@kaizen/components 1.68.10 → 1.68.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Tag/Tag.cjs +2 -33
- package/dist/cjs/Tag/Tag.module.scss.cjs +1 -8
- package/dist/cjs/Tag/subcomponents/LiveIcon/LiveIcon.cjs +56 -0
- package/dist/cjs/Tag/subcomponents/LiveIcon/LiveIcon.module.css.cjs +12 -0
- package/dist/cjs/Tile/TileGrid/TileGrid.cjs +19 -2
- package/dist/cjs/__future__/Tabs/constants.cjs +4 -0
- package/dist/cjs/__future__/Tabs/subcomponents/Tab/Tab.cjs +3 -1
- package/dist/cjs/__future__/Tabs/subcomponents/TabList/TabList.cjs +117 -3
- package/dist/cjs/__future__/Tabs/subcomponents/TabList/TabList.module.css.cjs +4 -1
- package/dist/cjs/__utilities__/isRTL/isRTL.cjs +11 -0
- package/dist/esm/Tag/Tag.mjs +2 -33
- package/dist/esm/Tag/Tag.module.scss.mjs +1 -8
- package/dist/esm/Tag/subcomponents/LiveIcon/LiveIcon.mjs +54 -0
- package/dist/esm/Tag/subcomponents/LiveIcon/LiveIcon.module.css.mjs +10 -0
- package/dist/esm/Tile/TileGrid/TileGrid.mjs +19 -2
- package/dist/esm/__future__/Tabs/constants.mjs +2 -0
- package/dist/esm/__future__/Tabs/subcomponents/Tab/Tab.mjs +3 -1
- package/dist/esm/__future__/Tabs/subcomponents/TabList/TabList.mjs +121 -5
- package/dist/esm/__future__/Tabs/subcomponents/TabList/TabList.module.css.mjs +4 -1
- package/dist/esm/__utilities__/isRTL/isRTL.mjs +9 -0
- package/dist/styles.css +155 -87
- package/dist/types/Tag/subcomponents/LiveIcon/LiveIcon.d.ts +4 -0
- package/dist/types/Tag/subcomponents/LiveIcon/index.d.ts +1 -0
- package/dist/types/Tag/subcomponents/index.d.ts +1 -0
- package/dist/types/Tile/TileGrid/TileGrid.d.ts +1 -1
- package/dist/types/__future__/Tabs/constants.d.ts +1 -0
- package/dist/types/__future__/Tabs/subcomponents/TabList/TabList.d.ts +1 -0
- package/dist/types/__utilities__/isRTL/index.d.ts +1 -0
- package/dist/types/__utilities__/isRTL/isRTL.d.ts +5 -0
- package/package.json +3 -3
- package/src/Tag/Tag.module.scss +0 -92
- package/src/Tag/Tag.tsx +2 -37
- package/src/Tag/subcomponents/LiveIcon/LiveIcon.module.css +91 -0
- package/src/Tag/subcomponents/LiveIcon/LiveIcon.tsx +48 -0
- package/src/Tag/subcomponents/LiveIcon/index.ts +1 -0
- package/src/Tag/subcomponents/index.ts +1 -0
- package/src/Tile/TileGrid/TileGrid.module.scss +1 -0
- package/src/Tile/TileGrid/TileGrid.tsx +32 -7
- package/src/Tile/TileGrid/_docs/TileGrid.stickersheet.stories.tsx +40 -0
- package/src/Tile/TileGrid/_docs/TileGrid.stories.tsx +78 -1
- package/src/Workflow/_docs/ProgressStepper.stickersheet.stories.tsx +59 -0
- package/src/Workflow/subcomponents/Footer/components/ProgressStepper/ProgressStepper.module.css +6 -0
- package/src/__future__/Tabs/_docs/Tabs.spec.stories.tsx +118 -0
- package/src/__future__/Tabs/_docs/Tabs.stickersheet.stories.tsx +84 -0
- package/src/__future__/Tabs/_docs/Tabs.stories.tsx +12 -1
- package/src/__future__/Tabs/constants.ts +1 -0
- package/src/__future__/Tabs/subcomponents/Tab/Tab.tsx +1 -1
- package/src/__future__/Tabs/subcomponents/TabList/TabList.module.css +53 -1
- package/src/__future__/Tabs/subcomponents/TabList/TabList.tsx +138 -10
- package/src/__future__/Tag/Tag/_docs/Tag-migration-guide.stories.tsx +24 -64
- package/src/__utilities__/isRTL/index.ts +1 -0
- package/src/__utilities__/isRTL/isRTL.spec.tsx +38 -0
- package/src/__utilities__/isRTL/isRTL.ts +6 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
.liveIcon {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
position: relative;
|
|
4
|
+
width: 20px;
|
|
5
|
+
height: 20px;
|
|
6
|
+
margin-inline-start: 0.25rem;
|
|
7
|
+
color: var(--color-green-500);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.liveIcon_base {
|
|
11
|
+
opacity: 0.3;
|
|
12
|
+
display: block;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.liveIcon_1,
|
|
16
|
+
.liveIcon_2,
|
|
17
|
+
.liveIcon_3 {
|
|
18
|
+
display: block;
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: 0;
|
|
21
|
+
left: 0;
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
aspect-ratio: 1;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.liveIcon_1 {
|
|
29
|
+
clip-path: circle(16%);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.liveIcon_2,
|
|
33
|
+
.liveIcon_3 {
|
|
34
|
+
animation-duration: 3s;
|
|
35
|
+
animation-iteration-count: 3;
|
|
36
|
+
animation-delay: 1s;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.liveIcon_2 {
|
|
40
|
+
clip-path: circle(32%);
|
|
41
|
+
animation-name: pulse-inner;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.liveIcon_3 {
|
|
45
|
+
clip-path: circle(50%);
|
|
46
|
+
animation-name: pulse-outer;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@keyframes pulse-inner {
|
|
50
|
+
0% {
|
|
51
|
+
opacity: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
25% {
|
|
55
|
+
opacity: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
50% {
|
|
59
|
+
opacity: 1;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
75% {
|
|
63
|
+
opacity: 1;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
100% {
|
|
67
|
+
opacity: 1;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@keyframes pulse-outer {
|
|
72
|
+
0% {
|
|
73
|
+
opacity: 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
25% {
|
|
77
|
+
opacity: 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
50% {
|
|
81
|
+
opacity: 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
75% {
|
|
85
|
+
opacity: 1;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
100% {
|
|
89
|
+
opacity: 1;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// This file is autogenerated by wrapSVGs.ts
|
|
2
|
+
// Changes to this file will be overwritten
|
|
3
|
+
|
|
4
|
+
import React from 'react'
|
|
5
|
+
import { SVG } from '~components/Icon/subcomponents/SVG'
|
|
6
|
+
import styles from './LiveIcon.module.css'
|
|
7
|
+
|
|
8
|
+
type LiveIconSvgProps = { classNameOverride: string }
|
|
9
|
+
|
|
10
|
+
const LiveIconSvg = ({ classNameOverride }: LiveIconSvgProps): JSX.Element => (
|
|
11
|
+
<SVG
|
|
12
|
+
role="presentation"
|
|
13
|
+
width="16"
|
|
14
|
+
height="16"
|
|
15
|
+
viewBox="0 0 16 16"
|
|
16
|
+
fill="none"
|
|
17
|
+
classNameOverride={classNameOverride}
|
|
18
|
+
>
|
|
19
|
+
<path
|
|
20
|
+
stroke="currentColor"
|
|
21
|
+
d="M3.266 12.733c-2.6-2.6-2.6-6.866 0-9.466M5.2 10.8c-1.534-1.533-1.534-4.067 0-5.667"
|
|
22
|
+
strokeWidth="1.5"
|
|
23
|
+
strokeLinejoin="round"
|
|
24
|
+
strokeLinecap="round"
|
|
25
|
+
/>
|
|
26
|
+
<path fill="currentColor" d="M8 10a2 2 0 1 0 0-4 2 2 0 0 0 0 4" />
|
|
27
|
+
<path
|
|
28
|
+
stroke="currentColor"
|
|
29
|
+
d="M10.8 5.2c1.533 1.533 1.533 4.067 0 5.667M12.733 3.267c2.6 2.6 2.6 6.8 0 9.4"
|
|
30
|
+
strokeWidth="1.5"
|
|
31
|
+
strokeLinejoin="round"
|
|
32
|
+
strokeLinecap="round"
|
|
33
|
+
/>
|
|
34
|
+
</SVG>
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
LiveIconSvg.displayName = 'LiveIconSvg'
|
|
38
|
+
|
|
39
|
+
export const LiveIcon = (): JSX.Element => (
|
|
40
|
+
<span className={styles.liveIcon}>
|
|
41
|
+
<LiveIconSvg classNameOverride={styles.liveIcon_base} />
|
|
42
|
+
<LiveIconSvg classNameOverride={styles.liveIcon_1} />
|
|
43
|
+
<LiveIconSvg classNameOverride={styles.liveIcon_2} />
|
|
44
|
+
<LiveIconSvg classNameOverride={styles.liveIcon_3} />
|
|
45
|
+
</span>
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
LiveIcon.displayName = 'LiveIcon'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LiveIcon'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LiveIcon'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { HTMLAttributes, ReactElement } from 'react'
|
|
1
|
+
import React, { HTMLAttributes, ReactElement, ReactNode } from 'react'
|
|
2
2
|
import classnames from 'classnames'
|
|
3
3
|
import { OverrideClassName } from '~components/types/OverrideClassName'
|
|
4
4
|
import { InformationTileProps } from '../InformationTile'
|
|
@@ -9,7 +9,7 @@ type TileProps = InformationTileProps | MultiActionTileProps
|
|
|
9
9
|
|
|
10
10
|
export type TileElement = ReactElement<TileProps>
|
|
11
11
|
|
|
12
|
-
export interface TileGridProps extends OverrideClassName<HTMLAttributes<
|
|
12
|
+
export interface TileGridProps extends OverrideClassName<HTMLAttributes<HTMLUListElement>> {
|
|
13
13
|
children: TileElement[] | TileElement
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -21,10 +21,35 @@ export const TileGrid = ({
|
|
|
21
21
|
children,
|
|
22
22
|
classNameOverride,
|
|
23
23
|
...restProps
|
|
24
|
-
}: TileGridProps): JSX.Element =>
|
|
25
|
-
|
|
26
|
-
{children}
|
|
27
|
-
</div>
|
|
28
|
-
)
|
|
24
|
+
}: TileGridProps): JSX.Element => {
|
|
25
|
+
const isFragment = !Array.isArray(children) && children.type === React.Fragment
|
|
29
26
|
|
|
27
|
+
return (
|
|
28
|
+
<ul className={classnames(styles.grid, classNameOverride)} data-tile-grid {...restProps}>
|
|
29
|
+
{isFragment ? (
|
|
30
|
+
children?.props?.children ? (
|
|
31
|
+
<TileListItem tiles={children.props.children} />
|
|
32
|
+
) : null
|
|
33
|
+
) : (
|
|
34
|
+
<TileListItem tiles={children} />
|
|
35
|
+
)}
|
|
36
|
+
</ul>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
30
39
|
TileGrid.displayName = 'TileGrid'
|
|
40
|
+
|
|
41
|
+
type TileListItemProps = { tiles: ReactNode }
|
|
42
|
+
|
|
43
|
+
const TileListItem = ({ tiles }: TileListItemProps): JSX.Element => {
|
|
44
|
+
if (Array.isArray(tiles)) {
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
{tiles.map((tile: TileElement, index) => (
|
|
48
|
+
<li key={`${tile.props.title}-${index}`}>{tile}</li>
|
|
49
|
+
))}
|
|
50
|
+
</>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return <li>{tiles}</li>
|
|
55
|
+
}
|
|
@@ -105,6 +105,46 @@ const StickerSheetTemplate: StickerSheetStory = {
|
|
|
105
105
|
/>
|
|
106
106
|
</TileGrid>
|
|
107
107
|
</StickerSheet.Row>
|
|
108
|
+
<StickerSheet.Row header="Single Tile">
|
|
109
|
+
<TileGrid>
|
|
110
|
+
<InformationTile
|
|
111
|
+
title="Title"
|
|
112
|
+
metadata="Side A"
|
|
113
|
+
information="Side B"
|
|
114
|
+
footer={<>Footer</>}
|
|
115
|
+
/>
|
|
116
|
+
</TileGrid>
|
|
117
|
+
</StickerSheet.Row>
|
|
118
|
+
<StickerSheet.Row header="Fragment">
|
|
119
|
+
<TileGrid>
|
|
120
|
+
<>
|
|
121
|
+
<InformationTile
|
|
122
|
+
title="Title"
|
|
123
|
+
metadata="Side A"
|
|
124
|
+
information="Side B"
|
|
125
|
+
footer={<>Footer</>}
|
|
126
|
+
/>
|
|
127
|
+
<InformationTile
|
|
128
|
+
title="Title"
|
|
129
|
+
metadata="Side A"
|
|
130
|
+
information="Side B"
|
|
131
|
+
footer={<>Footer</>}
|
|
132
|
+
/>
|
|
133
|
+
<InformationTile
|
|
134
|
+
title="Title"
|
|
135
|
+
metadata="Side A"
|
|
136
|
+
information="Side B"
|
|
137
|
+
footer={<>Footer</>}
|
|
138
|
+
/>
|
|
139
|
+
<InformationTile
|
|
140
|
+
title="Title"
|
|
141
|
+
metadata="Side A"
|
|
142
|
+
information="Side B"
|
|
143
|
+
footer={<>Footer</>}
|
|
144
|
+
/>
|
|
145
|
+
</>
|
|
146
|
+
</TileGrid>
|
|
147
|
+
</StickerSheet.Row>
|
|
108
148
|
</StickerSheet>
|
|
109
149
|
),
|
|
110
150
|
}
|
|
@@ -47,7 +47,6 @@ export const Playground: Story = {
|
|
|
47
47
|
},
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
// Test for multiple tiles, flipping one doesn't flip others
|
|
51
50
|
export const FlipOneNotOthers: Story = {
|
|
52
51
|
play: async ({ canvasElement, step }) => {
|
|
53
52
|
const canvas = within(canvasElement)
|
|
@@ -78,3 +77,81 @@ export const FlipOneNotOthers: Story = {
|
|
|
78
77
|
})
|
|
79
78
|
},
|
|
80
79
|
}
|
|
80
|
+
|
|
81
|
+
export const OneTile: Story = {
|
|
82
|
+
args: {
|
|
83
|
+
children: (
|
|
84
|
+
<InformationTile
|
|
85
|
+
title="Title A"
|
|
86
|
+
metadata="Side A"
|
|
87
|
+
information="Side A - Back"
|
|
88
|
+
footer={<>Footer</>}
|
|
89
|
+
/>
|
|
90
|
+
),
|
|
91
|
+
},
|
|
92
|
+
play: async ({ canvasElement, step }) => {
|
|
93
|
+
const canvas = within(canvasElement)
|
|
94
|
+
|
|
95
|
+
await step('Tile renders as <li>', async () => {
|
|
96
|
+
await waitFor(() => {
|
|
97
|
+
expect(canvas.getByRole('listitem')).toBeInTheDocument()
|
|
98
|
+
})
|
|
99
|
+
})
|
|
100
|
+
},
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export const MultipleTiles: Story = {
|
|
104
|
+
render: () => {
|
|
105
|
+
return (
|
|
106
|
+
<TileGrid>
|
|
107
|
+
<InformationTile
|
|
108
|
+
title="Title A"
|
|
109
|
+
metadata="Side A"
|
|
110
|
+
information="Side A - Back"
|
|
111
|
+
footer={<>Footer</>}
|
|
112
|
+
/>
|
|
113
|
+
<InformationTile
|
|
114
|
+
title="Title B"
|
|
115
|
+
metadata="Side B"
|
|
116
|
+
information="Side B - Back"
|
|
117
|
+
footer={<>Footer</>}
|
|
118
|
+
/>
|
|
119
|
+
<InformationTile
|
|
120
|
+
title="Title C"
|
|
121
|
+
metadata="Side C"
|
|
122
|
+
information="Side C - Back"
|
|
123
|
+
footer={<>Footer</>}
|
|
124
|
+
/>
|
|
125
|
+
</TileGrid>
|
|
126
|
+
)
|
|
127
|
+
},
|
|
128
|
+
play: async ({ canvasElement, step }) => {
|
|
129
|
+
const canvas = within(canvasElement)
|
|
130
|
+
|
|
131
|
+
await step('All Tiles marked up as individual <li> elements', async () => {
|
|
132
|
+
await waitFor(() => {
|
|
133
|
+
const listOfTiles = canvas.getByRole('list')
|
|
134
|
+
const { getAllByRole } = within(listOfTiles)
|
|
135
|
+
const tiles = getAllByRole('listitem')
|
|
136
|
+
|
|
137
|
+
expect(tiles.length).toBe(3)
|
|
138
|
+
})
|
|
139
|
+
})
|
|
140
|
+
},
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export const Fragment: Story = {
|
|
144
|
+
play: async ({ canvasElement, step }) => {
|
|
145
|
+
const canvas = within(canvasElement)
|
|
146
|
+
|
|
147
|
+
await step('All Tiles marked up as individual <li> elements', async () => {
|
|
148
|
+
await waitFor(() => {
|
|
149
|
+
const listOfTiles = canvas.getByRole('list')
|
|
150
|
+
const { getAllByRole } = within(listOfTiles)
|
|
151
|
+
const tiles = getAllByRole('listitem')
|
|
152
|
+
|
|
153
|
+
expect(tiles.length).toBe(3)
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
},
|
|
157
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Meta } from '@storybook/react'
|
|
3
|
+
import { StickerSheet, StickerSheetStory } from '~storybook/components/StickerSheet'
|
|
4
|
+
import { ProgressStepper } from '../subcomponents'
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Layout/Workflow/Components/Progress Stepper',
|
|
8
|
+
parameters: {
|
|
9
|
+
chromatic: { disable: false },
|
|
10
|
+
controls: { disable: true },
|
|
11
|
+
},
|
|
12
|
+
} satisfies Meta
|
|
13
|
+
|
|
14
|
+
const StickerSheetTemplate: StickerSheetStory = {
|
|
15
|
+
render: () => (
|
|
16
|
+
<StickerSheet layout="stretch">
|
|
17
|
+
<StickerSheet.Row header="Progress States">
|
|
18
|
+
<ProgressStepper
|
|
19
|
+
currentStepId="preview-step"
|
|
20
|
+
steps={[
|
|
21
|
+
{
|
|
22
|
+
id: 'settings-step',
|
|
23
|
+
label: 'Settings',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 'questions-step',
|
|
27
|
+
label: 'Questions',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 'preview-step',
|
|
31
|
+
label: 'Preview',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'employees-step',
|
|
35
|
+
label: 'Employees',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'schedule-step',
|
|
39
|
+
label: 'Schedule',
|
|
40
|
+
},
|
|
41
|
+
]}
|
|
42
|
+
/>
|
|
43
|
+
</StickerSheet.Row>
|
|
44
|
+
</StickerSheet>
|
|
45
|
+
),
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const StickerSheetDefault: StickerSheetStory = {
|
|
49
|
+
...StickerSheetTemplate,
|
|
50
|
+
name: 'Sticker Sheet (Default)',
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const StickerSheetRTL: StickerSheetStory = {
|
|
54
|
+
...StickerSheetTemplate,
|
|
55
|
+
name: 'Sticker Sheet (RTL)',
|
|
56
|
+
parameters: {
|
|
57
|
+
textDirection: 'rtl',
|
|
58
|
+
},
|
|
59
|
+
}
|
package/src/Workflow/subcomponents/Footer/components/ProgressStepper/ProgressStepper.module.css
CHANGED
|
@@ -84,6 +84,12 @@
|
|
|
84
84
|
/* sets fron the bottom to the centre of the dot */
|
|
85
85
|
top: calc(100% - calc(var(--progress-stepper-indicator-size) / 2));
|
|
86
86
|
transform: translateX(-50%);
|
|
87
|
+
|
|
88
|
+
:dir(rtl) & {
|
|
89
|
+
left: unset;
|
|
90
|
+
right: 100%;
|
|
91
|
+
transform: translateX(50%);
|
|
92
|
+
}
|
|
87
93
|
}
|
|
88
94
|
|
|
89
95
|
.stepperDescription {
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
import { within, userEvent, expect } from '@storybook/test'
|
|
4
|
+
import { Text } from '~components/Text'
|
|
5
|
+
import { Tab, TabList, TabPanel, Tabs } from '../index'
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Components/Tabs/Tabs (Future)/Tests',
|
|
9
|
+
parameters: {
|
|
10
|
+
controls: { disable: true },
|
|
11
|
+
},
|
|
12
|
+
args: {
|
|
13
|
+
children: (
|
|
14
|
+
<>
|
|
15
|
+
<TabList aria-label="Tabs" data-testid="sb-arrows">
|
|
16
|
+
<Tab id="one">Tab 1</Tab>
|
|
17
|
+
<Tab id="two">Tab 2</Tab>
|
|
18
|
+
<Tab id="three" badge="3">
|
|
19
|
+
Tab 3
|
|
20
|
+
</Tab>
|
|
21
|
+
<Tab id="disabled" isDisabled>
|
|
22
|
+
Disabled Tab
|
|
23
|
+
</Tab>
|
|
24
|
+
<Tab id="four">Tab 4</Tab>
|
|
25
|
+
<Tab id="five">Tab 5</Tab>
|
|
26
|
+
</TabList>
|
|
27
|
+
<TabPanel id="one" className="p-24">
|
|
28
|
+
<Text variant="body">Content 1</Text>
|
|
29
|
+
</TabPanel>
|
|
30
|
+
<TabPanel id="two" className="p-24">
|
|
31
|
+
<Text variant="body">Content 2</Text>
|
|
32
|
+
</TabPanel>
|
|
33
|
+
<TabPanel id="three" className="p-24">
|
|
34
|
+
<Text variant="body">Content 3</Text>
|
|
35
|
+
</TabPanel>
|
|
36
|
+
<TabPanel id="disabled" className="p-24">
|
|
37
|
+
<Text variant="body">Disabled content</Text>
|
|
38
|
+
</TabPanel>
|
|
39
|
+
<TabPanel id="four" className="p-24">
|
|
40
|
+
<Text variant="body">Content 4</Text>
|
|
41
|
+
</TabPanel>
|
|
42
|
+
<TabPanel id="five" className="p-24">
|
|
43
|
+
<Text variant="body">Content 5</Text>
|
|
44
|
+
</TabPanel>
|
|
45
|
+
</>
|
|
46
|
+
),
|
|
47
|
+
},
|
|
48
|
+
} satisfies Meta<typeof Tabs>
|
|
49
|
+
|
|
50
|
+
export default meta
|
|
51
|
+
|
|
52
|
+
type Story = StoryObj<typeof meta>
|
|
53
|
+
|
|
54
|
+
export const ArrowsShowingAndHiding: Story = {
|
|
55
|
+
render: (args) => {
|
|
56
|
+
return (
|
|
57
|
+
<div style={{ maxWidth: '500px' }}>
|
|
58
|
+
<Tabs {...args} />
|
|
59
|
+
</div>
|
|
60
|
+
)
|
|
61
|
+
},
|
|
62
|
+
play: async ({ canvasElement }) => {
|
|
63
|
+
const canvas = within(canvasElement.parentElement!)
|
|
64
|
+
|
|
65
|
+
expect(canvas.queryByTestId('kz-tablist-left-arrow')).not.toBeInTheDocument()
|
|
66
|
+
|
|
67
|
+
const rightArrow = await canvas.findByTestId('sb-arrows-kz-tablist-right-arrow')
|
|
68
|
+
|
|
69
|
+
await userEvent.click(rightArrow)
|
|
70
|
+
await new Promise((r) => setTimeout(r, 500))
|
|
71
|
+
|
|
72
|
+
const leftArrow = await canvas.findByTestId('sb-arrows-kz-tablist-left-arrow')
|
|
73
|
+
|
|
74
|
+
expect(leftArrow).toBeInTheDocument()
|
|
75
|
+
expect(rightArrow).toBeInTheDocument()
|
|
76
|
+
|
|
77
|
+
await userEvent.click(rightArrow)
|
|
78
|
+
await new Promise((r) => setTimeout(r, 500))
|
|
79
|
+
|
|
80
|
+
expect(leftArrow).toBeInTheDocument()
|
|
81
|
+
expect(rightArrow).not.toBeInTheDocument()
|
|
82
|
+
},
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export const ArrowsShowingAndHidingRTL: Story = {
|
|
86
|
+
name: 'Arrows Showing and Hiding (RTL)',
|
|
87
|
+
parameters: {
|
|
88
|
+
textDirection: 'rtl',
|
|
89
|
+
},
|
|
90
|
+
render: (args) => {
|
|
91
|
+
return (
|
|
92
|
+
<div style={{ maxWidth: '500px' }}>
|
|
93
|
+
<Tabs {...args} />
|
|
94
|
+
</div>
|
|
95
|
+
)
|
|
96
|
+
},
|
|
97
|
+
play: async ({ canvasElement }) => {
|
|
98
|
+
const canvas = within(canvasElement.parentElement!)
|
|
99
|
+
|
|
100
|
+
expect(canvas.queryByTestId('kz-tablist-right-arrow')).not.toBeInTheDocument()
|
|
101
|
+
|
|
102
|
+
const leftArrow = await canvas.findByTestId('sb-arrows-kz-tablist-left-arrow')
|
|
103
|
+
|
|
104
|
+
await userEvent.click(leftArrow)
|
|
105
|
+
await new Promise((r) => setTimeout(r, 500))
|
|
106
|
+
|
|
107
|
+
const rightArrow = await canvas.findByTestId('sb-arrows-kz-tablist-right-arrow')
|
|
108
|
+
|
|
109
|
+
expect(leftArrow).toBeInTheDocument()
|
|
110
|
+
expect(rightArrow).toBeInTheDocument()
|
|
111
|
+
|
|
112
|
+
await userEvent.click(leftArrow)
|
|
113
|
+
await new Promise((r) => setTimeout(r, 500))
|
|
114
|
+
|
|
115
|
+
expect(rightArrow).toBeInTheDocument()
|
|
116
|
+
expect(leftArrow).not.toBeInTheDocument()
|
|
117
|
+
},
|
|
118
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Meta } from '@storybook/react'
|
|
3
|
+
import { Text } from '~components/Text'
|
|
4
|
+
import { StickerSheet, StickerSheetStory } from '~storybook/components/StickerSheet'
|
|
5
|
+
import { Tab, TabList, TabPanel, Tabs } from '../index'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Components/Tabs/Tabs (Future)',
|
|
9
|
+
parameters: {
|
|
10
|
+
chromatic: { disable: false },
|
|
11
|
+
controls: { disable: true },
|
|
12
|
+
},
|
|
13
|
+
} satisfies Meta
|
|
14
|
+
|
|
15
|
+
const ExampleTabs = ({ id }: { id: string }): JSX.Element => (
|
|
16
|
+
<Tabs>
|
|
17
|
+
<TabList aria-label="Tabs">
|
|
18
|
+
<Tab id={`${id}-1`}>Tab 1</Tab>
|
|
19
|
+
<Tab id={`${id}-2`}>Tab 2</Tab>
|
|
20
|
+
<Tab id={`${id}-3`} badge="3">
|
|
21
|
+
Tab 3
|
|
22
|
+
</Tab>
|
|
23
|
+
<Tab id={`${id}-disabled`} isDisabled>
|
|
24
|
+
Disabled Tab
|
|
25
|
+
</Tab>
|
|
26
|
+
<Tab id={`${id}-4`}>Tab 4</Tab>
|
|
27
|
+
<Tab id={`${id}-5`}>Tab 5</Tab>
|
|
28
|
+
</TabList>
|
|
29
|
+
<TabPanel id={`${id}-1`} className="p-24">
|
|
30
|
+
<Text variant="body">Content 1</Text>
|
|
31
|
+
</TabPanel>
|
|
32
|
+
<TabPanel id={`${id}-2`} className="p-24">
|
|
33
|
+
<Text variant="body">Content 2</Text>
|
|
34
|
+
</TabPanel>
|
|
35
|
+
<TabPanel id={`${id}-3`} className="p-24">
|
|
36
|
+
<Text variant="body">Content 3</Text>
|
|
37
|
+
</TabPanel>
|
|
38
|
+
<TabPanel id={`${id}-disabled`} className="p-24">
|
|
39
|
+
<Text variant="body">Disabled content</Text>
|
|
40
|
+
</TabPanel>
|
|
41
|
+
<TabPanel id={`${id}-4`} className="p-24">
|
|
42
|
+
<Text variant="body">Content 4</Text>
|
|
43
|
+
</TabPanel>
|
|
44
|
+
<TabPanel id={`${id}-5`} className="p-24">
|
|
45
|
+
<Text variant="body">Content 5</Text>
|
|
46
|
+
</TabPanel>
|
|
47
|
+
</Tabs>
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
const StickerSheetTemplate: StickerSheetStory = {
|
|
51
|
+
render: () => {
|
|
52
|
+
return (
|
|
53
|
+
<>
|
|
54
|
+
<StickerSheet title="Tabs" layout="stretch">
|
|
55
|
+
<StickerSheet.Row>
|
|
56
|
+
<ExampleTabs id="fullwidth" />
|
|
57
|
+
</StickerSheet.Row>
|
|
58
|
+
</StickerSheet>
|
|
59
|
+
|
|
60
|
+
<StickerSheet title="Overflow (container 500px)" layout="stretch">
|
|
61
|
+
<StickerSheet.Row>
|
|
62
|
+
<div style={{ maxWidth: '500px' }}>
|
|
63
|
+
<ExampleTabs id="overflow" />
|
|
64
|
+
</div>
|
|
65
|
+
</StickerSheet.Row>
|
|
66
|
+
</StickerSheet>
|
|
67
|
+
</>
|
|
68
|
+
)
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const StickerSheetDefault: StickerSheetStory = {
|
|
73
|
+
...StickerSheetTemplate,
|
|
74
|
+
name: 'Sticker Sheet (Default)',
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const StickerSheetRTL: StickerSheetStory = {
|
|
78
|
+
...StickerSheetTemplate,
|
|
79
|
+
name: 'Sticker Sheet (RTL)',
|
|
80
|
+
parameters: {
|
|
81
|
+
...StickerSheetTemplate.parameters,
|
|
82
|
+
textDirection: 'rtl',
|
|
83
|
+
},
|
|
84
|
+
}
|
|
@@ -16,9 +16,11 @@ const meta = {
|
|
|
16
16
|
<Tab id="three" badge="3">
|
|
17
17
|
Tab 3
|
|
18
18
|
</Tab>
|
|
19
|
-
<Tab id="
|
|
19
|
+
<Tab id="disabled" isDisabled>
|
|
20
20
|
Disabled Tab
|
|
21
21
|
</Tab>
|
|
22
|
+
<Tab id="four">Tab 4</Tab>
|
|
23
|
+
<Tab id="five">Tab 5</Tab>
|
|
22
24
|
</TabList>
|
|
23
25
|
<TabPanel id="one" className="p-24">
|
|
24
26
|
<Text variant="body">Content 1</Text>
|
|
@@ -29,6 +31,15 @@ const meta = {
|
|
|
29
31
|
<TabPanel id="three" className="p-24">
|
|
30
32
|
<Text variant="body">Content 3</Text>
|
|
31
33
|
</TabPanel>
|
|
34
|
+
<TabPanel id="disabled" className="p-24">
|
|
35
|
+
<Text variant="body">Content 4</Text>
|
|
36
|
+
</TabPanel>
|
|
37
|
+
<TabPanel id="four" className="p-24">
|
|
38
|
+
<Text variant="body">Content 4</Text>
|
|
39
|
+
</TabPanel>
|
|
40
|
+
<TabPanel id="five" className="p-24">
|
|
41
|
+
<Text variant="body">Content 5</Text>
|
|
42
|
+
</TabPanel>
|
|
32
43
|
</>
|
|
33
44
|
),
|
|
34
45
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SCROLL_AMOUNT = 120
|