@kaizen/components 1.57.2 → 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.
- package/bin/codemod.sh +39 -0
- package/codemods/README.md +31 -0
- package/codemods/__tests__/utils/index.ts +1 -0
- package/codemods/__tests__/utils/parseJsx.ts +11 -0
- package/codemods/migrateBrandMomentMoodToVariant/index.ts +21 -0
- package/codemods/migrateBrandMomentMoodToVariant/transformBrandMomentMoodToVariant.spec.ts +44 -0
- package/codemods/migrateBrandMomentMoodToVariant/transformBrandMomentMoodToVariant.ts +24 -0
- package/codemods/migrateCardVariantToColor/index.ts +15 -0
- package/codemods/migrateCardVariantToColor/transformCardVariantToColor.spec.ts +91 -0
- package/codemods/migrateCardVariantToColor/transformCardVariantToColor.ts +32 -0
- package/codemods/migrateConfirmationModalMoodsToVariant/index.ts +19 -0
- package/codemods/migrateConfirmationModalMoodsToVariant/transformConfirmationModalMoodsToVariant.spec.ts +110 -0
- package/codemods/migrateConfirmationModalMoodsToVariant/transformConfirmationModalMoodsToVariant.ts +59 -0
- package/codemods/migrateEmptyStateIllustrationTypeToVariant/index.ts +21 -0
- package/codemods/migrateEmptyStateIllustrationTypeToVariant/transformEmptyStateIllustrationTypeToVariant.spec.ts +74 -0
- package/codemods/migrateEmptyStateIllustrationTypeToVariant/transformEmptyStateIllustrationTypeToVariant.ts +28 -0
- package/codemods/migrateGlobalNotificationTypeToVariant/index.ts +19 -0
- package/codemods/migrateInformationTileMoodToVariant/index.ts +21 -0
- package/codemods/migrateInformationTileMoodToVariant/transformInformationTileMoodToVariant.spec.ts +84 -0
- package/codemods/migrateInformationTileMoodToVariant/transformInformationTileMoodToVariant.ts +22 -0
- package/codemods/migrateInlineNotificationTypeToVariant/index.ts +19 -0
- package/codemods/migrateMultiActionTileMoodToVariant/index.ts +21 -0
- package/codemods/migrateMultiActionTileMoodToVariant/transformMultiActionTileMoodToVariant.spec.ts +84 -0
- package/codemods/migrateMultiActionTileMoodToVariant/transformMultiActionTileMoodToVariant.ts +22 -0
- package/codemods/migrateNotificationTypeToVariant/index.ts +1 -0
- package/codemods/migrateNotificationTypeToVariant/migrateNotificationTypeToVariant.spec.ts +107 -0
- package/codemods/migrateNotificationTypeToVariant/migrateNotificationTypeToVariant.ts +28 -0
- package/codemods/migrateProgressBarMoodToColor/index.ts +21 -0
- package/codemods/migrateProgressBarMoodToColor/transformProgressBarMoodToColor.spec.ts +54 -0
- package/codemods/migrateProgressBarMoodToColor/transformProgressBarMoodToColor.ts +26 -0
- package/codemods/migrateToastNotificationTypeToVariant/index.ts +19 -0
- package/codemods/migrateWellVariantToColor/index.ts +15 -0
- package/codemods/migrateWellVariantToColor/transformWellVariantToColor.spec.ts +192 -0
- package/codemods/migrateWellVariantToColor/transformWellVariantToColor.ts +75 -0
- package/codemods/removeInputEditModalMood/index.ts +19 -0
- package/codemods/removeInputEditModalMood/removeInputEditModalMood.spec.ts +80 -0
- package/codemods/removeInputEditModalMood/removeInputEditModalMood.ts +40 -0
- package/codemods/updateGuidanceBlockVariantProp/transformGuidanceBlockVariantProp.spec.ts +118 -0
- package/codemods/updateGuidanceBlockVariantProp/transformGuidanceBlockVariantProp.ts +64 -0
- package/codemods/utils/__fixtures__/KaioComponent.tsx +6 -0
- package/codemods/utils/__snapshots__/transformSource.spec.ts.snap +11 -0
- package/codemods/utils/getPropValueText.spec.ts +75 -0
- package/codemods/utils/getPropValueText.ts +21 -0
- package/codemods/utils/getTagName.spec.ts +24 -0
- package/codemods/utils/getTagName.ts +32 -0
- package/codemods/utils/index.ts +7 -0
- package/codemods/utils/migrateStringProp.spec.ts +129 -0
- package/codemods/utils/migrateStringProp.ts +43 -0
- package/codemods/utils/printAst.ts +6 -0
- package/codemods/utils/transformComponentsInDir.ts +42 -0
- package/codemods/utils/transformSource.spec.ts +56 -0
- package/codemods/utils/transformSource.ts +25 -0
- package/codemods/utils/updateJsxElementWithNewProps.spec.ts +67 -0
- package/codemods/utils/updateJsxElementWithNewProps.ts +24 -0
- package/dist/cjs/BrandMoment/BrandMoment.cjs +3 -2
- package/dist/cjs/BrandMoment/BrandMoment.module.scss.cjs +3 -1
- package/dist/cjs/Card/Card.cjs +7 -6
- package/dist/cjs/Card/Card.module.scss.cjs +10 -2
- package/dist/cjs/EmptyState/EmptyState.cjs +14 -6
- package/dist/cjs/EmptyState/EmptyState.module.scss.cjs +3 -0
- package/dist/cjs/ErrorPage/ErrorPage.cjs +1 -1
- package/dist/cjs/Modal/ConfirmationModal/ConfirmationModal.cjs +9 -5
- package/dist/cjs/Modal/ConfirmationModal/ConfirmationModal.module.scss.cjs +6 -2
- package/dist/cjs/Notification/ToastNotification/ToastNotification/ToastNotification.cjs +1 -3
- package/dist/cjs/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/ToastNotificationsMap.cjs +1 -3
- package/dist/cjs/Notification/subcomponents/GenericNotification/GenericNotification.cjs +6 -3
- package/dist/cjs/Notification/subcomponents/GenericNotification/GenericNotification.module.scss.cjs +5 -3
- package/dist/cjs/Notification/subcomponents/NotificationIcon/NotificationIcon.cjs +35 -3
- package/dist/cjs/ProgressBar/ProgressBar.cjs +3 -2
- package/dist/cjs/ProgressBar/ProgressBar.module.scss.cjs +8 -4
- package/dist/cjs/Tile/subcomponents/GenericTile/GenericTile.cjs +7 -5
- package/dist/cjs/Tile/subcomponents/GenericTile/GenericTile.module.scss.cjs +8 -6
- package/dist/cjs/Well/Well.cjs +5 -4
- package/dist/cjs/Well/Well.module.scss.cjs +9 -1
- package/dist/cjs/{GuidanceBlock → __containers__/GuidanceBlock/v1}/GuidanceBlock.cjs +6 -6
- package/dist/cjs/__containers__/GuidanceBlock/v1/GuidanceBlock.module.scss.cjs +33 -0
- package/dist/cjs/__containers__/GuidanceBlock/v2/GuidanceBlock.cjs +160 -0
- package/dist/cjs/__containers__/GuidanceBlock/v2/GuidanceBlock.module.scss.cjs +28 -0
- package/dist/cjs/containersV1.cjs +4 -0
- package/dist/cjs/containersV2.cjs +4 -0
- package/dist/cjs/index.cjs +2 -2
- package/dist/esm/BrandMoment/BrandMoment.mjs +3 -2
- package/dist/esm/BrandMoment/BrandMoment.module.scss.mjs +3 -1
- package/dist/esm/Card/Card.mjs +7 -6
- package/dist/esm/Card/Card.module.scss.mjs +10 -2
- package/dist/esm/EmptyState/EmptyState.mjs +15 -7
- package/dist/esm/EmptyState/EmptyState.module.scss.mjs +3 -0
- package/dist/esm/ErrorPage/ErrorPage.mjs +1 -1
- package/dist/esm/Modal/ConfirmationModal/ConfirmationModal.mjs +9 -5
- package/dist/esm/Modal/ConfirmationModal/ConfirmationModal.module.scss.mjs +6 -2
- package/dist/esm/Notification/ToastNotification/ToastNotification/ToastNotification.mjs +1 -3
- package/dist/esm/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/ToastNotificationsMap.mjs +1 -3
- package/dist/esm/Notification/subcomponents/GenericNotification/GenericNotification.mjs +8 -5
- package/dist/esm/Notification/subcomponents/GenericNotification/GenericNotification.module.scss.mjs +5 -3
- package/dist/esm/Notification/subcomponents/NotificationIcon/NotificationIcon.mjs +39 -5
- package/dist/esm/ProgressBar/ProgressBar.mjs +3 -2
- package/dist/esm/ProgressBar/ProgressBar.module.scss.mjs +8 -4
- package/dist/esm/Tile/subcomponents/GenericTile/GenericTile.mjs +7 -5
- package/dist/esm/Tile/subcomponents/GenericTile/GenericTile.module.scss.mjs +8 -6
- package/dist/esm/Well/Well.mjs +5 -4
- package/dist/esm/Well/Well.module.scss.mjs +9 -1
- package/dist/esm/{GuidanceBlock → __containers__/GuidanceBlock/v1}/GuidanceBlock.mjs +6 -6
- package/dist/esm/__containers__/GuidanceBlock/v1/GuidanceBlock.module.scss.mjs +31 -0
- package/dist/esm/__containers__/GuidanceBlock/v2/GuidanceBlock.mjs +153 -0
- package/dist/esm/__containers__/GuidanceBlock/v2/GuidanceBlock.module.scss.mjs +26 -0
- package/dist/esm/containersV1.mjs +1 -0
- package/dist/esm/containersV2.mjs +1 -0
- package/dist/esm/index.mjs +1 -1
- package/dist/styles.css +13 -12
- package/dist/types/BrandMoment/BrandMoment.d.ts +19 -3
- package/dist/types/Card/Card.d.ts +20 -7
- package/dist/types/EmptyState/EmptyState.d.ts +14 -6
- package/dist/types/Modal/ConfirmationModal/ConfirmationModal.d.ts +25 -7
- package/dist/types/Modal/GenericModal/subcomponents/ModalFooter/ModalFooter.d.ts +3 -0
- package/dist/types/Modal/InputEditModal/InputEditModal.d.ts +4 -1
- package/dist/types/Notification/GlobalNotification/GlobalNotification.d.ts +3 -3
- package/dist/types/Notification/InlineNotification/InlineNotification.d.ts +3 -3
- package/dist/types/Notification/ToastNotification/ToastNotification/ToastNotification.d.ts +5 -4
- package/dist/types/Notification/ToastNotification/context/ToastNotificationContext.d.ts +4 -3
- package/dist/types/Notification/ToastNotification/types.d.ts +3 -3
- package/dist/types/Notification/subcomponents/GenericNotification/GenericNotification.d.ts +24 -4
- package/dist/types/Notification/subcomponents/NotificationIcon/NotificationIcon.d.ts +11 -4
- package/dist/types/Notification/types.d.ts +2 -1
- package/dist/types/ProgressBar/ProgressBar.d.ts +25 -6
- package/dist/types/Tile/subcomponents/GenericTile/GenericTile.d.ts +10 -3
- package/dist/types/Well/Well.d.ts +6 -2
- package/dist/types/Well/types.d.ts +4 -0
- package/dist/types/{GuidanceBlock → __containers__/GuidanceBlock/v1}/GuidanceBlock.d.ts +4 -4
- package/dist/types/__containers__/GuidanceBlock/v2/GuidanceBlock.d.ts +59 -0
- package/dist/types/__containers__/GuidanceBlock/v2/index.d.ts +1 -0
- package/dist/types/__containers__/v1.d.ts +1 -0
- package/dist/types/__containers__/v2.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +17 -3
- package/src/BrandMoment/BrandMoment.module.scss +20 -9
- package/src/BrandMoment/BrandMoment.tsx +26 -3
- package/src/BrandMoment/_docs/BrandMoment.mdx +13 -13
- package/src/BrandMoment/_docs/BrandMoment.stickersheet.stories.tsx +102 -0
- package/src/BrandMoment/_docs/BrandMoment.stories.tsx +17 -99
- package/src/Card/Card.module.scss +56 -7
- package/src/Card/Card.tsx +35 -11
- package/src/Card/_docs/Card.mdx +6 -3
- package/src/Card/_docs/Card.stickersheet.stories.tsx +44 -39
- package/src/Card/_docs/Card.stories.tsx +23 -23
- package/src/EmptyState/EmptyState.module.scss +32 -14
- package/src/EmptyState/EmptyState.tsx +32 -18
- package/src/EmptyState/_docs/EmptyState.stickersheet.stories.tsx +69 -121
- package/src/EmptyState/_docs/EmptyState.stories.tsx +6 -8
- package/src/ErrorPage/ErrorPage.tsx +1 -1
- package/src/Modal/ConfirmationModal/ConfirmationModal.module.scss +100 -78
- package/src/Modal/ConfirmationModal/ConfirmationModal.spec.tsx +5 -5
- package/src/Modal/ConfirmationModal/ConfirmationModal.tsx +41 -10
- package/src/Modal/ConfirmationModal/_docs/ConfirmationModal.mdx +3 -3
- package/src/Modal/ConfirmationModal/_docs/ConfirmationModal.stories.tsx +11 -4
- package/src/Modal/ContextModal/_docs/ContextModal.stories.tsx +3 -1
- package/src/Modal/GenericModal/subcomponents/ModalFooter/ModalFooter.tsx +3 -0
- package/src/Modal/InputEditModal/InputEditModal.tsx +4 -1
- package/src/Modal/InputEditModal/_docs/InputEditModal.mdx +0 -13
- package/src/Modal/InputEditModal/_docs/InputEditModal.stories.tsx +9 -10
- package/src/Notification/GlobalNotification/GlobalNotification.tsx +9 -4
- package/src/Notification/GlobalNotification/_docs/GlobalNotification.stickersheet.stories.tsx +68 -58
- package/src/Notification/GlobalNotification/_docs/GlobalNotification.stories.tsx +10 -13
- package/src/Notification/InlineNotification/InlineNotification.tsx +9 -4
- package/src/Notification/InlineNotification/_docs/InlineNotification.stickersheet.stories.tsx +79 -44
- package/src/Notification/InlineNotification/_docs/InlineNotification.stories.tsx +17 -17
- package/src/Notification/ToastNotification/ToastNotification/ToastNotification.tsx +7 -5
- package/src/Notification/ToastNotification/ToastNotificationsList/subcomponents/ToastNotificationsMap/ToastNotificationsMap.tsx +1 -2
- package/src/Notification/ToastNotification/_docs/ToastNotification.stickersheet.stories.tsx +12 -7
- package/src/Notification/ToastNotification/_docs/ToastNotification.stories.tsx +6 -1
- package/src/Notification/ToastNotification/context/ToastNotificationContext.tsx +7 -3
- package/src/Notification/ToastNotification/types.ts +8 -3
- package/src/Notification/subcomponents/GenericNotification/GenericNotification.module.scss +42 -5
- package/src/Notification/subcomponents/GenericNotification/GenericNotification.tsx +40 -6
- package/src/Notification/subcomponents/GenericNotification/_mixins.scss +2 -1
- package/src/Notification/subcomponents/NotificationIcon/NotificationIcon.tsx +31 -5
- package/src/Notification/types.ts +9 -2
- package/src/ProgressBar/ProgressBar.module.scss +37 -25
- package/src/ProgressBar/ProgressBar.tsx +30 -5
- package/src/ProgressBar/_docs/ProgressBar.mdx +2 -3
- package/src/ProgressBar/_docs/ProgressBar.stickersheet.stories.tsx +95 -51
- package/src/ProgressBar/_docs/ProgressBar.stories.tsx +56 -25
- package/src/Tile/InformationTile/_docs/InformationTile.mdx +3 -2
- package/src/Tile/InformationTile/_docs/InformationTile.stickersheet.stories.tsx +57 -19
- package/src/Tile/InformationTile/_docs/InformationTile.stories.tsx +19 -7
- package/src/Tile/MultiActionTile/_docs/MultiActionTile.mdx +3 -2
- package/src/Tile/MultiActionTile/_docs/MultiActionTile.stickersheet.stories.tsx +62 -24
- package/src/Tile/MultiActionTile/_docs/MultiActionTile.stories.tsx +19 -7
- package/src/Tile/subcomponents/GenericTile/GenericTile.module.scss +34 -22
- package/src/Tile/subcomponents/GenericTile/GenericTile.tsx +17 -8
- package/src/Tile/subcomponents/GenericTile/_docs/GenericTile.stickersheet.stories.tsx +57 -19
- package/src/Well/Well.module.scss +70 -33
- package/src/Well/Well.tsx +9 -3
- package/src/Well/_docs/Well.mdx +9 -2
- package/src/Well/_docs/Well.stickersheet.stories.tsx +10 -1
- package/src/Well/_docs/Well.stories.tsx +54 -29
- package/src/Well/types.ts +15 -0
- package/src/__actions__/Button/v3/_docs/ApiSpecification.mdx +1 -1
- package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/GuidanceBlock.module.scss +2 -2
- package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/_docs/GuidanceBlock.mdx +2 -2
- package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/_docs/GuidanceBlock.stickersheet.stories.tsx +1 -1
- package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/_docs/GuidanceBlock.stories.tsx +1 -1
- package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.module.scss +356 -0
- package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.spec.tsx +82 -0
- package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.tsx +262 -0
- package/src/__containers__/GuidanceBlock/v2/_docs/GuidanceBlock.mdx +38 -0
- package/src/__containers__/GuidanceBlock/v2/_docs/GuidanceBlock.stickersheet.stories.tsx +118 -0
- package/src/__containers__/GuidanceBlock/v2/_docs/GuidanceBlock.stories.tsx +152 -0
- package/src/__containers__/GuidanceBlock/v2/index.ts +1 -0
- package/src/__containers__/v1.ts +1 -0
- package/src/__containers__/v2.ts +1 -0
- package/src/index.ts +2 -1
- package/v1/containers/package.json +5 -0
- package/v2/containers/package.json +5 -0
- package/dist/cjs/GuidanceBlock/GuidanceBlock.module.scss.cjs +0 -33
- package/dist/esm/GuidanceBlock/GuidanceBlock.module.scss.mjs +0 -31
- package/dist/types/Tile/subcomponents/GenericTile/types.d.ts +0 -2
- package/src/EmptyState/_docs/EmptyState.stories.module.scss +0 -15
- package/src/Notification/ToastNotification/ToastNotification/ToastNotification.spec.tsx +0 -33
- package/src/Tile/subcomponents/GenericTile/types.ts +0 -10
- /package/dist/types/{GuidanceBlock → __containers__/GuidanceBlock/v1}/index.d.ts +0 -0
- /package/dist/types/{GuidanceBlock → __containers__/GuidanceBlock/v1}/types.d.ts +0 -0
- /package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/GuidanceBlock.spec.tsx +0 -0
- /package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/GuidanceBlock.tsx +0 -0
- /package/src/{GuidanceBlock → __containers__/GuidanceBlock/v1}/index.ts +0 -0
- /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 {
|
|
7
|
+
import {
|
|
8
|
+
NotificationType,
|
|
9
|
+
NotificationVariant,
|
|
10
|
+
} from "~components/Notification/types"
|
|
8
11
|
|
|
9
|
-
export type
|
|
12
|
+
export type NotificationIconTypeProps = {
|
|
10
13
|
type: NotificationType
|
|
11
14
|
}
|
|
12
15
|
|
|
13
|
-
export const
|
|
16
|
+
export const NotificationIconType = ({
|
|
14
17
|
type,
|
|
15
|
-
}:
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
73
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
-
###
|
|
33
|
+
### Colors
|
|
35
34
|
|
|
36
|
-
<Canvas of={
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
11
|
+
color: "green",
|
|
12
12
|
isAnimating: false,
|
|
13
13
|
label: "25%",
|
|
14
14
|
isReversed: false,
|
|
15
15
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
###
|
|
28
|
-
|
|
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 {
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
+
}
|