@descope/web-components-ui 1.0.51 → 1.0.53

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. package/dist/index.esm.js +774 -377
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/umd/832.js +1 -0
  4. package/dist/umd/descope-button-index-js.js +1 -1
  5. package/dist/umd/descope-checkbox-index-js.js +1 -1
  6. package/dist/umd/descope-combo-index-js.js +1 -1
  7. package/dist/umd/descope-container-index-js.js +1 -1
  8. package/dist/umd/descope-date-picker-index-js.js +1 -1
  9. package/dist/umd/descope-divider-index-js.js +1 -0
  10. package/dist/umd/descope-email-field-index-js.js +1 -1
  11. package/dist/umd/descope-logo-index-js.js +1 -1
  12. package/dist/umd/descope-number-field-index-js.js +1 -1
  13. package/dist/umd/descope-passcode-descope-passcode-internal-index-js.js +1 -0
  14. package/dist/umd/descope-passcode-index-js.js +1 -0
  15. package/dist/umd/descope-password-field-index-js.js +1 -1
  16. package/dist/umd/descope-switch-toggle-index-js.js +1 -1
  17. package/dist/umd/descope-text-area-index-js.js +1 -1
  18. package/dist/umd/descope-text-field-index-js.js +1 -1
  19. package/dist/umd/descope-text-index-js.js +1 -1
  20. package/dist/umd/index.js +1 -1
  21. package/package.json +1 -1
  22. package/src/components/DescopeBaseClass.js +1 -0
  23. package/src/components/descope-button/Button.js +0 -1
  24. package/src/components/descope-combo/index.js +2 -1
  25. package/src/components/descope-container/Container.js +14 -6
  26. package/src/components/descope-divider/Divider.js +85 -0
  27. package/src/components/descope-divider/index.js +6 -0
  28. package/src/components/descope-logo/Logo.js +5 -4
  29. package/src/components/descope-passcode/Passcode.js +141 -0
  30. package/src/components/descope-passcode/descope-passcode-internal/PasscodeInternal.js +213 -0
  31. package/src/components/descope-passcode/descope-passcode-internal/helpers.js +14 -0
  32. package/src/components/descope-passcode/descope-passcode-internal/index.js +3 -0
  33. package/src/components/descope-passcode/index.js +5 -0
  34. package/src/components/descope-password-field/PasswordField.js +0 -1
  35. package/src/components/descope-text/Text.js +8 -1
  36. package/src/components/descope-text/index.js +0 -1
  37. package/src/componentsHelpers/createProxy/helpers.js +24 -7
  38. package/src/componentsHelpers/createProxy/index.js +8 -6
  39. package/src/componentsHelpers/createStyleMixin/index.js +103 -72
  40. package/src/componentsHelpers/enforceNestingElementsStylesMixin.js +95 -0
  41. package/src/componentsHelpers/inputMixin.js +13 -13
  42. package/src/index.js +3 -0
  43. package/src/theme/components/divider.js +24 -0
  44. package/src/theme/components/index.js +5 -1
  45. package/src/theme/components/passcode.js +8 -0
  46. package/src/theme/components/text.js +6 -0
  47. package/dist/umd/433.js +0 -1
package/dist/index.esm.js CHANGED
@@ -5,6 +5,7 @@ import '@vaadin/email-field';
5
5
  import '@vaadin/password-field';
6
6
  import '@vaadin/text-area';
7
7
  import '@vaadin/date-picker';
8
+ import '@vaadin/checkbox';
8
9
  import merge from 'lodash.merge';
9
10
  import set from 'lodash.set';
10
11
  import Color from 'color';
@@ -108,80 +109,111 @@ const matchHostStyle = (mappingObj = {}) => [
108
109
  ];
109
110
 
110
111
  const createStyleMixin =
111
- ({ mappings = {} }) =>
112
- (superclass) => {
113
- const styleAttributes = Object.keys(mappings).map((key) =>
114
- kebabCaseJoin('st', key)
115
- );
116
- return class CustomStyleMixinClass extends superclass {
117
- static get observedAttributes() {
118
- const superAttrs = superclass.observedAttributes || [];
119
- return [...superAttrs, ...styleAttributes];
120
- }
112
+ ({ mappings = {}, nestedMappings = {} }) =>
113
+ (superclass) => {
114
+ const styleAttributes = Object.keys(mappings).map((key) =>
115
+ kebabCaseJoin('st', key)
116
+ );
117
+ return class CustomStyleMixinClass extends superclass {
118
+ static get observedAttributes() {
119
+ const superAttrs = superclass.observedAttributes || [];
120
+ return [...superAttrs, ...styleAttributes];
121
+ }
121
122
 
122
- static get cssVarList() {
123
- return createCssVarsList(superclass.componentName, mappings);
124
- }
123
+ static get cssVarList() {
124
+ return createCssVarsList(superclass.componentName, mappings);
125
+ }
125
126
 
126
- #styleEle = null;
127
+ #styleEle = null;
127
128
 
128
- constructor() {
129
- super();
129
+ constructor() {
130
+ super();
130
131
 
131
- this.#createComponentStyle();
132
- this.#createAttrOverrideStyle();
133
- }
132
+ this.#createComponentStyle();
133
+ this.#createAttrOverrideStyle();
134
+ }
134
135
 
135
- #createAttrOverrideStyle() {
136
- this.#styleEle = document.createElement('style');
137
- this.#styleEle.id = 'style-mixin-overrides';
136
+ #createAttrOverrideStyle() {
137
+ this.#styleEle = document.createElement('style');
138
+ this.#styleEle.id = 'style-mixin-overrides';
138
139
 
139
- this.#styleEle.innerText = '* {}';
140
- this.shadowRoot.prepend(this.#styleEle);
141
- }
140
+ this.#styleEle.innerText = '* {}';
141
+ this.shadowRoot.prepend(this.#styleEle);
142
+ }
142
143
 
143
- #updateAttrOverrideStyle(attrName, value) {
144
- const style = this.#styleEle.sheet.cssRules[0].style;
145
- const varName = getCssVarName(
146
- superclass.componentName,
147
- attrName.replace(/^st-/, '')
148
- );
144
+ #updateAttrOverrideStyle(attrName, value) {
145
+ const style = this.#styleEle.sheet?.cssRules[0].style;
146
+ const varName = getCssVarName(
147
+ superclass.componentName,
148
+ attrName.replace(/^st-/, '')
149
+ );
149
150
 
150
- if (value) style.setProperty(varName, value);
151
- else style.removeProperty(varName);
152
- }
151
+ if (value) style?.setProperty(varName, value);
152
+ else style?.removeProperty(varName);
153
+ }
153
154
 
154
- #createComponentStyle() {
155
- const themeStyle = document.createElement('style');
156
- themeStyle.id = 'style-mixin-component';
157
- themeStyle.innerHTML = createStyle(
158
- superclass.componentName,
159
- this.baseSelector,
160
- mappings
161
- );
162
- this.shadowRoot.prepend(themeStyle);
163
- }
155
+ #createComponentStyle() {
156
+ const themeStyle = document.createElement('style');
157
+ themeStyle.id = 'style-mixin-component';
158
+ themeStyle.innerHTML = createStyle(
159
+ superclass.componentName,
160
+ this.baseSelector,
161
+ mappings
162
+ );
163
+ this.shadowRoot.prepend(themeStyle);
164
+ }
165
+
166
+ #createComponentNestingStyle() {
167
+ // we need these selectors to be more specific from the theme selectors
168
+ // in order to do it, we are repeating the class name for specificity
169
+ const numOfClassNameSpecifier = 3;
170
+
171
+ const rootNode = this.shadowRoot.host.getRootNode();
172
+ const styleId = `${superclass.componentName}-style-mixin-component`;
173
+
174
+ const className = superclass.componentName;
175
+ this.shadowRoot.host.classList.add(className);
164
176
 
165
- attributeChangedCallback(attrName, oldValue, newValue) {
166
- super.attributeChangedCallback?.(attrName, oldValue, newValue);
177
+ if(rootNode.querySelector(`style#${styleId}`)) return;
167
178
 
168
- if (styleAttributes.includes(attrName)) {
169
- this.#updateAttrOverrideStyle(attrName, newValue);
179
+ const themeStyle = document.createElement('style');
180
+ themeStyle.id = styleId;
181
+ themeStyle.innerHTML = createStyle(
182
+ superclass.componentName,
183
+ `${superclass.componentName}${Array(numOfClassNameSpecifier).fill(`.${className}`).join('')}`,
184
+ nestedMappings
185
+ );
186
+
187
+ // rootNode can be either a shadow DOM or a light DOM
188
+ if (rootNode.nodeName === '#document') {
189
+ rootNode.head.append(themeStyle);
190
+ } else {
191
+ rootNode.append(themeStyle);
192
+ }
170
193
  }
171
- }
172
194
 
173
- connectedCallback() {
174
- super.connectedCallback?.();
175
- if (this.shadowRoot.isConnected) {
176
- Array.from(this.attributes).forEach(attr => {
177
- if (styleAttributes.includes(attr.nodeName)) {
178
- this.#updateAttrOverrideStyle(attr.nodeName, attr.value);
179
- }
180
- });
181
- }
182
- }
195
+ attributeChangedCallback(attrName, oldValue, newValue) {
196
+ super.attributeChangedCallback?.(attrName, oldValue, newValue);
197
+
198
+ if (styleAttributes.includes(attrName)) {
199
+ this.#updateAttrOverrideStyle(attrName, newValue);
200
+ }
201
+ }
202
+
203
+ connectedCallback() {
204
+ super.connectedCallback?.();
205
+ if (this.shadowRoot.isConnected) {
206
+ this.#createComponentNestingStyle();
207
+
208
+ Array.from(this.attributes).forEach(attr => {
209
+ if (styleAttributes.includes(attr.nodeName)) {
210
+ this.#updateAttrOverrideStyle(attr.nodeName, attr.value);
211
+ }
212
+ });
213
+ }
214
+ }
215
+ };
183
216
  };
