@kaizen/components 1.67.21 → 1.67.22

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.
@@ -10,7 +10,7 @@ import {
10
10
  } from "~components/Illustration"
11
11
  import { Text } from "~components/Text"
12
12
  import { OverrideClassName } from "~components/types/OverrideClassName"
13
- import styles from "./EmptyState.module.scss"
13
+ import styles from "./EmptyState.module.css"
14
14
 
15
15
  const ILLUSTRATIONS: Record<
16
16
  string,
@@ -50,6 +50,7 @@ export type EmptyStateProps = {
50
50
  * @default informative
51
51
  */
52
52
  variant?: "success" | "warning" | "informative" | "expert-advice"
53
+ /** @deprecated - This prop no longer has any effect */
53
54
  layoutContext?: "sidebarAndContent" | "contentOnly"
54
55
  bodyText: string | React.ReactNode
55
56
  straightCorners?: boolean
@@ -66,7 +67,7 @@ export const EmptyState = ({
66
67
  id,
67
68
  illustrationType,
68
69
  variant = "informative",
69
- layoutContext = "sidebarAndContent",
70
+ layoutContext: _,
70
71
  headingProps,
71
72
  bodyText,
72
73
  straightCorners,
@@ -82,33 +83,30 @@ export const EmptyState = ({
82
83
  className={classnames(
83
84
  styles.container,
84
85
  illustrationType ? styles[illustrationType] : styles[variant],
85
- styles[layoutContext],
86
86
  straightCorners && styles.straightCorners,
87
87
  classNameOverride
88
88
  )}
89
89
  id={id}
90
90
  {...props}
91
91
  >
92
- <div className={styles.illustrationSide}>
93
- {isAnimated ? (
94
- <IllustrationComponent
95
- isAnimated
96
- loop={loop}
97
- classNameOverride={styles.illustration}
98
- />
99
- ) : (
100
- <IllustrationComponent classNameOverride={styles.illustration} />
101
- )}
102
- </div>
103
- <div className={styles.textSide}>
104
- <div className={styles.textSideInner}>
92
+ <div className={styles.content}>
93
+ <div className={styles.illustrationContainer}>
94
+ {isAnimated ? (
95
+ <IllustrationComponent
96
+ isAnimated
97
+ loop={loop}
98
+ classNameOverride={styles.illustration}
99
+ />
100
+ ) : (
101
+ <IllustrationComponent classNameOverride={styles.illustration} />
102
+ )}
103
+ </div>
104
+ <div className={styles.textContainer}>
105
105
  {headingProps && (
106
106
  <Heading classNameOverride={styles.heading} {...headingProps} />
107
107
  )}
108
- <Text variant="body" classNameOverride={styles.description}>
109
- {bodyText}
110
- </Text>
111
- {children}
108
+ <Text variant="body">{bodyText}</Text>
109
+ {children && <span>{children}</span>}
112
110
  </div>
113
111
  </div>
114
112
  </div>
@@ -6,7 +6,7 @@ import { Icon } from "~components/__future__/Icon"
6
6
  import {
7
7
  StickerSheet,
8
8
  StickerSheetStory,
9
- } from "~storybook/components/StickerSheet"
9
+ } from "~storybook/components/_future/StickerSheet"
10
10
  import { EmptyState, EmptyStateProps } from "../index"
11
11
 
12
12
  export default {
@@ -23,7 +23,9 @@ const EmptyStateWrapper = ({
23
23
  isAnimated,
24
24
  ...args
25
25
  }: EmptyStateProps): JSX.Element => (
26
- <EmptyState isAnimated={IS_CHROMATIC ? false : isAnimated} {...args} />
26
+ <div>
27
+ <EmptyState isAnimated={IS_CHROMATIC ? false : isAnimated} {...args} />
28
+ </div>
27
29
  )
28
30
 
29
31
  const StickerSheetTemplate: StickerSheetStory = {
@@ -54,50 +56,64 @@ const StickerSheetTemplate: StickerSheetStory = {
54
56
 
55
57
  return (
56
58
  <>
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 />
59
+ <StickerSheet isReversed={isReversed} title="EmptyState">
60
+ {variants.map(variant => (
61
+ <StickerSheet.Row key={variant} header={variant}>
62
+ <EmptyStateWrapper {...defaultProps} variant={variant} />
68
63
  </StickerSheet.Row>
69
- </StickerSheet.Body>
64
+ ))}
65
+ <StickerSheet.Row header="straightCorners">
66
+ <EmptyStateWrapper {...defaultProps} straightCorners />
67
+ </StickerSheet.Row>
68
+ </StickerSheet>
69
+
70
+ <StickerSheet isReversed={isReversed} title="Responsive breakpoints">
71
+ <StickerSheet.Row header="Above 1024px">
72
+ <StickerSheet.Cell style={{ width: 1025 }}>
73
+ <EmptyStateWrapper {...defaultProps} />
74
+ </StickerSheet.Cell>
75
+ </StickerSheet.Row>
76
+ <StickerSheet.Row header="Above 560px and below or equal to 1024px (max)">
77
+ <StickerSheet.Cell style={{ width: 1024 }}>
78
+ <EmptyStateWrapper {...defaultProps} />
79
+ </StickerSheet.Cell>
80
+ </StickerSheet.Row>
81
+ <StickerSheet.Row header="Above 560px and below or equal to 1024px (min)">
82
+ <StickerSheet.Cell style={{ width: 561 }}>
83
+ <EmptyStateWrapper {...defaultProps} />
84
+ </StickerSheet.Cell>
85
+ </StickerSheet.Row>
86
+ <StickerSheet.Row header="Below or equal to 560px">
87
+ <StickerSheet.Cell style={{ width: 560 }}>
88
+ <EmptyStateWrapper {...defaultProps} />
89
+ </StickerSheet.Cell>
90
+ </StickerSheet.Row>
70
91
  </StickerSheet>
71
92
 
72
93
  <StickerSheet
73
94
  isReversed={isReversed}
74
- heading="Illustration type (deprecated)"
95
+ title="Illustration type (deprecated)"
75
96
  >
76
- <StickerSheet.Body>
77
- {illustrationTypes.map(illustrationType => (
78
- <StickerSheet.Row
79
- key={illustrationType}
80
- rowTitle={illustrationType}
97
+ {illustrationTypes.map(illustrationType => (
98
+ <StickerSheet.Row key={illustrationType} header={illustrationType}>
99
+ <EmptyStateWrapper
100
+ {...defaultProps}
101
+ illustrationType={illustrationType}
81
102
  >
82
- <EmptyStateWrapper
83
- {...defaultProps}
84
- illustrationType={illustrationType}
85
- >
86
- <Button
87
- label="Label"
88
- icon={
89
- <Icon
90
- name="chevron_right"
91
- isPresentational
92
- shouldMirrorInRTL
93
- />
94
- }
95
- iconPosition="end"
96
- />
97
- </EmptyStateWrapper>
98
- </StickerSheet.Row>
99
- ))}
100
- </StickerSheet.Body>
103
+ <Button
104
+ label="Label"
105
+ icon={
106
+ <Icon
107
+ name="chevron_right"
108
+ isPresentational
109
+ shouldMirrorInRTL
110
+ />
111
+ }
112
+ iconPosition="end"
113
+ />
114
+ </EmptyStateWrapper>
115
+ </StickerSheet.Row>
116
+ ))}
101
117
  </StickerSheet>
102
118
  </>
103
119
  )
@@ -1,23 +0,0 @@
1
- 'use strict';
2
-
3
- var styles = {
4
- "container": "EmptyState-module_container__-B5OU",
5
- "straightCorners": "EmptyState-module_straightCorners__Aeou0",
6
- "sidebarAndContent": "EmptyState-module_sidebarAndContent__Eysay",
7
- "contentOnly": "EmptyState-module_contentOnly__RWVVX",
8
- "positive": "EmptyState-module_positive__o3dXR",
9
- "negative": "EmptyState-module_negative__e5ci6",
10
- "action": "EmptyState-module_action__OdsgJ",
11
- "neutral": "EmptyState-module_neutral__L6fBb",
12
- "success": "EmptyState-module_success__y7jKP",
13
- "warning": "EmptyState-module_warning__-PrRp",
14
- "informative": "EmptyState-module_informative__x0GSr",
15
- "expert-advice": "EmptyState-module_expert-advice__VVB8i",
16
- "illustrationSide": "EmptyState-module_illustrationSide__ZSjF3",
17
- "textSide": "EmptyState-module_textSide__tv54w",
18
- "illustration": "EmptyState-module_illustration__HyD2k",
19
- "textSideInner": "EmptyState-module_textSideInner__Yynhi",
20
- "heading": "EmptyState-module_heading__y-yvC",
21
- "description": "EmptyState-module_description__fsJOc"
22
- };
23
- module.exports = styles;
@@ -1,21 +0,0 @@
1
- var styles = {
2
- "container": "EmptyState-module_container__-B5OU",
3
- "straightCorners": "EmptyState-module_straightCorners__Aeou0",
4
- "sidebarAndContent": "EmptyState-module_sidebarAndContent__Eysay",
5
- "contentOnly": "EmptyState-module_contentOnly__RWVVX",
6
- "positive": "EmptyState-module_positive__o3dXR",
7
- "negative": "EmptyState-module_negative__e5ci6",
8
- "action": "EmptyState-module_action__OdsgJ",
9
- "neutral": "EmptyState-module_neutral__L6fBb",
10
- "success": "EmptyState-module_success__y7jKP",
11
- "warning": "EmptyState-module_warning__-PrRp",
12
- "informative": "EmptyState-module_informative__x0GSr",
13
- "expert-advice": "EmptyState-module_expert-advice__VVB8i",
14
- "illustrationSide": "EmptyState-module_illustrationSide__ZSjF3",
15
- "textSide": "EmptyState-module_textSide__tv54w",
16
- "illustration": "EmptyState-module_illustration__HyD2k",
17
- "textSideInner": "EmptyState-module_textSideInner__Yynhi",
18
- "heading": "EmptyState-module_heading__y-yvC",
19
- "description": "EmptyState-module_description__fsJOc"
20
- };
21
- export { styles as default };
@@ -1,186 +0,0 @@
1
- @import "~@kaizen/design-tokens/sass/spacing";
2
- @import "~@kaizen/design-tokens/sass/color";
3
- @import "~@kaizen/design-tokens/sass/border";
4
- @import "./mixins";
5
-
6
- .container {
7
- --empty-state-border-width: var(--border-width-1);
8
-
9
- display: flex;
10
- width: 100%;
11
- box-sizing: border-box;
12
- justify-content: space-around;
13
- padding: calc(2% - var(--empty-state-border-width))
14
- calc(var(--spacing-24) - var(--empty-state-border-width));
15
- color: $color-purple-800;
16
- border: var(--empty-state-border-width) solid var(--empty-state-border-color);
17
- border-radius: var(--border-solid-border-radius);
18
- background-color: var(--empty-state-background-color);
19
- flex-wrap: wrap;
20
-
21
- @include small {
22
- flex-direction: column;
23
- align-items: center;
24
- padding: calc(var(--spacing-24) - var(--empty-state-border-width));
25
- }
26
-
27
- &.straightCorners {
28
- border-radius: 0;
29
- }
30
-
31
- // These class names must match the possible values of the component's layoutContext prop
32
- &.sidebarAndContent {
33
- @include large-sidebar-and-content {
34
- padding-top: $spacing-md;
35
- padding-bottom: $spacing-md;
36
- }
37
- }
38
-
39
- &.contentOnly {
40
- @include large-content-only {
41
- padding-top: $spacing-md;
42
- padding-bottom: $spacing-md;
43
- }
44
- }
45
- }
46
-
47
- /** @deprecated */
48
- .positive {
49
- --empty-state-border-color: var(--color-green-500);
50
- --empty-state-background-color: var(--color-green-100);
51
- }
52
-
53
- .negative,
54
- .action {
55
- --empty-state-border-color: var(--color-red-500);
56
- --empty-state-background-color: var(--color-red-100);
57
- }
58
-
59
- .neutral {
60
- --empty-state-border-color: var(--color-purple-400);
61
- --empty-state-background-color: var(--color-purple-100);
62
- }
63
-
64
- /** end @deprecated */
65
- .success {
66
- --empty-state-border-color: var(--color-green-500);
67
- --empty-state-background-color: var(--color-green-100);
68
- }
69
-
70
- .warning {
71
- --empty-state-border-color: var(--color-red-500);
72
- --empty-state-background-color: var(--color-red-100);
73
- }
74
-
75
- .informative {
76
- --empty-state-border-color: var(--color-blue-400);
77
- --empty-state-background-color: var(--color-blue-100);
78
- }
79
-
80
- .expert-advice {
81
- --empty-state-border-color: var(--color-purple-400);
82
- --empty-state-background-color: var(--color-purple-100);
83
- }
84
-
85
- .illustrationSide,
86
- .textSide {
87
- display: flex;
88
- box-sizing: border-box;
89
- }
90
-
91
- .illustrationSide {
92
- justify-content: center;
93
- align-items: center;
94
- flex: 0 1 auto;
95
- min-width: 0;
96
- max-width: 100%;
97
- margin-bottom: $spacing-md;
98
-
99
- @include small {
100
- width: 100%;
101
- max-width: 224px;
102
- }
103
-
104
- @include medium {
105
- flex-direction: column;
106
- justify-content: center;
107
- align-items: flex-end;
108
- margin-bottom: 0;
109
- width: auto;
110
- max-width: 40%;
111
- padding-inline-end: $spacing-md;
112
- }
113
-
114
- .sidebarAndContent & {
115
- @include large-sidebar-and-content {
116
- flex-shrink: 1;
117
- flex-basis: auto;
118
- }
119
- }
120
-
121
- .contentOnly & {
122
- @include large-content-only {
123
- flex-shrink: 1;
124
- flex-basis: auto;
125
- }
126
- }
127
- }
128
-
129
- .illustration,
130
- .illustrationSide video {
131
- max-width: 100%;
132
- max-height: 366px;
133
- width: auto;
134
- height: auto;
135
-
136
- // Fixes for IE11 Flexbox issues
137
- min-height: 196px;
138
-
139
- @include small {
140
- max-height: 196px;
141
- width: 100%;
142
- }
143
- }
144
-
145
- .textSide {
146
- flex: 1 1 auto;
147
- min-width: 0;
148
- max-width: 100%;
149
- align-items: center;
150
- -webkit-font-smoothing: antialiased;
151
-
152
- @include medium {
153
- flex: 0 1 50%;
154
- }
155
- }
156
-
157
- .textSideInner {
158
- width: 100%;
159
- max-width: 100%;
160
- box-sizing: border-box;
161
- margin: 0 $spacing-sm;
162
- word-wrap: break-word;
163
- overflow-wrap: break-word;
164
-
165
- @include small {
166
- margin-bottom: 0;
167
- }
168
-
169
- @include medium {
170
- max-width: 426px;
171
- }
172
- }
173
-
174
- .heading {
175
- margin-bottom: $spacing-md;
176
- max-width: 100%;
177
-
178
- @media (max-width: (375px)) {
179
- @include typography-heading-3-sm;
180
- }
181
- }
182
-
183
- .description {
184
- margin-bottom: $spacing-md;
185
- max-width: 100%;
186
- }
@@ -1,48 +0,0 @@
1
- import React from "react"
2
- import { cleanup, render } from "@testing-library/react"
3
- import { EmptyState, EmptyStateProps } from "./EmptyState"
4
-
5
- vi.mock("~components/Illustration", () => ({
6
- EmptyStatesPositive: (): JSX.Element => (
7
- <div>EmptyStatesPositive_Component</div>
8
- ),
9
- EmptyStatesNeutral: (): JSX.Element => (
10
- <div>EmptyStatesNeutral_Component</div>
11
- ),
12
- EmptyStatesNegative: (): JSX.Element => (
13
- <div>EmptyStatesNegative_Component</div>
14
- ),
15
- EmptyStatesInformative: (): JSX.Element => (
16
- <div>EmptyStatesInformative_Component</div>
17
- ),
18
- EmptyStatesAction: (): JSX.Element => <div>EmptyStatesAction_Component</div>,
19
- }))
20
-
21
- describe("<EmptyState />", () => {
22
- afterEach(cleanup)
23
-
24
- const defaultProps: EmptyStateProps = {
25
- id: "someId",
26
- headingProps: {
27
- children: "Some heading",
28
- variant: "heading-1",
29
- },
30
- bodyText: "Lorem ipsum dolor...",
31
- }
32
-
33
- it("renders an `id` attribute", () => {
34
- const { container } = render(<EmptyState {...defaultProps} />)
35
-
36
- expect(container.querySelector("#someId")).toBeTruthy()
37
- })
38
-
39
- it("renders given children", () => {
40
- const { getByText } = render(
41
- <EmptyState {...defaultProps}>
42
- <h1>Child Heading</h1>
43
- </EmptyState>
44
- )
45
-
46
- expect(getByText("Child Heading")).toBeTruthy()
47
- })
48
- })
@@ -1,44 +0,0 @@
1
- @import "~@kaizen/design-tokens/sass/layout";
2
-
3
- $small: 300px;
4
- $medium: $layout-breakpoints-medium;
5
- $large: $layout-breakpoints-large;
6
-
7
- // comes from ca-layout-padding x2 which is no longer used
8
- $side-padding: 48px;
9
- $sidebarWidth: 240px;
10
- $sidebarWithPadding: $sidebarWidth + $side-padding;
11
-
12
- $typography-heading-3-font-size-small: 1.25rem;
13
- $typography-heading-3-font-weight-small: 700;
14
- $typography-heading-3-line-height-small: 1.5rem;
15
-
16
- @mixin large-sidebar-and-content {
17
- @media (min-width: ($large + $sidebarWithPadding + $side-padding)) {
18
- @content;
19
- }
20
- }
21
-
22
- @mixin large-content-only {
23
- @media (min-width: ($large + $side-padding)) {
24
- @content;
25
- }
26
- }
27
-
28
- @mixin medium {
29
- @media (min-width: ($medium + $side-padding)) {
30
- @content;
31
- }
32
- }
33
-
34
- @mixin small {
35
- @media (max-width: ($medium + $side-padding - 1px)) {
36
- @content;
37
- }
38
- }
39
-
40
- @mixin typography-heading-3-sm {
41
- font-size: $typography-heading-3-font-size-small;
42
- line-height: $typography-heading-3-line-height-small;
43
- font-weight: $typography-heading-3-font-weight-small;
44
- }