@lumx/core 3.20.1-alpha.11 → 3.20.1-alpha.13

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.
Files changed (66) hide show
  1. package/js/constants/design-tokens.js +5389 -2294
  2. package/js/constants/index.js +107 -134
  3. package/js/constants/keycodes.js +9 -13
  4. package/js/custom-colors.js +17 -22
  5. package/js/types/Callback.js +0 -1
  6. package/js/types/Falsy.js +0 -1
  7. package/js/types/GenericProps.js +0 -1
  8. package/js/types/HasAriaLabelOrLabelledBy.js +0 -1
  9. package/js/types/HasClassName.js +0 -1
  10. package/js/types/HasCloseMode.js +0 -1
  11. package/js/types/HasTheme.js +0 -1
  12. package/js/types/HeadingElement.js +0 -1
  13. package/js/types/Point.js +0 -1
  14. package/js/types/Predicate.js +0 -1
  15. package/js/types/RectSize.js +0 -1
  16. package/js/types/TextElement.js +0 -1
  17. package/js/types/ValueOf.js +0 -1
  18. package/js/types/index.js +0 -1
  19. package/js/utils/className/fontColorClass.js +7 -12
  20. package/js/utils/className/fontColorClass.test.js +14 -16
  21. package/js/utils/className/getBasicClass.js +19 -24
  22. package/js/utils/className/getBasicClass.test.js +55 -19
  23. package/js/utils/className/getRootClassName.js +10 -17
  24. package/js/utils/className/getRootClassName.test.js +11 -13
  25. package/js/utils/className/getTypographyClassName.js +3 -7
  26. package/js/utils/className/getTypographyClassName.test.js +5 -7
  27. package/js/utils/className/handleBasicClasses.js +27 -31
  28. package/js/utils/className/handleBasicClasses.test.js +30 -32
  29. package/js/utils/className/index.js +12 -25
  30. package/js/utils/className/resolveColorWithVariants.js +4 -9
  31. package/js/utils/className/resolveColorWithVariants.test.js +26 -28
  32. package/js/utils/index.js +161 -174
  33. package/package.json +1 -3
  34. package/js/constants/design-tokens.min.js +0 -1
  35. package/js/constants/index.min.js +0 -1
  36. package/js/constants/keycodes.min.js +0 -1
  37. package/js/custom-colors.min.js +0 -1
  38. package/js/types/Callback.min.js +0 -1
  39. package/js/types/Falsy.min.js +0 -1
  40. package/js/types/GenericProps.min.js +0 -1
  41. package/js/types/HasAriaLabelOrLabelledBy.min.js +0 -1
  42. package/js/types/HasClassName.min.js +0 -1
  43. package/js/types/HasCloseMode.min.js +0 -1
  44. package/js/types/HasTheme.min.js +0 -1
  45. package/js/types/HeadingElement.min.js +0 -1
  46. package/js/types/Point.min.js +0 -1
  47. package/js/types/Predicate.min.js +0 -1
  48. package/js/types/RectSize.min.js +0 -1
  49. package/js/types/TextElement.min.js +0 -1
  50. package/js/types/ValueOf.min.js +0 -1
  51. package/js/types/index.min.js +0 -1
  52. package/js/utils/className/fontColorClass.min.js +0 -1
  53. package/js/utils/className/fontColorClass.test.min.js +0 -1
  54. package/js/utils/className/getBasicClass.min.js +0 -1
  55. package/js/utils/className/getBasicClass.test.min.js +0 -1
  56. package/js/utils/className/getRootClassName.min.js +0 -1
  57. package/js/utils/className/getRootClassName.test.min.js +0 -1
  58. package/js/utils/className/getTypographyClassName.min.js +0 -1
  59. package/js/utils/className/getTypographyClassName.test.min.js +0 -1
  60. package/js/utils/className/handleBasicClasses.min.js +0 -1
  61. package/js/utils/className/handleBasicClasses.test.min.js +0 -1
  62. package/js/utils/className/index.min.js +0 -1
  63. package/js/utils/className/resolveColorWithVariants.min.js +0 -1
  64. package/js/utils/className/resolveColorWithVariants.test.min.js +0 -1
  65. package/js/utils/index.min.js +0 -1
  66. package/lumx.min.css +0 -1
