@kaizen/components 1.66.1 → 1.67.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.
Files changed (274) hide show
  1. package/codemods/README.md +5 -0
  2. package/codemods/upgradeIconV1/getNewIconPropsFromOldIconName.ts +255 -0
  3. package/codemods/upgradeIconV1/index.ts +33 -0
  4. package/codemods/upgradeIconV1/transformCaMonogramIconToBrand.spec.ts +83 -0
  5. package/codemods/upgradeIconV1/transformCaMonogramIconToBrand.ts +53 -0
  6. package/codemods/upgradeIconV1/transformIcon.spec.ts +181 -0
  7. package/codemods/upgradeIconV1/transformIcon.ts +115 -0
  8. package/codemods/upgradeIconV1/transformSpinnerIconToLoadingSpinner.spec.ts +81 -0
  9. package/codemods/upgradeIconV1/transformSpinnerIconToLoadingSpinner.ts +41 -0
  10. package/codemods/upgradeIconV1/upgradeIconV1.spec.ts +306 -0
  11. package/codemods/upgradeIconV1/upgradeIconV1.ts +94 -0
  12. package/codemods/utils/createProp.spec.ts +83 -0
  13. package/codemods/utils/createProp.ts +51 -0
  14. package/codemods/utils/getKaioTagName.spec.ts +85 -0
  15. package/codemods/utils/getKaioTagName.ts +129 -0
  16. package/codemods/utils/index.ts +3 -1
  17. package/codemods/utils/transformComponentsInDir.ts +32 -16
  18. package/codemods/utils/transformSource.ts +10 -5
  19. package/codemods/utils/updateJsxElementWithNewProps.ts +4 -3
  20. package/codemods/utils/updateKaioImports.spec.ts +223 -0
  21. package/codemods/utils/updateKaioImports.ts +233 -0
  22. package/dist/cjs/Avatar/Avatar.cjs +16 -13
  23. package/dist/cjs/Calendar/CalendarRange/CalendarRange.cjs +9 -7
  24. package/dist/cjs/Calendar/CalendarSingle/CalendarSingle.cjs +9 -7
  25. package/dist/cjs/Calendar/LegacyCalendarRange/LegacyCalendarRange.cjs +9 -7
  26. package/dist/cjs/Checkbox/Checkbox/Checkbox.cjs +5 -11
  27. package/dist/cjs/ClearButton/ClearButton.cjs +5 -4
  28. package/dist/cjs/Collapsible/Collapsible/Collapsible.cjs +4 -7
  29. package/dist/cjs/DateInput/DateInputWithIconButton/DateInputWithIconButton.cjs +5 -4
  30. package/dist/cjs/DateRangePicker/DateRangePicker.cjs +5 -4
  31. package/dist/cjs/ErrorPage/ErrorPage.cjs +9 -7
  32. package/dist/cjs/FieldMessage/FieldMessage.cjs +5 -11
  33. package/dist/cjs/Filter/FilterBar/subcomponents/AddFiltersMenu/AddFiltersMenu.cjs +4 -5
  34. package/dist/cjs/Filter/FilterButton/FilterButton/FilterButton.cjs +4 -7
  35. package/dist/cjs/Filter/FilterButton/FilterButtonRemovable/FilterButtonRemovable.cjs +5 -5
  36. package/dist/cjs/Filter/FilterMultiSelect/subcomponents/MultiSelectOption/MultiSelectOption.cjs +4 -4
  37. package/dist/cjs/GuidanceBlock/GuidanceBlock.cjs +5 -4
  38. package/dist/cjs/Illustration/utils/usePausePlay.cjs +5 -8
  39. package/dist/cjs/Input/InputSearch/InputSearch.cjs +4 -3
  40. package/dist/cjs/LikertScaleLegacy/LikertScaleLegacy.cjs +5 -6
  41. package/dist/cjs/Modal/ConfirmationModal/ConfirmationModal.cjs +31 -26
  42. package/dist/cjs/Modal/GenericModal/subcomponents/ModalHeader/ModalHeader.cjs +4 -5
  43. package/dist/cjs/MultiSelect/subcomponents/Checkbox/Checkbox.cjs +7 -17
  44. package/dist/cjs/MultiSelect/subcomponents/MultiSelectToggle/MultiSelectToggle.cjs +4 -7
  45. package/dist/cjs/Notification/subcomponents/CancelButton/CancelButton.cjs +4 -3
  46. package/dist/cjs/Notification/subcomponents/NotificationIcon/NotificationIcon.cjs +33 -38
  47. package/dist/cjs/Notification/subcomponents/NotificationIcon/NotificationIcon.module.css.cjs +6 -0
  48. package/dist/cjs/Pagination/subcomponents/DirectionalLink/DirectionalLink.cjs +11 -19
  49. package/dist/cjs/Pagination/subcomponents/TruncateIndicator/TruncateIndicator.cjs +4 -5
  50. package/dist/cjs/Popover/Popover.cjs +5 -4
  51. package/dist/cjs/Popover/utils/classMappers.cjs +21 -16
  52. package/dist/cjs/RichTextEditor/RichTextEditor/utils/controlmap.cjs +29 -25
  53. package/dist/cjs/RichTextEditor/utils/plugins/LinkManager/components/LinkPopover/LinkPopover.cjs +10 -12
  54. package/dist/cjs/Select/Select.cjs +8 -10
  55. package/dist/cjs/SplitButton/subcomponents/DropdownButton/DropdownButton.cjs +4 -4
  56. package/dist/cjs/Table/Table.cjs +11 -10
  57. package/dist/cjs/Tag/Tag.cjs +21 -17
  58. package/dist/cjs/TextField/TextField.cjs +5 -4
  59. package/dist/cjs/Tile/subcomponents/GenericTile/GenericTile.cjs +8 -7
  60. package/dist/cjs/TitleBlockZen/TitleBlockZen.cjs +9 -12
  61. package/dist/cjs/TitleBlockZen/subcomponents/MainActions.cjs +7 -7
  62. package/dist/cjs/TitleBlockZen/subcomponents/MobileActions.cjs +10 -15
  63. package/dist/cjs/TitleBlockZen/subcomponents/SecondaryActions.cjs +7 -7
  64. package/dist/cjs/ToggleSwitch/ToggleSwitch/ToggleSwitch.cjs +5 -5
  65. package/dist/cjs/Workflow/subcomponents/Footer/components/ProgressStepper/ProgressStepper.cjs +13 -18
  66. package/dist/cjs/__future__/Icon/Icon.cjs +47 -0
  67. package/dist/cjs/__future__/Icon/Icon.module.css.cjs +10 -0
  68. package/dist/cjs/__future__/Icon/constants.cjs +8 -0
  69. package/dist/cjs/__future__/Select/subcomponents/Option/Option.cjs +4 -5
  70. package/dist/cjs/__future__/Select/subcomponents/SelectToggle/SelectToggle.cjs +5 -9
  71. package/dist/cjs/__future__/Tag/RemovableTag/subcomponents/RemoveButton.cjs +4 -3
  72. package/dist/cjs/future.cjs +2 -0
  73. package/dist/esm/Avatar/Avatar.mjs +16 -13
  74. package/dist/esm/Calendar/CalendarRange/CalendarRange.mjs +9 -7
  75. package/dist/esm/Calendar/CalendarSingle/CalendarSingle.mjs +9 -7
  76. package/dist/esm/Calendar/LegacyCalendarRange/LegacyCalendarRange.mjs +9 -7
  77. package/dist/esm/Checkbox/Checkbox/Checkbox.mjs +5 -11
  78. package/dist/esm/ClearButton/ClearButton.mjs +5 -4
  79. package/dist/esm/Collapsible/Collapsible/Collapsible.mjs +5 -8
  80. package/dist/esm/DateInput/DateInputWithIconButton/DateInputWithIconButton.mjs +5 -4
  81. package/dist/esm/DateRangePicker/DateRangePicker.mjs +5 -4
  82. package/dist/esm/ErrorPage/ErrorPage.mjs +10 -8
  83. package/dist/esm/FieldMessage/FieldMessage.mjs +6 -12
  84. package/dist/esm/Filter/FilterBar/subcomponents/AddFiltersMenu/AddFiltersMenu.mjs +4 -5
  85. package/dist/esm/Filter/FilterButton/FilterButton/FilterButton.mjs +5 -8
  86. package/dist/esm/Filter/FilterButton/FilterButtonRemovable/FilterButtonRemovable.mjs +5 -5
  87. package/dist/esm/Filter/FilterMultiSelect/subcomponents/MultiSelectOption/MultiSelectOption.mjs +4 -4
  88. package/dist/esm/GuidanceBlock/GuidanceBlock.mjs +5 -4
  89. package/dist/esm/Illustration/utils/usePausePlay.mjs +5 -8
  90. package/dist/esm/Input/InputSearch/InputSearch.mjs +4 -3
  91. package/dist/esm/LikertScaleLegacy/LikertScaleLegacy.mjs +5 -6
  92. package/dist/esm/Modal/ConfirmationModal/ConfirmationModal.mjs +31 -26
  93. package/dist/esm/Modal/GenericModal/subcomponents/ModalHeader/ModalHeader.mjs +4 -5
  94. package/dist/esm/MultiSelect/subcomponents/Checkbox/Checkbox.mjs +7 -17
  95. package/dist/esm/MultiSelect/subcomponents/MultiSelectToggle/MultiSelectToggle.mjs +5 -8
  96. package/dist/esm/Notification/subcomponents/CancelButton/CancelButton.mjs +4 -3
  97. package/dist/esm/Notification/subcomponents/NotificationIcon/NotificationIcon.mjs +33 -38
  98. package/dist/esm/Notification/subcomponents/NotificationIcon/NotificationIcon.module.css.mjs +4 -0
  99. package/dist/esm/Pagination/subcomponents/DirectionalLink/DirectionalLink.mjs +11 -19
  100. package/dist/esm/Pagination/subcomponents/TruncateIndicator/TruncateIndicator.mjs +4 -5
  101. package/dist/esm/Popover/Popover.mjs +5 -4
  102. package/dist/esm/Popover/utils/classMappers.mjs +21 -16
  103. package/dist/esm/RichTextEditor/RichTextEditor/utils/controlmap.mjs +33 -29
  104. package/dist/esm/RichTextEditor/utils/plugins/LinkManager/components/LinkPopover/LinkPopover.mjs +10 -12
  105. package/dist/esm/Select/Select.mjs +9 -11
  106. package/dist/esm/SplitButton/subcomponents/DropdownButton/DropdownButton.mjs +4 -4
  107. package/dist/esm/Table/Table.mjs +11 -10
  108. package/dist/esm/Tag/Tag.mjs +21 -17
  109. package/dist/esm/TextField/TextField.mjs +5 -4
  110. package/dist/esm/Tile/subcomponents/GenericTile/GenericTile.mjs +8 -7
  111. package/dist/esm/TitleBlockZen/TitleBlockZen.mjs +9 -12
  112. package/dist/esm/TitleBlockZen/subcomponents/MainActions.mjs +7 -7
  113. package/dist/esm/TitleBlockZen/subcomponents/MobileActions.mjs +13 -18
  114. package/dist/esm/TitleBlockZen/subcomponents/SecondaryActions.mjs +7 -7
  115. package/dist/esm/ToggleSwitch/ToggleSwitch/ToggleSwitch.mjs +5 -5
  116. package/dist/esm/Workflow/subcomponents/Footer/components/ProgressStepper/ProgressStepper.mjs +16 -21
  117. package/dist/esm/__future__/Icon/Icon.mjs +38 -0
  118. package/dist/esm/__future__/Icon/Icon.module.css.mjs +8 -0
  119. package/dist/esm/__future__/Icon/constants.mjs +6 -0
  120. package/dist/esm/__future__/Select/subcomponents/Option/Option.mjs +4 -5
  121. package/dist/esm/__future__/Select/subcomponents/SelectToggle/SelectToggle.mjs +6 -10
  122. package/dist/esm/__future__/Tag/RemovableTag/subcomponents/RemoveButton.mjs +4 -3
  123. package/dist/esm/future.mjs +1 -0
  124. package/dist/styles.css +562 -538
  125. package/dist/types/__future__/Icon/Icon.d.ts +21 -0
  126. package/dist/types/__future__/Icon/constants.d.ts +5 -0
  127. package/dist/types/__future__/Icon/index.d.ts +1 -0
  128. package/dist/types/__future__/Icon/types.d.ts +4 -0
  129. package/dist/types/__future__/index.d.ts +1 -0
  130. package/package.json +2 -2
  131. package/src/Avatar/Avatar.module.scss +6 -8
  132. package/src/Avatar/Avatar.tsx +14 -5
  133. package/src/BrandMoment/_docs/BrandMoment.stories.tsx +6 -10
  134. package/src/BrandMoment/_docs/ExampleHeaders.tsx +2 -2
  135. package/src/Calendar/CalendarRange/CalendarRange.tsx +7 -3
  136. package/src/Calendar/CalendarSingle/CalendarSingle.tsx +7 -3
  137. package/src/Calendar/LegacyCalendarRange/LegacyCalendarRange.tsx +7 -3
  138. package/src/Calendar/baseCalendarClassNames.module.scss +0 -4
  139. package/src/Checkbox/Checkbox/Checkbox.module.scss +0 -8
  140. package/src/Checkbox/Checkbox/Checkbox.tsx +6 -8
  141. package/src/ClearButton/ClearButton.tsx +2 -2
  142. package/src/Collapsible/Collapsible/Collapsible.tsx +5 -6
  143. package/src/Collapsible/Collapsible/_docs/Collapsible.stories.tsx +2 -2
  144. package/src/DateInput/DateInputWithIconButton/DateInputWithIconButton.module.scss +2 -7
  145. package/src/DateInput/DateInputWithIconButton/DateInputWithIconButton.tsx +2 -2
  146. package/src/DateRangePicker/DateRangePicker.tsx +2 -2
  147. package/src/EmptyState/_docs/EmptyState.stickersheet.stories.tsx +8 -2
  148. package/src/EmptyState/_docs/EmptyState.stories.tsx +4 -2
  149. package/src/ErrorPage/ErrorPage.tsx +5 -3
  150. package/src/FieldMessage/FieldMessage.tsx +6 -14
  151. package/src/Filter/FilterBar/FilterBar.spec.tsx +12 -12
  152. package/src/Filter/FilterBar/subcomponents/AddFiltersMenu/AddFiltersMenu.tsx +2 -2
  153. package/src/Filter/FilterButton/FilterButton/FilterButton.module.scss +1 -1
  154. package/src/Filter/FilterButton/FilterButton/FilterButton.tsx +5 -6
  155. package/src/Filter/FilterButton/FilterButtonRemovable/FilterButtonRemovable.tsx +2 -2
  156. package/src/Filter/FilterDateRangePicker/FilterDateRangePicker.spec.tsx +0 -1
  157. package/src/Filter/FilterDateRangePicker/subcomponents/DateRangeInputField/DateRangeInputField.spec.tsx +2 -1
  158. package/src/Filter/FilterMultiSelect/subcomponents/MultiSelectOption/MultiSelectOption.tsx +2 -2
  159. package/src/Filter/FilterSelect/FilterSelect.spec.tsx +4 -5
  160. package/src/GuidanceBlock/GuidanceBlock.tsx +6 -2
  161. package/src/Icon/_docs/{Icon.stories.tsx → Icon.docs.stories.tsx} +1 -1
  162. package/src/Icon/_docs/Icon.mdx +1 -2
  163. package/src/Icon/_docs/Icon.stickersheet.stories.tsx +1 -1
  164. package/src/Illustration/utils/usePausePlay.tsx +7 -5
  165. package/src/Input/Input/_docs/Input.stickersheet.stories.tsx +7 -5
  166. package/src/Input/Input/_docs/Input.stories.tsx +5 -3
  167. package/src/Input/InputSearch/InputSearch.tsx +2 -2
  168. package/src/Label/Label.module.scss +4 -0
  169. package/src/LikertScaleLegacy/LikertScaleLegacy.tsx +2 -2
  170. package/src/Loading/LoadingGraphic/_docs/LoadingGraphic.stories.tsx +2 -2
  171. package/src/Modal/ConfirmationModal/ConfirmationModal.module.scss +2 -0
  172. package/src/Modal/ConfirmationModal/ConfirmationModal.tsx +32 -35
  173. package/src/Modal/GenericModal/subcomponents/ModalHeader/ModalHeader.tsx +2 -2
  174. package/src/MultiSelect/MultiSelect.spec.tsx +7 -3
  175. package/src/MultiSelect/subcomponents/Checkbox/Checkbox.module.scss +0 -6
  176. package/src/MultiSelect/subcomponents/Checkbox/Checkbox.tsx +10 -9
  177. package/src/MultiSelect/subcomponents/MultiSelectOptions/MultiSelectOptions.spec.tsx +11 -7
  178. package/src/MultiSelect/subcomponents/MultiSelectToggle/MultiSelectToggle.tsx +5 -7
  179. package/src/Notification/subcomponents/CancelButton/CancelButton.tsx +2 -2
  180. package/src/Notification/subcomponents/GenericNotification/_mixins.scss +2 -0
  181. package/src/Notification/subcomponents/NotificationIcon/NotificationIcon.module.css +3 -0
  182. package/src/Notification/subcomponents/NotificationIcon/NotificationIcon.tsx +22 -16
  183. package/src/Pagination/subcomponents/DirectionalLink/DirectionalLink.module.scss +0 -4
  184. package/src/Pagination/subcomponents/DirectionalLink/DirectionalLink.tsx +13 -12
  185. package/src/Pagination/subcomponents/TruncateIndicator/TruncateIndicator.module.scss +0 -1
  186. package/src/Pagination/subcomponents/TruncateIndicator/TruncateIndicator.tsx +2 -2
  187. package/src/Popover/Popover.module.scss +3 -3
  188. package/src/Popover/Popover.tsx +2 -2
  189. package/src/Popover/utils/classMappers.tsx +6 -11
  190. package/src/RichTextEditor/RichTextEditor/subcomponents/ToggleIconButton/_docs/ToggleIconButton.stickersheet.stories.tsx +7 -7
  191. package/src/RichTextEditor/RichTextEditor/subcomponents/ToggleIconButton/_docs/ToggleIconButton.stories.tsx +2 -2
  192. package/src/RichTextEditor/RichTextEditor/subcomponents/Toolbar/Toolbar.spec.tsx +7 -4
  193. package/src/RichTextEditor/RichTextEditor/subcomponents/Toolbar/_docs/Toolbar.stories.tsx +18 -12
  194. package/src/RichTextEditor/RichTextEditor/utils/controlmap.tsx +25 -18
  195. package/src/RichTextEditor/utils/plugins/LinkManager/components/LinkPopover/LinkPopover.tsx +4 -8
  196. package/src/Select/Select.module.scss +2 -0
  197. package/src/Select/Select.tsx +10 -7
  198. package/src/SplitButton/subcomponents/DropdownButton/DropdownButton.spec.tsx +4 -5
  199. package/src/SplitButton/subcomponents/DropdownButton/DropdownButton.tsx +2 -2
  200. package/src/Table/Table.tsx +4 -8
  201. package/src/Table/_docs/Table.stickersheet.stories.tsx +4 -4
  202. package/src/Table/_docs/Table.stories.tsx +3 -3
  203. package/src/Tag/Tag.module.scss +2 -0
  204. package/src/Tag/Tag.tsx +7 -13
  205. package/src/Text/Text.module.scss +2 -0
  206. package/src/TextField/TextField.spec.tsx +9 -4
  207. package/src/TextField/TextField.tsx +2 -2
  208. package/src/TextField/_docs/TextField.stories.tsx +4 -3
  209. package/src/Tile/subcomponents/GenericTile/GenericTile.tsx +3 -3
  210. package/src/TitleBlockZen/TitleBlockZen.module.scss +1 -0
  211. package/src/TitleBlockZen/TitleBlockZen.spec.tsx +1 -1
  212. package/src/TitleBlockZen/TitleBlockZen.tsx +6 -9
  213. package/src/TitleBlockZen/_docs/TitleBlockZen.stories.tsx +5 -5
  214. package/src/TitleBlockZen/subcomponents/MainActions.tsx +5 -3
  215. package/src/TitleBlockZen/subcomponents/MobileActions.tsx +13 -16
  216. package/src/TitleBlockZen/subcomponents/SecondaryActions.tsx +3 -3
  217. package/src/ToggleSwitch/ToggleSwitch/ToggleSwitch.module.scss +0 -3
  218. package/src/ToggleSwitch/ToggleSwitch/ToggleSwitch.tsx +2 -2
  219. package/src/Workflow/_docs/Workflow.stories.tsx +4 -5
  220. package/src/Workflow/_docs/WorkflowHeader.stories.tsx +4 -5
  221. package/src/Workflow/_docs/controls/controls.tsx +4 -4
  222. package/src/Workflow/subcomponents/Footer/components/ProgressStepper/ProgressStepper.tsx +6 -31
  223. package/src/__actions__/Button/v1/Button/_docs/Button.stickersheet.stories.tsx +5 -5
  224. package/src/__actions__/Button/v1/Button/_docs/Button.stories.tsx +6 -5
  225. package/src/__actions__/Button/v1/IconButton/_docs/IconButton.stickersheet.stories.tsx +6 -6
  226. package/src/__actions__/Button/v1/IconButton/_docs/IconButton.stories.tsx +4 -4
  227. package/src/__actions__/Button/v2/Button/_docs/Button.stories.tsx +6 -5
  228. package/src/__actions__/Button/v2/IconButton/_docs/IconButton.stories.tsx +4 -4
  229. package/src/__actions__/Menu/v1/_docs/Menu.stickersheet.stories.tsx +3 -3
  230. package/src/__actions__/Menu/v1/_docs/Menu.stories.tsx +3 -3
  231. package/src/__actions__/Menu/v1/_docs/MenuContentExample.tsx +6 -6
  232. package/src/__actions__/Menu/v1/_docs/examples.tsx +5 -5
  233. package/src/__actions__/Menu/v2/_docs/Menu.stories.tsx +3 -3
  234. package/src/__actions__/Menu/v3/_docs/ApiSpecification.mdx +1 -3
  235. package/src/__actions__/Menu/v3/_docs/Menu.docs.stories.tsx +46 -45
  236. package/src/__actions__/Menu/v3/_docs/Menu.mdx +1 -1
  237. package/src/__actions__/Menu/v3/_docs/Menu.spec.stories.tsx +21 -23
  238. package/src/__actions__/Menu/v3/_docs/Menu.stories.tsx +12 -15
  239. package/src/__future__/Icon/Icon.module.css +35 -0
  240. package/src/__future__/Icon/Icon.spec.tsx +36 -0
  241. package/src/__future__/Icon/Icon.tsx +85 -0
  242. package/src/__future__/Icon/_docs/Icon--api-specification.mdx +98 -0
  243. package/src/__future__/Icon/_docs/Icon--usage-guidelines.mdx +145 -0
  244. package/src/__future__/Icon/_docs/Icon.docs.module.css +17 -0
  245. package/src/__future__/Icon/_docs/Icon.docs.stories.tsx +524 -0
  246. package/src/__future__/Icon/_docs/Icon.stickersheet.stories.tsx +126 -0
  247. package/src/__future__/Icon/_docs/assets/interface-dont.png +0 -0
  248. package/src/__future__/Icon/_docs/assets/tooltip-dont.png +0 -0
  249. package/src/__future__/Icon/constants.ts +149 -0
  250. package/src/__future__/Icon/index.ts +1 -0
  251. package/src/__future__/Icon/material-symbols-metadata.json +3370 -0
  252. package/src/__future__/Icon/types.ts +11 -0
  253. package/src/__future__/Select/subcomponents/Option/Option.tsx +2 -2
  254. package/src/__future__/Select/subcomponents/SelectToggle/SelectToggle.module.scss +1 -1
  255. package/src/__future__/Select/subcomponents/SelectToggle/SelectToggle.tsx +6 -9
  256. package/src/__future__/Tag/RemovableTag/_docs/RemovableTag.stories.tsx +0 -77
  257. package/src/__future__/Tag/RemovableTag/subcomponents/RemoveButton.module.scss +0 -56
  258. package/src/__future__/Tag/RemovableTag/subcomponents/RemoveButton.tsx +2 -12
  259. package/src/__future__/Tag/Tag/Tag.module.scss +1 -1
  260. package/src/__future__/Tag/Tag/_docs/Tag-migration-guide.stories.tsx +6 -17
  261. package/src/__future__/Tag/Tag/_docs/Tag.stickersheet.stories.tsx +5 -2
  262. package/src/__future__/Tag/Tag/_docs/Tag.stories.tsx +13 -6
  263. package/src/__future__/index.ts +1 -0
  264. package/src/__overlays__/Tooltip/v1/_docs/Tooltip.stickersheet.stories.tsx +10 -10
  265. package/src/__overlays__/Tooltip/v1/_docs/Tooltip.stories.tsx +7 -4
  266. package/src/__overlays__/Tooltip/v1/utils/isSemanticElement.spec.tsx +4 -11
  267. package/src/__overlays__/Tooltip/v3/_docs/Tooltip.docs.stories.tsx +10 -10
  268. package/src/__overlays__/Tooltip/v3/_docs/Tooltip.spec.stories.tsx +3 -3
  269. package/codemods/utils/getTagName.spec.ts +0 -24
  270. package/codemods/utils/getTagName.ts +0 -32
  271. package/dist/cjs/__future__/Tag/RemovableTag/subcomponents/RemoveTagIcon.cjs +0 -23
  272. package/dist/esm/__future__/Tag/RemovableTag/subcomponents/RemoveTagIcon.mjs +0 -15
  273. package/dist/types/__future__/Tag/RemovableTag/subcomponents/RemoveTagIcon.d.ts +0 -2
  274. package/src/__future__/Tag/RemovableTag/subcomponents/RemoveTagIcon.tsx +0 -21
