From 17951f367e7b4fa2a99b601e64c8452f1ef6141f Mon Sep 17 00:00:00 2001 From: Cassandra Date: Wed, 16 Oct 2024 12:21:20 +1100 Subject: [PATCH] feat: add future Icon (release branch) (#5153) * feat(Icon): add future Icon (#4973) * feat: add illustrations entrypoint * chore(storybook): link to Material Symbols CDN * feat(future/Icon): add prop to mirror in RTL * docs(future/Icon): add api specification * docs(future/Icon): update usage guidelines * feat(future/Icon): add props for accessibility * feat(future/Icon): add string suggestions for name * feat(future/Icon): handle RTL icons that are not a direct mirror * docs(future/Icon): add list of default icon set * docs(DosAndDonts): update styles so items are the same height * chore: update root test command to not watch * docs(DosAndDonts): update styles for single col to span full width * feat(Notification): update icons to use future Icon * chore(tsconfig): resolve json in storybook * chore(DosAndDonts): update to use new icon * chore(ResourceLinks): update to use new icon * fix(future/Tag): fix cautionary icon colour * refactor: update Icon usage in some components * chore: fix lint:fix script * fix(Popover): fix icon color * feat(codemod): add codemod to upgrade Icon to Future Icon (#5080) * refactor: rename getTagName to getKaioTagName and abstract traversing * feat(codemod): add util getKaioTagNamesByRegex * refactor(transformSource): make tag name generic * feat(updateJsxElementWithNewProps): add arg to update tag name * feat(codemod): add codemod for upgrading icons * feat(upgradeIconV1): transform CaMonogramIcon to Brand * feat(updateKaioImport): add util to update imports * feat(upgradeIconV1): transform SpinnerIcon to LoadingSpinner --- .changeset/little-lizards-sniff.md | 5 + .changeset/quick-timers-juggle.md | 2 + .changeset/real-pumpkins-drive.md | 5 + .github/workflows/test-unit.yml | 6 +- docs/.storybook/preview-head.html | 6 + .../DosAndDonts/DosAndDonts.module.css | 14 + docs/components/DosAndDonts/DosAndDonts.tsx | 42 +- .../ResourceLinks/ResourceLinks.tsx | 9 +- docs/tsconfig.json | 1 + package.json | 5 +- packages/components/codemods/README.md | 5 + .../getNewIconPropsFromOldIconName.ts | 255 ++ .../codemods/upgradeIconV1/index.ts | 33 + .../transformCaMonogramIconToBrand.spec.ts | 83 + .../transformCaMonogramIconToBrand.ts | 53 + .../upgradeIconV1/transformIcon.spec.ts | 181 + .../codemods/upgradeIconV1/transformIcon.ts | 115 + ...ansformSpinnerIconToLoadingSpinner.spec.ts | 81 + .../transformSpinnerIconToLoadingSpinner.ts | 41 + .../upgradeIconV1/upgradeIconV1.spec.ts | 306 ++ .../codemods/upgradeIconV1/upgradeIconV1.ts | 94 + .../codemods/utils/createProp.spec.ts | 83 + .../components/codemods/utils/createProp.ts | 51 + .../codemods/utils/getKaioTagName.spec.ts | 85 + .../codemods/utils/getKaioTagName.ts | 129 + .../codemods/utils/getTagName.spec.ts | 24 - .../components/codemods/utils/getTagName.ts | 32 - packages/components/codemods/utils/index.ts | 4 +- .../utils/transformComponentsInDir.ts | 48 +- .../codemods/utils/transformSource.ts | 15 +- .../utils/updateJsxElementWithNewProps.ts | 7 +- .../codemods/utils/updateKaioImports.spec.ts | 223 ++ .../codemods/utils/updateKaioImports.ts | 233 ++ packages/components/rollup.config.mjs | 6 +- .../components/src/Avatar/Avatar.module.scss | 14 +- packages/components/src/Avatar/Avatar.tsx | 19 +- .../BrandMoment/_docs/BrandMoment.stories.tsx | 16 +- .../src/BrandMoment/_docs/ExampleHeaders.tsx | 4 +- .../Calendar/CalendarRange/CalendarRange.tsx | 10 +- .../CalendarSingle/CalendarSingle.tsx | 10 +- .../LegacyCalendarRange.tsx | 10 +- .../baseCalendarClassNames.module.scss | 4 - .../Checkbox/Checkbox/Checkbox.module.scss | 8 - .../src/Checkbox/Checkbox/Checkbox.tsx | 14 +- .../src/ClearButton/ClearButton.tsx | 4 +- .../Collapsible/Collapsible/Collapsible.tsx | 11 +- .../Collapsible/_docs/Collapsible.stories.tsx | 4 +- .../DateInputWithIconButton.module.scss | 9 +- .../DateInputWithIconButton.tsx | 4 +- .../src/DateRangePicker/DateRangePicker.tsx | 4 +- .../_docs/EmptyState.stickersheet.stories.tsx | 10 +- .../EmptyState/_docs/EmptyState.stories.tsx | 6 +- .../components/src/ErrorPage/ErrorPage.tsx | 8 +- .../src/FieldMessage/FieldMessage.tsx | 20 +- .../src/Filter/FilterBar/FilterBar.spec.tsx | 24 +- .../AddFiltersMenu/AddFiltersMenu.tsx | 4 +- .../FilterButton/FilterButton.tsx | 11 +- .../FilterButtonRemovable.tsx | 4 +- .../FilterDateRangePicker.spec.tsx | 1 - .../DateRangeInputField.spec.tsx | 3 +- .../MultiSelectOption/MultiSelectOption.tsx | 4 +- .../Filter/FilterSelect/FilterSelect.spec.tsx | 9 +- .../src/GuidanceBlock/GuidanceBlock.tsx | 8 +- ...Icon.stories.tsx => Icon.docs.stories.tsx} | 2 +- packages/components/src/Icon/_docs/Icon.mdx | 3 +- .../Icon/_docs/Icon.stickersheet.stories.tsx | 2 +- .../src/Illustration/utils/usePausePlay.tsx | 12 +- .../_docs/Input.stickersheet.stories.tsx | 12 +- .../src/Input/Input/_docs/Input.stories.tsx | 8 +- .../src/Input/InputSearch/InputSearch.tsx | 4 +- .../components/src/Label/Label.module.scss | 4 + .../LikertScaleLegacy/LikertScaleLegacy.tsx | 4 +- .../_docs/LoadingGraphic.stories.tsx | 4 +- .../ConfirmationModal.module.scss | 2 + .../ConfirmationModal/ConfirmationModal.tsx | 67 +- .../subcomponents/ModalHeader/ModalHeader.tsx | 4 +- .../src/MultiSelect/MultiSelect.spec.tsx | 10 +- .../Checkbox/Checkbox.module.scss | 6 - .../subcomponents/Checkbox/Checkbox.tsx | 19 +- .../MultiSelectOptions.spec.tsx | 18 +- .../MultiSelectToggle/MultiSelectToggle.tsx | 12 +- .../CancelButton/CancelButton.tsx | 4 +- .../GenericNotification/_mixins.scss | 2 + .../NotificationIcon.module.css | 3 + .../NotificationIcon/NotificationIcon.tsx | 38 +- .../DirectionalLink.module.scss | 4 - .../DirectionalLink/DirectionalLink.tsx | 25 +- .../TruncateIndicator.module.scss | 1 - .../TruncateIndicator/TruncateIndicator.tsx | 4 +- .../src/Popover/Popover.module.scss | 6 +- packages/components/src/Popover/Popover.tsx | 4 +- .../src/Popover/utils/classMappers.tsx | 17 +- .../ToggleIconButton.stickersheet.stories.tsx | 14 +- .../_docs/ToggleIconButton.stories.tsx | 4 +- .../subcomponents/Toolbar/Toolbar.spec.tsx | 11 +- .../Toolbar/_docs/Toolbar.stories.tsx | 30 +- .../RichTextEditor/utils/controlmap.tsx | 43 +- .../components/LinkPopover/LinkPopover.tsx | 12 +- .../components/src/Select/Select.module.scss | 2 + packages/components/src/Select/Select.tsx | 17 +- .../DropdownButton/DropdownButton.spec.tsx | 9 +- .../DropdownButton/DropdownButton.tsx | 4 +- packages/components/src/Table/Table.tsx | 12 +- .../_docs/Table.stickersheet.stories.tsx | 8 +- .../src/Table/_docs/Table.stories.tsx | 6 +- packages/components/src/Tag/Tag.module.scss | 2 + packages/components/src/Tag/Tag.tsx | 20 +- packages/components/src/Text/Text.module.scss | 2 + .../src/TextField/TextField.spec.tsx | 13 +- .../components/src/TextField/TextField.tsx | 4 +- .../src/TextField/_docs/TextField.stories.tsx | 7 +- .../subcomponents/GenericTile/GenericTile.tsx | 6 +- .../TitleBlockZen/TitleBlockZen.module.scss | 1 + .../src/TitleBlockZen/TitleBlockZen.spec.tsx | 2 +- .../src/TitleBlockZen/TitleBlockZen.tsx | 15 +- .../_docs/TitleBlockZen.stories.tsx | 10 +- .../subcomponents/MainActions.tsx | 8 +- .../subcomponents/MobileActions.tsx | 29 +- .../subcomponents/SecondaryActions.tsx | 6 +- .../ToggleSwitch/ToggleSwitch.module.scss | 3 - .../ToggleSwitch/ToggleSwitch.tsx | 4 +- .../src/Workflow/_docs/Workflow.stories.tsx | 9 +- .../Workflow/_docs/WorkflowHeader.stories.tsx | 9 +- .../src/Workflow/_docs/controls/controls.tsx | 8 +- .../ProgressStepper/ProgressStepper.tsx | 37 +- .../_docs/Button.stickersheet.stories.tsx | 10 +- .../Button/v1/Button/_docs/Button.stories.tsx | 11 +- .../_docs/IconButton.stickersheet.stories.tsx | 12 +- .../IconButton/_docs/IconButton.stories.tsx | 8 +- .../Button/v2/Button/_docs/Button.stories.tsx | 11 +- .../IconButton/_docs/IconButton.stories.tsx | 8 +- .../v1/_docs/Menu.stickersheet.stories.tsx | 6 +- .../Menu/v1/_docs/Menu.stories.tsx | 6 +- .../Menu/v1/_docs/MenuContentExample.tsx | 12 +- .../__actions__/Menu/v1/_docs/examples.tsx | 10 +- .../Menu/v2/_docs/Menu.stories.tsx | 6 +- .../Menu/v3/_docs/ApiSpecification.mdx | 4 +- .../Menu/v3/_docs/Menu.docs.stories.tsx | 91 +- .../src/__actions__/Menu/v3/_docs/Menu.mdx | 2 +- .../Menu/v3/_docs/Menu.spec.stories.tsx | 44 +- .../Menu/v3/_docs/Menu.stories.tsx | 27 +- .../src/__future__/Icon/Icon.module.css | 35 + .../src/__future__/Icon/Icon.spec.tsx | 36 + .../components/src/__future__/Icon/Icon.tsx | 85 + .../Icon/_docs/Icon--api-specification.mdx | 98 + .../Icon/_docs/Icon--usage-guidelines.mdx | 145 + .../Icon/_docs/Icon.docs.module.css | 17 + .../Icon/_docs/Icon.docs.stories.tsx | 524 +++ .../Icon/_docs/Icon.stickersheet.stories.tsx | 126 + .../Icon/_docs/assets/interface-dont.png | Bin 0 -> 6479 bytes .../Icon/_docs/assets/tooltip-dont.png | Bin 0 -> 37421 bytes .../src/__future__/Icon/constants.ts | 149 + .../components/src/__future__/Icon/index.ts | 1 + .../Icon/material-symbols-metadata.json | 3370 +++++++++++++++++ .../components/src/__future__/Icon/types.ts | 11 + .../Select/subcomponents/Option/Option.tsx | 4 +- .../SelectToggle/SelectToggle.module.scss | 2 +- .../SelectToggle/SelectToggle.tsx | 15 +- .../_docs/RemovableTag.stories.tsx | 77 - .../subcomponents/RemoveButton.module.scss | 56 - .../subcomponents/RemoveButton.tsx | 14 +- .../subcomponents/RemoveTagIcon.tsx | 21 - .../src/__future__/Tag/Tag/Tag.module.scss | 2 +- .../Tag/_docs/Tag-migration-guide.stories.tsx | 23 +- .../Tag/_docs/Tag.stickersheet.stories.tsx | 7 +- .../__future__/Tag/Tag/_docs/Tag.stories.tsx | 19 +- packages/components/src/__future__/index.ts | 1 + .../v1/_docs/Tooltip.stickersheet.stories.tsx | 20 +- .../Tooltip/v1/_docs/Tooltip.stories.tsx | 11 +- .../v1/utils/isSemanticElement.spec.tsx | 15 +- .../Tooltip/v3/_docs/Tooltip.docs.stories.tsx | 20 +- .../Tooltip/v3/_docs/Tooltip.spec.stories.tsx | 6 +- packages/components/types.d.ts | 5 + .../components/CodeSnippet/CodeSnippet.tsx | 6 +- 174 files changed, 7432 insertions(+), 964 deletions(-) create mode 100644 .changeset/little-lizards-sniff.md create mode 100644 .changeset/quick-timers-juggle.md create mode 100644 .changeset/real-pumpkins-drive.md create mode 100644 packages/components/codemods/upgradeIconV1/getNewIconPropsFromOldIconName.ts create mode 100644 packages/components/codemods/upgradeIconV1/index.ts create mode 100644 packages/components/codemods/upgradeIconV1/transformCaMonogramIconToBrand.spec.ts create mode 100644 packages/components/codemods/upgradeIconV1/transformCaMonogramIconToBrand.ts create mode 100644 packages/components/codemods/upgradeIconV1/transformIcon.spec.ts create mode 100644 packages/components/codemods/upgradeIconV1/transformIcon.ts create mode 100644 packages/components/codemods/upgradeIconV1/transformSpinnerIconToLoadingSpinner.spec.ts create mode 100644 packages/components/codemods/upgradeIconV1/transformSpinnerIconToLoadingSpinner.ts create mode 100644 packages/components/codemods/upgradeIconV1/upgradeIconV1.spec.ts create mode 100644 packages/components/codemods/upgradeIconV1/upgradeIconV1.ts create mode 100644 packages/components/codemods/utils/createProp.spec.ts create mode 100644 packages/components/codemods/utils/createProp.ts create mode 100644 packages/components/codemods/utils/getKaioTagName.spec.ts create mode 100644 packages/components/codemods/utils/getKaioTagName.ts delete mode 100644 packages/components/codemods/utils/getTagName.spec.ts delete mode 100644 packages/components/codemods/utils/getTagName.ts create mode 100644 packages/components/codemods/utils/updateKaioImports.spec.ts create mode 100644 packages/components/codemods/utils/updateKaioImports.ts rename packages/components/src/Icon/_docs/{Icon.stories.tsx => Icon.docs.stories.tsx} (98%) create mode 100644 packages/components/src/Notification/subcomponents/NotificationIcon/NotificationIcon.module.css create mode 100644 packages/components/src/__future__/Icon/Icon.module.css create mode 100644 packages/components/src/__future__/Icon/Icon.spec.tsx create mode 100644 packages/components/src/__future__/Icon/Icon.tsx create mode 100644 packages/components/src/__future__/Icon/_docs/Icon--api-specification.mdx create mode 100644 packages/components/src/__future__/Icon/_docs/Icon--usage-guidelines.mdx create mode 100644 packages/components/src/__future__/Icon/_docs/Icon.docs.module.css create mode 100644 packages/components/src/__future__/Icon/_docs/Icon.docs.stories.tsx create mode 100644 packages/components/src/__future__/Icon/_docs/Icon.stickersheet.stories.tsx create mode 100644 packages/components/src/__future__/Icon/_docs/assets/interface-dont.png create mode 100644 packages/components/src/__future__/Icon/_docs/assets/tooltip-dont.png create mode 100644 packages/components/src/__future__/Icon/constants.ts create mode 100644 packages/components/src/__future__/Icon/index.ts create mode 100644 packages/components/src/__future__/Icon/material-symbols-metadata.json create mode 100644 packages/components/src/__future__/Icon/types.ts delete mode 100644 packages/components/src/__future__/Tag/RemovableTag/subcomponents/RemoveTagIcon.tsx diff --git a/.changeset/little-lizards-sniff.md b/.changeset/little-lizards-sniff.md new file mode 100644 index 00000000000..5e0d6c1c6de --- /dev/null +++ b/.changeset/little-lizards-sniff.md @@ -0,0 +1,5 @@ +--- +"@kaizen/components": minor +--- + +Add future Icon and update internal icon usages (excluding Buttons). diff --git a/.changeset/quick-timers-juggle.md b/.changeset/quick-timers-juggle.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/quick-timers-juggle.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/.changeset/real-pumpkins-drive.md b/.changeset/real-pumpkins-drive.md new file mode 100644 index 00000000000..2047ccc48a3 --- /dev/null +++ b/.changeset/real-pumpkins-drive.md @@ -0,0 +1,5 @@ +--- +"@kaizen/components": patch +--- + +Fix future Tag cautionary icon colour. diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index fdc3458cd19..a71d3acabf8 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -27,7 +27,7 @@ jobs: - uses: actions/checkout@v4 - uses: ./.github/actions/setup - name: Unit tests (1/3) - run: pnpm test -- -- --run --shard=1/3 + run: pnpm test -- --shard=1/3 unit-tests-2: if: github.head_ref != 'changeset-release/main' @@ -38,7 +38,7 @@ jobs: - uses: actions/checkout@v4 - uses: ./.github/actions/setup - name: Unit tests (2/3) - run: pnpm test -- -- --run --shard=2/3 + run: pnpm test -- --shard=2/3 unit-tests-3: if: github.head_ref != 'changeset-release/main' @@ -49,4 +49,4 @@ jobs: - uses: actions/checkout@v4 - uses: ./.github/actions/setup - name: Unit tests (3/3) - run: pnpm test -- -- --run --shard=3/3 + run: pnpm test -- --shard=3/3 diff --git a/docs/.storybook/preview-head.html b/docs/.storybook/preview-head.html index 35aae17a813..b44c54ed349 100644 --- a/docs/.storybook/preview-head.html +++ b/docs/.storybook/preview-head.html @@ -1,3 +1,9 @@ + + + + + +