@@ -1,13 +1,10 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var js_constants_keycodes = require('./keycodes.js');
1
+ export { BACKSPACE_KEY_CODE, DOWN_KEY_CODE, ENTER_KEY_CODE, ESCAPE_KEY_CODE, LEFT_KEY_CODE, RIGHT_KEY_CODE, SPACE_KEY_CODE, TAB_KEY_CODE, UP_KEY_CODE } from './keycodes.js';
6
2
 
7
3
  /**
8
4
  * The prefix to use for the CSS classes.
9
5
  */
10
6
  const CSS_PREFIX = 'lumx';
7
+
11
8
  /**
12
9
  * Animation duration constants. Take into consideration that if you change one of these variables,
13
10
  * you need to update their scss counterpart as well
@@ -16,203 +13,179 @@ const DIALOG_TRANSITION_DURATION = 400;
16
13
  const EXPANSION_PANEL_TRANSITION_DURATION = 400;
17
14
  const NOTIFICATION_TRANSITION_DURATION = 200;
18
15
  const SLIDESHOW_TRANSITION_DURATION = 5000;
16
+
19
17
  /**
20
18
  * Delay on hover after which we open or close the tooltip.
21
19
  * Only applies to devices supporting pointer hover.
22
20
  */
23
21
  const TOOLTIP_HOVER_DELAY = {
24
- open: 500,
25
- close: 500,
22
+ open: 500,
23
+ close: 500
26
24
  };
25
+
27
26
  /**
28
27
  * Delay on long press after which we open or close the tooltip.
29
28
  * Only applies to devices not supporting pointer hover.
30
29
  */
31
30
  const TOOLTIP_LONG_PRESS_DELAY = {
32
- open: 250,
33
- close: 3000,
31
+ open: 250,
32
+ close: 3000
34
33
  };
34
+
35
35
  /**
36
36
  * Alignments.
37
37
  */
38
38
  const Alignment = {
39
- bottom: 'bottom',
40
- center: 'center',
41
- end: 'end',
42
- left: 'left',
43
- right: 'right',
44
- spaceAround: 'space-around',
45
- spaceBetween: 'space-between',
46
- spaceEvenly: 'space-evenly',
47
- start: 'start',
48
- top: 'top',
39
+ bottom: 'bottom',
40
+ center: 'center',
41
+ end: 'end',
42
+ left: 'left',
43
+ right: 'right',
44
+ spaceAround: 'space-around',
45
+ spaceBetween: 'space-between',
46
+ spaceEvenly: 'space-evenly',
47
+ start: 'start',
48
+ top: 'top'
49
49
  };
50
50
  const Theme = {
51
- light: 'light',
52
- dark: 'dark',
51
+ light: 'light',
52
+ dark: 'dark'
53
53
  };
54
54
  const Size = {
55
- xxs: 'xxs',
56
- xs: 'xs',
57
- s: 's',
58
- m: 'm',
59
- l: 'l',
60
- xl: 'xl',
61
- xxl: 'xxl',
62
- tiny: 'tiny',
63
- regular: 'regular',
64
- medium: 'medium',
65
- big: 'big',
66
- huge: 'huge',
55
+ xxs: 'xxs',
56
+ xs: 'xs',
57
+ s: 's',
58
+ m: 'm',
59
+ l: 'l',
60
+ xl: 'xl',
61
+ xxl: 'xxl',
62
+ tiny: 'tiny',
63
+ regular: 'regular',
64
+ medium: 'medium',
65
+ big: 'big',
66
+ huge: 'huge'
67
67
  };
68
68
  const Orientation = {
69
- horizontal: 'horizontal',
70
- vertical: 'vertical',
69
+ horizontal: 'horizontal',
70
+ vertical: 'vertical'
71
71
  };
72
72
  const Emphasis = {
73
- low: 'low',
74
- medium: 'medium',
75
- high: 'high',
73
+ low: 'low',
74
+ medium: 'medium',
75
+ high: 'high'
76
76
  };
