@lumx/react 3.9.5 → 3.9.6-alpha.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/package.json CHANGED
@@ -6,8 +6,8 @@
6
6
  "url": "https://github.com/lumapps/design-system/issues"
7
7
  },
8
8
  "dependencies": {
9
- "@lumx/core": "^3.9.5",
10
- "@lumx/icons": "^3.9.5",
9
+ "@lumx/core": "^3.9.6-alpha.0",
10
+ "@lumx/icons": "^3.9.6-alpha.0",
11
11
  "@popperjs/core": "^2.5.4",
12
12
  "body-scroll-lock": "^3.1.5",
13
13
  "classnames": "^2.3.2",
@@ -111,5 +111,5 @@
111
111
  "build:storybook": "storybook build"
112
112
  },
113
113
  "sideEffects": false,
114
- "version": "3.9.5"
114
+ "version": "3.9.6-alpha.0"
115
115
  }
@@ -1,29 +1,53 @@
1
1
  import React from 'react';
2
- import { Button, ButtonSize, Emphasis, Size, Text } from '@lumx/react';
2
+ import omit from 'lodash/omit';
3
+ import pick from 'lodash/pick';
4
+
5
+ import { Button, ButtonSize, Emphasis, GridColumn, Size, Text, Theme } from '@lumx/react';
6
+ import { mdiAccountBox } from '@lumx/icons';
7
+
3
8
  import { iconArgType } from '@lumx/react/stories/controls/icons';
4
9
  import { colorArgType } from '@lumx/react/stories/controls/color';
5
10
  import { getSelectArgType } from '@lumx/react/stories/controls/selectArgType';
6
11
  import { withCombinations } from '@lumx/react/stories/decorators/withCombinations';
7
- import { mdiAccountBox } from '@lumx/icons';
12
+ import { disableArgTypes } from '@lumx/react/stories/utils/disableArgTypes';
13
+ import { withWrapper } from '@lumx/react/stories/decorators/withWrapper';
14
+ import { loremIpsum } from '@lumx/react/stories/utils/lorem';
15
+ import { withThemedBackground } from '@lumx/react/stories/decorators/withThemedBackground';
16
+ import { withTheming } from '@lumx/react/stories/utils/theming';
17
+ import { DESIGN_TOKENS } from '@lumx/core/js/constants/design-tokens';
8
18
 
9
19
  const buttonSizes = [Size.m, Size.s];
10
- const buttonEmphasis = [Emphasis.low, Emphasis.medium, Emphasis.high];
20
+ const buttonEmphasis = [Emphasis.high, Emphasis.medium, Emphasis.low];
21
+
22
+ // Combination of props that should be avoided
23
+ const excludeCombination = ({ isSelected, emphasis, hasBackground }: any) => {
24
+ // isSelected is only supported in medium emphasis
25
+ if (isSelected && emphasis && emphasis !== 'medium') return true;
26
+ // hasBackground is only supported in low emphasis
27
+ if (hasBackground && emphasis && emphasis !== 'low') return true;
28
+ return false;
29
+ };
11
30
 
12
31
  export default {
13
32
  title: 'LumX components/button/Button',
14
33
  component: Button,
15
34
  argTypes: {
16
- isSelected: { control: 'boolean' },
35
+ isSelected: { control: 'boolean', if: { arg: 'emphasis', eq: 'medium' } },
17
36
  isDisabled: { control: 'boolean' },
18
- hasBackground: { control: 'boolean' },
37
+ hasBackground: { control: 'boolean', if: { arg: 'emphasis', eq: 'low' } },
19
38
  emphasis: getSelectArgType(buttonEmphasis),
20
39
  size: getSelectArgType<ButtonSize>(buttonSizes),
21
40
  rightIcon: iconArgType,
22
41
  leftIcon: iconArgType,
23
42
  color: colorArgType,
24
- onClick: { action: true },
43
+ ref: { table: { disable: true } },
44
+ onClick: { action: true, table: { disable: true } },
45
+ linkAs: { table: { disable: true } },
46
+ className: { table: { disable: true } },
47
+ target: { if: { arg: 'href', exists: true }, control: { type: 'inline-radio' } },
48
+ type: { if: { arg: 'href', exists: false }, control: { type: 'inline-radio' } },
25
49
  },
26
- args: Button.defaultProps,
50
+ args: omit(Button.defaultProps, ['theme']),
27
51
  };
