@kaizen/components 1.73.0 → 1.73.2

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 (28) hide show
  1. package/bin/codemod.sh +2 -0
  2. package/codemods/README.md +46 -0
  3. package/codemods/upgradeV1Buttons/index.ts +19 -0
  4. package/codemods/upgradeV1Buttons/transformV1ButtonAttributes.spec.ts +210 -0
  5. package/codemods/upgradeV1Buttons/transformV1ButtonAttributes.ts +146 -0
  6. package/codemods/upgradeV1Buttons/upgradeV1Buttons.spec.ts +658 -0
  7. package/codemods/upgradeV1Buttons/upgradeV1Buttons.ts +93 -0
  8. package/codemods/utils/createJsxElementWithChildren.spec.ts +119 -0
  9. package/codemods/utils/createJsxElementWithChildren.ts +55 -0
  10. package/codemods/utils/createProp.spec.ts +75 -19
  11. package/codemods/utils/createProp.ts +8 -1
  12. package/codemods/utils/getKaioTagName.ts +13 -5
  13. package/codemods/utils/index.ts +1 -0
  14. package/dist/styles.css +8788 -8788
  15. package/package.json +1 -1
  16. package/src/Icon/_docs/Icon.mdx +1 -1
  17. package/src/__next__/Button/_docs/Button--migration-guide.mdx +81 -0
  18. package/src/__next__/Icon/_docs/Icon--api-specification.mdx +1 -1
  19. package/src/__next__/Icon/_docs/Icon--usage-guidelines.mdx +1 -1
  20. package/src/__next__/Menu/_docs/Menu--api-specification.mdx +1 -1
  21. package/src/__next__/Menu/_docs/Menu--usage-guidelines.mdx +1 -1
  22. package/src/__next__/Select/_docs/Select.mdx +2 -2
  23. package/src/__next__/Select/_docs/Select.stickersheet.stories.tsx +1 -1
  24. package/src/__next__/Select/_docs/Select.stories.tsx +1 -1
  25. package/src/__next__/Tabs/_docs/Tabs--api-specification.mdx +1 -1
  26. package/src/__next__/Tag/RemovableTag/_docs/RemovableTag.mdx +1 -1
  27. package/src/__next__/Tooltip/_docs/ApiSpecification.mdx +1 -1
  28. package/src/__next__/Tooltip/_docs/Tooltip.mdx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaizen/components",
3
- "version": "1.73.0",
3
+ "version": "1.73.2",
4
4
  "description": "Kaizen component library",
5
5
  "author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
6
6
  "homepage": "https://cultureamp.design",
@@ -6,7 +6,7 @@ import * as IconStories from './Icon.docs.stories'
6
6
 
7
7
  # Icon (deprecated)
8
8
 
9
- <ResourceLinks sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/Icons" />
9
+ <ResourceLinks sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/Icon" />
10
10
 
11
11
  <ReplacementNotice />
12
12
 