77
77
  /**
78
78
  * List of typographies that can't be customized.
79
79
  */
80
80
  const TypographyInterface = {
81
- overline: 'overline',
82
- caption: 'caption',
83
- body1: 'body1',
84
- body2: 'body2',
85
- subtitle1: 'subtitle1',
86
- subtitle2: 'subtitle2',
87
- title: 'title',
88
- headline: 'headline',
89
- display1: 'display1',
81
+ overline: 'overline',
82
+ caption: 'caption',
83
+ body1: 'body1',
84
+ body2: 'body2',
85
+ subtitle1: 'subtitle1',
86
+ subtitle2: 'subtitle2',
87
+ title: 'title',
88
+ headline: 'headline',
89
+ display1: 'display1'
90
90
  };
91
91
  /**
92
92
  * List of title typographies that can be customized (via CSS variables).
93
93
  */
94
94
  const TypographyTitleCustom = {
95
- title1: 'custom-title1',
96
- title2: 'custom-title2',
97
- title3: 'custom-title3',
98
- title4: 'custom-title4',
99
- title5: 'custom-title5',
100
- title6: 'custom-title6',
95
+ title1: 'custom-title1',
96
+ title2: 'custom-title2',
97
+ title3: 'custom-title3',
98
+ title4: 'custom-title4',
99
+ title5: 'custom-title5',
100
+ title6: 'custom-title6'
101
101
  };
102
102
  /**
103
103
  * List of typographies that can be customized (via CSS variables).
104
104
  */
105
105
  const TypographyCustom = {
106
- ...TypographyTitleCustom,
107
- intro: 'custom-intro',
108
- 'body-large': 'custom-body-large',
109
- body: 'custom-body',
110
- quote: 'custom-quote',
111
- 'publish-info': 'custom-publish-info',
112
- button: 'custom-button',
106
+ ...TypographyTitleCustom,
107
+ intro: 'custom-intro',
108
+ 'body-large': 'custom-body-large',
109
+ body: 'custom-body',
110
+ quote: 'custom-quote',
111
+ 'publish-info': 'custom-publish-info',
112
+ button: 'custom-button'
113
113
  };
114
114
  /**
115
115
  * List of all typographies.
116
116
  */
117
117
  const Typography = {
118
- ...TypographyInterface,
119
- custom: TypographyCustom,
118
+ ...TypographyInterface,
119
+ custom: TypographyCustom
120
120
  };
121
121
  /**
122
122
  * All available aspect ratios.
123
123
  */
124
124
  const AspectRatio = {
125
- /** Intrinsic content ratio. */
126
- original: 'original',
127
- /** Ratio 3:1 */
128
- panoramic: 'panoramic',
129
- /** Ratio 16:9 */
130
- wide: 'wide',
131
- /** Ratio 3:2 */
132
- horizontal: 'horizontal',
133
- /** Ratio 3:2 */
134
- vertical: 'vertical',
135
- /** Ratio 1:1 */
136
- square: 'square',
137
- /** Ratio constrained by the parent. */
138
- free: 'free',
125
+ /** Intrinsic content ratio. */
126
+ original: 'original',
127
+ /** Ratio 3:1 */
128
+ panoramic: 'panoramic',
129
+ /** Ratio 16:9 */
130
+ wide: 'wide',
131
+ /** Ratio 3:2 */
132
+ horizontal: 'horizontal',
133
+ /** Ratio 3:2 */
134
+ vertical: 'vertical',
135
+ /** Ratio 1:1 */
136
+ square: 'square',
137
+ /** Ratio constrained by the parent. */
138
+ free: 'free'
139
139
  };
140
140
  /**
141
141
  * Semantic info about the purpose of the component
142
142
  */
143
143
  const Kind = {
144
- info: 'info',
145
- success: 'success',
146
- warning: 'warning',
147
- error: 'error',
144
+ info: 'info',
145
+ success: 'success',
146
+ warning: 'warning',
147
+ error: 'error'
148
148
  };
149
149
  /**
150
150
  * All available white-space values
151
151
  * */
