@lumx/core 3.20.1-alpha.5 → 3.20.1-alpha.50

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 (156) hide show
  1. package/CONTRIBUTING.md +1 -5
  2. package/{js/utils/className/resolveColorWithVariants.js → _internal/DPnPEC08.js} +1 -5
  3. package/js/constants/_internal/design-tokens.d.ts +5421 -0
  4. package/js/constants/className/index.d.ts +4 -0
  5. package/js/constants/className/index.js +6 -0
  6. package/js/constants/components/index.d.ts +24 -0
  7. package/js/constants/components/index.js +26 -0
  8. package/js/constants/enums/index.d.ts +200 -0
  9. package/js/constants/enums/index.js +155 -0
  10. package/js/constants/index.d.ts +4 -0
  11. package/js/constants/index.js +4 -218
  12. package/js/constants/keycodes/index.d.ts +36 -0
  13. package/js/constants/{keycodes.js → keycodes/index.js} +1 -13
  14. package/js/types/Direction.d.ts +1 -0
  15. package/js/types/{GenericProps.ts → GenericProps.d.ts} +0 -1
  16. package/js/types/HasAriaLabelOrLabelledBy.d.ts +17 -0
  17. package/js/types/{HasTheme.ts → HasTheme.d.ts} +0 -1
  18. package/js/types/KebabCase.d.ts +2 -0
  19. package/js/types/LumxClassName.d.ts +3 -0
  20. package/js/types/Point.d.ts +7 -0
  21. package/js/types/RectSize.d.ts +7 -0
  22. package/js/types/Spacing.d.ts +1 -0
  23. package/js/types/{TextElement.ts → TextElement.d.ts} +0 -1
  24. package/js/types/{index.ts → index.d.ts} +4 -0
  25. package/js/types/index.js +0 -1
  26. package/js/utils/_internal/color/index.d.ts +1 -0
  27. package/js/utils/_internal/color/resolveColorWithVariants.d.ts +3 -0
  28. package/js/utils/classNames/bem/block.d.ts +18 -0
  29. package/js/utils/classNames/bem/block.js +20 -0
  30. package/js/utils/classNames/bem/element.d.ts +19 -0
  31. package/js/utils/classNames/bem/element.js +21 -0
  32. package/js/utils/classNames/bem/generateBEMClass.d.ts +27 -0
  33. package/js/utils/classNames/bem/generateBEMClass.js +48 -0
  34. package/js/utils/classNames/bem/index.d.ts +2 -0
  35. package/js/utils/classNames/bem/index.js +2 -0
  36. package/js/utils/classNames/color/index.d.ts +43 -0
  37. package/js/utils/classNames/color/index.js +50 -0
  38. package/js/utils/classNames/index.d.ts +6 -0
  39. package/js/utils/classNames/index.js +7 -0
  40. package/js/utils/classNames/spacing/index.d.ts +70 -0
  41. package/js/utils/classNames/spacing/index.js +74 -0
  42. package/js/utils/classNames/typography/index.d.ts +6 -0
  43. package/js/utils/classNames/typography/index.js +9 -0
  44. package/js/utils/classNames/visually-hidden/index.d.ts +5 -0
  45. package/js/utils/classNames/visually-hidden/index.js +10 -0
  46. package/js/utils/events/index.d.ts +2 -0
  47. package/js/utils/events/index.js +2 -0
  48. package/js/utils/events/keyboard.d.ts +24 -0
  49. package/js/utils/events/keyboard.js +44 -0
  50. package/js/utils/events/swipe.d.ts +6 -0
  51. package/js/utils/events/swipe.js +79 -0
  52. package/js/utils/index.d.ts +2 -0
  53. package/js/utils/index.js +4 -223
  54. package/lumx.css +18 -17
  55. package/package.json +11 -15
  56. package/scss/components/list/_index.scss +10 -4
  57. package/scss/components/text-field/_index.scss +4 -6
  58. package/js/components/Icon/Stories.js +0 -40
  59. package/js/components/Icon/Tests.tsx +0 -120
  60. package/js/components/Icon/index.tsx +0 -134
  61. package/js/constants/design-tokens.js +0 -2329
  62. package/js/constants/design-tokens.min.js +0 -1
  63. package/js/constants/design-tokens.ts +0 -2324
  64. package/js/constants/index.min.js +0 -1
  65. package/js/constants/index.ts +0 -231
  66. package/js/constants/keycodes.min.js +0 -1
  67. package/js/constants/keycodes.ts +0 -44
  68. package/js/custom-colors.js +0 -48
  69. package/js/custom-colors.min.js +0 -1
  70. package/js/custom-colors.ts +0 -56
  71. package/js/date-picker.js +0 -71
  72. package/js/date-picker.min.js +0 -1
  73. package/js/date-picker.ts +0 -77
  74. package/js/types/Callback.js +0 -2
  75. package/js/types/Callback.min.js +0 -1
  76. package/js/types/Falsy.js +0 -2
  77. package/js/types/Falsy.min.js +0 -1
  78. package/js/types/GenericProps.js +0 -2
  79. package/js/types/GenericProps.min.js +0 -1
  80. package/js/types/HasAriaLabelOrLabelledBy.js +0 -2
  81. package/js/types/HasAriaLabelOrLabelledBy.min.js +0 -1
  82. package/js/types/HasAriaLabelOrLabelledBy.ts +0 -19
  83. package/js/types/HasClassName.js +0 -2
  84. package/js/types/HasClassName.min.js +0 -1
  85. package/js/types/HasCloseMode.js +0 -2
  86. package/js/types/HasCloseMode.min.js +0 -1
  87. package/js/types/HasTheme.js +0 -2
  88. package/js/types/HasTheme.min.js +0 -1
  89. package/js/types/HeadingElement.js +0 -2
  90. package/js/types/HeadingElement.min.js +0 -1
  91. package/js/types/Point.js +0 -2
  92. package/js/types/Point.min.js +0 -1
  93. package/js/types/Point.ts +0 -4
  94. package/js/types/Predicate.js +0 -2
  95. package/js/types/Predicate.min.js +0 -1
  96. package/js/types/RectSize.js +0 -2
  97. package/js/types/RectSize.min.js +0 -1
  98. package/js/types/RectSize.ts +0 -4
  99. package/js/types/TextElement.js +0 -2
  100. package/js/types/TextElement.min.js +0 -1
  101. package/js/types/ValueOf.js +0 -2
  102. package/js/types/ValueOf.min.js +0 -1
  103. package/js/types/index.min.js +0 -1
  104. package/js/utils/className/fontColorClass.js +0 -20
  105. package/js/utils/className/fontColorClass.min.js +0 -1
  106. package/js/utils/className/fontColorClass.test.js +0 -18
  107. package/js/utils/className/fontColorClass.test.min.js +0 -1
  108. package/js/utils/className/fontColorClass.test.ts +0 -15
  109. package/js/utils/className/fontColorClass.ts +0 -12
  110. package/js/utils/className/getBasicClass.js +0 -36
  111. package/js/utils/className/getBasicClass.min.js +0 -1
  112. package/js/utils/className/getBasicClass.test.js +0 -22
  113. package/js/utils/className/getBasicClass.test.min.js +0 -1
  114. package/js/utils/className/getBasicClass.test.ts +0 -20
  115. package/js/utils/className/getBasicClass.ts +0 -36
  116. package/js/utils/className/getRootClassName.js +0 -33
  117. package/js/utils/className/getRootClassName.min.js +0 -1
  118. package/js/utils/className/getRootClassName.test.js +0 -15
  119. package/js/utils/className/getRootClassName.test.min.js +0 -1
  120. package/js/utils/className/getRootClassName.test.ts +0 -11
  121. package/js/utils/className/getRootClassName.ts +0 -25
  122. package/js/utils/className/getTypographyClassName.js +0 -13
  123. package/js/utils/className/getTypographyClassName.min.js +0 -1
  124. package/js/utils/className/getTypographyClassName.test.js +0 -9
  125. package/js/utils/className/getTypographyClassName.test.min.js +0 -1
  126. package/js/utils/className/getTypographyClassName.test.ts +0 -7
  127. package/js/utils/className/getTypographyClassName.ts +0 -9
  128. package/js/utils/className/handleBasicClasses.js +0 -52
  129. package/js/utils/className/handleBasicClasses.min.js +0 -1
  130. package/js/utils/className/handleBasicClasses.test.js +0 -35
  131. package/js/utils/className/handleBasicClasses.test.min.js +0 -1
  132. package/js/utils/className/handleBasicClasses.test.ts +0 -28
  133. package/js/utils/className/handleBasicClasses.ts +0 -44
  134. package/js/utils/className/index.js +0 -25
  135. package/js/utils/className/index.min.js +0 -1
  136. package/js/utils/className/index.ts +0 -6
  137. package/js/utils/className/resolveColorWithVariants.min.js +0 -1
  138. package/js/utils/className/resolveColorWithVariants.test.js +0 -30
  139. package/js/utils/className/resolveColorWithVariants.test.min.js +0 -1
  140. package/js/utils/className/resolveColorWithVariants.test.ts +0 -33
  141. package/js/utils/className/resolveColorWithVariants.ts +0 -11
  142. package/js/utils/index.min.js +0 -1
  143. package/js/utils/index.ts +0 -221
  144. package/lumx.min.css +0 -1
  145. package/stories/controls/color.ts +0 -7
  146. package/stories/controls/icons.ts +0 -126
  147. package/stories/controls/selectArgType.ts +0 -8
  148. package/stories/controls/withUndefined.ts +0 -1
  149. package/testing/utils/queries.ts +0 -19
  150. /package/js/types/{Callback.ts → Callback.d.ts} +0 -0
  151. /package/js/types/{Falsy.ts → Falsy.d.ts} +0 -0
  152. /package/js/types/{HasClassName.ts → HasClassName.d.ts} +0 -0
  153. /package/js/types/{HasCloseMode.ts → HasCloseMode.d.ts} +0 -0
  154. /package/js/types/{HeadingElement.ts → HeadingElement.d.ts} +0 -0
  155. /package/js/types/{Predicate.ts → Predicate.d.ts} +0 -0
  156. /package/js/types/{ValueOf.ts → ValueOf.d.ts} +0 -0
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./keycodes.min.js");const t={overline:"overline",caption:"caption",body1:"body1",body2:"body2",subtitle1:"subtitle1",subtitle2:"subtitle2",title:"title",headline:"headline",display1:"display1"},o={title1:"custom-title1",title2:"custom-title2",title3:"custom-title3",title4:"custom-title4",title5:"custom-title5",title6:"custom-title6"},r={...o,intro:"custom-intro","body-large":"custom-body-large",body:"custom-body",quote:"custom-quote","publish-info":"custom-publish-info",button:"custom-button"},s={...t,custom:r};exports.BACKSPACE_KEY_CODE=e.BACKSPACE_KEY_CODE,exports.DOWN_KEY_CODE=e.DOWN_KEY_CODE,exports.ENTER_KEY_CODE=e.ENTER_KEY_CODE,exports.ESCAPE_KEY_CODE=e.ESCAPE_KEY_CODE,exports.LEFT_KEY_CODE=e.LEFT_KEY_CODE,exports.RIGHT_KEY_CODE=e.RIGHT_KEY_CODE,exports.SPACE_KEY_CODE=e.SPACE_KEY_CODE,exports.TAB_KEY_CODE=e.TAB_KEY_CODE,exports.UP_KEY_CODE=e.UP_KEY_CODE,exports.Alignment={bottom:"bottom",center:"center",end:"end",left:"left",right:"right",spaceAround:"space-around",spaceBetween:"space-between",spaceEvenly:"space-evenly",start:"start",top:"top"},exports.AspectRatio={original:"original",panoramic:"panoramic",wide:"wide",horizontal:"horizontal",vertical:"vertical",square:"square",free:"free"},exports.CSS_PREFIX="lumx",exports.ColorPalette={primary:"primary",secondary:"secondary",blue:"blue",dark:"dark",green:"green",yellow:"yellow",red:"red",light:"light",grey:"grey"},exports.ColorVariant={D1:"D1",D2:"D2",L1:"L1",L2:"L2",L3:"L3",L4:"L4",L5:"L5",L6:"L6",N:"N"},exports.DIALOG_TRANSITION_DURATION=400,exports.EXPANSION_PANEL_TRANSITION_DURATION=400,exports.Emphasis={low:"low",medium:"medium",high:"high"},exports.Kind={info:"info",success:"success",warning:"warning",error:"error"},exports.NOTIFICATION_TRANSITION_DURATION=200,exports.Orientation={horizontal:"horizontal",vertical:"vertical"},exports.SLIDESHOW_TRANSITION_DURATION=5e3,exports.Size={xxs:"xxs",xs:"xs",s:"s",m:"m",l:"l",xl:"xl",xxl:"xxl",tiny:"tiny",regular:"regular",medium:"medium",big:"big",huge:"huge"},exports.TOOLTIP_HOVER_DELAY={open:500,close:500},exports.TOOLTIP_LONG_PRESS_DELAY={open:250,close:3e3},exports.Theme={light:"light",dark:"dark"},exports.Typography=s,exports.TypographyCustom=r,exports.TypographyInterface=t,exports.TypographyTitleCustom=o,exports.WhiteSpace={normal:"normal",nowrap:"nowrap",pre:"pre","pre-wrap":"pre-wrap","pre-line":"pre-line","break-spaces":"break-spaces"};
@@ -1,231 +0,0 @@
1
- import { ValueOf } from '../types/ValueOf';
2
- /**
3
- * The prefix to use for the CSS classes.
4
- */
5
- export const CSS_PREFIX = 'lumx';
6
-
7
- /**
8
- * Key codes.
9
- */
10
- export * from './keycodes';
11
-
12
- /**
13
- * Animation duration constants. Take into consideration that if you change one of these variables,
14
- * you need to update their scss counterpart as well
15
- */
16
- export const DIALOG_TRANSITION_DURATION = 400;
17
- export const EXPANSION_PANEL_TRANSITION_DURATION = 400;
18
- export const NOTIFICATION_TRANSITION_DURATION = 200;
19
- export const SLIDESHOW_TRANSITION_DURATION = 5000;
20
-
21
- /**
22
- * Delay on hover after which we open or close the tooltip.
23
- * Only applies to devices supporting pointer hover.
24
- */
25
- export const TOOLTIP_HOVER_DELAY = {
26
- open: 500,
27
- close: 500,
28
- };
29
-
30
- /**
31
- * Delay on long press after which we open or close the tooltip.
32
- * Only applies to devices not supporting pointer hover.
33
- */
34
- export const TOOLTIP_LONG_PRESS_DELAY = {
35
- open: 250,
36
- close: 3000,
37
- };
38
-
39
- /**
40
- * Alignments.
41
- */
42
- export const Alignment = {
43
- bottom: 'bottom',
44
- center: 'center',
45
- end: 'end',
46
- left: 'left',
47
- right: 'right',
48
- spaceAround: 'space-around',
49
- spaceBetween: 'space-between',
50
- spaceEvenly: 'space-evenly',
51
- start: 'start',
52
- top: 'top',
53
- } as const;
54
- export type Alignment = ValueOf<typeof Alignment>;
55
- export type VerticalAlignment = Extract<Alignment, 'top' | 'center' | 'bottom'>;
56
- export type HorizontalAlignment = Extract<Alignment, 'right' | 'center' | 'left'>;
57
-
58
- export const Theme = {
59
- light: 'light',
60
- dark: 'dark',
61
- } as const;
62
- export type Theme = ValueOf<typeof Theme>;
63
-
64
- export const Size = {
65
- xxs: 'xxs',
66
- xs: 'xs',
67
- s: 's',
68
- m: 'm',
69
- l: 'l',
70
- xl: 'xl',
71
- xxl: 'xxl',
72
- tiny: 'tiny',
73
- regular: 'regular',
74
- medium: 'medium',
75
- big: 'big',
76
- huge: 'huge',
77
- } as const;
78
- export type Size = ValueOf<typeof Size>;
79
- export type GlobalSize = Extract<Size, 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl'>;
80
-
81
- export const Orientation = {
82
- horizontal: 'horizontal',
83
- vertical: 'vertical',
84
- } as const;
85
- export type Orientation = ValueOf<typeof Orientation>;
86
-
87
- export const Emphasis = {
88
- low: 'low',
89
- medium: 'medium',
90
- high: 'high',
91
- } as const;
92
- export type Emphasis = ValueOf<typeof Emphasis>;
93
-
94
- /**
95
- * List of typographies that can't be customized.
96
- */
97
- export const TypographyInterface = {
98
- overline: 'overline',
99
- caption: 'caption',
100
- body1: 'body1',
101
- body2: 'body2',
102
- subtitle1: 'subtitle1',
103
- subtitle2: 'subtitle2',
104
- title: 'title',
105
- headline: 'headline',
106
- display1: 'display1',
107
- } as const;
108
- export type TypographyInterface = ValueOf<typeof TypographyInterface>;
109
-
110
- /**
111
- * List of title typographies that can be customized (via CSS variables).
112
- */
113
- export const TypographyTitleCustom = {
114
- title1: 'custom-title1',
115
- title2: 'custom-title2',
116
- title3: 'custom-title3',
117
- title4: 'custom-title4',
118
- title5: 'custom-title5',
119
- title6: 'custom-title6',
120
- } as const;
121
- export type TypographyTitleCustom = ValueOf<typeof TypographyTitleCustom>;
122
-
123
- /**
124
- * List of typographies that can be customized (via CSS variables).
125
- */
126
- export const TypographyCustom = {
127
- ...TypographyTitleCustom,
128
- intro: 'custom-intro',
129
- 'body-large': 'custom-body-large',
130
- body: 'custom-body',
131
- quote: 'custom-quote',
132
- 'publish-info': 'custom-publish-info',
133
- button: 'custom-button',
134
- } as const;
135
- export type TypographyCustom = ValueOf<typeof TypographyCustom>;
136
-
137
- /**
138
- * List of all typographies.
139
- */
140
- export const Typography = {
141
- ...TypographyInterface,
142
- custom: TypographyCustom,
143
- } as const;
144
- export type Typography = TypographyInterface | TypographyCustom;
145
-
146
- /**
147
- * All available aspect ratios.
148
- */
149
- export const AspectRatio = {
150
- /** Intrinsic content ratio. */
151
- original: 'original',
152
- /** Ratio 3:1 */
153
- panoramic: 'panoramic',
154
- /** Ratio 16:9 */
155
- wide: 'wide',
156
- /** Ratio 3:2 */
157
- horizontal: 'horizontal',
158
- /** Ratio 3:2 */
159
- vertical: 'vertical',
160
- /** Ratio 1:1 */
161
- square: 'square',
162
- /** Ratio constrained by the parent. */
163
- free: 'free',
164
- } as const;
165
- export type AspectRatio = ValueOf<typeof AspectRatio>;
166
-
167
- /**
168
- * Semantic info about the purpose of the component
169
- */
170
- export const Kind = {
171
- info: 'info',
172
- success: 'success',
173
- warning: 'warning',
174
- error: 'error',
175
- } as const;
176
- export type Kind = ValueOf<typeof Kind>;
177
-
178
- /**
179
- * All available white-space values
180
- * */
181
- export const WhiteSpace = {
182
- normal: 'normal',
183
- nowrap: 'nowrap',
184
- pre: 'pre',
185
- 'pre-wrap': 'pre-wrap',
186
- 'pre-line': 'pre-line',
187
- 'break-spaces': 'break-spaces',
188
- };
189
- export type WhiteSpace = ValueOf<typeof WhiteSpace>;
190
-
191
- /**
192
- * See SCSS variable $lumx-color-palette
193
- */
194
- export const ColorPalette = {
195
- primary: 'primary',
196
- secondary: 'secondary',
197
- blue: 'blue',
198
- dark: 'dark',
199
- green: 'green',
200
- yellow: 'yellow',
201
- red: 'red',
202
- light: 'light',
203
- grey: 'grey',
204
- } as const;
205
- export type ColorPalette = ValueOf<typeof ColorPalette>;
206
- export type Color = ColorPalette | string;
207
-
208
- /**
209
- * See SCSS variable $lumx-color-variants
210
- */
211
- export const ColorVariant = {
212
- D1: 'D1',
213
- D2: 'D2',
214
- L1: 'L1',
215
- L2: 'L2',
216
- L3: 'L3',
217
- L4: 'L4',
218
- L5: 'L5',
219
- L6: 'L6',
220
- N: 'N',
221
- } as const;
222
- export type ColorVariant = ValueOf<typeof ColorVariant>;
223
-
224
- /** ColorPalette with all possible color variant combination */
225
- export type ColorWithVariants =
226
- | ColorPalette
227
- | Exclude<
228
- `${ColorPalette}-${ColorVariant}`,
229
- // No dark variant for light and dark
230
- `light-D${number}` | `dark-D${number}`
231
- >;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.BACKSPACE_KEY_CODE=8,exports.DOWN_KEY_CODE=40,exports.ENTER_KEY_CODE=13,exports.ESCAPE_KEY_CODE=27,exports.LEFT_KEY_CODE=37,exports.RIGHT_KEY_CODE=39,exports.SPACE_KEY_CODE=32,exports.TAB_KEY_CODE=9,exports.UP_KEY_CODE=38;
@@ -1,44 +0,0 @@
1
- /**
2
- * The down key code.
3
- */
4
- export const DOWN_KEY_CODE = 40;
5
-
6
- /**
7
- * The enter/return key code.
8
- */
9
- export const ENTER_KEY_CODE = 13;
10
-
11
- /**
12
- * The space key code.
13
- */
14
- export const SPACE_KEY_CODE = 32;
15
-
16
- /**
17
- * The escape key code.
18
- */
19
- export const ESCAPE_KEY_CODE = 27;
20
-
21
- /**
22
- * The left key code.
23
- */
24
- export const LEFT_KEY_CODE = 37;
25
-
26
- /**
27
- * The right key code.
28
- */
29
- export const RIGHT_KEY_CODE = 39;
30
-
31
- /**
32
- * The tab key code.
33
- */
34
- export const TAB_KEY_CODE = 9;
35
-
36
- /**
37
- * The up key code.
38
- */
39
- export const UP_KEY_CODE = 38;
40
-
41
- /**
42
- * The up key code.
43
- */
44
- export const BACKSPACE_KEY_CODE = 8;
@@ -1,48 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- /**
6
- * Generate CSS variables for the given color palette.
7
- */
8
- 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
- }
16
- }
17
- return output;
18
- }
19
- /**
20
- * Add a css rule in a given sheet.
21
- *
22
- * @param sheet The sheet to insert the new rules in.
23
- * @param selector The css rules selector.
24
- * @param rules The css rules.
25
- * @param index The css rule index.
26
- */
27
- 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
- }
34
- }
35
- /**
36
- * Set primary and secondary custom colors.
37
- *
38
- * @param sheet The sheet to insert the custom rules in.
39
- * @param colorPalette The custom color palette.
40
- * @param selector The selector used to scope the custom colors (defaults to ':root').
41
- */
42
- function setCustomColors(sheet, colorPalette, selector = ':root') {
43
- const rules = generateCSSColorVariables(colorPalette);
44
- _addCSSRule(sheet, selector, rules, 0);
45
- }
46
-
47
- exports.generateCSSColorVariables = generateCSSColorVariables;
48
- exports.setCustomColors = setCustomColors;
@@ -1 +0,0 @@
1
- "use strict";function e(e){let t="";for(const[o,r]of Object.entries(e))if(r)for(const[e,n]of Object.entries(r))t+=`--lumx-color-${o}-${e}: ${n};\n`;return t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.generateCSSColorVariables=e,exports.setCustomColors=function(t,o,r=":root"){!function(e,t,o,r){"insertRule"in e?e.insertRule(`${t}{${o}}`,r):"addRule"in e&&e.addRule(t,o,r)}(t,r,e(o),0)};
@@ -1,56 +0,0 @@
1
- interface Variants {
2
- D2?: string;
3
- D1?: string;
4
- N?: string;
5
- L1?: string;
6
- L2?: string;
7
- L3?: string;
8
- L4?: string;
9
- L5?: string;
10
- L6?: string;
11
- }
12
-
13
- type ColorPalette = Partial<Record<'primary' | 'secondary', Variants>>;
14
-
15
- /**
16
- * Generate CSS variables for the given color palette.
17
- */
18
- export function generateCSSColorVariables(palette: ColorPalette): string {
19
- let output = '';
20
- for (const [color, variants] of Object.entries(palette)) {
21
- if (!variants) continue;
22
-
23
- for (const [variantName, colorValue] of Object.entries(variants)) {
24
- output += `--lumx-color-${color}-${variantName}: ${colorValue};\n`;
25
- }
26
- }
27
- return output;
28
- }
29
-
30
- /**
31
- * Add a css rule in a given sheet.
32
- *
33
- * @param sheet The sheet to insert the new rules in.
34
- * @param selector The css rules selector.
35
- * @param rules The css rules.
36
- * @param index The css rule index.
37
- */
38
- function _addCSSRule(sheet: CSSStyleSheet, selector: string, rules: string, index: number) {
39
- if ('insertRule' in sheet) {
40
- sheet.insertRule(`${selector}{${rules}}`, index);
41
- } else if ('addRule' in sheet) {
42
- (sheet as any).addRule(selector, rules, index);
43
- }
44
- }
45
-
46
- /**
47
- * Set primary and secondary custom colors.
48
- *
49
- * @param sheet The sheet to insert the custom rules in.
50
- * @param colorPalette The custom color palette.
51
- * @param selector The selector used to scope the custom colors (defaults to ':root').
52
- */
53
- export function setCustomColors(sheet: CSSStyleSheet, colorPalette: ColorPalette, selector = ':root') {
54
- const rules = generateCSSColorVariables(colorPalette);
55
- _addCSSRule(sheet, selector, rules, 0);
56
- }
package/js/date-picker.js DELETED
@@ -1,71 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var range = require('lodash/range');
6
- var mMoment = require('moment');
7
- var momentRange = require('moment-range');
8
-
9
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
-
11
- var range__default = /*#__PURE__*/_interopDefaultLegacy(range);
12
- var mMoment__default = /*#__PURE__*/_interopDefaultLegacy(mMoment);
13
-
14
- const moment = momentRange.extendMoment(mMoment__default["default"]);
15
- const DAYS_PER_WEEK = 7;
16
- /**
17
- * Get the list of days in a week based on locale.
18
- *
19
- * @deprecated will be removed in next major version along with the removal of moment (no replacement planned)
20
- *
21
- * @param locale The locale using to generate the order of days in a week.
22
- * @return The list of days in a week based on locale.
23
- */
24
- function getWeekDays(locale) {
25
- return range__default["default"](DAYS_PER_WEEK).map((_, i) => moment().locale(locale).weekday(i));
26
- }
27
- /**
28
- * Get month calendar based on locale and start date.
29
- *
30
- * @deprecated will be removed in next major version along with the removal of moment (no replacement planned)
31
- *
32
- * @param locale The locale using to generate the order of days in a week.
33
- * @param selectedMonth The selected month.
34
- * @return The list of days in a week based on locale.
35
- */
36
- function getMonthCalendar(locale, selectedMonth) {
37
- const firstDayOfMonth = moment(selectedMonth).startOf('month');
38
- const endDayOfMonth = moment(selectedMonth).endOf('month');
39
- // The first day of the week depends on the locale used. In FR the first day is a monday but in EN the first day is sunday
40
- const firstDay = firstDayOfMonth.locale(locale).startOf('week');
41
- const monthRange = moment.range(firstDay.toDate(), endDayOfMonth.toDate());
42
- return Array.from(monthRange.by('day'));
43
- }
44
- /**
45
- * Get month calendar based on locale and start date.
46
- * Each day is annotated to know if they are displayed and/or clickable.
47
- *
48
- * @deprecated will be removed in next major version along with the removal of moment (no replacement planned)
49
- *
50
- * @param locale The locale using to generate the order of days in a week.
51
- * @param minDate The first selectable date.
52
- * @param maxDate The last selectable date.
53
- * @param selectedMonth The selected month.
54
- * @return The list of days in a week based on locale.
55
- */
56
- function getAnnotatedMonthCalendar(locale, minDate, maxDate, selectedMonth) {
57
- const month = moment(selectedMonth).locale(locale).month();
58
- const clickableRange = moment.range(minDate, maxDate);
59
- return getMonthCalendar(locale, selectedMonth).map((date) => {
60
- return {
61
- date,
62
- isClickable: clickableRange.contains(date),
63
- isDisplayed: date.month() === month,
64
- isToday: date.isSame(moment(), 'day'),
65
- };
66
- });
67
- }
68
-
69
- exports.getAnnotatedMonthCalendar = getAnnotatedMonthCalendar;
70
- exports.getMonthCalendar = getMonthCalendar;
71
- exports.getWeekDays = getWeekDays;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("lodash/range"),t=require("moment"),n=require("moment-range");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=a(e),r=a(t);const s=n.extendMoment(r.default);function d(e,t){const n=s(t).startOf("month"),a=s(t).endOf("month"),o=n.locale(e).startOf("week"),r=s.range(o.toDate(),a.toDate());return Array.from(r.by("day"))}exports.getAnnotatedMonthCalendar=function(e,t,n,a){const o=s(a).locale(e).month(),r=s.range(t,n);return d(e,a).map(e=>({date:e,isClickable:r.contains(e),isDisplayed:e.month()===o,isToday:e.isSame(s(),"day")}))},exports.getMonthCalendar=d,exports.getWeekDays=function(e){return o.default(7).map((t,n)=>s().locale(e).weekday(n))};
package/js/date-picker.ts DELETED
@@ -1,77 +0,0 @@
1
- import range from 'lodash/range';
2
- import mMoment, { Moment } from 'moment';
3
- import { extendMoment } from 'moment-range';
4
-
5
- const moment = extendMoment(mMoment as any);
6
-
7
- const DAYS_PER_WEEK = 7;
8
-
9
- interface AnnotatedDate {
10
- date: Moment;
11
- isDisplayed: boolean;
12
- isClickable: boolean;
13
- isToday: boolean;
14
- }
15
-
16
- /**
17
- * Get the list of days in a week based on locale.
18
- *
19
- * @deprecated will be removed in next major version along with the removal of moment (no replacement planned)
20
- *
21
- * @param locale The locale using to generate the order of days in a week.
22
- * @return The list of days in a week based on locale.
23
- */
24
- export function getWeekDays(locale: string): Moment[] {
25
- return range(DAYS_PER_WEEK).map((_, i) => moment().locale(locale).weekday(i));
26
- }
27
-
28
- /**
29
- * Get month calendar based on locale and start date.
30
- *
31
- * @deprecated will be removed in next major version along with the removal of moment (no replacement planned)
32
- *
33
- * @param locale The locale using to generate the order of days in a week.
34
- * @param selectedMonth The selected month.
35
- * @return The list of days in a week based on locale.
36
- */
37
- export function getMonthCalendar(locale: string, selectedMonth?: Moment): Moment[] {
38
- const firstDayOfMonth = moment(selectedMonth).startOf('month');
39
- const endDayOfMonth = moment(selectedMonth).endOf('month');
40
- // The first day of the week depends on the locale used. In FR the first day is a monday but in EN the first day is sunday
41
- const firstDay = firstDayOfMonth.locale(locale).startOf('week');
42
- const monthRange = moment.range(firstDay.toDate(), endDayOfMonth.toDate());
43
-
44
- return Array.from(monthRange.by('day'));
45
- }
46
-
47
- /**
48
- * Get month calendar based on locale and start date.
49
- * Each day is annotated to know if they are displayed and/or clickable.
50
- *
51
- * @deprecated will be removed in next major version along with the removal of moment (no replacement planned)
52
- *
53
- * @param locale The locale using to generate the order of days in a week.
54
- * @param minDate The first selectable date.
55
- * @param maxDate The last selectable date.
56
- * @param selectedMonth The selected month.
57
- * @return The list of days in a week based on locale.
58
- */
59
- export function getAnnotatedMonthCalendar(
60
- locale: string,
61
- minDate?: Date,
62
- maxDate?: Date,
63
- selectedMonth?: Moment,
64
- ): AnnotatedDate[] {
65
- const month = moment(selectedMonth).locale(locale).month();
66
-
67
- const clickableRange = moment.range(minDate as Date, maxDate as Date);
68
-
69
- return getMonthCalendar(locale, selectedMonth).map((date) => {
70
- return {
71
- date,
72
- isClickable: clickableRange.contains(date),
73
- isDisplayed: date.month() === month,
74
- isToday: date.isSame(moment(), 'day'),
75
- };
76
- });
77
- }
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1 +0,0 @@
1
- "use strict";
package/js/types/Falsy.js DELETED
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,19 +0,0 @@
1
- /**
2
- * Require either `aria-label` or `arial-labelledby` prop.
3
- * If none are set, the order will prioritize `aria-labelledby` over `aria-label` as it
4
- * needs a visible element.
5
- */
6
- export type HasAriaLabelOrLabelledBy<T = string | undefined> = T extends string
7
- ? {
8
- /**
9
- * The id of the element to use as title of the dialog. Can be within or out of the dialog.
10
- * Although it is not recommended, aria-label can be used instead if no visible element is available.
11
- */
12
- 'aria-labelledby': T;
13
- /** The label of the dialog. */
14
- 'aria-label'?: undefined;
15
- }
16
- : {
17
- 'aria-label': string;
18
- 'aria-labelledby'?: undefined;
19
- };
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1 +0,0 @@
1
- "use strict";
package/js/types/Point.js DELETED
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1 +0,0 @@
1
- "use strict";
package/js/types/Point.ts DELETED
@@ -1,4 +0,0 @@
1
- /**
2
- * A point coordinate in 2D space
3
- */
4
- export type Point = { x: number; y: number };
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,4 +0,0 @@
1
- /**
2
- * Rectangle size
3
- */
4
- export type RectSize = { width: number; height: number };
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1 +0,0 @@
1
- "use strict";