@kaizen/components 1.42.7 → 1.43.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/dist/cjs/LikertScaleLegacy/LikertScaleLegacy.cjs +6 -4
- package/dist/cjs/LikertScaleLegacy/LikertScaleLegacy.module.scss.cjs +2 -0
- package/dist/cjs/index.css +3 -3
- package/dist/esm/LikertScaleLegacy/LikertScaleLegacy.mjs +6 -4
- package/dist/esm/LikertScaleLegacy/LikertScaleLegacy.module.scss.mjs +2 -0
- package/dist/esm/index.css +3 -3
- package/dist/styles.css +1 -1
- package/dist/types/LikertScaleLegacy/LikertScaleLegacy.d.ts +3 -2
- package/dist/types/LikertScaleLegacy/types.d.ts +1 -0
- package/package.json +3 -3
- package/src/LikertScaleLegacy/LikertScaleLegacy.module.scss +66 -17
- package/src/LikertScaleLegacy/LikertScaleLegacy.tsx +6 -1
- package/src/LikertScaleLegacy/_docs/LikertScaleLegacy.stickersheet.stories.tsx +26 -4
- package/src/LikertScaleLegacy/types.ts +2 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Scale, ScaleItem } from "./types";
|
|
2
|
+
import { Scale, ScaleItem, ColorSchema } from "./types";
|
|
3
3
|
export type LikertScaleProps = {
|
|
4
4
|
labelId: string;
|
|
5
5
|
scale: Scale;
|
|
@@ -10,6 +10,7 @@ export type LikertScaleProps = {
|
|
|
10
10
|
automationId?: string;
|
|
11
11
|
"data-testid"?: string;
|
|
12
12
|
reversed?: boolean;
|
|
13
|
+
colorSchema?: ColorSchema | "classical";
|
|
13
14
|
validationMessage?: string;
|
|
14
15
|
status?: "default" | "error";
|
|
15
16
|
onSelect: (value: ScaleItem | null) => void;
|
|
@@ -18,4 +19,4 @@ export type LikertScaleProps = {
|
|
|
18
19
|
* {@link https://cultureamp.atlassian.net/wiki/spaces/DesignSystem/pages/3082060201/Likert+Scale Guidance} |
|
|
19
20
|
* {@link https://cultureamp.design/?path=/docs/components-likertscalelegacy--docs Storybook}
|
|
20
21
|
*/
|
|
21
|
-
export declare const LikertScaleLegacy: ({ scale, selectedItem, reversed, "data-testid": dataTestId, onSelect, validationMessage, status, labelId, }: LikertScaleProps) => JSX.Element;
|
|
22
|
+
export declare const LikertScaleLegacy: ({ scale, selectedItem, reversed, colorSchema, "data-testid": dataTestId, onSelect, validationMessage, status, labelId, }: LikertScaleProps) => JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaizen/components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.43.0",
|
|
4
4
|
"description": "Kaizen component library",
|
|
5
5
|
"author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
|
|
6
6
|
"homepage": "https://cultureamp.design",
|
|
@@ -108,8 +108,8 @@
|
|
|
108
108
|
"ts-node": "^10.9.2",
|
|
109
109
|
"ts-patch": "^3.1.2",
|
|
110
110
|
"typescript-transform-paths": "^3.4.7",
|
|
111
|
-
"@kaizen/
|
|
112
|
-
"@kaizen/
|
|
111
|
+
"@kaizen/tailwind": "1.2.6",
|
|
112
|
+
"@kaizen/design-tokens": "10.3.20"
|
|
113
113
|
},
|
|
114
114
|
"peerDependencies": {
|
|
115
115
|
"@cultureamp/i18n-react-intl": "^2.5.5",
|
|
@@ -23,11 +23,17 @@ $block-height: 35px;
|
|
|
23
23
|
$desktop-rater-width: 220px;
|
|
24
24
|
$desktop-rater-height: 63px;
|
|
25
25
|
|
|
26
|
-
$first: $color-yellow-300;
|
|
27
|
-
$second: $color-yellow-400;
|
|
28
|
-
$third: $color-orange-400;
|
|
29
|
-
$fourth: $color-orange-500;
|
|
30
|
-
$fifth: $color-red-500;
|
|
26
|
+
$classical-first: $color-yellow-300;
|
|
27
|
+
$classical-second: $color-yellow-400;
|
|
28
|
+
$classical-third: $color-orange-400;
|
|
29
|
+
$classical-fourth: $color-orange-500;
|
|
30
|
+
$classical-fifth: $color-red-500;
|
|
31
|
+
|
|
32
|
+
$blue-first: $color-blue-100;
|
|
33
|
+
$blue-second: $color-blue-200;
|
|
34
|
+
$blue-third: $color-blue-300;
|
|
35
|
+
$blue-fourth: $color-blue-400;
|
|
36
|
+
$blue-fifth: $color-blue-500;
|
|
31
37
|
|
|
32
38
|
@mixin pop {
|
|
33
39
|
-webkit-animation: pop cubic-bezier(0, 0.94, 0.32, 1) 0.7s 1;
|
|
@@ -212,45 +218,88 @@ $fifth: $color-red-500;
|
|
|
212
218
|
left: 100%;
|
|
213
219
|
}
|
|
214
220
|
|
|
215
|
-
&.suggested,
|
|
216
|
-
&.selected {
|
|
221
|
+
&.suggested.classicalColorSchema,
|
|
222
|
+
&.selected.classicalColorSchema {
|
|
217
223
|
.field1 {
|
|
218
|
-
background-color: $first;
|
|
224
|
+
background-color: $classical-first;
|
|
219
225
|
|
|
220
226
|
&::after {
|
|
221
|
-
background-color: $first;
|
|
227
|
+
background-color: $classical-first;
|
|
222
228
|
}
|
|
223
229
|
}
|
|
224
230
|
|
|
225
231
|
.field2 {
|
|
226
|
-
background-color: $second;
|
|
232
|
+
background-color: $classical-second;
|
|
227
233
|
|
|
228
234
|
&::after {
|
|
229
|
-
background-color: $second;
|
|
235
|
+
background-color: $classical-second;
|
|
230
236
|
}
|
|
231
237
|
}
|
|
232
238
|
|
|
233
239
|
.field3 {
|
|
234
|
-
background-color: $third;
|
|
240
|
+
background-color: $classical-third;
|
|
235
241
|
|
|
236
242
|
&::after {
|
|
237
|
-
background-color: $third;
|
|
243
|
+
background-color: $classical-third;
|
|
238
244
|
}
|
|
239
245
|
}
|
|
240
246
|
|
|
241
247
|
.field4 {
|
|
242
|
-
background-color: $fourth;
|
|
248
|
+
background-color: $classical-fourth;
|
|
243
249
|
|
|
244
250
|
&::after {
|
|
245
|
-
background-color: $fourth;
|
|
251
|
+
background-color: $classical-fourth;
|
|
246
252
|
}
|
|
247
253
|
}
|
|
248
254
|
|
|
249
255
|
.field5 {
|
|
250
|
-
background-color: $fifth;
|
|
256
|
+
background-color: $classical-fifth;
|
|
251
257
|
|
|
252
258
|
&::after {
|
|
253
|
-
background-color: $fifth;
|
|
259
|
+
background-color: $classical-fifth;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
&.suggested.blueColorSchema,
|
|
265
|
+
&.selected.blueColorSchema {
|
|
266
|
+
.field1 {
|
|
267
|
+
background-color: $blue-first;
|
|
268
|
+
|
|
269
|
+
&::after {
|
|
270
|
+
background-color: $blue-first;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.field2 {
|
|
275
|
+
background-color: $blue-second;
|
|
276
|
+
|
|
277
|
+
&::after {
|
|
278
|
+
background-color: $blue-second;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.field3 {
|
|
283
|
+
background-color: $blue-third;
|
|
284
|
+
|
|
285
|
+
&::after {
|
|
286
|
+
background-color: $blue-third;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.field4 {
|
|
291
|
+
background-color: $blue-fourth;
|
|
292
|
+
|
|
293
|
+
&::after {
|
|
294
|
+
background-color: $blue-fourth;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.field5 {
|
|
299
|
+
background-color: $blue-fifth;
|
|
300
|
+
|
|
301
|
+
&::after {
|
|
302
|
+
background-color: $blue-fifth;
|
|
254
303
|
}
|
|
255
304
|
}
|
|
256
305
|
}
|
|
@@ -3,7 +3,7 @@ import classnames from "classnames"
|
|
|
3
3
|
import { FieldMessage } from "~components/FieldMessage"
|
|
4
4
|
import { CheckIcon } from "~components/Icon"
|
|
5
5
|
import { Text } from "~components/Text"
|
|
6
|
-
import { ScaleValue, Scale, ScaleItem } from "./types"
|
|
6
|
+
import { ScaleValue, Scale, ScaleItem, ColorSchema } from "./types"
|
|
7
7
|
import determineSelectionFromKeyPress from "./utils/determineSelectionFromKeyPress"
|
|
8
8
|
import styles from "./LikertScaleLegacy.module.scss"
|
|
9
9
|
|
|
@@ -22,6 +22,7 @@ export type LikertScaleProps = {
|
|
|
22
22
|
automationId?: string
|
|
23
23
|
"data-testid"?: string
|
|
24
24
|
reversed?: boolean
|
|
25
|
+
colorSchema?: ColorSchema | "classical"
|
|
25
26
|
validationMessage?: string
|
|
26
27
|
status?: "default" | "error"
|
|
27
28
|
onSelect: (value: ScaleItem | null) => void
|
|
@@ -39,6 +40,7 @@ export const LikertScaleLegacy = ({
|
|
|
39
40
|
scale,
|
|
40
41
|
selectedItem,
|
|
41
42
|
reversed,
|
|
43
|
+
colorSchema = "classical",
|
|
42
44
|
"data-testid": dataTestId,
|
|
43
45
|
onSelect,
|
|
44
46
|
validationMessage,
|
|
@@ -156,6 +158,9 @@ export const LikertScaleLegacy = ({
|
|
|
156
158
|
<div
|
|
157
159
|
className={classnames(
|
|
158
160
|
styles.likertItem,
|
|
161
|
+
colorSchema == "blue"
|
|
162
|
+
? styles.blueColorSchema
|
|
163
|
+
: styles.classicalColorSchema,
|
|
159
164
|
styles[`likertItem${item.value}`],
|
|
160
165
|
isSelected && styles.selected,
|
|
161
166
|
isSuggested && styles.suggested,
|
|
@@ -43,7 +43,7 @@ const scale: Scale = [
|
|
|
43
43
|
]
|
|
44
44
|
|
|
45
45
|
const StickerSheetTemplate: StickerSheetStory = {
|
|
46
|
-
render: ({ isReversed }) => (
|
|
46
|
+
render: ({ isReversed, colorSchema }) => (
|
|
47
47
|
<StickerSheet isReversed={isReversed}>
|
|
48
48
|
<StickerSheet.Body>
|
|
49
49
|
<StickerSheet.Row rowTitle="Not rated">
|
|
@@ -53,6 +53,7 @@ const StickerSheetTemplate: StickerSheetStory = {
|
|
|
53
53
|
selectedItem={scale[0]}
|
|
54
54
|
onSelect={(): void => undefined}
|
|
55
55
|
reversed={isReversed}
|
|
56
|
+
colorSchema={colorSchema}
|
|
56
57
|
/>
|
|
57
58
|
</StickerSheet.Row>
|
|
58
59
|
<StickerSheet.Row rowTitle="Strongly disagree">
|
|
@@ -62,6 +63,7 @@ const StickerSheetTemplate: StickerSheetStory = {
|
|
|
62
63
|
selectedItem={scale[1]}
|
|
63
64
|
onSelect={(): void => undefined}
|
|
64
65
|
reversed={isReversed}
|
|
66
|
+
colorSchema={colorSchema}
|
|
65
67
|
/>
|
|
66
68
|
</StickerSheet.Row>
|
|
67
69
|
<StickerSheet.Row rowTitle="Disagree">
|
|
@@ -71,6 +73,7 @@ const StickerSheetTemplate: StickerSheetStory = {
|
|
|
71
73
|
selectedItem={scale[2]}
|
|
72
74
|
onSelect={(): void => undefined}
|
|
73
75
|
reversed={isReversed}
|
|
76
|
+
colorSchema={colorSchema}
|
|
74
77
|
/>
|
|
75
78
|
</StickerSheet.Row>
|
|
76
79
|
<StickerSheet.Row rowTitle="Neither agree or disagree">
|
|
@@ -80,6 +83,7 @@ const StickerSheetTemplate: StickerSheetStory = {
|
|
|
80
83
|
selectedItem={scale[3]}
|
|
81
84
|
onSelect={(): void => undefined}
|
|
82
85
|
reversed={isReversed}
|
|
86
|
+
colorSchema={colorSchema}
|
|
83
87
|
/>
|
|
84
88
|
</StickerSheet.Row>
|
|
85
89
|
<StickerSheet.Row rowTitle="Agree">
|
|
@@ -89,6 +93,7 @@ const StickerSheetTemplate: StickerSheetStory = {
|
|
|
89
93
|
selectedItem={scale[4]}
|
|
90
94
|
onSelect={(): void => undefined}
|
|
91
95
|
reversed={isReversed}
|
|
96
|
+
colorSchema={colorSchema}
|
|
92
97
|
/>
|
|
93
98
|
</StickerSheet.Row>
|
|
94
99
|
<StickerSheet.Row rowTitle="Strongly agree">
|
|
@@ -98,6 +103,7 @@ const StickerSheetTemplate: StickerSheetStory = {
|
|
|
98
103
|
selectedItem={scale[5]}
|
|
99
104
|
onSelect={(): void => undefined}
|
|
100
105
|
reversed={isReversed}
|
|
106
|
+
colorSchema={colorSchema}
|
|
101
107
|
/>
|
|
102
108
|
</StickerSheet.Row>
|
|
103
109
|
<StickerSheet.Row rowTitle="Validation">
|
|
@@ -107,6 +113,7 @@ const StickerSheetTemplate: StickerSheetStory = {
|
|
|
107
113
|
selectedItem={scale[0]}
|
|
108
114
|
onSelect={(): void => undefined}
|
|
109
115
|
reversed={isReversed}
|
|
116
|
+
colorSchema={colorSchema}
|
|
110
117
|
validationMessage="Error message here"
|
|
111
118
|
status="error"
|
|
112
119
|
/>
|
|
@@ -118,18 +125,33 @@ const StickerSheetTemplate: StickerSheetStory = {
|
|
|
118
125
|
|
|
119
126
|
export const StickerSheetDefault: StickerSheetStory = {
|
|
120
127
|
...StickerSheetTemplate,
|
|
121
|
-
name: "Sticker Sheet (Default)",
|
|
128
|
+
name: "Sticker Sheet (Default - Classical)",
|
|
122
129
|
}
|
|
123
130
|
|
|
124
|
-
export const
|
|
131
|
+
export const StickerBlueSheetDefault: StickerSheetStory = {
|
|
125
132
|
...StickerSheetTemplate,
|
|
126
|
-
name: "Sticker Sheet (
|
|
133
|
+
name: "Sticker Sheet (Blue)",
|
|
134
|
+
args: { colorSchema: "blue" },
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export const StickerSheetClassicalReversed: StickerSheetStory = {
|
|
138
|
+
...StickerSheetTemplate,
|
|
139
|
+
name: "Sticker Sheet (Classical Reversed)",
|
|
127
140
|
parameters: {
|
|
128
141
|
backgrounds: { default: "Purple 700" },
|
|
129
142
|
},
|
|
130
143
|
args: { isReversed: true },
|
|
131
144
|
}
|
|
132
145
|
|
|
146
|
+
export const StickerSheetBlueReversed: StickerSheetStory = {
|
|
147
|
+
...StickerSheetTemplate,
|
|
148
|
+
name: "Sticker Sheet (Blue Reversed)",
|
|
149
|
+
parameters: {
|
|
150
|
+
backgrounds: { default: "Purple 700" },
|
|
151
|
+
},
|
|
152
|
+
args: { isReversed: true, colorSchema: "blue" },
|
|
153
|
+
}
|
|
154
|
+
|
|
133
155
|
export const StickerSheetRTL: StickerSheetStory = {
|
|
134
156
|
...StickerSheetTemplate,
|
|
135
157
|
name: "Sticker Sheet (RTL)",
|