152
152
  const WhiteSpace = {
153
- normal: 'normal',
154
- nowrap: 'nowrap',
155
- pre: 'pre',
156
- 'pre-wrap': 'pre-wrap',
157
- 'pre-line': 'pre-line',
158
- 'break-spaces': 'break-spaces',
153
+ normal: 'normal',
154
+ nowrap: 'nowrap',
155
+ pre: 'pre',
156
+ 'pre-wrap': 'pre-wrap',
157
+ 'pre-line': 'pre-line',
158
+ 'break-spaces': 'break-spaces'
159
159
  };
160
160
  /**
161
161
  * See SCSS variable $lumx-color-palette
162
162
  */
163
163
  const ColorPalette = {
164
- primary: 'primary',
165
- secondary: 'secondary',
166
- blue: 'blue',
167
- dark: 'dark',
168
- green: 'green',
169
- yellow: 'yellow',
170
- red: 'red',
171
- light: 'light',
172
- grey: 'grey',
164
+ primary: 'primary',
165
+ secondary: 'secondary',
166
+ blue: 'blue',
167
+ dark: 'dark',
168
+ green: 'green',
169
+ yellow: 'yellow',
170
+ red: 'red',
171
+ light: 'light',
172
+ grey: 'grey'
173
173
  };
174
174
  /**
175
175
  * See SCSS variable $lumx-color-variants
176
176
  */
177
177
  const ColorVariant = {
178
- D1: 'D1',
179
- D2: 'D2',
180
- L1: 'L1',
181
- L2: 'L2',
182
- L3: 'L3',
183
- L4: 'L4',
184
- L5: 'L5',
185
- L6: 'L6',
186
- N: 'N',
178
+ D1: 'D1',
179
+ D2: 'D2',
180
+ L1: 'L1',
181
+ L2: 'L2',
182
+ L3: 'L3',
183
+ L4: 'L4',
184
+ L5: 'L5',
185
+ L6: 'L6',
186
+ N: 'N'
187
187
  };
188
188
 
189
- exports.BACKSPACE_KEY_CODE = js_constants_keycodes.BACKSPACE_KEY_CODE;
190
- exports.DOWN_KEY_CODE = js_constants_keycodes.DOWN_KEY_CODE;
191
- exports.ENTER_KEY_CODE = js_constants_keycodes.ENTER_KEY_CODE;
192
- exports.ESCAPE_KEY_CODE = js_constants_keycodes.ESCAPE_KEY_CODE;
193
- exports.LEFT_KEY_CODE = js_constants_keycodes.LEFT_KEY_CODE;
194
- exports.RIGHT_KEY_CODE = js_constants_keycodes.RIGHT_KEY_CODE;
195
- exports.SPACE_KEY_CODE = js_constants_keycodes.SPACE_KEY_CODE;
196
- exports.TAB_KEY_CODE = js_constants_keycodes.TAB_KEY_CODE;
197
- exports.UP_KEY_CODE = js_constants_keycodes.UP_KEY_CODE;
198
- exports.Alignment = Alignment;
199
- exports.AspectRatio = AspectRatio;
200
- exports.CSS_PREFIX = CSS_PREFIX;
201
- exports.ColorPalette = ColorPalette;
202
- exports.ColorVariant = ColorVariant;
203
- exports.DIALOG_TRANSITION_DURATION = DIALOG_TRANSITION_DURATION;
204
- exports.EXPANSION_PANEL_TRANSITION_DURATION = EXPANSION_PANEL_TRANSITION_DURATION;
205
- exports.Emphasis = Emphasis;
206
- exports.Kind = Kind;
207
- exports.NOTIFICATION_TRANSITION_DURATION = NOTIFICATION_TRANSITION_DURATION;
208
- exports.Orientation = Orientation;
209
- exports.SLIDESHOW_TRANSITION_DURATION = SLIDESHOW_TRANSITION_DURATION;
210
- exports.Size = Size;
211
- exports.TOOLTIP_HOVER_DELAY = TOOLTIP_HOVER_DELAY;
212
- exports.TOOLTIP_LONG_PRESS_DELAY = TOOLTIP_LONG_PRESS_DELAY;
213
- exports.Theme = Theme;
214
- exports.Typography = Typography;
215
- exports.TypographyCustom = TypographyCustom;
216
- exports.TypographyInterface = TypographyInterface;
217
- exports.TypographyTitleCustom = TypographyTitleCustom;
218
- exports.WhiteSpace = WhiteSpace;
189
+ /** ColorPalette with all possible color variant combination */
190
+
191
+ export { Alignment, AspectRatio, CSS_PREFIX, ColorPalette, ColorVariant, DIALOG_TRANSITION_DURATION, EXPANSION_PANEL_TRANSITION_DURATION, Emphasis, Kind, NOTIFICATION_TRANSITION_DURATION, Orientation, SLIDESHOW_TRANSITION_DURATION, Size, TOOLTIP_HOVER_DELAY, TOOLTIP_LONG_PRESS_DELAY, Theme, Typography, TypographyCustom, TypographyInterface, TypographyTitleCustom, WhiteSpace };
@@ -1,50 +1,46 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
1
  /**
6
2
  * The down key code.
7
3
  */
