@kaizen/components 1.68.10 → 1.68.11

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.
Files changed (29) hide show
  1. package/dist/cjs/Tag/Tag.cjs +2 -33
  2. package/dist/cjs/Tag/Tag.module.scss.cjs +1 -8
  3. package/dist/cjs/Tag/subcomponents/LiveIcon/LiveIcon.cjs +56 -0
  4. package/dist/cjs/Tag/subcomponents/LiveIcon/LiveIcon.module.css.cjs +12 -0
  5. package/dist/cjs/Tile/TileGrid/TileGrid.cjs +19 -2
  6. package/dist/esm/Tag/Tag.mjs +2 -33
  7. package/dist/esm/Tag/Tag.module.scss.mjs +1 -8
  8. package/dist/esm/Tag/subcomponents/LiveIcon/LiveIcon.mjs +54 -0
  9. package/dist/esm/Tag/subcomponents/LiveIcon/LiveIcon.module.css.mjs +10 -0
  10. package/dist/esm/Tile/TileGrid/TileGrid.mjs +19 -2
  11. package/dist/styles.css +178 -162
  12. package/dist/types/Tag/subcomponents/LiveIcon/LiveIcon.d.ts +4 -0
  13. package/dist/types/Tag/subcomponents/LiveIcon/index.d.ts +1 -0
  14. package/dist/types/Tag/subcomponents/index.d.ts +1 -0
  15. package/dist/types/Tile/TileGrid/TileGrid.d.ts +1 -1
  16. package/package.json +1 -1
  17. package/src/Tag/Tag.module.scss +0 -92
  18. package/src/Tag/Tag.tsx +2 -37
  19. package/src/Tag/subcomponents/LiveIcon/LiveIcon.module.css +91 -0
  20. package/src/Tag/subcomponents/LiveIcon/LiveIcon.tsx +48 -0
  21. package/src/Tag/subcomponents/LiveIcon/index.ts +1 -0
  22. package/src/Tag/subcomponents/index.ts +1 -0
  23. package/src/Tile/TileGrid/TileGrid.module.scss +1 -0
  24. package/src/Tile/TileGrid/TileGrid.tsx +32 -7
  25. package/src/Tile/TileGrid/_docs/TileGrid.stickersheet.stories.tsx +40 -0
  26. package/src/Tile/TileGrid/_docs/TileGrid.stories.tsx +78 -1
  27. package/src/Workflow/_docs/ProgressStepper.stickersheet.stories.tsx +59 -0
  28. package/src/Workflow/subcomponents/Footer/components/ProgressStepper/ProgressStepper.module.css +6 -0
  29. package/src/__future__/Tag/Tag/_docs/Tag-migration-guide.stories.tsx +24 -64
@@ -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'
@@ -3,6 +3,7 @@
3
3
  @import '../subcomponents/GenericTile/variables';
4
4
 
