@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
@@ -4,15 +4,18 @@ import { ExclamationIcon } from "~components/Icon/ExclamationIcon"
4
4
  import { InformationIcon } from "~components/Icon/InformationIcon"
5
5
  import { SecurityTipIcon } from "~components/Icon/SecurityTipIcon"
6
6
  import { SuccessIcon } from "~components/Icon/SuccessIcon"
7
- import { NotificationType } from "~components/Notification/types"
7
+ import {
8
+ NotificationType,
9
+ NotificationVariant,
10
+ } from "~components/Notification/types"
8
11
 
9
- export type NotificationIconProps = {
12
+ export type NotificationIconTypeProps = {
10
13
  type: NotificationType
11
14
  }
12
15
 
13
- export const NotificationIcon = ({
16
+ export const NotificationIconType = ({
14
17
  type,
15
- }: NotificationIconProps): JSX.Element => {
18
+ }: NotificationIconTypeProps): JSX.Element => {
16
19
  switch (type) {
17
20
  case "positive":
18
21
  return <SuccessIcon role="presentation" inheritSize />
@@ -29,4 +32,27 @@ export const NotificationIcon = ({
29
32
  }
30
33
  }
31
34
 
32
- NotificationIcon.displayName = "NotificationIcon"
35
+ NotificationIconType.displayName = "NotificationIconType"
36
+
37
+ export type NotificationIconVariantProps = {
38
+ variant: NotificationVariant
39
+ }
40
+
41
+ export const NotificationIconVariant = ({
42
+ variant,
43
+ }: NotificationIconVariantProps): JSX.Element => {
44
+ switch (variant) {
45
+ case "success":
46
+ return <SuccessIcon role="presentation" inheritSize />
47
+ case "warning":
48
+ return <ExclamationIcon role="presentation" inheritSize />
49
+ case "cautionary":
50
+ return <CautionIcon role="presentation" inheritSize />
51
+ case "informative":
52
+ return <InformationIcon role="presentation" inheritSize />
53
+ case "security":
54
+ return <SecurityTipIcon role="presentation" inheritSize />
55
+ }
56
+ }
57
+
58
+ NotificationIconVariant.displayName = "NotificationIconVariant"
@@ -1,6 +1,13 @@
1
1
  export type NotificationType =
2
- | "positive"
3
- | "informative"
4
2
  | "cautionary"
3
+ | "informative"
5
4
  | "negative"
5
+ | "positive"
6
+ | "security"
7
+
8
+ export type NotificationVariant =
9
+ | "cautionary"
10
+ | "informative"
11
+ | "success"
6
12
  | "security"
13
+ | "warning"
@@ -3,10 +3,6 @@
3
3
 
4
4
  $height: 10px;
5
5
 
6
- @mixin animation-background($color) {
7
- background: linear-gradient(90deg, transparent, #{$color} 75%, transparent);
8
- }
9
-
10
6
  .subtext {
11
7
  color: $color-purple-800;
12
8
  padding-top: $spacing-6;
@@ -39,43 +35,59 @@ $height: 10px;
39
35
  border-radius: $height;
40
36
  overflow: hidden;
41
37
  transition: transform 200ms ease;
38
+ background-color: var(--progressbar-background-color);
42
39
  }
43
40
 
41
+ // ------------------------------
42
+ // Moods
43
+ // @deprecated use colors instead
44
+ // ------------------------------
44
45
  .positive {
45
- composes: progress;
46
- background: $color-green-400;
47
-
48
- &::after {
49
- @include animation-background($color-green-300);
50
- }
46
+ --progressbar-background-color: var(--color-green-400);
51
47
  }
52
48
 
53
49
  .informative {
54
- composes: progress;
55
- background: $color-blue-400;
56
-
57
- &::after {
58
- @include animation-background($color-blue-300);
59
- }
50
+ --progressbar-background-color: var(--color-blue-400);
60
51
  }
61
52
 
62
53
  .cautionary {
63
- composes: progress;
64
- background: $color-yellow-400;
65
-
66
- &::after {
67
- @include animation-background($color-yellow-300);
68
- }
54
+ --progressbar-background-color: var(--color-yellow-400);
69
55
  }
70
56
 
71
57
  .negative {
72
- composes: progress;
73
- background: $color-red-400;
58
+ --progressbar-background-color: var(--color-red-400);
59
+ }
60
+
61
+ // End deprecated styles
62
+
63
+ // ------------------------------
64
+ // Colors
65
+ // ------------------------------
66
+ .blue {
67
+ --progressbar-background-color: var(--color-blue-400);
68
+ }
69
+
70
+ .green {
71
+ --progressbar-background-color: var(--color-green-400);
72
+ }
73
+
74
+ .red {
75
+ --progressbar-background-color: var(--color-red-400);
76
+ }
77
+
78
+ .yellow {
79
+ --progressbar-background-color: var(--color-yellow-400);
74
80
  }
75
81
 
76
82
  .isAnimating {
77
83
  &::after {
78
- opacity: 100%;
84
+ background: linear-gradient(
85
+ 90deg,
86
+ transparent,
87
+ var(--color-white) 75%,
88
+ transparent
89
+ );
90
+ opacity: 25%;
79
91
  content: "";
80
92
  position: absolute;
81
93
  top: 0;
@@ -6,20 +6,43 @@ import { Label } from "./subcomponents/Label"
6
6
  import { calculatePercentage } from "./utils/calculatePercentage"
7
7
  import styles from "./ProgressBar.module.scss"
8
8
 
9
- export type ProgressBarProps = {
9
+ export type ProgressBarMood = {
10
+ /**
11
+ * @deprecated Use `color` prop instead
12
+ */
13
+ mood: "positive" | "informative" | "negative" | "cautionary"
14
+ color?: never
15
+ }
16
+
17
+ export type ProgressBarColor = {
18
+ /**
19
+ * @deprecated Use `color` prop instead
20
+ */
21
+ mood?: never
22
+ /**
23
+ * If transitioning from `mood`:
24
+ * - `cautionary` -> `yellow`
25
+ * - `informative` -> `blue`
26
+ * - `negative` -> `red`
27
+ * - `positive` -> `green`
28
+ */
29
+ color: "blue" | "green" | "red" | "yellow"
30
+ }
31
+
32
+ export type ProgressBarBaseProps = {
10
33
  /** A value that represents completed progress */
11
34
  value: number
12
35
  /** A value that sets the maximum progress that can be achieved */
13
36
  max: number
14
37
  /** Adds an animated state to indicate loading progress */
15
38
  isAnimating: boolean
16
- mood: Mood
17
39
  subtext?: string
18
40
  label?: string
19
41
  isReversed: boolean
20
- } & OverrideClassName<HTMLAttributes<HTMLDivElement>>
42
+ } & OverrideClassName<Omit<HTMLAttributes<HTMLDivElement>, "color">>
21
43
 
22
- type Mood = "positive" | "informative" | "negative" | "cautionary"
44
+ export type ProgressBarProps = ProgressBarBaseProps &
45
+ (ProgressBarMood | ProgressBarColor)
23
46
 
24
47
  /**
25
48
  * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3081896891/Progress+Bar Guidance} |
@@ -30,6 +53,7 @@ export const ProgressBar = ({
30
53
  max,
31
54
  isAnimating,
32
55
  mood,
56
+ color,
33
57
  subtext,
34
58
  label,
35
59
  classNameOverride,
@@ -50,7 +74,8 @@ export const ProgressBar = ({
50
74
  <div className={styles.progressBackground}>
51
75
  <div
52
76
  className={classnames(
53
- styles[mood],
77
+ styles.progress,
78
+ color ? styles[color] : styles[mood],
54
79
  isAnimating && styles.isAnimating
55
80
  )}
56
81
  style={{ transform: `translateX(-${100 - percentage}%` }}
@@ -1,6 +1,5 @@
1
1
  import { Canvas, Controls, DocsStory, Meta } from "@storybook/blocks"
2
2
  import { ResourceLinks, KAIOInstallation } from "~storybook/components"
3
- import * as ProgressBarStickersheetStories from "./ProgressBar.stickersheet.stories"
4
3
  import * as ProgressBarStories from "./ProgressBar.stories"
5
4
 
6
5
  <Meta of={ProgressBarStories} />
@@ -31,9 +30,9 @@ Adds an animated state that indicates system processes, such as downloading, upl
31
30
 
32
31
  <Canvas of={ProgressBarStories.IsAnimating} />
33
32
 
34
- ### Moods
33
+ ### Colors
35
34
 
36
- <Canvas of={ProgressBarStickersheetStories.StickerSheetDefault} />
35
+ <Canvas of={ProgressBarStories.Colors} />
37
36
 
38
37
  ### Value and max
39
38
 
@@ -1,10 +1,11 @@
1
1
  import React from "react"
2
2
  import { Meta } from "@storybook/react"
3
+ import isChromatic from "chromatic"
3
4
  import {
4
5
  StickerSheet,
5
6
  StickerSheetStory,
6
7
  } from "~storybook/components/StickerSheet"
7
- import { ProgressBar } from "../index"
8
+ import { ProgressBar, ProgressBarProps } from "../index"
8
9
 
9
10
  export default {
10
11
  title: "Components/ProgressBar",
@@ -25,57 +26,100 @@ export default {
25
26
  },
26
27
  } satisfies Meta
27
28
 
29
+ const isNotChromatic = !isChromatic()
30
+
31
+ const moods = [
32
+ {
33
+ title: "Positive",
34
+ props: { mood: "positive" },
35
+ },
36
+ {
37
+ title: "Informative",
38
+ props: { mood: "informative" },
39
+ },
40
+ {
41
+ title: "Negative",
42
+ props: { mood: "negative" },
43
+ },
44
+ {
45
+ title: "Cautionary",
46
+ props: { mood: "cautionary" },
47
+ },
48
+ ] satisfies Array<{ title: string; props: Partial<ProgressBarProps> }>
49
+
50
+ const colors = [
51
+ {
52
+ title: "Blue",
53
+ props: { color: "blue" },
54
+ },
55
+ {
56
+ title: "Green",
57
+ props: { color: "green" },
58
+ },
59
+ {
60
+ title: "Red",
61
+ props: { color: "red" },
62
+ },
63
+ {
64
+ title: "Yellow",
65
+ props: { color: "yellow" },
66
+ },
67
+ {
68
+ title: "Green (Animated)",
69
+ props: { color: "green", isAnimating: isNotChromatic },
70
+ },
71
+ ] satisfies Array<{ title: string; props: Partial<ProgressBarProps> }>
72
+
28
73
  const StickerSheetTemplate: StickerSheetStory = {
29
- render: ({ isReversed = false }) => (
30
- <StickerSheet className="w-full" isReversed={isReversed}>
31
- <StickerSheet.Body>
32
- <StickerSheet.Row rowTitle="Positive" rowTitleWidth="100px">
33
- <ProgressBar
34
- value={25}
35
- max={100}
36
- mood="positive"
37
- isAnimating={false}
38
- label="25%"
39
- subtext="Subtext"
40
- isReversed={isReversed}
41
- />
42
- </StickerSheet.Row>
43
- <StickerSheet.Row rowTitle="Informative">
44
- <ProgressBar
45
- value={25}
46
- max={100}
47
- mood="informative"
48
- isAnimating={false}
49
- label="25%"
50
- subtext="Subtext"
51
- isReversed={isReversed}
52
- />
53
- </StickerSheet.Row>
54
- <StickerSheet.Row rowTitle="Negative">
55
- <ProgressBar
56
- value={25}
57
- max={100}
58
- mood="negative"
59
- isAnimating={false}
60
- label="25%"
61
- subtext="Subtext"
62
- isReversed={isReversed}
63
- />
64
- </StickerSheet.Row>
65
- <StickerSheet.Row rowTitle="Cautionary">
66
- <ProgressBar
67
- value={25}
68
- max={100}
69
- mood="cautionary"
70
- isAnimating={false}
71
- label="25%"
72
- subtext="Subtext"
73
- isReversed={isReversed}
74
- />
75
- </StickerSheet.Row>
76
- </StickerSheet.Body>
77
- </StickerSheet>
78
- ),
74
+ render: ({ isReversed = false }) => {
75
+ const defaultProps = {
76
+ label: "25%",
77
+ value: 25,
78
+ max: 100,
79
+ isAnimating: false,
80
+ isReversed,
81
+ subtext: "Subtext",
82
+ }
83
+
84
+ return (
85
+ <>
86
+ <StickerSheet
87
+ className="w-full"
88
+ heading="ProgressBar"
89
+ isReversed={isReversed}
90
+ >
91
+ <StickerSheet.Body>
92
+ {colors.map(({ title, props }) => (
93
+ <StickerSheet.Row
94
+ key={title}
95
+ rowTitle={title}
96
+ rowTitleWidth="100px"
97
+ >
98
+ <ProgressBar {...defaultProps} {...props} />
99
+ </StickerSheet.Row>
100
+ ))}
101
+ </StickerSheet.Body>
102
+ </StickerSheet>
103
+ <StickerSheet
104
+ className="w-full"
105
+ heading="ProgressBar Moods (deprecated)"
106
+ isReversed={isReversed}
107
+ >
108
+ <StickerSheet.Body>
109
+ {moods.map(({ title, props }) => (
110
+ <StickerSheet.Row
111
+ key={title}
112
+ rowTitle={title}
113
+ rowTitleWidth="100px"
114
+ >
115
+ <ProgressBar {...defaultProps} {...props} />
116
+ </StickerSheet.Row>
117
+ ))}
118
+ </StickerSheet.Body>
119
+ </StickerSheet>
120
+ </>
121
+ )
122
+ },
79
123
  }
80
124
 
81
125
  export const StickerSheetDefault: StickerSheetStory = {
@@ -1,6 +1,6 @@
1
1
  import React from "react"
2
2
  import { Meta, StoryObj } from "@storybook/react"
3
- import { ProgressBar } from "../index"
3
+ import { ProgressBar, ProgressBarProps } from "../index"
4
4
 
5
5
  const meta = {
6
6
  title: "Components/ProgressBar",
@@ -8,26 +8,28 @@ const meta = {
8
8
  args: {
9
9
  value: 25,
10
10
  max: 100,
11
- mood: "positive",
11
+ color: "green",
12
12
  isAnimating: false,
13
13
  label: "25%",
14
14
  isReversed: false,
15
15
  },
16
- } satisfies Meta<typeof ProgressBar>
17
-
18
- const a11yExclusions = {
19
- a11y: {
20
- config: {
21
- rules: [
22
- {
23
- // `label` is an optional prop so this has no accessible title by default. For now consumers can pass in `aria-labelledby` or `aria-label`, which can provide an accessible title.
24
- id: "aria-progressbar-name",
25
- enabled: false,
26
- },
27
- ],
16
+ argTypes: {
17
+ mood: { control: false },
18
+ },
19
+ parameters: {
20
+ a11y: {
21
+ config: {
22
+ rules: [
23
+ {
24
+ // `label` is an optional prop so this has no accessible by default. consumers can pass in `aria-labelledby` or `aria-label` which can provide an accessible description pending a refactor.
25
+ id: "aria-progressbar-name",
26
+ enabled: false,
27
+ },
28
+ ],
29
+ },
28
30
  },
29
31
  },
30
- }
32
+ } satisfies Meta<typeof ProgressBar>
31
33
 
32
34
  export default meta
33
35
 
@@ -40,22 +42,55 @@ export const Playground: Story = {
40
42
  sourceState: "shown",
41
43
  },
42
44
  },
43
- ...a11yExclusions,
44
45
  },
45
46
  }
46
47
 
48
+ const colors = [
49
+ {
50
+ title: "Blue",
51
+ props: { color: "blue" },
52
+ },
53
+ {
54
+ title: "Green",
55
+ props: { color: "green" },
56
+ },
57
+ {
58
+ title: "Red",
59
+ props: { color: "red" },
60
+ },
61
+ {
62
+ title: "Yellow",
63
+ props: { color: "yellow" },
64
+ },
65
+ ] satisfies Array<{ title: string; props: Partial<ProgressBarProps> }>
66
+
67
+ export const Colors: Story = {
68
+ render: () => (
69
+ <div className="flex flex-col gap-16">
70
+ {colors.map(({ title, props }) => (
71
+ <ProgressBar
72
+ key={title}
73
+ {...props}
74
+ value={3}
75
+ max={5}
76
+ label={title}
77
+ isAnimating={false}
78
+ isReversed={false}
79
+ />
80
+ ))}
81
+ </div>
82
+ ),
83
+ }
84
+
47
85
  export const IsAnimating: Story = {
48
86
  args: { isAnimating: true },
49
- parameters: {
50
- ...a11yExclusions,
51
- },
52
87
  }
53
88
 
54
89
  export const ValueAndMax: Story = {
55
90
  render: () => (
56
91
  <div className="flex flex-col gap-16">
57
92
  <ProgressBar
58
- mood="positive"
93
+ color="green"
59
94
  value={3}
60
95
  max={5}
61
96
  label="3/5"
@@ -63,7 +98,7 @@ export const ValueAndMax: Story = {
63
98
  isReversed={false}
64
99
  />
65
100
  <ProgressBar
66
- mood="positive"
101
+ color="green"
67
102
  value={60}
68
103
  max={100}
69
104
  label="60%"
@@ -72,15 +107,11 @@ export const ValueAndMax: Story = {
72
107
  />
73
108
  </div>
74
109
  ),
75
- parameters: {
76
- ...a11yExclusions,
77
- },
78
110
  }
79
111
 
80
112
  export const Reversed: Story = {
81
113
  parameters: {
82
114
  backgrounds: { default: "Purple 700" },
83
- ...a11yExclusions,
84
115
  },
85
116
  args: { isReversed: true },
86
117
  }
@@ -24,8 +24,9 @@ A visually interesting item in a list consisting of a card, visual, title, metad
24
24
 
25
25
  ## API
26
26
 
27
- ### Moods
28
- <Canvas of={InformationTileStories.Moods} />
27
+ ### Variants
28
+
29
+ <Canvas of={InformationTileStories.Variants} />
29
30
 
30
31
  ### Information
31
32
  <Canvas of={InformationTileStories.Information} />
@@ -4,8 +4,7 @@ import {
4
4
  StickerSheet,
5
5
  StickerSheetStory,
6
6
  } from "~storybook/components/StickerSheet"
7
- import { moodsList } from "../../subcomponents/GenericTile/types"
8
- import { InformationTile } from "../index"
7
+ import { InformationTile, InformationTileProps } from "../index"
9
8
 
10
9
  export default {
11
10
  title: "Components/Tiles/InformationTile",
@@ -16,26 +15,65 @@ export default {
16
15
  } satisfies Meta
17
16
 
18
17
  const StickerSheetTemplate: StickerSheetStory = {
19
- render: () => (
20
- <StickerSheet>
21
- <StickerSheet.Body>
22
- {(["default", ...moodsList] as const).map(mood => (
23
- <StickerSheet.Row key={mood} rowTitle={mood}>
24
- <InformationTile
25
- mood={mood === "default" ? undefined : mood}
26
- title="Title"
27
- metadata="Side A"
28
- information="Side B"
29
- footer={<>Footer</>}
30
- />
31
- </StickerSheet.Row>
32
- ))}
33
- </StickerSheet.Body>
34
- </StickerSheet>
35
- ),
18
+ render: () => {
19
+ const defaultProps = {
20
+ title: "Title",
21
+ metadata: "Side A",
22
+ information: "Side B",
23
+ footer: <>Footer</>,
24
+ } satisfies InformationTileProps
25
+
26
+ const variants = ["default", "expert-advice"] satisfies Array<
27
+ InformationTileProps["variant"]
28
+ >
29
+
30
+ const moods = [
31
+ "positive",
32
+ "informative",
33
+ "cautionary",
34
+ "assertive",
35
+ "negative",
36
+ "prominent",
37
+ ] satisfies Array<InformationTileProps["mood"]>
38
+
39
+ return (
40
+ <>
41
+ <StickerSheet heading="InformationTile">
42
+ <StickerSheet.Body>
43
+ {variants.map(variant => (
44
+ <StickerSheet.Row key={variant} rowTitle={variant}>
45
+ <InformationTile {...defaultProps} variant={variant} />
46
+ </StickerSheet.Row>
47
+ ))}
48
+ </StickerSheet.Body>
49
+ </StickerSheet>
50
+
51
+ <StickerSheet heading="Mood (deprecated)">
52
+ <StickerSheet.Body>
53
+ <>
54
+ <StickerSheet.Row rowTitle="default">
55
+ <InformationTile {...defaultProps} />
56
+ </StickerSheet.Row>
57
+ {moods.map(mood => (
58
+ <StickerSheet.Row key={mood} rowTitle={mood}>
59
+ <InformationTile {...defaultProps} mood={mood} />
60
+ </StickerSheet.Row>
61
+ ))}
62
+ </>
63
+ </StickerSheet.Body>
64
+ </StickerSheet>
65
+ </>
66
+ )
67
+ },
36
68
  }
37
69
 
38
70
  export const StickerSheetDefault: StickerSheetStory = {
39
71
  ...StickerSheetTemplate,
40
72
  name: "Sticker Sheet (Default)",
41
73
  }
74
+
75
+ export const StickerSheetRTL: StickerSheetStory = {
76
+ ...StickerSheetTemplate,
77
+ name: "Sticker Sheet (RTL)",
78
+ parameters: { textDirection: "rtl" },
79
+ }