@lumx/core 3.19.0 → 3.19.1-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/js/constants/index.js +167 -0
- package/js/constants/index.min.js +1 -1
- package/js/constants/index.ts +195 -0
- package/js/types/Callback.js +2 -0
- package/js/types/Callback.min.js +1 -0
- package/js/types/Callback.ts +4 -0
- package/js/types/Falsy.js +2 -0
- package/js/types/Falsy.min.js +1 -0
- package/js/types/Falsy.ts +5 -0
- package/js/types/GenericProps.js +2 -0
- package/js/types/GenericProps.min.js +1 -0
- package/js/types/GenericProps.ts +11 -0
- package/js/types/HasAriaLabelOrLabelledBy.js +2 -0
- package/js/types/HasAriaLabelOrLabelledBy.min.js +1 -0
- package/js/types/HasAriaLabelOrLabelledBy.ts +19 -0
- package/js/types/HasClassName.js +2 -0
- package/js/types/HasClassName.min.js +1 -0
- package/js/types/HasClassName.ts +6 -0
- package/js/types/HasCloseMode.js +2 -0
- package/js/types/HasCloseMode.min.js +1 -0
- package/js/types/HasCloseMode.ts +7 -0
- package/js/types/HasTheme.js +2 -0
- package/js/types/HasTheme.min.js +1 -0
- package/js/types/HasTheme.ts +8 -0
- package/js/types/HeadingElement.js +2 -0
- package/js/types/HeadingElement.min.js +1 -0
- package/js/types/HeadingElement.ts +2 -0
- package/js/types/Point.js +2 -0
- package/js/types/Point.min.js +1 -0
- package/js/types/Point.ts +4 -0
- package/js/types/Predicate.js +2 -0
- package/js/types/Predicate.min.js +1 -0
- package/js/types/Predicate.ts +2 -0
- package/js/types/RectSize.js +2 -0
- package/js/types/RectSize.min.js +1 -0
- package/js/types/RectSize.ts +4 -0
- package/js/types/TextElement.js +2 -0
- package/js/types/TextElement.min.js +1 -0
- package/js/types/TextElement.ts +4 -0
- package/js/types/ValueOf.js +2 -0
- package/js/types/ValueOf.min.js +1 -0
- package/js/types/ValueOf.ts +2 -0
- package/js/types/index.js +2 -0
- package/js/types/index.min.js +1 -0
- package/js/types/index.ts +13 -0
- package/js/utils/className/fontColorClass.js +20 -0
- package/js/utils/className/fontColorClass.min.js +1 -0
- package/js/utils/className/fontColorClass.test.js +18 -0
- package/js/utils/className/fontColorClass.test.min.js +1 -0
- package/js/utils/className/fontColorClass.test.ts +15 -0
- package/js/utils/className/fontColorClass.ts +12 -0
- package/js/utils/className/getBasicClass.js +36 -0
- package/js/utils/className/getBasicClass.min.js +1 -0
- package/js/utils/className/getBasicClass.test.js +22 -0
- package/js/utils/className/getBasicClass.test.min.js +1 -0
- package/js/utils/className/getBasicClass.test.ts +20 -0
- package/js/utils/className/getBasicClass.ts +36 -0
- package/js/utils/className/getRootClassName.js +33 -0
- package/js/utils/className/getRootClassName.min.js +1 -0
- package/js/utils/className/getRootClassName.test.js +15 -0
- package/js/utils/className/getRootClassName.test.min.js +1 -0
- package/js/utils/className/getRootClassName.test.ts +11 -0
- package/js/utils/className/getRootClassName.ts +25 -0
- package/js/utils/className/getTypographyClassName.js +13 -0
- package/js/utils/className/getTypographyClassName.min.js +1 -0
- package/js/utils/className/getTypographyClassName.test.js +9 -0
- package/js/utils/className/getTypographyClassName.test.min.js +1 -0
- package/js/utils/className/getTypographyClassName.test.ts +7 -0
- package/js/utils/className/getTypographyClassName.ts +9 -0
- package/js/utils/className/handleBasicClasses.js +52 -0
- package/js/utils/className/handleBasicClasses.min.js +1 -0
- package/js/utils/className/handleBasicClasses.test.js +35 -0
- package/js/utils/className/handleBasicClasses.test.min.js +1 -0
- package/js/utils/className/handleBasicClasses.test.ts +28 -0
- package/js/utils/className/handleBasicClasses.ts +44 -0
- package/js/utils/className/index.js +25 -0
- package/js/utils/className/index.min.js +1 -0
- package/js/utils/className/index.ts +6 -0
- package/js/utils/className/resolveColorWithVariants.js +13 -0
- package/js/utils/className/resolveColorWithVariants.min.js +1 -0
- package/js/utils/className/resolveColorWithVariants.test.js +30 -0
- package/js/utils/className/resolveColorWithVariants.test.min.js +1 -0
- package/js/utils/className/resolveColorWithVariants.test.ts +33 -0
- package/js/utils/className/resolveColorWithVariants.ts +11 -0
- package/js/{utils.js → utils/index.js} +48 -96
- package/js/utils/index.min.js +1 -0
- package/js/{utils.ts → utils/index.ts} +41 -116
- package/package.json +2 -1
- package/js/utils.min.js +0 -1
package/js/constants/index.js
CHANGED
|
@@ -32,6 +32,159 @@ const TOOLTIP_LONG_PRESS_DELAY = {
|
|
|
32
32
|
open: 250,
|
|
33
33
|
close: 3000,
|
|
34
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Alignments.
|
|
37
|
+
*/
|
|
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',
|
|
49
|
+
};
|
|
50
|
+
const Theme = {
|
|
51
|
+
light: 'light',
|
|
52
|
+
dark: 'dark',
|
|
53
|
+
};
|
|
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',
|
|
67
|
+
};
|
|
68
|
+
const Orientation = {
|
|
69
|
+
horizontal: 'horizontal',
|
|
70
|
+
vertical: 'vertical',
|
|
71
|
+
};
|
|
72
|
+
const Emphasis = {
|
|
73
|
+
low: 'low',
|
|
74
|
+
medium: 'medium',
|
|
75
|
+
high: 'high',
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* List of typographies that can't be customized.
|
|
79
|
+
*/
|
|
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',
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* List of title typographies that can be customized (via CSS variables).
|
|
93
|
+
*/
|
|
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',
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* List of typographies that can be customized (via CSS variables).
|
|
104
|
+
*/
|
|
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',
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* List of all typographies.
|
|
116
|
+
*/
|
|
117
|
+
const Typography = {
|
|
118
|
+
...TypographyInterface,
|
|
119
|
+
custom: TypographyCustom,
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* All available aspect ratios.
|
|
123
|
+
*/
|
|
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',
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Semantic info about the purpose of the component
|
|
142
|
+
*/
|
|
143
|
+
const Kind = {
|
|
144
|
+
info: 'info',
|
|
145
|
+
success: 'success',
|
|
146
|
+
warning: 'warning',
|
|
147
|
+
error: 'error',
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* All available white-space values
|
|
151
|
+
* */
|
|
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',
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* See SCSS variable $lumx-color-palette
|
|
162
|
+
*/
|
|
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',
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* See SCSS variable $lumx-color-variants
|
|
176
|
+
*/
|
|
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',
|
|
187
|
+
};
|
|
35
188
|
|
|
36
189
|
exports.BACKSPACE_KEY_CODE = js_constants_keycodes.BACKSPACE_KEY_CODE;
|
|
37
190
|
exports.DOWN_KEY_CODE = js_constants_keycodes.DOWN_KEY_CODE;
|
|
@@ -42,10 +195,24 @@ exports.RIGHT_KEY_CODE = js_constants_keycodes.RIGHT_KEY_CODE;
|
|
|
42
195
|
exports.SPACE_KEY_CODE = js_constants_keycodes.SPACE_KEY_CODE;
|
|
43
196
|
exports.TAB_KEY_CODE = js_constants_keycodes.TAB_KEY_CODE;
|
|
44
197
|
exports.UP_KEY_CODE = js_constants_keycodes.UP_KEY_CODE;
|
|
198
|
+
exports.Alignment = Alignment;
|
|
199
|
+
exports.AspectRatio = AspectRatio;
|
|
45
200
|
exports.CSS_PREFIX = CSS_PREFIX;
|
|
201
|
+
exports.ColorPalette = ColorPalette;
|
|
202
|
+
exports.ColorVariant = ColorVariant;
|
|
46
203
|
exports.DIALOG_TRANSITION_DURATION = DIALOG_TRANSITION_DURATION;
|
|
47
204
|
exports.EXPANSION_PANEL_TRANSITION_DURATION = EXPANSION_PANEL_TRANSITION_DURATION;
|
|
205
|
+
exports.Emphasis = Emphasis;
|
|
206
|
+
exports.Kind = Kind;
|
|
48
207
|
exports.NOTIFICATION_TRANSITION_DURATION = NOTIFICATION_TRANSITION_DURATION;
|
|
208
|
+
exports.Orientation = Orientation;
|
|
49
209
|
exports.SLIDESHOW_TRANSITION_DURATION = SLIDESHOW_TRANSITION_DURATION;
|
|
210
|
+
exports.Size = Size;
|
|
50
211
|
exports.TOOLTIP_HOVER_DELAY = TOOLTIP_HOVER_DELAY;
|
|
51
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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
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"};
|
package/js/constants/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ValueOf } from '../types/ValueOf';
|
|
1
2
|
/**
|
|
2
3
|
* The prefix to use for the CSS classes.
|
|
3
4
|
*/
|
|
@@ -34,3 +35,197 @@ export const TOOLTIP_LONG_PRESS_DELAY = {
|
|
|
34
35
|
open: 250,
|
|
35
36
|
close: 3000,
|
|
36
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
|
+
>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HasClassName } from './HasClassName';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Define a generic props types.
|
|
5
|
+
*/
|
|
6
|
+
export interface GenericProps extends HasClassName {
|
|
7
|
+
/**
|
|
8
|
+
* Any prop (particularly any supported prop for a HTML element).
|
|
9
|
+
*/
|
|
10
|
+
[propName: string]: any;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type { Callback } from './Callback';
|
|
2
|
+
export type { Falsy } from './Falsy';
|
|
3
|
+
export type { HasAriaLabelOrLabelledBy } from './HasAriaLabelOrLabelledBy';
|
|
4
|
+
export type { HasClassName } from './HasClassName';
|
|
5
|
+
export type { HasCloseMode } from './HasCloseMode';
|
|
6
|
+
export type { HasTheme } from './HasTheme';
|
|
7
|
+
export type { GenericProps } from './GenericProps';
|
|
8
|
+
export type { HeadingElement } from './HeadingElement';
|
|
9
|
+
export type { Point } from './Point';
|
|
10
|
+
export type { Predicate } from './Predicate';
|
|
11
|
+
export type { RectSize } from './RectSize';
|
|
12
|
+
export type { TextElement } from './TextElement';
|
|
13
|
+
export type { ValueOf } from './ValueOf';
|
|
@@ -0,0 +1,20 @@
|
|
|
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');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Returns the classname associated to the given color and variant.
|
|
11
|
+
* For example, for 'dark' and 'L2' it returns `lumx-color-font-dark-L2`
|
|
12
|
+
*/
|
|
13
|
+
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}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.fontColorClass = fontColorClass;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("../../constants/index.min.js"),e=require("./resolveColorWithVariants.min.js");require("../../constants/keycodes.min.js"),exports.fontColorClass=function(o,t){if(!o)return;const[s,n=r.ColorVariant.N]=e.resolveColorWithVariants(o,t);return`lumx-color-font-${s}-${n}`};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
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
|
+
});
|
|
18
|
+
});
|