@kaizen/components 1.74.2 → 1.75.0
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/bin/codemod.sh +1 -0
- package/codemods/README.md +6 -0
- package/codemods/migrateGuidanceBlockActionsToActionsSlot/index.ts +21 -0
- package/codemods/migrateGuidanceBlockActionsToActionsSlot/migrateGuidanceBlockActionsToActionsSlot.spec.ts +122 -0
- package/codemods/migrateGuidanceBlockActionsToActionsSlot/migrateGuidanceBlockActionsToActionsSlot.ts +102 -0
- package/codemods/migrateGuidanceBlockActionsToActionsSlot/transformActionsToActionsSlot.spec.ts +196 -0
- package/codemods/migrateGuidanceBlockActionsToActionsSlot/transformActionsToActionsSlot.ts +71 -0
- package/codemods/utils/createProp.ts +1 -1
- package/codemods/utils/index.ts +1 -0
- package/codemods/utils/transformV1ButtonPropsToButtonOrLinkButton.spec.tsx +199 -0
- package/codemods/utils/transformV1ButtonPropsToButtonOrLinkButton.ts +195 -0
- package/dist/cjs/GuidanceBlock/GuidanceBlock.cjs +49 -84
- package/dist/cjs/GuidanceBlock/GuidanceBlock.module.css.cjs +0 -2
- package/dist/esm/GuidanceBlock/GuidanceBlock.mjs +50 -84
- package/dist/esm/GuidanceBlock/GuidanceBlock.module.css.mjs +0 -2
- package/dist/styles.css +8614 -8623
- package/dist/types/GuidanceBlock/GuidanceBlock.d.ts +8 -4
- package/locales/de.json +4 -4
- package/locales/id.json +3 -3
- package/locales/mi.json +2 -2
- package/locales/zh-TW.json +1 -1
- package/package.json +3 -4
- package/src/GuidanceBlock/GuidanceBlock.module.css +0 -9
- package/src/GuidanceBlock/GuidanceBlock.tsx +48 -87
- package/src/GuidanceBlock/_docs/GuidanceBlock--migration-guide.mdx +77 -0
- package/src/GuidanceBlock/_docs/GuidanceBlock.mdx +35 -6
- package/src/GuidanceBlock/_docs/GuidanceBlock.stickersheet.stories.tsx +60 -27
- package/src/GuidanceBlock/_docs/GuidanceBlock.stories.tsx +205 -4
- package/src/Notification/InlineNotification/_docs/InlineNotification.stories.tsx +1 -0
- package/src/__next__/Button/_docs/Button--migration-guide.mdx +3 -3
- package/src/__next__/Tag/Tag/_docs/Tag.stories.tsx +10 -0
|
@@ -6,7 +6,14 @@ import {
|
|
|
6
6
|
Informative,
|
|
7
7
|
SkillsCoachEssentialFeedback,
|
|
8
8
|
} from '~components/Illustration'
|
|
9
|
+
import { LinkButton } from '~components/LinkButton'
|
|
9
10
|
import { Text } from '~components/Text'
|
|
11
|
+
import { Button } from '~components/__next__/Button'
|
|
12
|
+
import { Icon } from '~components/__next__/Icon'
|
|
13
|
+
import {
|
|
14
|
+
Tooltip as TooltipNext,
|
|
15
|
+
TooltipTrigger as TooltipTriggerNext,
|
|
16
|
+
} from '~components/__next__/Tooltip'
|
|
10
17
|
import { GuidanceBlock } from '../index'
|
|
11
18
|
import { variantsMap } from '../types'
|
|
12
19
|
|
|
@@ -52,6 +59,64 @@ const meta = {
|
|
|
52
59
|
description:
|
|
53
60
|
'This takes a scene scene or spot element, ie: `<Informative />`. This radio button implementation is a storybook only representation to toggle between the two illustration styles.',
|
|
54
61
|
},
|
|
62
|
+
actionsSlot: {
|
|
63
|
+
control: {
|
|
64
|
+
type: 'select',
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
options: [
|
|
68
|
+
'Primary action',
|
|
69
|
+
'Primary and Secondary action',
|
|
70
|
+
'Action with Icon',
|
|
71
|
+
'Action with Tooltip',
|
|
72
|
+
],
|
|
73
|
+
mapping: {
|
|
74
|
+
'Primary action': (
|
|
75
|
+
<Button variant="secondary" onPress={() => alert('tada: 🎉')}>
|
|
76
|
+
Label
|
|
77
|
+
</Button>
|
|
78
|
+
),
|
|
79
|
+
'Primary and Secondary action': (
|
|
80
|
+
<>
|
|
81
|
+
<Button variant="secondary" onPress={() => alert('tada: 🎉')}>
|
|
82
|
+
Label
|
|
83
|
+
</Button>
|
|
84
|
+
<LinkButton variant="tertiary" href="#link">
|
|
85
|
+
Secondary action
|
|
86
|
+
</LinkButton>
|
|
87
|
+
</>
|
|
88
|
+
),
|
|
89
|
+
'Action with Icon': (
|
|
90
|
+
<TooltipTriggerNext defaultOpen>
|
|
91
|
+
<Button
|
|
92
|
+
size="large"
|
|
93
|
+
variant="secondary"
|
|
94
|
+
onPress={() => alert('tada: 🎉')}
|
|
95
|
+
iconPosition="end"
|
|
96
|
+
icon={<Icon name="arrow_forward" shouldMirrorInRTL isPresentational />}
|
|
97
|
+
>
|
|
98
|
+
Label
|
|
99
|
+
</Button>
|
|
100
|
+
<TooltipNext>Tooltip content</TooltipNext>
|
|
101
|
+
</TooltipTriggerNext>
|
|
102
|
+
),
|
|
103
|
+
'Action with Tooltip': (
|
|
104
|
+
<TooltipTriggerNext defaultOpen>
|
|
105
|
+
<LinkButton
|
|
106
|
+
variant="secondary"
|
|
107
|
+
href="#lorem"
|
|
108
|
+
target="_blank"
|
|
109
|
+
rel="noopener noreferrer"
|
|
110
|
+
size="large"
|
|
111
|
+
iconPosition="end"
|
|
112
|
+
>
|
|
113
|
+
Label
|
|
114
|
+
</LinkButton>
|
|
115
|
+
<TooltipNext>Tooltip content</TooltipNext>
|
|
116
|
+
</TooltipTriggerNext>
|
|
117
|
+
),
|
|
118
|
+
},
|
|
119
|
+
},
|
|
55
120
|
content: {
|
|
56
121
|
description:
|
|
57
122
|
'If you need to render custom content inside of the `GuidanceBlock` that is more than just a title and description use this prop instead of the default `text` option.',
|
|
@@ -81,11 +146,11 @@ export const Actions: Story = {
|
|
|
81
146
|
content: <ContentComponent />,
|
|
82
147
|
actions: {
|
|
83
148
|
primary: {
|
|
84
|
-
label: '
|
|
149
|
+
label: 'Label',
|
|
85
150
|
onClick: () => alert('tada: 🎉'),
|
|
86
151
|
},
|
|
87
152
|
secondary: {
|
|
88
|
-
label: '
|
|
153
|
+
label: 'Label',
|
|
89
154
|
href: '#',
|
|
90
155
|
},
|
|
91
156
|
},
|
|
@@ -97,7 +162,7 @@ export const Tooltip: Story = {
|
|
|
97
162
|
content: <ContentComponent />,
|
|
98
163
|
actions: {
|
|
99
164
|
primary: {
|
|
100
|
-
label: '
|
|
165
|
+
label: 'Label',
|
|
101
166
|
onClick: () => alert('tada: 🎉'),
|
|
102
167
|
tooltip: {
|
|
103
168
|
text: 'Opens in a new tab',
|
|
@@ -105,7 +170,7 @@ export const Tooltip: Story = {
|
|
|
105
170
|
},
|
|
106
171
|
},
|
|
107
172
|
secondary: {
|
|
108
|
-
label: '
|
|
173
|
+
label: 'Label',
|
|
109
174
|
href: '#',
|
|
110
175
|
},
|
|
111
176
|
},
|
|
@@ -151,3 +216,139 @@ export const Variants: Story = {
|
|
|
151
216
|
text: defaultText,
|
|
152
217
|
},
|
|
153
218
|
}
|
|
219
|
+
|
|
220
|
+
export const ActionsVsActionsSlot: Story = {
|
|
221
|
+
args: {
|
|
222
|
+
layout: 'default',
|
|
223
|
+
illustration: <Informative alt="" />,
|
|
224
|
+
content: <ContentComponent />,
|
|
225
|
+
actions: {
|
|
226
|
+
dismiss: {
|
|
227
|
+
onClick: () => {
|
|
228
|
+
alert('Dismissed')
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
primary: {
|
|
232
|
+
label: 'Label',
|
|
233
|
+
onClick: () => alert('tada: 🎉'),
|
|
234
|
+
},
|
|
235
|
+
secondary: {
|
|
236
|
+
label: 'Label',
|
|
237
|
+
href: '#',
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
secondaryDismiss: true,
|
|
241
|
+
},
|
|
242
|
+
render: (args) => (
|
|
243
|
+
<div className="flex flex-col gap-16">
|
|
244
|
+
<GuidanceBlock
|
|
245
|
+
layout="default"
|
|
246
|
+
illustration={<Informative alt="" />}
|
|
247
|
+
content={<ContentComponent />}
|
|
248
|
+
actions={args.actions}
|
|
249
|
+
secondaryDismiss
|
|
250
|
+
/>
|
|
251
|
+
<GuidanceBlock
|
|
252
|
+
layout="default"
|
|
253
|
+
illustration={<Informative alt="" />}
|
|
254
|
+
content={<ContentComponent />}
|
|
255
|
+
secondaryDismiss={true}
|
|
256
|
+
actionsSlot={
|
|
257
|
+
<>
|
|
258
|
+
<Button size="large" onPress={() => alert('tada: 🎉')} slot="primary">
|
|
259
|
+
Label
|
|
260
|
+
</Button>
|
|
261
|
+
<Button variant="tertiary" size="large" onPress={() => alert('tada: 🎉')}>
|
|
262
|
+
Label
|
|
263
|
+
</Button>
|
|
264
|
+
</>
|
|
265
|
+
}
|
|
266
|
+
/>
|
|
267
|
+
</div>
|
|
268
|
+
),
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export const ActionsSlot: Story = {
|
|
272
|
+
args: {
|
|
273
|
+
layout: 'default',
|
|
274
|
+
illustration: <Informative alt="" />,
|
|
275
|
+
content: <ContentComponent />,
|
|
276
|
+
actionsSlot: (
|
|
277
|
+
<>
|
|
278
|
+
<Button
|
|
279
|
+
variant="secondary"
|
|
280
|
+
size="large"
|
|
281
|
+
onPress={() => alert('tada: 🎉')}
|
|
282
|
+
iconPosition="end"
|
|
283
|
+
slot="primary"
|
|
284
|
+
>
|
|
285
|
+
Label
|
|
286
|
+
</Button>
|
|
287
|
+
</>
|
|
288
|
+
),
|
|
289
|
+
},
|
|
290
|
+
render: (args) => (
|
|
291
|
+
<div className="flex flex-col gap-16">
|
|
292
|
+
<GuidanceBlock {...args} />
|
|
293
|
+
</div>
|
|
294
|
+
),
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export const MultipleActions: Story = {
|
|
298
|
+
args: {
|
|
299
|
+
layout: 'default',
|
|
300
|
+
illustration: <Informative alt="" />,
|
|
301
|
+
content: <ContentComponent />,
|
|
302
|
+
actionsSlot: (
|
|
303
|
+
<>
|
|
304
|
+
<Button
|
|
305
|
+
variant="secondary"
|
|
306
|
+
size="large"
|
|
307
|
+
onPress={() => alert('tada: 🎉')}
|
|
308
|
+
iconPosition="end"
|
|
309
|
+
slot="primary"
|
|
310
|
+
icon={<Icon name="arrow_forward" shouldMirrorInRTL isPresentational />}
|
|
311
|
+
>
|
|
312
|
+
Label
|
|
313
|
+
</Button>
|
|
314
|
+
<LinkButton slot="secondary" variant="tertiary" size="large" href="#">
|
|
315
|
+
Label
|
|
316
|
+
</LinkButton>
|
|
317
|
+
</>
|
|
318
|
+
),
|
|
319
|
+
},
|
|
320
|
+
render: (args) => (
|
|
321
|
+
<div className="flex flex-col gap-16">
|
|
322
|
+
<GuidanceBlock {...args} />
|
|
323
|
+
</div>
|
|
324
|
+
),
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export const ActionsSlotWithTooltips: Story = {
|
|
328
|
+
args: {
|
|
329
|
+
layout: 'default',
|
|
330
|
+
illustration: <Informative alt="" />,
|
|
331
|
+
content: <ContentComponent />,
|
|
332
|
+
actionsSlot: (
|
|
333
|
+
<>
|
|
334
|
+
<TooltipTriggerNext>
|
|
335
|
+
<Button variant="secondary" size="large" onPress={() => alert('tada: 🎉')}>
|
|
336
|
+
Label
|
|
337
|
+
</Button>
|
|
338
|
+
<TooltipNext>Tooltip Content</TooltipNext>
|
|
339
|
+
</TooltipTriggerNext>
|
|
340
|
+
<TooltipTriggerNext>
|
|
341
|
+
<LinkButton variant="tertiary" size="large" href="#">
|
|
342
|
+
Label
|
|
343
|
+
</LinkButton>
|
|
344
|
+
<TooltipNext>Tooltip secondary content</TooltipNext>
|
|
345
|
+
</TooltipTriggerNext>
|
|
346
|
+
</>
|
|
347
|
+
),
|
|
348
|
+
},
|
|
349
|
+
render: (args) => (
|
|
350
|
+
<div className="flex flex-col gap-16">
|
|
351
|
+
<GuidanceBlock {...args} />
|
|
352
|
+
</div>
|
|
353
|
+
),
|
|
354
|
+
}
|
|
@@ -41,7 +41,7 @@ This will loop through the given directory and update all instances of Button to
|
|
|
41
41
|
pnpm kaizen-codemod src upgradeV1Buttons
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
Note that there are cases where
|
|
44
|
+
Note that there are cases where props that no longer exist will be left in the codebase to throw type error and provide feedback to the engineer. This is intentional and identifies area's where manual updates are required.
|
|
45
45
|
|
|
46
46
|
### Pre-requisites
|
|
47
47
|
|
|
@@ -61,7 +61,7 @@ Based off Metabase queries, `component` render props is used in consuming reposi
|
|
|
61
61
|
|
|
62
62
|
#### `badge` props type errors
|
|
63
63
|
|
|
64
|
-
The codemod will continue to
|
|
64
|
+
The codemod will continue to pass `badge` props into the new implementation so it will throw a type error and provide feedback to engineers. This will need to be manually composed within the `Children` if required, ie:
|
|
65
65
|
|
|
66
66
|
```
|
|
67
67
|
import { Badge } from "@kaizen/components"
|
|
@@ -74,7 +74,7 @@ import { Button } from "@kaizen/components/next"
|
|
|
74
74
|
|
|
75
75
|
If no `href` or `component` props are passed to the component you may get type errors for having anchor related props passed into a Button, ie: `target`, `rel`.
|
|
76
76
|
|
|
77
|
-
This will cause a type error that can be corrected by either using the `LinkButton` (if intended) or removing all anchor related props as they
|
|
77
|
+
This will cause a type error that can be corrected by either using the `LinkButton` (if intended) or removing all anchor related props as they shouldn't exist on semantic buttons.
|
|
78
78
|
|
|
79
79
|
## More information
|
|
80
80
|
|
|
@@ -10,6 +10,16 @@ const meta = {
|
|
|
10
10
|
args: {
|
|
11
11
|
children: 'My tag',
|
|
12
12
|
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
icon: {
|
|
15
|
+
options: ['delete', 'arrow', 'add'],
|
|
16
|
+
mapping: {
|
|
17
|
+
delete: <Icon isPresentational name="delete" />,
|
|
18
|
+
arrow: <Icon isPresentational name="arrow_forward" />,
|
|
19
|
+
add: <Icon isPresentational name="add" />,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
13
23
|
} satisfies Meta<typeof Tag>
|
|
14
24
|
|
|
15
25
|
export default meta
|