@@ -0,0 +1,81 @@
1
+ import { Canvas, Meta, Controls, Story } from '@storybook/blocks'
2
+ import { ResourceLinks, KAIOInstallation } from '~storybook/components'
3
+
4
+ <Meta title="Components/Button/Migration Guide" />
5
+
6
+ # Button Migration Guide (next)
7
+
8
+ This is a short guide to assist in migration from the old to new `Button` and `LinkButton` component.
9
+
10
+ ## Key API differences
11
+
12
+ Below is a list of notable changes when migrating to the new `Button` and `LinkButton` component:
13
+
14
+ - `label` is now handled as `Children` .
15
+ - Variants, such as `primary` and `secondary`, are now controlled as by the single `variant` prop and some values will be remapped in the codemod.
16
+ - `primary` `boolean` becomes `variant="primary"`.
17
+ - `secondary` `boolean` becomes `variant="tertiary"`.
18
+ - `destructive` `boolean` is removed and will default to the `primary` variant.
19
+ - `size` props have been adjusted to include `small`, `medium` and `large` and some values will be remapped in the codemod.
20
+ - `small` becomes `medium`
21
+ - `regular` becomes `large`
22
+ - `onClick` and other event handlers now reflect the RAC event ecosystems, ie: `onPress`.
23
+ - You can see more about the RAC event ecosystem [here](https://react-spectrum.adobe.com/react-aria/Button.html#events).
24
+ - `Button` and `LinkButton` now exist as separate components.
25
+ - The intent is to more closely align to the semantic roles of an anchor or button and should be used accordingly.
26
+ - `LinkButton` handles native navigation via `href` out of the box but additional config can be used to allow for client side routing - [see here](/docs/components-linkbutton-api-specification--docs#client-side-routing).
27
+ - `onPress` can still be used in place of `onClick` for pushing to routers and tracking events.
28
+ - `IconButton` has been superseded by icon props and the [icon-only pattern](/docs/components-button-button-next-api-specification--docs#icon-only-button-and-hashiddenlabel).
29
+ - `working`, `workingLabel` and `workingLabelHidden` has been updated to `isPending`, `pendingLabel` and `hasHiddenPendingLabel` to better reflect the state of the button.
30
+ - This is not available in the `LinkButton` component
31
+ - `badge` prop has been removed and should be handled within the `Children` where required.
32
+ - Reversed styles should be handled by the `ReversedColors` Provider but for ease of migration, the `isReversed` prop `boolean` exists.
33
+
34
+ ## Codemod
35
+
36
+ To assist in migration we have created the `upgradeV1Buttons` codemod.
37
+
38
+ This will loop through the given directory and update all instances of Button to the latest implementation. You can refer to this [README](https://github.com/cultureamp/kaizen-design-system/blob/main/packages/components/codemods/README.md#kaizen-codemods) on how to run kaizen codemods using the CLI within your repository, ie:
39
+
40
+ ```bash
41
+ pnpm kaizen-codemod src upgradeV1Buttons
42
+ ```
43
+
44
+ Note that there are cases where an 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
+
46
+ ### Pre-requisites
47
+
48
+ It is also recommended that the `upgradeIconV1` codemod is run before `upgradeV1Buttons` to ensure that all icons are updated to the new `Icon` component that uses the Material icons CDN. There is likely to be a number of visual diffs in this migration so it is recommended to do this separately if viable. Seem more about this [here](/docs/components-icon-icon-future-api-specification--docs#set-up).
49
+
50
+ ### Codemod gotchas
51
+
52
+ If you're facing any issues not captured below, reach out to the [#help_design_system](https://cultureamp.slack.com/archives/C0189KBPM4Y) channel on Slack.
53
+
54
+ #### `icon` props and sizing
55
+
56
+ While the `icon` prop supports any `JSX` element, only the latest [Icon component](/docs/components-icon-icon-future-api-specification--docs) will be able to handle relative sizing and spacing automatically within the Button. We recommend running the `upgradeIconV1` codemod before this to convert all icons to the latest implementation. See the guidance here on using the [Material Icons CDN](/docs/guides-app-starter--docs#5-link-to-google-material-symbols-cdn).
57
+
58
+ #### `component` props type errors
59
+
60
+ Based off Metabase queries, `component` render props is used in consuming repositories to wrap Button content with a routing solution, such as NextJS's `Link` component. To ensure a safe migration, the codemod will update any usages to a `LinkButton` with the `component` prop still passed in. This will cause an intentional type error to provide feedback and make it easier to find in the codebase for a manual update. This should be able to be converted to use client side routing by following the [LinkButton API docs](https://cultureamp.design/?path=/docs/components-linkbutton-api-specification--docs).
61
+
62
+ #### `badge` props type errors
63
+
64
+ The codemod will continue to passed `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
+
66
+ ```
67
+ import { Badge } from "@kaizen/components"
68
+ import { Button } from "@kaizen/components/next"
69
+
70
+ <Button>Label<Badge classNameOverride="ms-8" variant="success">New</Badge></Button>
71
+ ```
72
+
73
+ #### Link related props type errors
74
+
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
+
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 should exist on semantic buttons.
78
+
79
+ ## More information
80
+
81
+ For more information on the about each of the new API's, we recommend referring the [Button](/docs/components-button-button-next-api-specification--docs) or [LinkButton](/docs/components-linkbutton-api-specification--docs) API specifications.
@@ -9,7 +9,7 @@ import * as IconStories from './Icon.docs.stories'
9
9
  Updated September 4, 2024
10
10
 
11
11
  <ResourceLinks
12
- sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__v2__/Icon"
12
+ sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__next__/Icon"
13
13
  designGuidelines="/?path=/docs/illustrations-icon-v2-usage-guidelines--docs"
14
14
  />
15
15
 
@@ -9,7 +9,7 @@ import * as IconStories from './Icon.docs.stories'
9
9
  Updated September 13, 2024
10
10
 
11
11
  <ResourceLinks
12
- sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__illustrations__/Icon/next"
12
+ sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__next__/Icon"
13
13
  apiSpecification="/?path=/docs/illustrations-icon-v3-api-specification--docs"
14
14
  figma="https://www.figma.com/design/eZKEE5kXbEMY3lx84oz8iN/%F0%9F%92%9C-Heart-UI-Kit?node-id=1929-3974"
15
15
  />
@@ -10,7 +10,7 @@ import * as exampleStories from './Menu.stories'
10
10
  Updated December 16, 2024
11
11
 
12
12
  <ResourceLinks
13
- sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__actions__/Menu"
13
+ sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__next__/Menu"
14
14
  figma="https://www.figma.com/design/eZKEE5kXbEMY3lx84oz8iN/%F0%9F%92%9C-Heart-UI-Kit?m=auto&node-id=6262-0&t=I4H23jCrCJz4O2nf-1"
15
15
  designGuidelines="/?path=/docs/components-menu-menu-next-usage-guidelines--docs"
16
16
  ariaComponentPage="https://react-spectrum.adobe.com/react-aria/Menu.html"
@@ -10,7 +10,7 @@ import * as MenuStories from './Menu.stories'
10
10
  Updated July 6, 2024
11
11
 
12
12
  <ResourceLinks
13
- sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__actions__/Menu"
13
+ sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__next__/Menu"
14
14
  figma="https://www.figma.com/design/eZKEE5kXbEMY3lx84oz8iN/%F0%9F%92%9C-Heart-UI-Kit?m=auto&node-id=6262-0&t=I4H23jCrCJz4O2nf-1"
15
15
  ariaComponentPage="https://react-spectrum.adobe.com/react-aria/Menu.html"
16
16
  apiSpecification="/?path=/docs/actions-menu-v3-api-specification--docs"
@@ -4,10 +4,10 @@ import * as SelectStories from './Select.stories'
4
4
 
5
5
  <Meta of={SelectStories} />
6
6
 
7
- # Select (future)
7
+ # Select (next)
8
8
 
9
9
  <ResourceLinks
10
- sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/Select"
10
+ sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__next__/Select"
11
11
  figma="https://www.figma.com/file/ZRfnoNUXbGZv4eVWLbF4Az/%F0%9F%96%BC%EF%B8%8F-Component-Gallery?node-id=9%3A37837&mode=dev"
12
12
  designGuidelines="https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081896474/Select"
13
13
 
@@ -14,7 +14,7 @@ import {
14
14
  const IS_CHROMATIC = isChromatic()
15
15
 
16
16
  export default {
17
- title: 'Components/Select/Select (future)',
17
+ title: 'Components/Select/Select (next)',
18
18
  parameters: {
19
19
  chromatic: { disable: false },
20
20
  controls: { disable: true },
@@ -7,7 +7,7 @@ import { type SelectOption } from '../types'
7
7
  import { groupedMockItems, mixedMockItemsDisabled, singleMockItems } from './mockData'
8
8
 
9
9
  const meta = {
10
- title: 'Components/Select/Select (future)',
10
+ title: 'Components/Select/Select (next)',
11
11
  component: Select,
12
12
  argTypes: {
13
13
  items: {
@@ -7,7 +7,7 @@ import * as TabsStories from './Tabs.stories'
7
7
  # Tabs (next)
8
8
 
9
9
  <ResourceLinks
10
- sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/Tabs"
10
+ sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__next__/Tabs"
11
11
  figma="https://www.figma.com/file/eZKEE5kXbEMY3lx84oz8iN/%F0%9F%92%9C-UI-Kit%3A-Heart?type=design&node-id=1929%3A28886&mode=design&t=AGMmnoJia9RscurE-1"
12
12
  designGuidelines="https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081929117/Tabs"
13
13
 
@@ -6,7 +6,7 @@ import * as RemovableTagStories from './RemovableTag.stories'
6
6
 
7
7
  # RemovableTag (next)
8
8
 
9
- <ResourceLinks sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__next__/Tag/RemovableTag.tsx" />
9
+ <ResourceLinks sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__next__/Tag/RemovableTag" />
10
10
 
11
11
  <KAIOInstallation exportNames="RemovableTag" isNext />
12
12
 
@@ -10,7 +10,7 @@ import * as exampleStories from './Tooltip.stories'
10
10
  Updated June 25, 2024
11
11
 
12
12
  <ResourceLinks
13
- sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/Tooltip"
13
+ sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__next__/Tooltip"
14
14
  figma="https://www.figma.com/file/eZKEE5kXbEMY3lx84oz8iN/%F0%9F%92%9C-UI-Kit%3A-Heart?type=design&node-id=1929%3A32006&mode=design&t=LwTCBZ5E1uRvOA1l-1"
15
15
  designGuidelines="/?path=/docs/overlays-tooltip-next-usage-guidelines--docs"
16
16
  ariaComponentPage="https://react-spectrum.adobe.com/react-aria/Tooltip.html"
@@ -13,7 +13,7 @@ import WhenToUsePng from './assets/tooltip_variant.png'
13
13
  Updated June 25, 2024
14
14
 
15
15
  <ResourceLinks
16
- sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/Tooltip"
16
+ sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__next__/Tooltip"
17
17
  figma="https://www.figma.com/file/eZKEE5kXbEMY3lx84oz8iN/%F0%9F%92%9C-UI-Kit%3A-Heart?type=design&node-id=1929%3A32006&mode=design&t=LwTCBZ5E1uRvOA1l-1"
18
18
  designGuidelines="/?path=/docs/overlays-tooltip-next-usage-guidelines--docs"
19
19
  ariaComponentPage="https://react-spectrum.adobe.com/react-aria/Tooltip.html"