184
- };
185
217
 
186
218
  const draggableMixin = (superclass) =>
187
219
  class DraggableMixinClass extends superclass {
@@ -215,17 +247,32 @@ const draggableMixin = (superclass) =>
215
247
  }
216
248
  };
217
249
 
218
- const observeAttributes = (ele, callback, excludeAttrs) => {
250
+ class DescopeBaseClass extends HTMLElement {}
251
+
252
+ const observeAttributes = (
253
+ ele,
254
+ callback,
255
+ { excludeAttrs = [], includeAttrs = [] }
256
+ ) => {
219
257
  // sync all attrs on init
220
- callback(...Array.from(ele.attributes).map((attr) => attr.name));
258
+ callback(
259
+ ...Array.from(ele.attributes)
260
+ .filter(
261
+ (attr) =>
262
+ !excludeAttrs.includes(attr.name) &&
263
+ (!includeAttrs.length || includeAttrs.includes(attr.name))
264
+ )
265
+ .map((attr) => attr.name)
266
+ );
221
267
 
222
268
  const observer = new MutationObserver((mutationsList) => {
223
269
  for (const mutation of mutationsList) {
224
270
  if (
225
271
  mutation.type === 'attributes' &&
226
- !excludeAttrs.includes(mutation.attributeName)
272
+ !excludeAttrs.includes(mutation.attributeName) &&
273
+ (!includeAttrs.length || includeAttrs.includes(attr.name))
227
274
  ) {
228
- callback(mutation.attributeName);
275
+ callback([mutation.attributeName]);
229
276
  }
230
277
  }
231
278
  });
@@ -248,9 +295,13 @@ const createSyncAttrsCb =
248
295
  });
249
296
  };
250
297
 
