@descope/web-components-ui 1.0.51 → 1.0.52
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.esm.js +297 -133
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/433.js +1 -1
- package/dist/umd/descope-combo-index-js.js +1 -1
- package/dist/umd/descope-passcode-descope-passcode-internal-index-js.js +1 -0
- package/dist/umd/descope-passcode-index-js.js +1 -0
- package/dist/umd/descope-text-field-index-js.js +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +1 -1
- package/src/components/descope-container/Container.js +1 -1
- package/src/components/descope-passcode/Passcode.js +141 -0
- package/src/components/descope-passcode/descope-passcode-internal/PasscodeInternal.js +213 -0
- package/src/components/descope-passcode/descope-passcode-internal/helpers.js +14 -0
- package/src/components/descope-passcode/descope-passcode-internal/index.js +3 -0
- package/src/components/descope-passcode/index.js +5 -0
- package/src/componentsHelpers/createProxy/index.js +3 -4
- package/src/componentsHelpers/createStyleMixin/index.js +103 -72
- package/src/componentsHelpers/inputMixin.js +13 -13
- package/src/theme/components/index.js +3 -1
- package/src/theme/components/passcode.js +8 -0
package/dist/index.esm.js
CHANGED
@@ -108,80 +108,111 @@ const matchHostStyle = (mappingObj = {}) => [
|
|
108
108
|
];
|
109
109
|
|
110
110
|
const createStyleMixin =
|
111
|
-
({ mappings = {} }) =>
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
111
|
+
({ mappings = {}, nestedMappings = {} }) =>
|
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
|
+
}
|
121
121
|
|
122
|
-
|
123
|
-
|
124
|
-
|
122
|
+
static get cssVarList() {
|
123
|
+
return createCssVarsList(superclass.componentName, mappings);
|
124
|
+
}
|
125
125
|
|
126
|
-
|
126
|
+
#styleEle = null;
|
127
127
|
|
128
|
-
|
129
|
-
|
128
|
+
constructor() {
|
129
|
+
super();
|
130
130
|
|
131
|
-
|
132
|
-
|
133
|
-
|
131
|
+
this.#createComponentStyle();
|
132
|
+
this.#createAttrOverrideStyle();
|
133
|
+
}
|
134
134
|
|
135
|
-
|
136
|
-
|
137
|
-
|
135
|
+
#createAttrOverrideStyle() {
|
136
|
+
this.#styleEle = document.createElement('style');
|
137
|
+
this.#styleEle.id = 'style-mixin-overrides';
|
138
138
|
|
139
|
-
|
140
|
-
|
141
|
-
|
139
|
+
this.#styleEle.innerText = '* {}';
|
140
|
+
this.shadowRoot.prepend(this.#styleEle);
|
141
|
+
}
|
142
142
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
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
|
+
);
|
149
149
|
|
150
|
-
|
151
|
-
|
152
|
-
|
150
|
+
if (value) style?.setProperty(varName, value);
|
151
|
+
else style?.removeProperty(varName);
|
152
|
+
}
|
153
153
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
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
|
+
}
|
164
164
|
|
165
|
-
|
166
|
-
|
165
|
+
#createComponentNestingStyle() {
|
166
|
+
// we need these selectors to be more specific from the theme selectors
|
167
|
+
// in order to do it, we are repeating the class name for specificity
|
168
|
+
const numOfClassNameSpecifier = 3;
|
167
169
|
|
168
|
-
|
169
|
-
|
170
|
+
const rootNode = this.shadowRoot.host.getRootNode();
|
171
|
+
const styleId = `${superclass.componentName}-style-mixin-component`;
|
172
|
+
|
173
|
+
const className = superclass.componentName;
|
174
|
+
this.shadowRoot.host.classList.add(className);
|
175
|
+
|
176
|
+
if(rootNode.querySelector(`style#${styleId}`)) return;
|
177
|
+
|
178
|
+
const themeStyle = document.createElement('style');
|
179
|
+
themeStyle.id = styleId;
|
180
|
+
themeStyle.innerHTML = createStyle(
|
181
|
+
superclass.componentName,
|
182
|
+
`${superclass.componentName}${Array(numOfClassNameSpecifier).fill(`.${className}`).join('')}`,
|
183
|
+
nestedMappings
|
184
|
+
);
|
185
|
+
|
186
|
+
// rootNode can be either a shadow DOM or a light DOM
|
187
|
+
if (rootNode.nodeName === '#document') {
|
188
|
+
rootNode.head.append(themeStyle);
|
189
|
+
} else {
|
190
|
+
rootNode.append(themeStyle);
|
191
|
+
}
|
170
192
|
}
|
171
|
-
}
|
172
193
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
194
|
+
attributeChangedCallback(attrName, oldValue, newValue) {
|
195
|
+
super.attributeChangedCallback?.(attrName, oldValue, newValue);
|
196
|
+
|
197
|
+
if (styleAttributes.includes(attrName)) {
|
198
|
+
this.#updateAttrOverrideStyle(attrName, newValue);
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
connectedCallback() {
|
203
|
+
super.connectedCallback?.();
|
204
|
+
if (this.shadowRoot.isConnected) {
|
205
|
+
this.#createComponentNestingStyle();
|
206
|
+
|
207
|
+
Array.from(this.attributes).forEach(attr => {
|
208
|
+
if (styleAttributes.includes(attr.nodeName)) {
|
209
|
+
this.#updateAttrOverrideStyle(attr.nodeName, attr.value);
|
210
|
+
}
|
211
|
+
});
|
212
|
+
}
|
213
|
+
}
|
214
|
+
};
|
183
215
|
};
|
184
|
-
};
|
185
216
|
|
186
217
|
const draggableMixin = (superclass) =>
|
187
218
|
class DraggableMixinClass extends superclass {
|
@@ -288,9 +319,9 @@ const createProxy = ({
|
|
288
319
|
this.setAttribute('tabindex', '0');
|
289
320
|
|
290
321
|
// we want to focus on the proxy element when focusing our WC
|
291
|
-
this.
|
322
|
+
this.addEventListener('focus', () => {
|
292
323
|
this.proxyElement.focus();
|
293
|
-
};
|
324
|
+
});
|
294
325
|
|
295
326
|
// `onkeydown` is set on `proxyElement` support proper tab-index navigation
|
296
327
|
// this support is needed since both proxy host and element catch `focus`/`blur` event
|
@@ -316,8 +347,7 @@ const createProxy = ({
|
|
316
347
|
this.proxyElement.addEventListener('mouseover', this.mouseoverCbRef);
|
317
348
|
|
318
349
|
// sync events
|
319
|
-
this.addEventListener = this.proxyElement.addEventListener;
|
320
|
-
|
350
|
+
this.addEventListener = (...args) => this.proxyElement.addEventListener(...args);
|
321
351
|
syncAttrs(this.proxyElement, this.hostElement, excludeAttrsSync);
|
322
352
|
}
|
323
353
|
}
|
@@ -392,40 +422,40 @@ const inputMixin = (superclass) =>
|
|
392
422
|
}
|
393
423
|
|
394
424
|
connectedCallback() {
|
395
|
-
this.baseEle = this.shadowRoot.querySelector(this.baseSelector);
|
396
425
|
super.connectedCallback?.();
|
397
426
|
|
427
|
+
this.baseEle = this.shadowRoot.querySelector(this.baseSelector);
|
428
|
+
|
398
429
|
// this is needed in order to make sure the form input validation is working
|
399
430
|
if (!this.hasAttribute('tabindex')) {
|
400
431
|
this.setAttribute('tabindex', 0);
|
401
432
|
}
|
402
433
|
|
403
|
-
|
404
|
-
this.baseEle.querySelector('
|
405
|
-
|
406
|
-
if (!input) throw Error('no input was found');
|
434
|
+
this.inputElement ??= this.baseEle.shadowRoot.querySelector('slot[name="input"]')?.assignedElements()[0] ||
|
435
|
+
this.baseEle.shadowRoot.querySelector('slot[name="textarea"]')?.assignedElements()[0];
|
436
|
+
if (!this.inputElement) throw Error('no input was found');
|
407
437
|
|
408
438
|
// sync properties
|
409
|
-
propertyObserver(this,
|
410
|
-
this.setSelectionRange =
|
439
|
+
propertyObserver(this, this.inputElement, 'value');
|
440
|
+
this.setSelectionRange = this.inputElement.setSelectionRange?.bind(this.inputElement);
|
411
441
|
|
412
|
-
this.validity =
|
442
|
+
this.validity = this.inputElement.validity;
|
413
443
|
|
414
444
|
this.setValidity = () => {
|
415
|
-
this.#internals.setValidity(
|
445
|
+
this.#internals.setValidity(this.inputElement.validity, this.inputElement.validationMessage);
|
416
446
|
};
|
417
447
|
|
418
|
-
|
419
|
-
this.value =
|
448
|
+
this.inputElement.oninput = () => {
|
449
|
+
this.value = this.inputElement.value;
|
420
450
|
this.setValidity();
|
421
451
|
};
|
422
452
|
|
423
453
|
this.onfocus = () => {
|
424
|
-
setTimeout(() =>
|
454
|
+
setTimeout(() => this.inputElement.reportValidity(), 0);
|
425
455
|
this.validate();
|
426
456
|
};
|
427
457
|
|
428
|
-
|
458
|
+
this.inputElement.oninvalid = () => {
|
429
459
|
this.validate();
|
430
460
|
};
|
431
461
|
}
|
@@ -464,7 +494,7 @@ const compose =
|
|
464
494
|
(val) =>
|
465
495
|
fns.reduceRight((res, fn) => fn(res), val);
|
466
496
|
|
467
|
-
const componentName$
|
497
|
+
const componentName$e = getComponentName('button');
|
468
498
|
|
469
499
|
const editorOverrides = `vaadin-button::part(label) { pointer-events: none; }`;
|
470
500
|
const resetStyles = `
|
@@ -518,7 +548,7 @@ const Button = compose(
|
|
518
548
|
style: () =>
|
519
549
|
`${resetStyles} ${editorOverrides} ${iconStyles} ${loadingIndicatorStyles}`,
|
520
550
|
excludeAttrsSync: ['tabindex'],
|
521
|
-
componentName: componentName$
|
551
|
+
componentName: componentName$e
|
522
552
|
})
|
523
553
|
);
|
524
554
|
|
@@ -551,7 +581,7 @@ const loadingIndicatorStyles = `
|
|
551
581
|
}
|
552
582
|
`;
|
553
583
|
|
554
|
-
customElements.define(componentName$
|
584
|
+
customElements.define(componentName$e, Button);
|
555
585
|
|
556
586
|
const selectors$1 = {
|
557
587
|
label: '::part(label)',
|
@@ -588,9 +618,9 @@ var textFieldMappings = {
|
|
588
618
|
placeholderColor: { selector: selectors$1.placeholder, property: 'color' }
|
589
619
|
};
|
590
620
|
|
591
|
-
const componentName$
|
621
|
+
const componentName$d = getComponentName('text-field');
|
592
622
|
|
593
|
-
let overrides$
|
623
|
+
let overrides$6 = ``;
|
594
624
|
|
595
625
|
const TextField = compose(
|
596
626
|
createStyleMixin({
|
@@ -603,13 +633,13 @@ const TextField = compose(
|
|
603
633
|
createProxy({
|
604
634
|
slots: ['prefix', 'suffix'],
|
605
635
|
wrappedEleName: 'vaadin-text-field',
|
606
|
-
style: () => overrides$
|
636
|
+
style: () => overrides$6,
|
607
637
|
excludeAttrsSync: ['tabindex'],
|
608
|
-
componentName: componentName$
|
638
|
+
componentName: componentName$d
|
609
639
|
})
|
610
640
|
);
|
611
641
|
|
612
|
-
overrides$
|
642
|
+
overrides$6 = `
|
613
643
|
:host {
|
614
644
|
display: inline-block;
|
615
645
|
}
|
@@ -650,11 +680,11 @@ overrides$5 = `
|
|
650
680
|
}
|
651
681
|
`;
|
652
682
|
|
653
|
-
customElements.define(componentName$
|
683
|
+
customElements.define(componentName$d, TextField);
|
654
684
|
|
655
685
|
const template = document.createElement('template');
|
656
686
|
|
657
|
-
const componentName$
|
687
|
+
const componentName$c = getComponentName('combo');
|
658
688
|
|
659
689
|
template.innerHTML = `
|
660
690
|
<descope-button></descope-button>
|
@@ -671,11 +701,11 @@ class Combo extends HTMLElement {
|
|
671
701
|
}
|
672
702
|
}
|
673
703
|
|
674
|
-
customElements.define(componentName$
|
704
|
+
customElements.define(componentName$c, Combo);
|
675
705
|
|
676
|
-
const componentName$
|
706
|
+
const componentName$b = getComponentName('number-field');
|
677
707
|
|
678
|
-
let overrides$
|
708
|
+
let overrides$5 = ``;
|
679
709
|
|
680
710
|
const NumberField = compose(
|
681
711
|
createStyleMixin({
|
@@ -690,13 +720,13 @@ const NumberField = compose(
|
|
690
720
|
createProxy({
|
691
721
|
slots: ['prefix', 'suffix'],
|
692
722
|
wrappedEleName: 'vaadin-number-field',
|
693
|
-
style: () => overrides$
|
723
|
+
style: () => overrides$5,
|
694
724
|
excludeAttrsSync: ['tabindex'],
|
695
|
-
componentName: componentName$
|
725
|
+
componentName: componentName$b
|
696
726
|
})
|
697
727
|
);
|
698
728
|
|
699
|
-
overrides$
|
729
|
+
overrides$5 = `
|
700
730
|
:host {
|
701
731
|
display: inline-block;
|
702
732
|
}
|
@@ -736,11 +766,11 @@ overrides$4 = `
|
|
736
766
|
}
|
737
767
|
`;
|
738
768
|
|
739
|
-
customElements.define(componentName$
|
769
|
+
customElements.define(componentName$b, NumberField);
|
740
770
|
|
741
|
-
const componentName$
|
771
|
+
const componentName$a = getComponentName('email-field');
|
742
772
|
|
743
|
-
let overrides$
|
773
|
+
let overrides$4 = ``;
|
744
774
|
|
745
775
|
const EmailField = compose(
|
746
776
|
createStyleMixin({
|
@@ -755,13 +785,13 @@ const EmailField = compose(
|
|
755
785
|
createProxy({
|
756
786
|
slots: ['suffix'],
|
757
787
|
wrappedEleName: 'vaadin-email-field',
|
758
|
-
style: () => overrides$
|
788
|
+
style: () => overrides$4,
|
759
789
|
excludeAttrsSync: ['tabindex'],
|
760
|
-
componentName: componentName$
|
790
|
+
componentName: componentName$a
|
761
791
|
})
|
762
792
|
);
|
763
793
|
|
764
|
-
overrides$
|
794
|
+
overrides$4 = `
|
765
795
|
:host {
|
766
796
|
display: inline-block;
|
767
797
|
}
|
@@ -801,11 +831,11 @@ overrides$3 = `
|
|
801
831
|
}
|
802
832
|
`;
|
803
833
|
|
804
|
-
customElements.define(componentName$
|
834
|
+
customElements.define(componentName$a, EmailField);
|
805
835
|
|
806
|
-
const componentName$
|
836
|
+
const componentName$9 = getComponentName('password-field');
|
807
837
|
|
808
|
-
let overrides$
|
838
|
+
let overrides$3 = ``;
|
809
839
|
|
810
840
|
const PasswordField = compose(
|
811
841
|
createStyleMixin({
|
@@ -827,13 +857,13 @@ const PasswordField = compose(
|
|
827
857
|
createProxy({
|
828
858
|
slots: ['suffix'],
|
829
859
|
wrappedEleName: 'vaadin-password-field',
|
830
|
-
style: () => overrides$
|
860
|
+
style: () => overrides$3,
|
831
861
|
excludeAttrsSync: ['tabindex'],
|
832
|
-
componentName: componentName$
|
862
|
+
componentName: componentName$9
|
833
863
|
})
|
834
864
|
);
|
835
865
|
|
836
|
-
overrides$
|
866
|
+
overrides$3 = `
|
837
867
|
:host {
|
838
868
|
display: inline-block;
|
839
869
|
}
|
@@ -873,9 +903,9 @@ overrides$2 = `
|
|
873
903
|
}
|
874
904
|
`;
|
875
905
|
|
876
|
-
customElements.define(componentName$
|
906
|
+
customElements.define(componentName$9, PasswordField);
|
877
907
|
|
878
|
-
const componentName$
|
908
|
+
const componentName$8 = getComponentName('text-area');
|
879
909
|
|
880
910
|
const selectors = {
|
881
911
|
label: '::part(label)',
|
@@ -883,7 +913,7 @@ const selectors = {
|
|
883
913
|
required: '::part(required-indicator)::after'
|
884
914
|
};
|
885
915
|
|
886
|
-
let overrides$
|
916
|
+
let overrides$2 = ``;
|
887
917
|
|
888
918
|
const TextArea = compose(
|
889
919
|
createStyleMixin({
|
@@ -908,13 +938,13 @@ const TextArea = compose(
|
|
908
938
|
createProxy({
|
909
939
|
slots: [],
|
910
940
|
wrappedEleName: 'vaadin-text-area',
|
911
|
-
style: () => overrides$
|
941
|
+
style: () => overrides$2,
|
912
942
|
excludeAttrsSync: ['tabindex'],
|
913
|
-
componentName: componentName$
|
943
|
+
componentName: componentName$8
|
914
944
|
})
|
915
945
|
);
|
916
946
|
|
917
|
-
overrides$
|
947
|
+
overrides$2 = `
|
918
948
|
:host {
|
919
949
|
display: inline-block;
|
920
950
|
}
|
@@ -935,29 +965,29 @@ overrides$1 = `
|
|
935
965
|
}
|
936
966
|
`;
|
937
967
|
|
938
|
-
customElements.define(componentName$
|
968
|
+
customElements.define(componentName$8, TextArea);
|
939
969
|
|
940
|
-
const componentName$
|
970
|
+
const componentName$7 = getComponentName('date-picker');
|
941
971
|
|
942
972
|
const DatePicker = compose(
|
943
973
|
draggableMixin,
|
944
974
|
componentNameValidationMixin
|
945
975
|
)(
|
946
976
|
createProxy({
|
947
|
-
componentName: componentName$
|
977
|
+
componentName: componentName$7,
|
948
978
|
slots: ['prefix', 'suffix'],
|
949
979
|
wrappedEleName: 'vaadin-date-picker',
|
950
980
|
style: ``
|
951
981
|
})
|
952
982
|
);
|
953
983
|
|
954
|
-
customElements.define(componentName$
|
984
|
+
customElements.define(componentName$7, DatePicker);
|
955
985
|
|
956
|
-
const componentName$
|
986
|
+
const componentName$6 = getComponentName('container');
|
957
987
|
|
958
988
|
class RawContainer extends HTMLElement {
|
959
989
|
static get componentName() {
|
960
|
-
return componentName$
|
990
|
+
return componentName$6;
|
961
991
|
}
|
962
992
|
constructor() {
|
963
993
|
super();
|
@@ -987,7 +1017,7 @@ const Container = compose(
|
|
987
1017
|
{ property: 'padding-right' }
|
988
1018
|
],
|
989
1019
|
|
990
|
-
display: {},
|
1020
|
+
display: {}, // maybe this should be hardcoded to flex
|
991
1021
|
flexDirection: {},
|
992
1022
|
justifyContent: {},
|
993
1023
|
alignItems: {},
|
@@ -1007,13 +1037,13 @@ const Container = compose(
|
|
1007
1037
|
componentNameValidationMixin
|
1008
1038
|
)(RawContainer);
|
1009
1039
|
|
1010
|
-
customElements.define(componentName$
|
1040
|
+
customElements.define(componentName$6, Container);
|
1011
1041
|
|
1012
|
-
const componentName$
|
1042
|
+
const componentName$5 = getComponentName('text');
|
1013
1043
|
|
1014
1044
|
class RawText extends HTMLElement {
|
1015
1045
|
static get componentName() {
|
1016
|
-
return componentName$
|
1046
|
+
return componentName$5;
|
1017
1047
|
}
|
1018
1048
|
constructor() {
|
1019
1049
|
super();
|
@@ -1045,7 +1075,7 @@ const Text = compose(
|
|
1045
1075
|
componentNameValidationMixin
|
1046
1076
|
)(RawText);
|
1047
1077
|
|
1048
|
-
customElements.define(componentName$
|
1078
|
+
customElements.define(componentName$5, Text);
|
1049
1079
|
|
1050
1080
|
const getVarName = (path) => getCssVarName(DESCOPE_PREFIX, ...path);
|
1051
1081
|
|
@@ -1296,7 +1326,7 @@ const mode = {
|
|
1296
1326
|
surface: globalRefs$4.colors.surface
|
1297
1327
|
};
|
1298
1328
|
|
1299
|
-
const [helperTheme$1, helperRefs$1] = createHelperVars({ mode }, componentName$
|
1329
|
+
const [helperTheme$1, helperRefs$1] = createHelperVars({ mode }, componentName$e);
|
1300
1330
|
|
1301
1331
|
const button = {
|
1302
1332
|
...helperTheme$1,
|
@@ -1505,7 +1535,7 @@ const textArea = {
|
|
1505
1535
|
}
|
1506
1536
|
};
|
1507
1537
|
|
1508
|
-
const componentName$
|
1538
|
+
const componentName$4 = getComponentName('checkbox');
|
1509
1539
|
|
1510
1540
|
const Checkbox = compose(
|
1511
1541
|
createStyleMixin({
|
@@ -1527,7 +1557,7 @@ const Checkbox = compose(
|
|
1527
1557
|
}
|
1528
1558
|
`,
|
1529
1559
|
excludeAttrsSync: ['tabindex'],
|
1530
|
-
componentName: componentName$
|
1560
|
+
componentName: componentName$4
|
1531
1561
|
})
|
1532
1562
|
);
|
1533
1563
|
|
@@ -1537,9 +1567,9 @@ const checkbox = {
|
|
1537
1567
|
[vars$4.cursor]: 'pointer'
|
1538
1568
|
};
|
1539
1569
|
|
1540
|
-
const componentName$
|
1570
|
+
const componentName$3 = getComponentName('switch-toggle');
|
1541
1571
|
|
1542
|
-
let overrides = ``;
|
1572
|
+
let overrides$1 = ``;
|
1543
1573
|
|
1544
1574
|
const SwitchToggle = compose(
|
1545
1575
|
createStyleMixin({
|
@@ -1555,13 +1585,13 @@ const SwitchToggle = compose(
|
|
1555
1585
|
createProxy({
|
1556
1586
|
slots: [],
|
1557
1587
|
wrappedEleName: 'vaadin-checkbox',
|
1558
|
-
style: () => overrides,
|
1588
|
+
style: () => overrides$1,
|
1559
1589
|
excludeAttrsSync: ['tabindex'],
|
1560
|
-
componentName: componentName$
|
1590
|
+
componentName: componentName$3
|
1561
1591
|
})
|
1562
1592
|
);
|
1563
1593
|
|
1564
|
-
overrides = `
|
1594
|
+
overrides$1 = `
|
1565
1595
|
:host {
|
1566
1596
|
display: inline-block;
|
1567
1597
|
}
|
@@ -1718,14 +1748,14 @@ const container = {
|
|
1718
1748
|
}
|
1719
1749
|
};
|
1720
1750
|
|
1721
|
-
const componentName = getComponentName('logo');
|
1751
|
+
const componentName$2 = getComponentName('logo');
|
1722
1752
|
|
1723
1753
|
let style;
|
1724
1754
|
const getStyle = () => style;
|
1725
1755
|
|
1726
1756
|
class RawLogo extends HTMLElement {
|
1727
1757
|
static get componentName() {
|
1728
|
-
return componentName;
|
1758
|
+
return componentName$2;
|
1729
1759
|
}
|
1730
1760
|
constructor() {
|
1731
1761
|
super();
|
@@ -1846,6 +1876,139 @@ const text = {
|
|
1846
1876
|
}
|
1847
1877
|
};
|
1848
1878
|
|
1879
|
+
const componentName$1 = getComponentName('passcode-internal');
|
1880
|
+
|
1881
|
+
const componentName = getComponentName('passcode');
|
1882
|
+
|
1883
|
+
const customMixin = (superclass) =>
|
1884
|
+
class DraggableMixinClass extends superclass {
|
1885
|
+
constructor() {
|
1886
|
+
super();
|
1887
|
+
}
|
1888
|
+
|
1889
|
+
get digits() {
|
1890
|
+
return Number.parseInt(this.getAttribute('digits')) || 6
|
1891
|
+
}
|
1892
|
+
|
1893
|
+
connectedCallback() {
|
1894
|
+
super.connectedCallback?.();
|
1895
|
+
const template = document.createElement('template');
|
1896
|
+
|
1897
|
+
//forward required & pattern TODO use forwardAttrs
|
1898
|
+
template.innerHTML = `
|
1899
|
+
<${componentName$1}
|
1900
|
+
bordered="true"
|
1901
|
+
name="code"
|
1902
|
+
tabindex="0"
|
1903
|
+
slot="input"
|
1904
|
+
required="${this.shadowRoot.host.getAttribute('required')}"
|
1905
|
+
pattern="${this.shadowRoot.host.getAttribute('pattern')}"
|
1906
|
+
></${componentName$1}>
|
1907
|
+
`;
|
1908
|
+
|
1909
|
+
// 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
|
1910
|
+
const slotEle = Object.assign(document.createElement('slot'), { name: 'input', slot: 'input', part: 'input' });
|
1911
|
+
this.proxyElement.appendChild(slotEle);
|
1912
|
+
|
1913
|
+
// we want to control when the element is out of focus
|
1914
|
+
// so the validations will be triggered blur event is dispatched from descope-passcode internal (and not every time focusing a digit)
|
1915
|
+
this.proxyElement._setFocused = () => { };
|
1916
|
+
|
1917
|
+
this.shadowRoot.host.appendChild(template.content.cloneNode(true));
|
1918
|
+
this.inputElement = this.querySelector(componentName$1);
|
1919
|
+
|
1920
|
+
// we want to trigger validation only when dispatching a blur event from the descope-passcode-internal
|
1921
|
+
this.inputElement.addEventListener('blur', () => {
|
1922
|
+
this.proxyElement.validate();
|
1923
|
+
});
|
1924
|
+
}
|
1925
|
+
};
|
1926
|
+
|
1927
|
+
const { borderStyle, borderWidth, ...restTextFieldMappings } = textFieldMappings;
|
1928
|
+
|
1929
|
+
const Passcode = compose(
|
1930
|
+
createStyleMixin({
|
1931
|
+
mappings: {
|
1932
|
+
...restTextFieldMappings,
|
1933
|
+
},
|
1934
|
+
nestedMappings: {
|
1935
|
+
borderColor: {
|
1936
|
+
selector: ` ${TextField.componentName}`,
|
1937
|
+
property: TextField.cssVarList.borderColor
|
1938
|
+
}
|
1939
|
+
}
|
1940
|
+
}),
|
1941
|
+
draggableMixin,
|
1942
|
+
inputMixin,
|
1943
|
+
componentNameValidationMixin,
|
1944
|
+
customMixin
|
1945
|
+
)(
|
1946
|
+
createProxy({
|
1947
|
+
slots: [],
|
1948
|
+
wrappedEleName: 'vaadin-text-field',
|
1949
|
+
style: () => `
|
1950
|
+
:host {
|
1951
|
+
--vaadin-field-default-width: auto;
|
1952
|
+
}
|
1953
|
+
|
1954
|
+
::slotted([slot='input']) {
|
1955
|
+
-webkit-mask-image: none;
|
1956
|
+
display: flex;
|
1957
|
+
gap: 2px;
|
1958
|
+
align-items: center;
|
1959
|
+
padding: 0;
|
1960
|
+
}
|
1961
|
+
|
1962
|
+
vaadin-text-field::part(input-field) {
|
1963
|
+
background-color: transparent;
|
1964
|
+
padding: 0;
|
1965
|
+
}
|
1966
|
+
|
1967
|
+
${overrides}
|
1968
|
+
`,
|
1969
|
+
excludeAttrsSync: ['tabindex'],
|
1970
|
+
componentName
|
1971
|
+
})
|
1972
|
+
);
|
1973
|
+
|
1974
|
+
const overrides = `
|
1975
|
+
:host {
|
1976
|
+
display: inline-block;
|
1977
|
+
}
|
1978
|
+
|
1979
|
+
vaadin-text-field {
|
1980
|
+
margin: 0;
|
1981
|
+
padding: 0;
|
1982
|
+
}
|
1983
|
+
vaadin-text-field::part(input-field) {
|
1984
|
+
overflow: hidden;
|
1985
|
+
}
|
1986
|
+
vaadin-text-field[readonly] > input:placeholder-shown {
|
1987
|
+
opacity: 1;
|
1988
|
+
}
|
1989
|
+
|
1990
|
+
vaadin-text-field > label,
|
1991
|
+
vaadin-text-field::part(input-field) {
|
1992
|
+
cursor: pointer;
|
1993
|
+
color: var(${Passcode.cssVarList.color});
|
1994
|
+
}
|
1995
|
+
vaadin-text-field::part(input-field):focus {
|
1996
|
+
cursor: text;
|
1997
|
+
}
|
1998
|
+
vaadin-text-field[required]::part(required-indicator)::after {
|
1999
|
+
font-size: "12px";
|
2000
|
+
content: "*";
|
2001
|
+
color: var(${Passcode.cssVarList.color});
|
2002
|
+
}
|
2003
|
+
vaadin-text-field[readonly]::part(input-field)::after {
|
2004
|
+
border: 0 solid;
|
2005
|
+
}
|
2006
|
+
`;
|
2007
|
+
|
2008
|
+
const passcode = {
|
2009
|
+
...textField(Passcode.cssVarList),
|
2010
|
+
};
|
2011
|
+
|
1849
2012
|
var components = {
|
1850
2013
|
button,
|
1851
2014
|
textField: textField$1,
|
@@ -1857,7 +2020,8 @@ var components = {
|
|
1857
2020
|
switchToggle: swtichToggle,
|
1858
2021
|
container,
|
1859
2022
|
logo,
|
1860
|
-
text
|
2023
|
+
text,
|
2024
|
+
passcode
|
1861
2025
|
};
|
1862
2026
|
|
1863
2027
|
var index = { globals, components };
|