8
4
  const DOWN_KEY_CODE = 40;
5
+
9
6
  /**
10
7
  * The enter/return key code.
11
8
  */
12
9
  const ENTER_KEY_CODE = 13;
10
+
13
11
  /**
14
12
  * The space key code.
15
13
  */
16
14
  const SPACE_KEY_CODE = 32;
15
+
17
16
  /**
18
17
  * The escape key code.
19
18
  */
20
19
  const ESCAPE_KEY_CODE = 27;
20
+
21
21
  /**
22
22
  * The left key code.
23
23
  */
24
24
  const LEFT_KEY_CODE = 37;
25
+
25
26
  /**
26
27
  * The right key code.
27
28
  */
28
29
  const RIGHT_KEY_CODE = 39;
30
+
29
31
  /**
30
32
  * The tab key code.
31
33
  */
32
34
  const TAB_KEY_CODE = 9;
35
+
33
36
  /**
34
37
  * The up key code.
35
38
  */
36
39
  const UP_KEY_CODE = 38;
40
+
37
41
  /**
38
42
  * The up key code.
39
43
  */
40
44
  const BACKSPACE_KEY_CODE = 8;
41
45
 
42
- exports.BACKSPACE_KEY_CODE = BACKSPACE_KEY_CODE;
43
- exports.DOWN_KEY_CODE = DOWN_KEY_CODE;
44
- exports.ENTER_KEY_CODE = ENTER_KEY_CODE;
45
- exports.ESCAPE_KEY_CODE = ESCAPE_KEY_CODE;
46
- exports.LEFT_KEY_CODE = LEFT_KEY_CODE;
47
- exports.RIGHT_KEY_CODE = RIGHT_KEY_CODE;
48
- exports.SPACE_KEY_CODE = SPACE_KEY_CODE;
49
- exports.TAB_KEY_CODE = TAB_KEY_CODE;
50
- exports.UP_KEY_CODE = UP_KEY_CODE;
46
+ export { BACKSPACE_KEY_CODE, DOWN_KEY_CODE, ENTER_KEY_CODE, ESCAPE_KEY_CODE, LEFT_KEY_CODE, RIGHT_KEY_CODE, SPACE_KEY_CODE, TAB_KEY_CODE, UP_KEY_CODE };
@@ -1,21 +1,17 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
1
  /**
6
2
  * Generate CSS variables for the given color palette.
7
3
  */
