@kaizen/components 1.57.1 → 1.58.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 (226) hide show
  1. package/bin/codemod.sh +39 -0
  2. package/codemods/README.md +31 -0
  3. package/codemods/__tests__/utils/index.ts +1 -0
  4. package/codemods/__tests__/utils/parseJsx.ts +11 -0
  5. package/codemods/migrateBrandMomentMoodToVariant/index.ts +21 -0
  6. package/codemods/migrateBrandMomentMoodToVariant/transformBrandMomentMoodToVariant.spec.ts +44 -0
  7. package/codemods/migrateBrandMomentMoodToVariant/transformBrandMomentMoodToVariant.ts +24 -0
  8. package/codemods/migrateCardVariantToColor/index.ts +15 -0
  9. package/codemods/migrateCardVariantToColor/transformCardVariantToColor.spec.ts +91 -0
  10. package/codemods/migrateCardVariantToColor/transformCardVariantToColor.ts +32 -0
  11. package/codemods/migrateConfirmationModalMoodsToVariant/index.ts +19 -0
  12. package/codemods/migrateConfirmationModalMoodsToVariant/transformConfirmationModalMoodsToVariant.spec.ts +110 -0
  13. package/codemods/migrateConfirmationModalMoodsToVariant/transformConfirmationModalMoodsToVariant.ts +59 -0
  14. package/codemods/migrateEmptyStateIllustrationTypeToVariant/index.ts +21 -0
  15. package/codemods/migrateEmptyStateIllustrationTypeToVariant/transformEmptyStateIllustrationTypeToVariant.spec.ts +74 -0
  16. package/codemods/migrateEmptyStateIllustrationTypeToVariant/transformEmptyStateIllustrationTypeToVariant.ts +28 -0
  17. package/codemods/migrateGlobalNotificationTypeToVariant/index.ts +19 -0
  18. package/codemods/migrateInformationTileMoodToVariant/index.ts +21 -0
  19. package/codemods/migrateInformationTileMoodToVariant/transformInformationTileMoodToVariant.spec.ts +84 -0
  20. package/codemods/migrateInformationTileMoodToVariant/transformInformationTileMoodToVariant.ts +22 -0
  21. package/codemods/migrateInlineNotificationTypeToVariant/index.ts +19 -0
  22. package/codemods/migrateMultiActionTileMoodToVariant/index.ts +21 -0
  23. package/codemods/migrateMultiActionTileMoodToVariant/transformMultiActionTileMoodToVariant.spec.ts +84 -0
  24. package/codemods/migrateMultiActionTileMoodToVariant/transformMultiActionTileMoodToVariant.ts +22 -0
  25. package/codemods/migrateNotificationTypeToVariant/index.ts +1 -0
  26. package/codemods/migrateNotificationTypeToVariant/migrateNotificationTypeToVariant.spec.ts +107 -0
  27. package/codemods/migrateNotificationTypeToVariant/migrateNotificationTypeToVariant.ts +28 -0
  28. package/codemods/migrateProgressBarMoodToColor/index.ts +21 -0
  29. package/codemods/migrateProgressBarMoodToColor/transformProgressBarMoodToColor.spec.ts +54 -0
  30. package/codemods/migrateProgressBarMoodToColor/transformProgressBarMoodToColor.ts +26 -0
  31. package/codemods/migrateToastNotificationTypeToVariant/index.ts +19 -0
  32. package/codemods/migrateWellVariantToColor/index.ts +15 -0
  33. package/codemods/migrateWellVariantToColor/transformWellVariantToColor.spec.ts +192 -0
  34. package/codemods/migrateWellVariantToColor/transformWellVariantToColor.ts +75 -0
  35. package/codemods/removeInputEditModalMood/index.ts +19 -0
  36. package/codemods/removeInputEditModalMood/removeInputEditModalMood.spec.ts +80 -0
  37. package/codemods/removeInputEditModalMood/removeInputEditModalMood.ts +40 -0
  38. package/codemods/updateGuidanceBlockVariantProp/transformGuidanceBlockVariantProp.spec.ts +118 -0
  39. package/codemods/updateGuidanceBlockVariantProp/transformGuidanceBlockVariantProp.ts +64 -0
  40. package/codemods/utils/__fixtures__/KaioComponent.tsx +6 -0
  41. package/codemods/utils/__snapshots__/transformSource.spec.ts.snap +11 -0
  42. package/codemods/utils/getPropValueText.spec.ts +75 -0
  43. package/codemods/utils/getPropValueText.ts +21 -0
  44. package/codemods/utils/getTagName.spec.ts +24 -0
  45. package/codemods/utils/getTagName.ts +32 -0
  46. package/codemods/utils/index.ts +7 -0
  47. package/codemods/utils/migrateStringProp.spec.ts +129 -0
  48. package/codemods/utils/migrateStringProp.ts +43 -0
  49. package/codemods/utils/printAst.ts +6 -0
  50. package/codemods/utils/transformComponentsInDir.ts +42 -0
  51. package/codemods/utils/transformSource.spec.ts +56 -0
  52. package/codemods/utils/transformSource.ts +25 -0
  53. package/codemods/utils/updateJsxElementWithNewProps.spec.ts +67 -0
  54. package/codemods/utils/updateJsxElementWithNewProps.ts +24 -0
  55. package/dist/cjs/BrandMoment/BrandMoment.cjs +3 -2
  56. package/dist/cjs/BrandMoment/BrandMoment.module.scss.cjs +3 -1
  57. package/dist/cjs/Card/Card.cjs +7 -6
  58. package/dist/cjs/Card/Card.module.scss.cjs +10 -2
  59. package/dist/cjs/EmptyState/EmptyState.cjs +14 -6
  60. package/dist/cjs/EmptyState/EmptyState.module.scss.cjs +3 -0
  61. package/dist/cjs/ErrorPage/ErrorPage.cjs +1 -1
  62. package/dist/cjs/Modal/ConfirmationModal/ConfirmationModal.cjs +9 -5
  63. package/dist/cjs/Modal/ConfirmationModal/ConfirmationModal.module.scss.cjs +6 -2
  64. package/dist/cjs/Notification/ToastNotification/ToastNotification/ToastNotification.cjs +1 -3
  65. package/dist/cjs/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/ToastNotificationsMap.cjs +1 -3
  66. package/dist/cjs/Notification/subcomponents/GenericNotification/GenericNotification.cjs +6 -3
  67. package/dist/cjs/Notification/subcomponents/GenericNotification/GenericNotification.module.scss.cjs +5 -3
  68. package/dist/cjs/Notification/subcomponents/NotificationIcon/NotificationIcon.cjs +35 -3
  69. package/dist/cjs/ProgressBar/ProgressBar.cjs +3 -2
  70. package/dist/cjs/ProgressBar/ProgressBar.module.scss.cjs +8 -4
  71. package/dist/cjs/Tile/subcomponents/GenericTile/GenericTile.cjs +7 -5
  72. package/dist/cjs/Tile/subcomponents/GenericTile/GenericTile.module.scss.cjs +8 -6
  73. package/dist/cjs/Well/Well.cjs +5 -4
  74. package/dist/cjs/Well/Well.module.scss.cjs +9 -1
  75. package/dist/cjs/{GuidanceBlock → __containers__/GuidanceBlock/v1}/GuidanceBlock.cjs +6 -6
  76. package/dist/cjs/__containers__/GuidanceBlock/v1/GuidanceBlock.module.scss.cjs +33 -0
  77. package/dist/cjs/__containers__/GuidanceBlock/v2/GuidanceBlock.cjs +160 -0
  78. package/dist/cjs/__containers__/GuidanceBlock/v2/GuidanceBlock.module.scss.cjs +28 -0
  79. package/dist/cjs/containersV1.cjs +4 -0
  80. package/dist/cjs/containersV2.cjs +4 -0
  81. package/dist/cjs/index.cjs +2 -2
  82. package/dist/esm/BrandMoment/BrandMoment.mjs +3 -2
  83. package/dist/esm/BrandMoment/BrandMoment.module.scss.mjs +3 -1
  84. package/dist/esm/Card/Card.mjs +7 -6
  85. package/dist/esm/Card/Card.module.scss.mjs +10 -2
  86. package/dist/esm/EmptyState/EmptyState.mjs +15 -7
  87. package/dist/esm/EmptyState/EmptyState.module.scss.mjs +3 -0
  88. package/dist/esm/ErrorPage/ErrorPage.mjs +1 -1
  89. package/dist/esm/Modal/ConfirmationModal/ConfirmationModal.mjs +9 -5
  90. package/dist/esm/Modal/ConfirmationModal/ConfirmationModal.module.scss.mjs +6 -2
  91. package/dist/esm/Notification/ToastNotification/ToastNotification/ToastNotification.mjs +1 -3
  92. package/dist/esm/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/ToastNotificationsMap.mjs +1 -3
  93. package/dist/esm/Notification/subcomponents/GenericNotification/GenericNotification.mjs +8 -5
  94. package/dist/esm/Notification/subcomponents/GenericNotification/GenericNotification.module.scss.mjs +5 -3
  95. package/dist/esm/Notification/subcomponents/NotificationIcon/NotificationIcon.mjs +39 -5
  96. package/dist/esm/ProgressBar/ProgressBar.mjs +3 -2
  97. package/dist/esm/ProgressBar/ProgressBar.module.scss.mjs +8 -4
  98. package/dist/esm/Tile/subcomponents/GenericTile/GenericTile.mjs +7 -5
  99. package/dist/esm/Tile/subcomponents/GenericTile/GenericTile.module.scss.mjs +8 -6
  100. package/dist/esm/Well/Well.mjs +5 -4
  101. package/dist/esm/Well/Well.module.scss.mjs +9 -1
  102. package/dist/esm/{GuidanceBlock → __containers__/GuidanceBlock/v1}/GuidanceBlock.mjs +6 -6
  103. package/dist/esm/__containers__/GuidanceBlock/v1/GuidanceBlock.module.scss.mjs +31 -0
  104. package/dist/esm/__containers__/GuidanceBlock/v2/GuidanceBlock.mjs +153 -0
  105. package/dist/esm/__containers__/GuidanceBlock/v2/GuidanceBlock.module.scss.mjs +26 -0
  106. package/dist/esm/containersV1.mjs +1 -0
  107. package/dist/esm/containersV2.mjs +1 -0
  108. package/dist/esm/index.mjs +1 -1
  109. package/dist/styles.css +13 -12
  110. package/dist/types/BrandMoment/BrandMoment.d.ts +19 -3
  111. package/dist/types/Card/Card.d.ts +20 -7
  112. package/dist/types/EmptyState/EmptyState.d.ts +14 -6
  113. package/dist/types/Modal/ConfirmationModal/ConfirmationModal.d.ts +25 -7
  114. package/dist/types/Modal/GenericModal/subcomponents/ModalFooter/ModalFooter.d.ts +3 -0
  115. package/dist/types/Modal/InputEditModal/InputEditModal.d.ts +4 -1
  116. package/dist/types/Notification/GlobalNotification/GlobalNotification.d.ts +3 -3
  117. package/dist/types/Notification/InlineNotification/InlineNotification.d.ts +3 -3
  118. package/dist/types/Notification/ToastNotification/ToastNotification/ToastNotification.d.ts +5 -4
  119. package/dist/types/Notification/ToastNotification/context/ToastNotificationContext.d.ts +4 -3
  120. package/dist/types/Notification/ToastNotification/types.d.ts +3 -3
  121. package/dist/types/Notification/subcomponents/GenericNotification/GenericNotification.d.ts +24 -4
  122. package/dist/types/Notification/subcomponents/NotificationIcon/NotificationIcon.d.ts +11 -4
  123. package/dist/types/Notification/types.d.ts +2 -1
  124. package/dist/types/ProgressBar/ProgressBar.d.ts +25 -6
  125. package/dist/types/Tile/subcomponents/GenericTile/GenericTile.d.ts +10 -3
  126. package/dist/types/Well/Well.d.ts +6 -2
  127. package/dist/types/Well/types.d.ts +4 -0
  128. package/dist/types/{GuidanceBlock → __containers__/GuidanceBlock/v1}/GuidanceBlock.d.ts +4 -4
  129. package/dist/types/__containers__/GuidanceBlock/v2/GuidanceBlock.d.ts +59 -0
  130. package/dist/types/__containers__/GuidanceBlock/v2/index.d.ts +1 -0
  131. package/dist/types/__containers__/v1.d.ts +1 -0
  132. package/dist/types/__containers__/v2.d.ts +1 -0
  133. package/dist/types/index.d.ts +1 -1
  134. package/package.json +19 -5
  135. package/src/BrandMoment/BrandMoment.module.scss +20 -9
  136. package/src/BrandMoment/BrandMoment.tsx +26 -3
  137. package/src/BrandMoment/_docs/BrandMoment.mdx +13 -13
  138. package/src/BrandMoment/_docs/BrandMoment.stickersheet.stories.tsx +102 -0
  139. package/src/BrandMoment/_docs/BrandMoment.stories.tsx +17 -99
  140. package/src/Card/Card.module.scss +56 -7
  141. package/src/Card/Card.tsx +35 -11
  142. package/src/Card/_docs/Card.mdx +6 -3
  143. package/src/Card/_docs/Card.stickersheet.stories.tsx +44 -39
  144. package/src/Card/_docs/Card.stories.tsx +23 -23
  145. package/src/EmptyState/EmptyState.module.scss +32 -14
  146. package/src/EmptyState/EmptyState.tsx +32 -18
  147. package/src/EmptyState/_docs/EmptyState.stickersheet.stories.tsx +69 -121
  148. package/src/EmptyState/_docs/EmptyState.stories.tsx +6 -8
  149. package/src/ErrorPage/ErrorPage.tsx +1 -1
  150. package/src/Modal/ConfirmationModal/ConfirmationModal.module.scss +100 -78
  151. package/src/Modal/ConfirmationModal/ConfirmationModal.spec.tsx +5 -5
  152. package/src/Modal/ConfirmationModal/ConfirmationModal.tsx +41 -10
  153. package/src/Modal/ConfirmationModal/_docs/ConfirmationModal.mdx +3 -3
  154. package/src/Modal/ConfirmationModal/_docs/ConfirmationModal.stories.tsx +11 -4
  155. package/src/Modal/ContextModal/_docs/ContextModal.stories.tsx +3 -1
  156. package/src/Modal/GenericModal/subcomponents/ModalFooter/ModalFooter.tsx +3 -0
  157. package/src/Modal/InputEditModal/InputEditModal.tsx +4 -1
  158. package/src/Modal/InputEditModal/_docs/InputEditModal.mdx +0 -13
  159. package/src/Modal/InputEditModal/_docs/InputEditModal.stories.tsx +9 -10
  160. package/src/Notification/GlobalNotification/GlobalNotification.tsx +9 -4
  161. package/src/Notification/GlobalNotification/_docs/GlobalNotification.stickersheet.stories.tsx +68 -58
  162. package/src/Notification/GlobalNotification/_docs/GlobalNotification.stories.tsx +10 -13
  163. package/src/Notification/InlineNotification/InlineNotification.tsx +9 -4
  164. package/src/Notification/InlineNotification/_docs/InlineNotification.stickersheet.stories.tsx +79 -44
  165. package/src/Notification/InlineNotification/_docs/InlineNotification.stories.tsx +17 -17
  166. package/src/Notification/ToastNotification/ToastNotification/ToastNotification.tsx +7 -5
  167. package/src/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/ToastNotificationsMap.tsx +1 -2
  168. package/src/Notification/ToastNotification/_docs/ToastNotification.stickersheet.stories.tsx +12 -7
  169. package/src/Notification/ToastNotification/_docs/ToastNotification.stories.tsx +6 -1
  170. package/src/Notification/ToastNotification/context/ToastNotificationContext.tsx +7 -3
  171. package/src/Notification/ToastNotification/types.ts +8 -3
  172. package/src/Notification/subcomponents/GenericNotification/GenericNotification.module.scss +42 -5
  173. package/src/Notification/subcomponents/GenericNotification/GenericNotification.tsx +40 -6
  174. package/src/Notification/subcomponents/GenericNotification/_mixins.scss +2 -1
  175. package/src/Notification/subcomponents/NotificationIcon/NotificationIcon.tsx +31 -5
  176. package/src/Notification/types.ts +9 -2
  177. package/src/ProgressBar/ProgressBar.module.scss +37 -25
  178. package/src/ProgressBar/ProgressBar.tsx +30 -5
  179. package/src/ProgressBar/_docs/ProgressBar.mdx +2 -3
  180. package/src/ProgressBar/_docs/ProgressBar.stickersheet.stories.tsx +95 -51
  181. package/src/ProgressBar/_docs/ProgressBar.stories.tsx +56 -25
  182. package/src/Tile/InformationTile/_docs/InformationTile.mdx +3 -2
  183. package/src/Tile/InformationTile/_docs/InformationTile.stickersheet.stories.tsx +57 -19
  184. package/src/Tile/InformationTile/_docs/InformationTile.stories.tsx +19 -7
  185. package/src/Tile/MultiActionTile/_docs/MultiActionTile.mdx +3 -2
  186. package/src/Tile/MultiActionTile/_docs/MultiActionTile.stickersheet.stories.tsx +62 -24
  187. package/src/Tile/MultiActionTile/_docs/MultiActionTile.stories.tsx +19 -7
  188. package/src/Tile/subcomponents/GenericTile/GenericTile.module.scss +34 -22
  189. package/src/Tile/subcomponents/GenericTile/GenericTile.tsx +17 -8
  190. package/src/Tile/subcomponents/GenericTile/_docs/GenericTile.stickersheet.stories.tsx +57 -19
  191. package/src/Well/Well.module.scss +70 -33
  192. package/src/Well/Well.tsx +9 -3
  193. package/src/Well/_docs/Well.mdx +9 -2
  194. package/src/Well/_docs/Well.stickersheet.stories.tsx +10 -1
  195. package/src/Well/_docs/Well.stories.tsx +54 -29
  196. package/src/Well/types.ts +15 -0
  197. package/src/__actions__/Button/v3/_docs/ApiSpecification.mdx +1 -1
  198. package/src/__actions__/Menu/v3/MenuItem.module.scss +1 -0
  199. package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/GuidanceBlock.module.scss +2 -2
  200. package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/_docs/GuidanceBlock.mdx +2 -2
  201. package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/_docs/GuidanceBlock.stickersheet.stories.tsx +1 -1
  202. package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/_docs/GuidanceBlock.stories.tsx +1 -1
  203. package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.module.scss +356 -0
  204. package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.spec.tsx +82 -0
  205. package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.tsx +262 -0
  206. package/src/__containers__/GuidanceBlock/v2/_docs/GuidanceBlock.mdx +38 -0
  207. package/src/__containers__/GuidanceBlock/v2/_docs/GuidanceBlock.stickersheet.stories.tsx +118 -0
  208. package/src/__containers__/GuidanceBlock/v2/_docs/GuidanceBlock.stories.tsx +152 -0
  209. package/src/__containers__/GuidanceBlock/v2/index.ts +1 -0
  210. package/src/__containers__/v1.ts +1 -0
  211. package/src/__containers__/v2.ts +1 -0
  212. package/src/index.ts +2 -1
  213. package/v1/containers/package.json +5 -0
  214. package/v2/containers/package.json +5 -0
  215. package/dist/cjs/GuidanceBlock/GuidanceBlock.module.scss.cjs +0 -33
  216. package/dist/esm/GuidanceBlock/GuidanceBlock.module.scss.mjs +0 -31
  217. package/dist/types/Tile/subcomponents/GenericTile/types.d.ts +0 -2
  218. package/src/EmptyState/_docs/EmptyState.stories.module.scss +0 -15
  219. package/src/Notification/ToastNotification/ToastNotification/ToastNotification.spec.tsx +0 -33
  220. package/src/Tile/subcomponents/GenericTile/types.ts +0 -10
  221. /package/dist/types/{GuidanceBlock → __containers__/GuidanceBlock/v1}/index.d.ts +0 -0
  222. /package/dist/types/{GuidanceBlock → __containers__/GuidanceBlock/v1}/types.d.ts +0 -0
  223. /package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/GuidanceBlock.spec.tsx +0 -0
  224. /package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/GuidanceBlock.tsx +0 -0
  225. /package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/index.ts +0 -0
  226. /package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/types.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  import React from "react"
