@descope/web-components-ui 1.0.61 → 1.0.63

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. package/dist/cjs/index.cjs.js +95 -21
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +967 -784
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/umd/447.js +1 -1
  6. package/dist/umd/666.js +37 -0
  7. package/dist/umd/725.js +1 -37
  8. package/dist/umd/descope-button-index-js.js +1 -1
  9. package/dist/umd/descope-checkbox-index-js.js +1 -1
  10. package/dist/umd/descope-container-index-js.js +1 -1
  11. package/dist/umd/descope-date-picker-index-js.js +1 -1
  12. package/dist/umd/descope-divider-index-js.js +1 -1
  13. package/dist/umd/descope-email-field-index-js.js +1 -1
  14. package/dist/umd/descope-link-index-js.js +1 -1
  15. package/dist/umd/descope-loader-linear-index-js.js +1 -1
  16. package/dist/umd/descope-loader-radial-index-js.js +1 -1
  17. package/dist/umd/descope-logo-index-js.js +1 -1
  18. package/dist/umd/descope-number-field-index-js.js +1 -1
  19. package/dist/umd/descope-passcode-descope-passcode-internal-index-js.js +1 -1
  20. package/dist/umd/descope-passcode-index-js.js +1 -1
  21. package/dist/umd/descope-password-field-index-js.js +1 -1
  22. package/dist/umd/descope-switch-toggle-index-js.js +1 -1
  23. package/dist/umd/descope-text-area-index-js.js +1 -1
  24. package/dist/umd/descope-text-field-index-js.js +1 -1
  25. package/dist/umd/descope-text-index-js.js +1 -1
  26. package/dist/umd/index.js +1 -1
  27. package/package.json +1 -1
  28. package/src/baseClasses/BaseInputClass.js +3 -0
  29. package/src/components/descope-button/Button.js +14 -10
  30. package/src/components/descope-checkbox/Checkbox.js +10 -7
  31. package/src/components/descope-container/Container.js +12 -7
  32. package/src/components/descope-date-picker/index.js +3 -3
  33. package/src/components/descope-divider/Divider.js +35 -30
  34. package/src/components/descope-email-field/EmailField.js +5 -5
  35. package/src/components/descope-link/Link.js +19 -27
  36. package/src/components/descope-loader-linear/LoaderLinear.js +12 -7
  37. package/src/components/descope-loader-radial/LoaderRadial.js +5 -5
  38. package/src/components/descope-logo/Logo.js +4 -4
  39. package/src/components/descope-number-field/NumberField.js +5 -5
  40. package/src/components/descope-passcode/Passcode.js +52 -71
  41. package/src/components/descope-passcode/descope-passcode-internal/PasscodeInternal.js +43 -71
  42. package/src/components/descope-password-field/PasswordField.js +5 -5
  43. package/src/components/descope-switch-toggle/SwitchToggle.js +10 -7
  44. package/src/components/descope-text/Text.js +18 -9
  45. package/src/components/descope-text-area/TextArea.js +9 -8
  46. package/src/components/descope-text-field/TextField.js +5 -5
  47. package/src/components/descope-text-field/textFieldMappings.js +3 -5
  48. package/src/constants.js +1 -0
  49. package/src/dev/index.js +2 -2
  50. package/src/{componentsHelpers/createProxy/helpers.js → helpers/componentHelpers.js} +13 -5
  51. package/src/{helpers.js → helpers/index.js} +5 -2
  52. package/src/helpers/themeHelpers/componentsThemeManager.js +40 -0
  53. package/src/{themeHelpers → helpers/themeHelpers}/index.js +56 -21
  54. package/src/index.cjs.js +1 -1
  55. package/src/index.js +5 -5
  56. package/src/index.umd.js +4 -0
  57. package/src/{componentsHelpers/createProxy/index.js → mixins/createProxy.js} +4 -4
  58. package/src/{componentsHelpers → mixins}/createStyleMixin/helpers.js +14 -15
  59. package/src/mixins/createStyleMixin/index.js +109 -0
  60. package/src/mixins/index.js +7 -0
  61. package/src/mixins/inputMixin.js +173 -0
  62. package/src/mixins/proxyInputMixin.js +152 -0
  63. package/src/theme/components/button.js +2 -2
  64. package/src/theme/components/checkbox.js +2 -1
  65. package/src/theme/components/container.js +2 -2
  66. package/src/theme/components/divider.js +17 -9
  67. package/src/theme/components/link.js +1 -1
  68. package/src/theme/components/loader/loaderLinear.js +1 -1
  69. package/src/theme/components/loader/loaderRadial.js +1 -1
  70. package/src/theme/components/text.js +1 -1
  71. package/src/theme/components/textArea.js +2 -1
  72. package/src/theme/components/textField.js +2 -2
  73. package/src/theme/globals.js +3 -3
  74. package/dist/umd/832.js +0 -1
  75. package/dist/umd/942.js +0 -1
  76. package/dist/umd/descope-combo-index-js.js +0 -1
  77. package/src/components/descope-combo/index.js +0 -27
  78. package/src/componentsHelpers/createStyleMixin/index.js +0 -114
  79. package/src/componentsHelpers/enforceNestingElementsStylesMixin.js +0 -95
  80. package/src/componentsHelpers/index.js +0 -15
  81. package/src/componentsHelpers/inputMixin.js +0 -94
  82. /package/dist/umd/{725.js.LICENSE.txt → 666.js.LICENSE.txt} +0 -0
  83. /package/src/{themeHelpers/processColors.js → helpers/themeHelpers/colorsHelpers.js} +0 -0
  84. /package/src/{componentsHelpers → mixins}/componentNameValidationMixin.js +0 -0
  85. /package/src/{componentsHelpers → mixins}/draggableMixin.js +0 -0
  86. /package/src/{componentsHelpers → mixins}/hoverableMixin.js +0 -0
package/dist/index.esm.js CHANGED
@@ -1,17 +1,15 @@
1
1
  import '@vaadin/button';
2
2
  import '@vaadin/checkbox';
3
- import '@vaadin/text-field';
4
3
  import '@vaadin/date-picker';
5
4
  import '@vaadin/email-field';
6
5
  import '@vaadin/number-field';
6
+ import '@vaadin/text-field';
7
7
  import '@vaadin/password-field';
8
8
  import '@vaadin/text-area';
9
9
  import merge from 'lodash.merge';
10
10
  import set from 'lodash.set';
11
11
  import Color from 'color';
12
12
 
13
- const DESCOPE_PREFIX = 'descope';
14
-
15
13
  const kebabCase = (str) =>
16
14
  str
17
15
  .replace(/([a-z])([A-Z])/g, '$1-$2')
@@ -20,8 +18,132 @@ const kebabCase = (str) =>
20
18
 
21
19
  const kebabCaseJoin = (...args) => kebabCase(args.join('-'));
22
20
 
21
+ const compose = (...fns) =>
22
+ (val) =>
23
+ fns.reduceRight((res, fn) => fn(res), val);
24
+
25
+ const DESCOPE_PREFIX = 'descope';
26
+ const CSS_SELECTOR_SPECIFIER_MULTIPLY = 3;
27
+
28
+ const observeAttributes = (
29
+ ele,
30
+ callback,
31
+ { excludeAttrs = [], includeAttrs = [] }
32
+ ) => {
33
+ // sync all attrs on init
34
+ callback(
35
+ ...Array.from(ele.attributes)
36
+ .filter(
37
+ (attr) =>
38
+ !excludeAttrs.includes(attr.name) &&
39
+ (!includeAttrs.length || includeAttrs.includes(attr.name))
40
+ )
41
+ .map((attr) => attr.name)
42
+ );
43
+
44
+ const observer = new MutationObserver((mutationsList) => {
45
+ for (const mutation of mutationsList) {
46
+ if (
47
+ mutation.type === 'attributes' &&
48
+ !excludeAttrs.includes(mutation.attributeName) &&
49
+ (!includeAttrs.length || includeAttrs.includes(mutation.attributeName))
50
+ ) {
51
+ callback([mutation.attributeName]);
52
+ }
53
+ }
54
+ });
55
+
56
+ observer.observe(ele, { attributes: true });
57
+ };
58
+
59
+ const createSyncAttrsCb =
60
+ (srcEle, targetEle, mapAttrs = {}) =>
61
+ (...attrNames) => {
62
+ attrNames.forEach((attrName) => {
63
+ const targetAttrName = mapAttrs[attrName] || attrName;
64
+ const srcAttrVal = srcEle.getAttribute(attrName);
65
+ if (srcAttrVal !== null) {
66
+ if (targetEle.getAttribute(targetAttrName) !== srcAttrVal) {
67
+ targetEle.setAttribute(targetAttrName, srcAttrVal);
68
+ }
69
+ } else {
70
+ targetEle.removeAttribute(targetAttrName);
71
+ }
72
+ });
73
+ };
74
+
75
+ const syncAttrs = (ele1, ele2, options) => {
76
+ observeAttributes(ele1, createSyncAttrsCb(ele1, ele2), options);
77
+ observeAttributes(ele2, createSyncAttrsCb(ele2, ele1), options);
78
+ };
79
+
80
+ const getComponentName = (name) => kebabCaseJoin(DESCOPE_PREFIX, name);
81
+
23
82
  const getCssVarName = (...args) =>
24
- `--${kebabCaseJoin(...args.filter((arg) => !!arg))}`;
83
+ `--${kebabCaseJoin(...args.filter((arg) => !!arg))}`;
84
+
85
+ const forwardAttrs = (source, dest, options = {}) => {
86
+ observeAttributes(
87
+ source,
88
+ createSyncAttrsCb(source, dest, options.mapAttrs),
89
+ options
90
+ );
91
+ };
92
+
93
+ const forwardProps = (src, target, props = []) => {
94
+ if(!props.length) return;
95
+
96
+ const config = props.reduce((acc, prop) => Object.assign(acc, {[prop] : {
97
+ get () {
98
+ return target[prop]
99
+ },
100
+ set (v) {
101
+ target[prop] = v;
102
+ }
103
+ }}), {});
104
+
105
+ Object.defineProperties(src, config);
106
+ };
107
+
108
+ class ComponentsThemeManager {
109
+ static mountOnPropName = 'DescopeThemeManager';
110
+
111
+ #themes = {};
112
+
113
+ #currentThemeName = 'light';
114
+
115
+ #callbacks = new Set();
116
+
117
+ #notify() {
118
+ this.#callbacks.forEach(cb => cb?.());
119
+ };
120
+
121
+ get currentThemeName() {
122
+ return this.#currentThemeName;
123
+ }
124
+
125
+ set currentThemeName(themeName) {
126
+ this.#currentThemeName = themeName;
127
+ this.#notify();
128
+ }
129
+
130
+ get currentTheme() {
131
+ return this.#themes[this.currentThemeName];
132
+ }
133
+
134
+ onCurrentThemeChange(cb) {
135
+ this.#callbacks.add(cb);
136
+
137
+ return () => { this.#callbacks.delete(cb); };
138
+ };
139
+
140
+ set themes(themes) {
141
+ this.#themes = themes;
142
+ this.#notify();
143
+ }
144
+ }
145
+
146
+ const componentsThemeManager = new ComponentsThemeManager();
25
147
 
26
148
  const createCssVarFallback = (first, ...rest) =>
27
149
  `var(${first}${rest.length ? ` , ${createCssVarFallback(...rest)}` : ''})`;
@@ -32,11 +154,10 @@ const createCssSelector = (
32
154
  ) =>
33
155
  typeof relativeSelectorOrSelectorFn === 'function'
34
156
  ? relativeSelectorOrSelectorFn(baseSelector)
35
- : `${baseSelector}${
36
- /^[A-Za-z]/.test(relativeSelectorOrSelectorFn)
37
- ? ` ${relativeSelectorOrSelectorFn}`
38
- : relativeSelectorOrSelectorFn
39
- }`;
157
+ : `${baseSelector}${/^[A-Za-z]/.test(relativeSelectorOrSelectorFn)
158
+ ? ` ${relativeSelectorOrSelectorFn}`
159
+ : relativeSelectorOrSelectorFn
160
+ }`;
40
161
 
