@kaizen/components 1.42.5 → 1.42.6

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.
@@ -0,0 +1,328 @@
1
+ import React from "react"
2
+ import { Meta, StoryObj } from "@storybook/react"
3
+ import { fn } from "@storybook/test"
4
+ import { Avatar } from "~components/Avatar"
5
+ import {
6
+ CautionIcon,
7
+ ExclamationIcon,
8
+ InformationIcon,
9
+ SuccessIcon,
10
+ LiveIcon,
11
+ } from "~components/Icon"
12
+ import styles from "~components/Tag/Tag.module.scss"
13
+ import { Tag, RemovableTag } from "../.."
14
+
15
+ const meta = {
16
+ title: "Components/Tag/Future Tag Migration Guide",
17
+ component: Tag,
18
+ args: {
19
+ children: "My tag",
20
+ },
21
+ parameters: {
22
+ docs: {
23
+ source: {
24
+ type: "dynamic",
25
+ },
26
+ },
27
+ },
28
+ } satisfies Meta<typeof Tag>
29
+
30
+ export default meta
31
+
32
+ /** * This is a stand-in component for the legacy Tag's bake in LiveIcon - we should consider adding this as an actual component or replacing it */
33
+ const LiveIconComponent = (): JSX.Element => (
34
+ <span className={styles.liveIcon}>
35
+ <LiveIcon
36
+ role="presentation"
37
+ classNameOverride={styles.liveIcon_base}
38
+ width="16"
39
+ height="16"
40
+ viewBox="0 0 16 16"
41
+ fill="none"
42
+ />
43
+ <LiveIcon
44
+ role="presentation"
45
+ classNameOverride={styles.liveIcon_1}
46
+ width="16"
47
+ height="16"
48
+ viewBox="0 0 16 16"
49
+ fill="none"
50
+ />
51
+ <LiveIcon
52
+ role="presentation"
53
+ classNameOverride={styles.liveIcon_2}
54
+ width="16"
55
+ height="16"
56
+ viewBox="0 0 16 16"
57
+ fill="none"
58
+ />
59
+ <LiveIcon
60
+ role="presentation"
61
+ classNameOverride={styles.liveIcon_3}
62
+ width="16"
63
+ height="16"
64
+ viewBox="0 0 16 16"
65
+ fill="none"
66
+ />
67
+ </span>
68
+ )
69
+
70
+ export const LiveIconComponentStory: StoryObj = {
71
+ render: () => <LiveIconComponent />,
72
+ parameters: {
73
+ docs: {
74
+ source: {
75
+ type: "dynamic",
76
+ code: `
77
+ // component with styled with CSS modules
78
+ const LiveIconComponent = (): JSX.Element => (
79
+ <span className={styles.liveIcon}>
80
+ <LiveIcon
81
+ role="presentation"
82
+ classNameOverride={styles.liveIcon_base}
83
+ width="16"
84
+ height="16"
85
+ viewBox="0 0 16 16"
86
+ fill="none"
87
+ />
88
+ <LiveIcon
89
+ role="presentation"
90
+ classNameOverride={styles.liveIcon_1}
91
+ width="16"
92
+ height="16"
93
+ viewBox="0 0 16 16"
94
+ fill="none"
95
+ />
96
+ <LiveIcon
97
+ role="presentation"
98
+ classNameOverride={styles.liveIcon_2}
99
+ width="16"
100
+ height="16"
101
+ viewBox="0 0 16 16"
102
+ fill="none"
103
+ />
104
+ <LiveIcon
105
+ role="presentation"
106
+ classNameOverride={styles.liveIcon_3}
107
+ width="16"
108
+ height="16"
109
+ viewBox="0 0 16 16"
110
+ fill="none"
111
+ />
112
+ </span>
113
+ )
114
+
115
+ // Minified SCSS from the stylesheet
116
+ <style>
117
+ .liveIcon_2,.liveIcon_3{animation-duration:3s;animation-iteration-count:3;animation-delay:1s}.liveIcon{display:inline-block;position:relative;width:20px;height:20px;color:$color-green-500}.liveIcon_1,.liveIcon_2,.liveIcon_3{display:block;position:absolute;top:0;left:$0;width:100%;height:100%;overflow:hidden}.liveIcon_base{opacity:30%;display:block}.liveIcon_1{clip-path:circle(16%)}.liveIcon_2{clip-path:circle(32%);animation-name:pulse-inner}.liveIcon_3{clip-path:circle(50%);animation-name:pulse-outer}@keyframes pulse-inner{0%,25%{opacity:0%}100%,50%,75%{opacity:100%}}@keyframes pulse-outer{0%,25%,50%{opacity:0%}100%,75%{opacity:100%}}
118
+ </style>
119
+ `,
120
+ },
121
+ },
122
+ },
123
+ }
124
+
125
+ export const StatusMigration: StoryObj = {
126
+ render: () => (
127
+ <>
128
+ <Tag classNameOverride="gap-4" color="green">
129
+ <span>Tag</span>
130
+ <LiveIconComponent />
131
+ </Tag>
132
+ <Tag color="blue">Tag</Tag>
133
+ <Tag color="red">Tag</Tag>
134
+ <Tag color="orange">Tag</Tag>
135
+ </>
136
+ ),
137
+ decorators: [
138
+ Story => (
139
+ <div className="flex gap-12">
140
+ <Story />
141
+ </div>
142
+ ),
143
+ ],
144
+ }
145
+
146
+ export const ValidationMigration: StoryObj = {
147
+ render: () => (
148
+ <>
149
+ <Tag
150
+ color="green"
151
+ icon={<SuccessIcon role="img" aria-label="Success," />}
152
+ >
153
+ Tag
154
+ </Tag>
155
+ <Tag
156
+ color="blue"
157
+ icon={<InformationIcon role="img" aria-label="Note," />}
158
+ >
159
+ Tag
160
+ </Tag>
161
+ <Tag
162
+ color="red"
163
+ icon={<ExclamationIcon role="img" aria-label="Error," />}
164
+ >
165
+ Tag
166
+ </Tag>
167
+ <Tag
168
+ color="yellow"
169
+ icon={<CautionIcon role="img" aria-label="Warning," />}
170
+ >
171
+ Tag
172
+ </Tag>
173
+ </>
174
+ ),
175
+ decorators: [
176
+ Story => (
177
+ <div className="flex gap-12">
178
+ <Story />
179
+ </div>
180
+ ),
181
+ ],
182
+ }
183
+
184
+ export const SentimentsMigration: StoryObj = {
185
+ render: () => (
186
+ <>
187
+ <Tag color="green">Tag</Tag>
188
+ <Tag color="gray">Tag</Tag>
189
+ <Tag color="red">Tag</Tag>
190
+ <Tag color="blue">Tag</Tag>
191
+ <Tag color="yellow">Tag</Tag>
192
+ <Tag color="orange">Tag</Tag>
193
+ </>
194
+ ),
195
+ decorators: [
196
+ Story => (
197
+ <div className="flex gap-12">
198
+ <Story />
199
+ </div>
200
+ ),
201
+ ],
202
+ }
203
+
204
+ export const SentimentNone: StoryObj = {
205
+ render: () => (
206
+ <Tag
207
+ color="gray"
208
+ classNameOverride="bg-white border-default-color border-solid border"
209
+ >
210
+ Tag
211
+ </Tag>
212
+ ),
213
+ }
214
+
215
+ export const DismissibleMigration: StoryObj = {
216
+ render: () => (
217
+ <RemovableTag
218
+ removeButtonProps={{
219
+ ariaLabel: "Remove this tag",
220
+ onClick: fn(),
221
+ }}
222
+ >
223
+ Tag
224
+ </RemovableTag>
225
+ ),
226
+ }
227
+
228
+ export const AvatarMigration: StoryObj = {
229
+ render: () => (
230
+ <>
231
+ <Tag classNameOverride="ps-4">
232
+ <span className="flex gap-6 items-center">
233
+ <Avatar size="small" />
234
+ Tag
235
+ </span>
236
+ </Tag>
237
+ <Tag classNameOverride="ps-4">
238
+ <span className="flex gap-6 items-center">
239
+ <Avatar size="small" fullName="Reed Richards" />
240
+ Reed Richards
241
+ </span>
242
+ </Tag>
243
+ <Tag classNameOverride="ps-4">
244
+ <span className="flex gap-6 items-center">
245
+ <Avatar
246
+ size="small"
247
+ fullName="Sue Storm"
248
+ avatarSrc="https://www.cultureampcom-preview-1.usw2.wp-dev-us.cultureamp-cdn.com/assets/slices/main/assets/public/media/chapters-card-1@2x.05e547444387f29f14df0b82634bf2b6.png"
249
+ />
250
+ Susan Storm
251
+ </span>
252
+ </Tag>
253
+ </>
254
+ ),
255
+ decorators: [
256
+ Story => (
257
+ <div className="flex gap-12">
258
+ <Story />
259
+ </div>
260
+ ),
261
+ ],
262
+ }
263
+
264
+ export const AvatarRemovableMigration: StoryObj = {
265
+ render: () => (
266
+ <>
267
+ <RemovableTag
268
+ removeButtonProps={{
269
+ ariaLabel: "Remove user from *this context*",
270
+ onClick: fn(),
271
+ }}
272
+ classNameOverride="ps-4"
273
+ >
274
+ <span className="flex gap-6 items-center">
275
+ <Avatar size="small" />
276
+ Tag
277
+ </span>
278
+ </RemovableTag>
279
+ <RemovableTag
280
+ removeButtonProps={{
281
+ ariaLabel: "Remove Reed Richards from *this context*",
282
+ onClick: fn(),
283
+ }}
284
+ classNameOverride="ps-4"
285
+ >
286
+ <span className="flex gap-6 items-center">
287
+ <Avatar size="small" fullName="Reed Richards" />
288
+ Tag
289
+ </span>
290
+ </RemovableTag>
291
+ <RemovableTag
292
+ removeButtonProps={{
293
+ ariaLabel: "Remove Sue Storm from *this context*",
294
+ onClick: fn(),
295
+ }}
296
+ classNameOverride="ps-4"
297
+ >
298
+ <span className="flex gap-6 items-center">
299
+ <Avatar
300
+ size="small"
301
+ fullName="Sue Storm"
302
+ avatarSrc="https://www.cultureampcom-preview-1.usw2.wp-dev-us.cultureamp-cdn.com/assets/slices/main/assets/public/media/chapters-card-1@2x.05e547444387f29f14df0b82634bf2b6.png"
303
+ />
304
+ Tag
305
+ </span>
306
+ </RemovableTag>
307
+ </>
308
+ ),
309
+ decorators: [
310
+ Story => (
311
+ <div className="flex gap-12">
312
+ <Story />
313
+ </div>
314
+ ),
315
+ ],
316
+ }
317
+
318
+ export const InlineMigration: StoryObj = {
319
+ render: () => (
320
+ <div className="flex gap-12">
321
+ <Tag>Tag</Tag>
322
+ <Tag>Tag</Tag>
323
+ <Tag>Tag</Tag>
324
+ </div>
325
+ ),
326
+ }
327
+
328
+ export const SizesMigration: StoryObj = {}
@@ -36,7 +36,7 @@ Takes a `ReactNode`. This should be the text that is displayed inside the Tag.
36
36
 
37
37
  ### `color`
38
38
 
39
- Determines the color of the background, text, and icon.
39
+ Determines the color of the background, text, and icon. This can be used to convey status and give meaning to the `Tag`. Find more guidance on color usage [here](https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3064857902/Color).
40
40
 
41
41
  <Canvas of={TagStories.Color} />
42
42
 
@@ -52,3 +52,12 @@ in LTR, and on the right of `children` in RTL. For a list of icons, see [Icons](
52
52
  Allows classnames to be attached to the outermost element of Tag.
53
53
 
54
54
  <Canvas of={TagStories.ClassNameOverride} />
55
+
56
+ #### variant
57
+
58
+ `variant` has been dropped as a catch all way to supply context and mean to `Tag`. Instead, `color` and `icon` should be used to capture sentiment, validation and status.
59
+
60
+ ### Migrating to future Tag
61
+
62
+ See our [full guide](?path=/docs/components-tag-future-tag-migration-guide--docs) here to migrate to the future release of `Tag`.
63
+