2
2
  import { Meta, StoryObj } from "@storybook/react"
3
- import { Card } from "../index"
3
+ import { Card, CardProps } from "../index"
4
4
 
5
5
  const meta = {
6
6
  title: "Components/Card",
@@ -8,6 +8,11 @@ const meta = {
8
8
  args: {
9
9
  children: "This is a default container",
10
10
  },
11
+ argTypes: {
12
+ variant: {
13
+ control: false,
14
+ },
15
+ },
11
16
  } satisfies Meta<typeof Card>
12
17
 
13
18
  export default meta
@@ -24,30 +29,25 @@ export const Playground: Story = {
24
29
  },
25
30
  }
26
31
 
27
- export const Variants: Story = {
32
+ const colors = [
33
+ "blue",
34
+ "green",
35
+ "gray",
36
+ "orange",
37
+ "purple",
38
+ "red",
39
+ "white",
40
+ "yellow",
41
+ ] satisfies Array<CardProps["color"]>
42
+
43
+ export const Colors: Story = {
28
44
  render: () => (
29
45
  <ul className="flex list-none gap-16">
30
- <li>
31
- <Card variant="default">Default</Card>
32
- </li>
33
- <li>
34
- <Card variant="informative">Informative</Card>
35
- </li>
36
- <li>
37
- <Card variant="positive">Positive</Card>
38
- </li>
39
- <li>
40
- <Card variant="cautionary">Cautionary</Card>
41
- </li>
42
- <li>
43
- <Card variant="destructive">Destructive</Card>
44
- </li>
45
- <li>
46
- <Card variant="assertive">Assertive</Card>
47
- </li>
48
- <li>
49
- <Card variant="highlight">Highlight</Card>
50
- </li>
46
+ {colors.map(color => (
47
+ <li key={color}>
48
+ <Card color={color}>This is a default container</Card>
49
+ </li>
50
+ ))}
51
51
  </ul>
52
52
  ),
53
53
  }
@@ -4,21 +4,22 @@
4
4
  @import "./mixins";
5
5
 
6
6
  .container {
7
- --border-width: var(--border-width-1);
7
+ --empty-state-border-width: var(--border-width-1);
8
8
 
9
9
  display: flex;
10
10
  justify-content: space-around;
11
11
  width: 100%;
12
- padding: calc(2% - var(--border-width))
13
- calc(var(--spacing-24) - var(--border-width));
12
+ padding: calc(2% - var(--empty-state-border-width))
13
+ calc(var(--spacing-24) - var(--empty-state-border-width));
14
14
  color: $color-purple-800;
15
- border: var(--border-width) var(--border-solid-border-style);
16
- border-radius: $border-solid-border-radius;
15
+ border: var(--empty-state-border-width) solid var(--empty-state-border-color);
16
+ border-radius: var(--border-solid-border-radius);
17
+ background-color: var(--empty-state-background-color);
17
18
 
18
19
  @include small {
19
20
  flex-direction: column;
20
21
  align-items: center;
21
- padding-block: calc(var(--spacing-24) - var(--border-width));
22
+ padding-block: calc(var(--spacing-24) - var(--empty-state-border-width));
22
23
  }
23
24
 
24
25
  &.straightCorners {
@@ -41,25 +42,42 @@
41
42
  }
42
43
  }
43
44
 
45
+ /** @deprecated */
44
46
  .positive {
45
- border-color: var(--color-green-500);
46
- background-color: $color-green-100;
47
+ --empty-state-border-color: var(--color-green-500);
48
+ --empty-state-background-color: var(--color-green-100);
47
49
  }
48
50
 
49
51
  .negative,
50
52
  .action {
51
- border-color: var(--color-red-500);
52
- background-color: $color-red-100;
53
+ --empty-state-border-color: var(--color-red-500);
54
+ --empty-state-background-color: var(--color-red-100);
53
55
  }
54
56
 
55
57
  .neutral {
56
- border-color: var(--color-purple-400);
57
- background-color: $color-purple-100;
58
+ --empty-state-border-color: var(--color-purple-400);
59
+ --empty-state-background-color: var(--color-purple-100);
60
+ }
61
+
62
+ /** end @deprecated */
63
+ .success {
64
+ --empty-state-border-color: var(--color-green-500);
65
+ --empty-state-background-color: var(--color-green-100);
66
+ }
67
+
68
+ .warning {
69
+ --empty-state-border-color: var(--color-red-500);
70
+ --empty-state-background-color: var(--color-red-100);
58
71
  }
59
72
 
60
73
  .informative {
61
- border-color: var(--color-blue-400);
62
- background-color: $color-blue-100;
74
+ --empty-state-border-color: var(--color-blue-400);
75
+ --empty-state-background-color: var(--color-blue-100);
76
+ }
77
+
78
+ .expert-advice {
79
+ --empty-state-border-color: var(--color-purple-400);
80
+ --empty-state-background-color: var(--color-purple-100);
63
81
  }
64
82
 
65
83
  .illustrationSide,
@@ -16,27 +16,41 @@ const ILLUSTRATIONS: Record<
16
16
  string,
17
17
  (props: AnimatedSceneProps) => JSX.Element
18
18
  > = {
19
+ success: EmptyStatesPositive,
20
+ warning: EmptyStatesNegative,
21
+ informative: EmptyStatesInformative,
22
+ "expert-advice": EmptyStatesNeutral,
23
+ /** @deprecated Replaced by success */
19
24
  positive: EmptyStatesPositive,
25
+ /** @deprecated Replaced by expert-advice */
20
26
  neutral: EmptyStatesNeutral,
27
+ /** @deprecated Replaced by warning */
21
28
  negative: EmptyStatesNegative,
22
- informative: EmptyStatesInformative,
29
+ /** @deprecated Replaced by warning */
23
30
  action: EmptyStatesNegative,
24
31
  }
25
32
 
26
- type IllustrationType =
27
- | "positive"
28
- | "neutral"
29
- | "negative"
30
- | "informative"
31
- | "action"
32
-
33
- type LayoutContextType = "sidebarAndContent" | "contentOnly"
34
-
35
33
  export type EmptyStateProps = {
36
34
  children?: React.ReactNode
37
35
  id?: string
38
- illustrationType?: IllustrationType
39
- layoutContext?: LayoutContextType
36
+ /** @deprecated Use `variant` instead */
37
+ illustrationType?:
38
+ | "positive"
39
+ | "informative"
40
+ | "negative"
41
+ | "action"
42
+ | "neutral"
43
+ /**
44
+ * If you are transitioning from `illustrationType`:
45
+ * - `positive` should be `success`
46
+ * - `informative` remains as `informative`
47
+ * - `negative` should be `warning`
48
+ * - `action` should be `warning`
49
+ * - `neutral` should be `expert-advice`
50
+ * @default informative
51
+ */
52
+ variant?: "success" | "warning" | "informative" | "expert-advice"
53
+ layoutContext?: "sidebarAndContent" | "contentOnly"
40
54
  bodyText: string | React.ReactNode
41
55
  straightCorners?: boolean
42
56
  headingProps?: HeadingProps
@@ -50,7 +64,8 @@ export type EmptyStateProps = {
50
64
  export const EmptyState = ({
51
65
  children,
52
66
  id,
53
- illustrationType = "informative",
67
+ illustrationType,
68
+ variant = "informative",
54
69
  layoutContext = "sidebarAndContent",
55
70
  headingProps,
56
71
  bodyText,
@@ -60,17 +75,16 @@ export const EmptyState = ({
60
75
  classNameOverride,
61
76
  ...props
62
77
  }: EmptyStateProps): JSX.Element => {
63
- const IllustrationComponent = ILLUSTRATIONS[illustrationType]
78
+ const IllustrationComponent = ILLUSTRATIONS[illustrationType ?? variant]
64
79
 
65
80
  return (
66
81
  <div
67
82
  className={classnames(
68
- classNameOverride,
69
- styles[illustrationType],
70
83
  styles.container,
71
- styles.zen,
84
+ illustrationType ? styles[illustrationType] : styles[variant],
72
85
  styles[layoutContext],
73
- straightCorners && styles.straightCorners
86
+ straightCorners && styles.straightCorners,
87
+ classNameOverride
74
88
  )}
75
89
  id={id}
76
90
  {...props}
@@ -1,5 +1,5 @@
1
1
  import React from "react"
2
- import { Meta, StoryFn } from "@storybook/react"
2
+ import { Meta } from "@storybook/react"
3
3
  import isChromatic from "chromatic"
4
4
  import { ChevronRightIcon } from "~components/Icon"
5
5
  import { Button } from "~components/__actions__/v2"
@@ -8,7 +8,6 @@ import {
8
8
  StickerSheetStory,
9
9
  } from "~storybook/components/StickerSheet"
10
10
  import { EmptyState, EmptyStateProps } from "../index"
11
- import styles from "./EmptyState.stories.module.scss"
12
11
 
13
12
  export default {
14
13
  title: "Components/EmptyState",
@@ -20,141 +19,90 @@ export default {
20
19
 
21
20
  const IS_CHROMATIC = isChromatic()
22
21
 
23
- const EmptyStateWrapper: StoryFn<typeof EmptyState> = ({
22
+ const EmptyStateWrapper = ({
24
23
  isAnimated,
25
24
  ...args
26
- }) => <EmptyState isAnimated={IS_CHROMATIC ? false : isAnimated} {...args} />
27
-
28
- const ButtonWrapper = (
29
- <div className={styles.buttonContainer}>
30
- <Button
31
- label="Label"
32
- icon={<ChevronRightIcon role="presentation" />}
33
- iconPosition="end"
34
- />
35
- </div>
25
+ }: EmptyStateProps): JSX.Element => (
26
+ <EmptyState isAnimated={IS_CHROMATIC ? false : isAnimated} {...args} />
36
27
  )
37
28
 
38
- const POSTIVE_PROPS: EmptyStateProps = {
39
- children: ButtonWrapper,
40
- headingProps: {
41
- variant: "heading-3",
42
- children: "Positive empty state",
43
- },
44
- bodyText:
45
- "If providing further actions, include a link to an action or use a Default or Primary action.",
46
- illustrationType: "positive",
47
- }
48
-
49
- const INFORMATIVE_PROPS: EmptyStateProps = {
50
- headingProps: {
51
- variant: "heading-3",
52
- children: "Informative empty state",
53
- },
54
- bodyText:
55
- "If providing further actions, include a link to an action or use a Default or Primary action.",
56
- illustrationType: "informative",
57
- }
58
-
59
- const ACTION_PROPS: EmptyStateProps = {
60
- children: ButtonWrapper,
61
- headingProps: {
62
- variant: "heading-3",
63
- children: "Action empty state",
64
- },
65
- bodyText:
66
- "If providing further actions, include a link to an action or use a Default or Primary action.",
67
- illustrationType: "action",
68
- }
29
+ const StickerSheetTemplate: StickerSheetStory = {
30
+ render: ({ isReversed }) => {
31
+ const defaultProps = {
32
+ headingProps: {
33
+ variant: "heading-3",
34
+ children: "Empty state",
35
+ },
36
+ bodyText:
37
+ "If providing further actions, include a link to an action or use a Default or Primary action.",
38
+ } satisfies EmptyStateProps
69
39
 
70
- const NEUTRAL_PROPS: EmptyStateProps = {
71
- headingProps: {
72
- variant: "heading-3",
73
- children: "Neutral empty state",
74
- },
75
- bodyText:
76
- "If providing further actions, include a link to an action or use a Default or Primary action.",
77
- illustrationType: "neutral",
78
- }
40
+ const variants = [
41
+ "success",
42
+ "warning",
43
+ "informative",
44
+ "expert-advice",
45
+ ] satisfies Array<EmptyStateProps["variant"]>
79
46
 
80
- const NEGATIVE_PROPS: EmptyStateProps = {
81
- children: ButtonWrapper,
82
- headingProps: {
83
- variant: "heading-3",
84
- children: "Negative empty state",
85
- },
86
- bodyText:
87
- "If providing further actions, include a link to an action or use a Default or Primary action.",
88
- illustrationType: "negative",
89
- }
47
+ const illustrationTypes = [
48
+ "positive",
49
+ "neutral",
50
+ "negative",
51
+ "informative",
52
+ "action",
53
+ ] satisfies Array<EmptyStateProps["illustrationType"]>
90
54
 
91
- const STRAIGHT_CORNERS_PROPS: EmptyStateProps = {
92
- children: ButtonWrapper,
93
- headingProps: {
94
- variant: "heading-3",
95
- children: "Straight corners empty state",
96
- },
97
- bodyText:
98
- "If providing further actions, include a link to an action or use a Default or Primary action.",
99
- illustrationType: "action",
100
- straightCorners: true,
101
- }
55
+ return (
56
+ <>
57
+ <StickerSheet isReversed={isReversed} heading="EmptyState">
58
+ <StickerSheet.Body>
59
+ {variants.map(variant => (
60
+ <StickerSheet.Row key={variant} rowTitle={variant}>
61
+ <EmptyStateWrapper {...defaultProps} variant={variant} />
62
+ </StickerSheet.Row>
63
+ ))}
64
+ </StickerSheet.Body>
65
+ <StickerSheet.Body>
66
+ <StickerSheet.Row rowTitle="straightCorners">
67
+ <EmptyStateWrapper {...defaultProps} straightCorners />
68
+ </StickerSheet.Row>
69
+ </StickerSheet.Body>
70
+ </StickerSheet>
102
71
 
103
- const CUSTOM_HEADING_PROPS: EmptyStateProps = {
104
- children: ButtonWrapper,
105
- bodyText:
106
- "Customise heading level so that the correct semantic heading level can be used for your page.",
107
- illustrationType: "neutral",
108
- headingProps: {
109
- variant: "heading-3",
110
- children: "Custom heading empty state",
111
- tag: "h2",
112
- color: "dark-reduced-opacity",
72
+ <StickerSheet
73
+ isReversed={isReversed}
74
+ heading="Illustration type (deprecated)"
75
+ >
76
+ <StickerSheet.Body>
77
+ {illustrationTypes.map(illustrationType => (
78
+ <StickerSheet.Row
79
+ key={illustrationType}
80
+ rowTitle={illustrationType}
81
+ >
82
+ <EmptyStateWrapper
83
+ {...defaultProps}
84
+ illustrationType={illustrationType}
85
+ >
86
+ <Button
87
+ label="Label"
88
+ icon={<ChevronRightIcon role="presentation" />}
89
+ iconPosition="end"
90
+ />
91
+ </EmptyStateWrapper>
92
+ </StickerSheet.Row>
93
+ ))}
94
+ </StickerSheet.Body>
95
+ </StickerSheet>
96
+ </>
97
+ )
113
98
  },
114
99
  }
115
100
 
116
- const StickerSheetTemplate: StickerSheetStory = {
117
- render: ({ isReversed }) => (
118
- <StickerSheet isReversed={isReversed}>
119
- <StickerSheet.Body>
120
- <StickerSheet.Row rowTitle="Positive">
121
- <EmptyStateWrapper {...POSTIVE_PROPS} />
122
- </StickerSheet.Row>
123
- <StickerSheet.Row rowTitle="Informative">
124
- <EmptyStateWrapper {...INFORMATIVE_PROPS} />
125
- </StickerSheet.Row>
126
- <StickerSheet.Row rowTitle="Action">
127
- <EmptyStateWrapper {...ACTION_PROPS} />
128
- </StickerSheet.Row>
129
- <StickerSheet.Row rowTitle="Neutral">
130
- <EmptyStateWrapper {...NEUTRAL_PROPS} />
131
- </StickerSheet.Row>
132
- <StickerSheet.Row rowTitle="Negative">
133
- <EmptyStateWrapper {...NEGATIVE_PROPS} />
134
- </StickerSheet.Row>
135
- <StickerSheet.Row rowTitle="Straight Corners">
136
- <EmptyStateWrapper {...STRAIGHT_CORNERS_PROPS} />
137
- </StickerSheet.Row>
138
- <StickerSheet.Row rowTitle="Custom heading">
139
- <EmptyStateWrapper {...CUSTOM_HEADING_PROPS} />
140
- </StickerSheet.Row>
141
- </StickerSheet.Body>
142
- </StickerSheet>
143
- ),
144
- }
145
-
146
101
  export const StickerSheetDefault: StickerSheetStory = {
147
102
  ...StickerSheetTemplate,
148
103
  name: "Sticker Sheet (Default)",
149
104
  }
150
105
 
151
- export const StickerSheetReversed: StickerSheetStory = {
152
- ...StickerSheetTemplate,
153
- name: "Sticker Sheet (Reversed)",
154
- parameters: { backgrounds: { default: "Purple 700" } },
155
- args: { isReversed: true },
156
- }
157
-
158
106
  export const StickerSheetRTL: StickerSheetStory = {
159
107
  ...StickerSheetTemplate,
160
108
  name: "Sticker Sheet (RTL)",
@@ -3,7 +3,6 @@ import { Meta, StoryObj } from "@storybook/react"
3
3
  import { ChevronRightIcon } from "~components/Icon"
4
4
  import { Button } from "~components/__actions__/v2"
5
5
  import { EmptyState } from "../index"
6
- import styles from "./EmptyState.stories.module.scss"
7
6
 
8
7
  const meta = {
9
8
  title: "Components/EmptyState",
@@ -16,16 +15,15 @@ const meta = {
16
15
  mapping: {
17
16
  "Default (no children)": undefined,
18
17
  "Button (chevron right)": (
19
- <div className={styles.buttonContainer}>
20
- <Button
21
- label="Label"
22
- icon={<ChevronRightIcon role="presentation" />}
23
- iconPosition="end"
24
- />
25
- </div>
18
+ <Button
19
+ label="Label"
20
+ icon={<ChevronRightIcon role="presentation" />}
21
+ iconPosition="end"
22
+ />
26
23
  ),
27
24
  },
28
25
  },
26
+ illustrationType: { control: false },
29
27
  },
30
28
  args: {
31
29
  headingProps: {
@@ -64,7 +64,7 @@ export const ErrorPage = ({
64
64
  </>
65
65
  }
66
66
  illustration={<BrandMomentError isAnimated loop />}
67
- mood="negative"
67
+ variant="warning"
68
68
  primaryAction={{
69
69
  ...actions.primary,
70
70
  icon: <ArrowRightIcon role="presentation" />,