41
162
  class StyleBuilder {
42
163
  constructor() {
@@ -57,9 +178,9 @@ class StyleBuilder {
57
178
  toString() {
58
179
  return Array.from(this.styleMap.entries()).reduce(
59
180
  (style, [selector, propValArr]) =>
60
- (style += `${selector} { \n${propValArr
61
- .map(({ property, value }) => `${property}: ${value}`)
62
- .join(';\n')} \n}\n\n`),
181
+ (style += `${selector} { \n${propValArr
182
+ .map(({ property, value }) => `${property}: ${value}`)
183
+ .join(';\n')} \n}\n\n`),
63
184
  ''
64
185
  );
65
186
  }
@@ -105,124 +226,115 @@ const createCssVarsList = (componentName, mappings) =>
105
226
  {}
106
227
  );
107
228
 
108
- // match the host selector with the inner element selector
109
- // e.g. when we want to set the same size for the host & the inner element this can be useful
110
- const matchHostStyle = (mappingObj = {}) => [
111
- mappingObj,
112
- { ...mappingObj, selector: () => `:host${mappingObj.selector || ''}` }
113
- ];
229
+ // on some cases we need a selector to be more specific than another
230
+ // for this we have this fn that generate a class selector multiple times
231
+ const createClassSelectorSpecifier = (className, numOfRepeats) => Array(numOfRepeats)
232
+ .fill(`.${className}`)
233
+ .join('');
114
234
 
115
235
  const createStyleMixin =
116
- ({ mappings = {}, nestedMappings = {} }) =>
117
- (superclass) => {
118
- const styleAttributes = Object.keys(mappings).map((key) =>
119
- kebabCaseJoin('st', key)
120
- );
121
- return class CustomStyleMixinClass extends superclass {
122
- static get observedAttributes() {
123
- const superAttrs = superclass.observedAttributes || [];
124
- return [...superAttrs, ...styleAttributes];
125
- }
126
-
127
- static get cssVarList() {
128
- return createCssVarsList(superclass.componentName, {
129
- ...mappings,
130
- ...nestedMappings
131
- });
132
- }
236
+ ({ mappings = {} }) =>
237
+ (superclass) => {
238
+ const styleAttributes = Object.keys(mappings).map((key) =>
239
+ kebabCaseJoin('st', key)
240
+ );
241
+ return class CustomStyleMixinClass extends superclass {
242
+ static get observedAttributes() {
243
+ const superAttrs = superclass.observedAttributes || [];
244
+ return [...superAttrs, ...styleAttributes];
245
+ }
133
246
 
134
- #styleEle = null;
247
+ static get cssVarList() {
248
+ return createCssVarsList(superclass.componentName, {
249
+ ...mappings,
250
+ });
251
+ }
135
252
 
136
- constructor() {
137
- super();
253
+ #overrideStyleEle = null;
254
+ #themeStyleEle = null;
255
+ #disconnectThemeManager
138
256
 
139
- this.#createComponentStyle();
140
- this.#createAttrOverrideStyle();
141
- }
257
+ constructor() {
258
+ super();
142
259
 
143
- #createAttrOverrideStyle() {
144
- this.#styleEle = document.createElement('style');
145
- this.#styleEle.id = 'style-mixin-overrides';
260
+ this.classList.add(superclass.componentName);
146
261
 
147
- this.#styleEle.innerText = '* {}';
148
- this.shadowRoot.prepend(this.#styleEle);
149
- }
150
-
151
- #updateAttrOverrideStyle(attrName, value) {
152
- const style = this.#styleEle.sheet?.cssRules[0].style;
153
- const varName = getCssVarName(
154
- superclass.componentName,
155
- attrName.replace(/^st-/, '')
156
- );
262
+ this.#createComponentStyle();
263
+ this.#createComponentTheme();
264
+ this.#createAttrOverrideStyle();
265
+ }
157
266
 
158
- if (value) style?.setProperty(varName, value);
159
- else style?.removeProperty(varName);
160
- }
267
+ get componentTheme() {
268
+ return componentsThemeManager.currentTheme?.[superclass.componentName] || ''
269
+ }
161
270
 
162
- #createComponentStyle() {
163
- const themeStyle = document.createElement('style');
164
- themeStyle.id = 'style-mixin-component';
165
- themeStyle.innerHTML = createStyle(
166
- superclass.componentName,
167
- this.baseSelector,
168
- mappings
169
- );
170
- this.shadowRoot.prepend(themeStyle);
171
- }
271
+ onComponentThemeChange() {
272
+ this.#themeStyleEle.innerHTML = this.componentTheme.theme;
273
+ }
172
274
 
173
- #createComponentNestingStyle() {
174
- // we need these selectors to be more specific from the theme selectors
175
- // in order to do it, we are repeating the class name for specificity
176
- const numOfClassNameSpecifier = 3;
275
+ #createComponentTheme() {
276
+ this.#themeStyleEle = document.createElement('style');
277
+ this.#themeStyleEle.id = 'style-mixin-component-theme';
278
+ this.shadowRoot.prepend(this.#themeStyleEle);
279
+ this.#disconnectThemeManager = componentsThemeManager.onCurrentThemeChange(this.onComponentThemeChange.bind(this));
280
+ this.onComponentThemeChange();
281
+ }
177
282
 
178
- const rootNode = this.shadowRoot.host.getRootNode();
179
- const styleId = `${superclass.componentName}-style-mixin-component`;
283
+ #createAttrOverrideStyle() {
284
+ this.#overrideStyleEle = document.createElement('style');
285
+ this.#overrideStyleEle.id = 'style-mixin-overrides';
180
286
 
181
- const className = superclass.componentName;
182
- this.shadowRoot.host.classList.add(className);
287
+ const classSpecifier = createClassSelectorSpecifier(superclass.componentName, CSS_SELECTOR_SPECIFIER_MULTIPLY);
288
+ this.#overrideStyleEle.innerText = `:host(${classSpecifier}) {}`;
289
+ this.shadowRoot.append(this.#overrideStyleEle);
290
+ }
183
291
 
184
- if (rootNode.querySelector(`style#${styleId}`)) return;
292
+ #updateAttrOverrideStyle(attrName, value) {
293
+ const style = this.#overrideStyleEle.sheet?.cssRules[0].style;
294
+ const varName = getCssVarName(
295
+ superclass.componentName,
296
+ attrName.replace(/^st-/, '')
297
+ );
185
298
 
186
- const themeStyle = document.createElement('style');
187
- themeStyle.id = styleId;
188
- themeStyle.innerHTML = createStyle(
189
- superclass.componentName,
190
- `${superclass.componentName}${Array(numOfClassNameSpecifier)
191
- .fill(`.${className}`)
192
- .join('')}`,
193
- nestedMappings
194
- );
299
+ if (value) style?.setProperty(varName, value);
300
+ else style?.removeProperty(varName);
301
+ }
195
302
 
196
- // rootNode can be either a shadow DOM or a light DOM
197
- if (rootNode.nodeName === '#document') {
198
- rootNode.head.append(themeStyle);
199
- } else {
200
- rootNode.append(themeStyle);
303
+ #createComponentStyle() {
304
+ const themeStyle = document.createElement('style');
305
+ themeStyle.id = 'style-mixin-component';
306
+ themeStyle.innerHTML = createStyle(
307
+ superclass.componentName,
308
+ this.baseSelector,
309
+ mappings
310
+ );
311
+ this.shadowRoot.prepend(themeStyle);
201
312
  }
202
- }
203
313
 
204
- attributeChangedCallback(attrName, oldValue, newValue) {
205
- super.attributeChangedCallback?.(attrName, oldValue, newValue);
314
+ attributeChangedCallback(attrName, oldValue, newValue) {
315
+ super.attributeChangedCallback?.(attrName, oldValue, newValue);
206
316
 
207
- if (styleAttributes.includes(attrName)) {
208
- this.#updateAttrOverrideStyle(attrName, newValue);
317
+ if (styleAttributes.includes(attrName)) {
318
+ this.#updateAttrOverrideStyle(attrName, newValue);
319
+ }
209
320
  }
210
- }
211
321
 
212
- connectedCallback() {
213
- super.connectedCallback?.();
214
- if (this.shadowRoot.isConnected) {
215
- this.#createComponentNestingStyle();
322
+ connectedCallback() {
323
+ super.connectedCallback?.();
324
+ if (this.shadowRoot.isConnected) {
325
+ Array.from(this.attributes).forEach((attr) => {
326
+ if (styleAttributes.includes(attr.nodeName)) {
327
+ this.#updateAttrOverrideStyle(attr.nodeName, attr.value);
328
+ }
329
+ });
330
+ }
331
+ }
216
332
 
217
- Array.from(this.attributes).forEach((attr) => {
218
- if (styleAttributes.includes(attr.nodeName)) {
219
- this.#updateAttrOverrideStyle(attr.nodeName, attr.value);
220
- }
221
- });
333
+ disconnectedCallback() {
334
+ this.#disconnectThemeManager?.();
222
335
  }
223
- }
336
+ };
224
337
  };
225
- };
226
338
 
227
339
  const draggableMixin = (superclass) =>
228
340
  class DraggableMixinClass extends superclass {
@@ -282,81 +394,6 @@ const hoverableMixin =
282
394
  }
283
395
  };
284
396
 