28
52
 
29
53
  /**
@@ -36,35 +60,27 @@ export const Default = {
36
60
  };
37
61
 
38
62
  /**
39
- * Disabled button
40
- */
41
- export const Disabled = {
42
- args: {
43
- isDisabled: true,
44
- children: 'Default button (disabled)',
45
- },
46
- };
47
-
48
- /**
49
- * All combinations of size, emphasis and hasBackground
63
+ * All combinations of size and emphasis
50
64
  */
51
- export const SizeEmphasisAndBackground = {
65
+ export const SizeAndEmphasis = {
52
66
  args: {
53
67
  children: 'Button',
54
68
  },
69
+ argTypes: {
70
+ // Disable props that are used in the combinations
71
+ ...disableArgTypes(['emphasis', 'size']),
72
+ },
55
73
  decorators: [
74
+ withThemedBackground(),
56
75
  withCombinations({
57
- tableStyle: { background: 'lightgray' },
58
76
  cellStyle: { padding: '10px' },
59
77
  combinations: {
78
+ sections: { key: 'theme', options: Object.values(Theme) },
60
79
  rows: { medium: { size: Size.m }, small: { size: Size.s } },
61
80
  cols: { key: 'emphasis', options: buttonEmphasis },
62
- sections: {
63
- 'hasBackground: false': { hasBackground: false },
64
- 'hasBackground: true': { hasBackground: true },
65
- },
66
81
  },
67
82
  }),
83
+ withWrapper({ maxColumns: 3, itemMinWidth: 350 }, GridColumn),
68
84
  ],
69
85
  };
70
86
 
@@ -76,62 +92,75 @@ export const LinkButton = {
76
92
  href: 'https://example.com',
77
93
  children: 'Link button',
78
94
  },
95
+ decorators: [
96
+ withCombinations({
97
+ combinations: {
98
+ cols: {
99
+ Default: {},
100
+ Disabled: { isDisabled: true },
101
+ },
102
+ },
103
+ }),
104
+ ],
79
105
  };
80
106
 
81
107
  /**
82
- * Setting a href to transform the button into a link.
83
- */
84
- export const LinkButtonDisabled = {
85
- args: {
86
- href: 'https://example.com',
87
- children: 'Link button (disabled)',
88
- isDisabled: true,
89
- },
90
- };
91
-
92
- /**
93
- * Full width button
94
- */
95
- export const FullWidth = {
96
- args: {
97
- fullWidth: true,
98
- children: 'Full width button',
99
- },
100
- };
101
-
102
- /**
103
- * Full width button with long text truncated
108
+ * Demo content sizing
104
109
  */
