Skip to content

Commit d4e0467

Browse files
authored
Re-implement Tabs component using Radix (#1061)
* feat(tabs): re-implement tabs component using radix ui * feat(tabs): add tabs storybook * chore(tabs): add index.ts to resolve typecheck failed * feat(tabs): give Tabs.Trigger's props directly to Button component * fix(tabs): resolve typecheck error * feat(tabs): add TabsContent * feat(tabs): change tabAction element from div to button * feat(tabs): rename tabs-related components to be singular * fix(tabs): fix TabsProps to have ReactNode as children * feat(tabs): add test code for Tabs component * feat(tabs): export old tabs as LegacyTabs * chore(changeset): add changeset * chore(tabs): remove unnecessary font-weight style in TabAction * feat(tabs): add test code for tab list in regard to a11n * refactor(tabs): apply style to TabsPrimitive.Root directly * refactor(tabs): change height in interface to size * feat(tabs): add html attributes props to TabItem, TabList, and TabAction * deps(toolbar): add radix-toolbar package * feat(tabs): add TabItems and TabActions * feat(tabs): fix test-code as changed Tabs component anatomy and add test code for tabaction(wip) * fix(tabs): fix use example of tabs component * fix(tabs): make TabsProps and TabActions extend BezerComponentProps * docs(tabs): add js-docs for tab components * fix(tabs): remove DisableProps from TabAction * feat(tabs): add test code for tab actions * feat(storybook): add tabs related components as subcomponent in storybook * fix(tabs): forward ref directly to TabAction component * feat(tabs): add test code with home and end keyboard * fix(storybook): fix TabsComposition story to change value with mouse click * fix(tabs): change TabAction interface to have proper interface depending on href is given or not * chore(tabs): rename TabActionElement interface as TabActionElementBy * feat(tabs): add activation animation using css animation * chore(tabs): remove unnecessary will-change property * refactor(tabs): css-animation 을 transition 으로 변경 * chore(tabs): fix typo (TabsListContextValue -> TabListContextValue) * refactor(tabs): use semantic value for tabsize instead of px size * refactor(tabs): remove unnecessary type assertion with TabAction component * fix(tabs): add missed ref forwarding * feat(tabs): add activation mode to props of Tabs component and test code associated with it * refactor(tabs/style): replace tabsize prop with css variable * chore(tabitem): remove unncessary will-change property
1 parent e1550c5 commit d4e0467

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1201
-21
lines changed

.changeset/mean-garlics-speak.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
"@channel.io/bezier-react": minor
3+
---
4+
5+
Re-implement `Tabs` component
6+
7+
BREAKING_CHANGES
8+
9+
- The existing `Tabs` is renamed `LegacyTabs` and will be removed from following PR.
10+
- No longer use selectedOptionIndex in `Tabs`
11+
- Some props such as `withIndicator`, `optionKey` are removed from `TabItem`
12+
- Wrap with `TabContent` component for tab panel

packages/bezier-react/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@
121121
"@radix-ui/react-separator": "^1.0.0",
122122
"@radix-ui/react-slider": "^1.0.0",
123123
"@radix-ui/react-switch": "^1.0.1",
124+
"@radix-ui/react-tabs": "^1.0.1",
125+
"@radix-ui/react-toolbar": "^1.0.1",
124126
"lodash-es": "^4.17.15",
125127
"react-resize-detector": "^7.1.1",
126128
"react-textarea-autosize": "^8.3.4",

packages/bezier-react/src/components/Tabs/TabAction/TabAction.tsx renamed to packages/bezier-react/src/components/Tabs/LegacyTabs/TabAction/TabAction.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { get, isNil, noop } from 'lodash-es'
66
import { Typography } from 'Foundation'
77
import { Text } from 'Components/Text'
88
import { IconSize, OpenInNewIcon } from 'Components/Icon'
9-
import TabsSize from 'Components/Tabs/TabsSize'
9+
import TabsSize from 'Components/Tabs/LegacyTabs/TabsSize'
1010
import TabActionProps from './TabAction.types'
1111
import { Wrapper, Background, LinkIcon } from './TabAction.styled'
1212

packages/bezier-react/src/components/Tabs/TabAction/TabAction.types.ts renamed to packages/bezier-react/src/components/Tabs/LegacyTabs/TabAction/TabAction.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react'
33

44
/* Internal dependencies */
55
import { BezierComponentProps, DisableProps, LinkProps, ChildrenProps } from 'Types/ComponentProps'
6-
import type TabsOptions from 'Components/Tabs/Tabs.types'
6+
import type TabsOptions from 'Components/Tabs/LegacyTabs/Tabs.types'
77

88
interface TabActionOptions extends ChildrenProps {
99
onClick?: React.MouseEventHandler

packages/bezier-react/src/components/Tabs/TabItem/TabItem.stories.tsx renamed to packages/bezier-react/src/components/Tabs/LegacyTabs/TabItem/TabItem.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Story, Meta } from '@storybook/react'
55

66
/* Internal dependencies */
77
import { getObjectFromEnum, getTitle } from 'Utils/storyUtils'
8-
import TabsSize from 'Components/Tabs/TabsSize'
8+
import TabsSize from 'Components/Tabs/LegacyTabs/TabsSize'
99
import TabItem from './TabItem'
1010
import TabItemProps from './TabItem.types'
1111

packages/bezier-react/src/components/Tabs/TabItem/TabItem.tsx renamed to packages/bezier-react/src/components/Tabs/LegacyTabs/TabItem/TabItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { get, noop } from 'lodash-es'
66
import { Typography } from 'Foundation'
77
import { mergeClassNames } from 'Utils/stringUtils'
88
import { Text } from 'Components/Text'
9-
import TabsSize from 'Components/Tabs/TabsSize'
9+
import TabsSize from 'Components/Tabs/LegacyTabs/TabsSize'
1010
import TabItemProps from './TabItem.types'
1111
import { Wrapper, Background } from './TabItem.styled'
1212

0 commit comments

Comments
 (0)