Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migrate from reakit to ariakit #2101

Merged
merged 57 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
21b6b35
feat: migrate Button
theo-mesnil Jun 21, 2023
cfdf030
chore: upgrade watch script
theo-mesnil Jun 21, 2023
d4c97af
docs: change reakit to ariakit on package json keywords
theo-mesnil Jun 21, 2023
1e5c06f
feat: migrate Accordion
theo-mesnil Jun 21, 2023
bc879f0
docs: change reakit to ariakit on package json description
theo-mesnil Jun 21, 2023
b79f3c4
test: add missing tests on Accordion
theo-mesnil Jun 21, 2023
abbda9c
feat: migrate Checkbox
theo-mesnil Jun 21, 2023
b3aa639
feat: migrate Popover
theo-mesnil Jun 21, 2023
9b30e3a
feat: migrate Popover on EmojiPicker
theo-mesnil Jun 21, 2023
7153785
refactor: rename hooks
theo-mesnil Jun 28, 2023
14dbc55
feat: migrate Tabs and EmojiPicker
theo-mesnil Jun 28, 2023
388f927
feat: migrate Pagination
theo-mesnil Jun 28, 2023
b4fa159
feat: migrate Radio
theo-mesnil Jul 12, 2023
4641957
feat: migrate RadioGroup and RadioTab
theo-mesnil Jul 12, 2023
f8162e9
feat: migrate Toggle
theo-mesnil Jul 13, 2023
8bbfe5d
feat: migrate Tooltip component
theo-mesnil Jul 20, 2023
ce1d5fe
feat: migrate Picker component
theo-mesnil Jul 20, 2023
fc7dc5e
feat: migrate Modal component
theo-mesnil Jul 20, 2023
e8d52ff
feat: migrate Drawer component
theo-mesnil Jul 24, 2023
86ab8e6
feat: migrate DropdownMenu component
theo-mesnil Jul 24, 2023
a0710c1
feat: remove last reakit words
theo-mesnil Jul 24, 2023
cc3bb9c
fix: ci checkoutx
theo-mesnil Jul 24, 2023
8cccc2c
fix: remove modal prop en Drawer
theo-mesnil Jul 24, 2023
4d695b6
chore: fix version of ariakit
theo-mesnil Jul 24, 2023
fc2cdaa
docs: add missing docs for migration
theo-mesnil Jul 27, 2023
e4c83e2
chore: upgrade to ariakit 0.2.14
theo-mesnil Jul 27, 2023
942795d
fix: dropdown ùenu with alwaysvisible
theo-mesnil Jul 27, 2023
2cc318c
docs: fix page name
theo-mesnil Jul 27, 2023
2dc2a9e
Update docs/pages/components/drawer.mdx
theo-mesnil Aug 2, 2023
fd3e13b
Update docs/pages/components/drawer.mdx
theo-mesnil Aug 2, 2023
0e9c946
Update docs/pages/components/emoji-picker.mdx
theo-mesnil Aug 2, 2023
9038e4c
Update docs/pages/components/emoji-picker.mdx
theo-mesnil Aug 2, 2023
33a197e
Update docs/pages/components/emoji-picker.mdx
theo-mesnil Aug 2, 2023
86319bb
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
6d66f7c
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
872f0f4
Update docs/pages/upgrades/v4.mdx
theo-mesnil Aug 2, 2023
9bc1415
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
7747f3a
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
a9dda88
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
f01aa50
Update docs/pages/components/toast.mdx
theo-mesnil Aug 2, 2023
223a39f
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
2b0374b
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
d678fc8
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
4a25d0e
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
1a8f263
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
6ffa1ae
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
7257c2e
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
500f7a0
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
a94d148
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
bca81db
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
b6ce2d3
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
76e544b
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
ad4dc64
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
237f6b6
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
5b2c9d5
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
09e27cd
Update docs/pages/upgrade.mdx
theo-mesnil Aug 2, 2023
99250ca
fix: wrong css and some js
theo-mesnil Aug 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/tech-feature-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ body:
attributes:
label: 'Implementation'
description: 'If possible, describe how this feature could be implemented.'
placeholder: 'See [CONTRIBUTING.mdx](https://github.com/reakit/reakit/blob/master/CONTRIBUTING.mdx)'
placeholder: 'See [CONTRIBUTING.mdx](https://github.com/WTTJ/welcome-ui/blob/master/CONTRIBUTING.mdx)'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<img src="docs/public/illustration.png" width="300" />