105
- export const FullWidthTruncated = {
106
- argTypes: {
107
- children: { control: false },
108
- },
109
- args: {
110
- fullWidth: true,
111
- children: (
112
- <Text as="span" truncate>
113
- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
114
- dolore magna aliqua. Potenti nullam ac tortor vitae. Lorem ipsum dolor sit amet. Diam sollicitudin
115
- tempor id eu nisl nunc mi ipsum. Elementum facilisis leo vel fringilla est ullamcorper eget nulla.
116
- Mollis aliquam ut porttitor leo a diam sollicitudin tempor. Ultrices tincidunt arcu non sodales neque
117
- sodales.
118
- </Text>
119
- ),
120
- },
110
+ export const ContentSizing = {
111
+ decorators: [
112
+ withCombinations({
113
+ colStyle: { width: '50%' },
114
+ cellStyle: { maxWidth: '400px', overflow: 'hidden' },
115
+ combinations: {
116
+ rows: {
117
+ Default: {},
118
+ FullWidth: { fullWidth: true },
119
+ },
120
+ cols: {
121
+ 'Short text': {
122
+ children: 'Short text',
123
+ },
124
+ 'Long text': {
125
+ children: (
126
+ <Text as="span" truncate>
127
+ {loremIpsum('long')}
128
+ </Text>
129
+ ),
130
+ },
131
+ },
132
+ },
133
+ }),
134
+ ],
121
135
  };
122
136
 
123
137
  /**
124
138
  * Check button style variations (color, states, emphasis, etc.)
125
139
  */
126
- export const ButtonVariations = {
140
+ export const StateVariations = {
127
141
  args: {
128
142
  children: 'Button',
129
143
  rightIcon: mdiAccountBox,
130
144
  },
145
+ argTypes: {
146
+ ...disableArgTypes([
147
+ 'emphasis',
148
+ 'hasBackground',
149
+ 'isSelected',
150
+ 'isDisabled',
151
+ 'color',
152
+ 'fullWidth',
153
+ 'type',
154
+ 'name',
155
+ 'href',
156
+ ]),
157
+ },
131
158
  decorators: [
159
+ withThemedBackground(),
132
160
  withCombinations({
133
- tableStyle: { background: 'lightgray', width: '100%' },
161
+ tableStyle: { width: '100%' },
134
162
  firstColStyle: { whiteSpace: 'nowrap', width: '1%' },
163
+ excludeCombination,
135
164
  combinations: {
136
165
  // Colors
137
166
  rows: {
@@ -139,14 +168,15 @@ export const ButtonVariations = {
139
168
  'Color: red': { color: 'red' },
140
169
  'Theme: dark': { theme: 'dark' },
141
170
  'Theme: dark & color: green': { theme: 'dark', color: 'green' },
171
+ Selected: { isSelected: true },
172
+ 'Selected & theme dark': { isSelected: true, theme: 'dark' },
142
173
  },
143
174
  // States
144
175
  cols: {
145
176
  'Default state': {},
146
- Selected: { isSelected: true },
147
177
  Hovered: { isHovered: true },
148
- Focused: { isFocused: true },
149
178
  Active: { isActive: true },
179
+ Focused: { isFocused: true },
150
180
  Disabled: { isDisabled: true },
151
181
  },
152
182
  // Emphasis/Background
@@ -155,10 +185,169 @@ export const ButtonVariations = {
155
185
  'Emphasis medium': { emphasis: 'medium' },
156
186
  'Emphasis low': { emphasis: 'low' },
157
187
  'Full width': { fullWidth: true },
158
- 'Has background (emphasis low)': { emphasis: 'low', hasBackground: true },
159
- 'Has background + Full width': { emphasis: 'low', hasBackground: true, fullWidth: true },
188
+ 'Emphasis low + has background': { emphasis: 'low', hasBackground: true },
160
189
  },
161
190
  },
162
191
  }),
163
192
  ],
164
193
  };
194
+
195
+ /**
196
+ * Demo button LumX CSS theming variable
197
+ */
198
+ export const Theming = {
199
+ args: { children: 'Label' },
200
+ argTypes: {
201
+ ...disableArgTypes(['isDisabled', 'href', 'name', 'type', 'emphasis']),
202
+ },
203
+ decorators: [
204
+ withThemedBackground(),
205
+ withCombinations({
206
+ excludeCombination,
207
+ combinations: {
208
+ // States
209
+ cols: {
210
+ Default: {},
211
+ Hovered: { isHovered: true },
212
+ Active: { isActive: true },
213
+ Focused: { isFocused: true },
214
+ Disabled: { isDisabled: true },
215
+ },
216
+ rows: {
217
+ Default: {},
218
+ Selected: { isSelected: true },
219
+ 'Has background': { hasBackground: true },
220
+ },
221
+ },
222
+ }),
223
+ withTheming({
224
+ properties: pick(DESIGN_TOKENS, ['button']),
225
+ values: `
226
+ --lumx-button-height: 50px;
227
+ --lumx-button-border-radius: 2px;
228
+
229
+ /////////////
230
+ --lumx-button-emphasis-high-state-default-padding-horizontal: 10px;
231
+ --lumx-button-emphasis-high-state-default-border-width: 2px;
232
+ --lumx-button-emphasis-high-state-hover-padding-horizontal: 15px;
233
+ --lumx-button-emphasis-high-state-hover-border-width: 4px;
234
+ --lumx-button-emphasis-high-state-active-padding-horizontal: 20px;
235
+ --lumx-button-emphasis-high-state-active-border-width: 6px;
236
+
237
+ --lumx-button-emphasis-high-state-default-theme-light-background-color: darkred;
238
+ --lumx-button-emphasis-high-state-default-theme-light-color: green;
239
+ --lumx-button-emphasis-high-state-default-theme-light-border-color: green;
240
+ --lumx-button-emphasis-high-state-hover-theme-light-background-color: rebeccapurple;
241
+ --lumx-button-emphasis-high-state-hover-theme-light-color: yellow;
242
+ --lumx-button-emphasis-high-state-hover-theme-light-border-color: yellow;
243
+ --lumx-button-emphasis-high-state-active-theme-light-background-color: black;
244
+ --lumx-button-emphasis-high-state-active-theme-light-color: blue;
245
+ --lumx-button-emphasis-high-state-active-theme-light-border-color: blue;
246
+
247
+ --lumx-button-emphasis-high-state-default-theme-dark-background-color: rebeccapurple;
248
+ --lumx-button-emphasis-high-state-default-theme-dark-color: hotpink;
249
+ --lumx-button-emphasis-high-state-default-theme-dark-border-color: hotpink;
250
+ --lumx-button-emphasis-high-state-hover-theme-dark-background-color: yellow;
251
+ --lumx-button-emphasis-high-state-hover-theme-dark-color: blue;
252
+ --lumx-button-emphasis-high-state-hover-theme-dark-border-color: blue;
253
+ --lumx-button-emphasis-high-state-active-theme-dark-background-color: green;
254
+ --lumx-button-emphasis-high-state-active-theme-dark-color: red;
255
+ --lumx-button-emphasis-high-state-active-theme-dark-border-color: red;
256
+
257
+ /////////////
258
+ --lumx-button-emphasis-medium-state-default-padding-horizontal: 5px;
259
+ --lumx-button-emphasis-medium-state-default-border-width: 6px;
260
+ --lumx-button-emphasis-medium-state-hover-padding-horizontal: 10px;
261
+ --lumx-button-emphasis-medium-state-hover-border-width: 4px;
262
+ --lumx-button-emphasis-medium-state-active-padding-horizontal: 2px;
263
+ --lumx-button-emphasis-medium-state-active-border-width: 2px;
264
+
265
+ --lumx-button-emphasis-medium-state-default-theme-light-background-color: lightblue;
266
+ --lumx-button-emphasis-medium-state-default-theme-light-color: hotpink;
267
+ --lumx-button-emphasis-medium-state-default-theme-light-border-color: hotpink;
268
+ --lumx-button-emphasis-medium-state-hover-theme-light-background-color: red;
269
+ --lumx-button-emphasis-medium-state-hover-theme-light-color: rebeccapurple;
270
+ --lumx-button-emphasis-medium-state-hover-theme-light-border-color: rebeccapurple;
271
+ --lumx-button-emphasis-medium-state-active-theme-light-background-color: lightseagreen;
272
+ --lumx-button-emphasis-medium-state-active-theme-light-color: maroon;
273
+ --lumx-button-emphasis-medium-state-active-theme-light-border-color: maroon;
274
+
275
+ --lumx-button-emphasis-medium-state-default-theme-dark-background-color: mediumorchid;
276
+ --lumx-button-emphasis-medium-state-default-theme-dark-color: midnightblue;
277
+ --lumx-button-emphasis-medium-state-default-theme-dark-border-color: midnightblue;
278
+ --lumx-button-emphasis-medium-state-hover-theme-dark-background-color: olive;
279
+ --lumx-button-emphasis-medium-state-hover-theme-dark-color: orangered;
280
+ --lumx-button-emphasis-medium-state-hover-theme-dark-border-color: orangered;
281
+ --lumx-button-emphasis-medium-state-active-theme-dark-background-color: salmon;
282
+ --lumx-button-emphasis-medium-state-active-theme-dark-color: seagreen;
283
+ --lumx-button-emphasis-medium-state-active-theme-dark-border-color: seagreen;
284
+
285
+ /////////////
286
+ --lumx-button-emphasis-selected-state-default-padding-horizontal: 5px;
287
+ --lumx-button-emphasis-selected-state-default-border-width: 1px;
288
+ --lumx-button-emphasis-selected-state-hover-padding-horizontal: 2px;
289
+ --lumx-button-emphasis-selected-state-hover-border-width: 2px;
290
+ --lumx-button-emphasis-selected-state-active-padding-horizontal: 10px;
291
+ --lumx-button-emphasis-selected-state-active-border-width: 3px;
292
+
293
+ --lumx-button-emphasis-selected-state-default-theme-light-background-color: yellowgreen;
294
+ --lumx-button-emphasis-selected-state-default-theme-light-color: bisque;
295
+ --lumx-button-emphasis-selected-state-default-theme-light-border-color: bisque;
296
+ --lumx-button-emphasis-selected-state-hover-theme-light-background-color: cadetblue;
297
+ --lumx-button-emphasis-selected-state-hover-theme-light-color: coral;
298
+ --lumx-button-emphasis-selected-state-hover-theme-light-border-color: coral;
299
+ --lumx-button-emphasis-selected-state-active-theme-light-background-color: darkgoldenrod;
300
+ --lumx-button-emphasis-selected-state-active-theme-light-color: darkslategrey;
301
+ --lumx-button-emphasis-selected-state-active-theme-light-border-color: darkslategrey;
302
+
303
+ --lumx-button-emphasis-selected-state-default-theme-dark-background-color: gold;
304
+ --lumx-button-emphasis-selected-state-default-theme-dark-color: ghostwhite;
305
+ --lumx-button-emphasis-selected-state-default-theme-dark-border-color: ghostwhite;
306
+ --lumx-button-emphasis-selected-state-hover-theme-dark-background-color: lightcoral;
307
+ --lumx-button-emphasis-selected-state-hover-theme-dark-color: magenta;
308
+ --lumx-button-emphasis-selected-state-hover-theme-dark-border-color: magenta;
309
+ --lumx-button-emphasis-selected-state-active-theme-dark-background-color: mediumslateblue;
310
+ --lumx-button-emphasis-selected-state-active-theme-dark-color: mistyrose;
311
+ --lumx-button-emphasis-selected-state-active-theme-dark-border-color: mistyrose;
312
+
313
+ /////////////
314
+ --lumx-button-emphasis-low-state-default-padding-horizontal: 1px;
315
+ --lumx-button-emphasis-low-state-default-border-width: 10px;
316
+ --lumx-button-emphasis-low-state-hover-padding-horizontal: 2px;
317
+ --lumx-button-emphasis-low-state-hover-border-width: 5px;
318
+ --lumx-button-emphasis-low-state-active-padding-horizontal: 3px;
319
+ --lumx-button-emphasis-low-state-active-border-width: 2px;
320
+
321
+ --lumx-button-emphasis-low-state-default-theme-light-background-color: rgb(from lightcyan r g b / 50%);
322
+ --lumx-button-emphasis-low-state-default-theme-light-color: rgb(from goldenrod r g b / 50%);
323
+ --lumx-button-emphasis-low-state-default-theme-light-border-color: rgb(from goldenrod r g b / 50%);
324
+ --lumx-button-emphasis-low-state-hover-theme-light-background-color: rgb(from darkslategray r g b / 50%);
325
+ --lumx-button-emphasis-low-state-hover-theme-light-color: rgb(from crimson r g b / 50%);
326
+ --lumx-button-emphasis-low-state-hover-theme-light-border-color: rgb(from crimson r g b / 50%);
327
+ --lumx-button-emphasis-low-state-active-theme-light-background-color: rgb(from blanchedalmond r g b / 50%);
328
+ --lumx-button-emphasis-low-state-active-theme-light-color: rgb(from firebrick r g b / 50%);
329
+ --lumx-button-emphasis-low-state-active-theme-light-border-color: rgb(from firebrick r g b / 50%);
330
+
331
+ --lumx-button-emphasis-low-state-default-theme-dark-background-color: rgb(from blueviolet r g b / 50%);
332
+ --lumx-button-emphasis-low-state-default-theme-dark-color: rgb(from chartreuse r g b / 50%);
333
+ --lumx-button-emphasis-low-state-default-theme-dark-border-color: rgb(from chartreuse r g b / 50%);
334
+ --lumx-button-emphasis-low-state-hover-theme-dark-background-color: rgb(from darkturquoise r g b / 50%);
335
+ --lumx-button-emphasis-low-state-hover-theme-dark-color: rgb(from goldenrod r g b / 50%);
336
+ --lumx-button-emphasis-low-state-hover-theme-dark-border-color: rgb(from goldenrod r g b / 50%);
337
+ --lumx-button-emphasis-low-state-active-theme-dark-background-color: rgb(from magenta r g b / 50%);
338
+ --lumx-button-emphasis-low-state-active-theme-dark-color: rgb(from lightsteelblue r g b / 50%);
339
+ --lumx-button-emphasis-low-state-active-theme-dark-border-color: rgb(from lightsteelblue r g b / 50%);
340
+ `,
341
+ }),
342
+ withCombinations({
343
+ combinations: {
344
+ sections: { key: 'emphasis', options: buttonEmphasis },
345
+ },
346
+ }),
347
+ withCombinations({
348
+ combinations: {
349
+ sections: { 'Theme light': { theme: 'light' }, 'Theme dark': { theme: 'dark' } },
350
+ },
351
+ }),
352
+ ],
353
+ };
@@ -4,7 +4,7 @@ import { iconArgType } from '@lumx/react/stories/controls/icons';
4
4
  import { colorArgType } from '@lumx/react/stories/controls/color';
5
5
  import { SQUARE_IMAGES, squareImageArgType } from '@lumx/react/stories/controls/image';
6
6
  import { getSelectArgType } from '@lumx/react/stories/controls/selectArgType';
7
- import { ButtonVariations } from './Button.stories';
7
+ import { StateVariations } from './Button.stories';
8
8
 
9
9
  export default {
10
10
  title: 'LumX components/button/IconButton',
@@ -17,6 +17,12 @@ export default {
17
17
  size: getSelectArgType<ButtonSize>([Size.s, Size.m]),
18
18
  icon: iconArgType,
19
19
  color: colorArgType,
20
+ ref: { table: { disable: true } },
21
+ onClick: { action: true, table: { disable: true } },
22
+ linkAs: { table: { disable: true } },
23
+ className: { table: { disable: true } },
24
+ target: { if: { arg: 'href', exists: true }, control: { type: 'inline-radio' } },
25
+ type: { if: { arg: 'href', exists: false }, control: { type: 'inline-radio' } },
20
26
  },
21
27
  args: IconButton.defaultProps,
22
28
  };
@@ -25,7 +31,7 @@ export default {
25
31
  * Default IconButton
26
32
  */
27
33
  export const Default = {
28
- args: { icon: mdiSend },
34
+ args: { icon: mdiSend, label: 'Button label' },
29
35
  };
30
36
 
31
37
  /**
@@ -36,17 +42,11 @@ export const WithImage = {
36
42
  args: { image: SQUARE_IMAGES.square1 },
37
43
  };
38
44
 
39
- /**
40
- * IconButton using a tooltip
41
- */
42
- export const WithTooltip = {
43
- args: { icon: mdiSend, label: 'Send a message' },
44
- };
45
-
46
45
  /**
47
46
  * Check icon button style variations (color, states, emphasis, etc.)
48
47
  */
49
- export const IconButtonVariations = {
48
+ export const IconStateVariations = {
50
49
  ...Default,
51
- decorators: ButtonVariations.decorators,
50
+ argTypes: { ...Default.args, ...StateVariations.argTypes },
51
+ decorators: StateVariations.decorators,
52
52
  };
@@ -1,17 +1,22 @@
1
1
  import React from 'react';
2
2
 
3
+ import omit from 'lodash/omit';
3
4
  import { mdiClose, mdiViewList } from '@lumx/icons';
4
- import { Chip, ChipProps, ColorPalette, GridColumn, Icon, Size } from '@lumx/react';
5
+ import { Chip, ChipProps, ColorPalette, Icon, Size, Theme } from '@lumx/react';
6
+
5
7
  import { getSelectArgType } from '@lumx/react/stories/controls/selectArgType';
6
8
  import { withCombinations } from '@lumx/react/stories/decorators/withCombinations';
7
9
  import { withUndefined } from '@lumx/react/stories/controls/withUndefined';
8
- import { withWrapper } from '@lumx/react/stories/decorators/withWrapper';
10
+ import { withTheming } from '@lumx/react/stories/utils/theming';
11
+ import { DESIGN_TOKENS } from '@lumx/core/src/js/constants/design-tokens';
12
+ import pick from 'lodash/pick';
13
+ import { withThemedBackground } from '@lumx/react/stories/decorators/withThemedBackground';
9
14
 
10
15
  const chipSizes = [Size.m, Size.s];
11
16
  export default {
12
17
  title: 'LumX components/chip/Chip',
13
18
  component: Chip,
14
- args: Chip.defaultProps,
19
+ args: omit(Chip.defaultProps, ['theme']),
15
20
  argTypes: {
16
21
  size: getSelectArgType<ChipProps['size']>(chipSizes),
17
22
  before: { control: false },
@@ -64,20 +69,81 @@ export const WithAfterAndBefore = {
64
69
  /**
65
70
  * All combinations of color, size and states.
66
71
  */
67
- export const Variants = {
72
+ export const ColorVariants = {
68
73
  ...WithAfterAndBefore,
69
74
  decorators: [
70
75
  withCombinations({
71
76
  combinations: {
72
77
  rows: { key: 'color', options: withUndefined(ColorPalette) },
73
- cols: { key: 'size', options: chipSizes },
74
- sections: {
78
+ sections: { key: 'size', options: chipSizes },
79
+ cols: {
80
+ Default: {},
81
+ Hover: { 'data-lumx-hover': true },
82
+ Active: { 'data-lumx-active': true },
83
+ Disabled: { isDisabled: true },
84
+ Focused: { 'data-focus-visible-added': true },
85
+ },
86
+ },
87
+ }),
88
+ ],
89
+ };
90
+
91
+ /**
92
+ * All combinations of color, size and states.
93
+ */
94
+ export const SelectedVariants = {
95
+ ...WithAfterAndBefore,
96
+ decorators: [
97
+ withThemedBackground(),
98
+ withCombinations({
99
+ combinations: {
100
+ sections: { 'Size m': {}, 'Size s': { size: 's' } },
101
+ rows: {
102
+ 'theme=light': { theme: Theme.light },
103
+ 'Selected & theme=light': { isSelected: true, theme: Theme.light },
104
+ 'theme=dark': { theme: Theme.dark },
105
+ 'Selected & theme=dark': { isSelected: true, theme: Theme.dark },
106
+ },
107
+ cols: {
75
108
  Default: {},
109
+ Hover: { 'data-lumx-hover': true },
110
+ Active: { 'data-lumx-active': true },
76
111
  Disabled: { isDisabled: true },
77
- Highlighted: { isHighlighted: true },
112
+ Focused: { 'data-focus-visible-added': true },
78
113
  },
79
114
  },
80
115
  }),
81
- withWrapper({ maxColumns: 3, itemMinWidth: 350 }, GridColumn),
116
+ ],
117
+ };
118
+
119
+ /**
120
+ * Test chip CSS variable theming
121
+ */
122
+ export const Theming = {
123
+ ...SelectedVariants,
124
+ decorators: [
125
+ ...SelectedVariants.decorators,
126
+ withTheming({
127
+ properties: pick(DESIGN_TOKENS, ['chip']),
128
+ values: `
129
+ --lumx-chip-emphasis-selected-state-default-border-width: 2px;
130
+ --lumx-chip-emphasis-selected-state-default-theme-light-border-color: red;
131
+ --lumx-chip-emphasis-selected-state-default-theme-light-background-color: blue;
132
+ --lumx-chip-emphasis-selected-state-default-theme-dark-border-color: blue;
133
+ --lumx-chip-emphasis-selected-state-default-theme-dark-background-color: red;
134
+
135
+ --lumx-chip-emphasis-selected-state-hover-border-width: 3px;
136
+ --lumx-chip-emphasis-selected-state-hover-theme-light-border-color: green;
137
+ --lumx-chip-emphasis-selected-state-hover-theme-light-background-color: violet;
138
+ --lumx-chip-emphasis-selected-state-hover-theme-dark-border-color: violet;
139
+ --lumx-chip-emphasis-selected-state-hover-theme-dark-background-color: green;
140
+
141
+ --lumx-chip-emphasis-selected-state-active-border-width: 4px;
142
+ --lumx-chip-emphasis-selected-state-active-theme-light-border-color: orange;
143
+ --lumx-chip-emphasis-selected-state-active-theme-light-background-color: pink;
144
+ --lumx-chip-emphasis-selected-state-active-theme-dark-border-color: pink;
145
+ --lumx-chip-emphasis-selected-state-active-theme-dark-background-color: orange;
146
+ `,
147
+ }),
82
148
  ],
83
149
  };