5
5
  .grid {
6
+ list-style-type: none;
6
7
  display: grid;
7
8
  // the more we shave off the width here,
8
9
  // the less the tiles will grow when they lose one from the row
@@ -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<HTMLDivElement>> {
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
- <div className={classnames(styles.grid, classNameOverride)} data-tile-grid {...restProps}>
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
+ }
@@ -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 {
@@ -2,8 +2,7 @@ import React from 'react'
2
2
  import { Meta, StoryObj } from '@storybook/react'
3
3
  import { fn } from '@storybook/test'
4
4
  import { Avatar } from '~components/Avatar'
5
- import { LiveIcon } from '~components/Icon'
6
- import styles from '~components/Tag/Tag.module.scss'
5
+ import { LiveIcon } from '~components/Tag/subcomponents'
7
6
  import { Icon } from '~components/__future__/Icon'
8
7
  import { Tag, RemovableTag } from '../..'
9
8
 
@@ -23,8 +22,16 @@ const meta = {
23
22
  } satisfies Meta<typeof Tag>
24
23
 
25
24
  export default meta
25
+ type Story = StoryObj<typeof meta>
26
26
 
27
- /** * This is a stand-in component for the legacy Tag's bake in LiveIcon - we should consider adding this as an actual component or replacing it */
27
+ export const LiveIconComponentStory: Story = {
28
+ render: () => <LiveIcon />,
29
+ parameters: {
30
+ docs: {
31
+ source: {
32
+ type: 'dynamic',
33
+ code: `
34
+ // component with styled with CSS modules
28
35
  const LiveIconComponent = (): JSX.Element => (
29
36
  <span className={styles.liveIcon}>
30
37
  <LiveIcon
@@ -61,68 +68,21 @@ const LiveIconComponent = (): JSX.Element => (
61
68
  />
62
69
  </span>
63
70
  )
64
-
65
- export const LiveIconComponentStory: StoryObj = {
66
- render: () => <LiveIconComponent />,
67
- parameters: {
68
- docs: {
69
- source: {
70
- type: 'dynamic',
71
- code: `
72
- // component with styled with CSS modules
73
- const LiveIconComponent = (): JSX.Element => (
74
- <span className={styles.liveIcon}>
75
- <LiveIcon
76
- role="presentation"
77
- classNameOverride={styles.liveIcon_base}
78
- width="16"
79
- height="16"
80
- viewBox="0 0 16 16"
81
- fill="none"
82
- />
83
- <LiveIcon
84
- role="presentation"
85
- classNameOverride={styles.liveIcon_1}
86
- width="16"
87
- height="16"
88
- viewBox="0 0 16 16"
89
- fill="none"
90
- />
91
- <LiveIcon
92
- role="presentation"
93
- classNameOverride={styles.liveIcon_2}
94
- width="16"
95
- height="16"
96
- viewBox="0 0 16 16"
97
- fill="none"
98
- />
99
- <LiveIcon
100
- role="presentation"
101
- classNameOverride={styles.liveIcon_3}
102
- width="16"
103
- height="16"
104
- viewBox="0 0 16 16"
105
- fill="none"
106
- />
107
- </span>
108
- )
109
-
110
- // Minified SCSS from the stylesheet
111
- <style>
112
- .liveIcon_2,.liveIcon_3{animation-duration:3s;animation-iteration-count:3;animation-delay:1s}.liveIcon{display:inline-block;position:relative;width:20px;height:20px;color:$color-green-500}.liveIcon_1,.liveIcon_2,.liveIcon_3{display:block;position:absolute;top:0;left:$0;width:100%;height:100%;overflow:hidden}.liveIcon_base{opacity:30%;display:block}.liveIcon_1{clip-path:circle(16%)}.liveIcon_2{clip-path:circle(32%);animation-name:pulse-inner}.liveIcon_3{clip-path:circle(50%);animation-name:pulse-outer}@keyframes pulse-inner{0%,25%{opacity:0%}100%,50%,75%{opacity:100%}}@keyframes pulse-outer{0%,25%,50%{opacity:0%}100%,75%{opacity:100%}}
113
- </style>
114
- `,
71
+ // Minified SCSS from the stylesheet
72
+ <style>
73
+ .liveIcon_2,.liveIcon_3{animation-duration:3s;animation-iteration-count:3;animation-delay:1s}.liveIcon{display:inline-block;position:relative;width:20px;height:20px;color:$color-green-500}.liveIcon_1,.liveIcon_2,.liveIcon_3{display:block;position:absolute;top:0;left:$0;width:100%;height:100%;overflow:hidden}.liveIcon_base{opacity:30%;display:block}.liveIcon_1{clip-path:circle(16%)}.liveIcon_2{clip-path:circle(32%);animation-name:pulse-inner}.liveIcon_3{clip-path:circle(50%);animation-name:pulse-outer}@keyframes pulse-inner{0%,25%{opacity:0%}100%,50%,75%{opacity:100%}}@keyframes pulse-outer{0%,25%,50%{opacity:0%}100%,75%{opacity:100%}}
74
+ </style>`,
115
75
  },
116
76
  },
117
77
  },
118
78
  }
119
79
 
120
- export const StatusMigration: StoryObj = {
80
+ export const StatusMigration: Story = {
121
81
  render: () => (
122
82
  <>
123
83
  <Tag classNameOverride="gap-4" color="green">
124
84
  <span>Tag</span>
125
- <LiveIconComponent />
85
+ <LiveIcon />
126
86
  </Tag>
127
87
  <Tag color="blue">Tag</Tag>
128
88
  <Tag color="red">Tag</Tag>
@@ -138,7 +98,7 @@ export const StatusMigration: StoryObj = {
138
98
  ],
139
99
  }
140
100
 
141
- export const ValidationMigration: StoryObj = {
101
+ export const ValidationMigration: Story = {
142
102
  render: () => (
143
103
  <>
144
104
  <Tag color="green" icon={<Icon name="check_circle" isFilled alt="Success," />}>
@@ -164,7 +124,7 @@ export const ValidationMigration: StoryObj = {
164
124
  ],
165
125
  }
166
126
 
167
- export const SentimentsMigration: StoryObj = {
127
+ export const SentimentsMigration: Story = {
168
128
  render: () => (
169
129
  <>
170
130
  <Tag color="green">Tag</Tag>
@@ -184,7 +144,7 @@ export const SentimentsMigration: StoryObj = {
184
144
  ],
185
145
  }
186
146
 
187
- export const SentimentNone: StoryObj = {
147
+ export const SentimentNone: Story = {
188
148
  render: () => (
189
149
  <Tag color="gray" classNameOverride="bg-white border-default-color border-solid border">
190
150
  Tag
@@ -192,7 +152,7 @@ export const SentimentNone: StoryObj = {
192
152
  ),
193
153
  }
194
154
 
195
- export const DismissibleMigration: StoryObj = {
155
+ export const DismissibleMigration: Story = {
196
156
  render: () => (
197
157
  <RemovableTag
198
158
  removeButtonProps={{
@@ -205,7 +165,7 @@ export const DismissibleMigration: StoryObj = {
205
165
  ),
206
166
  }
207
167
 
208
- export const AvatarMigration: StoryObj = {
168
+ export const AvatarMigration: Story = {
209
169
  render: () => (
210
170
  <>
211
171
  <Tag classNameOverride="ps-4">
@@ -241,7 +201,7 @@ export const AvatarMigration: StoryObj = {
241
201
  ],
242
202
  }
243
203
 
244
- export const AvatarRemovableMigration: StoryObj = {
204
+ export const AvatarRemovableMigration: Story = {
245
205
  render: () => (
246
206
  <>
247
207
  <RemovableTag
@@ -295,7 +255,7 @@ export const AvatarRemovableMigration: StoryObj = {
295
255
  ],
296
256
  }
297
257
 
298
- export const InlineMigration: StoryObj = {
258
+ export const InlineMigration: Story = {
299
259
  render: () => (
300
260
  <div className="flex gap-12">
301
261
  <Tag>Tag</Tag>
@@ -305,4 +265,4 @@ export const InlineMigration: StoryObj = {
305
265
  ),
306
266
  }
307
267
 
308
- export const SizesMigration: StoryObj = {}
268
+ export const SizesMigration: Story = {}