Welcome to the _Welcome UI library_ created by [Welcome to the jungle](https://www.welcometothejungle.com), a customizable design system with react • typescript • styled-components • styled-system and reakit.
Welcome to the _Welcome UI library_ created by [Welcome to the jungle](https://www.welcometothejungle.com), a customizable design system with react • typescript • styled-components • styled-system and ariakit.

Here you'll find all the core components you need to create a delightful webapp.

Expand Down
2 changes: 2 additions & 0 deletions docs/components/GlobalStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export const GlobalStyle = createGlobalStyle`
}
.DocSearch {
transition: none !important;
&-Button {
margin: 0;
width: 100%;
Expand Down
4 changes: 2 additions & 2 deletions docs/components/Head.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ export function Head() {
<meta content="@wttj_fr" name="twitter:create" />
<meta content="Welcome UI - Customizable design system with react" property="twitter:title" />
<meta
content="Here you'll find all the core components you need to create a delightful webapp. Customizable design system from Welcome to the jungle with react, typescript, styled-components, reakit and a lot of love 💛"
content="Here you'll find all the core components you need to create a delightful webapp. Customizable design system from Welcome to the jungle with react, typescript, styled-components, ariakit and a lot of love 💛"
property="twitter:description"
/>
<meta content="https://www.welcome-ui.com" property="og:url" />
<meta content="Welcome UI - Customizable design system with react" property="og:title" />
<meta
content="Here you'll find all the core components you need to create a delightful webapp. Customizable design system from Welcome to the jungle with react, typescript, styled-components, reakit and a lot of love 💛"
content="Here you'll find all the core components you need to create a delightful webapp. Customizable design system from Welcome to the jungle with react, typescript, styled-components, ariakit and a lot of love 💛"
property="og:description"
/>
<meta content="https://www.welcome-ui.com/og-image.png" property="og:image" />
Expand Down
18 changes: 12 additions & 6 deletions docs/components/Header/ThemeSelector.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { DropdownMenu, useDropdownMenuState } from '@welcome-ui/dropdown-menu'
import { DropdownMenu, useDropdownMenu } from '@welcome-ui/dropdown-menu'
import { Box } from '@welcome-ui/box'
import { CrescentMoonIcon, StarIcon, StarOutlineIcon, SunIcon } from '@welcome-ui/icons'
import { Button } from '@welcome-ui/button'
Expand All @@ -9,12 +9,12 @@ import { useSetThemeContext, useThemeContext } from '../../context/theme'

export const ThemeSelector = props => {
const setTheme = useSetThemeContext()
const menuState = useDropdownMenuState({ gutter: 10 })
const dropdownMenu = useDropdownMenu()
const theme = useThemeContext()

const handleSetTheme = theme => {
setTheme(theme)
menuState.hide()
dropdownMenu.hide()
}

const options = [
Expand All @@ -26,17 +26,23 @@ export const ThemeSelector = props => {

return (
<>
<DropdownMenu.Trigger as={Button} h={30} shape="circle" state={menuState} w={30} {...props}>
<DropdownMenu.Trigger
as={Button}
h={30}
shape="circle"
store={dropdownMenu}
w={30}
{...props}
>
<SunIcon />
</DropdownMenu.Trigger>
<DropdownMenu aria-label="Theme selector" state={menuState}>
<DropdownMenu aria-label="Theme selector" store={dropdownMenu}>
{options?.map(({ icon: Icon, isBeta, label, value }) => (
<DropdownMenu.Item
color={theme === value ? 'dark-900' : undefined}
fontWeight={theme === value ? 'bold' : undefined}
key={value}
onClick={() => handleSetTheme(value)}
state={menuState}
>
<Icon mr="md" size="sm" />
<Box>{label}</Box>
Expand Down
72 changes: 38 additions & 34 deletions docs/components/Header/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useEffect, useState } from 'react'
import React from 'react'
import { Box } from '@welcome-ui/box'
import { InformationIcon, MenuIcon } from '@welcome-ui/icons'
import NextLink from 'next/link'
import { Drawer, useDrawerState } from '@welcome-ui/drawer'
import { useModalState } from '@welcome-ui/modal'
import { Drawer, useDrawer } from '@welcome-ui/drawer'
import { useModal } from '@welcome-ui/modal'
import { Button } from '@welcome-ui/button'
import { CrossIcon } from '@welcome-ui/icons'
import { DocSearch } from '@docsearch/react'
Expand All @@ -19,22 +19,16 @@ import * as S from './styles'
import { NavBar } from './NavBar'

export const Header = () => {
const mobileMenuDrawerState = useDrawerState()
const modalState = useModalState()
const mobileMenuDrawer = useDrawer()
const modal = useModal()
const { pathname } = useRouter()
const variants = {
'/': 'gray',
}
const variant = variants[pathname]
const [hasBeenHydrated, setHasBeenHydrated] = useState(false)

// Workaround for hydration warning UI for Reakit dialog (fix in ariakit 2.0)
useEffect(() => {
setHasBeenHydrated(true)
}, [])

function openThemeHelper() {
modalState.show()
modal.show()
}

return (
Expand All @@ -54,32 +48,42 @@ export const Header = () => {
placeholder="Search the docs"
/>
</Box>
<ThemeSelector ml="lg" />
<Button h={30} ml="xxs" onClick={openThemeHelper} shape="circle" variant="ghost" w={30}>
<ThemeSelector ml="lg" display={{ _: 'none', md: 'flex' }} />
<Button
h={30}
ml="xxs"
display={{ _: 'none', md: 'flex' }}
onClick={openThemeHelper}
shape="circle"
variant="ghost"
w={30}
>
<InformationIcon color="light-900" />
</Button>
</Box>
<NavBar display={{ xs: 'none', md: 'flex' }} />
{hasBeenHydrated && (
<>
<Drawer.Trigger
as={Button}
display={{ md: 'none' }}
shape="circle"
size="sm"
state={mobileMenuDrawerState}
>
{mobileMenuDrawerState.visible ? <CrossIcon /> : <MenuIcon />}
</Drawer.Trigger>
<Drawer.Backdrop backdropVisible={false} state={mobileMenuDrawerState}>
<S.MenuMobileDrawer aria-label="Menu backdrop" state={mobileMenuDrawerState}>
<NavBar drawerState={mobileMenuDrawerState} isMobileMenu mb="lg" />
<ComponentsList onClick={() => mobileMenuDrawerState.hide()} />
</S.MenuMobileDrawer>
</Drawer.Backdrop>
</>
)}
<ThemeHelper modalState={modalState} />
<>
<Drawer.Trigger
flexShrink={0}
as={Button}
display={{ md: 'none' }}
shape="circle"
size="sm"
store={mobileMenuDrawer}
>
{mobileMenuDrawer.open ? <CrossIcon /> : <MenuIcon />}
</Drawer.Trigger>
<S.MenuMobileDrawer
withBackdrop={false}
store={mobileMenuDrawer}
aria-label="Menu backdrop"
withCloseButton={false}
>
<NavBar drawerState={mobileMenuDrawer} isMobileMenu mb="lg" />
<ComponentsList onClick={() => mobileMenuDrawer.hide()} />
</S.MenuMobileDrawer>
</>
<ThemeHelper modalStore={modal} />
</S.Header>
)
}
2 changes: 1 addition & 1 deletion docs/components/Header/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const Header = styled.header(
)

export const MenuMobileDrawer = styled(WUIDrawer)`
top: ${`calc(${headerHeight} - 1px)`} !important;
margin-top: ${`calc(${headerHeight} - 1px)`} !important;
width: 100% !important;
padding: lg;
Expand Down
2 changes: 1 addition & 1 deletion docs/components/Homepage/Expectations.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const expectations = [
title: 'Accessibility',
icon: UserIcon,
description:
'We are trying to offer an accessible experience as much as we can, using Reakit for instance.',
'We are trying to offer an accessible experience as much as we can, using Ariakit for instance.',
},
{
title: 'Typing',
Expand Down
4 changes: 2 additions & 2 deletions docs/components/Mdx/Code/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { yupResolver } from '@hookform/resolvers/yup'
import dynamic from 'next/dynamic'

// Welcome UI
import { Accordion } from '@welcome-ui/accordion'
import * as Accordion from '@welcome-ui/accordion'
import { Alert } from '@welcome-ui/alert'
import { AspectRatio } from '@welcome-ui/aspect-ratio'
import { Avatar } from '@welcome-ui/avatar'
Expand Down Expand Up @@ -121,7 +121,7 @@ export const Code = ({
language,
transformCode: () => transformCode(editorCode, row),
scope: {
Accordion,
...Accordion,
Alert,
AspectRatio,
Avatar,
Expand Down
8 changes: 8 additions & 0 deletions docs/components/Mdx/Code/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ export const LiveEditorContent = styled(ReactLiveEditor)(
`}
overflow-x: auto;
.inserted-sign {
color: sub-5 !important;
}
.deleted-sign {
color: danger-300 !important;
}
textarea,
pre {
background-color: black !important;
Expand Down
4 changes: 2 additions & 2 deletions docs/components/Mdx/InlineCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export const InlineCode = styled.code`
background-color: transparent;
font-family: inherit;
font-size: inherit;
font-weight: bold;
color: sub-3;
font-weight: medium;
color: sub-2;
`
2 changes: 1 addition & 1 deletion docs/components/Mdx/Showcase/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function Showcase({
<Box backgroundColor="nude-100" maxW="100% !important">
<Box m="0 auto" maxW={970} px={{ md: 'md' }} py={{ xs: 'xxl', md: '4xl' }}>
<H1 mb="0" pb="sm" pt="0">
{pageName || component}
{component?.split(',')?.[0]}
</H1>
{description && <Text variant="body1">{description}</Text>}
<Box mt="4xl">
Expand Down
88 changes: 42 additions & 46 deletions docs/components/ThemeHelper.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
import { Box } from '@welcome-ui/box'
import { Modal } from '@welcome-ui/modal'
import { Tab, useTabState } from '@welcome-ui/tabs'
import { Tab, useTab } from '@welcome-ui/tabs'
import { Text } from '@welcome-ui/text'
import { useEffect, useState } from 'react'
import { useEffect } from 'react'

import { useThemeContext } from '../context/theme'

import { ThemeConfiguration } from './ThemeConfiguration'

const KEY_CODE_HELP = 'KeyI'

export const ThemeHelper = ({ modalState }) => {
export const ThemeHelper = ({ modalStore }) => {
const currentTheme = useThemeContext()
const [hasBeenHydrated, setHasBeenHydrated] = useState(false)
const tabState = useTabState({ orientation: 'vertical' })
const tab = useTab({ orientation: 'vertical' })

const categories = ['colors', 'space', 'screens', 'fontSizes', 'fontWeights']
const [defaultTab] = categories
const title = `${currentTheme.at(0).toUpperCase()}${currentTheme.slice(1)} Theme`

// Workaround for hydration warning UI for Reakit dialog (fix in ariakit 2.0)
useEffect(() => {
setHasBeenHydrated(true)

const onKeyboardEvent = event => {
if (event.metaKey && event.code === KEY_CODE_HELP) modal.show()
if (event.metaKey && event.code === KEY_CODE_HELP) {
modalStore.show()
}
}

window.addEventListener('keydown', onKeyboardEvent)
Expand All @@ -33,49 +31,47 @@ export const ThemeHelper = ({ modalState }) => {
}, [])

useEffect(() => {
tabState.select(defaultTab)
tab.select(defaultTab)
}, [currentTheme])

return (
<>
{hasBeenHydrated && (
<Modal ariaLabel="theme configuration" state={modalState} title={title}>
<Modal.Content>
<Modal.Header subtitle="Documentation for the core theme entries" title={title} />
<Modal.Body mt="xl">
<Box display="flex">
<Tab.List aria-label="Tabs" mr="lg" state={tabState} w={200}>
{categories.map(category => (
<Tab id={category} key={category} state={tabState}>
{category}
</Tab>
))}
</Tab.List>

<Modal ariaLabel="theme configuration" store={modalStore} title={title}>
<Modal.Content store={modalStore}>
<Modal.Header subtitle="Documentation for the core theme entries" title={title} />
<Modal.Body mt="xl">
<Box display="flex">
<Tab.List aria-label="Tabs" mr="lg" store={tab} w={200}>
{categories.map(category => (
<Tab.Panel key={category} state={tabState} tabId={category}>
<Box
columnGap={16}
display="grid"
gridTemplateColumns="1fr 1fr"
mb="md"
rowGap={8}
>
<Text mb="md" mt="0" variant="h5">
Key
</Text>
<Text mb="md" mt="0" variant="h5">
Value
</Text>
<ThemeConfiguration category={category} />
</Box>
</Tab.Panel>
<Tab id={category} key={category} store={tab}>
{category}
</Tab>
))}
</Box>
</Modal.Body>
</Modal.Content>
</Modal>
)}
</Tab.List>

{categories.map(category => (
<Tab.Panel key={category} store={tab} tabId={category}>
<Box
columnGap={16}
display="grid"
gridTemplateColumns="1fr 1fr"
mb="md"
rowGap={8}
>
<Text mb="md" mt="0" variant="h5">
Key
</Text>
<Text mb="md" mt="0" variant="h5">
Value
</Text>
<ThemeConfiguration category={category} />
</Box>
</Tab.Panel>
))}
</Box>
</Modal.Body>
</Modal.Content>
</Modal>
</>
)
}
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"keywords": [
"design-system",
"react",
"reakit",
"ariakit",
"styled-components",
"styled-system",
"ui-library",
Expand Down
Loading