@kaizen/components 1.57.2 → 1.58.1

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 (232) 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 +135 -0
  39. package/codemods/updateGuidanceBlockVariantProp/transformGuidanceBlockVariantProp.ts +77 -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/Icon/subcomponents/SVG/SVG.cjs +2 -3
  63. package/dist/cjs/Illustration/subcomponents/VideoPlayer/VideoPlayer.cjs +1 -1
  64. package/dist/cjs/Modal/ConfirmationModal/ConfirmationModal.cjs +9 -5
  65. package/dist/cjs/Modal/ConfirmationModal/ConfirmationModal.module.scss.cjs +6 -2
  66. package/dist/cjs/Notification/ToastNotification/ToastNotification/ToastNotification.cjs +1 -3
  67. package/dist/cjs/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/ToastNotificationsMap.cjs +1 -3
  68. package/dist/cjs/Notification/subcomponents/GenericNotification/GenericNotification.cjs +6 -3
  69. package/dist/cjs/Notification/subcomponents/GenericNotification/GenericNotification.module.scss.cjs +5 -3
  70. package/dist/cjs/Notification/subcomponents/NotificationIcon/NotificationIcon.cjs +35 -3
  71. package/dist/cjs/ProgressBar/ProgressBar.cjs +3 -2
  72. package/dist/cjs/ProgressBar/ProgressBar.module.scss.cjs +8 -4
  73. package/dist/cjs/Tile/subcomponents/GenericTile/GenericTile.cjs +7 -5
  74. package/dist/cjs/Tile/subcomponents/GenericTile/GenericTile.module.scss.cjs +8 -6
  75. package/dist/cjs/Well/Well.cjs +5 -4
  76. package/dist/cjs/Well/Well.module.scss.cjs +9 -1
  77. package/dist/cjs/{GuidanceBlock → __containers__/GuidanceBlock/v1}/GuidanceBlock.cjs +6 -6
  78. package/dist/cjs/__containers__/GuidanceBlock/v1/GuidanceBlock.module.scss.cjs +33 -0
  79. package/dist/cjs/__containers__/GuidanceBlock/v2/GuidanceBlock.cjs +160 -0
  80. package/dist/cjs/__containers__/GuidanceBlock/v2/GuidanceBlock.module.scss.cjs +28 -0
  81. package/dist/cjs/containersV1.cjs +4 -0
  82. package/dist/cjs/containersV2.cjs +4 -0
  83. package/dist/cjs/index.cjs +2 -2
  84. package/dist/esm/BrandMoment/BrandMoment.mjs +3 -2
  85. package/dist/esm/BrandMoment/BrandMoment.module.scss.mjs +3 -1
  86. package/dist/esm/Card/Card.mjs +7 -6
  87. package/dist/esm/Card/Card.module.scss.mjs +10 -2
  88. package/dist/esm/EmptyState/EmptyState.mjs +15 -7
  89. package/dist/esm/EmptyState/EmptyState.module.scss.mjs +3 -0
  90. package/dist/esm/ErrorPage/ErrorPage.mjs +1 -1
  91. package/dist/esm/Icon/subcomponents/SVG/SVG.mjs +2 -3
  92. package/dist/esm/Illustration/subcomponents/VideoPlayer/VideoPlayer.mjs +1 -1
  93. package/dist/esm/Modal/ConfirmationModal/ConfirmationModal.mjs +9 -5
  94. package/dist/esm/Modal/ConfirmationModal/ConfirmationModal.module.scss.mjs +6 -2
  95. package/dist/esm/Notification/ToastNotification/ToastNotification/ToastNotification.mjs +1 -3
  96. package/dist/esm/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/ToastNotificationsMap.mjs +1 -3
  97. package/dist/esm/Notification/subcomponents/GenericNotification/GenericNotification.mjs +8 -5
  98. package/dist/esm/Notification/subcomponents/GenericNotification/GenericNotification.module.scss.mjs +5 -3
  99. package/dist/esm/Notification/subcomponents/NotificationIcon/NotificationIcon.mjs +39 -5
  100. package/dist/esm/ProgressBar/ProgressBar.mjs +3 -2
  101. package/dist/esm/ProgressBar/ProgressBar.module.scss.mjs +8 -4
  102. package/dist/esm/Tile/subcomponents/GenericTile/GenericTile.mjs +7 -5
  103. package/dist/esm/Tile/subcomponents/GenericTile/GenericTile.module.scss.mjs +8 -6
  104. package/dist/esm/Well/Well.mjs +5 -4
  105. package/dist/esm/Well/Well.module.scss.mjs +9 -1
  106. package/dist/esm/{GuidanceBlock → __containers__/GuidanceBlock/v1}/GuidanceBlock.mjs +6 -6
  107. package/dist/esm/__containers__/GuidanceBlock/v1/GuidanceBlock.module.scss.mjs +31 -0
  108. package/dist/esm/__containers__/GuidanceBlock/v2/GuidanceBlock.mjs +153 -0
  109. package/dist/esm/__containers__/GuidanceBlock/v2/GuidanceBlock.module.scss.mjs +26 -0
  110. package/dist/esm/containersV1.mjs +1 -0
  111. package/dist/esm/containersV2.mjs +1 -0
  112. package/dist/esm/index.mjs +1 -1
  113. package/dist/styles.css +13 -12
  114. package/dist/types/BrandMoment/BrandMoment.d.ts +19 -3
  115. package/dist/types/Card/Card.d.ts +20 -7
  116. package/dist/types/EmptyState/EmptyState.d.ts +14 -6
  117. package/dist/types/Icon/subcomponents/SVG/SVG.d.ts +1 -2
  118. package/dist/types/Modal/ConfirmationModal/ConfirmationModal.d.ts +25 -7
  119. package/dist/types/Modal/GenericModal/subcomponents/ModalFooter/ModalFooter.d.ts +3 -0
  120. package/dist/types/Modal/InputEditModal/InputEditModal.d.ts +4 -1
  121. package/dist/types/Notification/GlobalNotification/GlobalNotification.d.ts +3 -3
  122. package/dist/types/Notification/InlineNotification/InlineNotification.d.ts +3 -3
  123. package/dist/types/Notification/ToastNotification/ToastNotification/ToastNotification.d.ts +5 -4
  124. package/dist/types/Notification/ToastNotification/context/ToastNotificationContext.d.ts +4 -3
  125. package/dist/types/Notification/ToastNotification/types.d.ts +3 -3
  126. package/dist/types/Notification/subcomponents/GenericNotification/GenericNotification.d.ts +24 -4
  127. package/dist/types/Notification/subcomponents/NotificationIcon/NotificationIcon.d.ts +11 -4
  128. package/dist/types/Notification/types.d.ts +2 -1
  129. package/dist/types/ProgressBar/ProgressBar.d.ts +25 -6
  130. package/dist/types/Tile/subcomponents/GenericTile/GenericTile.d.ts +10 -3
  131. package/dist/types/Well/Well.d.ts +6 -2
  132. package/dist/types/Well/types.d.ts +4 -0
  133. package/dist/types/{GuidanceBlock → __containers__/GuidanceBlock/v1}/GuidanceBlock.d.ts +4 -4
  134. package/dist/types/__containers__/GuidanceBlock/v2/GuidanceBlock.d.ts +59 -0
  135. package/dist/types/__containers__/GuidanceBlock/v2/index.d.ts +1 -0
  136. package/dist/types/__containers__/v1.d.ts +1 -0
  137. package/dist/types/__containers__/v2.d.ts +1 -0
  138. package/dist/types/index.d.ts +1 -1
  139. package/package.json +28 -13
  140. package/src/BrandMoment/BrandMoment.module.scss +20 -9
  141. package/src/BrandMoment/BrandMoment.tsx +26 -3
  142. package/src/BrandMoment/_docs/BrandMoment.mdx +13 -13
  143. package/src/BrandMoment/_docs/BrandMoment.stickersheet.stories.tsx +102 -0
  144. package/src/BrandMoment/_docs/BrandMoment.stories.tsx +17 -99
  145. package/src/Card/Card.module.scss +56 -7
  146. package/src/Card/Card.tsx +35 -11
  147. package/src/Card/_docs/Card.mdx +6 -3
  148. package/src/Card/_docs/Card.stickersheet.stories.tsx +44 -39
  149. package/src/Card/_docs/Card.stories.tsx +23 -23
  150. package/src/EmptyState/EmptyState.module.scss +32 -14
  151. package/src/EmptyState/EmptyState.tsx +32 -18
  152. package/src/EmptyState/_docs/EmptyState.stickersheet.stories.tsx +69 -121
  153. package/src/EmptyState/_docs/EmptyState.stories.tsx +6 -8
  154. package/src/ErrorPage/ErrorPage.tsx +1 -1
  155. package/src/Icon/subcomponents/SVG/SVG.tsx +1 -4
  156. package/src/Illustration/subcomponents/VideoPlayer/VideoPlayer.tsx +1 -1
  157. package/src/Modal/ConfirmationModal/ConfirmationModal.module.scss +100 -78
  158. package/src/Modal/ConfirmationModal/ConfirmationModal.spec.tsx +5 -5
  159. package/src/Modal/ConfirmationModal/ConfirmationModal.tsx +41 -10
  160. package/src/Modal/ConfirmationModal/_docs/ConfirmationModal.mdx +3 -3
  161. package/src/Modal/ConfirmationModal/_docs/ConfirmationModal.stories.tsx +11 -4
  162. package/src/Modal/ContextModal/_docs/ContextModal.stories.tsx +3 -1
  163. package/src/Modal/GenericModal/subcomponents/ModalFooter/ModalFooter.tsx +3 -0
  164. package/src/Modal/InputEditModal/InputEditModal.tsx +4 -1
  165. package/src/Modal/InputEditModal/_docs/InputEditModal.mdx +0 -13
  166. package/src/Modal/InputEditModal/_docs/InputEditModal.stories.tsx +9 -10
  167. package/src/Notification/GlobalNotification/GlobalNotification.tsx +9 -4
  168. package/src/Notification/GlobalNotification/_docs/GlobalNotification.stickersheet.stories.tsx +68 -58
  169. package/src/Notification/GlobalNotification/_docs/GlobalNotification.stories.tsx +10 -13
  170. package/src/Notification/InlineNotification/InlineNotification.tsx +9 -4
  171. package/src/Notification/InlineNotification/_docs/InlineNotification.stickersheet.stories.tsx +79 -44
  172. package/src/Notification/InlineNotification/_docs/InlineNotification.stories.tsx +17 -17
  173. package/src/Notification/ToastNotification/ToastNotification/ToastNotification.tsx +7 -5
  174. package/src/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/ToastNotificationsMap.tsx +1 -2
  175. package/src/Notification/ToastNotification/_docs/ToastNotification.stickersheet.stories.tsx +12 -7
  176. package/src/Notification/ToastNotification/_docs/ToastNotification.stories.tsx +6 -1
  177. package/src/Notification/ToastNotification/context/ToastNotificationContext.tsx +7 -3
  178. package/src/Notification/ToastNotification/types.ts +8 -3
  179. package/src/Notification/subcomponents/GenericNotification/GenericNotification.module.scss +42 -5
  180. package/src/Notification/subcomponents/GenericNotification/GenericNotification.tsx +40 -6
  181. package/src/Notification/subcomponents/GenericNotification/_mixins.scss +2 -1
  182. package/src/Notification/subcomponents/NotificationIcon/NotificationIcon.tsx +31 -5
  183. package/src/Notification/types.ts +9 -2
  184. package/src/ProgressBar/ProgressBar.module.scss +37 -25
  185. package/src/ProgressBar/ProgressBar.tsx +30 -5
  186. package/src/ProgressBar/_docs/ProgressBar.mdx +2 -3
  187. package/src/ProgressBar/_docs/ProgressBar.stickersheet.stories.tsx +95 -51
  188. package/src/ProgressBar/_docs/ProgressBar.stories.tsx +56 -25
  189. package/src/Tile/InformationTile/_docs/InformationTile.mdx +3 -2
  190. package/src/Tile/InformationTile/_docs/InformationTile.stickersheet.stories.tsx +57 -19
  191. package/src/Tile/InformationTile/_docs/InformationTile.stories.tsx +19 -7
  192. package/src/Tile/MultiActionTile/_docs/MultiActionTile.mdx +3 -2
  193. package/src/Tile/MultiActionTile/_docs/MultiActionTile.stickersheet.stories.tsx +62 -24
  194. package/src/Tile/MultiActionTile/_docs/MultiActionTile.stories.tsx +19 -7
  195. package/src/Tile/subcomponents/GenericTile/GenericTile.module.scss +34 -22
  196. package/src/Tile/subcomponents/GenericTile/GenericTile.tsx +17 -8
  197. package/src/Tile/subcomponents/GenericTile/_docs/GenericTile.stickersheet.stories.tsx +57 -19
  198. package/src/Well/Well.module.scss +70 -33
  199. package/src/Well/Well.tsx +9 -3
  200. package/src/Well/_docs/Well.mdx +9 -2
  201. package/src/Well/_docs/Well.stickersheet.stories.tsx +10 -1
  202. package/src/Well/_docs/Well.stories.tsx +54 -29
  203. package/src/Well/types.ts +15 -0
  204. package/src/__actions__/Button/v3/_docs/ApiSpecification.mdx +1 -1
  205. package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/GuidanceBlock.module.scss +2 -2
  206. package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/_docs/GuidanceBlock.mdx +2 -2
  207. package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/_docs/GuidanceBlock.stickersheet.stories.tsx +1 -1
  208. package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/_docs/GuidanceBlock.stories.tsx +1 -1
  209. package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.module.scss +356 -0
  210. package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.spec.tsx +82 -0
  211. package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.tsx +262 -0
  212. package/src/__containers__/GuidanceBlock/v2/_docs/GuidanceBlock.mdx +38 -0
  213. package/src/__containers__/GuidanceBlock/v2/_docs/GuidanceBlock.stickersheet.stories.tsx +118 -0
  214. package/src/__containers__/GuidanceBlock/v2/_docs/GuidanceBlock.stories.tsx +152 -0
  215. package/src/__containers__/GuidanceBlock/v2/index.ts +1 -0
  216. package/src/__containers__/v1.ts +1 -0
  217. package/src/__containers__/v2.ts +1 -0
  218. package/src/index.ts +2 -1
  219. package/v1/containers/package.json +5 -0
  220. package/v2/containers/package.json +5 -0
  221. package/dist/cjs/GuidanceBlock/GuidanceBlock.module.scss.cjs +0 -33
  222. package/dist/esm/GuidanceBlock/GuidanceBlock.module.scss.mjs +0 -31
  223. package/dist/types/Tile/subcomponents/GenericTile/types.d.ts +0 -2
  224. package/src/EmptyState/_docs/EmptyState.stories.module.scss +0 -15
  225. package/src/Notification/ToastNotification/ToastNotification/ToastNotification.spec.tsx +0 -33
  226. package/src/Tile/subcomponents/GenericTile/types.ts +0 -10
  227. /package/dist/types/{GuidanceBlock → __containers__/GuidanceBlock/v1}/index.d.ts +0 -0
  228. /package/dist/types/{GuidanceBlock → __containers__/GuidanceBlock/v1}/types.d.ts +0 -0
  229. /package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/GuidanceBlock.spec.tsx +0 -0
  230. /package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/GuidanceBlock.tsx +0 -0
  231. /package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/index.ts +0 -0
  232. /package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/types.ts +0 -0
