@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.
- 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 +19 -5
- 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/__actions__/Menu/v3/MenuItem.module.scss +1 -0
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import { Meta, StoryObj } from "@storybook/react"
|
|
3
|
-
import { Card } from "../index"
|
|
3
|
+
import { Card, CardProps } from "../index"
|
|
4
4
|
|
|
5
5
|
const meta = {
|
|
6
6
|
title: "Components/Card",
|
|
@@ -8,6 +8,11 @@ const meta = {
|
|
|
8
8
|
args: {
|
|
9
9
|
children: "This is a default container",
|
|
10
10
|
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
variant: {
|
|
13
|
+
control: false,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
11
16
|
} satisfies Meta<typeof Card>
|
|
12
17
|
|
|
13
18
|
export default meta
|
|
@@ -24,30 +29,25 @@ export const Playground: Story = {
|
|
|
24
29
|
},
|
|
25
30
|
}
|
|
26
31
|
|
|
27
|
-
|
|
32
|
+
const colors = [
|
|
33
|
+
"blue",
|
|
34
|
+
"green",
|
|
35
|
+
"gray",
|
|
36
|
+
"orange",
|
|
37
|
+
"purple",
|
|
38
|
+
"red",
|
|
39
|
+
"white",
|
|
40
|
+
"yellow",
|
|
41
|
+
] satisfies Array<CardProps["color"]>
|
|
42
|
+
|
|
43
|
+
export const Colors: Story = {
|
|
28
44
|
render: () => (
|
|
29
45
|
<ul className="flex list-none gap-16">
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
</li>
|
|
36
|
-
<li>
|
|
37
|
-
<Card variant="positive">Positive</Card>
|
|
38
|
-
</li>
|
|
39
|
-
<li>
|
|
40
|
-
<Card variant="cautionary">Cautionary</Card>
|
|
41
|
-
</li>
|
|
42
|
-
<li>
|
|
43
|
-
<Card variant="destructive">Destructive</Card>
|
|
44
|
-
</li>
|
|
45
|
-
<li>
|
|
46
|
-
<Card variant="assertive">Assertive</Card>
|
|
47
|
-
</li>
|
|
48
|
-
<li>
|
|
49
|
-
<Card variant="highlight">Highlight</Card>
|
|
50
|
-
</li>
|
|
46
|
+
{colors.map(color => (
|
|
47
|
+
<li key={color}>
|
|
48
|
+
<Card color={color}>This is a default container</Card>
|
|
49
|
+
</li>
|
|
50
|
+
))}
|
|
51
51
|
</ul>
|
|
52
52
|
),
|
|
53
53
|
}
|
|
@@ -4,21 +4,22 @@
|
|
|
4
4
|
@import "./mixins";
|
|
5
5
|
|
|
6
6
|
.container {
|
|
7
|
-
--border-width: var(--border-width-1);
|
|
7
|
+
--empty-state-border-width: var(--border-width-1);
|
|
8
8
|
|
|
9
9
|
display: flex;
|
|
10
10
|
justify-content: space-around;
|
|
11
11
|
width: 100%;
|
|
12
|
-
padding: calc(2% - var(--border-width))
|
|
13
|
-
calc(var(--spacing-24) - var(--border-width));
|
|
12
|
+
padding: calc(2% - var(--empty-state-border-width))
|
|
13
|
+
calc(var(--spacing-24) - var(--empty-state-border-width));
|
|
14
14
|
color: $color-purple-800;
|
|
15
|
-
border: var(--border-width) var(--
|
|
16
|
-
border-radius:
|
|
15
|
+
border: var(--empty-state-border-width) solid var(--empty-state-border-color);
|
|
16
|
+
border-radius: var(--border-solid-border-radius);
|
|
17
|
+
background-color: var(--empty-state-background-color);
|
|
17
18
|
|
|
18
19
|
@include small {
|
|
19
20
|
flex-direction: column;
|
|
20
21
|
align-items: center;
|
|
21
|
-
padding-block: calc(var(--spacing-24) - var(--border-width));
|
|
22
|
+
padding-block: calc(var(--spacing-24) - var(--empty-state-border-width));
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
&.straightCorners {
|
|
@@ -41,25 +42,42 @@
|
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
|
|
45
|
+
/** @deprecated */
|
|
44
46
|
.positive {
|
|
45
|
-
border-color: var(--color-green-500);
|
|
46
|
-
background-color:
|
|
47
|
+
--empty-state-border-color: var(--color-green-500);
|
|
48
|
+
--empty-state-background-color: var(--color-green-100);
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
.negative,
|
|
50
52
|
.action {
|
|
51
|
-
border-color: var(--color-red-500);
|
|
52
|
-
background-color:
|
|
53
|
+
--empty-state-border-color: var(--color-red-500);
|
|
54
|
+
--empty-state-background-color: var(--color-red-100);
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
.neutral {
|
|
56
|
-
border-color: var(--color-purple-400);
|
|
57
|
-
background-color:
|
|
58
|
+
--empty-state-border-color: var(--color-purple-400);
|
|
59
|
+
--empty-state-background-color: var(--color-purple-100);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** end @deprecated */
|
|
63
|
+
.success {
|
|
64
|
+
--empty-state-border-color: var(--color-green-500);
|
|
65
|
+
--empty-state-background-color: var(--color-green-100);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.warning {
|
|
69
|
+
--empty-state-border-color: var(--color-red-500);
|
|
70
|
+
--empty-state-background-color: var(--color-red-100);
|
|
58
71
|
}
|
|
59
72
|
|
|
60
73
|
.informative {
|
|
61
|
-
border-color: var(--color-blue-400);
|
|
62
|
-
background-color:
|
|
74
|
+
--empty-state-border-color: var(--color-blue-400);
|
|
75
|
+
--empty-state-background-color: var(--color-blue-100);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.expert-advice {
|
|
79
|
+
--empty-state-border-color: var(--color-purple-400);
|
|
80
|
+
--empty-state-background-color: var(--color-purple-100);
|
|
63
81
|
}
|
|
64
82
|
|
|
65
83
|
.illustrationSide,
|
|
@@ -16,27 +16,41 @@ const ILLUSTRATIONS: Record<
|
|
|
16
16
|
string,
|
|
17
17
|
(props: AnimatedSceneProps) => JSX.Element
|
|
18
18
|
> = {
|
|
19
|
+
success: EmptyStatesPositive,
|
|
20
|
+
warning: EmptyStatesNegative,
|
|
21
|
+
informative: EmptyStatesInformative,
|
|
22
|
+
"expert-advice": EmptyStatesNeutral,
|
|
23
|
+
/** @deprecated Replaced by success */
|
|
19
24
|
positive: EmptyStatesPositive,
|
|
25
|
+
/** @deprecated Replaced by expert-advice */
|
|
20
26
|
neutral: EmptyStatesNeutral,
|
|
27
|
+
/** @deprecated Replaced by warning */
|
|
21
28
|
negative: EmptyStatesNegative,
|
|
22
|
-
|
|
29
|
+
/** @deprecated Replaced by warning */
|
|
23
30
|
action: EmptyStatesNegative,
|
|
24
31
|
}
|
|
25
32
|
|
|
26
|
-
type IllustrationType =
|
|
27
|
-
| "positive"
|
|
28
|
-
| "neutral"
|
|
29
|
-
| "negative"
|
|
30
|
-
| "informative"
|
|
31
|
-
| "action"
|
|
32
|
-
|
|
33
|
-
type LayoutContextType = "sidebarAndContent" | "contentOnly"
|
|
34
|
-
|
|
35
33
|
export type EmptyStateProps = {
|
|
36
34
|
children?: React.ReactNode
|
|
37
35
|
id?: string
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
/** @deprecated Use `variant` instead */
|
|
37
|
+
illustrationType?:
|
|
38
|
+
| "positive"
|
|
39
|
+
| "informative"
|
|
40
|
+
| "negative"
|
|
41
|
+
| "action"
|
|
42
|
+
| "neutral"
|
|
43
|
+
/**
|
|
44
|
+
* If you are transitioning from `illustrationType`:
|
|
45
|
+
* - `positive` should be `success`
|
|
46
|
+
* - `informative` remains as `informative`
|
|
47
|
+
* - `negative` should be `warning`
|
|
48
|
+
* - `action` should be `warning`
|
|
49
|
+
* - `neutral` should be `expert-advice`
|
|
50
|
+
* @default informative
|
|
51
|
+
*/
|
|
52
|
+
variant?: "success" | "warning" | "informative" | "expert-advice"
|
|
53
|
+
layoutContext?: "sidebarAndContent" | "contentOnly"
|
|
40
54
|
bodyText: string | React.ReactNode
|
|
41
55
|
straightCorners?: boolean
|
|
42
56
|
headingProps?: HeadingProps
|
|
@@ -50,7 +64,8 @@ export type EmptyStateProps = {
|
|
|
50
64
|
export const EmptyState = ({
|
|
51
65
|
children,
|
|
52
66
|
id,
|
|
53
|
-
illustrationType
|
|
67
|
+
illustrationType,
|
|
68
|
+
variant = "informative",
|
|
54
69
|
layoutContext = "sidebarAndContent",
|
|
55
70
|
headingProps,
|
|
56
71
|
bodyText,
|
|
@@ -60,17 +75,16 @@ export const EmptyState = ({
|
|
|
60
75
|
classNameOverride,
|
|
61
76
|
...props
|
|
62
77
|
}: EmptyStateProps): JSX.Element => {
|
|
63
|
-
const IllustrationComponent = ILLUSTRATIONS[illustrationType]
|
|
78
|
+
const IllustrationComponent = ILLUSTRATIONS[illustrationType ?? variant]
|
|
64
79
|
|
|
65
80
|
return (
|
|
66
81
|
<div
|
|
67
82
|
className={classnames(
|
|
68
|
-
classNameOverride,
|
|
69
|
-
styles[illustrationType],
|
|
70
83
|
styles.container,
|
|
71
|
-
styles
|
|
84
|
+
illustrationType ? styles[illustrationType] : styles[variant],
|
|
72
85
|
styles[layoutContext],
|
|
73
|
-
straightCorners && styles.straightCorners
|
|
86
|
+
straightCorners && styles.straightCorners,
|
|
87
|
+
classNameOverride
|
|
74
88
|
)}
|
|
75
89
|
id={id}
|
|
76
90
|
{...props}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react"
|
|
2
|
-
import { Meta
|
|
2
|
+
import { Meta } from "@storybook/react"
|
|
3
3
|
import isChromatic from "chromatic"
|
|
4
4
|
import { ChevronRightIcon } from "~components/Icon"
|
|
5
5
|
import { Button } from "~components/__actions__/v2"
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
StickerSheetStory,
|
|
9
9
|
} from "~storybook/components/StickerSheet"
|
|
10
10
|
import { EmptyState, EmptyStateProps } from "../index"
|
|
11
|
-
import styles from "./EmptyState.stories.module.scss"
|
|
12
11
|
|
|
13
12
|
export default {
|
|
14
13
|
title: "Components/EmptyState",
|
|
@@ -20,141 +19,90 @@ export default {
|
|
|
20
19
|
|
|
21
20
|
const IS_CHROMATIC = isChromatic()
|
|
22
21
|
|
|
23
|
-
const EmptyStateWrapper
|
|
22
|
+
const EmptyStateWrapper = ({
|
|
24
23
|
isAnimated,
|
|
25
24
|
...args
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
const ButtonWrapper = (
|
|
29
|
-
<div className={styles.buttonContainer}>
|
|
30
|
-
<Button
|
|
31
|
-
label="Label"
|
|
32
|
-
icon={<ChevronRightIcon role="presentation" />}
|
|
33
|
-
iconPosition="end"
|
|
34
|
-
/>
|
|
35
|
-
</div>
|
|
25
|
+
}: EmptyStateProps): JSX.Element => (
|
|
26
|
+
<EmptyState isAnimated={IS_CHROMATIC ? false : isAnimated} {...args} />
|
|
36
27
|
)
|
|
37
28
|
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const INFORMATIVE_PROPS: EmptyStateProps = {
|
|
50
|
-
headingProps: {
|
|
51
|
-
variant: "heading-3",
|
|
52
|
-
children: "Informative empty state",
|
|
53
|
-
},
|
|
54
|
-
bodyText:
|
|
55
|
-
"If providing further actions, include a link to an action or use a Default or Primary action.",
|
|
56
|
-
illustrationType: "informative",
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const ACTION_PROPS: EmptyStateProps = {
|
|
60
|
-
children: ButtonWrapper,
|
|
61
|
-
headingProps: {
|
|
62
|
-
variant: "heading-3",
|
|
63
|
-
children: "Action empty state",
|
|
64
|
-
},
|
|
65
|
-
bodyText:
|
|
66
|
-
"If providing further actions, include a link to an action or use a Default or Primary action.",
|
|
67
|
-
illustrationType: "action",
|
|
68
|
-
}
|
|
29
|
+
const StickerSheetTemplate: StickerSheetStory = {
|
|
30
|
+
render: ({ isReversed }) => {
|
|
31
|
+
const defaultProps = {
|
|
32
|
+
headingProps: {
|
|
33
|
+
variant: "heading-3",
|
|
34
|
+
children: "Empty state",
|
|
35
|
+
},
|
|
36
|
+
bodyText:
|
|
37
|
+
"If providing further actions, include a link to an action or use a Default or Primary action.",
|
|
38
|
+
} satisfies EmptyStateProps
|
|
69
39
|
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"If providing further actions, include a link to an action or use a Default or Primary action.",
|
|
77
|
-
illustrationType: "neutral",
|
|
78
|
-
}
|
|
40
|
+
const variants = [
|
|
41
|
+
"success",
|
|
42
|
+
"warning",
|
|
43
|
+
"informative",
|
|
44
|
+
"expert-advice",
|
|
45
|
+
] satisfies Array<EmptyStateProps["variant"]>
|
|
79
46
|
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
"If providing further actions, include a link to an action or use a Default or Primary action.",
|
|
88
|
-
illustrationType: "negative",
|
|
89
|
-
}
|
|
47
|
+
const illustrationTypes = [
|
|
48
|
+
"positive",
|
|
49
|
+
"neutral",
|
|
50
|
+
"negative",
|
|
51
|
+
"informative",
|
|
52
|
+
"action",
|
|
53
|
+
] satisfies Array<EmptyStateProps["illustrationType"]>
|
|
90
54
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
55
|
+
return (
|
|
56
|
+
<>
|
|
57
|
+
<StickerSheet isReversed={isReversed} heading="EmptyState">
|
|
58
|
+
<StickerSheet.Body>
|
|
59
|
+
{variants.map(variant => (
|
|
60
|
+
<StickerSheet.Row key={variant} rowTitle={variant}>
|
|
61
|
+
<EmptyStateWrapper {...defaultProps} variant={variant} />
|
|
62
|
+
</StickerSheet.Row>
|
|
63
|
+
))}
|
|
64
|
+
</StickerSheet.Body>
|
|
65
|
+
<StickerSheet.Body>
|
|
66
|
+
<StickerSheet.Row rowTitle="straightCorners">
|
|
67
|
+
<EmptyStateWrapper {...defaultProps} straightCorners />
|
|
68
|
+
</StickerSheet.Row>
|
|
69
|
+
</StickerSheet.Body>
|
|
70
|
+
</StickerSheet>
|
|
102
71
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
72
|
+
<StickerSheet
|
|
73
|
+
isReversed={isReversed}
|
|
74
|
+
heading="Illustration type (deprecated)"
|
|
75
|
+
>
|
|
76
|
+
<StickerSheet.Body>
|
|
77
|
+
{illustrationTypes.map(illustrationType => (
|
|
78
|
+
<StickerSheet.Row
|
|
79
|
+
key={illustrationType}
|
|
80
|
+
rowTitle={illustrationType}
|
|
81
|
+
>
|
|
82
|
+
<EmptyStateWrapper
|
|
83
|
+
{...defaultProps}
|
|
84
|
+
illustrationType={illustrationType}
|
|
85
|
+
>
|
|
86
|
+
<Button
|
|
87
|
+
label="Label"
|
|
88
|
+
icon={<ChevronRightIcon role="presentation" />}
|
|
89
|
+
iconPosition="end"
|
|
90
|
+
/>
|
|
91
|
+
</EmptyStateWrapper>
|
|
92
|
+
</StickerSheet.Row>
|
|
93
|
+
))}
|
|
94
|
+
</StickerSheet.Body>
|
|
95
|
+
</StickerSheet>
|
|
96
|
+
</>
|
|
97
|
+
)
|
|
113
98
|
},
|
|
114
99
|
}
|
|
115
100
|
|
|
116
|
-
const StickerSheetTemplate: StickerSheetStory = {
|
|
117
|
-
render: ({ isReversed }) => (
|
|
118
|
-
<StickerSheet isReversed={isReversed}>
|
|
119
|
-
<StickerSheet.Body>
|
|
120
|
-
<StickerSheet.Row rowTitle="Positive">
|
|
121
|
-
<EmptyStateWrapper {...POSTIVE_PROPS} />
|
|
122
|
-
</StickerSheet.Row>
|
|
123
|
-
<StickerSheet.Row rowTitle="Informative">
|
|
124
|
-
<EmptyStateWrapper {...INFORMATIVE_PROPS} />
|
|
125
|
-
</StickerSheet.Row>
|
|
126
|
-
<StickerSheet.Row rowTitle="Action">
|
|
127
|
-
<EmptyStateWrapper {...ACTION_PROPS} />
|
|
128
|
-
</StickerSheet.Row>
|
|
129
|
-
<StickerSheet.Row rowTitle="Neutral">
|
|
130
|
-
<EmptyStateWrapper {...NEUTRAL_PROPS} />
|
|
131
|
-
</StickerSheet.Row>
|
|
132
|
-
<StickerSheet.Row rowTitle="Negative">
|
|
133
|
-
<EmptyStateWrapper {...NEGATIVE_PROPS} />
|
|
134
|
-
</StickerSheet.Row>
|
|
135
|
-
<StickerSheet.Row rowTitle="Straight Corners">
|
|
136
|
-
<EmptyStateWrapper {...STRAIGHT_CORNERS_PROPS} />
|
|
137
|
-
</StickerSheet.Row>
|
|
138
|
-
<StickerSheet.Row rowTitle="Custom heading">
|
|
139
|
-
<EmptyStateWrapper {...CUSTOM_HEADING_PROPS} />
|
|
140
|
-
</StickerSheet.Row>
|
|
141
|
-
</StickerSheet.Body>
|
|
142
|
-
</StickerSheet>
|
|
143
|
-
),
|
|
144
|
-
}
|
|
145
|
-
|
|
146
101
|
export const StickerSheetDefault: StickerSheetStory = {
|
|
147
102
|
...StickerSheetTemplate,
|
|
148
103
|
name: "Sticker Sheet (Default)",
|
|
149
104
|
}
|
|
150
105
|
|
|
151
|
-
export const StickerSheetReversed: StickerSheetStory = {
|
|
152
|
-
...StickerSheetTemplate,
|
|
153
|
-
name: "Sticker Sheet (Reversed)",
|
|
154
|
-
parameters: { backgrounds: { default: "Purple 700" } },
|
|
155
|
-
args: { isReversed: true },
|
|
156
|
-
}
|
|
157
|
-
|
|
158
106
|
export const StickerSheetRTL: StickerSheetStory = {
|
|
159
107
|
...StickerSheetTemplate,
|
|
160
108
|
name: "Sticker Sheet (RTL)",
|
|
@@ -3,7 +3,6 @@ import { Meta, StoryObj } from "@storybook/react"
|
|
|
3
3
|
import { ChevronRightIcon } from "~components/Icon"
|
|
4
4
|
import { Button } from "~components/__actions__/v2"
|
|
5
5
|
import { EmptyState } from "../index"
|
|
6
|
-
import styles from "./EmptyState.stories.module.scss"
|
|
7
6
|
|
|
8
7
|
const meta = {
|
|
9
8
|
title: "Components/EmptyState",
|
|
@@ -16,16 +15,15 @@ const meta = {
|
|
|
16
15
|
mapping: {
|
|
17
16
|
"Default (no children)": undefined,
|
|
18
17
|
"Button (chevron right)": (
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/>
|
|
25
|
-
</div>
|
|
18
|
+
<Button
|
|
19
|
+
label="Label"
|
|
20
|
+
icon={<ChevronRightIcon role="presentation" />}
|
|
21
|
+
iconPosition="end"
|
|
22
|
+
/>
|
|
26
23
|
),
|
|
27
24
|
},
|
|
28
25
|
},
|
|
26
|
+
illustrationType: { control: false },
|
|
29
27
|
},
|
|
30
28
|
args: {
|
|
31
29
|
headingProps: {
|