8
4
  function generateCSSColorVariables(palette) {
9
- let output = '';
10
- for (const [color, variants] of Object.entries(palette)) {
11
- if (!variants)
12
- continue;
13
- for (const [variantName, colorValue] of Object.entries(variants)) {
14
- output += `--lumx-color-${color}-${variantName}: ${colorValue};\n`;
15
- }
5
+ let output = '';
6
+ for (const [color, variants] of Object.entries(palette)) {
7
+ if (!variants) continue;
8
+ for (const [variantName, colorValue] of Object.entries(variants)) {
9
+ output += `--lumx-color-${color}-${variantName}: ${colorValue};\n`;
16
10
  }
17
- return output;
11
+ }
12
+ return output;
18
13
  }
14
+
19
15
  /**
20
16
  * Add a css rule in a given sheet.
21
17
  *
@@ -25,13 +21,13 @@ function generateCSSColorVariables(palette) {
25
21
  * @param index The css rule index.
26
22
  */
27
23
  function _addCSSRule(sheet, selector, rules, index) {
28
- if ('insertRule' in sheet) {
29
- sheet.insertRule(`${selector}{${rules}}`, index);
30
- }
31
- else if ('addRule' in sheet) {
32
- sheet.addRule(selector, rules, index);
33
- }
24
+ if ('insertRule' in sheet) {
25
+ sheet.insertRule(`${selector}{${rules}}`, index);
26
+ } else if ('addRule' in sheet) {
27
+ sheet.addRule(selector, rules, index);
28
+ }
34
29
  }
30
+
35
31
  /**
36
32
  * Set primary and secondary custom colors.
37
33
  *
@@ -40,9 +36,8 @@ function _addCSSRule(sheet, selector, rules, index) {
40
36
  * @param selector The selector used to scope the custom colors (defaults to ':root').
41
37
  */
42
38
  function setCustomColors(sheet, colorPalette, selector = ':root') {
43
- const rules = generateCSSColorVariables(colorPalette);
44
- _addCSSRule(sheet, selector, rules, 0);
39
+ const rules = generateCSSColorVariables(colorPalette);
40
+ _addCSSRule(sheet, selector, rules, 0);
45
41
  }
46
42
 
47
- exports.generateCSSColorVariables = generateCSSColorVariables;
48
- exports.setCustomColors = setCustomColors;
43
+ export { generateCSSColorVariables, setCustomColors };
@@ -1,2 +1 @@
1
- 'use strict';
2
1
 
package/js/types/Falsy.js CHANGED
@@ -1,2 +1 @@
1
- 'use strict';
2
1
 
@@ -1,2 +1 @@
1
- 'use strict';
2
1
 
@@ -1,2 +1 @@
1
- 'use strict';
2
1
 
@@ -1,2 +1 @@
1
- 'use strict';
2
1
 
@@ -1,2 +1 @@
1
- 'use strict';
2
1
 
@@ -1,2 +1 @@
1
- 'use strict';
2
1
 
@@ -1,2 +1 @@
1
- 'use strict';
2
1
 
package/js/types/Point.js CHANGED
@@ -1,2 +1 @@
1
- 'use strict';
2
1
 
@@ -1,2 +1 @@
1
- 'use strict';
2
1
 
@@ -1,2 +1 @@
1
- 'use strict';
2
1
 
@@ -1,2 +1 @@
1
- 'use strict';
2
1
 
@@ -1,2 +1 @@
1
- 'use strict';
2
1
 
package/js/types/index.js CHANGED
@@ -1,2 +1 @@
1
- 'use strict';
2
1
 
@@ -1,20 +1,15 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var js_constants_index = require('../../constants/index.js');
6
- var js_utils_className_resolveColorWithVariants = require('./resolveColorWithVariants.js');
7
- require('../../constants/keycodes.js');
1
+ import { ColorVariant } from '../../constants/index.js';
2
+ import { resolveColorWithVariants } from './resolveColorWithVariants.js';
3
+ import '../../constants/keycodes.js';
8
4
 
9
5
  /**
10
6
  * Returns the classname associated to the given color and variant.
11
7
  * For example, for 'dark' and 'L2' it returns `lumx-color-font-dark-L2`
12
8
  */
13
9
  function fontColorClass(propColor, propColorVariant) {
14
- if (!propColor)
15
- return undefined;
16
- const [color, colorVariant = js_constants_index.ColorVariant.N] = js_utils_className_resolveColorWithVariants.resolveColorWithVariants(propColor, propColorVariant);
17
- return `lumx-color-font-${color}-${colorVariant}`;
10
+ if (!propColor) return undefined;
11
+ const [color, colorVariant = ColorVariant.N] = resolveColorWithVariants(propColor, propColorVariant);
12
+ return `lumx-color-font-${color}-${colorVariant}`;
18
13
  }
19
14
 
20
- exports.fontColorClass = fontColorClass;
15
+ export { fontColorClass };
@@ -1,18 +1,16 @@
1
- 'use strict';
1
+ import { fontColorClass } from './fontColorClass.js';
2
+ import '../../constants/index.js';
3
+ import '../../constants/keycodes.js';
4
+ import './resolveColorWithVariants.js';
2
5
 
3
- var js_utils_className_fontColorClass = require('./fontColorClass.js');
4
- require('../../constants/index.js');
5
- require('../../constants/keycodes.js');
6
- require('./resolveColorWithVariants.js');
7
-
8
- describe(js_utils_className_fontColorClass.fontColorClass, () => {
9
- it('should get lumx class for font color', () => {
10
- expect(js_utils_className_fontColorClass.fontColorClass('dark')).toBe('lumx-color-font-dark-N');
11
- });
12
- it('should get lumx class for font color with variant', () => {
13
- expect(js_utils_className_fontColorClass.fontColorClass('red', 'L2')).toBe('lumx-color-font-red-L2');
14
- });
15
- it('should get lumx class for font color with variant with override', () => {
16
- expect(js_utils_className_fontColorClass.fontColorClass('red-N', 'L2')).toBe('lumx-color-font-red-L2');
17
- });
6
+ describe(fontColorClass, () => {
7
+ it('should get lumx class for font color', () => {
8
+ expect(fontColorClass('dark')).toBe('lumx-color-font-dark-N');
9
+ });
10
+ it('should get lumx class for font color with variant', () => {
11
+ expect(fontColorClass('red', 'L2')).toBe('lumx-color-font-red-L2');
12
+ });
13
+ it('should get lumx class for font color with variant with override', () => {
14
+ expect(fontColorClass('red-N', 'L2')).toBe('lumx-color-font-red-L2');
15
+ });
18
16
  });
@@ -1,14 +1,5 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var isBoolean = require('lodash/isBoolean');
6
- var kebabCase = require('lodash/kebabCase');
7
-
8
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
-
10
- var isBoolean__default = /*#__PURE__*/_interopDefaultLegacy(isBoolean);
11
- var kebabCase__default = /*#__PURE__*/_interopDefaultLegacy(kebabCase);
1
+ import isBoolean from 'lodash/isBoolean';
2
+ import kebabCase from 'lodash/kebabCase';
12
3
 
13
4
  /**
14
5
  * Get the basic CSS class for the given type.
@@ -18,19 +9,23 @@ var kebabCase__default = /*#__PURE__*/_interopDefaultLegacy(kebabCase);
18
9
  * @param value The value of the type of the CSS class (e.g.: 'primary', 'button', ...).
19
10
  * @return The basic CSS class.
20
11
  */
21
- function getBasicClass({ prefix, type, value, }) {
22
- if (isBoolean__default["default"](value)) {
23
- if (!value) {
24
- // False value should not return a class.
25
- return '';
26
- }
27
- const booleanPrefixes = ['has', 'is'];
28
- if (booleanPrefixes.some((booleanPrefix) => type.toString().startsWith(booleanPrefix))) {
29
- return `${prefix}--${kebabCase__default["default"](type)}`;
30
- }
31
- return `${prefix}--is-${kebabCase__default["default"](type)}`;
12
+ function getBasicClass({
13
+ prefix,
14
+ type,
15
+ value
16
+ }) {
17
+ if (isBoolean(value)) {
18
+ if (!value) {
19
+ // False value should not return a class.
20
+ return '';
21
+ }
22
+ const booleanPrefixes = ['has', 'is'];
23
+ if (booleanPrefixes.some(booleanPrefix => type.toString().startsWith(booleanPrefix))) {
24
+ return `${prefix}--${kebabCase(type)}`;
32
25
  }
33
- return `${prefix}--${kebabCase__default["default"](type)}-${value}`;
26
+ return `${prefix}--is-${kebabCase(type)}`;
27
+ }
28
+ return `${prefix}--${kebabCase(type)}-${value}`;
34
29
  }
35
30
 
36
- exports.getBasicClass = getBasicClass;
31
+ export { getBasicClass };