@@ -1,21 +1,18 @@
1
1
  import { Meta, StoryObj } from "@storybook/react"
2
- import {
3
- GlobalNotification,
4
- GlobalNotificationProps,
5
- } from "../GlobalNotification"
6
-
7
- const DEFAULT_PROPS: Partial<GlobalNotificationProps> = {
8
- type: "positive",
9
- children:
10
- "Lorem ipsum dolor sit amet consectetur adipisicing elit. Perspiciatis quibusdam natus doloremque",
11
- }
2
+ import { GlobalNotification } from "../GlobalNotification"
12
3
 
13
4
  const meta = {
14
5
  title: "Components/Notifications/GlobalNotification",
15
6
  component: GlobalNotification,
16
-
17
7
  args: {
18
- ...DEFAULT_PROPS,
8
+ variant: "success",
9
+ children:
10
+ "Lorem ipsum dolor sit amet consectetur adipisicing elit. Perspiciatis quibusdam natus doloremque",
11
+ },
12
+ argTypes: {
13
+ type: {
14
+ control: false,
15
+ },
19
16
  },
20
17
  } satisfies Meta<typeof GlobalNotification>
21
18
 
@@ -41,7 +38,7 @@ export const Playground: StoryObj<typeof meta> = {
41
38
  export const Persistent: StoryObj<typeof meta> = {
42
39
  args: {
43
40
  persistent: true,
44
- type: "negative",
41
+ variant: "warning",
45
42
  children: "Please fill in all required fields before submitting",
46
43
  },
47
44
  }
@@ -2,12 +2,14 @@ import React from "react"
2
2
  import classnames from "classnames"
3
3
  import { HeadingProps } from "~components/Heading"
4
4
  import { OverrideClassName } from "~types/OverrideClassName"
5
- import { GenericNotification } from "../subcomponents/GenericNotification"
5
+ import {
6
+ GenericNotification,
7
+ GenericNotificationType,
8
+ GenericNotificationVariant,
9
+ } from "../subcomponents/GenericNotification"
6
10
  import styles from "../subcomponents/GenericNotification/GenericNotification.module.scss"
7
- import { NotificationType } from "../types"
8
11
 
9
- export type InlineNotificationProps = OverrideClassName<{
10
- type: NotificationType
12
+ export type InlineNotificationBase = OverrideClassName<{
11
13
  children?: React.ReactNode
12
14
  /** @default false */
13
15
  persistent?: boolean
@@ -20,6 +22,9 @@ export type InlineNotificationProps = OverrideClassName<{
20
22
  isSubtle?: boolean
21
23
  }>
22
24
 
25
+ export type InlineNotificationProps = InlineNotificationBase &
26
+ (GenericNotificationType | GenericNotificationVariant)
27
+
23
28
  /**
24
29
  * {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082093392/Inline+Notification Guidance} |
25
30
  * {@link https://cultureamp.design/storybook/?path=/docs/components-notifications-inline-notification--docs Storybook}
@@ -21,17 +21,13 @@ export default {
21
21
  },
22
22
  } satisfies Meta
23
23
 
24
- const DEFAULT_CHILDREN: JSX.Element = (
25
- <span>
26
- New user data, imported by mackenzie@hooli.com has successfully uploaded.{" "}
27
- <a href="/">Manage users is now available</a>
28
- </span>
29
- )
30
-
31
24
  const DEFAULT_PROPS = {
32
- hideCloseIcon: false,
33
- persistent: false,
34
- children: DEFAULT_CHILDREN,
25
+ children: (
26
+ <span>
27
+ New user data, imported by mackenzie@hooli.com has successfully uploaded.{" "}
28
+ <a href="/">Manage users is now available</a>
29
+ </span>
30
+ ),
35
31
  } satisfies Partial<InlineNotificationProps>
36
32
 
37
33
  const VARIANTS_PROPS: Array<{
@@ -41,8 +37,7 @@ const VARIANTS_PROPS: Array<{
41
37
  {
42
38
  title: "Informative",
43
39
  props: {
44
- ...DEFAULT_PROPS,
45
- type: "informative",
40
+ variant: "informative",
46
41
  headingProps: {
47
42
  variant: "heading-6",
48
43
  tag: "span",
@@ -51,34 +46,20 @@ const VARIANTS_PROPS: Array<{
51
46
  },
52
47
  },
53
48
  {
54
- title: "Positive",
55
- props: {
56
- ...DEFAULT_PROPS,
57
- type: "positive",
58
- headingProps: {
59
- variant: "heading-6",
60
- tag: "span",
61
- children: "Positive title",
62
- },
63
- },
64
- },
65
- {
66
- title: "Negative",
49
+ title: "Success",
67
50
  props: {
68
- ...DEFAULT_PROPS,
69
- type: "negative",
51
+ variant: "success",
70
52
  headingProps: {
71
53
  variant: "heading-6",
72
54
  tag: "span",
73
- children: "Negative title",
55
+ children: "Success title",
74
56
  },
75
57
  },
76
58
  },
77
59
  {
78
60
  title: "Cautionary",
79
61
  props: {
80
- ...DEFAULT_PROPS,
81
- type: "cautionary",
62
+ variant: "cautionary",
82
63
  headingProps: {
83
64
  variant: "heading-6",
84
65
  tag: "span",
@@ -87,35 +68,32 @@ const VARIANTS_PROPS: Array<{
87
68
  },
88
69
  },
89
70
  {
90
- title: "Security",
71
+ title: "Warning",
91
72
  props: {
92
- ...DEFAULT_PROPS,
93
- type: "security",
73
+ variant: "warning",
94
74
  headingProps: {
95
75
  variant: "heading-6",
96
76
  tag: "span",
97
- children: "Security title",
77
+ children: "Warning title",
98
78
  },
99
79
  },
100
80
  },
101
81
  {
102
82
  title: "Persistent",
103
83
  props: {
104
- ...DEFAULT_PROPS,
105
- type: "informative",
84
+ variant: "informative",
106
85
  persistent: true,
107
86
  headingProps: {
108
87
  variant: "heading-6",
109
88
  tag: "span",
110
- children: "Security title",
89
+ children: "Persistent title",
111
90
  },
112
91
  },
113
92
  },
114
93
  {
115
94
  title: "Subtle",
116
95
  props: {
117
- ...DEFAULT_PROPS,
118
- type: "informative",
96
+ variant: "informative",
119
97
  isSubtle: true,
120
98
  persistent: true,
121
99
  headingProps: {
@@ -129,10 +107,9 @@ const VARIANTS_PROPS: Array<{
129
107
  {
130
108
  title: "Multiline",
131
109
  props: {
132
- ...DEFAULT_PROPS,
133
110
  children:
134
111
  "Content longer that the width of the container will break onto a new line. Lorem ipsum dolor, sit amet consectetur adipisicing elit. In aperiam voluptatem molestias saepe quia vitae quod ex illum, unde nihil impedit possimus officia labore atque quidem necessitatibus sint, maiores velit.",
135
- type: "positive",
112
+ variant: "success",
136
113
  headingProps: {
137
114
  variant: "heading-6",
138
115
  tag: "span",
@@ -143,10 +120,9 @@ const VARIANTS_PROPS: Array<{
143
120
  {
144
121
  title: "Forced multiline",
145
122
  props: {
146
- ...DEFAULT_PROPS,
147
123
  children:
148
124
  "forceMultiline will break children onto a new line regardless of width",
149
- type: "negative",
125
+ variant: "cautionary",
150
126
  headingProps: {
151
127
  variant: "heading-6",
152
128
  tag: "span",
@@ -157,6 +133,56 @@ const VARIANTS_PROPS: Array<{
157
133
  },
158
134
  ]
159
135
 
136
+ const TYPE_PROPS: Array<{
137
+ title: string
138
+ props: InlineNotificationProps
139
+ }> = [
140
+ {
141
+ title: "Informative",
142
+ props: {
143
+ type: "informative",
144
+ headingProps: {
145
+ variant: "heading-6",
146
+ tag: "span",
147
+ children: "Informative title",
148
+ },
149
+ },
150
+ },
151
+ {
152
+ title: "Positive",
153
+ props: {
154
+ type: "positive",
155
+ headingProps: {
156
+ variant: "heading-6",
157
+ tag: "span",
158
+ children: "Positive title",
159
+ },
160
+ },
161
+ },
162
+ {
163
+ title: "Cautionary",
164
+ props: {
165
+ type: "cautionary",
166
+ headingProps: {
167
+ variant: "heading-6",
168
+ tag: "span",
169
+ children: "Cautionary title",
170
+ },
171
+ },
172
+ },
173
+ {
174
+ title: "Negative",
175
+ props: {
176
+ type: "negative",
177
+ headingProps: {
178
+ variant: "heading-6",
179
+ tag: "span",
180
+ children: "Negative title",
181
+ },
182
+ },
183
+ },
184
+ ]
185
+
160
186
  const StickerSheetTemplate: StickerSheetStory = {
161
187
  render: ({ isReversed }) => (
162
188
  <>
@@ -164,7 +190,16 @@ const StickerSheetTemplate: StickerSheetStory = {
164
190
  <StickerSheet.Body>
165
191
  {VARIANTS_PROPS.map(({ title, props }) => (
166
192
  <StickerSheet.Row key={title} rowTitle={title}>
167
- <InlineNotification {...props} />
193
+ <InlineNotification {...DEFAULT_PROPS} {...props} />
194
+ </StickerSheet.Row>
195
+ ))}
196
+ </StickerSheet.Body>
197
+ </StickerSheet>
198
+ <StickerSheet heading="Type (deprecated)" isReversed={isReversed}>
199
+ <StickerSheet.Body>
200
+ {TYPE_PROPS.map(({ title, props }) => (
201
+ <StickerSheet.Row key={title} rowTitle={title}>
202
+ <InlineNotification {...DEFAULT_PROPS} {...props} />
168
203
  </StickerSheet.Row>
169
204
  ))}
170
205
  </StickerSheet.Body>
@@ -1,25 +1,25 @@
1
1
  import { Meta, StoryObj } from "@storybook/react"
2
- import {
3
- InlineNotification,
4
- InlineNotificationProps,
5
- } from "../InlineNotification"
6
-
7
- const DEFAULT_PROPS: Partial<InlineNotificationProps> = {
8
- headingProps: {
9
- children: "Informative",
10
- tag: "span",
11
- variant: "heading-6",
12
- },
13
- type: "informative",
14
- children:
15
- "Lorem ipsum dolor sit amet consectetur adipisicing elit. Perspiciatis quibusdam natus doloremque",
16
- }
2
+ import { InlineNotification } from "../InlineNotification"
17
3
 
18
4
  const meta = {
19
5
  title: "Components/Notifications/InlineNotification",
20
6
  component: InlineNotification,
21
7
  args: {
22
- ...DEFAULT_PROPS,
8
+ headingProps: {
9
+ children: "Informative",
10
+ tag: "span",
11
+ variant: "heading-6",
12
+ },
13
+ variant: "informative",
14
+ children:
15
+ "Lorem ipsum dolor sit amet consectetur adipisicing elit. Perspiciatis quibusdam natus doloremque",
16
+ },
17
+ argTypes: {
18
+ type: {
19
+ control: {
20
+ disable: true,
21
+ },
22
+ },
23
23
  },
24
24
  parameters: {
25
25
  a11y: {
@@ -47,7 +47,7 @@ export const Playground: StoryObj<typeof meta> = {
47
47
  export const Persistent: StoryObj<typeof meta> = {
48
48
  args: {
49
49
  persistent: true,
50
- type: "negative",
50
+ variant: "warning",
51
51
  children: "Please fill in all required fields before submitting",
52
52
  headingProps: {
53
53
  children: "Form error",
@@ -1,9 +1,13 @@
1
1
  import React, { useEffect, useId } from "react"
2
+ import {
3
+ GenericNotificationType,
4
+ GenericNotificationVariant,
5
+ } from "~components/Notification/subcomponents/GenericNotification"
2
6
  import { useToastNotificationContext } from "../context/ToastNotificationContext"
3
- import { ToastNotificationObj } from "../types"
7
+ import { ToastNotificationObjBase } from "../types"
4
8
 
5
9
  export type ToastNotificationProps = Omit<
6
- ToastNotificationObj,
10
+ ToastNotificationObjBase,
7
11
  "id" | "message" | "persistent"
8
12
  > & {
9
13
  children: React.ReactNode
@@ -14,12 +18,11 @@ export type ToastNotificationProps = Omit<
14
18
  * @default false
15
19
  */
16
20
  hideCloseIcon?: boolean
17
- }
21
+ } & (GenericNotificationType | GenericNotificationVariant)
18
22
 
19
23
  export const ToastNotification = ({
20
24
  id: propsId,
21
25
  hideCloseIcon = false,
22
- type,
23
26
  title,
24
27
  onHide,
25
28
  children,
@@ -33,7 +36,6 @@ export const ToastNotification = ({
33
36
  useEffect(() => {
34
37
  addToastNotification({
35
38
  id,
36
- type,
37
39
  title,
38
40
  message: children,
39
41
  persistent,
@@ -22,11 +22,10 @@ export const ToastNotificationsMap = ({
22
22
  return createPortal(
23
23
  <>
24
24
  {notifications.map(
25
- ({ id, type, title, persistent, onHide, message, ...restProps }) => (
25
+ ({ id, title, persistent, onHide, message, ...restProps }) => (
26
26
  <GenericNotification
27
27
  key={id}
28
28
  style="toast"
29
- type={type}
30
29
  title={title}
31
30
  persistent={persistent}
32
31
  onHide={(): void => {
@@ -14,27 +14,32 @@ export default {
14
14
  const StickerSheetTemplate: StickerSheetStory = {
15
15
  render: () => (
16
16
  <>
17
- <ToastNotification type="positive" title="Positive">
17
+ <ToastNotification variant="success" title="Success">
18
18
  New user data, imported by mackenzie@hooli.com has successfully
19
19
  uploaded. <a href="/">Manage users is now available</a>
20
20
  </ToastNotification>
21
- <ToastNotification type="informative" title="Informative">
21
+ <ToastNotification type="positive" title="Positive (Deprecated)">
22
+ New user data, imported by mackenzie@hooli.com has successfully
23
+ uploaded. <a href="/">Manage users is now available</a>
24
+ </ToastNotification>
25
+ <ToastNotification variant="informative" title="Informative">
22
26
  New user data is currently being processed. We&apos;ll let you know when
23
27
  the process is completed. <a href="/">Manage users</a>
24
28
  </ToastNotification>
25
- <ToastNotification type="cautionary" title="Cautionary">
29
+ <ToastNotification variant="cautionary" title="Cautionary">
26
30
  New user data, imported by mackenzie@hooli.com has uploaded with some
27
31
  minor issues. <a href="/">View issues</a>
28
32
  </ToastNotification>
29
- <ToastNotification type="security" title="Security">
33
+ <ToastNotification variant="warning" title="Warning">
30
34
  Results hidden to protect confidentiality of individuals and small
31
35
  groups. <a href="/">Learn more</a>
32
36
  </ToastNotification>
33
- <ToastNotification type="negative" title="Negative">
34
- Check your connection and try again. <a href="/">Refresh</a>.
37
+ <ToastNotification type="negative" title="Negative (Deprecated)">
38
+ New user data, imported by mackenzie@hooli.com has successfully
39
+ uploaded. <a href="/">Manage users is now available</a>
35
40
  </ToastNotification>
36
41
  <ToastNotification
37
- type="positive"
42
+ variant="security"
38
43
  title="Very long Title Example Very long title Example VerylongTitleExampleVerylongtitleExample"
39
44
  >
40
45
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla semper
@@ -8,7 +8,7 @@ const meta = {
8
8
  component: ToastNotification,
9
9
  args: {
10
10
  id: "abc-123",
11
- type: "positive",
11
+ variant: "success",
12
12
  title: "Success",
13
13
  children: (
14
14
  <div>
@@ -17,6 +17,11 @@ const meta = {
17
17
  </div>
18
18
  ),
19
19
  },
20
+ argTypes: {
21
+ type: {
22
+ control: false,
23
+ },
24
+ },
20
25
  } satisfies Meta<typeof ToastNotification>
21
26
 
22
27
  export default meta
@@ -1,10 +1,14 @@
1
1
  import React, { useContext, useState } from "react"
2
2
  import { v4 as uuidv4 } from "uuid"
3
- import { ToastNotificationObj } from "../types"
3
+ import {
4
+ GenericNotificationType,
5
+ GenericNotificationVariant,
6
+ } from "~components/Notification/subcomponents/GenericNotification"
7
+ import { ToastNotificationObj, ToastNotificationObjBase } from "../types"
4
8
 
5
- type ToastNotificationObjOptionalId = Omit<ToastNotificationObj, "id"> & {
9
+ type ToastNotificationObjOptionalId = Omit<ToastNotificationObjBase, "id"> & {
6
10
  id?: string
7
- }
11
+ } & (GenericNotificationType | GenericNotificationVariant)
8
12
 
9
13
  export type ToastNotificationContextValue = {
10
14
  notifications: ToastNotificationObj[]
@@ -1,9 +1,11 @@
1
1
  import { DataAttributes } from "~types/DataAttributes"
2
- import { NotificationType } from "../types"
2
+ import {
3
+ GenericNotificationType,
4
+ GenericNotificationVariant,
5
+ } from "../subcomponents/GenericNotification"
3
6
 
4
- export type ToastNotificationObj = {
7
+ export type ToastNotificationObjBase = {
5
8
  id: string
6
- type: NotificationType
7
9
  title: string
8
10
  message: React.ReactNode
9
11
  onHide?: () => void
@@ -13,3 +15,6 @@ export type ToastNotificationObj = {
13
15
  */
14
16
  persistent?: boolean
15
17
  } & DataAttributes
18
+
19
+ export type ToastNotificationObj = ToastNotificationObjBase &
20
+ (GenericNotificationType | GenericNotificationVariant)
@@ -11,6 +11,8 @@
11
11
  // Structure
12
12
  .icon {
13
13
  @extend %ca-notification__icon;
14
+
15
+ color: var(--icon-color);
14
16
  }
15
17
 
16
18
  .textContainer {
@@ -88,16 +90,14 @@
88
90
  @extend %ca-notification---global;
89
91
  }
90
92
 
93
+ // ------------------------------
91
94
  // Type
95
+ // @deprecated use variant instead
96
+ // ------------------------------
92
97
  .positive {
93
98
  @extend %ca-notification---positive;
94
99
  }
95
100
 
96
- .informative {
97
- @extend %ca-notification---informative;
98
- }
99
-
100
- .cautionary,
101
101
  .security {
102
102
  @extend %ca-notification---cautionary;
103
103
  }
@@ -106,6 +106,43 @@
106
106
  @extend %ca-notification---negative;
107
107
  }
108
108
 
109
+ // End deprecated styles
110
+
111
+ // ------------------------------
112
+ // Variant
113
+ // ------------------------------
114
+ .success {
115
+ background: $color-green-100;
116
+ border-color: var(--color-green-500);
117
+ color: $color-purple-800;
118
+
119
+ --icon-color: var(--color-green-500);
120
+ }
121
+
122
+ .informative {
123
+ background: $color-blue-100;
124
+ border-color: var(--color-blue-400);
125
+ color: $color-purple-800;
126
+
127
+ --icon-color: var(--color-blue-400);
128
+ }
129
+
130
+ .cautionary {
131
+ background: $color-yellow-100;
132
+ border-color: var(--color-yellow-700);
133
+ color: $color-purple-800;
134
+
135
+ --icon-color: var(--color-yellow-700);
136
+ }
137
+
138
+ .warning {
139
+ background: $color-red-100;
140
+ border-color: var(--color-red-500);
141
+ color: $color-purple-800;
142
+
143
+ --icon-color: var(--color-red-500);
144
+ }
145
+
109
146
  // Modifiers
110
147
  .noBottomMargin {
111
148
  @extend %ca-notification---noBottomMargin;
@@ -1,15 +1,20 @@
1
1
  import React, { HTMLAttributes, useEffect, useRef, useState } from "react"
2
2
  import classnames from "classnames"
3
3
  import { HeadingProps } from "~components/Heading"
4
- import { NotificationType } from "~components/Notification/types"
4
+ import {
5
+ NotificationType,
6
+ NotificationVariant,
7
+ } from "~components/Notification/types"
5
8
  import { OverrideClassName } from "~types/OverrideClassName"
6
9
  import { CancelButton } from "../CancelButton"
7
10
  import { NotificationHeading } from "../NotificationHeading"
8
- import { NotificationIcon } from "../NotificationIcon"
11
+ import {
12
+ NotificationIconType,
13
+ NotificationIconVariant,
14
+ } from "../NotificationIcon"
9
15
  import styles from "./GenericNotification.module.scss"
10
16
 
11
- export type GenericNotificationProps = {
12
- type: NotificationType
17
+ type GenericNotificationBase = {
13
18
  style: "global" | "inline" | "toast"
14
19
  children?: React.ReactNode
15
20
  title?: string
@@ -20,8 +25,33 @@ export type GenericNotificationProps = {
20
25
  headingProps?: HeadingProps
21
26
  } & Omit<OverrideClassName<HTMLAttributes<HTMLDivElement>>, "style">
22
27
 
28
+ export type GenericNotificationType = {
29
+ /**
30
+ * @deprecated Please use `variant` instead
31
+ */
32
+ type: NotificationType
33
+ variant?: never
34
+ }
35
+
36
+ export type GenericNotificationVariant = {
37
+ /**
38
+ * @deprecated Please use `variant` instead
39
+ */
40
+ type?: never
41
+ /**
42
+ * If you are transitioning from `type`:
43
+ * - `positive` should be `success`
44
+ * - `negative` should be `warning`
45
+ */
46
+ variant: NotificationVariant
47
+ }
48
+
49
+ export type GenericNotificationProps = GenericNotificationBase &
50
+ (GenericNotificationType | GenericNotificationVariant)
51
+
23
52
  export const GenericNotification = ({
24
53
  type,
54
+ variant,
25
55
  style,
26
56
  children,
27
57
  title,
@@ -70,7 +100,7 @@ export const GenericNotification = ({
70
100
  ref={containerRef}
71
101
  className={classnames(
72
102
  styles.notification,
73
- styles[type],
103
+ variant ? styles[variant] : styles[type],
74
104
  styles[style],
75
105
  isHidden && styles.hidden,
76
106
  noBottomMargin && styles.noBottomMargin,
@@ -82,7 +112,11 @@ export const GenericNotification = ({
82
112
  {...restProps}
83
113
  >
84
114
  <div className={styles.icon}>
85
- <NotificationIcon type={type} />
115
+ {type ? (
116
+ <NotificationIconType type={type} />
117
+ ) : (
118
+ <NotificationIconVariant variant={variant} />
119
+ )}
86
120
  </div>
87
121
  <div
88
122
  className={classnames(
@@ -26,7 +26,8 @@ $notification-slide-right: transform 300ms ease-out;
26
26
  &%ca-notification---inline,
27
27
  &%ca-notification---toast {
28
28
  margin-bottom: $spacing-24;
29
- border: $border-width var(--border-solid-border-style);
29
+ border-width: $border-width;
30
+ border-style: solid;
30
31
  border-radius: $border-solid-border-radius;
31
32
  }
32
33