285
- const observeAttributes = (
286
- ele,
287
- callback,
288
- { excludeAttrs = [], includeAttrs = [] }
289
- ) => {
290
- // sync all attrs on init
291
- callback(
292
- ...Array.from(ele.attributes)
293
- .filter(
294
- (attr) =>
295
- !excludeAttrs.includes(attr.name) &&
296
- (!includeAttrs.length || includeAttrs.includes(attr.name))
297
- )
298
- .map((attr) => attr.name)
299
- );
300
-
301
- const observer = new MutationObserver((mutationsList) => {
302
- for (const mutation of mutationsList) {
303
- if (
304
- mutation.type === 'attributes' &&
305
- !excludeAttrs.includes(mutation.attributeName) &&
306
- (!includeAttrs.length || includeAttrs.includes(mutation.attributeName))
307
- ) {
308
- callback([mutation.attributeName]);
309
- }
310
- }
311
- });
312
-
313
- observer.observe(ele, { attributes: true });
314
- };
315
-
316
- const createSyncAttrsCb =
317
- (srcEle, targetEle, mapAttrs = {}) =>
318
- (...attrNames) => {
319
- attrNames.forEach((attrName) => {
320
- const targetAttrName = mapAttrs[attrName] || attrName;
321
- const srcAttrVal = srcEle.getAttribute(attrName);
322
- if (srcAttrVal !== null) {
323
- if (targetEle.getAttribute(targetAttrName) !== srcAttrVal) {
324
- targetEle.setAttribute(targetAttrName, srcAttrVal);
325
- }
326
- } else {
327
- targetEle.removeAttribute(targetAttrName);
328
- }
329
- });
330
- };
331
-
332
- const syncAttrs = (ele1, ele2, options) => {
333
- observeAttributes(ele1, createSyncAttrsCb(ele1, ele2), options);
334
- observeAttributes(ele2, createSyncAttrsCb(ele2, ele1), options);
335
- };
336
-
337
- const forwardAttrs = (source, dest, options = {}) => {
338
- observeAttributes(
339
- source,
340
- createSyncAttrsCb(source, dest, options.mapAttrs),
341
- options
342
- );
343
- };
344
-
345
- const forwardProps = (src, target, props = []) => {
346
- if(!props.length) return;
347
-
348
- const config = props.reduce((acc, prop) => Object.assign(acc, {[prop] : {
349
- get () {
350
- return target[prop]
351
- },
352
- set (v) {
353
- target[prop] = v;
354
- }
355
- }}), {});
356
-
357
- Object.defineProperties(src, config);
358
- };
359
-
360
397
  const createProxy = ({
361
398
  componentName,
362
399
  wrappedEleName,
@@ -438,9 +475,177 @@ const createProxy = ({
438
475
  return compose(hoverableMixin())(ProxyElement);
439
476
  };
440
477
 
441
- const attrs = {
442
- valueMissing: 'data-errormessage-value-missing',
443
- patternMismatch: 'data-errormessage-pattern-mismatch'
478
+ const upperFirst = (str) => str.charAt(0).toUpperCase() + str.slice(1);
479
+
480
+ const events = [
481
+ 'change',
482
+ 'input',
483
+ 'blur',
484
+ 'focus',
485
+ 'invalid',
486
+ 'valid',
487
+ ];
488
+
489
+ const observedAttributes = [
490
+ 'required',
491
+ 'pattern',
492
+ ];
493
+
494
+ const errorAttributes = {
495
+ valueMissing: 'data-errormessage-value-missing',
496
+ patternMismatch: 'data-errormessage-pattern-mismatch'
497
+ };
498
+ const inputMixin = (superclass) => class InputMixinClass extends superclass {
499
+ static get observedAttributes() {
500
+ return [
501
+ ...superclass.observedAttributes || [],
502
+ ...observedAttributes
503
+ ];
504
+ }
505
+
506
+ static get formAssociated() {
507
+ return true;
508
+ }
509
+
510
+ #internals
511
+
512
+ constructor() {
513
+ super();
514
+
515
+ this.#internals = this.attachInternals();
516
+
517
+ for (const event of events) {
518
+ this[`dispatch${upperFirst(event)}`] = function () {
519
+ this.dispatchInputEvent(event);
520
+ };
521
+ }
522
+ }
523
+
524
+ get defaultErrorMsgValueMissing() {
525
+ return 'Please fill out this field.'
526
+ }
527
+
528
+ get defaultErrorMsgPatternMismatch() {
529
+ return 'Please match the requested format.'
530
+ }
531
+
532
+ getErrorMessage(flags) {
533
+ switch (true) {
534
+ case flags.valueMissing:
535
+ return this.getAttribute(errorAttributes.valueMissing) ||
536
+ this.defaultErrorMsgValueMissing
537
+ case flags.patternMismatch || flags.typeMismatch:
538
+ return this.getAttribute(errorAttributes.patternMismatch) ||
539
+ this.defaultErrorMsgPatternMismatch
540
+ case flags.customError:
541
+ return this.validationMessage
542
+ default:
543
+ return ''
544
+ }
545
+ }
546
+
547
+ setValidity() {
548
+ const validity = this.getValidity();
549
+ this.#internals.setValidity(validity, this.getErrorMessage(validity));
550
+ }
551
+
552
+ get validationMessage() {
553
+ return this.#internals.validationMessage;
554
+ }
555
+
556
+ getValidity() {
557
+ throw Error('getValidity', 'is not implemented')
558
+ }
559
+
560
+ checkValidity() {
561
+ return this.#internals.validity.valid
562
+ }
563
+
564
+ reportValidity() {
565
+ return this.#internals.reportValidity()
566
+ }
567
+
568
+ get validity() {
569
+ return this.#internals.validity
570
+ }
571
+
572
+ setCustomValidity(errorMessage) {
573
+ if(errorMessage){
574
+ this.#internals.setValidity({customError: true}, errorMessage);
575
+ } else {
576
+ this.#internals.setValidity({});
577
+ this.setValidity();
578
+ }
579
+ }
580
+
581
+ get isRequired() {
582
+ return this.hasAttribute('required') && this.getAttribute('required') !== 'false'
583
+ }
584
+
585
+ get pattern() {
586
+ return this.getAttribute('pattern')
587
+ }
588
+
589
+ get value() {
590
+ throw Error('get value', 'is not implemented')
591
+ }
592
+
593
+ set value(value) {
594
+ throw Error('set value', 'is not implemented')
595
+ }
596
+
597
+ handleFocus() {
598
+ throw Error('handleFocus', 'is not implemented')
599
+ }
600
+
601
+ handleInput() {
602
+ this.setValidity();
603
+ this.handleDispatchValidationEvents();
604
+ }
605
+
606
+ handleBlur() {
607
+ throw Error('handleBlur', 'is not implemented')
608
+ }
609
+
610
+ handleChange() {
611
+ throw Error('handleChange', 'is not implemented')
612
+ }
613
+
614
+ dispatchInputEvent(eventName) {
615
+ this[`on${eventName}`]?.(); // in case we got an event callback as property
616
+ this.dispatchEvent(new InputEvent(eventName));
617
+ }
618
+
619
+ attributeChangedCallback(attrName, oldValue, newValue) {
620
+ super.attributeChangedCallback?.(attrName, oldValue, newValue);
621
+
622
+ if (observedAttributes.includes(attrName)) {
623
+ this.setValidity();
624
+ }
625
+ }
626
+
627
+ handleDispatchValidationEvents(){
628
+ if(this.checkValidity()) {
629
+ this.dispatchValid();
630
+ } else {
631
+ this.dispatchInvalid();
632
+ }
633
+ }
634
+
635
+ connectedCallback() {
636
+ super.connectedCallback?.();
637
+
638
+ this.setValidity();
639
+ this.handleDispatchValidationEvents();
640
+
641
+ // create proxy replace the addEventListener fn
642
+ // and we want to be able to access the focus events
643
+ // of this element and not the nested element's events
644
+ this.onfocus = this.handleFocus.bind(this);
645
+ this.addEventListener('input', this.handleInput.bind(this));
646
+ this.addEventListener('blur', this.handleBlur.bind(this));
647
+ this.addEventListener('change', this.handleBlur.bind(this));
648
+ }
444
649
  };
445
650
 
446
651
  const errorAttrs = ['invalid', 'has-error-message'];
@@ -457,79 +662,140 @@ const propertyObserver = (src, target, property) => {
457
662
  });
458
663
  };
459
664
 
460
- const inputMixin = (superclass) =>
461
- class InputMixinClass extends superclass {
462
- static get formAssociated() {
463
- return true;
665
+ // recursively take the first slot child until it finds an element which is not a slot
666
+ // stops after "nestingLevel" times
667
+ const getNestedInput = (ele) => {
668
+ if (!ele) return;
669
+
670
+ const nestingLevel = 10;
671
+
672
+ let nonSlotEle = ele;
673
+ for (let i = 0; i < nestingLevel; i++) {
674
+ nonSlotEle = nonSlotEle.assignedElements()[0];
675
+ if (nonSlotEle.localName !== 'slot') return nonSlotEle
676
+ }
677
+ };
678
+
679
+ const proxyInputMixin = (superclass) =>
680
+ class proxyInputMixinClass extends inputMixin(superclass) {
681
+ static get observedAttributes() {
682
+ return [...superclass.observedAttributes || [], ...errorAttrs];
464
683
  }
465
684
 
466
- #internals;
685
+ #inputElement
467
686
 
468
687
  constructor() {
469
688
  super();
470
689
 
471
- this.#internals = this.attachInternals();
690
+ this.#inputElement = super.inputElement;
691
+
692
+ // this is our way to identify that the form was submitted
693
+ // in this case, we want the input to be in error state if it's not valid
694
+ this.addEventListener('focus', (e) => {
695
+ if (e.relatedTarget?.form) {
696
+ if (!this.checkValidity()) {
697
+ this.setAttribute('invalid', 'true');
698
+ }
699
+
700
+ if (this.hasAttribute('invalid')) {
701
+ this.reportValidityOnInternalInput();
702
+ }
703
+ }
704
+ });
705
+
706
+ this.addEventListener('invalid', () => {
707
+ this.setInternalInputErrorMessage();
708
+ this.setAttribute('error-message', this.validationMessage);
709
+ });
710
+
711
+ this.addEventListener('valid', () => {
712
+ this.removeAttribute('invalid');
713
+ });
714
+ }
715
+
716
+ get inputElement() {
717
+ const inputSlot = this.baseEle.shadowRoot.querySelector('slot[name="input"]');
718
+ const textAreaSlot = this.baseEle.shadowRoot.querySelector('slot[name="textarea"]');
719
+
720
+ this.#inputElement ??= getNestedInput(inputSlot) || getNestedInput(textAreaSlot);
721
+
722
+ if (!this.#inputElement) throw Error('no input was found');
723
+
724
+ return this.#inputElement
725
+ }
726
+
727
+ set inputElement(ele) {
728
+ this.#inputElement = ele;
729
+ }
730
+
731
+ getValidity() {
732
+ return this.inputElement.validity
472
733
  }
473
734
 
474
- formAssociatedCallback() {
475
- this.setValidity?.();
735
+ reportValidityOnInternalInput() {
736
+ setTimeout(() => {
737
+ this.inputElement.reportValidity();
738
+ }, 0);
739
+ }
740
+
741
+ handleBlur() { }
742
+
743
+ handleFocus() {
744
+ this.inputElement.focus();
745
+ if (this.hasAttribute('invalid')) {
746
+ this.reportValidityOnInternalInput();
747
+ }
476
748
  }
477
749
 
478
- setValidationAttribute(attr) {
479
- const validationAttr = this.getAttribute(attr);
480
- if (validationAttr) {
481
- this.proxyElement.setAttribute('error-message', validationAttr);
750
+ // we want reportValidity to behave like form submission
751
+ reportValidity() {
752
+ const isValid = super.reportValidity();
753
+ if (!isValid) {
754
+ this.setAttribute('invalid', 'true');
755
+ this.inputElement.focus();
482
756
  }
483
- // normalize vaadin error attributes to have a boolean value
484
- errorAttrs.forEach((att) => this.proxyElement.setAttribute(att, 'true'));
757
+ this.reportValidityOnInternalInput();
485
758
  }
486
759
 
487
- validate() {
488
- const { valueMissing, patternMismatch, typeMismatch } = this.validity;
489
- if (valueMissing) {
490
- this.setValidationAttribute(attrs.valueMissing);
491
- } else if (typeMismatch || patternMismatch) {
492
- this.setValidationAttribute(attrs.patternMismatch);
760
+ setInternalInputErrorMessage() {
761
+ if (!this.checkValidity()) {
762
+ this.inputElement.setCustomValidity(this.validationMessage);
493
763
  }
494
764
  }
495
765
 
496
766
  connectedCallback() {
767
+ this.baseEle = this.shadowRoot.querySelector(this.baseSelector);
768
+
497
769
  super.connectedCallback?.();
498
770
 
499
- this.baseEle = this.shadowRoot.querySelector(this.baseSelector);
771
+ this.inputElement.addEventListener('input', () => {
772
+ this.inputElement.setCustomValidity('');
773
+ if (!this.inputElement.checkValidity())
774
+ this.setInternalInputErrorMessage();
775
+ });
776
+
777
+ this.inputElement.addEventListener('invalid', () => {
778
+ this.setValidity();
779
+ this.setInternalInputErrorMessage();
780
+ this.setAttribute('error-message', this.validationMessage);
781
+ });
500
782
 
501
783
  // this is needed in order to make sure the form input validation is working
502
784
  if (!this.hasAttribute('tabindex')) {
503
785
  this.setAttribute('tabindex', 0);
504
786
  }
505
787
 
506
- this.inputElement ??= this.baseEle.shadowRoot.querySelector('slot[name="input"]')?.assignedElements()[0] ||
507
- this.baseEle.shadowRoot.querySelector('slot[name="textarea"]')?.assignedElements()[0];
508
- if (!this.inputElement) throw Error('no input was found');
509
-
510
788
  // sync properties
511
789
  propertyObserver(this, this.inputElement, 'value');
512
790
  this.setSelectionRange = this.inputElement.setSelectionRange?.bind(this.inputElement);
791
+ }
513
792
 
514
- this.validity = this.inputElement.validity;
515
-
516
- this.setValidity = () => {
517
- this.#internals.setValidity(this.inputElement.validity, this.inputElement.validationMessage);
518
- };
519
-
520
- this.inputElement.oninput = () => {
521
- this.value = this.inputElement.value;
522
- this.setValidity();
523
- };
524
-
525
- this.onfocus = () => {
526
- setTimeout(() => this.inputElement.reportValidity(), 0);
527
- this.validate();
528
- };
793
+ attributeChangedCallback(attrName, oldValue, newValue) {
794
+ super.attributeChangedCallback?.(attrName, oldValue, newValue);
529
795
 
530
- this.inputElement.oninvalid = () => {
531
- this.validate();
532
- };
796
+ if (attrName === 'invalid' && newValue === '') {
797
+ this.setAttribute('invalid', 'true');
798
+ }
533
799
  }
534
800
  };
535
801
 
@@ -559,14 +825,7 @@ const componentNameValidationMixin = (superclass) =>
559
825
  }
560
826
  };
561
827
 
562
- const getComponentName = (name) => kebabCaseJoin(DESCOPE_PREFIX, name);
563
-
564
- const compose =
565
- (...fns) =>
566
- (val) =>
567
- fns.reduceRight((res, fn) => fn(res), val);
568
-
569
- const componentName$i = getComponentName('button');
828
+ const componentName$h = getComponentName('button');
570
829
 
571
830
  const editorOverrides = `vaadin-button::part(label) { pointer-events: none; }`;
572
831
  const resetStyles = `
@@ -589,8 +848,9 @@ const iconStyles = `
589
848
  }
590
849
  `;
591
850
 
592
- const selectors$5 = {
593
- label: '::part(label)'
851
+ const { label: label$1, host: host$3 } = {
852
+ label: { selector: '::part(label)' },
853
+ host: { selector: () => ':host' }
594
854
  };
595
855
 
596
856
  const Button = compose(
@@ -598,16 +858,16 @@ const Button = compose(
598
858
  mappings: {
599
859
  backgroundColor: {},
600
860
  borderRadius: {},
601
- color: { selector: selectors$5.label },
861
+ color: label$1,
602
862
  borderColor: {},
603
863
  borderStyle: {},
604
864
  borderWidth: {},
605
865
  fontSize: {},
606
866
  height: {},
607
- width: matchHostStyle(),
867
+ width: host$3,
608
868
  cursor: {},
609
- padding: [{ selector: selectors$5.label }],
610
- textDecoration: { selector: selectors$5.label }
869
+ padding: label$1,
870
+ textDecoration: label$1
611
871
  }
612
872
  }),
613
873
  draggableMixin,
@@ -619,7 +879,7 @@ const Button = compose(
619
879
  style: () =>
620
880
  `${resetStyles} ${editorOverrides} ${iconStyles} ${loadingIndicatorStyles}`,
621
881
  excludeAttrsSync: ['tabindex'],
622
- componentName: componentName$i
882
+ componentName: componentName$h
623
883
  })
624
884
  );
625
885
 
@@ -650,21 +910,25 @@ const loadingIndicatorStyles = `
650
910
  :host([loading="true"])::part(label) {
651
911
  visibility: hidden;
652
912
  }
913
+
914
+ vaadin-button {
915
+ width: 100%;
916
+ }
653
917
  `;
654
918
 
655
- customElements.define(componentName$i, Button);
919
+ customElements.define(componentName$h, Button);
656
920
 
657
- const componentName$h = getComponentName('checkbox');
921
+ const componentName$g = getComponentName('checkbox');
658
922
 
659
923
  const Checkbox = compose(
660
924
  createStyleMixin({
661
925
  mappings: {
662
- width: matchHostStyle(),
926
+ width: { selector: () => ':host' },
663
927
  cursor: [{}, { selector: '> label' }]
664
928
  }
665
929
  }),
666
930
  draggableMixin,
667
- inputMixin,
931
+ proxyInputMixin,
668
932
  componentNameValidationMixin
669
933
  )(
670
934
  createProxy({
@@ -674,19 +938,23 @@ const Checkbox = compose(
674
938
  :host {
675
939
  display: inline-block;
676
940
  }
941
+
942
+ vaadin-checkbox {
943
+ width: 100%;
944
+ }
677
945
  `,
678
946
  excludeAttrsSync: ['tabindex'],
679
- componentName: componentName$h
947
+ componentName: componentName$g
680
948
  })
681
949
  );
682
950
 
683
- customElements.define(componentName$h, Checkbox);
951
+ customElements.define(componentName$g, Checkbox);
684
952
 
685
- const componentName$g = getComponentName('loader-linear');
953
+ const componentName$f = getComponentName('loader-linear');
686
954
 
687
955
  class RawLoaderLinear extends DescopeBaseClass {
688
956
  static get componentName() {
689
- return componentName$g;
957
+ return componentName$f;
690
958
  }
691
959
  constructor() {
692
960
  super();
@@ -699,6 +967,7 @@ class RawLoaderLinear extends DescopeBaseClass {
699
967
  }
700
968
  :host {
701
969
  position: relative;
970
+ display: inline-block
702
971
  }
703
972
  div::after {
704
973
  content: '';
@@ -706,6 +975,10 @@ class RawLoaderLinear extends DescopeBaseClass {
706
975
  position: absolute;
707
976
  left: 0;
708
977
  }
978
+
979
+ :host > div {
980
+ width: 100%;
981
+ }
709
982
  </style>
710
983
  <div></div>
711
984
  `;
@@ -719,16 +992,17 @@ class RawLoaderLinear extends DescopeBaseClass {
719
992
 
720
993
  const selectors$4 = {
721
994
  root: {},
722
- after: { selector: '::after' }
995
+ after: { selector: '::after' },
996
+ host: { selector: () => ':host' }
723
997
  };
724
998
 
725
- const { root: root$1, after: after$1 } = selectors$4;
999
+ const { root: root$1, after: after$1, host: host$2 } = selectors$4;
726
1000
 
727
1001
  const LoaderLinear = compose(
728
1002
  createStyleMixin({
729
1003
  mappings: {
730
1004
  display: root$1,
731
- width: matchHostStyle(root$1),
1005
+ width: host$2,
732
1006
  height: [root$1, after$1],
733
1007
  borderRadius: [root$1, after$1],
734
1008
  surfaceColor: [{ property: 'background-color' }],
@@ -743,13 +1017,13 @@ const LoaderLinear = compose(
743
1017
  componentNameValidationMixin
744
1018
  )(RawLoaderLinear);
745
1019
 
746
- customElements.define(componentName$g, LoaderLinear);
1020
+ customElements.define(componentName$f, LoaderLinear);
747
1021
 
748
- const componentName$f = getComponentName('loader-radial');
1022
+ const componentName$e = getComponentName('loader-radial');
749
1023
 
750
1024
  class RawLoaderRadial extends DescopeBaseClass {
751
1025
  static get componentName() {
752
- return componentName$f;
1026
+ return componentName$e;
753
1027
  }
754
1028
  constructor() {
755
1029
  super();
@@ -762,6 +1036,7 @@ class RawLoaderRadial extends DescopeBaseClass {
762
1036
  }
763
1037
  :host {
764
1038
  position: relative;
1039
+ display: inline-flex;
765
1040
  }
766
1041
  :host > div {
767
1042
  animation-name: spin;
@@ -781,7 +1056,7 @@ const LoaderRadial = compose(
781
1056
  createStyleMixin({
782
1057
  mappings: {
783
1058
  display: {},
784
- width: matchHostStyle({}),
1059
+ width: {},
785
1060
  height: {},
786
1061
  spinnerWidth: { property: 'border-width' },
787
1062
  spinnerStyle: { property: 'border-style' },
@@ -800,133 +1075,13 @@ const LoaderRadial = compose(
800
1075
  componentNameValidationMixin
801
1076
  )(RawLoaderRadial);
802
1077
 
803
- customElements.define(componentName$f, LoaderRadial);
804
-
805
- const selectors$3 = {
806
- label: '::part(label)',
807
- input: '::part(input-field)',
808
- readOnlyInput: '[readonly]::part(input-field)::after',
809
- placeholder: '> input:placeholder-shown'
810
- };
811
-
812
- var textFieldMappings = {
813
- color: { selector: selectors$3.input },
814
- backgroundColor: { selector: selectors$3.input },
815
- color: { selector: selectors$3.input },
816
- width: matchHostStyle({}),
817
- borderColor: [
818
- { selector: selectors$3.input },
819
- { selector: selectors$3.readOnlyInput }
820
- ],
821
- borderWidth: [
822
- { selector: selectors$3.input },
823
- { selector: selectors$3.readOnlyInput }
824
- ],
825
- borderStyle: [
826
- { selector: selectors$3.input },
827
- { selector: selectors$3.readOnlyInput }
828
- ],
829
- borderRadius: { selector: selectors$3.input },
830
- boxShadow: { selector: selectors$3.input },
831
- fontSize: {},
832
- height: { selector: selectors$3.input },
833
- padding: { selector: selectors$3.input },
834
- outline: { selector: selectors$3.input },
835
- outlineOffset: { selector: selectors$3.input },
836
-
837
- placeholderColor: { selector: selectors$3.placeholder, property: 'color' }
838
- };
839
-
840
- const componentName$e = getComponentName('text-field');
841
-
842
- let overrides$6 = ``;
843
-
844
- const TextField = compose(
845
- createStyleMixin({
846
- mappings: textFieldMappings
847
- }),
848
- draggableMixin,
849
- inputMixin,
850
- componentNameValidationMixin
851
- )(
852
- createProxy({
853
- slots: ['prefix', 'suffix'],
854
- wrappedEleName: 'vaadin-text-field',
855
- style: () => overrides$6,
856
- excludeAttrsSync: ['tabindex'],
857
- componentName: componentName$e
858
- })
859
- );
860
-
861
- overrides$6 = `
862
- :host {
863
- display: inline-block;
864
- }
865
-
866
- vaadin-text-field {
867
- margin: 0;
868
- padding: 0;
869
- }
870
- vaadin-text-field::part(input-field) {
871
- overflow: hidden;
872
- }
873
- vaadin-text-field[readonly] > input:placeholder-shown {
874
- opacity: 1;
875
- }
876
- vaadin-text-field input:-webkit-autofill,
877
- vaadin-text-field input:-webkit-autofill::first-line,
878
- vaadin-text-field input:-webkit-autofill:hover,
879
- vaadin-text-field input:-webkit-autofill:active,
880
- vaadin-text-field input:-webkit-autofill:focus {
881
- -webkit-text-fill-color: var(${TextField.cssVarList.color});
882
- box-shadow: 0 0 0 var(${TextField.cssVarList.height}) var(${TextField.cssVarList.backgroundColor}) inset;
883
- }
884
- vaadin-text-field > label,
885
- vaadin-text-field::part(input-field) {
886
- cursor: pointer;
887
- color: var(${TextField.cssVarList.color});
888
- }
889
- vaadin-text-field::part(input-field):focus {
890
- cursor: text;
891
- }
892
- vaadin-text-field[required]::part(required-indicator)::after {
893
- font-size: "12px";
894
- content: "*";
895
- color: var(${TextField.cssVarList.color});
896
- }
897
- vaadin-text-field[readonly]::part(input-field)::after {
898
- border: 0 solid;
899
- }
900
- `;
901
-
902
- customElements.define(componentName$e, TextField);
903
-
904
- const template = document.createElement('template');
905
-
906
- const componentName$d = getComponentName('combo');
1078
+ customElements.define(componentName$e, LoaderRadial);
907
1079
 
908
- template.innerHTML = `
909
- <descope-button></descope-button>
910
- <descope-text-field></descope-text-field>
911
- `;
912
-
913
- class Combo extends DescopeBaseClass {
914
- constructor() {
915
- super();
916
-
917
- this.attachShadow({ mode: 'open' }).appendChild(
918
- template.content.cloneNode(true)
919
- );
920
- }
921
- }
922
-
923
- customElements.define(componentName$d, Combo);
924
-
925
- const componentName$c = getComponentName('container');
1080
+ const componentName$d = getComponentName('container');
926
1081
 
927
1082
  class RawContainer extends DescopeBaseClass {
928
1083
  static get componentName() {
929
- return componentName$c;
1084
+ return componentName$d;
930
1085
  }
931
1086
  constructor() {
932
1087
  super();
@@ -935,6 +1090,13 @@ class RawContainer extends DescopeBaseClass {
935
1090
  <style>
936
1091
  :host > slot {
937
1092
  box-sizing: border-box;
1093
+ width: 100%;
1094
+ height: 100%;
1095
+ display: flex;
1096
+ overflow: auto;
1097
+ }
1098
+ :host {
1099
+ display: inline-block;
938
1100
  }
939
1101
  </style>
940
1102
  <slot></slot>
@@ -950,8 +1112,8 @@ class RawContainer extends DescopeBaseClass {
950
1112
  const Container = compose(
951
1113
  createStyleMixin({
952
1114
  mappings: {
953
- height: matchHostStyle(),
954
- width: matchHostStyle(),
1115
+ height: { selector: () => ':host' },
1116
+ width: { selector: () => ':host' },
955
1117
 
956
1118
  verticalPadding: [
957
1119
  { property: 'padding-top' },
@@ -962,7 +1124,6 @@ const Container = compose(
962
1124
  { property: 'padding-right' }
963
1125
  ],
964
1126
 
965
- display: {}, // maybe this should be hardcoded to flex
966
1127
  flexDirection: {},
967
1128
  justifyContent: {},
968
1129
  alignItems: {},
@@ -982,244 +1143,203 @@ const Container = compose(
982
1143
  componentNameValidationMixin
983
1144
  )(RawContainer);
984
1145
 
985
- customElements.define(componentName$c, Container);
1146
+ customElements.define(componentName$d, Container);
986
1147
 
987
- const componentName$b = getComponentName('date-picker');
1148
+ const componentName$c = getComponentName('date-picker');
988
1149
 
989
1150
  const DatePicker = compose(
990
1151
  draggableMixin,
991
1152
  componentNameValidationMixin
992
1153
  )(
993
1154
  createProxy({
994
- componentName: componentName$b,
1155
+ componentName: componentName$c,
995
1156
  slots: ['prefix', 'suffix'],
996
1157
  wrappedEleName: 'vaadin-date-picker',
997
1158
  style: ``
998
1159
  })
999
1160
  );
1000
1161
 
1001
- customElements.define(componentName$b, DatePicker);
1002
-
1003
- const getChildObserver = (callback) => {
1004
- return new MutationObserver((mutationsList) => {
1005
- for (const mutation of mutationsList) {
1006
- if (mutation.type === 'childList') {
1007
- callback(mutation);
1008
- }
1009
- }
1010
- });
1011
- };
1012
-
1013
- const insertNestingLevel = (srcEle, nestingEle) => {
1014
- nestingEle.append(...srcEle.childNodes);
1015
- srcEle.appendChild(nestingEle);
1016
- };
1017
-
1018
- // adds a nesting element to the component, and move all existing children
1019
- // to be under the nesting element
1020
- const enforceNestingElementsStylesMixin =
1021
- ({ nestingElementTagName, nestingElementDestSlotName, forwardAttrOptions }) =>
1022
- (superclass) => {
1023
- const getChildNodeEle = () =>
1024
- Object.assign(document.createElement(nestingElementTagName), {
1025
- slot: nestingElementDestSlotName
1026
- });
1027
-
1028
- let childObserver;
1029
-
1030
- const getObserver = () => childObserver;
1031
-
1032
- return class EnforceNestingElementsStylesMixinClass extends superclass {
1033
- constructor() {
1034
- super();
1035
-
1036
- const childObserverCallback = () => {
1037
- // we are going to change the DOM, so we need to disconnect the observer before
1038
- // and reconnect it after the child component is added
1039
- getObserver().disconnect(this.shadowRoot.host);
1040
-
1041
- const isNestingElementExist = this.shadowRoot.host.querySelector(nestingElementTagName);
1042
- const hasNewChildren = this.shadowRoot.host.childNodes.length > 0;
1043
-
1044
- if (!isNestingElementExist && hasNewChildren) {
1045
- // if before there were no children and now there are children - insert
1046
- insertNestingLevel(this.shadowRoot.host, getChildNodeEle());
1047
- } else if (isNestingElementExist && hasNewChildren) {
1048
- // if children existed, and they changed -
1049
- // we need to update (move) the new children into
1050
- // descope-text and remove previous children
1051
- this.shadowRoot.host.querySelector(child).remove();
1052
- insertNestingLevel(this.shadowRoot.host, getChildNodeEle());
1053
- }
1054
- else if (isNestingElementExist && !hasNewChildren) {
1055
- // if children existed and now there are none -
1056
- // we need to remove descope-text completely
1057
- this.shadowRoot.host.querySelector(child).remove();
1058
- }
1059
-
1060
- // we need a new observer, because we remove the nesting element
1061
- this.shadowRoot.host.querySelector(nestingElementTagName) &&
1062
- forwardAttrs(
1063
- this.shadowRoot.host,
1064
- this.shadowRoot.host.querySelector(nestingElementTagName),
1065
- forwardAttrOptions
1066
- );
1067
-
1068
- getObserver().observe(this.shadowRoot.host, {
1069
- childList: true
1070
- });
1071
- };
1072
-
1073
- childObserver = getChildObserver(childObserverCallback);
1074
- }
1075
-
1076
- connectedCallback() {
1077
- super.connectedCallback?.();
1078
-
1079
- if (this.shadowRoot.host.childNodes.length > 0) {
1080
- // on the first render - we want to move all component's children to be under descope-text
1081
- insertNestingLevel(this.shadowRoot.host, getChildNodeEle());
1082
-
1083
- forwardAttrs(
1084
- this.shadowRoot.host,
1085
- this.shadowRoot.host.querySelector(nestingElementTagName),
1086
- forwardAttrOptions
1087
- );
1088
- }
1089
-
1090
- getObserver().observe(this.shadowRoot.host, {
1091
- childList: true
1092
- });
1093
- }
1094
- };
1095
- };
1096
-
1097
- const componentName$a = getComponentName('text');
1098
-
1099
- class RawText extends DescopeBaseClass {
1100
- static get componentName() {
1101
- return componentName$a;
1102
- }
1103
- constructor() {
1104
- super();
1105
- const template = document.createElement('template');
1106
- template.innerHTML = `<slot></slot>`;
1107
-
1108
- this.attachShadow({ mode: 'open' });
1109
- this.shadowRoot.appendChild(template.content.cloneNode(true));
1110
-
1111
- this.baseSelector = ':host > slot';
1112
- }
1113
- }
1114
-
1115
- const Text = compose(
1116
- createStyleMixin({
1117
- mappings: {
1118
- fontFamily: {},
1119
- lineHeight: {},
1120
- fontStyle: {},
1121
- fontSize: {},
1122
- fontWeight: {},
1123
- width: {},
1124
- color: {},
1125
- letterSpacing: {},
1126
- textShadow: {},
1127
- borderWidth: {},
1128
- borderStyle: {},
1129
- borderColor: {},
1130
- textTransform: {},
1131
- textAlign: matchHostStyle(),
1132
- display: matchHostStyle()
1133
- }
1134
- }),
1135
- draggableMixin,
1136
- componentNameValidationMixin
1137
- )(RawText);
1162
+ customElements.define(componentName$c, DatePicker);
1138
1163
 
1139
- const componentName$9 = getComponentName('divider');
1164
+ const componentName$b = getComponentName('divider');
1140
1165
  class RawDivider extends DescopeBaseClass {
1141
1166
  static get componentName() {
1142
- return componentName$9;
1167
+ return componentName$b;
1143
1168
  }
1144
1169
  constructor() {
1145
1170
  super();
1171
+
1146
1172
  const template = document.createElement('template');
1147
1173
  template.innerHTML = `
1148
1174
  <style>
1149
1175
  :host > div {
1150
1176
  display: flex;
1151
1177
  height: 100%;
1178
+ width: 100%;
1152
1179
  }
1153
1180
  :host > div::before,
1154
1181
  :host > div::after {
1155
1182
  content: '';
1156
1183
  flex-grow: 1;
1157
- width: 100%;
1158
1184
  }
1159
- ::slotted(*) {
1185
+
1186
+ descope-text {
1160
1187
  flex-grow: 0;
1161
1188
  flex-shrink: 0;
1162
1189
  }
1190
+
1191
+ :host(:empty) descope-text {
1192
+ display: none;
1193
+ }
1194
+
1195
+ :host([vertical="true"]) div {
1196
+ width: fit-content;
1197
+ }
1198
+
1163
1199
  </style>
1164
1200
  <div>
1165
- <slot></slot>
1166
- <slot name="text"></slot>
1201
+ <descope-text>
1202
+ <slot></slot>
1203
+ </descope-text>
1167
1204
  </div>
1168
1205
  `;
1169
1206
  this.attachShadow({ mode: 'open' });
1170
1207
  this.shadowRoot.appendChild(template.content.cloneNode(true));
1171
1208
 
1172
1209
  this.baseSelector = ':host > div';
1210
+
1211
+ this.textComponent = this.shadowRoot.querySelector('descope-text');
1212
+
1213
+ forwardAttrs(this, this.textComponent, {
1214
+ includeAttrs: ['mode', 'variant', 'italic']
1215
+ });
1173
1216
  }
1174
1217
  }
1175
1218
 
1176
- const selectors$2 = {
1219
+ const selectors$3 = {
1177
1220
  root: { selector: '' },
1178
1221
  before: { selector: '::before' },
1179
1222
  after: { selector: '::after' },
1180
- slotted: { selector: () => '::slotted(*)' }
1223
+ text: { selector: 'descope-text' },
1224
+ host: { selector: () => ':host' },
1181
1225
  };
1182
1226
 
1183
- const { root, before, after, slotted } = selectors$2;
1227
+ const { root, before, after, text: text$2, host: host$1 } = selectors$3;
1184
1228
 
1185
1229
  const Divider = compose(
1186
- enforceNestingElementsStylesMixin({
1187
- nestingElementTagName: 'descope-text',
1188
- nestingElementDestSlotName: 'text',
1189
- forwardAttrOptions: {
1190
- includeAttrs: ['mode', 'variant'],
1191
- excludeAttrs: []
1192
- }
1193
- }),
1194
1230
  createStyleMixin({
1195
1231
  mappings: {
1232
+ maxTextWidth: { ...text$2, property: 'max-width' },
1196
1233
  minHeight: root,
1197
1234
  alignItems: root,
1198
1235
  alignSelf: root,
1199
1236
  flexDirection: root,
1200
- padding: slotted,
1201
- width: matchHostStyle(),
1202
- height: [before, after],
1237
+ textPadding: {...text$2, property: 'padding'},
1238
+ width: host$1,
1239
+ padding: host$1,
1203
1240
  backgroundColor: [before, after],
1204
1241
  opacity: [before, after],
1205
- textWidth: { ...slotted, property: 'width' }
1242
+ textWidth: { ...text$2, property: 'width' },
1243
+ dividerHeight: [{ ...before, property: 'height' }, { ...after, property: 'height' }],
1244
+ dividerWidth: [{ ...before, property: 'width' }, { ...after, property: 'width' }]
1206
1245
  },
1207
- nestedMappings: {
1208
- fontStyle: {
1209
- selector: Text.componentName,
1210
- property: Text.cssVarList.fontStyle
1211
- }
1212
- }
1213
1246
  }),
1214
1247
  draggableMixin,
1215
1248
  componentNameValidationMixin
1216
1249
  )(RawDivider);
1217
1250
 
1251
+ const componentName$a = getComponentName('text');
1252
+
1253
+ class RawText extends DescopeBaseClass {
1254
+ static get componentName() {
1255
+ return componentName$a;
1256
+ }
1257
+ constructor() {
1258
+ super();
1259
+ const template = document.createElement('template');
1260
+ template.innerHTML = `
1261
+ <style>
1262
+ :host {
1263
+ display: inline-block;
1264
+ }
1265
+ :host > slot {
1266
+ width: 100%;
1267
+ display: inline-block;
1268
+ }
1269
+ </style>
1270
+ <slot></slot>
1271
+ `;
1272
+
1273
+ this.attachShadow({ mode: 'open' });
1274
+ this.shadowRoot.appendChild(template.content.cloneNode(true));
1275
+
1276
+ this.baseSelector = ':host > slot';
1277
+ }
1278
+ }
1279
+
1280
+ const Text = compose(
1281
+ createStyleMixin({
1282
+ mappings: {
1283
+ fontFamily: {},
1284
+ lineHeight: {},
1285
+ fontStyle: {},
1286
+ fontSize: {},
1287
+ fontWeight: {},
1288
+ width: { selector: () => ':host' },
1289
+ color: {},
1290
+ letterSpacing: {},
1291
+ textShadow: {},
1292
+ borderWidth: {},
1293
+ borderStyle: {},
1294
+ borderColor: {},
1295
+ textTransform: {},
1296
+ textAlign: {},
1297
+ },
1298
+ }),
1299
+ draggableMixin,
1300
+ componentNameValidationMixin
1301
+ )(RawText);
1302
+
1218
1303
  customElements.define(componentName$a, Text);
1219
1304
 
1220
- customElements.define(componentName$9, Divider);
1305
+ customElements.define(componentName$b, Divider);
1306
+
1307
+ const selectors$2 = {
1308
+ label: '::part(label)',
1309
+ input: '::part(input-field)',
1310
+ readOnlyInput: '[readonly]::part(input-field)::after',
1311
+ placeholder: '> input:placeholder-shown',
1312
+ host: () => ':host'
1313
+ };
1314
+
1315
+ var textFieldMappings = {
1316
+ backgroundColor: { selector: selectors$2.input },
1317
+ color: { selector: selectors$2.input },
1318
+ width: { selector: selectors$2.host },
1319
+ borderColor: [
1320
+ { selector: selectors$2.input },
1321
+ { selector: selectors$2.readOnlyInput }
1322
+ ],
1323
+ borderWidth: [
1324
+ { selector: selectors$2.input },
1325
+ { selector: selectors$2.readOnlyInput }
1326
+ ],
1327
+ borderStyle: [
1328
+ { selector: selectors$2.input },
1329
+ { selector: selectors$2.readOnlyInput }
1330
+ ],
1331
+ borderRadius: { selector: selectors$2.input },
1332
+ boxShadow: { selector: selectors$2.input },
1333
+ fontSize: {},
1334
+ height: { selector: selectors$2.input },
1335
+ padding: { selector: selectors$2.input },
1336
+ outline: { selector: selectors$2.input },
1337
+ outlineOffset: { selector: selectors$2.input },
1338
+
1339
+ placeholderColor: { selector: selectors$2.placeholder, property: 'color' }
1340
+ };
1221
1341
 
1222
- const componentName$8 = getComponentName('email-field');
1342
+ const componentName$9 = getComponentName('email-field');
1223
1343
 
1224
1344
  let overrides$5 = ``;
1225
1345
 
@@ -1230,7 +1350,7 @@ const EmailField = compose(
1230
1350
  }
1231
1351
  }),
1232
1352
  draggableMixin,
1233
- inputMixin,
1353
+ proxyInputMixin,
1234
1354
  componentNameValidationMixin
1235
1355
  )(
1236
1356
  createProxy({
@@ -1238,7 +1358,7 @@ const EmailField = compose(
1238
1358
  wrappedEleName: 'vaadin-email-field',
1239
1359
  style: () => overrides$5,
1240
1360
  excludeAttrsSync: ['tabindex'],
1241
- componentName: componentName$8
1361
+ componentName: componentName$9
1242
1362
  })
1243
1363
  );
1244
1364
 
@@ -1282,12 +1402,12 @@ overrides$5 = `
1282
1402
  }
1283
1403
  `;
1284
1404
 
1285
- customElements.define(componentName$8, EmailField);
1405
+ customElements.define(componentName$9, EmailField);
1286
1406
 
1287
- const componentName$7 = getComponentName('link');
1407
+ const componentName$8 = getComponentName('link');
1288
1408
  class RawLink extends DescopeBaseClass {
1289
1409
  static get componentName() {
1290
- return componentName$7;
1410
+ return componentName$8;
1291
1411
  }
1292
1412
  constructor() {
1293
1413
  super();
@@ -1304,7 +1424,9 @@ class RawLink extends DescopeBaseClass {
1304
1424
  </style>
1305
1425
  <div>
1306
1426
  <a>
1307
- <slot name="text"></slot>
1427
+ <descope-text>
1428
+ <slot></slot>
1429
+ </descope-text>
1308
1430
  </a>
1309
1431
  </div>
1310
1432
  `;
@@ -1312,63 +1434,56 @@ class RawLink extends DescopeBaseClass {
1312
1434
  this.attachShadow({ mode: 'open' });
1313
1435
  this.shadowRoot.appendChild(template.content.cloneNode(true));
1314
1436
 
1315
- forwardAttrs(this.shadowRoot.host, this.shadowRoot.querySelector('a'), {
1437
+ forwardAttrs(this, this.shadowRoot.querySelector('a'), {
1316
1438
  includeAttrs: ['href', 'target', 'tooltip'],
1317
1439
  mapAttrs: {
1318
1440
  tooltip: 'title'
1319
1441
  }
1320
1442
  });
1321
1443
 
1444
+ forwardAttrs(this, this.shadowRoot.querySelector('descope-text'), {
1445
+ includeAttrs: ['mode', 'variant'],
1446
+ });
1447
+
1322
1448
  this.baseSelector = ':host > div';
1323
1449
  }
1324
1450
  }
1325
1451
 
1326
1452
  const selectors$1 = {
1327
- anchor: { selector: '> a' }
1453
+ host: { selector: () => 'host' },
1454
+ anchor: { selector: '> a' },
1455
+ text: { selector: Text.componentName }
1328
1456
  };
1329
1457
 
1330
- const { anchor } = selectors$1;
1458
+ const { anchor, text: text$1, host } = selectors$1;
1331
1459
 
1332
1460
  const Link = compose(
1333
- enforceNestingElementsStylesMixin({
1334
- nestingElementTagName: 'descope-text',
1335
- nestingElementDestSlotName: 'text',
1336
- forwardAttrOptions: {
1337
- includeAttrs: ['variant', 'italic', 'uppercase', 'lowercase']
1338
- }
1339
- }),
1340
1461
  createStyleMixin({
1341
1462
  mappings: {
1342
- width: matchHostStyle(),
1463
+ width: host,
1343
1464
  textAlign: {},
1344
- color: anchor,
1465
+ color: [anchor, { ...text$1, property: Text.cssVarList.color }],
1345
1466
  cursor: anchor,
1346
1467
  borderBottomWidth: anchor,
1347
1468
  borderBottomStyle: anchor,
1348
1469
  borderBottomColor: anchor
1349
1470
  },
1350
- nestedMappings: {
1351
- color: {
1352
- selector: Text.componentName,
1353
- property: Text.cssVarList.color
1354
- }
1355
- }
1356
1471
  }),
1357
1472
  hoverableMixin(anchor.selector),
1358
1473
  draggableMixin,
1359
1474
  componentNameValidationMixin
1360
1475
  )(RawLink);
1361
1476
 
1362
- customElements.define(componentName$7, Link);
1477
+ customElements.define(componentName$8, Link);
1363
1478
 
1364
- const componentName$6 = getComponentName('logo');
1479
+ const componentName$7 = getComponentName('logo');
1365
1480
 
1366
1481
  let style;
1367
1482
  const getStyle = () => style;
1368
1483
 
1369
1484
  class RawLogo extends DescopeBaseClass {
1370
1485
  static get componentName() {
1371
- return componentName$6;
1486
+ return componentName$7;
1372
1487
  }
1373
1488
  constructor() {
1374
1489
  super();
@@ -1401,7 +1516,7 @@ const Logo = compose(
1401
1516
 
1402
1517
  style = `
1403
1518
  :host {
1404
- display: inline-block;
1519
+ display: inline-flex;
1405
1520
  }
1406
1521
  :host > div {
1407
1522
  display: inline-block;
@@ -1409,9 +1524,9 @@ style = `
1409
1524
  }
1410
1525
  `;
1411
1526
 
1412
- customElements.define(componentName$6, Logo);
1527
+ customElements.define(componentName$7, Logo);
1413
1528
 
1414
- const componentName$5 = getComponentName('number-field');
1529
+ const componentName$6 = getComponentName('number-field');
1415
1530
 
1416
1531
  let overrides$4 = ``;
1417
1532
 
@@ -1422,7 +1537,7 @@ const NumberField = compose(
1422
1537
  }
1423
1538
  }),
1424
1539
  draggableMixin,
1425
- inputMixin,
1540
+ proxyInputMixin,
1426
1541
  componentNameValidationMixin
1427
1542
  )(
1428
1543
  createProxy({
@@ -1430,7 +1545,7 @@ const NumberField = compose(
1430
1545
  wrappedEleName: 'vaadin-number-field',
1431
1546
  style: () => overrides$4,
1432
1547
  excludeAttrsSync: ['tabindex'],
1433
- componentName: componentName$5
1548
+ componentName: componentName$6
1434
1549
  })
1435
1550
  );
1436
1551
 
@@ -1474,7 +1589,9 @@ overrides$4 = `
1474
1589
  }
1475
1590
  `;
1476
1591
 
1477
- customElements.define(componentName$5, NumberField);
1592
+ customElements.define(componentName$6, NumberField);
1593
+
1594
+ var BaseInputClass = inputMixin(HTMLElement); //todo: maybe we should use base class?
1478
1595
 
1479
1596
  const focusElement = (ele) => {
1480
1597
  ele?.focus();
@@ -1490,29 +1607,22 @@ const getSanitizedCharacters = (str) => {
1490
1607
  return [...pin]; // creating array of chars
1491
1608
  };
1492
1609
 
1493
- const componentName$4 = getComponentName('passcode-internal');
1610
+ const componentName$5 = getComponentName('passcode-internal');
1494
1611
 
1495
- class PasscodeInternal extends HTMLElement {
1612
+ class PasscodeInternal extends BaseInputClass {
1496
1613
  static get observedAttributes() {
1497
1614
  return [
1615
+ ...BaseInputClass.observedAttributes,
1498
1616
  'disabled',
1499
1617
  'bordered',
1500
- 'size',
1501
- 'required',
1502
- 'pattern'
1618
+ 'size'
1503
1619
  ];
1504
1620
  }
1505
1621
 
1506
1622
  static get componentName() {
1507
- return componentName$4;
1508
- }
1509
-
1510
- static get formAssociated() {
1511
- return true;
1623
+ return componentName$5;
1512
1624
  }
1513
1625
 
1514
- #internals
1515
-
1516
1626
  constructor() {
1517
1627
  super();
1518
1628
  const template = document.createElement('template');
@@ -1536,23 +1646,9 @@ class PasscodeInternal extends HTMLElement {
1536
1646
 
1537
1647
  this.baseSelector = ':host > div';
1538
1648
 
1539
- this.#internals = this.attachInternals();
1540
-
1541
1649
  this.inputs = Array.from(this.querySelectorAll('descope-text-field'));
1542
1650
  }
1543
1651
 
1544
- checkValidity() {
1545
- // we need to toggle the has-error-message so the text inside the digits will become red when there is an error
1546
- if (this.#internals.validity.valid) {
1547
- this.inputs.forEach(input => input.removeAttribute('has-error-message'));
1548
- } else {
1549
- this.inputs.forEach(input => input.setAttribute('has-error-message', 'true'));
1550
- // we need to call it so the has-error-message with have the correct format (="true")
1551
- this.oninvalid?.();
1552
- }
1553
- return this.#internals.validity.valid
1554
- }
1555
-
1556
1652
  get digits() {
1557
1653
  return Number.parseInt(this.getAttribute('digits')) || 6
1558
1654
  }
@@ -1561,59 +1657,54 @@ class PasscodeInternal extends HTMLElement {
1561
1657
  return this.inputs.map(({ value }) => value).join('')
1562
1658
  }
1563
1659
 
1564
- set value(val) { }
1660
+ set value(val) {
1661
+ if(val === this.value) return;
1662
+
1663
+ const charArr = getSanitizedCharacters(val);
1565
1664
 
1566
- get isRequired() {
1567
- return this.hasAttribute('required') && this.getAttribute('required') !== 'false'
1665
+ if (charArr.length) {
1666
+ this.fillDigits(charArr, this.inputs[0]);
1667
+ }
1568
1668
  }
1569
1669
 
1570
1670
  get pattern() {
1571
1671
  return `^$|^\\d{${this.digits},}$`
1572
1672
  }
1573
1673
 
1574
- get valueMissingErrMsg() {
1575
- return 'Please fill out this field.'
1576
- }
1577
-
1578
- get patternMismatchErrMsg() {
1579
- return `Must be a ${this.digits} digits number.`
1580
- }
1581
-
1582
- get validity() {
1583
- return this.#internals.validity;
1584
- }
1585
-
1586
- get validationMessage() {
1587
- return this.#internals.validationMessage;
1588
- }
1589
-
1590
- reportValidity() {
1591
- this.#internals.reportValidity();
1674
+ handleInputsInvalid() {
1675
+ setTimeout(() => {
1676
+ if (this.hasAttribute('invalid')) {
1677
+ this.inputs.forEach(input => input.setAttribute('invalid', 'true'));
1678
+ }
1679
+ });
1592
1680
  }
1593
1681
 
1594
- formAssociatedCallback() {
1595
- this.setValidity?.();
1682
+ handleInputsValid() {
1683
+ this.inputs.forEach(input => input.removeAttribute('invalid'));
1596
1684
  }
1597
1685
 
1598
- setValidity = () => {
1686
+ getValidity() {
1599
1687
  if (this.isRequired && !this.value) {
1600
- this.#internals.setValidity({ valueMissing: true }, this.valueMissingErrMsg);
1688
+ return { valueMissing: true };
1601
1689
  }
1602
1690
  else if (this.pattern && !new RegExp(this.pattern).test(this.value)) {
1603
- this.#internals.setValidity({ patternMismatch: true }, this.patternMismatchErrMsg);
1691
+ return { patternMismatch: true };
1604
1692
  }
1605
1693
  else {
1606
- this.#internals.setValidity({});
1694
+ return {}
1607
1695
  }
1608
1696
  };
1609
1697
 
1698
+ handleFocus() {
1699
+ this.inputs[0].focus();
1700
+ }
1701
+
1610
1702
  async connectedCallback() {
1611
- this.setValidity();
1703
+ super.connectedCallback();
1612
1704
  this.initInputs();
1613
1705
 
1614
- this.onfocus = () => {
1615
- this.inputs[0].focus();
1616
- };
1706
+ this.addEventListener('invalid', this.handleInputsInvalid);
1707
+ this.addEventListener('valid', this.handleInputsValid);
1617
1708
  }
1618
1709
 
1619
1710
  getInputIdx(inputEle) {
@@ -1644,6 +1735,10 @@ class PasscodeInternal extends HTMLElement {
1644
1735
  !currentInput.hasAttribute('focused') && focusElement(currentInput);
1645
1736
  };
1646
1737
 
1738
+ handleBlur() {
1739
+ this.handleInputsInvalid();
1740
+ }
1741
+
1647
1742
  initInputs() {
1648
1743
  this.inputs.forEach((input) => {
1649
1744
 
@@ -1652,7 +1747,7 @@ class PasscodeInternal extends HTMLElement {
1652
1747
  // if not, the component is no longer focused and we should simulate blur
1653
1748
  input.addEventListener('blur', () => {
1654
1749
  const timerId = setTimeout(() => {
1655
- this.dispatchEvent(new Event('blur'));
1750
+ this.dispatchBlur();
1656
1751
  });
1657
1752
 
1658
1753
  this.inputs.forEach((ele) =>
@@ -1660,13 +1755,13 @@ class PasscodeInternal extends HTMLElement {
1660
1755
  );
1661
1756
  });
1662
1757
 
1663
- input.oninput = (e) => {
1758
+ input.oninput = () => {
1664
1759
  const charArr = getSanitizedCharacters(input.value);
1665
1760
 
1666
1761
  if (!charArr.length) input.value = ''; // if we got an invalid value we want to clear the input
1667
1762
  else this.fillDigits(charArr, input);
1668
1763
 
1669
- this.setValidity();
1764
+ this.dispatchInput();
1670
1765
  };
1671
1766
 
1672
1767
  input.onkeydown = ({ key }) => {
@@ -1679,33 +1774,89 @@ class PasscodeInternal extends HTMLElement {
1679
1774
  !prevInput.hasAttribute('focused') && setTimeout(() => {
1680
1775
  focusElement(prevInput);
1681
1776
  });
1777
+
1778
+ this.dispatchInput();
1682
1779
  } else if (key.match(/^(\d)$/g)) { // if input is a digit
1683
1780
  input.value = ''; // we are clearing the previous value so we can override it with the new value
1684
1781
  }
1685
1782
 
1686
- this.setValidity();
1687
1783
  };
1688
1784
  });
1689
1785
  }
1690
1786
 
1691
- attributeChangedCallback(
1692
- attrName,
1693
- oldValue,
1694
- newValue
1695
- ) {
1696
- const validationRelatedAttributes = ['required', 'pattern'];
1787
+ attributeChangedCallback(attrName, oldValue, newValue) {
1788
+ super.attributeChangedCallback(attrName, oldValue, newValue);
1697
1789
 
1698
1790
  if (oldValue !== newValue) {
1699
- if (validationRelatedAttributes.includes(attrName)) {
1700
- this.setValidity();
1701
- }
1702
- else if (PasscodeInternal.observedAttributes.includes(attrName)) {
1791
+ if (PasscodeInternal.observedAttributes.includes(attrName) && !BaseInputClass.observedAttributes.includes(attrName)) {
1703
1792
  this.inputs.forEach((input) => input.setAttribute(attrName, newValue));
1704
1793
  }
1705
1794
  }
1706
1795
  }
1707
1796
  }
1708
1797
 
1798
+ const componentName$4 = getComponentName('text-field');
1799
+
1800
+ let overrides$3 = ``;
1801
+
1802
+ const TextField = compose(
1803
+ createStyleMixin({
1804
+ mappings: textFieldMappings
1805
+ }),
1806
+ draggableMixin,
1807
+ proxyInputMixin,
1808
+ componentNameValidationMixin
1809
+ )(
1810
+ createProxy({
1811
+ slots: ['prefix', 'suffix'],
1812
+ wrappedEleName: 'vaadin-text-field',
1813
+ style: () => overrides$3,
1814
+ excludeAttrsSync: ['tabindex'],
1815
+ componentName: componentName$4
1816
+ })
1817
+ );
1818
+
1819
+ overrides$3 = `
1820
+ :host {
1821
+ display: inline-block;
1822
+ }
1823
+
1824
+ vaadin-text-field {
1825
+ margin: 0;
1826
+ padding: 0;
1827
+ }
1828
+ vaadin-text-field::part(input-field) {
1829
+ overflow: hidden;
1830
+ }
1831
+ vaadin-text-field[readonly] > input:placeholder-shown {
1832
+ opacity: 1;
1833
+ }
1834
+ vaadin-text-field input:-webkit-autofill,
1835
+ vaadin-text-field input:-webkit-autofill::first-line,
1836
+ vaadin-text-field input:-webkit-autofill:hover,
1837
+ vaadin-text-field input:-webkit-autofill:active,
1838
+ vaadin-text-field input:-webkit-autofill:focus {
1839
+ -webkit-text-fill-color: var(${TextField.cssVarList.color});
1840
+ box-shadow: 0 0 0 var(${TextField.cssVarList.height}) var(${TextField.cssVarList.backgroundColor}) inset;
1841
+ }
1842
+ vaadin-text-field > label,
1843
+ vaadin-text-field::part(input-field) {
1844
+ cursor: pointer;
1845
+ color: var(${TextField.cssVarList.color});
1846
+ }
1847
+ vaadin-text-field::part(input-field):focus {
1848
+ cursor: text;
1849
+ }
1850
+ vaadin-text-field[required]::part(required-indicator)::after {
1851
+ font-size: "12px";
1852
+ content: "*";
1853
+ color: var(${TextField.cssVarList.color});
1854
+ }
1855
+ vaadin-text-field[readonly]::part(input-field)::after {
1856
+ border: 0 solid;
1857
+ }
1858
+ `;
1859
+
1709
1860
  const componentName$3 = getComponentName('passcode');
1710
1861
 
1711
1862
  const customMixin = (superclass) =>
@@ -1723,28 +1874,21 @@ const customMixin = (superclass) =>
1723
1874
  const template = document.createElement('template');
1724
1875
 
1725
1876
  template.innerHTML = `
1726
- <${componentName$4}
1727
- bordered="true"
1728
- name="code"
1729
- tabindex="0"
1730
- slot="input"
1731
- ></${componentName$4}>
1732
- `;
1733
-
1734
- // we are adding a slot under vaadin-text-field, it should reflect all descope-passcode children to be under vaadin-text-field, this is why it has a name & slot
1735
- const slotEle = Object.assign(document.createElement('slot'), {
1736
- name: 'input',
1737
- slot: 'input',
1738
- part: 'input'
1739
- });
1740
- this.proxyElement.appendChild(slotEle);
1877
+ <${componentName$5}
1878
+ bordered="true"
1879
+ name="code"
1880
+ tabindex="-1"
1881
+ slot="input"
1882
+ ></${componentName$5}>
1883
+ `;
1884
+
1885
+ this.proxyElement.appendChild(template.content.cloneNode(true));
1741
1886
 
1742
1887
  // we want to control when the element is out of focus
1743
1888
  // so the validations will be triggered blur event is dispatched from descope-passcode internal (and not every time focusing a digit)
1744
1889
  this.proxyElement._setFocused = () => { };
1745
1890
 
1746
- this.shadowRoot.host.appendChild(template.content.cloneNode(true));
1747
- this.inputElement = this.querySelector(componentName$4);
1891
+ this.inputElement = this.shadowRoot.querySelector(componentName$5);
1748
1892
 
1749
1893
  forwardAttrs(this.shadowRoot.host, this.inputElement, { includeAttrs: ['required', 'pattern'] });
1750
1894
 
@@ -1758,20 +1902,24 @@ const customMixin = (superclass) =>
1758
1902
  const { borderStyle, borderWidth, ...restTextFieldMappings } =
1759
1903
  textFieldMappings;
1760
1904
 
1905
+ const { digitField, label, requiredIndicator } = {
1906
+ digitField: { selector: () => TextField.componentName },
1907
+ label: { selector: '> label' },
1908
+ requiredIndicator: { selector: '[required]::part(required-indicator)::after' }
1909
+ };
1910
+
1911
+ const textVars = TextField.cssVarList;
1912
+
1761
1913
  const Passcode = compose(
1762
1914
  createStyleMixin({
1763
1915
  mappings: {
1764
- ...restTextFieldMappings
1916
+ ...restTextFieldMappings,
1917
+ borderColor: { ...digitField, property: textVars.borderColor },
1918
+ color: [restTextFieldMappings.color, label, requiredIndicator],
1765
1919
  },
1766
- nestedMappings: {
1767
- borderColor: {
1768
- selector: TextField.componentName,
1769
- property: TextField.cssVarList.borderColor
1770
- }
1771
- }
1772
1920
  }),
1773
1921
  draggableMixin,
1774
- inputMixin,
1922
+ proxyInputMixin,
1775
1923
  componentNameValidationMixin,
1776
1924
  customMixin
1777
1925
  )(
@@ -1781,63 +1929,50 @@ const Passcode = compose(
1781
1929
  style: () => `
1782
1930
  :host {
1783
1931
  --vaadin-field-default-width: auto;
1932
+ display: inline-block;
1784
1933
  }
1785
-
1786
- ::slotted([slot='input']) {
1934
+ descope-passcode-internal {
1787
1935
  -webkit-mask-image: none;
1788
1936
  display: flex;
1789
1937
  gap: 2px;
1790
1938
  align-items: center;
1791
1939
  padding: 0;
1792
1940
  }
1793
-
1794
1941
  vaadin-text-field::part(input-field) {
1795
1942
  background-color: transparent;
1796
1943
  padding: 0;
1944
+ overflow: hidden;
1797
1945
  }
1798
-
1799
- ${overrides$3}
1946
+ vaadin-text-field {
1947
+ margin: 0;
1948
+ padding: 0;
1949
+ }
1950
+ vaadin-text-field[readonly] > input:placeholder-shown {
1951
+ opacity: 1;
1952
+ }
1953
+ vaadin-text-field > label,
1954
+ vaadin-text-field::part(input-field) {
1955
+ cursor: pointer;
1956
+ }
1957
+ vaadin-text-field::part(input-field):focus {
1958
+ cursor: text;
1959
+ }
1960
+ vaadin-text-field[required]::part(required-indicator)::after {
1961
+ font-size: "12px";
1962
+ content: "*";
1963
+ }
1964
+ vaadin-text-field[readonly]::part(input-field)::after {
1965
+ border: 0 solid;
1966
+ }
1800
1967
  `,
1801
1968
  excludeAttrsSync: ['tabindex'],
1802
1969
  componentName: componentName$3
1803
1970
  })
1804
1971
  );
1805
1972
 
1806
- const overrides$3 = `
1807
- :host {
1808
- display: inline-block;
1809
- }
1810
-
1811
- vaadin-text-field {
1812
- margin: 0;
1813
- padding: 0;
1814
- }
1815
- vaadin-text-field::part(input-field) {
1816
- overflow: hidden;
1817
- }
1818
- vaadin-text-field[readonly] > input:placeholder-shown {
1819
- opacity: 1;
1820
- }
1821
-
1822
- vaadin-text-field > label,
1823
- vaadin-text-field::part(input-field) {
1824
- cursor: pointer;
1825
- color: var(${Passcode.cssVarList.color});
1826
- }
1827
- vaadin-text-field::part(input-field):focus {
1828
- cursor: text;
1829
- }
1830
- vaadin-text-field[required]::part(required-indicator)::after {
1831
- font-size: "12px";
1832
- content: "*";
1833
- color: var(${Passcode.cssVarList.color});
1834
- }
1835
- vaadin-text-field[readonly]::part(input-field)::after {
1836
- border: 0 solid;
1837
- }
1838
- `;
1973
+ customElements.define(componentName$4, TextField);
1839
1974
 
1840
- customElements.define(componentName$4, PasscodeInternal);
1975
+ customElements.define(componentName$5, PasscodeInternal);
1841
1976
 
1842
1977
  customElements.define(componentName$3, Passcode);
1843
1978
 
@@ -1858,7 +1993,7 @@ const PasswordField = compose(
1858
1993
  }
1859
1994
  }),
1860
1995
  draggableMixin,
1861
- inputMixin,
1996
+ proxyInputMixin,
1862
1997
  componentNameValidationMixin
1863
1998
  )(
1864
1999
  createProxy({
@@ -1919,12 +2054,12 @@ let overrides$1 = ``;
1919
2054
  const SwitchToggle = compose(
1920
2055
  createStyleMixin({
1921
2056
  mappings: {
1922
- width: matchHostStyle(),
2057
+ width: {selector: () => ':host'},
1923
2058
  cursor: [{}, { selector: '> label' }]
1924
2059
  }
1925
2060
  }),
1926
2061
  draggableMixin,
1927
- inputMixin,
2062
+ proxyInputMixin,
1928
2063
  componentNameValidationMixin
1929
2064
  )(
1930
2065
  createProxy({
@@ -1950,6 +2085,9 @@ overrides$1 = `
1950
2085
  --bgColor: #fff;
1951
2086
  --knobBgColor: #000;
1952
2087
  }
2088
+ vaadin-checkbox : {
2089
+ width: 100%;
2090
+ }
1953
2091
  vaadin-checkbox>label {
1954
2092
  cursor: pointer;
1955
2093
  border: 1px solid;
@@ -1976,6 +2114,7 @@ overrides$1 = `
1976
2114
  height: 0;
1977
2115
  width: 0;
1978
2116
  visibility: hidden;
2117
+ margin: 0;
1979
2118
  }
1980
2119
  vaadin-checkbox[checked]>label::after {
1981
2120
  transform: translateX(-100%);
@@ -1993,7 +2132,8 @@ const componentName = getComponentName('text-area');
1993
2132
  const selectors = {
1994
2133
  label: '::part(label)',
1995
2134
  input: '::part(input-field)',
1996
- required: '::part(required-indicator)::after'
2135
+ required: '::part(required-indicator)::after',
2136
+ host: () => ':host'
1997
2137
  };
1998
2138
 
1999
2139
  let overrides = ``;
@@ -2004,7 +2144,7 @@ const TextArea = compose(
2004
2144
  resize: { selector: '> textarea' },
2005
2145
  color: { selector: selectors.label },
2006
2146
  cursor: {},
2007
- width: matchHostStyle(),
2147
+ width: { selector: selectors.host },
2008
2148
  backgroundColor: { selector: selectors.input },
2009
2149
  borderWidth: { selector: selectors.input },
2010
2150
  borderStyle: { selector: selectors.input },
@@ -2015,7 +2155,7 @@ const TextArea = compose(
2015
2155
  }
2016
2156
  }),
2017
2157
  draggableMixin,
2018
- inputMixin,
2158
+ proxyInputMixin,
2019
2159
  componentNameValidationMixin
2020
2160
  )(
2021
2161
  createProxy({
@@ -2034,6 +2174,7 @@ overrides = `
2034
2174
 
2035
2175
  vaadin-text-area {
2036
2176
  margin: 0;
2177
+ width: 100%;
2037
2178
  }
2038
2179
  vaadin-text-area > label,
2039
2180
  vaadin-text-area::part(input-field) {
@@ -2078,9 +2219,9 @@ const getThemeRefs = (theme, prefix) =>
2078
2219
  const globalsThemeToStyle = (theme, themeName = '') => `
2079
2220
  *[data-theme="${themeName}"] {
2080
2221
  ${Object.entries(themeToCSSVarsObj(theme)).reduce(
2081
- (acc, entry) => (acc += `${entry.join(':')};\n`),
2082
- ''
2083
- )}
2222
+ (acc, entry) => (acc += `${entry.join(':')};\n`),
2223
+ ''
2224
+ )}
2084
2225
  }
2085
2226
  `;
2086
2227
 
@@ -2088,10 +2229,20 @@ const componentsThemeToStyleObj = (componentsTheme) =>
2088
2229
  transformTheme(componentsTheme, [], (path, val) => {
2089
2230
  const [component, ...restPath] = path;
2090
2231
  const property = restPath.pop();
2232
+ const componentName = getComponentName(component);
2233
+
2234
+ // we need a support for portal components theme (e.g. overlay)
2235
+ // this allows us to generate those themes under different sections
2236
+ // if the theme has root level attribute that starts with #
2237
+ // we are generating a new theme
2238
+ let themeName = 'theme';
2239
+
2240
+ if (restPath[0] && restPath[0].startsWith('#')) {
2241
+ themeName = restPath.shift();
2242
+ }
2091
2243
 
2092
2244
  // do not start with underscore -> key:value, must have 2 no underscore attrs in a row
2093
2245
  // starts with underscore -> attribute selector
2094
-
2095
2246
  const attrsSelector = restPath.reduce((acc, section, idx) => {
2096
2247
  if (section.startsWith('_'))
2097
2248
  return (acc += `[${kebabCase(section.replace(/^_/, ''))}="true"]`);
@@ -2111,30 +2262,53 @@ const componentsThemeToStyleObj = (componentsTheme) =>
2111
2262
  .join('')}"]`);
2112
2263
  }, '');
2113
2264
 
2114
- let selector = `${getComponentName(component)}${attrsSelector}`;
2265
+ let selector = `:host${attrsSelector ? `(${attrsSelector})` : ''}`;
2115
2266
 
2116
2267
  return {
2117
- [selector]: {
2118
- [property]: val
2268
+ [componentName]: {
2269
+ [themeName]: {
2270
+ [selector]: {
2271
+ [property]: val
2272
+ }
2273
+ }
2119
2274
  }
2120
2275
  };
2121
2276
  });
2122
2277
 
2123
- const componentsThemeToStyle = (componentsTheme, themeName = '') =>
2124
- Object.entries(componentsThemeToStyleObj(componentsTheme)).reduce(
2278
+
2279
+ const createComponentsTheme = (componentsTheme) => {
2280
+ const styleObj = componentsThemeToStyleObj(componentsTheme);
2281
+
2282
+ return Object.keys(styleObj).reduce(
2283
+ (acc, componentName) => {
2284
+ const componentThemes = styleObj[componentName];
2285
+
2286
+ return Object.assign(acc, {
2287
+ [componentName]: Object.keys(componentThemes)
2288
+ .reduce((acc, theme) =>
2289
+ Object.assign(acc, { [theme]: componentsThemeToStyle(componentThemes[theme]) }),
2290
+ {})
2291
+ })
2292
+ },
2293
+ {}
2294
+ );
2295
+ };
2296
+
2297
+ const componentsThemeToStyle = (componentsTheme) =>
2298
+ Object.entries(componentsTheme).reduce(
2125
2299
  (acc, [selector, vars]) =>
2126
- (acc += `*[data-theme="${themeName}"] ${selector} { \n${Object.entries(
2127
- vars
2128
- )
2129
- .map(([key, val]) => `${key}: ${val}`)
2130
- .join(';\n')} \n}\n\n`),
2300
+ (acc += `${selector} { \n${Object.entries(
2301
+ vars
2302
+ )
2303
+ .map(([key, val]) => `${key}: ${val}`)
2304
+ .join(';\n')} \n}\n\n`),
2131
2305
  ''
2132
2306
  );
2133
2307
 
2134
- const themeToStyle = ({ globals, components }, themeName) => `
2135
- ${globalsThemeToStyle(globals, themeName)}
2136
- ${componentsThemeToStyle(components, themeName)}
2137
- `;
2308
+ const themeToStyle = ({ globals, components }, themeName) => ({
2309
+ globals: globalsThemeToStyle(globals, themeName),
2310
+ components: createComponentsTheme(components)
2311
+ });
2138
2312
 
2139
2313
  const useVar = (varName) => `var(${varName})`;
2140
2314
 
@@ -2189,7 +2363,7 @@ const colors = genColors({
2189
2363
  surface: {
2190
2364
  main: 'lightgray',
2191
2365
  light: '#fff',
2192
- dark: '#000'
2366
+ dark: '#000',
2193
2367
  },
2194
2368
  primary: '#0082B5',
2195
2369
  secondary: '#7D14EB',
@@ -2299,11 +2473,11 @@ const mode = {
2299
2473
  surface: globalRefs$7.colors.surface
2300
2474
  };
2301
2475
 
2302
- const [helperTheme$1, helperRefs$1] = createHelperVars({ mode }, componentName$i);
2476
+ const [helperTheme$2, helperRefs$2] = createHelperVars({ mode }, componentName$h);
2303
2477
 
2304
2478
  const button = {
2305
- ...helperTheme$1,
2306
-
2479
+ ...helperTheme$2,
2480
+ [vars$c.width]: 'fit-content',
2307
2481
  size: {
2308
2482
  xs: {
2309
2483
  [vars$c.height]: '10px',
@@ -2347,34 +2521,34 @@ const button = {
2347
2521
 
2348
2522
  variant: {
2349
2523
  contained: {
2350
- [vars$c.color]: helperRefs$1.contrast,
2351
- [vars$c.backgroundColor]: helperRefs$1.main,
2524
+ [vars$c.color]: helperRefs$2.contrast,
2525
+ [vars$c.backgroundColor]: helperRefs$2.main,
2352
2526
  _hover: {
2353
- [vars$c.backgroundColor]: helperRefs$1.dark
2527
+ [vars$c.backgroundColor]: helperRefs$2.dark
2354
2528
  },
2355
2529
  _loading: {
2356
- [vars$c.backgroundColor]: helperRefs$1.main
2530
+ [vars$c.backgroundColor]: helperRefs$2.main
2357
2531
  }
2358
2532
  },
2359
2533
  outline: {
2360
- [vars$c.color]: helperRefs$1.main,
2361
- [vars$c.borderColor]: helperRefs$1.main,
2534
+ [vars$c.color]: helperRefs$2.main,
2535
+ [vars$c.borderColor]: helperRefs$2.main,
2362
2536
  _hover: {
2363
- [vars$c.color]: helperRefs$1.dark,
2364
- [vars$c.borderColor]: helperRefs$1.dark,
2537
+ [vars$c.color]: helperRefs$2.dark,
2538
+ [vars$c.borderColor]: helperRefs$2.dark,
2365
2539
  _error: {
2366
- [vars$c.color]: helperRefs$1.error
2540
+ [vars$c.color]: helperRefs$2.error
2367
2541
  }
2368
2542
  }
2369
2543
  },
2370
2544
  link: {
2371
- [vars$c.color]: helperRefs$1.main,
2545
+ [vars$c.color]: helperRefs$2.main,
2372
2546
  [vars$c.padding]: 0,
2373
2547
  [vars$c.margin]: 0,
2374
- [vars$c.lineHeight]: helperRefs$1.height,
2548
+ [vars$c.lineHeight]: helperRefs$2.height,
2375
2549
  [vars$c.borderRadius]: 0,
2376
2550
  _hover: {
2377
- [vars$c.color]: helperRefs$1.main,
2551
+ [vars$c.color]: helperRefs$2.main,
2378
2552
  [vars$c.textDecoration]: 'underline'
2379
2553
  }
2380
2554
  }
@@ -2442,7 +2616,7 @@ const textField = (vars) => ({
2442
2616
  [vars.borderColor]: globalRefs$6.colors.surface.main
2443
2617
  },
2444
2618
 
2445
- _hasErrorMessage: {
2619
+ _invalid: {
2446
2620
  [vars.borderColor]: globalRefs$6.colors.error.main,
2447
2621
  [vars.color]: globalRefs$6.colors.error.main,
2448
2622
  [vars.placeholderColor]: globalRefs$6.colors.error.light
@@ -2470,6 +2644,7 @@ const globalRefs$5 = getThemeRefs(globals);
2470
2644
  const vars$9 = TextArea.cssVarList;
2471
2645
 
2472
2646
  const textArea = {
2647
+ [vars$9.width]: '100%',
2473
2648
  [vars$9.color]: globalRefs$5.colors.primary.main,
2474
2649
  [vars$9.backgroundColor]: globalRefs$5.colors.surface.light,
2475
2650
  [vars$9.resize]: 'vertical',
@@ -2503,7 +2678,8 @@ const textArea = {
2503
2678
  const vars$8 = Checkbox.cssVarList;
2504
2679
 
2505
2680
  const checkbox = {
2506
- [vars$8.cursor]: 'pointer'
2681
+ [vars$8.cursor]: 'pointer',
2682
+ [vars$8.width]: 'fit-content'
2507
2683
  };
2508
2684
 
2509
2685
  const vars$7 = SwitchToggle.cssVarList;
@@ -2529,7 +2705,7 @@ const horizontalAlignment = {
2529
2705
  end: { horizontalAlignment: 'end' },
2530
2706
  };
2531
2707
 
2532
- const [helperTheme, helperRefs, helperVars] =
2708
+ const [helperTheme$1, helperRefs$1, helperVars] =
2533
2709
  createHelperVars({
2534
2710
  verticalAlignment,
2535
2711
  horizontalAlignment,
@@ -2537,8 +2713,8 @@ const [helperTheme, helperRefs, helperVars] =
2537
2713
  }, 'container');
2538
2714
 
2539
2715
  const container = {
2540
- ...helperTheme,
2541
- [vars$6.display]: 'flex',
2716
+ ...helperTheme$1,
2717
+ [vars$6.width]: '100%',
2542
2718
  verticalPadding: {
2543
2719
  sm: { [vars$6.verticalPadding]: '5px' },
2544
2720
  md: { [vars$6.verticalPadding]: '10px' },
@@ -2552,8 +2728,8 @@ const container = {
2552
2728
  direction: {
2553
2729
  row: {
2554
2730
  [vars$6.flexDirection]: 'row',
2555
- [vars$6.alignItems]: helperRefs.verticalAlignment,
2556
- [vars$6.justifyContent]: helperRefs.horizontalAlignment,
2731
+ [vars$6.alignItems]: helperRefs$1.verticalAlignment,
2732
+ [vars$6.justifyContent]: helperRefs$1.horizontalAlignment,
2557
2733
  horizontalAlignment: {
2558
2734
  spaceBetween: { [helperVars.horizontalAlignment]: 'space-between' },
2559
2735
  }
@@ -2561,8 +2737,8 @@ const container = {
2561
2737
 
2562
2738
  column: {
2563
2739
  [vars$6.flexDirection]: 'column',
2564
- [vars$6.alignItems]: helperRefs.horizontalAlignment,
2565
- [vars$6.justifyContent]: helperRefs.verticalAlignment,
2740
+ [vars$6.alignItems]: helperRefs$1.horizontalAlignment,
2741
+ [vars$6.justifyContent]: helperRefs$1.verticalAlignment,
2566
2742
  verticalAlignment: {
2567
2743
  spaceBetween: { [helperVars.verticalAlignment]: 'space-between' }
2568
2744
  }
@@ -2583,20 +2759,20 @@ const container = {
2583
2759
 
2584
2760
  shadow: {
2585
2761
  sm: {
2586
- [vars$6.boxShadow]: `${globalRefs$4.shadow.wide.sm} ${helperRefs.shadowColor}, ${globalRefs$4.shadow.narrow.sm} ${helperRefs.shadowColor}`
2762
+ [vars$6.boxShadow]: `${globalRefs$4.shadow.wide.sm} ${helperRefs$1.shadowColor}, ${globalRefs$4.shadow.narrow.sm} ${helperRefs$1.shadowColor}`
2587
2763
  },
2588
2764
  md: {
2589
- [vars$6.boxShadow]: `${globalRefs$4.shadow.wide.md} ${helperRefs.shadowColor}, ${globalRefs$4.shadow.narrow.md} ${helperRefs.shadowColor}`
2765
+ [vars$6.boxShadow]: `${globalRefs$4.shadow.wide.md} ${helperRefs$1.shadowColor}, ${globalRefs$4.shadow.narrow.md} ${helperRefs$1.shadowColor}`
2590
2766
  },
2591
2767
  lg: {
2592
- [vars$6.boxShadow]: `${globalRefs$4.shadow.wide.lg} ${helperRefs.shadowColor}, ${globalRefs$4.shadow.narrow.lg} ${helperRefs.shadowColor}`
2768
+ [vars$6.boxShadow]: `${globalRefs$4.shadow.wide.lg} ${helperRefs$1.shadowColor}, ${globalRefs$4.shadow.narrow.lg} ${helperRefs$1.shadowColor}`
2593
2769
  },
2594
2770
  xl: {
2595
- [vars$6.boxShadow]: `${globalRefs$4.shadow.wide.xl} ${helperRefs.shadowColor}, ${globalRefs$4.shadow.narrow.xl} ${helperRefs.shadowColor}`
2771
+ [vars$6.boxShadow]: `${globalRefs$4.shadow.wide.xl} ${helperRefs$1.shadowColor}, ${globalRefs$4.shadow.narrow.xl} ${helperRefs$1.shadowColor}`
2596
2772
  },
2597
2773
  '2xl': {
2598
2774
  [helperVars.shadowColor]: '#00000050',
2599
- [vars$6.boxShadow]: `${globalRefs$4.shadow.wide['2xl']} ${helperRefs.shadowColor}`
2775
+ [vars$6.boxShadow]: `${globalRefs$4.shadow.wide['2xl']} ${helperRefs$1.shadowColor}`
2600
2776
  },
2601
2777
  },
2602
2778
 
@@ -2753,25 +2929,32 @@ const link = {
2753
2929
 
2754
2930
  const vars$2 = Divider.cssVarList;
2755
2931
 
2932
+ const thickness = '2px';
2933
+ const textPaddingSize = '10px';
2934
+ const [helperTheme, helperRefs] = createHelperVars({ thickness, textPaddingSize }, componentName$b);
2935
+
2936
+
2756
2937
  const divider = {
2938
+ ...helperTheme,
2757
2939
  [vars$2.alignItems]: 'center',
2758
- [vars$2.height]: '2px',
2940
+ [vars$2.dividerHeight]: helperRefs.thickness,
2759
2941
  [vars$2.backgroundColor]: 'currentColor',
2760
2942
  [vars$2.opacity]: '0.2',
2761
- [vars$2.padding]: '0 10px',
2943
+ [vars$2.textPadding]: `0 ${helperRefs.textPaddingSize}`,
2762
2944
  [vars$2.width]: '100%',
2763
2945
  [vars$2.flexDirection]: 'row',
2764
2946
  [vars$2.alignSelf]: 'strech',
2765
2947
  [vars$2.textWidth]: 'fit-content',
2948
+ [vars$2.maxTextWidth]: 'calc(100% - 100px)',
2766
2949
  _vertical: {
2767
- [vars$2.width]: '2px',
2768
- [vars$2.padding]: '10px 0',
2950
+ [vars$2.padding]: `0 calc(${thickness} * 3)`,
2951
+ [vars$2.width]: 'fit-content',
2952
+ [vars$2.textPadding]: `${helperRefs.textPaddingSize} 0`,
2769
2953
  [vars$2.flexDirection]: 'column',
2770
2954
  [vars$2.minHeight]: '200px',
2771
- [vars$2.textWidth]: 'max-content'
2772
- },
2773
- _italic: {
2774
- [vars$2.fontStyle]: 'italic'
2955
+ [vars$2.textWidth]: 'fit-content',
2956
+ [vars$2.dividerWidth]: helperRefs.thickness,
2957
+ [vars$2.maxTextWidth]: '100%',
2775
2958
  }
2776
2959
  };
2777
2960
 
@@ -2901,5 +3084,5 @@ var components = {
2901
3084
 
2902
3085
  var index = { globals, components };
2903
3086
 
2904
- export { componentsThemeToStyle, index as defaultTheme, genColor, globalsThemeToStyle, themeToStyle };
3087
+ export { componentsThemeManager, createComponentsTheme, index as defaultTheme, genColor, globalsThemeToStyle, themeToStyle };
2905
3088
  //# sourceMappingURL=index.esm.js.map