@descope/web-components-ui 1.0.35 → 1.0.37
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +23 -4
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +325 -103
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/313.js +1 -0
- package/dist/umd/599.js +1 -1
- package/dist/umd/97.js +1 -0
- package/dist/umd/descope-button-index-js.js +1 -0
- package/dist/umd/{descope-combo-js.js → descope-combo-index-js.js} +1 -1
- package/dist/umd/descope-container-index-js.js +1 -0
- package/dist/umd/descope-date-picker-index-js.js +1 -0
- package/dist/umd/descope-text-field-index-js.js +1 -0
- package/dist/umd/index.js +1 -1
- package/package.json +1 -1
- package/src/components/{descope-button.js → descope-button/Button.js} +5 -7
- package/src/components/descope-button/index.js +6 -0
- package/src/components/{descope-combo.js → descope-combo/index.js} +3 -3
- package/src/components/descope-container/Container.js +57 -0
- package/src/components/descope-container/index.js +5 -0
- package/src/components/{descope-date-picker.js → descope-date-picker/index.js} +3 -2
- package/src/components/{descope-text-field.js → descope-text-field/TextField.js} +5 -6
- package/src/components/descope-text-field/index.js +6 -0
- package/src/componentsHelpers/componentNameValidationMixin.js +21 -0
- package/src/componentsHelpers/createProxy/index.js +1 -9
- package/src/componentsHelpers/createStyleMixin/helpers.js +7 -5
- package/src/componentsHelpers/createStyleMixin/index.js +39 -3
- package/src/componentsHelpers/draggableMixin.js +2 -2
- package/src/componentsHelpers/index.js +1 -0
- package/src/componentsHelpers/inputMixin.js +1 -1
- package/src/helpers.js +1 -1
- package/src/index.js +1 -0
- package/src/index.umd.js +5 -2
- package/src/theme/components/button.js +36 -35
- package/src/theme/components/container.js +94 -0
- package/src/theme/components/index.js +3 -1
- package/src/theme/components/textField.js +27 -24
- package/src/theme/globals.js +2 -0
- package/src/theme/index.js +1 -1
- package/src/themeHelpers/index.js +23 -5
- package/dist/umd/146.js +0 -1
- package/dist/umd/descope-button-js.js +0 -1
- package/dist/umd/descope-date-picker-js.js +0 -1
- package/dist/umd/descope-text-field-js.js +0 -1
package/dist/index.esm.js
CHANGED
@@ -14,14 +14,14 @@ const kebabCase = str => str
|
|
14
14
|
|
15
15
|
const kebabCaseJoin = (...args) => kebabCase(args.join('-'));
|
16
16
|
|
17
|
-
const getCssVarName = (...args) => `--${kebabCaseJoin(...args)}`;
|
17
|
+
const getCssVarName = (...args) => `--${kebabCaseJoin(...args.filter(arg => !!arg))}`;
|
18
18
|
|
19
19
|
const createCssVarFallback = (first, ...rest) => `var(${first}${rest.length ? ` , ${createCssVarFallback(...rest)}` : ''})`;
|
20
20
|
|
21
|
-
const createCssSelector = (
|
21
|
+
const createCssSelector = (baseSelector = '', relativeSelectorOrSelectorFn = '') =>
|
22
22
|
typeof relativeSelectorOrSelectorFn === 'function' ?
|
23
|
-
relativeSelectorOrSelectorFn(
|
24
|
-
`${
|
23
|
+
relativeSelectorOrSelectorFn(baseSelector) :
|
24
|
+
`${baseSelector}${relativeSelectorOrSelectorFn}`;
|
25
25
|
|
26
26
|
class StyleBuilder {
|
27
27
|
constructor() {
|
@@ -53,7 +53,7 @@ const normalizeConfig = (attr, config) => {
|
|
53
53
|
return [Object.assign({}, defaultMapping, config)];
|
54
54
|
};
|
55
55
|
|
56
|
-
const createStyle = (componentName,
|
56
|
+
const createStyle = (componentName, baseSelector, mappings) => {
|
57
57
|
const style = new StyleBuilder();
|
58
58
|
|
59
59
|
Object.keys(mappings).forEach((attr) => {
|
@@ -63,7 +63,7 @@ const createStyle = (componentName, wrappedComponentName, mappings) => {
|
|
63
63
|
|
64
64
|
attrConfig.forEach(({ selector: relativeSelectorOrSelectorFn, property }) => {
|
65
65
|
style.add(
|
66
|
-
createCssSelector(
|
66
|
+
createCssSelector(baseSelector, relativeSelectorOrSelectorFn),
|
67
67
|
property,
|
68
68
|
createCssVarFallback(cssVarName)
|
69
69
|
);
|
@@ -79,26 +79,63 @@ const createCssVarsList = (componentName, mappings) =>
|
|
79
79
|
{}
|
80
80
|
);
|
81
81
|
|
82
|
+
// match the host selector with the inner element selector
|
83
|
+
// e.g. when we want to set the same size for the host & the inner element this can be useful
|
82
84
|
const matchHostStyle = (mappingObj) => [mappingObj, {...mappingObj, selector: () => `:host${mappingObj.selector || ''}`}];
|
83
85
|
|
84
86
|
const createStyleMixin = ({ mappings = {} }) => (superclass) => {
|
87
|
+
const styleAttributes = Object.keys(mappings).map(key => kebabCaseJoin('st', key));
|
85
88
|
return class CustomStyleMixinClass extends superclass {
|
89
|
+
static get observedAttributes() {
|
90
|
+
const superAttrs = superclass.observedAttributes || [];
|
91
|
+
return [...superAttrs, ...styleAttributes]
|
92
|
+
}
|
93
|
+
|
86
94
|
static get cssVarList() {
|
87
95
|
return createCssVarsList(superclass.componentName, mappings)
|
88
96
|
}
|
89
|
-
|
97
|
+
|
98
|
+
#styleEle = null;
|
99
|
+
|
90
100
|
constructor() {
|
91
101
|
super();
|
92
102
|
|
93
103
|
this.#createComponentStyle();
|
104
|
+
this.#createAttrOverrideStyle();
|
105
|
+
}
|
106
|
+
|
107
|
+
#createAttrOverrideStyle() {
|
108
|
+
this.#styleEle = document.createElement('style');
|
109
|
+
this.#styleEle.id = 'style-mixin-overrides';
|
110
|
+
|
111
|
+
this.#styleEle.innerText = '* {}';
|
112
|
+
this.shadowRoot.prepend(this.#styleEle);
|
113
|
+
}
|
114
|
+
|
115
|
+
#updateAttrOverrideStyle(attrName, value) {
|
116
|
+
const style = this.#styleEle.sheet.cssRules[0].style;
|
117
|
+
const varName = getCssVarName(superclass.componentName, attrName.replace(/^st-/, ''));
|
118
|
+
|
119
|
+
if (value)
|
120
|
+
style.setProperty(varName, value);
|
121
|
+
else
|
122
|
+
style.removeProperty(varName);
|
94
123
|
}
|
95
124
|
|
96
125
|
#createComponentStyle() {
|
97
126
|
const themeStyle = document.createElement('style');
|
98
|
-
themeStyle.id = 'style-mixin';
|
99
|
-
themeStyle.innerHTML = createStyle(
|
127
|
+
themeStyle.id = 'style-mixin-component';
|
128
|
+
themeStyle.innerHTML = createStyle(superclass.componentName, baseSelector, mappings);
|
100
129
|
this.shadowRoot.prepend(themeStyle);
|
101
130
|
}
|
131
|
+
|
132
|
+
attributeChangedCallback(attrName, oldValue, newValue) {
|
133
|
+
super.attributeChangedCallback?.(attrName, oldValue, newValue);
|
134
|
+
|
135
|
+
if (styleAttributes.includes(attrName)) {
|
136
|
+
this.#updateAttrOverrideStyle(attrName, newValue);
|
137
|
+
}
|
138
|
+
}
|
102
139
|
}
|
103
140
|
};
|
104
141
|
|
@@ -116,7 +153,7 @@ const draggableMixin = (superclass) =>
|
|
116
153
|
super();
|
117
154
|
|
118
155
|
this.#styleEle = document.createElement('style');
|
119
|
-
this.#styleEle.innerText = `${this.
|
156
|
+
this.#styleEle.innerText = `${this.baseSelector} { cursor: inherit }`;
|
120
157
|
}
|
121
158
|
|
122
159
|
#handleDraggableStyle(isDraggable) {
|
@@ -128,7 +165,7 @@ const draggableMixin = (superclass) =>
|
|
128
165
|
}
|
129
166
|
|
130
167
|
attributeChangedCallback(attrName, oldValue, newValue) {
|
131
|
-
super.attributeChangedCallback(attrName, oldValue, newValue);
|
168
|
+
super.attributeChangedCallback?.(attrName, oldValue, newValue);
|
132
169
|
if (attrName === 'draggable') {
|
133
170
|
this.#handleDraggableStyle(newValue === 'true');
|
134
171
|
}
|
@@ -187,19 +224,11 @@ const createProxy = ({ componentName, wrappedEleName, slots = [], style, exclude
|
|
187
224
|
super().attachShadow({ mode: "open" }).innerHTML = template;
|
188
225
|
this.hostElement = this.shadowRoot.host;
|
189
226
|
this.componentName = this.hostElement.tagName.toLowerCase();
|
190
|
-
this.
|
191
|
-
}
|
192
|
-
|
193
|
-
#checkComponentName() {
|
194
|
-
if (this.componentName !== componentName) {
|
195
|
-
throw Error(`component name mismatch, expected "${componentName}", current "${actualComponentName}"`)
|
196
|
-
}
|
227
|
+
this.baseSelector = wrappedEleName;
|
197
228
|
}
|
198
229
|
|
199
230
|
connectedCallback() {
|
200
231
|
if (this.shadowRoot.isConnected) {
|
201
|
-
this.#checkComponentName();
|
202
|
-
|
203
232
|
this.proxyElement = this.shadowRoot.querySelector(wrappedEleName);
|
204
233
|
this.setAttribute('tabindex', '0');
|
205
234
|
|
@@ -273,7 +302,7 @@ const inputMixin = (superclass) =>
|
|
273
302
|
}
|
274
303
|
|
275
304
|
connectedCallback() {
|
276
|
-
super.connectedCallback();
|
305
|
+
super.connectedCallback?.();
|
277
306
|
|
278
307
|
// vaadin does not expose all those validation attributes so we need to take it from the input
|
279
308
|
// https://github.com/vaadin/web-components/issues/1177
|
@@ -296,13 +325,35 @@ const inputMixin = (superclass) =>
|
|
296
325
|
}
|
297
326
|
};
|
298
327
|
|
328
|
+
const componentNameValidationMixin = (superclass) =>
|
329
|
+
class DraggableMixinClass extends superclass {
|
330
|
+
#checkComponentName() {
|
331
|
+
const currentComponentName = this.shadowRoot.host.tagName.toLowerCase();
|
332
|
+
|
333
|
+
if (!superclass.componentName) {
|
334
|
+
throw Error(`component name is not defined on super class, make sure you have a static get for "componentName"`)
|
335
|
+
}
|
336
|
+
|
337
|
+
if (currentComponentName !== superclass.componentName) {
|
338
|
+
throw Error(`component name mismatch, expected "${superclass.componentName}", current "${currentComponentName}"`)
|
339
|
+
}
|
340
|
+
}
|
341
|
+
|
342
|
+
connectedCallback() {
|
343
|
+
super.connectedCallback?.();
|
344
|
+
if (this.shadowRoot.isConnected) {
|
345
|
+
this.#checkComponentName();
|
346
|
+
}
|
347
|
+
}
|
348
|
+
};
|
349
|
+
|
299
350
|
const getComponentName = (name) => kebabCaseJoin(DESCOPE_PREFIX, name);
|
300
351
|
|
301
352
|
const compose = (...fns) => (val) => fns.reduceRight((res, fn) => fn(res), val);
|
302
353
|
|
303
354
|
const editorOverrides = `vaadin-button::part(label) { pointer-events: none; }`;
|
304
355
|
|
305
|
-
const componentName$
|
356
|
+
const componentName$4 = getComponentName("button");
|
306
357
|
|
307
358
|
const Button = compose(
|
308
359
|
createStyleMixin({
|
@@ -322,19 +373,20 @@ const Button = compose(
|
|
322
373
|
},
|
323
374
|
}),
|
324
375
|
draggableMixin,
|
376
|
+
componentNameValidationMixin
|
325
377
|
)(
|
326
378
|
createProxy({
|
327
379
|
slots: ["prefix", "suffix"],
|
328
380
|
wrappedEleName: "vaadin-button",
|
329
381
|
style: `${editorOverrides}`,
|
330
382
|
excludeAttrsSync: ['tabindex'],
|
331
|
-
componentName: componentName$
|
383
|
+
componentName: componentName$4
|
332
384
|
})
|
333
385
|
);
|
334
386
|
|
335
|
-
customElements.define(componentName$
|
387
|
+
customElements.define(componentName$4, Button);
|
336
388
|
|
337
|
-
const componentName$
|
389
|
+
const componentName$3 = getComponentName("text-field");
|
338
390
|
|
339
391
|
const TextField = compose(
|
340
392
|
createStyleMixin({
|
@@ -353,22 +405,23 @@ const TextField = compose(
|
|
353
405
|
},
|
354
406
|
}),
|
355
407
|
draggableMixin,
|
356
|
-
inputMixin
|
408
|
+
inputMixin,
|
409
|
+
componentNameValidationMixin
|
357
410
|
)(
|
358
411
|
createProxy({
|
359
412
|
slots: ["prefix", "suffix"],
|
360
413
|
wrappedEleName: "vaadin-text-field",
|
361
414
|
style: ``,
|
362
415
|
excludeAttrsSync: ['tabindex'],
|
363
|
-
componentName: componentName$
|
416
|
+
componentName: componentName$3
|
364
417
|
})
|
365
418
|
);
|
366
419
|
|
367
|
-
customElements.define(componentName$
|
420
|
+
customElements.define(componentName$3, TextField);
|
368
421
|
|
369
422
|
const template = document.createElement('template');
|
370
423
|
|
371
|
-
const componentName$
|
424
|
+
const componentName$2 = getComponentName("combo");
|
372
425
|
|
373
426
|
template.innerHTML = `
|
374
427
|
<descope-button></descope-button>
|
@@ -385,22 +438,79 @@ class Combo extends HTMLElement {
|
|
385
438
|
}
|
386
439
|
}
|
387
440
|
|
388
|
-
customElements.define(componentName$
|
441
|
+
customElements.define(componentName$2, Combo);
|
389
442
|
|
390
|
-
const componentName = getComponentName("date-picker");
|
443
|
+
const componentName$1 = getComponentName("date-picker");
|
391
444
|
|
392
445
|
const DatePicker = compose(
|
393
|
-
draggableMixin
|
446
|
+
draggableMixin,
|
447
|
+
componentNameValidationMixin
|
394
448
|
)(
|
395
449
|
createProxy({
|
396
|
-
componentName,
|
450
|
+
componentName: componentName$1,
|
397
451
|
slots: ["prefix", "suffix"],
|
398
452
|
wrappedEleName: "vaadin-date-picker",
|
399
453
|
style: ``,
|
400
454
|
})
|
401
455
|
);
|
402
456
|
|
403
|
-
customElements.define(componentName, DatePicker);
|
457
|
+
customElements.define(componentName$1, DatePicker);
|
458
|
+
|
459
|
+
const componentName = getComponentName("container");
|
460
|
+
|
461
|
+
class RawContainer extends HTMLElement {
|
462
|
+
static get componentName() {
|
463
|
+
return componentName
|
464
|
+
}
|
465
|
+
constructor() {
|
466
|
+
super();
|
467
|
+
const template = document.createElement('template');
|
468
|
+
template.innerHTML = `<slot></slot>`;
|
469
|
+
|
470
|
+
this.attachShadow({ mode: 'open' });
|
471
|
+
this.shadowRoot.appendChild(template.content.cloneNode(true));
|
472
|
+
|
473
|
+
this.baseSelector = ':host > slot';
|
474
|
+
}
|
475
|
+
}
|
476
|
+
|
477
|
+
const Container = compose(
|
478
|
+
createStyleMixin({
|
479
|
+
// todo: do we want to change the mapping structure to this? ['aa', 'aaa', {'color': [{ selector: '::part(label)' }]}],
|
480
|
+
mappings: {
|
481
|
+
'height': {},
|
482
|
+
'width': {},
|
483
|
+
|
484
|
+
'verticalPadding': [
|
485
|
+
{ property: 'padding-top' },
|
486
|
+
{ property: 'padding-bottom' }
|
487
|
+
],
|
488
|
+
'horizontalPadding': [
|
489
|
+
{ property: 'padding-left' },
|
490
|
+
{ property: 'padding-right' }
|
491
|
+
],
|
492
|
+
|
493
|
+
'display': {},
|
494
|
+
'flexDirection': {},
|
495
|
+
'justifyContent': {},
|
496
|
+
'alignItems': {},
|
497
|
+
'gap': {},
|
498
|
+
|
499
|
+
'backgroundColor': {},
|
500
|
+
'borderRadius': {},
|
501
|
+
|
502
|
+
'borderColor': {},
|
503
|
+
'borderStyle': {},
|
504
|
+
'borderWidth': {},
|
505
|
+
|
506
|
+
'boxShadow': {},
|
507
|
+
},
|
508
|
+
}),
|
509
|
+
draggableMixin,
|
510
|
+
componentNameValidationMixin,
|
511
|
+
)(RawContainer);
|
512
|
+
|
513
|
+
customElements.define(componentName, Container);
|
404
514
|
|
405
515
|
const getVarName = (path) => getCssVarName(DESCOPE_PREFIX, ...path);
|
406
516
|
|
@@ -441,7 +551,7 @@ const componentsThemeToStyleObj = (componentsTheme) =>
|
|
441
551
|
// starts with underscore -> attribute selector
|
442
552
|
|
443
553
|
const attrsSelector = restPath.reduce((acc, section, idx) => {
|
444
|
-
if (section.startsWith('_')) return acc += `[${section.replace(/^_/, '')}]`;
|
554
|
+
if (section.startsWith('_')) return acc += `[${kebabCase(section.replace(/^_/, ''))}]`;
|
445
555
|
|
446
556
|
const nextSection = restPath[idx + 1];
|
447
557
|
|
@@ -450,14 +560,14 @@ const componentsThemeToStyleObj = (componentsTheme) =>
|
|
450
560
|
return acc;
|
451
561
|
}
|
452
562
|
|
453
|
-
return acc += `[${section}="${restPath.splice(idx + 1, 1).join('')}"]`;
|
563
|
+
return acc += `[${kebabCase(section)}="${restPath.splice(idx + 1, 1).join('')}"]`;
|
454
564
|
}, '');
|
455
565
|
|
456
566
|
let selector = `${getComponentName(component)}${attrsSelector}`;
|
457
567
|
|
458
568
|
return {
|
459
569
|
[selector]: {
|
460
|
-
[
|
570
|
+
[property]: val
|
461
571
|
}
|
462
572
|
}
|
463
573
|
});
|
@@ -473,6 +583,24 @@ ${globalsThemeToStyle(globals, themeName)}
|
|
473
583
|
${componentsThemeToStyle(components, themeName)}
|
474
584
|
`;
|
475
585
|
|
586
|
+
const useVar = varName => `var(${varName})`;
|
587
|
+
|
588
|
+
const createHelperVars = (theme, prefix) => {
|
589
|
+
const res = transformTheme(theme, [], (path, value) => {
|
590
|
+
const modifiedPath = [...path];
|
591
|
+
const property = modifiedPath.splice(-1);
|
592
|
+
const varName = getCssVarName(prefix, property);
|
593
|
+
|
594
|
+
const vars = { [property]: varName };
|
595
|
+
const theme = set({}, [...modifiedPath, varName], value);
|
596
|
+
const useVars = { [property]: useVar(varName) };
|
597
|
+
|
598
|
+
return { theme, useVars, vars }
|
599
|
+
});
|
600
|
+
|
601
|
+
return [res.theme, res.useVars, res.vars]
|
602
|
+
};
|
603
|
+
|
476
604
|
const genDark = (c, percentage = 0.5) => c.darken(percentage).hex();
|
477
605
|
const genLight = (c, percentage = 0.5) => c.lighten(percentage).hex();
|
478
606
|
const genContrast = (c, percentage = 0.9) => {
|
@@ -554,6 +682,8 @@ const shadow = {
|
|
554
682
|
color: colors.primary.main,
|
555
683
|
size: {
|
556
684
|
sm: `0 0 10px`,
|
685
|
+
md: `0 0 20px`,
|
686
|
+
lg: `0 0 30px`,
|
557
687
|
},
|
558
688
|
};
|
559
689
|
|
@@ -566,135 +696,227 @@ var globals = {
|
|
566
696
|
shadow,
|
567
697
|
};
|
568
698
|
|
569
|
-
const globalRefs$
|
699
|
+
const globalRefs$2 = getThemeRefs(globals);
|
700
|
+
const vars$2 = Button.cssVarList;
|
570
701
|
|
571
702
|
const mode = {
|
572
703
|
primary: {
|
573
|
-
main: globalRefs$
|
704
|
+
main: globalRefs$2.colors.primary.main,
|
574
705
|
dark: 'darkblue',
|
575
706
|
light: 'lightblue',
|
576
707
|
contrast: 'white'
|
577
708
|
},
|
578
|
-
secondary: globalRefs$
|
579
|
-
success: globalRefs$
|
580
|
-
error: globalRefs$
|
581
|
-
surface: globalRefs$
|
709
|
+
secondary: globalRefs$2.colors.secondary,
|
710
|
+
success: globalRefs$2.colors.success,
|
711
|
+
error: globalRefs$2.colors.error,
|
712
|
+
surface: globalRefs$2.colors.surface,
|
582
713
|
};
|
583
714
|
|
584
|
-
const
|
715
|
+
const [helperTheme$1, helperRefs$1] = createHelperVars({ mode }, componentName$4);
|
585
716
|
|
586
717
|
const button = {
|
587
|
-
|
588
|
-
|
589
|
-
|
718
|
+
...helperTheme$1,
|
719
|
+
[vars$2.borderRadius]: globalRefs$2.radius.lg,
|
720
|
+
[vars$2.cursor]: 'pointer',
|
721
|
+
|
590
722
|
size: {
|
591
723
|
xs: {
|
592
|
-
height: '10px',
|
593
|
-
fontSize: '10px',
|
594
|
-
padding: `0 ${globalRefs$
|
724
|
+
[vars$2.height]: '10px',
|
725
|
+
[vars$2.fontSize]: '10px',
|
726
|
+
[vars$2.padding]: `0 ${globalRefs$2.spacing.xs}`
|
595
727
|
},
|
596
728
|
sm: {
|
597
|
-
height: '20px',
|
598
|
-
fontSize: '10px',
|
599
|
-
padding: `0 ${globalRefs$
|
729
|
+
[vars$2.height]: '20px',
|
730
|
+
[vars$2.fontSize]: '10px',
|
731
|
+
[vars$2.padding]: `0 ${globalRefs$2.spacing.sm}`
|
600
732
|
},
|
601
733
|
md: {
|
602
|
-
height: '30px',
|
603
|
-
fontSize: '14px',
|
604
|
-
padding: `0 ${globalRefs$
|
734
|
+
[vars$2.height]: '30px',
|
735
|
+
[vars$2.fontSize]: '14px',
|
736
|
+
[vars$2.padding]: `0 ${globalRefs$2.spacing.md}`
|
605
737
|
},
|
606
738
|
lg: {
|
607
|
-
height: '40px',
|
608
|
-
fontSize: '20px',
|
609
|
-
padding: `0 ${globalRefs$
|
739
|
+
[vars$2.height]: '40px',
|
740
|
+
[vars$2.fontSize]: '20px',
|
741
|
+
[vars$2.padding]: `0 ${globalRefs$2.spacing.lg}`
|
610
742
|
},
|
611
743
|
xl: {
|
612
|
-
height: '50px',
|
613
|
-
fontSize: '25px',
|
614
|
-
padding: `0 ${globalRefs$
|
744
|
+
[vars$2.height]: '50px',
|
745
|
+
[vars$2.fontSize]: '25px',
|
746
|
+
[vars$2.padding]: `0 ${globalRefs$2.spacing.xl}`
|
615
747
|
},
|
616
748
|
},
|
617
749
|
|
618
|
-
|
619
|
-
width: '100%'
|
750
|
+
_fullWidth: {
|
751
|
+
[vars$2.width]: '100%'
|
620
752
|
},
|
621
753
|
|
622
|
-
mode,
|
623
|
-
|
624
754
|
variant: {
|
625
755
|
contained: {
|
626
|
-
color:
|
627
|
-
backgroundColor:
|
756
|
+
[vars$2.color]: helperRefs$1.contrast,
|
757
|
+
[vars$2.backgroundColor]: helperRefs$1.main,
|
628
758
|
_hover: {
|
629
|
-
backgroundColor:
|
759
|
+
[vars$2.backgroundColor]: helperRefs$1.dark,
|
630
760
|
},
|
631
761
|
},
|
632
762
|
outline: {
|
633
|
-
color:
|
634
|
-
borderColor:
|
635
|
-
borderWidth: '2px',
|
636
|
-
borderStyle: 'solid',
|
763
|
+
[vars$2.color]: helperRefs$1.main,
|
764
|
+
[vars$2.borderColor]: helperRefs$1.main,
|
765
|
+
[vars$2.borderWidth]: '2px',
|
766
|
+
[vars$2.borderStyle]: 'solid',
|
637
767
|
_hover: {
|
638
|
-
color:
|
639
|
-
borderColor:
|
768
|
+
[vars$2.color]: helperRefs$1.dark,
|
769
|
+
[vars$2.borderColor]: helperRefs$1.dark,
|
640
770
|
_error: {
|
641
|
-
color: 'red',
|
771
|
+
[vars$2.color]: 'red',
|
642
772
|
}
|
643
773
|
}
|
644
774
|
},
|
645
775
|
link: {
|
646
|
-
color:
|
776
|
+
[vars$2.color]: helperRefs$1.main,
|
647
777
|
},
|
648
778
|
}
|
649
779
|
};
|
650
780
|
|
651
|
-
const globalRefs = getThemeRefs(globals);
|
781
|
+
const globalRefs$1 = getThemeRefs(globals);
|
782
|
+
|
783
|
+
const vars$1 = TextField.cssVarList;
|
652
784
|
|
653
785
|
const textField = {
|
654
|
-
borderRadius: globalRefs.radius.lg,
|
655
|
-
color: globalRefs.colors.surface.contrast,
|
656
|
-
backgroundColor: globalRefs.colors.surface.light,
|
657
|
-
borderWidth: globalRefs.border.small,
|
658
|
-
borderStyle: 'solid',
|
659
|
-
borderColor: globalRefs.colors.surface.dark,
|
660
|
-
labelColor: globalRefs.colors.surface.contrast,
|
661
|
-
placeholderColor: globalRefs.colors.surface.dark,
|
786
|
+
[vars$1.borderRadius]: globalRefs$1.radius.lg,
|
787
|
+
[vars$1.color]: globalRefs$1.colors.surface.contrast,
|
788
|
+
[vars$1.backgroundColor]: globalRefs$1.colors.surface.light,
|
789
|
+
[vars$1.borderWidth]: globalRefs$1.border.small,
|
790
|
+
[vars$1.borderStyle]: 'solid',
|
791
|
+
[vars$1.borderColor]: globalRefs$1.colors.surface.dark,
|
792
|
+
[vars$1.labelColor]: globalRefs$1.colors.surface.contrast,
|
793
|
+
[vars$1.placeholderColor]: globalRefs$1.colors.surface.dark,
|
662
794
|
_invalid: {
|
663
|
-
backgroundColor: globalRefs.colors.error.light,
|
664
|
-
borderColor: globalRefs.colors.error.dark,
|
795
|
+
[vars$1.backgroundColor]: globalRefs$1.colors.error.light,
|
796
|
+
[vars$1.borderColor]: globalRefs$1.colors.error.dark,
|
665
797
|
},
|
666
798
|
|
667
799
|
size: {
|
668
800
|
sm: {
|
669
|
-
height: '20px',
|
670
|
-
fontSize: '10px',
|
671
|
-
padding: `0 ${globalRefs.spacing.xs}`
|
801
|
+
[vars$1.height]: '20px',
|
802
|
+
[vars$1.fontSize]: '10px',
|
803
|
+
[vars$1.padding]: `0 ${globalRefs$1.spacing.xs}`
|
672
804
|
},
|
673
805
|
md: {
|
674
|
-
height: '30px',
|
675
|
-
fontSize: '14px',
|
676
|
-
padding: `0 ${globalRefs.spacing.sm}`
|
806
|
+
[vars$1.height]: '30px',
|
807
|
+
[vars$1.fontSize]: '14px',
|
808
|
+
[vars$1.padding]: `0 ${globalRefs$1.spacing.sm}`
|
677
809
|
},
|
678
810
|
lg: {
|
679
|
-
height: '40px',
|
680
|
-
fontSize: '20px',
|
681
|
-
padding: `0 ${globalRefs.spacing.sm}`
|
811
|
+
[vars$1.height]: '40px',
|
812
|
+
[vars$1.fontSize]: '20px',
|
813
|
+
[vars$1.padding]: `0 ${globalRefs$1.spacing.sm}`
|
682
814
|
},
|
683
815
|
xl: {
|
684
|
-
height: '50px',
|
685
|
-
fontSize: '25px',
|
686
|
-
padding: `0 ${globalRefs.spacing.md}`
|
816
|
+
[vars$1.height]: '50px',
|
817
|
+
[vars$1.fontSize]: '25px',
|
818
|
+
[vars$1.padding]: `0 ${globalRefs$1.spacing.md}`
|
687
819
|
},
|
688
820
|
},
|
689
821
|
|
690
|
-
|
691
|
-
width: '100%'
|
822
|
+
_fullWidth: {
|
823
|
+
[vars$1.width]: '100%'
|
692
824
|
},
|
693
825
|
};
|
694
826
|
|
827
|
+
const globalRefs = getThemeRefs(globals);
|
828
|
+
|
829
|
+
const vars = Container.cssVarList;
|
830
|
+
|
831
|
+
const verticalAlignment = {
|
832
|
+
start: { verticalAlignment: 'start' },
|
833
|
+
center: { verticalAlignment: 'center' },
|
834
|
+
end: { verticalAlignment: 'end' },
|
835
|
+
};
|
836
|
+
|
837
|
+
const horizontalAlignment = {
|
838
|
+
start: { horizontalAlignment: 'start' },
|
839
|
+
center: { horizontalAlignment: 'center' },
|
840
|
+
end: { horizontalAlignment: 'end' },
|
841
|
+
};
|
842
|
+
|
843
|
+
const [helperTheme, helperVars, helperRefs] =
|
844
|
+
createHelperVars({ verticalAlignment, horizontalAlignment }, 'container');
|
845
|
+
|
846
|
+
const container = {
|
847
|
+
...helperTheme,
|
848
|
+
[vars.display]: 'flex',
|
849
|
+
verticalPadding: {
|
850
|
+
sm: { [vars.verticalPadding]: '5px' },
|
851
|
+
md: { [vars.verticalPadding]: '10px' },
|
852
|
+
lg: { [vars.verticalPadding]: '20px' },
|
853
|
+
},
|
854
|
+
horizontalPadding: {
|
855
|
+
sm: { [vars.horizontalPadding]: '5px' },
|
856
|
+
md: { [vars.horizontalPadding]: '10px' },
|
857
|
+
lg: { [vars.horizontalPadding]: '20px' },
|
858
|
+
},
|
859
|
+
direction: {
|
860
|
+
row: {
|
861
|
+
[vars.flexDirection]: 'row',
|
862
|
+
[vars.alignItems]: helperRefs.verticalAlignment,
|
863
|
+
[vars.justifyContent]: helperRefs.horizontalAlignment,
|
864
|
+
horizontalAlignment: {
|
865
|
+
spaceBetween: { [helperVars.horizontalAlignment]: 'space-between' },
|
866
|
+
}
|
867
|
+
},
|
868
|
+
|
869
|
+
column: {
|
870
|
+
[vars.flexDirection]: 'column',
|
871
|
+
[vars.alignItems]: helperRefs.horizontalAlignment,
|
872
|
+
[vars.justifyContent]: helperRefs.verticalAlignment,
|
873
|
+
verticalAlignment: {
|
874
|
+
spaceBetween: { [helperVars.verticalAlignment]: 'space-between' }
|
875
|
+
}
|
876
|
+
},
|
877
|
+
},
|
878
|
+
|
879
|
+
spaceBetween: {
|
880
|
+
sm: {
|
881
|
+
[vars.gap]: '10px'
|
882
|
+
},
|
883
|
+
md: {
|
884
|
+
[vars.gap]: '20px'
|
885
|
+
},
|
886
|
+
lg: {
|
887
|
+
[vars.gap]: '30px'
|
888
|
+
}
|
889
|
+
},
|
890
|
+
|
891
|
+
shadow: {
|
892
|
+
sm: {
|
893
|
+
[vars.boxShadow]: `${globalRefs.shadow.size.sm} ${globalRefs.shadow.color}`
|
894
|
+
},
|
895
|
+
md: {
|
896
|
+
[vars.boxShadow]: `${globalRefs.shadow.size.md} ${globalRefs.shadow.color}`
|
897
|
+
},
|
898
|
+
lg: {
|
899
|
+
[vars.boxShadow]: `${globalRefs.shadow.size.lg} ${globalRefs.shadow.color}`
|
900
|
+
},
|
901
|
+
},
|
902
|
+
|
903
|
+
borderRadius: {
|
904
|
+
sm: {
|
905
|
+
[vars.borderRadius]: globalRefs.radius.sm
|
906
|
+
},
|
907
|
+
md: {
|
908
|
+
[vars.borderRadius]: globalRefs.radius.md
|
909
|
+
},
|
910
|
+
lg: {
|
911
|
+
[vars.borderRadius]: globalRefs.radius.lg
|
912
|
+
},
|
913
|
+
}
|
914
|
+
};
|
915
|
+
|
695
916
|
var components = {
|
696
917
|
button,
|
697
|
-
textField
|
918
|
+
textField,
|
919
|
+
container
|
698
920
|
};
|
699
921
|
|
700
922
|
var index = { globals, components };
|