@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
@@ -13,18 +13,29 @@ $breakpoint-xl: 1366px; // TODO: create an xl breakpoint in design-tokens and re
13
13
  display: flex;
14
14
  flex-direction: column;
15
15
  align-items: center;
16
+ background-color: var(--brand-moment-background-color);
17
+ }
16
18
 
17
- &.informative {
18
- background: $color-blue-100;
19
- }
19
+ /** @deprecated */
20
+ .positive {
21
+ --brand-moment-background-color: var(--color-green-100);
22
+ }
20
23
 
21
- &.positive {
22
- background: $color-green-100;
23
- }
24
+ .negative {
25
+ --brand-moment-background-color: var(--color-red-100);
26
+ }
24
27
 
25
- &.negative {
26
- background: $color-red-100;
27
- }
28
+ /** end @deprecated */
29
+ .informative {
30
+ --brand-moment-background-color: var(--color-blue-100);
31
+ }
32
+
33
+ .success {
34
+ --brand-moment-background-color: var(--color-green-100);
35
+ }
36
+
37
+ .warning {
38
+ --brand-moment-background-color: var(--color-red-100);
28
39
  }
29
40
 
30
41
  // --------------------------------
@@ -9,8 +9,25 @@ import { OverrideClassName } from "~types/OverrideClassName"
9
9
  import { useMediaQueries } from "~utils/useMediaQueries"
10
10
  import styles from "./BrandMoment.module.scss"
11
11
 
12
- export type BrandMomentProps = {
12
+ type DeprecatedMoodProps = {
13
+ /** @deprecated Use `variant` instead */
13
14
  mood: "informative" | "positive" | "negative"
15
+ variant?: never
16
+ }
17
+
18
+ type VariantProps = {
19
+ /**
20
+ * If you are transitioning from `mood`:
21
+ * - `informative` remains as `informative`
22
+ * - `positive` should be `success`
23
+ * - `negative` should be `warning`
24
+ */
25
+ variant: "informative" | "success" | "warning"
26
+ /** @deprecated Use `variant` instead */
27
+ mood?: never
28
+ }
29
+
30
+ export type BrandMomentProps = {
14
31
  illustration: ReactElement<SceneProps>
15
32
  header: ReactNode
16
33
  body?: ReactNode
@@ -22,7 +39,8 @@ export type BrandMomentProps = {
22
39
  body?: ReactNode
23
40
  footer?: ReactNode
24
41
  }
25
- } & OverrideClassName<HTMLAttributes<HTMLDivElement>>
42
+ } & OverrideClassName<HTMLAttributes<HTMLDivElement>> &
43
+ (DeprecatedMoodProps | VariantProps)
26
44
 
27
45
  /**
28
46
  * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082061589/Brand+Moment Guidance} |
@@ -30,6 +48,7 @@ export type BrandMomentProps = {
30
48
  */