@@ -2,17 +2,8 @@ import React, { FunctionComponent, ReactNode } from "react"
2
2
  import { Meta, StoryObj } from "@storybook/react"
3
3
  import isChromatic from "chromatic"
4
4
  import { Popover } from "react-aria-components"
5
- import {
6
- ArrowDownIcon,
7
- ArrowUpIcon,
8
- BookmarkOffIcon,
9
- CheckIcon,
10
- ChevronDownIcon,
11
- EditIcon,
12
- MeatballsIcon,
13
- TrashIcon,
14
- } from "~components/Icon"
15
5
  import { Button } from "~components/__actions__/v3"
6
+ import { Icon } from "~components/__future__/Icon"
16
7
  import { Menu, MenuItem, MenuTrigger } from "../index"
17
8
 
18
9
  const meta = {
@@ -31,19 +22,27 @@ type Story = StoryObj<typeof meta>
31
22
 
32
23
  const DefaultMenuItems = (): ReactNode => (
33
24
  <>
34
- <MenuItem icon={<BookmarkOffIcon role="presentation" />}>Save</MenuItem>
35
- <MenuItem icon={<EditIcon role="presentation" />}>Edit</MenuItem>
36
- <MenuItem icon={<ArrowUpIcon role="presentation" />}>Move up</MenuItem>
37
- <MenuItem icon={<ArrowDownIcon role="presentation" />}>Move down</MenuItem>
38
- <MenuItem icon={<TrashIcon role="presentation" />}>Delete</MenuItem>
25
+ <MenuItem icon={<Icon name="bookmark" isPresentational />}>Save</MenuItem>
26
+ <MenuItem icon={<Icon name="edit" isPresentational isFilled />}>
27
+ Edit
28
+ </MenuItem>
29
+ <MenuItem icon={<Icon name="arrow_upward" isPresentational />}>
30
+ Move up
31
+ </MenuItem>
32
+ <MenuItem icon={<Icon name="arrow_downward" isPresentational />}>
33
+ Move down
34
+ </MenuItem>
35
+ <MenuItem icon={<Icon name="delete" isPresentational isFilled />}>
36
+ Delete
37
+ </MenuItem>
39
38
  </>
40
39
  )
41
40
 
42
41
  export const Actions: Story = {
43
42
  render: ({ defaultOpen: _, ...args }) => (
44
43
  <MenuTrigger {...args}>
45
- <Button>
46
- <MeatballsIcon role="img" aria-label="Additional actions" />
44
+ <Button className="[--icon-size:24]">
45
+ <Icon name="more_horiz" alt="Additional actions" />
47
46
  </Button>
48
47
  <Popover>
49
48
  <Menu>
@@ -60,8 +59,8 @@ export const Actions: Story = {
60
59
  export const ItemsDo: Story = {
61
60
  render: ({ defaultOpen, ...args }) => (
62
61
  <MenuTrigger defaultOpen={defaultOpen} {...args}>
63
- <Button>
64
- <MeatballsIcon role="img" aria-label="Additional actions" />
62
+ <Button className="[--icon-size:24]">
63
+ <Icon name="more_horiz" alt="Additional actions" />
65
64
  </Button>
66
65
  <Popover>
67
66
  <Menu>
@@ -75,12 +74,14 @@ export const ItemsDo: Story = {
75
74
  export const ItemsDont: Story = {
76
75
  render: ({ defaultOpen, ...args }) => (
77
76
  <MenuTrigger defaultOpen={defaultOpen} {...args}>
78
- <Button>
79
- <MeatballsIcon role="img" aria-label="Additional actions" />
77
+ <Button className="[--icon-size:24]">
78
+ <Icon name="more_horiz" alt="Additional actions" />
80
79
  </Button>
81
80
  <Popover>
82
81
  <Menu>
83
- <MenuItem icon={<TrashIcon role="presentation" />}>Delete</MenuItem>
82
+ <MenuItem icon={<Icon name="delete" isPresentational isFilled />}>
83
+ Delete
84
+ </MenuItem>
84
85
  </Menu>
85
86
  </Popover>
86
87
  </MenuTrigger>
@@ -90,13 +91,13 @@ export const ItemsDont: Story = {
90
91
  export const SelectionDont: Story = {
91
92
  render: ({ defaultOpen, ...args }) => (
92
93
  <MenuTrigger defaultOpen={defaultOpen} {...args}>
93
- <Button>
94
+ <Button className="[--icon-size:24]">
94
95
  Sort by
95
- <ChevronDownIcon role="presentation" />
96
+ <Icon name="keyboard_arrow_down" isPresentational />
96
97
  </Button>
97
98
  <Popover>
98
99
  <Menu>
99
- <MenuItem icon={<CheckIcon role="presentation" />}>
100
+ <MenuItem icon={<Icon name="check" isPresentational />}>
100
101
  Recommended
101
102
  </MenuItem>
102
103
  <MenuItem>Most recent</MenuItem>
@@ -110,9 +111,9 @@ export const LabelChevronDo: Story = {
110
111
  render: ({ defaultOpen, ...args }) => (
111
112
  <MenuTrigger defaultOpen={defaultOpen} {...args}>
112
113
  {/* Replace with Kaizen Button once we have v3 or backwards compatibility */}
113
- <Button>
114
+ <Button className="[--icon-size:24]">
114
115
  Edit item
115
- <ChevronDownIcon role="presentation" />
116
+ <Icon name="keyboard_arrow_down" isPresentational />
116
117
  </Button>
117
118
  <Popover>
118
119
  <Menu>
@@ -139,9 +140,9 @@ export const LabelChevronDont: Story = {
139
140
  export const LabelDo: Story = {
140
141
  render: ({ defaultOpen, ...args }) => (
141
142
  <MenuTrigger defaultOpen={defaultOpen}>
142
- <Button>
143
+ <Button className="[--icon-size:24]">
143
144
  Actions [visually hidden], conversation with Harper[/visually hidden]
144
- <ChevronDownIcon role="presentation" />
145
+ <Icon name="keyboard_arrow_down" isPresentational />
145
146
  </Button>
146
147
  <Popover>
147
148
  <Menu {...args}>
@@ -155,9 +156,9 @@ export const LabelDo: Story = {
155
156
  export const LabelDont: Story = {
156
157
  render: ({ defaultOpen, ...args }) => (
157
158
  <MenuTrigger defaultOpen={defaultOpen}>
158
- <Button>
159
+ <Button className="[--icon-size:24]">
159
160
  Open menu
160
- <ChevronDownIcon role="presentation" />
161
+ <Icon name="keyboard_arrow_down" isPresentational />
161
162
  </Button>
162
163
  <Popover>
163
164
  <Menu {...args}>
@@ -171,15 +172,15 @@ export const LabelDont: Story = {
171
172
  export const IconsDont: Story = {
172
173
  render: ({ defaultOpen, ...args }) => (
173
174
  <MenuTrigger defaultOpen={defaultOpen}>
174
- <Button>
175
- <MeatballsIcon role="img" aria-label="Additional actions" />
175
+ <Button className="[--icon-size:24]">
176
+ <Icon name="more_horiz" alt="Additional actions" />
176
177
  </Button>
177
178
  <Popover>
178
179
  <Menu {...args}>
179
- <MenuItem icon={<EditIcon role="presentation" />}>
180
+ <MenuItem icon={<Icon name="edit" isPresentational isFilled />}>
180
181
  Edit &lsquo;Strengths&rsquo;
181
182
  </MenuItem>
182
- <MenuItem icon={<EditIcon role="presentation" />}>
183
+ <MenuItem icon={<Icon name="edit" isPresentational isFilled />}>
183
184
  Edit &lsquo;Weaknesses&rsquo;
184
185
  </MenuItem>
185
186
  <MenuItem>Export PDF</MenuItem>
@@ -193,8 +194,8 @@ export const IconsDont: Story = {
193
194
  export const MenuItemLabelsDont: Story = {
194
195
  render: ({ defaultOpen, ...args }) => (
195
196
  <MenuTrigger defaultOpen={defaultOpen}>
196
- <Button>
197
- <MeatballsIcon role="img" aria-label="Additional actions" />
197
+ <Button className="[--icon-size:24]">
198
+ <Icon name="more_horiz" alt="Additional actions" />
198
199
  </Button>
199
200
  <Popover>
200
201
  <Menu {...args}>
@@ -211,8 +212,8 @@ export const SentenceCaseDo: Story = {
211
212
  render: ({ defaultOpen, ...args }) => (
212
213
  <MenuTrigger defaultOpen={defaultOpen}>
213
214
  {/* Replace with Kaizen Button once we have v3 or backwards compatibility */}
214
- <Button>
215
- <MeatballsIcon role="img" aria-label="Additional actions" />
215
+ <Button className="[--icon-size:24]">
216
+ <Icon name="more_horiz" alt="Additional actions" />
216
217
  </Button>
217
218
  <Popover>
218
219
  <Menu {...args}>
@@ -229,8 +230,8 @@ export const SentenceCaseDont: Story = {
229
230
  render: ({ defaultOpen, ...args }) => (
230
231
  <MenuTrigger defaultOpen={defaultOpen}>
231
232
  {/* Replace with Kaizen Button once we have v3 or backwards compatibility */}
232
- <Button>
233
- <MeatballsIcon role="img" aria-label="Additional actions" />
233
+ <Button className="[--icon-size:24]">
234
+ <Icon name="more_horiz" alt="Additional actions" />
234
235
  </Button>
235
236
  <Popover>
236
237
  <Menu {...args}>
@@ -247,8 +248,8 @@ export const ElipsesDo: Story = {
247
248
  render: ({ defaultOpen, ...args }) => (
248
249
  <MenuTrigger defaultOpen={defaultOpen}>
249
250
  {/* Replace with Kaizen Button once we have v3 or backwards compatibility */}
250
- <Button>
251
- <MeatballsIcon role="img" aria-label="Additional actions" />
251
+ <Button className="[--icon-size:24]">
252
+ <Icon name="more_horiz" alt="Additional actions" />
252
253
  </Button>
253
254
  <Popover>
254
255
  <Menu {...args}>
@@ -265,8 +266,8 @@ export const ElipsesDont: Story = {
265
266
  render: ({ defaultOpen, ...args }) => (
266
267
  <MenuTrigger defaultOpen={defaultOpen}>
267
268
  {/* Replace with Kaizen Button once we have v3 or backwards compatibility */}
268
- <Button>
269
- <MeatballsIcon role="img" aria-label="Additional actions" />
269
+ <Button className="[--icon-size:24]">
270
+ <Icon name="more_horiz" alt="Additional actions" />
270
271
  </Button>
271
272
  <Popover>
272
273
  <Menu {...args}>
@@ -34,7 +34,7 @@ import * as MenuStories from "./Menu.stories"
34
34
  source={{code: `
35
35
  <TooltipTrigger>
36
36
  <Button>
37
- <MeatballsIcon role="img" aria-label="Additional actions" />
37
+ <Icon name="more_horiz" alt="Additional actions" />
38
38
  </Button>
39
39
  <Popover>
40
40
  <Menu>
@@ -3,17 +3,8 @@ import { Meta, StoryObj } from "@storybook/react"
3
3
  import { expect, userEvent, waitFor, within, fn } from "@storybook/test"
4
4
  import isChromatic from "chromatic"
5
5
  import { Popover, Header, Section } from "react-aria-components"
6
- import {
7
- ArrowDownIcon,
8
- ArrowUpIcon,
9
- BookmarkOffIcon,
10
- CautionIcon,
11
- EditIcon,
12
- ExternalLinkIcon,
13
- MeatballsIcon,
14
- TrashIcon,
15
- } from "~components/Icon"
16
6
  import { Button } from "~components/__actions__/v3"
7
+ import { Icon } from "~components/__future__/Icon"
17
8
  import { Menu, MenuItem, MenuTrigger } from "../index"
18
9
 
19
10
  const meta = {
@@ -46,31 +37,38 @@ export const KitchenSink: Story = {
46
37
  render: ({ defaultOpen, ...args }) => (
47
38
  <MenuTrigger defaultOpen={defaultOpen} {...args}>
48
39
  <Button>
49
- <MeatballsIcon role="img" aria-label="Additional actions" />
40
+ <Icon name="more_horiz" alt="Additional actions" />
50
41
  </Button>
51
42
  <Popover>
52
43
  <Menu>
53
44
  <Section>
54
45
  <Header>Section One</Header>
55
46
  <MenuItem
56
- icon={<BookmarkOffIcon role="presentation" />}
47
+ icon={<Icon name="bookmark" isPresentational />}
57
48
  href="https://cultureamp.com"
58
49
  >
59
50
  Save
60
51
  </MenuItem>
61
- <MenuItem icon={<EditIcon role="presentation" />}>Edit</MenuItem>
52
+ <MenuItem icon={<Icon name="edit" isPresentational isFilled />}>
53
+ Edit
54
+ </MenuItem>
62
55
  </Section>
63
56
  <Section>
64
- <MenuItem icon={<ArrowUpIcon role="presentation" />}>
57
+ <MenuItem icon={<Icon name="arrow_upward" isPresentational />}>
65
58
  Move Up
66
59
  </MenuItem>
67
- <MenuItem icon={<ArrowDownIcon role="presentation" />}>
60
+ <MenuItem icon={<Icon name="arrow_downward" isPresentational />}>
68
61
  Menu item with a longer label
69
62
  </MenuItem>
70
63
  </Section>
71
64
  <Section>
72
- <MenuItem icon={<TrashIcon role="presentation" />}>Delete</MenuItem>
73
- <MenuItem icon={<TrashIcon role="presentation" />} isDisabled>
65
+ <MenuItem icon={<Icon name="delete" isPresentational isFilled />}>
66
+ Delete
67
+ </MenuItem>
68
+ <MenuItem
69
+ icon={<Icon name="delete" isPresentational isFilled />}
70
+ isDisabled
71
+ >
74
72
  Delete but disabled
75
73
  </MenuItem>
76
74
  <MenuItem>Other action</MenuItem>
@@ -87,18 +85,18 @@ export const Basic: Story = {
87
85
  render: ({ defaultOpen, ...args }) => (
88
86
  <MenuTrigger defaultOpen={defaultOpen} {...args}>
89
87
  <Button>
90
- <MeatballsIcon role="img" aria-label="Additional actions" />
88
+ <Icon name="more_horiz" alt="Additional actions" />
91
89
  </Button>
92
90
  <Popover>
93
91
  <Menu>
94
92
  <MenuItem
95
- icon={<CautionIcon role="presentation" />}
93
+ icon={<Icon name="warning" isPresentational isFilled />}
96
94
  onAction={() => alert("Menu item pressed")}
97
95
  >
98
96
  Trigger an alert
99
97
  </MenuItem>
100
98
  <MenuItem
101
- icon={<ExternalLinkIcon role="presentation" />}
99
+ icon={<Icon name="open_in_new" isPresentational />}
102
100
  href="https://cultureamp.com"
103
101
  target="_blank"
104
102
  >
@@ -168,7 +166,7 @@ export const DisabledItems: Story = {
168
166
  render: () => (
169
167
  <MenuTrigger>
170
168
  <Button>
171
- <MeatballsIcon role="img" aria-label="Additional actions" />
169
+ <Icon name="more_horiz" alt="Additional actions" />
172
170
  </Button>
173
171
  <Popover>
174
172
  <Menu>
@@ -208,7 +206,7 @@ export const WithSections: Story = {
208
206
  render: () => (
209
207
  <MenuTrigger>
210
208
  <Button>
211
- <MeatballsIcon role="img" aria-label="Additional actions" />
209
+ <Icon name="more_horiz" alt="Additional actions" />
212
210
  </Button>
213
211
  <Popover>
214
212
  <Menu>
@@ -240,7 +238,7 @@ export const Controlled: Story = {
240
238
  </button>
241
239
  <MenuTrigger isOpen={isOpen} onOpenChange={setOpen}>
242
240
  <Button>
243
- <MeatballsIcon role="img" aria-label="Additional actions" />
241
+ <Icon name="more_horiz" alt="Additional actions" />
244
242
  </Button>
245
243
  <Popover>
246
244
  <Menu>
@@ -2,15 +2,8 @@ import React, { FunctionComponent } from "react"
2
2
  import { Meta, StoryObj } from "@storybook/react"
3
3
  import isChromatic from "chromatic"
4
4
  import { Popover } from "react-aria-components"
5
- import {
6
- ArrowDownIcon,
7
- ArrowUpIcon,
8
- BookmarkOffIcon,
9
- EditIcon,
10
- MeatballsIcon,
11
- TrashIcon,
12
- } from "~components/Icon"
13
5
  import { Button } from "~components/__actions__/v3"
6
+ import { Icon } from "~components/__future__/Icon"
14
7
  import { Menu, MenuTrigger, MenuItem } from "../index"
15
8
  import * as testStories from "./Menu.spec.stories"
16
9
 
@@ -32,22 +25,26 @@ export const Playground: Story = {
32
25
  render: ({ defaultOpen: _, ...args }) => (
33
26
  <MenuTrigger {...args}>
34
27
  {/* Replace with Kaizen Button once we have v3 or backwards compatibility */}
35
- <Button>
36
- <MeatballsIcon role="img" aria-label="Additional actions" />
28
+ <Button className="[--icon-size:24]">
29
+ <Icon name="more_horiz" alt="Additional actions" />
37
30
  </Button>
38
31
  <Popover>
39
32
  <Menu>
40
- <MenuItem icon={<BookmarkOffIcon role="presentation" />}>
33
+ <MenuItem icon={<Icon name="bookmark" isPresentational />}>
41
34
  Save
42
35
  </MenuItem>
43
- <MenuItem icon={<EditIcon role="presentation" />}>Edit</MenuItem>
44
- <MenuItem icon={<ArrowUpIcon role="presentation" />}>
36
+ <MenuItem icon={<Icon name="edit" isPresentational isFilled />}>
37
+ Edit
38
+ </MenuItem>
39
+ <MenuItem icon={<Icon name="arrow_upward" isPresentational />}>
45
40
  Move up
46
41
  </MenuItem>
47
- <MenuItem icon={<ArrowDownIcon role="presentation" />}>
42
+ <MenuItem icon={<Icon name="arrow_downward" isPresentational />}>
48
43
  Move down
49
44
  </MenuItem>
50
- <MenuItem icon={<TrashIcon role="presentation" />}>Delete</MenuItem>
45
+ <MenuItem icon={<Icon name="delete" isPresentational isFilled />}>
46
+ Delete
47
+ </MenuItem>
51
48
  </Menu>
52
49
  </Popover>
53
50
  </MenuTrigger>
@@ -0,0 +1,35 @@
1
+ .icon {
2
+ font-size: calc(1px * var(--icon-size, 20));
3
+ font-weight: var(--icon-font-weight, 400);
4
+ vertical-align: var(--icon-vertical-align);
5
+
6
+ /* Must use vars otherwise whole attribute must be set again */
7
+ font-variation-settings:
8
+ "FILL" var(--icon-fill, 0),
9
+ "GRAD" var(--icon-grade, 0),
10
+ "opsz" var(--icon-optical-size, var(--icon-size, 20));
11
+ }
12
+
13
+ .filled {
14
+ --icon-fill: 1;
15
+ }
16
+
17
+ .shouldMirrorInRTL {
18
+ [dir="rtl"] & {
19
+ transform: scale(-1, 1);
20
+ }
21
+ }
22
+
23
+ .iconLTR {
24
+ [dir="rtl"] & {
25
+ display: none;
26
+ }
27
+ }
28
+
29
+ .iconRTL {
30
+ display: none;
31
+
32
+ [dir="rtl"] & {
33
+ display: inherit;
34
+ }
35
+ }
@@ -0,0 +1,36 @@
1
+ import React from "react"
2
+ import { render, screen } from "@testing-library/react"
3
+ import { Icon } from "./Icon"
4
+
5
+ describe("<Icon />", () => {
6
+ it("sets required attributes for a presentational icon", () => {
7
+ render(<Icon data-testid="test__icon" name="star" isPresentational />)
8
+ const icon = screen.getByTestId("test__icon")
9
+
10
+ expect(icon).toHaveAttribute("aria-hidden", "true")
11
+ expect(icon).not.toHaveAttribute("role")
12
+ expect(icon).not.toHaveAttribute("aria-label")
13
+ })
14
+
15
+ it("sets required attributes for a meaningful icon", () => {
16
+ render(<Icon data-testid="test__icon" name="star" alt="Favourite" />)
17
+ const icon = screen.getByTestId("test__icon")
18
+
19
+ expect(icon).not.toHaveAttribute("aria-hidden")
20
+ expect(icon).toHaveAttribute("role", "img")
21
+ expect(icon).toHaveAttribute("aria-label", "Favourite")
22
+ })
23
+
24
+ describe("shouldMirrorInRTL", () => {
25
+ it("does not show icon name in accessible name for switched icons", () => {
26
+ render(
27
+ <button type="button">
28
+ <Icon name="format_list_numbered" shouldMirrorInRTL alt="Pancakes" />
29
+ </button>
30
+ )
31
+ const button = screen.getByRole("button")
32
+
33
+ expect(button).toHaveAccessibleName("Pancakes")
34
+ })
35
+ })
36
+ })
@@ -0,0 +1,85 @@
1
+ import React, { HTMLAttributes } from "react"
2
+ import classNames from "classnames"
3
+ import { StringSuggestions } from "~components/types/StringSuggestions"
4
+ import { handledRtlIcons } from "./constants"
5
+ import { IconNames } from "./types"
6
+ import styles from "./Icon.module.css"
7
+
8
+ type PresentationalIcon = {
9
+ isPresentational: true
10
+ alt?: never
11
+ }
12
+
13
+ type MeaningfulIcon = {
14
+ isPresentational?: false
15
+ alt: string
16
+ }
17
+
18
+ type BaseIconProps = {
19
+ isFilled?: boolean
20
+ } & HTMLAttributes<HTMLSpanElement> &
21
+ (PresentationalIcon | MeaningfulIcon)
22
+
23
+ type MaterialIconProps = BaseIconProps & {
24
+ children: React.ReactNode
25
+ }
26
+
27
+ const MaterialIcon = ({
28
+ children,
29
+ isFilled,
30
+ isPresentational,
31
+ alt,
32
+ className,
33
+ ...restProps
34
+ }: MaterialIconProps): JSX.Element => (
35
+ <span
36
+ className={classNames(
37
+ "material-symbols-outlined",
38
+ styles.icon,
39
+ isFilled && styles.filled,
40
+ className
41
+ )}
42
+ aria-hidden={isPresentational}
43
+ role={isPresentational ? undefined : "img"}
44
+ aria-label={alt}
45
+ {...restProps}
46
+ >
47
+ {children}
48
+ </span>
49
+ )
50
+
51
+ export type IconProps = BaseIconProps & {
52
+ /** Options available at https://fonts.google.com/icons */
53
+ name: StringSuggestions<IconNames>
54
+ shouldMirrorInRTL?: boolean
55
+ }
56
+
57
+ export const Icon = ({
58
+ name,
59
+ shouldMirrorInRTL,
60
+ ...restProps
61
+ }: IconProps): JSX.Element => {
62
+ if (!shouldMirrorInRTL) {
63
+ return <MaterialIcon {...restProps}>{name}</MaterialIcon>
64
+ }
65
+
66
+ if (Object.keys(handledRtlIcons).includes(name)) {
67
+ return (
68
+ <MaterialIcon {...restProps}>
69
+ <span className={styles.iconLTR}>{name}</span>
70
+ <span className={styles.iconRTL}>
71
+ {handledRtlIcons[name as keyof typeof handledRtlIcons]}
72
+ </span>
73
+ </MaterialIcon>
74
+ )
75
+ }
76
+
77
+ return (
78
+ <MaterialIcon
79
+ {...restProps}
80
+ className={classNames(styles.shouldMirrorInRTL, restProps.className)}
81
+ >
82
+ {name}
83
+ </MaterialIcon>
84
+ )
85
+ }
@@ -0,0 +1,98 @@
1
+ import { Canvas, Meta, Controls, Story } from "@storybook/blocks"
2
+ import { ResourceLinks, KAIOInstallation } from "~storybook/components"
3
+ import * as IconStories from "./Icon.docs.stories"
4
+
5
+ <Meta title="Illustrations/Icon/Icon (Future)/API Specification" />
6
+
7
+ # Icon API Specification (Future)
8
+
9
+ Updated September 4, 2024
10
+
11
+ <ResourceLinks
12
+ sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__v2__/Icon"
13
+ designGuidelines="/?path=/docs/illustrations-icon-v2-usage-guidelines--docs"
14
+ />
15
+
16
+ <KAIOInstallation exportNames="Icon" isFuture />
17
+
18
+ ### Set up
19
+
20
+ Add the following (CDN for the variable icon font) to your Storybook `preview-head.html` and to the `<head>` of your apps.
21
+
22
+ ```html
23
+ <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>
24
+ <link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,400,0..1,0" />
25
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,400,0..1,0" />
26
+ ```
27
+
28
+ ## Overview
29
+
30
+ Icon extends [Material Symbols](https://fonts.google.com/icons), utilising the CDN.
31
+
32
+ <Canvas of={IconStories.Playground} />
33
+ <Controls of={IconStories.Playground} />
34
+
35
+ ## API
36
+
37
+ ### Name
38
+
39
+ See [Material Symbols](https://fonts.google.com/icons) for all valid options.
40
+
41
+ ### Filled
42
+
43
+ <Canvas of={IconStories.Filled} />
44
+
45
+ ### Mirror in RTL
46
+
47
+ The `shouldMirrorInRTL` prop mirrors the Icon in `dir="rtl"`.
48
+
49
+ Use this for directional icons based on your usage context (eg. forwards in LTR will point right, whilst in RTL will point left).
50
+
51
+ Read more about bidirectionality from [Material Design](https://m2.material.io/design/usability/bidirectionality.html#mirroring-elements).
52
+
53
+ <Canvas of={IconStories.MirrorInRTL} />
54
+
55
+ ### Accessibility
56
+
57
+ #### Meaningful icon
58
+
59
+ Icons without accompanying text need to convey their intent to the screen reader.
60
+ Add `alt` text for these use cases.
61
+
62
+ <Canvas of={IconStories.MeaningfulIcon} />
63
+
64
+ #### Presentational icon
65
+
66
+ For icons which are purely presentational, add `isPresentational` to hide it from the screen reader.
67
+
68
+ <Canvas of={IconStories.PresentationalIcon} />
69
+
70
+ ### Customisation
71
+
72
+ #### Color
73
+
74
+ The Icon component inherits the color from its parent by default. You may also change the color using `className`.
75
+
76
+ <Canvas of={IconStories.Color} />
77
+
78
+ #### Size
79
+
80
+ There are two ways to change the size of the icon:
81
+
82
+ 1. (Recommended) Change the value of the `--icon-size` CSS variable (eg. in Tailwind - `[--icon-size:48]`).
83
+ This option will also scale the [optical size](https://m3.material.io/styles/icons/applying-icons#b41cbc01-9b49-4a44-a525-d153d1ea1425) of the icon.
84
+ Note that the value must be a whole number value without units.
85
+
86
+ 2. Override the `font-size` CSS attribute (eg. in Tailwind - `text-[1em]`).
87
+ This option will not scale the optical size of the icon for you, so you will need to combine it with also
88
+ overriding the `--icon-optical-size` CSS variable (eg. in Tailwind - `[--icon-optical-size:48]`).
89
+
90
+ <Canvas of={IconStories.Size} />
91
+
92
+ ## Default icon set
93
+
94
+ Whilst you have access to all Material Symbols, the following icons match the default set we have in Figma.
95
+
96
+ Tip: Click on the icon you want for a quick copy!
97
+
98
+ <Story of={IconStories.DefaultIconSet} />