251
- const syncAttrs = (ele1, ele2, excludeAttrs) => {
252
- observeAttributes(ele1, createSyncAttrsCb(ele1, ele2), excludeAttrs);
253
- observeAttributes(ele2, createSyncAttrsCb(ele2, ele1), excludeAttrs);
298
+ const syncAttrs = (ele1, ele2, options) => {
299
+ observeAttributes(ele1, createSyncAttrsCb(ele1, ele2), options);
300
+ observeAttributes(ele2, createSyncAttrsCb(ele2, ele1), options);
301
+ };
302
+
303
+ const forwardAttrs = (source, dest, options) => {
304
+ observeAttributes(source, createSyncAttrsCb(source, dest), options);
254
305
  };
255
306
 
256
307
  const createProxy = ({
@@ -268,7 +319,7 @@ const createProxy = ({
268
319
  </${wrappedEleName}>
269
320
  `;
270
321
 
271
- class ProxyElement extends HTMLElement {
322
+ class ProxyElement extends DescopeBaseClass {
272
323
  static get componentName() {
273
324
  return componentName;
274
325
  }
@@ -276,7 +327,6 @@ const createProxy = ({
276
327
  constructor() {
277
328
  super().attachShadow({ mode: 'open' }).innerHTML = template;
278
329
  this.hostElement = this.shadowRoot.host;
279
- this.componentName = this.hostElement.tagName.toLowerCase();
280
330
  this.baseSelector = wrappedEleName;
281
331
  this.shadowRoot.getElementById('create-proxy').innerHTML =
282
332
  typeof style === 'function' ? style() : style;
@@ -288,9 +338,9 @@ const createProxy = ({
288
338
  this.setAttribute('tabindex', '0');
289
339
 
290
340
  // we want to focus on the proxy element when focusing our WC
291
- this.onfocus = (e) => {
341
+ this.addEventListener('focus', () => {
292
342
  this.proxyElement.focus();
293
- };
343
+ });
294
344
 
295
345
  // `onkeydown` is set on `proxyElement` support proper tab-index navigation
296
346
  // this support is needed since both proxy host and element catch `focus`/`blur` event
@@ -316,9 +366,11 @@ const createProxy = ({
316
366
  this.proxyElement.addEventListener('mouseover', this.mouseoverCbRef);
317
367
 
318
368
  // sync events
319
- this.addEventListener = this.proxyElement.addEventListener;
369
+ this.addEventListener = (...args) => this.proxyElement.addEventListener(...args);
320
370
 
321
- syncAttrs(this.proxyElement, this.hostElement, excludeAttrsSync);
371
+ syncAttrs(this.proxyElement, this.hostElement, {
372
+ excludeAttrs: excludeAttrsSync
373
+ });
322
374
  }
323
375
  }
324
376
 
@@ -392,40 +444,40 @@ const inputMixin = (superclass) =>
392
444
  }
393
445
 
394
446
  connectedCallback() {
395
- this.baseEle = this.shadowRoot.querySelector(this.baseSelector);
396
447
  super.connectedCallback?.();
397
448
 
449
+ this.baseEle = this.shadowRoot.querySelector(this.baseSelector);
450
+
398
451
  // this is needed in order to make sure the form input validation is working
399
452
  if (!this.hasAttribute('tabindex')) {
400
453
  this.setAttribute('tabindex', 0);
401
454
  }
402
455
 
403
- const input =
404
- this.baseEle.querySelector('input') ||
405
- this.baseEle.querySelector('textarea');
406
- if (!input) throw Error('no input was found');
456
+ this.inputElement ??= this.baseEle.shadowRoot.querySelector('slot[name="input"]')?.assignedElements()[0] ||
457
+ this.baseEle.shadowRoot.querySelector('slot[name="textarea"]')?.assignedElements()[0];
458
+ if (!this.inputElement) throw Error('no input was found');
407
459
 
408
460
  // sync properties
409
- propertyObserver(this, input, 'value');
410
- this.setSelectionRange = input.setSelectionRange.bind(input);
461
+ propertyObserver(this, this.inputElement, 'value');
462
+ this.setSelectionRange = this.inputElement.setSelectionRange?.bind(this.inputElement);
411
463
 
412
- this.validity = input.validity;
464
+ this.validity = this.inputElement.validity;
413
465
 
414
466
  this.setValidity = () => {
415
- this.#internals.setValidity(input.validity, input.validationMessage);
467
+ this.#internals.setValidity(this.inputElement.validity, this.inputElement.validationMessage);
416
468
  };
417
469
 
418
- input.oninput = () => {
419
- this.value = input.value;
470
+ this.inputElement.oninput = () => {
471
+ this.value = this.inputElement.value;
420
472
  this.setValidity();
421
473
  };
422
474
 
423
475
  this.onfocus = () => {
424
- setTimeout(() => input.reportValidity(), 0);
476
+ setTimeout(() => this.inputElement.reportValidity(), 0);
425
477
  this.validate();
426
478
  };
427
479
 
428
- input.oninvalid = () => {
480
+ this.inputElement.oninvalid = () => {
429
481
  this.validate();
430
482
  };
431
483
  }
@@ -464,7 +516,7 @@ const compose =
464
516
  (val) =>
465
517
  fns.reduceRight((res, fn) => fn(res), val);
466
518
 
467
- const componentName$c = getComponentName('button');
519
+ const componentName$f = getComponentName('button');
468
520
 
469
521
  const editorOverrides = `vaadin-button::part(label) { pointer-events: none; }`;
470
522
  const resetStyles = `
@@ -487,17 +539,16 @@ const iconStyles = `
487
539
  }
488
540
  `;
489
541
 
490
- const selectors$2 = {
542
+ const selectors$3 = {
491
543
  label: '::part(label)'
492
544
  };
493
545
 
494
546
  const Button = compose(
495
547
  createStyleMixin({
496
- // todo: do we want to change the mapping structure to this? ['aa', 'aaa', {'color': [{ selector: '::part(label)' }]}],
497
548
  mappings: {
498
549
  backgroundColor: {},
499
550
  borderRadius: {},
500
- color: { selector: selectors$2.label },
551
+ color: { selector: selectors$3.label },
501
552
  borderColor: {},
502
553
  borderStyle: {},
503
554
  borderWidth: {},
@@ -505,8 +556,8 @@ const Button = compose(
505
556
  height: {},
506
557
  width: matchHostStyle(),
507
558
  cursor: {},
508
- padding: [{ selector: selectors$2.label }],
509
- textDecoration: { selector: selectors$2.label }
559
+ padding: [{ selector: selectors$3.label }],
560
+ textDecoration: { selector: selectors$3.label }
510
561
  }
511
562
  }),
512
563
  draggableMixin,
@@ -518,7 +569,7 @@ const Button = compose(
518
569
  style: () =>
519
570
  `${resetStyles} ${editorOverrides} ${iconStyles} ${loadingIndicatorStyles}`,
520
571
  excludeAttrsSync: ['tabindex'],
521
- componentName: componentName$c
572
+ componentName: componentName$f
522
573
  })
523
574
  );
524
575
 
@@ -551,9 +602,9 @@ const loadingIndicatorStyles = `
551
602
  }
552
603
  `;
553
604
 
554
- customElements.define(componentName$c, Button);
605
+ customElements.define(componentName$f, Button);
555
606
 
556
- const selectors$1 = {
607
+ const selectors$2 = {
557
608
  label: '::part(label)',
558
609
  input: '::part(input-field)',
559
610
  readOnlyInput: '[readonly]::part(input-field)::after',
@@ -561,36 +612,36 @@ const selectors$1 = {
561
612
  };
562
613
 
563
614
  var textFieldMappings = {
564
- color: { selector: selectors$1.input },
565
- backgroundColor: { selector: selectors$1.input },
566
- color: { selector: selectors$1.input },
615
+ color: { selector: selectors$2.input },
616
+ backgroundColor: { selector: selectors$2.input },
617
+ color: { selector: selectors$2.input },
567
618
  width: matchHostStyle({}),
568
619
  borderColor: [
569
- { selector: selectors$1.input },
570
- { selector: selectors$1.readOnlyInput }
620
+ { selector: selectors$2.input },
621
+ { selector: selectors$2.readOnlyInput }
571
622
  ],
572
623
  borderWidth: [
573
- { selector: selectors$1.input },
574
- { selector: selectors$1.readOnlyInput }
624
+ { selector: selectors$2.input },
625
+ { selector: selectors$2.readOnlyInput }
575
626
  ],
576
627
  borderStyle: [
577
- { selector: selectors$1.input },
578
- { selector: selectors$1.readOnlyInput }
628
+ { selector: selectors$2.input },
629
+ { selector: selectors$2.readOnlyInput }
579
630
  ],
580
- borderRadius: { selector: selectors$1.input },
581
- boxShadow: { selector: selectors$1.input },
631
+ borderRadius: { selector: selectors$2.input },
632
+ boxShadow: { selector: selectors$2.input },
582
633
  fontSize: {},
583
- height: { selector: selectors$1.input },
584
- padding: { selector: selectors$1.input },
585
- outline: { selector: selectors$1.input },
586
- outlineOffset: { selector: selectors$1.input },
634
+ height: { selector: selectors$2.input },
635
+ padding: { selector: selectors$2.input },
636
+ outline: { selector: selectors$2.input },
637
+ outlineOffset: { selector: selectors$2.input },
587
638
 
588
- placeholderColor: { selector: selectors$1.placeholder, property: 'color' }
639
+ placeholderColor: { selector: selectors$2.placeholder, property: 'color' }
589
640
  };
590
641
 
591
- const componentName$b = getComponentName('text-field');
642
+ const componentName$e = getComponentName('text-field');
592
643
 
593
- let overrides$5 = ``;
644
+ let overrides$6 = ``;
594
645
 
595
646
  const TextField = compose(
596
647
  createStyleMixin({
@@ -603,13 +654,13 @@ const TextField = compose(
603
654
  createProxy({
604
655
  slots: ['prefix', 'suffix'],
605
656
  wrappedEleName: 'vaadin-text-field',
606
- style: () => overrides$5,
657
+ style: () => overrides$6,
607
658
  excludeAttrsSync: ['tabindex'],
608
- componentName: componentName$b
659
+ componentName: componentName$e
609
660
  })
610
661
  );
611
662
 
612
- overrides$5 = `
663
+ overrides$6 = `
613
664
  :host {
614
665
  display: inline-block;
615
666
  }
@@ -650,18 +701,18 @@ overrides$5 = `
650
701
  }
651
702
  `;
652
703
 
653
- customElements.define(componentName$b, TextField);
704
+ customElements.define(componentName$e, TextField);
654
705
 
655
706
  const template = document.createElement('template');
656
707
 
657
- const componentName$a = getComponentName('combo');
708
+ const componentName$d = getComponentName('combo');
658
709
 
659
710
  template.innerHTML = `
660
711
  <descope-button></descope-button>
661
712
  <descope-text-field></descope-text-field>
662
713
  `;
663
714
 
664
- class Combo extends HTMLElement {
715
+ class Combo extends DescopeBaseClass {
665
716
  constructor() {
666
717
  super();
667
718
 
@@ -671,11 +722,11 @@ class Combo extends HTMLElement {
671
722
  }
672
723
  }
673
724
 
674
- customElements.define(componentName$a, Combo);
725
+ customElements.define(componentName$d, Combo);
675
726
 
676
- const componentName$9 = getComponentName('number-field');
727
+ const componentName$c = getComponentName('number-field');
677
728
 
678
- let overrides$4 = ``;
729
+ let overrides$5 = ``;
679
730
 
680
731
  const NumberField = compose(
681
732
  createStyleMixin({
@@ -690,13 +741,13 @@ const NumberField = compose(
690
741
  createProxy({
691
742
  slots: ['prefix', 'suffix'],
692
743
  wrappedEleName: 'vaadin-number-field',
693
- style: () => overrides$4,
744
+ style: () => overrides$5,
694
745
  excludeAttrsSync: ['tabindex'],
695
- componentName: componentName$9
746
+ componentName: componentName$c
696
747
  })
697
748
  );
698
749
 
699
- overrides$4 = `
750
+ overrides$5 = `
700
751
  :host {
701
752
  display: inline-block;
702
753
  }
@@ -736,11 +787,11 @@ overrides$4 = `
736
787
  }
737
788
  `;
738
789
 
739
- customElements.define(componentName$9, NumberField);
790
+ customElements.define(componentName$c, NumberField);
740
791
 
741
- const componentName$8 = getComponentName('email-field');
792
+ const componentName$b = getComponentName('email-field');
742
793
 
743
- let overrides$3 = ``;
794
+ let overrides$4 = ``;
744
795
 
745
796
  const EmailField = compose(
746
797
  createStyleMixin({
@@ -755,13 +806,13 @@ const EmailField = compose(
755
806
  createProxy({
756
807
  slots: ['suffix'],
757
808
  wrappedEleName: 'vaadin-email-field',
758
- style: () => overrides$3,
809
+ style: () => overrides$4,
759
810
  excludeAttrsSync: ['tabindex'],
760
- componentName: componentName$8
811
+ componentName: componentName$b
761
812
  })
762
813
  );
763
814
 
764
- overrides$3 = `
815
+ overrides$4 = `
765
816
  :host {
766
817
  display: inline-block;
767
818
  }
@@ -801,17 +852,16 @@ overrides$3 = `
801
852
  }
802
853
  `;
803
854
 
804
- customElements.define(componentName$8, EmailField);
855
+ customElements.define(componentName$b, EmailField);
805
856
 
806
- const componentName$7 = getComponentName('password-field');
857
+ const componentName$a = getComponentName('password-field');
807
858
 
808
- let overrides$2 = ``;
859
+ let overrides$3 = ``;
809
860
 
810
861
  const PasswordField = compose(
811
862
  createStyleMixin({
812
863
  mappings: {
813
864
  ...textFieldMappings,
814
- // todo: override cursor from lumo
815
865
  revealCursor: [
816
866
  {
817
867
  selector: '::part(reveal-button)::before',
@@ -827,13 +877,13 @@ const PasswordField = compose(
827
877
  createProxy({
828
878
  slots: ['suffix'],
829
879
  wrappedEleName: 'vaadin-password-field',
830
- style: () => overrides$2,
880
+ style: () => overrides$3,
831
881
  excludeAttrsSync: ['tabindex'],
832
- componentName: componentName$7
882
+ componentName: componentName$a
833
883
  })
834
884
  );
835
885
 
836
- overrides$2 = `
886
+ overrides$3 = `
837
887
  :host {
838
888
  display: inline-block;
839
889
  }
@@ -873,32 +923,32 @@ overrides$2 = `
873
923
  }
874
924
  `;
875
925
 
876
- customElements.define(componentName$7, PasswordField);
926
+ customElements.define(componentName$a, PasswordField);
877
927
 
878
- const componentName$6 = getComponentName('text-area');
928
+ const componentName$9 = getComponentName('text-area');
879
929
 
880
- const selectors = {
930
+ const selectors$1 = {
881
931
  label: '::part(label)',
882
932
  input: '::part(input-field)',
883
933
  required: '::part(required-indicator)::after'
884
934
  };
885
935
 
886
- let overrides$1 = ``;
936
+ let overrides$2 = ``;
887
937
 
888
938
  const TextArea = compose(
889
939
  createStyleMixin({
890
940
  mappings: {
891
941
  resize: { selector: '> textarea' },
892
- color: { selector: selectors.label },
942
+ color: { selector: selectors$1.label },
893
943
  cursor: {},
894
944
  width: matchHostStyle(),
895
- backgroundColor: { selector: selectors.input },
896
- borderWidth: { selector: selectors.input },
897
- borderStyle: { selector: selectors.input },
898
- borderColor: { selector: selectors.input },
899
- borderRadius: { selector: selectors.input },
900
- outline: { selector: selectors.input },
901
- outlineOffset: { selector: selectors.input }
945
+ backgroundColor: { selector: selectors$1.input },
946
+ borderWidth: { selector: selectors$1.input },
947
+ borderStyle: { selector: selectors$1.input },
948
+ borderColor: { selector: selectors$1.input },
949
+ borderRadius: { selector: selectors$1.input },
950
+ outline: { selector: selectors$1.input },
951
+ outlineOffset: { selector: selectors$1.input }
902
952
  }
903
953
  }),
904
954
  draggableMixin,
@@ -908,13 +958,13 @@ const TextArea = compose(
908
958
  createProxy({
909
959
  slots: [],
910
960
  wrappedEleName: 'vaadin-text-area',
911
- style: () => overrides$1,
961
+ style: () => overrides$2,
912
962
  excludeAttrsSync: ['tabindex'],
913
- componentName: componentName$6
963
+ componentName: componentName$9
914
964
  })
915
965
  );
916
966
 
917
- overrides$1 = `
967
+ overrides$2 = `
918
968
  :host {
919
969
  display: inline-block;
920
970
  }
@@ -935,34 +985,41 @@ overrides$1 = `
935
985
  }
936
986
  `;
937
987
 
938
- customElements.define(componentName$6, TextArea);
988
+ customElements.define(componentName$9, TextArea);
939
989
 
940
- const componentName$5 = getComponentName('date-picker');
990
+ const componentName$8 = getComponentName('date-picker');
941
991
 
942
992
  const DatePicker = compose(
943
993
  draggableMixin,
944
994
  componentNameValidationMixin
945
995
  )(
946
996
  createProxy({
947
- componentName: componentName$5,
997
+ componentName: componentName$8,
948
998
  slots: ['prefix', 'suffix'],
949
999
  wrappedEleName: 'vaadin-date-picker',
950
1000
  style: ``
951
1001
  })
952
1002
  );
953
1003
 
954
- customElements.define(componentName$5, DatePicker);
1004
+ customElements.define(componentName$8, DatePicker);
955
1005
 
956
- const componentName$4 = getComponentName('container');
1006
+ const componentName$7 = getComponentName('container');
957
1007
 
958
- class RawContainer extends HTMLElement {
1008
+ class RawContainer extends DescopeBaseClass {
959
1009
  static get componentName() {
960
- return componentName$4;
1010
+ return componentName$7;
961
1011
  }
962
1012
  constructor() {
963
1013
  super();
964
1014
  const template = document.createElement('template');
965
- template.innerHTML = `<slot></slot>`;
1015
+ template.innerHTML = `
1016
+ <style>
1017
+ :host > slot {
1018
+ box-sizing: border-box;
1019
+ }
1020
+ </style>
1021
+ <slot></slot>
1022
+ `;
966
1023
 
967
1024
  this.attachShadow({ mode: 'open' });
968
1025
  this.shadowRoot.appendChild(template.content.cloneNode(true));
@@ -973,10 +1030,9 @@ class RawContainer extends HTMLElement {
973
1030
 
974
1031
  const Container = compose(
975
1032
  createStyleMixin({
976
- // todo: do we want to change the mapping structure to this? ['aa', 'aaa', {'color': [{ selector: '::part(label)' }]}],
977
1033
  mappings: {
978
- height: {},
979
- width: {},
1034
+ height: matchHostStyle(),
1035
+ width: matchHostStyle(),
980
1036
 
981
1037
  verticalPadding: [
982
1038
  { property: 'padding-top' },
@@ -987,7 +1043,7 @@ const Container = compose(
987
1043
  { property: 'padding-right' }
988
1044
  ],
989
1045
 
990
- display: {},
1046
+ display: {}, // maybe this should be hardcoded to flex
991
1047
  flexDirection: {},
992
1048
  justifyContent: {},
993
1049
  alignItems: {},
@@ -1007,13 +1063,13 @@ const Container = compose(
1007
1063
  componentNameValidationMixin
1008
1064
  )(RawContainer);
1009
1065
 
1010
- customElements.define(componentName$4, Container);
1066
+ customElements.define(componentName$7, Container);
1011
1067
 
1012
- const componentName$3 = getComponentName('text');
1068
+ const componentName$6 = getComponentName('text');
1013
1069
 
1014
- class RawText extends HTMLElement {
1070
+ class RawText extends DescopeBaseClass {
1015
1071
  static get componentName() {
1016
- return componentName$3;
1072
+ return componentName$6;
1017
1073
  }
1018
1074
  constructor() {
1019
1075
  super();
@@ -1037,6 +1093,12 @@ const Text = compose(
1037
1093
  fontWeight: {},
1038
1094
  width: {},
1039
1095
  color: {},
1096
+ letterSpacing: {},
1097
+ textShadow: {},
1098
+ borderWidth: {},
1099
+ borderStyle: {},
1100
+ borderColor: {},
1101
+ textTransform: {},
1040
1102
  textAlign: matchHostStyle(),
1041
1103
  display: matchHostStyle()
1042
1104
  }
@@ -1045,7 +1107,254 @@ const Text = compose(
1045
1107
  componentNameValidationMixin
1046
1108
  )(RawText);
1047
1109
 
1048
- customElements.define(componentName$3, Text);
1110
+ customElements.define(componentName$6, Text);
1111
+
1112
+ const getChildObserver = (callback) => {
1113
+ return new MutationObserver((mutationsList) => {
1114
+ for (const mutation of mutationsList) {
1115
+ if (mutation.type === 'childList') {
1116
+ callback(mutation);
1117
+ }
1118
+ }
1119
+ });
1120
+ };
1121
+
1122
+ const insertNestingLevel = (srcEle, nestingEle) => {
1123
+ nestingEle.append(...srcEle.childNodes);
1124
+ srcEle.appendChild(nestingEle);
1125
+ };
1126
+
1127
+ // adds a nesting element to the component, and move all existing children
1128
+ // to be under the nesting element
1129
+ const enforceNestingElementsStylesMixin =
1130
+ ({ nestingElementTagName, nestingElementDestSlotName, forwardAttrOptions }) =>
1131
+ (superclass) => {
1132
+ const getChildNodeEle = () =>
1133
+ Object.assign(document.createElement(nestingElementTagName), {
1134
+ slot: nestingElementDestSlotName
1135
+ });
1136
+
1137
+ let childObserver;
1138
+
1139
+ const getObserver = () => childObserver;
1140
+
1141
+ return class EnforceNestingElementsStylesMixinClass extends superclass {
1142
+ constructor() {
1143
+ super();
1144
+
1145
+ const childObserverCallback = () => {
1146
+ // we are going to change the DOM, so we need to disconnect the observer before
1147
+ // and reconnect it after the child component is added
1148
+ getObserver().disconnect(this.shadowRoot.host);
1149
+
1150
+ const isNestingElementExist = this.shadowRoot.host.querySelector(nestingElementTagName);
1151
+ const hasNewChildren = this.shadowRoot.host.childNodes.length > 0;
1152
+
1153
+ if (!isNestingElementExist && hasNewChildren) {
1154
+ // if before there were no children and now there are children - insert
1155
+ insertNestingLevel(this.shadowRoot.host, getChildNodeEle());
1156
+ } else if (isNestingElementExist && hasNewChildren) {
1157
+ // if children existed, and they changed -
1158
+ // we need to update (move) the new children into
1159
+ // descope-text and remove previous children
1160
+ this.shadowRoot.host.querySelector(child).remove();
1161
+ insertNestingLevel(this.shadowRoot.host, getChildNodeEle());
1162
+ }
1163
+ else if (isNestingElementExist && !hasNewChildren) {
1164
+ // if children existed and now there are none -
1165
+ // we need to remove descope-text completely
1166
+ this.shadowRoot.host.querySelector(child).remove();
1167
+ }
1168
+
1169
+ // we need a new observer, because we remove the nesting element
1170
+ this.shadowRoot.host.querySelector(nestingElementTagName) &&
1171
+ forwardAttrs(
1172
+ this.shadowRoot.host,
1173
+ this.shadowRoot.host.querySelector(nestingElementTagName),
1174
+ forwardAttrOptions
1175
+ );
1176
+
1177
+ getObserver().observe(this.shadowRoot.host, {
1178
+ childList: true
1179
+ });
1180
+ };
1181
+
1182
+ childObserver = getChildObserver(childObserverCallback);
1183
+ }
1184
+
1185
+ connectedCallback() {
1186
+ super.connectedCallback?.();
1187
+
1188
+ if (this.shadowRoot.host.childNodes.length > 0) {
1189
+ // on the first render - we want to move all component's children to be under descope-text
1190
+ insertNestingLevel(this.shadowRoot.host, getChildNodeEle());
1191
+
1192
+ forwardAttrs(
1193
+ this.shadowRoot.host,
1194
+ this.shadowRoot.host.querySelector(nestingElementTagName),
1195
+ forwardAttrOptions
1196
+ );
1197
+ }
1198
+
1199
+ getObserver().observe(this.shadowRoot.host, {
1200
+ childList: true
1201
+ });
1202
+ }
1203
+ };
1204
+ };
1205
+
1206
+ const componentName$5 = getComponentName('divider');
1207
+ class RawDivider extends DescopeBaseClass {
1208
+ static get componentName() {
1209
+ return componentName$5;
1210
+ }
1211
+ constructor() {
1212
+ super();
1213
+ const template = document.createElement('template');
1214
+ template.innerHTML = `
1215
+ <style>
1216
+ :host > div {
1217
+ display: flex;
1218
+ height: 100%;
1219
+ }
1220
+ :host > div::before,
1221
+ :host > div::after {
1222
+ content: '';
1223
+ flex-grow: 1;
1224
+ width: 100%;
1225
+ }
1226
+ ::slotted(*) {
1227
+ flex-grow: 0;
1228
+ flex-shrink: 0;
1229
+ }
1230
+ </style>
1231
+ <div>
1232
+ <slot></slot>
1233
+ <slot name="text"></slot>
1234
+ </div>
1235
+ `;
1236
+ this.attachShadow({ mode: 'open' });
1237
+ this.shadowRoot.appendChild(template.content.cloneNode(true));
1238
+
1239
+ this.baseSelector = ':host > div';
1240
+ }
1241
+ }
1242
+
1243
+ const selectors = {
1244
+ root: { selector: '' },
1245
+ before: { selector: '::before' },
1246
+ after: { selector: '::after' },
1247
+ slotted: { selector: () => '::slotted(*)' }
1248
+ };
1249
+
1250
+ const { root, before, after, slotted } = selectors;
1251
+
1252
+ const Divider = compose(
1253
+ enforceNestingElementsStylesMixin({
1254
+ nestingElementTagName: 'descope-text',
1255
+ nestingElementDestSlotName: 'text',
1256
+ forwardAttrOptions: {
1257
+ includeAttrs: ['mode', 'variant'],
1258
+ excludeAttrs: []
1259
+ }
1260
+ }),
1261
+ createStyleMixin({
1262
+ mappings: {
1263
+ minHeight: root,
1264
+ alignItems: root,
1265
+ alignSelf: root,
1266
+ flexDirection: root,
1267
+ padding: slotted,
1268
+ width: matchHostStyle(),
1269
+ height: [before, after],
1270
+ backgroundColor: [before, after],
1271
+ opacity: [before, after],
1272
+ textWidth: { ...slotted, property: 'width' }
1273
+ }
1274
+ }),
1275
+ draggableMixin,
1276
+ componentNameValidationMixin
1277
+ )(RawDivider);
1278
+
1279
+ customElements.define(componentName$5, Divider);
1280
+
1281
+ const componentName$4 = getComponentName('logo');
1282
+
1283
+ let style;
1284
+ const getStyle = () => style;
1285
+
1286
+ class RawLogo extends DescopeBaseClass {
1287
+ static get componentName() {
1288
+ return componentName$4;
1289
+ }
1290
+ constructor() {
1291
+ super();
1292
+ const template = document.createElement('template');
1293
+ template.innerHTML = `
1294
+ <style>
1295
+ ${getStyle()}
1296
+ </style>
1297
+ <div></div>`;
1298
+
1299
+ this.attachShadow({ mode: 'open' });
1300
+ this.shadowRoot.appendChild(template.content.cloneNode(true));
1301
+
1302
+ this.baseSelector = ':host > div';
1303
+ }
1304
+ }
1305
+
1306
+ const Logo = compose(
1307
+ createStyleMixin({
1308
+ mappings: {
1309
+ height: {},
1310
+ width: {},
1311
+ url: {},
1312
+ fallbackUrl: {}
1313
+ }
1314
+ }),
1315
+ draggableMixin,
1316
+ componentNameValidationMixin
1317
+ )(RawLogo);
1318
+
1319
+ style = `
1320
+ :host {
1321
+ display: inline-block;
1322
+ }
1323
+ :host > div {
1324
+ display: inline-block;
1325
+ content: var(${Logo.cssVarList.url}, var(${Logo.cssVarList.fallbackUrl}));
1326
+ }
1327
+ `;
1328
+
1329
+ customElements.define(componentName$4, Logo);
1330
+
1331
+ const componentName$3 = getComponentName('checkbox');
1332
+
1333
+ const Checkbox = compose(
1334
+ createStyleMixin({
1335
+ mappings: {
1336
+ width: matchHostStyle(),
1337
+ cursor: [{}, { selector: '> label' }]
1338
+ }
1339
+ }),
1340
+ draggableMixin,
1341
+ inputMixin,
1342
+ componentNameValidationMixin
1343
+ )(
1344
+ createProxy({
1345
+ slots: [],
1346
+ wrappedEleName: 'vaadin-checkbox',
1347
+ style: `
1348
+ :host {
1349
+ display: inline-block;
1350
+ }
1351
+ `,
1352
+ excludeAttrsSync: ['tabindex'],
1353
+ componentName: componentName$3
1354
+ })
1355
+ );
1356
+
1357
+ customElements.define(componentName$3, Checkbox);
1049
1358
 
1050
1359
  const getVarName = (path) => getCssVarName(DESCOPE_PREFIX, ...path);
1051
1360
 
@@ -1286,7 +1595,7 @@ var globals = {
1286
1595
  };
1287
1596
 
1288
1597
  const globalRefs$4 = getThemeRefs(globals);
1289
- const vars$8 = Button.cssVarList;
1598
+ const vars$9 = Button.cssVarList;
1290
1599
 
1291
1600
  const mode = {
1292
1601
  primary: globalRefs$4.colors.primary,
@@ -1296,83 +1605,83 @@ const mode = {
1296
1605
  surface: globalRefs$4.colors.surface
1297
1606
  };
1298
1607
 
1299
- const [helperTheme$1, helperRefs$1] = createHelperVars({ mode }, componentName$c);
1608
+ const [helperTheme$1, helperRefs$1] = createHelperVars({ mode }, componentName$f);
1300
1609
 
1301
1610
  const button = {
1302
1611
  ...helperTheme$1,
1303
1612
 
1304
1613
  size: {
1305
1614
  xs: {
1306
- [vars$8.height]: '10px',
1307
- [vars$8.fontSize]: '10px',
1308
- [vars$8.padding]: `0 ${globalRefs$4.spacing.xs}`
1615
+ [vars$9.height]: '10px',
1616
+ [vars$9.fontSize]: '10px',
1617
+ [vars$9.padding]: `0 ${globalRefs$4.spacing.xs}`
1309
1618
  },
1310
1619
  sm: {
1311
- [vars$8.height]: '20px',
1312
- [vars$8.fontSize]: '10px',
1313
- [vars$8.padding]: `0 ${globalRefs$4.spacing.sm}`
1620
+ [vars$9.height]: '20px',
1621
+ [vars$9.fontSize]: '10px',
1622
+ [vars$9.padding]: `0 ${globalRefs$4.spacing.sm}`
1314
1623
  },
1315
1624
  md: {
1316
- [vars$8.height]: '30px',
1317
- [vars$8.fontSize]: '14px',
1318
- [vars$8.padding]: `0 ${globalRefs$4.spacing.md}`
1625
+ [vars$9.height]: '30px',
1626
+ [vars$9.fontSize]: '14px',
1627
+ [vars$9.padding]: `0 ${globalRefs$4.spacing.md}`
1319
1628
  },
1320
1629
  lg: {
1321
- [vars$8.height]: '40px',
1322
- [vars$8.fontSize]: '20px',
1323
- [vars$8.padding]: `0 ${globalRefs$4.spacing.lg}`
1630
+ [vars$9.height]: '40px',
1631
+ [vars$9.fontSize]: '20px',
1632
+ [vars$9.padding]: `0 ${globalRefs$4.spacing.lg}`
1324
1633
  },
1325
1634
  xl: {
1326
- [vars$8.height]: '50px',
1327
- [vars$8.fontSize]: '25px',
1328
- [vars$8.padding]: `0 ${globalRefs$4.spacing.xl}`
1635
+ [vars$9.height]: '50px',
1636
+ [vars$9.fontSize]: '25px',
1637
+ [vars$9.padding]: `0 ${globalRefs$4.spacing.xl}`
1329
1638
  }
1330
1639
  },
1331
1640
 
1332
- [vars$8.borderRadius]: globalRefs$4.radius.lg,
1333
- [vars$8.cursor]: 'pointer',
1334
- [vars$8.borderWidth]: '2px',
1335
- [vars$8.borderStyle]: 'solid',
1336
- [vars$8.borderColor]: 'transparent',
1641
+ [vars$9.borderRadius]: globalRefs$4.radius.lg,
1642
+ [vars$9.cursor]: 'pointer',
1643
+ [vars$9.borderWidth]: '2px',
1644
+ [vars$9.borderStyle]: 'solid',
1645
+ [vars$9.borderColor]: 'transparent',
1337
1646
 
1338
1647
  _fullWidth: {
1339
- [vars$8.width]: '100%'
1648
+ [vars$9.width]: '100%'
1340
1649
  },
1341
1650
  _loading: {
1342
- [vars$8.cursor]: 'wait'
1651
+ [vars$9.cursor]: 'wait'
1343
1652
  },
1344
1653
 
1345
1654
  variant: {
1346
1655
  contained: {
1347
- [vars$8.color]: helperRefs$1.contrast,
1348
- [vars$8.backgroundColor]: helperRefs$1.main,
1656
+ [vars$9.color]: helperRefs$1.contrast,
1657
+ [vars$9.backgroundColor]: helperRefs$1.main,
1349
1658
  _hover: {
1350
- [vars$8.backgroundColor]: helperRefs$1.dark
1659
+ [vars$9.backgroundColor]: helperRefs$1.dark
1351
1660
  },
1352
1661
  _loading: {
1353
- [vars$8.backgroundColor]: helperRefs$1.main
1662
+ [vars$9.backgroundColor]: helperRefs$1.main
1354
1663
  }
1355
1664
  },
1356
1665
  outline: {
1357
- [vars$8.color]: helperRefs$1.main,
1358
- [vars$8.borderColor]: helperRefs$1.main,
1666
+ [vars$9.color]: helperRefs$1.main,
1667
+ [vars$9.borderColor]: helperRefs$1.main,
1359
1668
  _hover: {
1360
- [vars$8.color]: helperRefs$1.dark,
1361
- [vars$8.borderColor]: helperRefs$1.dark,
1669
+ [vars$9.color]: helperRefs$1.dark,
1670
+ [vars$9.borderColor]: helperRefs$1.dark,
1362
1671
  _error: {
1363
- [vars$8.color]: helperRefs$1.error
1672
+ [vars$9.color]: helperRefs$1.error
1364
1673
  }
1365
1674
  }
1366
1675
  },
1367
1676
  link: {
1368
- [vars$8.color]: helperRefs$1.main,
1369
- [vars$8.padding]: 0,
1370
- [vars$8.margin]: 0,
1371
- [vars$8.lineHeight]: helperRefs$1.height,
1372
- [vars$8.borderRadius]: 0,
1677
+ [vars$9.color]: helperRefs$1.main,
1678
+ [vars$9.padding]: 0,
1679
+ [vars$9.margin]: 0,
1680
+ [vars$9.lineHeight]: helperRefs$1.height,
1681
+ [vars$9.borderRadius]: 0,
1373
1682
  _hover: {
1374
- [vars$8.color]: helperRefs$1.main,
1375
- [vars$8.textDecoration]: 'underline'
1683
+ [vars$9.color]: helperRefs$1.main,
1684
+ [vars$9.textDecoration]: 'underline'
1376
1685
  }
1377
1686
  }
1378
1687
  }
@@ -1380,7 +1689,7 @@ const button = {
1380
1689
 
1381
1690
  const globalRefs$3 = getThemeRefs(globals);
1382
1691
 
1383
- const vars$7 = TextField.cssVarList;
1692
+ const vars$8 = TextField.cssVarList;
1384
1693
 
1385
1694
  const textField = (vars) => ({
1386
1695
  size: {
@@ -1450,13 +1759,13 @@ const textField = (vars) => ({
1450
1759
  }
1451
1760
  });
1452
1761
 
1453
- var textField$1 = textField(vars$7);
1762
+ var textField$1 = textField(vars$8);
1454
1763
 
1455
- const vars$6 = PasswordField.cssVarList;
1764
+ const vars$7 = PasswordField.cssVarList;
1456
1765
 
1457
1766
  const passwordField = {
1458
- ...textField(vars$6),
1459
- [vars$6.revealCursor]: 'pointer'
1767
+ ...textField(vars$7),
1768
+ [vars$7.revealCursor]: 'pointer'
1460
1769
  };
1461
1770
 
1462
1771
  const numberField = {
@@ -1468,78 +1777,52 @@ const emailField = {
1468
1777
  };
1469
1778
 
1470
1779
  const globalRefs$2 = getThemeRefs(globals);
1471
- const vars$5 = TextArea.cssVarList;
1780
+ const vars$6 = TextArea.cssVarList;
1472
1781
 
1473
1782
  const textArea = {
1474
- [vars$5.color]: globalRefs$2.colors.primary.main,
1475
- [vars$5.backgroundColor]: globalRefs$2.colors.surface.light,
1476
- [vars$5.resize]: 'vertical',
1783
+ [vars$6.color]: globalRefs$2.colors.primary.main,
1784
+ [vars$6.backgroundColor]: globalRefs$2.colors.surface.light,
1785
+ [vars$6.resize]: 'vertical',
1477
1786
 
1478
- [vars$5.borderRadius]: globalRefs$2.radius.sm,
1479
- [vars$5.borderWidth]: '1px',
1480
- [vars$5.borderStyle]: 'solid',
1481
- [vars$5.borderColor]: 'transparent',
1787
+ [vars$6.borderRadius]: globalRefs$2.radius.sm,
1788
+ [vars$6.borderWidth]: '1px',
1789
+ [vars$6.borderStyle]: 'solid',
1790
+ [vars$6.borderColor]: 'transparent',
1482
1791
 
1483
1792
  _borderOffset: {
1484
- [vars$5.outlineOffset]: '2px'
1793
+ [vars$6.outlineOffset]: '2px'
1485
1794
  },
1486
1795
 
1487
1796
  _bordered: {
1488
- [vars$5.borderColor]: globalRefs$2.colors.surface.main
1797
+ [vars$6.borderColor]: globalRefs$2.colors.surface.main
1489
1798
  },
1490
1799
 
1491
1800
  _focused: {
1492
- [vars$5.outline]: `2px solid ${globalRefs$2.colors.surface.main}`
1801
+ [vars$6.outline]: `2px solid ${globalRefs$2.colors.surface.main}`
1493
1802
  },
1494
1803
 
1495
1804
  _fullWidth: {
1496
- [vars$5.width]: '100%'
1805
+ [vars$6.width]: '100%'
1497
1806
  },
1498
1807
 
1499
1808
  _disabled: {
1500
- [vars$5.cursor]: 'not-allowed'
1809
+ [vars$6.cursor]: 'not-allowed'
1501
1810
  },
1502
1811
 
1503
1812
  _invalid: {
1504
- [vars$5.outline]: `2px solid ${globalRefs$2.colors.error.main}`
1813
+ [vars$6.outline]: `2px solid ${globalRefs$2.colors.error.main}`
1505
1814
  }
1506
1815
  };
1507
1816
 
1508
- const componentName$2 = getComponentName('checkbox');
1509
-
1510
- const Checkbox = compose(
1511
- createStyleMixin({
1512
- mappings: {
1513
- width: matchHostStyle(),
1514
- cursor: [{}, { selector: '> label' }]
1515
- }
1516
- }),
1517
- draggableMixin,
1518
- inputMixin,
1519
- componentNameValidationMixin
1520
- )(
1521
- createProxy({
1522
- slots: [],
1523
- wrappedEleName: 'vaadin-checkbox',
1524
- style: `
1525
- :host {
1526
- display: inline-block;
1527
- }
1528
- `,
1529
- excludeAttrsSync: ['tabindex'],
1530
- componentName: componentName$2
1531
- })
1532
- );
1533
-
1534
- const vars$4 = Checkbox.cssVarList;
1817
+ const vars$5 = Checkbox.cssVarList;
1535
1818
 
1536
1819
  const checkbox = {
1537
- [vars$4.cursor]: 'pointer'
1820
+ [vars$5.cursor]: 'pointer'
1538
1821
  };
1539
1822
 
1540
- const componentName$1 = getComponentName('switch-toggle');
1823
+ const componentName$2 = getComponentName('switch-toggle');
1541
1824
 
1542
- let overrides = ``;
1825
+ let overrides$1 = ``;
1543
1826
 
1544
1827
  const SwitchToggle = compose(
1545
1828
  createStyleMixin({
@@ -1555,13 +1838,13 @@ const SwitchToggle = compose(
1555
1838
  createProxy({
1556
1839
  slots: [],
1557
1840
  wrappedEleName: 'vaadin-checkbox',
1558
- style: () => overrides,
1841
+ style: () => overrides$1,
1559
1842
  excludeAttrsSync: ['tabindex'],
1560
- componentName: componentName$1
1843
+ componentName: componentName$2
1561
1844
  })
1562
1845
  );
1563
1846
 
1564
- overrides = `
1847
+ overrides$1 = `
1565
1848
  :host {
1566
1849
  display: inline-block;
1567
1850
  }
@@ -1611,16 +1894,16 @@ overrides = `
1611
1894
  }
1612
1895
  `;
1613
1896
 
1614
- const vars$3 = SwitchToggle.cssVarList;
1897
+ const vars$4 = SwitchToggle.cssVarList;
1615
1898
 
1616
1899
  const swtichToggle = {
1617
- [vars$3.width]: '70px',
1618
- [vars$3.cursor]: [{}, { selector: '> label' }]
1900
+ [vars$4.width]: '70px',
1901
+ [vars$4.cursor]: [{}, { selector: '> label' }]
1619
1902
  };
1620
1903
 
1621
1904
  const globalRefs$1 = getThemeRefs(globals);
1622
1905
 
1623
- const vars$2 = Container.cssVarList;
1906
+ const vars$3 = Container.cssVarList;
1624
1907
 
1625
1908
  const verticalAlignment = {
1626
1909
  start: { verticalAlignment: 'start' },
@@ -1643,31 +1926,31 @@ const [helperTheme, helperRefs, helperVars] =
1643
1926
 
1644
1927
  const container = {
1645
1928
  ...helperTheme,
1646
- [vars$2.display]: 'flex',
1929
+ [vars$3.display]: 'flex',
1647
1930
  verticalPadding: {
1648
- sm: { [vars$2.verticalPadding]: '5px' },
1649
- md: { [vars$2.verticalPadding]: '10px' },
1650
- lg: { [vars$2.verticalPadding]: '20px' },
1931
+ sm: { [vars$3.verticalPadding]: '5px' },
1932
+ md: { [vars$3.verticalPadding]: '10px' },
1933
+ lg: { [vars$3.verticalPadding]: '20px' },
1651
1934
  },
1652
1935
  horizontalPadding: {
1653
- sm: { [vars$2.horizontalPadding]: '5px' },
1654
- md: { [vars$2.horizontalPadding]: '10px' },
1655
- lg: { [vars$2.horizontalPadding]: '20px' },
1936
+ sm: { [vars$3.horizontalPadding]: '5px' },
1937
+ md: { [vars$3.horizontalPadding]: '10px' },
1938
+ lg: { [vars$3.horizontalPadding]: '20px' },
1656
1939
  },
1657
1940
  direction: {
1658
1941
  row: {
1659
- [vars$2.flexDirection]: 'row',
1660
- [vars$2.alignItems]: helperRefs.verticalAlignment,
1661
- [vars$2.justifyContent]: helperRefs.horizontalAlignment,
1942
+ [vars$3.flexDirection]: 'row',
1943
+ [vars$3.alignItems]: helperRefs.verticalAlignment,
1944
+ [vars$3.justifyContent]: helperRefs.horizontalAlignment,
1662
1945
  horizontalAlignment: {
1663
1946
  spaceBetween: { [helperVars.horizontalAlignment]: 'space-between' },
1664
1947
  }
1665
1948
  },
1666
1949
 
1667
1950
  column: {
1668
- [vars$2.flexDirection]: 'column',
1669
- [vars$2.alignItems]: helperRefs.horizontalAlignment,
1670
- [vars$2.justifyContent]: helperRefs.verticalAlignment,
1951
+ [vars$3.flexDirection]: 'column',
1952
+ [vars$3.alignItems]: helperRefs.horizontalAlignment,
1953
+ [vars$3.justifyContent]: helperRefs.verticalAlignment,
1671
1954
  verticalAlignment: {
1672
1955
  spaceBetween: { [helperVars.verticalAlignment]: 'space-between' }
1673
1956
  }
@@ -1676,174 +1959,286 @@ const container = {
1676
1959
 
1677
1960
  spaceBetween: {
1678
1961
  sm: {
1679
- [vars$2.gap]: '10px'
1962
+ [vars$3.gap]: '10px'
1680
1963
  },
1681
1964
  md: {
1682
- [vars$2.gap]: '20px'
1965
+ [vars$3.gap]: '20px'
1683
1966
  },
1684
1967
  lg: {
1685
- [vars$2.gap]: '30px'
1968
+ [vars$3.gap]: '30px'
1686
1969
  }
1687
1970
  },
1688
1971
 
1689
1972
  shadow: {
1690
1973
  sm: {
1691
- [vars$2.boxShadow]: `${globalRefs$1.shadow.wide.sm} ${helperRefs.shadowColor}, ${globalRefs$1.shadow.narrow.sm} ${helperRefs.shadowColor}`
1974
+ [vars$3.boxShadow]: `${globalRefs$1.shadow.wide.sm} ${helperRefs.shadowColor}, ${globalRefs$1.shadow.narrow.sm} ${helperRefs.shadowColor}`
1692
1975
  },
1693
1976
  md: {
1694
- [vars$2.boxShadow]: `${globalRefs$1.shadow.wide.md} ${helperRefs.shadowColor}, ${globalRefs$1.shadow.narrow.md} ${helperRefs.shadowColor}`
1977
+ [vars$3.boxShadow]: `${globalRefs$1.shadow.wide.md} ${helperRefs.shadowColor}, ${globalRefs$1.shadow.narrow.md} ${helperRefs.shadowColor}`
1695
1978
  },
1696
1979
  lg: {
1697
- [vars$2.boxShadow]: `${globalRefs$1.shadow.wide.lg} ${helperRefs.shadowColor}, ${globalRefs$1.shadow.narrow.lg} ${helperRefs.shadowColor}`
1980
+ [vars$3.boxShadow]: `${globalRefs$1.shadow.wide.lg} ${helperRefs.shadowColor}, ${globalRefs$1.shadow.narrow.lg} ${helperRefs.shadowColor}`
1698
1981
  },
1699
1982
  xl: {
1700
- [vars$2.boxShadow]: `${globalRefs$1.shadow.wide.xl} ${helperRefs.shadowColor}, ${globalRefs$1.shadow.narrow.xl} ${helperRefs.shadowColor}`
1983
+ [vars$3.boxShadow]: `${globalRefs$1.shadow.wide.xl} ${helperRefs.shadowColor}, ${globalRefs$1.shadow.narrow.xl} ${helperRefs.shadowColor}`
1701
1984
  },
1702
1985
  '2xl': {
1703
1986
  [helperVars.shadowColor]: '#00000050',
1704
- [vars$2.boxShadow]: `${globalRefs$1.shadow.wide['2xl']} ${helperRefs.shadowColor}`
1987
+ [vars$3.boxShadow]: `${globalRefs$1.shadow.wide['2xl']} ${helperRefs.shadowColor}`
1705
1988
  },
1706
1989
  },
1707
1990
 
1708
1991
  borderRadius: {
1709
1992
  sm: {
1710
- [vars$2.borderRadius]: globalRefs$1.radius.sm
1993
+ [vars$3.borderRadius]: globalRefs$1.radius.sm
1711
1994
  },
1712
1995
  md: {
1713
- [vars$2.borderRadius]: globalRefs$1.radius.md
1996
+ [vars$3.borderRadius]: globalRefs$1.radius.md
1714
1997
  },
1715
1998
  lg: {
1716
- [vars$2.borderRadius]: globalRefs$1.radius.lg
1999
+ [vars$3.borderRadius]: globalRefs$1.radius.lg
1717
2000
  },
1718
2001
  }
1719
2002
  };
1720
2003
 
1721
- const componentName = getComponentName('logo');
1722
-
1723
- let style;
1724
- const getStyle = () => style;
1725
-
1726
- class RawLogo extends HTMLElement {
1727
- static get componentName() {
1728
- return componentName;
1729
- }
1730
- constructor() {
1731
- super();
1732
- const template = document.createElement('template');
1733
- template.innerHTML = `
1734
- <style>
1735
- ${getStyle()}
1736
- </style>
1737
- <div></div>`;
1738
-
1739
- this.attachShadow({ mode: 'open' });
1740
- this.shadowRoot.appendChild(template.content.cloneNode(true));
1741
-
1742
- this.baseSelector = ':host > div';
1743
- }
1744
- }
1745
-
1746
- const Logo = compose(
1747
- createStyleMixin({
1748
- mappings: {
1749
- height: {},
1750
- width: {},
1751
- url: {},
1752
- fallbackUrl: {},
1753
- }
1754
- }),
1755
- draggableMixin,
1756
- componentNameValidationMixin
1757
- )(RawLogo);
1758
-
1759
- style = `
1760
- :host {
1761
- display: inline-block;
1762
- }
1763
- :host > div {
1764
- display: inline-block;
1765
- content: var(${Logo.cssVarList.url}, var(${Logo.cssVarList.fallbackUrl}));
1766
- }
1767
- `;
1768
-
1769
- const vars$1 = Logo.cssVarList;
2004
+ const vars$2 = Logo.cssVarList;
1770
2005
 
1771
2006
  const logo = {
1772
- [vars$1.fallbackUrl]: 'url(https://content.app.descope.com/assets/flows/noLogoPlaceholder.svg)'
2007
+ [vars$2.fallbackUrl]: 'url(https://content.app.descope.com/assets/flows/noLogoPlaceholder.svg)'
1773
2008
  };
1774
2009
 
1775
2010
  const globalRefs = getThemeRefs(globals);
1776
2011
 
1777
- const vars = Text.cssVarList;
2012
+ const vars$1 = Text.cssVarList;
1778
2013
 
1779
2014
  const text = {
1780
- [vars.lineHeight]: '1em',
1781
- [vars.display]: 'inline-block',
1782
- [vars.textAlign]: 'left',
1783
- [vars.color]: globalRefs.colors.surface.dark,
2015
+ [vars$1.lineHeight]: '1em',
2016
+ [vars$1.display]: 'inline-block',
2017
+ [vars$1.textAlign]: 'left',
2018
+ [vars$1.color]: globalRefs.colors.surface.dark,
1784
2019
  variant: {
1785
2020
  h1: {
1786
- [vars.fontSize]: globalRefs.typography.h1.size,
1787
- [vars.fontWeight]: globalRefs.typography.h1.weight,
1788
- [vars.fontFamily]: globalRefs.typography.h1.font
2021
+ [vars$1.fontSize]: globalRefs.typography.h1.size,
2022
+ [vars$1.fontWeight]: globalRefs.typography.h1.weight,
2023
+ [vars$1.fontFamily]: globalRefs.typography.h1.font
1789
2024
  },
1790
2025
  h2: {
1791
- [vars.fontSize]: globalRefs.typography.h2.size,
1792
- [vars.fontWeight]: globalRefs.typography.h2.weight,
1793
- [vars.fontFamily]: globalRefs.typography.h2.font
2026
+ [vars$1.fontSize]: globalRefs.typography.h2.size,
2027
+ [vars$1.fontWeight]: globalRefs.typography.h2.weight,
2028
+ [vars$1.fontFamily]: globalRefs.typography.h2.font
1794
2029
  },
1795
2030
  h3: {
1796
- [vars.fontSize]: globalRefs.typography.h3.size,
1797
- [vars.fontWeight]: globalRefs.typography.h3.weight,
1798
- [vars.fontFamily]: globalRefs.typography.h3.font
2031
+ [vars$1.fontSize]: globalRefs.typography.h3.size,
2032
+ [vars$1.fontWeight]: globalRefs.typography.h3.weight,
2033
+ [vars$1.fontFamily]: globalRefs.typography.h3.font
1799
2034
  },
1800
2035
  subtitle1: {
1801
- [vars.fontSize]: globalRefs.typography.subtitle1.size,
1802
- [vars.fontWeight]: globalRefs.typography.subtitle1.weight,
1803
- [vars.fontFamily]: globalRefs.typography.subtitle1.font
2036
+ [vars$1.fontSize]: globalRefs.typography.subtitle1.size,
2037
+ [vars$1.fontWeight]: globalRefs.typography.subtitle1.weight,
2038
+ [vars$1.fontFamily]: globalRefs.typography.subtitle1.font
1804
2039
  },
1805
2040
  subtitle2: {
1806
- [vars.fontSize]: globalRefs.typography.subtitle2.size,
1807
- [vars.fontWeight]: globalRefs.typography.subtitle2.weight,
1808
- [vars.fontFamily]: globalRefs.typography.subtitle2.font
2041
+ [vars$1.fontSize]: globalRefs.typography.subtitle2.size,
2042
+ [vars$1.fontWeight]: globalRefs.typography.subtitle2.weight,
2043
+ [vars$1.fontFamily]: globalRefs.typography.subtitle2.font
1809
2044
  },
1810
2045
  body1: {
1811
- [vars.fontSize]: globalRefs.typography.body1.size,
1812
- [vars.fontWeight]: globalRefs.typography.body1.weight,
1813
- [vars.fontFamily]: globalRefs.typography.body1.font
2046
+ [vars$1.fontSize]: globalRefs.typography.body1.size,
2047
+ [vars$1.fontWeight]: globalRefs.typography.body1.weight,
2048
+ [vars$1.fontFamily]: globalRefs.typography.body1.font
1814
2049
  },
1815
2050
  body2: {
1816
- [vars.fontSize]: globalRefs.typography.body2.size,
1817
- [vars.fontWeight]: globalRefs.typography.body2.weight,
1818
- [vars.fontFamily]: globalRefs.typography.body2.font
2051
+ [vars$1.fontSize]: globalRefs.typography.body2.size,
2052
+ [vars$1.fontWeight]: globalRefs.typography.body2.weight,
2053
+ [vars$1.fontFamily]: globalRefs.typography.body2.font
1819
2054
  }
1820
2055
  },
1821
2056
  mode: {
1822
2057
  primary: {
1823
- [vars.color]: globalRefs.colors.primary.main
2058
+ [vars$1.color]: globalRefs.colors.primary.main
1824
2059
  },
1825
2060
  secondary: {
1826
- [vars.color]: globalRefs.colors.secondary.main
2061
+ [vars$1.color]: globalRefs.colors.secondary.main
1827
2062
  },
1828
2063
  error: {
1829
- [vars.color]: globalRefs.colors.error.main
2064
+ [vars$1.color]: globalRefs.colors.error.main
1830
2065
  },
1831
2066
  success: {
1832
- [vars.color]: globalRefs.colors.success.main
2067
+ [vars$1.color]: globalRefs.colors.success.main
1833
2068
  }
1834
2069
  },
1835
2070
  textAlign: {
1836
- right: { [vars.textAlign]: 'right' },
1837
- left: { [vars.textAlign]: 'left' },
1838
- center: { [vars.textAlign]: 'center' }
2071
+ right: { [vars$1.textAlign]: 'right' },
2072
+ left: { [vars$1.textAlign]: 'left' },
2073
+ center: { [vars$1.textAlign]: 'center' }
1839
2074
  },
1840
2075
  _fullWidth: {
1841
- [vars.width]: '100%',
1842
- [vars.display]: 'block'
2076
+ [vars$1.width]: '100%',
2077
+ [vars$1.display]: 'block'
1843
2078
  },
1844
2079
  _italic: {
1845
- [vars.fontStyle]: 'italic'
2080
+ [vars$1.fontStyle]: 'italic'
2081
+ },
2082
+ _uppercase: {
2083
+ [vars$1.textTransform]: 'uppercase'
2084
+ },
2085
+ _lowercase: {
2086
+ [vars$1.textTransform]: 'lowercase'
2087
+ }
2088
+ };
2089
+
2090
+ const vars = Divider.cssVarList;
2091
+
2092
+ const divider = {
2093
+ [vars.alignItems]: 'center',
2094
+ [vars.height]: '2px',
2095
+ [vars.backgroundColor]: 'currentColor',
2096
+ [vars.opacity]: '0.2',
2097
+ [vars.padding]: '0 10px',
2098
+ [vars.width]: '100%',
2099
+ [vars.flexDirection]: 'row',
2100
+ [vars.alignSelf]: 'strech',
2101
+ [vars.textWidth]: 'fit-content',
2102
+ _vertical: {
2103
+ [vars.width]: '2px',
2104
+ [vars.padding]: '10px 0',
2105
+ [vars.flexDirection]: 'column',
2106
+ [vars.minHeight]: '200px',
2107
+ [vars.textWidth]: 'max-content'
2108
+ }
2109
+ };
2110
+
2111
+ const componentName$1 = getComponentName('passcode-internal');
2112
+
2113
+ const componentName = getComponentName('passcode');
2114
+
2115
+ const customMixin = (superclass) =>
2116
+ class DraggableMixinClass extends superclass {
2117
+ constructor() {
2118
+ super();
2119
+ }
2120
+
2121
+ get digits() {
2122
+ return Number.parseInt(this.getAttribute('digits')) || 6
2123
+ }
2124
+
2125
+ connectedCallback() {
2126
+ super.connectedCallback?.();
2127
+ const template = document.createElement('template');
2128
+
2129
+ //forward required & pattern TODO use forwardAttrs
2130
+ template.innerHTML = `
2131
+ <${componentName$1}
2132
+ bordered="true"
2133
+ name="code"
2134
+ tabindex="0"
2135
+ slot="input"
2136
+ required="${this.shadowRoot.host.getAttribute('required')}"
2137
+ pattern="${this.shadowRoot.host.getAttribute('pattern')}"
2138
+ ></${componentName$1}>
2139
+ `;
2140
+
2141
+ // 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
2142
+ const slotEle = Object.assign(document.createElement('slot'), { name: 'input', slot: 'input', part: 'input' });
2143
+ this.proxyElement.appendChild(slotEle);
2144
+
2145
+ // we want to control when the element is out of focus
2146
+ // so the validations will be triggered blur event is dispatched from descope-passcode internal (and not every time focusing a digit)
2147
+ this.proxyElement._setFocused = () => { };
2148
+
2149
+ this.shadowRoot.host.appendChild(template.content.cloneNode(true));
2150
+ this.inputElement = this.querySelector(componentName$1);
2151
+
2152
+ // we want to trigger validation only when dispatching a blur event from the descope-passcode-internal
2153
+ this.inputElement.addEventListener('blur', () => {
2154
+ this.proxyElement.validate();
2155
+ });
2156
+ }
2157
+ };
2158
+
2159
+ const { borderStyle, borderWidth, ...restTextFieldMappings } = textFieldMappings;
2160
+
2161
+ const Passcode = compose(
2162
+ createStyleMixin({
2163
+ mappings: {
2164
+ ...restTextFieldMappings,
2165
+ },
2166
+ nestedMappings: {
2167
+ borderColor: {
2168
+ selector: ` ${TextField.componentName}`,
2169
+ property: TextField.cssVarList.borderColor
2170
+ }
2171
+ }
2172
+ }),
2173
+ draggableMixin,
2174
+ inputMixin,
2175
+ componentNameValidationMixin,
2176
+ customMixin
2177
+ )(
2178
+ createProxy({
2179
+ slots: [],
2180
+ wrappedEleName: 'vaadin-text-field',
2181
+ style: () => `
2182
+ :host {
2183
+ --vaadin-field-default-width: auto;
2184
+ }
2185
+
2186
+ ::slotted([slot='input']) {
2187
+ -webkit-mask-image: none;
2188
+ display: flex;
2189
+ gap: 2px;
2190
+ align-items: center;
2191
+ padding: 0;
2192
+ }
2193
+
2194
+ vaadin-text-field::part(input-field) {
2195
+ background-color: transparent;
2196
+ padding: 0;
2197
+ }
2198
+
2199
+ ${overrides}
2200
+ `,
2201
+ excludeAttrsSync: ['tabindex'],
2202
+ componentName
2203
+ })
2204
+ );
2205
+
2206
+ const overrides = `
2207
+ :host {
2208
+ display: inline-block;
1846
2209
  }
2210
+
2211
+ vaadin-text-field {
2212
+ margin: 0;
2213
+ padding: 0;
2214
+ }
2215
+ vaadin-text-field::part(input-field) {
2216
+ overflow: hidden;
2217
+ }
2218
+ vaadin-text-field[readonly] > input:placeholder-shown {
2219
+ opacity: 1;
2220
+ }
2221
+
2222
+ vaadin-text-field > label,
2223
+ vaadin-text-field::part(input-field) {
2224
+ cursor: pointer;
2225
+ color: var(${Passcode.cssVarList.color});
2226
+ }
2227
+ vaadin-text-field::part(input-field):focus {
2228
+ cursor: text;
2229
+ }
2230
+ vaadin-text-field[required]::part(required-indicator)::after {
2231
+ font-size: "12px";
2232
+ content: "*";
2233
+ color: var(${Passcode.cssVarList.color});
2234
+ }
2235
+ vaadin-text-field[readonly]::part(input-field)::after {
2236
+ border: 0 solid;
2237
+ }
2238
+ `;
2239
+
2240
+ const passcode = {
2241
+ ...textField(Passcode.cssVarList),
1847
2242
  };
1848
2243
 
1849
2244
  var components = {
@@ -1857,7 +2252,9 @@ var components = {
1857
2252
  switchToggle: swtichToggle,
1858
2253
  container,
1859
2254
  logo,
1860
- text
2255
+ text,
2256
+ divider,
2257
+ passcode
1861
2258
  };
1862
2259
 
1863
2260
  var index = { globals, components };