31
49
  export const BrandMoment = ({
32
50
  mood,
51
+ variant,
33
52
  illustration,
34
53
  header,
35
54
  body,
@@ -43,7 +62,11 @@ export const BrandMoment = ({
43
62
 
44
63
  return (
45
64
  <div
46
- className={classnames(styles.body, styles[mood], classNameOverride)}
65
+ className={classnames(
66
+ styles.body,
67
+ variant ? styles[variant] : styles[mood],
68
+ classNameOverride
69
+ )}
47
70
  {...restProps}
48
71
  >
49
72
  <header className={styles.header}>{header}</header>
@@ -1,11 +1,10 @@
1
- import { Canvas, Meta } from "@storybook/blocks"
2
- import { InlineNotification } from "~components/Notification"
1
+ import { Canvas, Controls, Meta } from "@storybook/blocks"
3
2
  import { ResourceLinks, KAIOInstallation } from "~storybook/components"
4
3
  import * as BrandMoment from "./BrandMoment.stories"
5
4
 
6
5
  <Meta of={BrandMoment} />
7
6
 
8
- # Badge
7
+ # BrandMoment
9
8
 
10
9
  <ResourceLinks
11
10
  sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/BrandMoment"
@@ -20,18 +19,19 @@ import * as BrandMoment from "./BrandMoment.stories"
20
19
 
21
20
  A brand moment is a page that showcases the brand's vibrant animations and illustration. The page provides an engaging experience for users when they reach these junction, helping to create a strong connection between the brand and product.
22
21
 
23
- <InlineNotification persistent type="informative">Code snippets on this page have been disabled due to performance issues, see [Source Code](https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/BrandMoment) for code examples.</InlineNotification>
22
+ <Canvas of={BrandMoment.Playground} />
23
+ <Controls of={BrandMoment.Playground} />
24
24
 
25
- ## Variants
25
+ ## Variant
26
26
 
27
- ### Informative Intro
28
- <Canvas of={BrandMoment.InformativeIntro} />
27
+ ### Informative
29
28
 
30
- ### Positive Outro
31
- <Canvas of={BrandMoment.PositiveOutro} />
29
+ <Canvas of={BrandMoment.Informative} />
32
30
 
33
- ### Positive Outro Customer Focused
34
- <Canvas of={BrandMoment.PositiveOutroCustomerFocused} />
31
+ ### Success
35
32
 
36
- ### Error
37
- <Canvas of={BrandMoment.Error} />
33
+ <Canvas of={BrandMoment.Success} />
34
+
35
+ ### Warning
36
+
37
+ <Canvas of={BrandMoment.Warning} />
@@ -0,0 +1,102 @@
1
+ import React from "react"
2
+ import { Meta } from "@storybook/react"
3
+ import {
4
+ BrandMomentCaptureIntro,
5
+ BrandMomentError,
6
+ BrandMomentPositiveOutro,
7
+ } from "~components/Illustration"
8
+ import {
9
+ StickerSheet,
10
+ StickerSheetStory,
11
+ } from "~storybook/components/StickerSheet"
12
+ import { BrandMoment } from "../BrandMoment"
13
+ import { Informative, Success, Warning } from "./BrandMoment.stories"
14
+
15
+ export default {
16
+ title: "Components/BrandMoment",
17
+ parameters: {
18
+ chromatic: { disable: false },
19
+ controls: { disable: true },
20
+ a11y: {
21
+ config: {
22
+ rules: [
23
+ {
24
+ // There's gonna be duplicate landmarks here because it's a stickersheet
25
+ id: "landmark-no-duplicate-banner",
26
+ enabled: false,
27
+ },
28
+ {
29
+ // There's gonna be duplicate landmarks here because it's a stickersheet
30
+ id: "landmark-no-duplicate-contentinfo",
31
+ enabled: false,
32
+ },
33
+ {
34
+ // There's gonna be duplicate landmarks here because it's a stickersheet
35
+ id: "landmark-no-duplicate-main",
36
+ enabled: false,
37
+ },
38
+ ],
39
+ },
40
+ },
41
+ },
42
+ } satisfies Meta
43
+
44
+ const StickerSheetTemplate: StickerSheetStory = {
45
+ render: ({ isReversed }) => (
46
+ <>
47
+ <StickerSheet isReversed={isReversed} heading="Variant">
48
+ <StickerSheet.Body>
49
+ <StickerSheet.Row rowTitle="Informative">
50
+ <BrandMoment {...Informative.args} />
51
+ </StickerSheet.Row>
52
+ <StickerSheet.Row rowTitle="Success">
53
+ <BrandMoment {...Success.args} />
54
+ </StickerSheet.Row>
55
+ <StickerSheet.Row rowTitle="Warning">
56
+ <BrandMoment {...Warning.args} />
57
+ </StickerSheet.Row>
58
+ </StickerSheet.Body>
59
+ </StickerSheet>
60
+
61
+ <StickerSheet isReversed={isReversed} heading="Mood (deprecated)">
62
+ <StickerSheet.Body>
63
+ <StickerSheet.Row rowTitle="Informative">
64
+ <BrandMoment
65
+ {...Informative.args}
66
+ illustration={<BrandMomentCaptureIntro />}
67
+ variant={undefined}
68
+ mood="informative"
69
+ />
70
+ </StickerSheet.Row>
71
+ <StickerSheet.Row rowTitle="Positive">
72
+ <BrandMoment
73
+ {...Success.args}
74
+ illustration={<BrandMomentPositiveOutro />}
75
+ variant={undefined}
76
+ mood="positive"
77
+ />
78
+ </StickerSheet.Row>
79
+ <StickerSheet.Row rowTitle="Negative">
80
+ <BrandMoment
81
+ {...Warning.args}
82
+ illustration={<BrandMomentError />}
83
+ variant={undefined}
84
+ mood="negative"
85
+ />
86
+ </StickerSheet.Row>
87
+ </StickerSheet.Body>
88
+ </StickerSheet>
89
+ </>
90
+ ),
91
+ }
92
+
93
+ export const StickerSheetDefault: StickerSheetStory = {
94
+ ...StickerSheetTemplate,
95
+ name: "Sticker Sheet (Default)",
96
+ }
97
+
98
+ export const StickerSheetRTL: StickerSheetStory = {
99
+ ...StickerSheetTemplate,
100
+ name: "Sticker Sheet (RTL)",
101
+ parameters: { textDirection: "rtl" },
102
+ }
@@ -3,11 +3,9 @@ import React from "react"
3
3
  import { Meta, StoryObj } from "@storybook/react"
4
4
  import isChromatic from "chromatic"
5
5
  import {
6
- ArrowLeftIcon,
7
6
  ArrowRightIcon,
8
7
  EmailIcon,
9
8
  FeedbackClassifyIcon,
10
- SecurityTipIcon,
11
9
  } from "~components/Icon"
12
10
  import {
13
11
  BrandMomentCaptureIntro,
@@ -30,10 +28,12 @@ const illustrationProps = (
30
28
  ) satisfies AnimatedSceneProps
31
29
 
32
30
  const meta = {
33
- title: "Components/Brand Moment",
31
+ title: "Components/BrandMoment",
34
32
  component: BrandMoment,
35
- parameters: {
36
- chromatic: { disable: false },
33
+ argTypes: {
34
+ mood: { control: false },
35
+ illustration: { control: false },
36
+ header: { control: false },
37
37
  },
38
38
  } satisfies Meta<typeof BrandMoment>
39
39
 
@@ -41,120 +41,39 @@ export default meta
41
41
 
42
42
  type Story = StoryObj<typeof meta>
43
43
 
44
- const IconRTLTemplate: Pick<Story, "render" | "parameters"> = {
45
- render: ({ primaryAction, ...args }, { globals }) => (
46
- <BrandMoment
47
- {...args}
48
- primaryAction={{
49
- label: "Primary action label",
50
- ...primaryAction,
51
- icon:
52
- globals.textDirection === "ltr" ? (
53
- <ArrowRightIcon role="presentation" />
54
- ) : (
55
- <ArrowLeftIcon role="presentation" />
56
- ),
57
- }}
58
- />
59
- ),
60
- parameters: {
61
- docs: {
62
- source: {
63
- // Code snippets will cause the browser to freeze when using JSX.Elements
64
- // within an object form prop, thus we must disable them to flip the
65
- // primaryAction icon when changing the global text direction
66
- code: "disabled",
67
- },
68
- },
69
- },
70
- }
71
-
72
- export const InformativeIntro: Story = {
73
- ...IconRTLTemplate,
74
- name: "Informative intro",
44
+ export const Playground: Story = {
75
45
  args: {
76
- mood: "informative",
46
+ variant: "informative",
77
47
  illustration: <BrandMomentCaptureIntro {...illustrationProps} />,
78
48
  header: <MinimalBasic />,
79
49
  text: {
80
50
  subtitle: "Welcome to Culture Amp",
81
51
  title: "Let's dive in and see how it works",
82
52
  },
83
- primaryAction: {
84
- label: "Get started",
85
- href: "#",
86
- icon: <ArrowRightIcon role="presentation" />,
87
- iconPosition: "end",
88
- },
89
53
  },
90
54
  }
91
55
 
92
- export const PositiveOutro: Story = {
93
- ...IconRTLTemplate,
94
- name: "Positive outro",
56
+ export const Informative: Story = {
95
57
  args: {
96
- mood: "positive",
97
- illustration: <BrandMomentPositiveOutro {...illustrationProps} />,
98
- header: <MinimalBasic />,
99
- text: {
100
- title: "Import in progress",
101
- body: (
102
- <>
103
- That&apos;s it for now. Your data is importing but you don&apos;t need
104
- to hang out here while it happens. Get on with your day and we&apos;ll
105
- let you know on the <a href="#">Users page</a> when it&apos;s
106
- complete.
107
- </>
108
- ),
109
- },
110
- primaryAction: {
111
- label: "Go to Users",
112
- href: "#",
113
- icon: <ArrowRightIcon role="presentation" />,
114
- iconPosition: "end",
115
- },
116
- },
117
- }
118
-
119
- export const InformativeIntroCustomerFocused: Story = {
120
- ...IconRTLTemplate,
121
- name: "Informative intro (customer focused)",
122
- args: {
123
- mood: "informative",
58
+ variant: "informative",
124
59
  illustration: <BrandMomentCaptureIntro {...illustrationProps} />,
125
- header: <MinimalCustomerFocused />,
60
+ header: <MinimalBasic />,
126
61
  text: {
127
- subtitle: "A survey for Hooli",
128
- title: "Manager Effectiveness Survey",
129
- body: "Thank you for taking the time to respond to this survey. It'll help us better understand your experience and perspective.",
130
- footer: (
131
- <>
132
- Your responses and information are securely collected and kept by
133
- Culture Amp in accordance with our <a href="#">Privacy Policy</a>.
134
- Your responses will be reported to Hooli based on the specific rules
135
- for this survey. If you have any additional questions, please contact
136
- us at <a href="#">support@cultureamp.com</a>.
137
- </>
138
- ),
62
+ subtitle: "Welcome to Culture Amp",
63
+ title: "Let's dive in and see how it works",
139
64
  },
140
65
  primaryAction: {
141
- label: "Take survey",
66
+ label: "Get started",
142
67
  href: "#",
143
68
  icon: <ArrowRightIcon role="presentation" />,
144
69
  iconPosition: "end",
145
70
  },
146
- secondaryAction: {
147
- label: "About data safety",
148
- icon: <SecurityTipIcon role="presentation" />,
149
- },
150
71
  },
151
72
  }
152
73
 
153
- export const PositiveOutroCustomerFocused: Story = {
154
- ...IconRTLTemplate,
155
- name: "Positive outro (customer focused)",
74
+ export const Success: Story = {
156
75
  args: {
157
- mood: "positive",
76
+ variant: "success",
158
77
  illustration: <BrandMomentPositiveOutro {...illustrationProps} />,
159
78
  header: <MinimalCustomerFocused />,
160
79
  text: {
@@ -189,10 +108,9 @@ export const PositiveOutroCustomerFocused: Story = {
189
108
  },
190
109
  }
191
110
 
192
- export const Error: Story = {
193
- ...IconRTLTemplate,
111
+ export const Warning: Story = {
194
112
  args: {
195
- mood: "negative",
113
+ variant: "warning",
196
114
  illustration: <BrandMomentError {...illustrationProps} />,
197
115
  header: <FakeNavBar />,
198
116
  text: {
@@ -3,12 +3,63 @@
3
3
  @import "~@kaizen/design-tokens/sass/color";
4
4
 
5
5
  .wrapper {
6
- color: $color-purple-800;
7
- border: var(--border-width-1) solid;
8
- border-radius: $border-borderless-border-radius;
9
- box-shadow: $shadow-small-box-shadow;
6
+ color: var(--color-purple-800);
7
+ border: var(--border-width-1) solid var(--card-border-color);
8
+ background-color: var(--card-background-color);
9
+ border-radius: var(--border-borderless-border-radius);
10
+ box-shadow: var(--card-box-shadow);
11
+
12
+ --card-border-color: var(--color-gray-500);
13
+ --card-background-color: var(--color-white);
14
+ --card-box-shadow: var(--shadow-small-box-shadow);
15
+ }
16
+
17
+ .elevated {
18
+ --card-box-shadow: var(--shadow-large-box-shadow);
19
+ }
20
+
21
+ // Color styles ---------------------------
22
+ .blue {
23
+ --card-background-color: var(--color-blue-100);
24
+ --card-border-color: var(--color-blue-400);
25
+ }
26
+
27
+ .gray {
28
+ --card-background-color: var(--color-gray-200);
29
+ --card-border-color: var(--color-gray-500);
30
+ }
31
+
32
+ .green {
33
+ --card-background-color: var(--color-green-100);
34
+ --card-border-color: var(--color-green-500);
35
+ }
36
+
37
+ .orange {
38
+ --card-background-color: var(--color-orange-100);
39
+ --card-border-color: var(--color-orange-600);
40
+ }
41
+
42
+ .purple {
43
+ --card-background-color: var(--color-purple-100);
44
+ --card-border-color: var(--color-purple-400);
10
45
  }
11
46
 
47
+ .red {
48
+ --card-background-color: var(--color-red-100);
49
+ --card-border-color: var(--color-red-500);
50
+ }
51
+
52
+ .white {
53
+ --card-background-color: var(--color-white);
54
+ --card-border-color: var(--color-gray-500);
55
+ }
56
+
57
+ .yellow {
58
+ --card-background-color: var(--color-yellow-100);
59
+ --card-border-color: var(--color-yellow-700);
60
+ }
61
+
62
+ // Deprecated Variant styles ----------------
12
63
  .default {
13
64
  border-color: var(--color-gray-500);
14
65
  background-color: var(--color-white);
@@ -44,6 +95,4 @@
44
95
  background-color: $color-purple-100;
45
96
  }
46
97
 
47
- .elevated {
48
- box-shadow: $shadow-large-box-shadow;
49
- }
98
+ // --------------------------------------------
package/src/Card/Card.tsx CHANGED
@@ -12,21 +12,43 @@ export type CardVariants =
12
12
  | "assertive"
13
13
  | "highlight"
14
14
 
15
- export type CardProps = OverrideClassName<HTMLAttributes<HTMLElement>> & {
15
+ export type CardColors =
16
+ | "blue"
17
+ | "green"
18
+ | "gray"
19
+ | "orange"
20
+ | "purple"
21
+ | "red"
22
+ | "white"
23
+ | "yellow"
24
+
25
+ export type CardProps = {
16
26
  children?: React.ReactNode
17
27
  /**
18
28
  * HTML elements that are allowed on Card.
19
29
  */
20
30
  tag?: "div" | "article" | "header" | "main" | "section" | "li"
21
- /**
22
- * determines the card background colour on the card. It should match to the type of content being conveyed.
23
- */
24
- variant?: CardVariants
25
31
  /**
26
32
  * Adds a larger box shadow to to the card container.
27
33
  */
28
34
  isElevated?: boolean
29
- }
35
+ /**
36
+ * If you are transitioning from `variant`:
37
+ * - `assertive` should be `orange`
38
+ * - `cautionary` should be `yellow`
39
+ * - `default` should be `white` OR you can remove the prop
40
+ * - `destructive` should be `red`
41
+ * - `highlight` should be `purple`
42
+ * - `informative` should be `blue`
43
+ * - `positive` should be `green`
44
+ * @default white
45
+ */
46
+ color?: CardColors
47
+ /**
48
+ * @deprecated Please use color instead
49
+ */
50
+ variant?: CardVariants
51
+ } & OverrideClassName<Omit<HTMLAttributes<HTMLElement>, "color">>
30
52
 
31
53
  /**
32
54
  * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082094938/Card Guidance} |
@@ -35,24 +57,26 @@ export type CardProps = OverrideClassName<HTMLAttributes<HTMLElement>> & {
35
57
  export const Card = ({
36
58
  children,
37
59
  tag = "div",
38
- variant = "default",
60
+ variant,
61
+ color = "white",
39
62
  isElevated = false,
40
63
  classNameOverride,
41
64
  ...props
42
65
  }: CardProps): JSX.Element => {
43
- const Tag = tag
66
+ const Element = tag
67
+
44
68
  return (
45
- <Tag
69
+ <Element
46
70
  className={classnames(
47
71
  styles.wrapper,
48
- styles[variant],
72
+ variant ? styles[variant] : styles[color],
49
73
  classNameOverride,
50
74
  isElevated && styles.elevated
51
75
  )}
52
76
  {...props}
53
77
  >
54
78
  {children}
55
- </Tag>
79
+ </Element>
56
80
  )
57
81
  }
58
82
 
@@ -1,4 +1,4 @@
1
- import { Canvas, Controls, DocsStory, Meta } from "@storybook/blocks"
1
+ import { Canvas, Controls, Meta } from "@storybook/blocks"
2
2
  import { ResourceLinks, KAIOInstallation } from "~storybook/components"
3
3
  import * as CardStories from "./Card.stories"
4
4
 
@@ -22,6 +22,9 @@ The `Card` component is a flexible container used to wrap primary content. It ha
22
22
 
23
23
  ## API
24
24
 
25
- <DocsStory of={CardStories.Variants} />
25
+ ### Colors
26
+ <Canvas of={CardStories.Colors} />
27
+
28
+ ### Elevation
29
+ <Canvas of={CardStories.Elevation} />
26
30
 
27
- <DocsStory of={CardStories.Elevation} />
@@ -8,53 +8,58 @@ import { Card, CardProps } from "../index"
8
8
 
9
9
  export default {
10
10
  title: "Components/Card",
11
+ args: {
12
+ children: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
13
+ },
11
14
  parameters: {
12
15
  chromatic: { disable: false },
13
16
  controls: { disable: true },
14
17
  },
15
18
  } satisfies Meta
16
19
 
17
- const CardWrapper = (args: CardProps): JSX.Element => (
18
- <Card {...args}>
19
- Lorem ipsum dolor sit amet, consectetur adipiscing elit.
20
- </Card>
21
- )
20
+ const colors = [
21
+ "blue",
22
+ "green",
23
+ "gray",
24
+ "orange",
25
+ "purple",
26
+ "red",
27
+ "white",
28
+ "yellow",
29
+ ] satisfies Array<CardProps["color"]>
30
+
31
+ const variants = [
32
+ "default",
33
+ "informative",
34
+ "positive",
35
+ "cautionary",
36
+ "destructive",
37
+ "assertive",
38
+ "highlight",
39
+ ] satisfies Array<CardProps["variant"]>
22
40
 
23
41
  const StickerSheetTemplate: StickerSheetStory = {
24
- render: ({ isReversed }) => (
25
- <StickerSheet isReversed={isReversed}>
26
- <StickerSheet.Header
27
- headings={[
28
- "Base",
29
- "Informative",
30
- "Positive",
31
- "Cautionary",
32
- "Destructive",
33
- "Assertive",
34
- "Highlight",
35
- ]}
36
- />
37
- <StickerSheet.Body>
38
- <StickerSheet.Row>
39
- <CardWrapper variant="default" />
40
- <CardWrapper variant="informative" />
41
- <CardWrapper variant="positive" />
42
- <CardWrapper variant="cautionary" />
43
- <CardWrapper variant="destructive" />
44
- <CardWrapper variant="assertive" />
45
- <CardWrapper variant="highlight" />
46
- </StickerSheet.Row>
47
- <StickerSheet.Row>
48
- <CardWrapper variant="default" isElevated />
49
- <CardWrapper variant="informative" isElevated />
50
- <CardWrapper variant="positive" isElevated />
51
- <CardWrapper variant="cautionary" isElevated />
52
- <CardWrapper variant="destructive" isElevated />
53
- <CardWrapper variant="assertive" isElevated />
54
- <CardWrapper variant="highlight" isElevated />
55
- </StickerSheet.Row>
56
- </StickerSheet.Body>
57
- </StickerSheet>
42
+ render: ({ isReversed, ...args }) => (
43
+ <>
44
+ <StickerSheet isReversed={isReversed} heading="Colors">
45
+ <StickerSheet.Body>
46
+ {colors.map(color => (
47
+ <StickerSheet.Row key={color} rowTitle={color}>
48
+ <Card {...args} color={color} />
49
+ </StickerSheet.Row>
50
+ ))}
51
+ </StickerSheet.Body>
52
+ </StickerSheet>
53
+ <StickerSheet isReversed={isReversed} heading="Variants (deprecated)">
54
+ <StickerSheet.Body>
55
+ {variants.map(variant => (
56
+ <StickerSheet.Row key={variant} rowTitle={variant}>
57
+ <Card {...args} variant={variant} />
58
+ </StickerSheet.Row>
59
+ ))}
60
+ </StickerSheet.Body>
61
+ </StickerSheet>
62
+ </>
58
63
  ),
59
64
  }
60
65