@descope/web-components-ui 1.0.111 → 1.0.112
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +4309 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +7 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/65.js +1 -0
- package/dist/umd/boolean-fields-descope-checkbox-index-js.js +1 -1
- package/dist/umd/boolean-fields-descope-switch-toggle-index-js.js +1 -1
- package/dist/umd/descope-button-index-js.js +1 -1
- package/dist/umd/descope-combo-box-index-js.js +1 -1
- package/dist/umd/descope-container-index-js.js +1 -1
- package/dist/umd/descope-date-picker-index-js.js +1 -1
- package/dist/umd/descope-divider-index-js.js +1 -1
- package/dist/umd/descope-email-field-index-js.js +1 -1
- package/dist/umd/descope-image-index-js.js +1 -1
- package/dist/umd/descope-link-index-js.js +1 -1
- package/dist/umd/descope-loader-linear-index-js.js +1 -1
- package/dist/umd/descope-loader-radial-index-js.js +1 -1
- package/dist/umd/descope-logo-index-js.js +1 -1
- package/dist/umd/descope-new-password-descope-new-password-internal-index-js.js +1 -1
- package/dist/umd/descope-new-password-index-js.js +1 -1
- package/dist/umd/descope-number-field-index-js.js +1 -1
- package/dist/umd/descope-passcode-index-js.js +1 -1
- package/dist/umd/descope-password-field-index-js.js +1 -1
- package/dist/umd/descope-phone-field-index-js.js +1 -1
- package/dist/umd/descope-text-area-index-js.js +1 -1
- package/dist/umd/descope-text-field-index-js.js +1 -1
- package/dist/umd/descope-text-index-js.js +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +1 -1
- package/src/components/boolean-fields/descope-checkbox/{Checkbox.js → CheckboxClass.js} +1 -3
- package/src/components/boolean-fields/descope-checkbox/index.js +1 -1
- package/src/components/boolean-fields/descope-switch-toggle/{SwitchToggle.js → SwitchToggleClass.js} +1 -2
- package/src/components/boolean-fields/descope-switch-toggle/index.js +1 -1
- package/src/components/descope-button/{Button.js → ButtonClass.js} +1 -3
- package/src/components/descope-button/index.js +1 -1
- package/src/components/descope-combo-box/{ComboBox.js → ComboBoxClass.js} +1 -2
- package/src/components/descope-combo-box/index.js +1 -1
- package/src/components/descope-container/{Container.js → ContainerClass.js} +1 -3
- package/src/components/descope-container/index.js +1 -1
- package/src/components/descope-date-picker/index.js +2 -3
- package/src/components/descope-divider/{Divider.js → DividerClass.js} +1 -2
- package/src/components/descope-divider/index.js +1 -1
- package/src/components/descope-email-field/{EmailField.js → EmailFieldClass.js} +1 -3
- package/src/components/descope-email-field/index.js +1 -1
- package/src/components/descope-image/{Image.js → ImageClass.js} +1 -3
- package/src/components/descope-image/index.js +1 -1
- package/src/components/descope-link/{Link.js → LinkClass.js} +3 -4
- package/src/components/descope-link/index.js +1 -1
- package/src/components/descope-loader-linear/{LoaderLinear.js → LoaderLinearClass.js} +1 -3
- package/src/components/descope-loader-linear/index.js +1 -1
- package/src/components/descope-loader-radial/{LoaderRadial.js → LoaderRadialClass.js} +1 -3
- package/src/components/descope-loader-radial/index.js +1 -1
- package/src/components/descope-logo/{Logo.js → LogoClass.js} +1 -3
- package/src/components/descope-logo/index.js +1 -1
- package/src/components/descope-new-password/{NewPassword.js → NewPasswordClass.js} +3 -4
- package/src/components/descope-new-password/descope-new-password-internal/NewPasswordInternal.js +1 -1
- package/src/components/descope-new-password/index.js +1 -1
- package/src/components/descope-number-field/{NumberField.js → NumberFieldClass.js} +1 -3
- package/src/components/descope-number-field/index.js +1 -1
- package/src/components/descope-passcode/{Passcode.js → PasscodeClass.js} +2 -2
- package/src/components/descope-passcode/index.js +1 -1
- package/src/components/descope-password-field/{PasswordField.js → PasswordFieldClass.js} +1 -3
- package/src/components/descope-password-field/index.js +1 -1
- package/src/components/descope-phone-field/{PhoneField.js → PhoneFieldClass.js} +3 -3
- package/src/components/descope-phone-field/index.js +1 -1
- package/src/components/descope-text/{Text.js → TextClass.js} +1 -3
- package/src/components/descope-text/index.js +2 -1
- package/src/components/descope-text-area/{TextArea.js → TextAreaClass.js} +1 -2
- package/src/components/descope-text-area/index.js +1 -1
- package/src/components/descope-text-field/{TextField.js → TextFieldClass.js} +2 -4
- package/src/components/descope-text-field/index.js +1 -1
- package/src/index.cjs.js +20 -0
- package/src/theme/components/button.js +1 -1
- package/src/theme/components/checkbox.js +1 -1
- package/src/theme/components/comboBox.js +1 -1
- package/src/theme/components/container.js +2 -2
- package/src/theme/components/divider.js +1 -1
- package/src/theme/components/emailField.js +1 -1
- package/src/theme/components/image.js +1 -1
- package/src/theme/components/link.js +1 -1
- package/src/theme/components/loader/loaderLinear.js +1 -1
- package/src/theme/components/loader/loaderRadial.js +1 -1
- package/src/theme/components/logo.js +1 -1
- package/src/theme/components/newPassword.js +1 -1
- package/src/theme/components/numberField.js +1 -1
- package/src/theme/components/passcode.js +1 -1
- package/src/theme/components/passwordField.js +1 -1
- package/src/theme/components/phoneField.js +1 -1
- package/src/theme/components/switchToggle.js +1 -1
- package/src/theme/components/text.js +1 -1
- package/src/theme/components/textArea.js +1 -1
- package/src/theme/components/textField.js +1 -1
- package/dist/umd/890.js +0 -1
package/dist/cjs/index.cjs.js
CHANGED
@@ -2,8 +2,10 @@
|
|
2
2
|
|
3
3
|
var merge = require('lodash.merge');
|
4
4
|
var set = require('lodash.set');
|
5
|
+
var Color = require('color');
|
5
6
|
|
6
7
|
const DESCOPE_PREFIX = 'descope';
|
8
|
+
const CSS_SELECTOR_SPECIFIER_MULTIPLY = 3;
|
7
9
|
const BASE_THEME_SECTION = 'host';
|
8
10
|
const PORTAL_THEME_PREFIX = '@';
|
9
11
|
|
@@ -15,6 +17,12 @@ const kebabCase = (str) =>
|
|
15
17
|
|
16
18
|
const kebabCaseJoin = (...args) => kebabCase(args.filter((arg) => !!arg).join('-'));
|
17
19
|
|
20
|
+
const compose = (...fns) =>
|
21
|
+
(val) =>
|
22
|
+
fns.reduceRight((res, fn) => fn(res), val);
|
23
|
+
|
24
|
+
const isFunction = (maybeFunc) => typeof maybeFunc === 'function';
|
25
|
+
|
18
26
|
const isUrl = (maybeUrl) => {
|
19
27
|
try {
|
20
28
|
new URL(maybeUrl);
|
@@ -25,11 +33,105 @@ const isUrl = (maybeUrl) => {
|
|
25
33
|
}
|
26
34
|
};
|
27
35
|
|
36
|
+
const observeAttributes = (
|
37
|
+
ele,
|
38
|
+
callback,
|
39
|
+
{ excludeAttrs = [], includeAttrs = [] }
|
40
|
+
) => {
|
41
|
+
// sync all attrs on init
|
42
|
+
const filteredAttrs = Array.from(ele.attributes)
|
43
|
+
.filter((attr) =>
|
44
|
+
!excludeAttrs.includes(attr.name) &&
|
45
|
+
(!includeAttrs.length || includeAttrs.includes(attr.name))
|
46
|
+
)
|
47
|
+
.map((attr) => attr.name);
|
48
|
+
|
49
|
+
callback(filteredAttrs);
|
50
|
+
|
51
|
+
const observer = new MutationObserver((mutationsList) => {
|
52
|
+
for (const mutation of mutationsList) {
|
53
|
+
if (
|
54
|
+
mutation.type === 'attributes' &&
|
55
|
+
!excludeAttrs.includes(mutation.attributeName) &&
|
56
|
+
(!includeAttrs.length || includeAttrs.includes(mutation.attributeName))
|
57
|
+
) {
|
58
|
+
callback([mutation.attributeName]);
|
59
|
+
}
|
60
|
+
}
|
61
|
+
});
|
62
|
+
|
63
|
+
observer.observe(ele, { attributes: true });
|
64
|
+
};
|
65
|
+
|
66
|
+
// calling the callback with this object: { addedNodes, removedNodes }
|
67
|
+
const observeChildren = (
|
68
|
+
ele,
|
69
|
+
callback,
|
70
|
+
) => {
|
71
|
+
callback({ addedNodes: Array.from(ele.children), removedNodes: [] });
|
72
|
+
|
73
|
+
const observer = new MutationObserver((mutationsList) => {
|
74
|
+
for (const mutation of mutationsList) {
|
75
|
+
if (mutation.type === 'childList') {
|
76
|
+
callback(mutation);
|
77
|
+
}
|
78
|
+
}
|
79
|
+
});
|
80
|
+
|
81
|
+
observer.observe(ele, { childList: true });
|
82
|
+
};
|
83
|
+
|
84
|
+
const createSyncAttrsCb =
|
85
|
+
(srcEle, targetEle, mapAttrs = {}) =>
|
86
|
+
(attrNames) => {
|
87
|
+
attrNames.forEach((attrName) => {
|
88
|
+
const targetAttrName = mapAttrs[attrName] || attrName;
|
89
|
+
const srcAttrVal = srcEle.getAttribute(attrName);
|
90
|
+
if (srcAttrVal !== null) {
|
91
|
+
if (targetEle.getAttribute(targetAttrName) !== srcAttrVal) {
|
92
|
+
targetEle.setAttribute(targetAttrName, srcAttrVal);
|
93
|
+
}
|
94
|
+
} else {
|
95
|
+
targetEle.removeAttribute(targetAttrName);
|
96
|
+
}
|
97
|
+
});
|
98
|
+
};
|
99
|
+
|
100
|
+
const syncAttrs = (ele1, ele2, options) => {
|
101
|
+
observeAttributes(ele1, createSyncAttrsCb(ele1, ele2), options);
|
102
|
+
observeAttributes(ele2, createSyncAttrsCb(ele2, ele1), options);
|
103
|
+
};
|
104
|
+
|
28
105
|
const getComponentName = (name) => kebabCaseJoin(DESCOPE_PREFIX, name);
|
29
106
|
|
30
107
|
const getCssVarName = (...args) =>
|
31
108
|
`--${kebabCaseJoin(...args)}`;
|
32
109
|
|
110
|
+
const forwardAttrs = (source, dest, options = {}) => {
|
111
|
+
observeAttributes(
|
112
|
+
source,
|
113
|
+
createSyncAttrsCb(source, dest, options.mapAttrs),
|
114
|
+
options
|
115
|
+
);
|
116
|
+
};
|
117
|
+
|
118
|
+
const forwardProps = (src, target, props = []) => {
|
119
|
+
if (!props.length) return;
|
120
|
+
|
121
|
+
const config = props.reduce((acc, prop) => Object.assign(acc, {
|
122
|
+
[prop]: {
|
123
|
+
get() {
|
124
|
+
return src[prop]
|
125
|
+
},
|
126
|
+
set(v) {
|
127
|
+
src[prop] = v;
|
128
|
+
}
|
129
|
+
}
|
130
|
+
}), {});
|
131
|
+
|
132
|
+
Object.defineProperties(target, config);
|
133
|
+
};
|
134
|
+
|
33
135
|
class ComponentsThemeManager {
|
34
136
|
static mountOnPropName = 'DescopeThemeManager';
|
35
137
|
|
@@ -222,9 +324,4216 @@ const createHelperVars = (theme, prefix) => {
|
|
222
324
|
return [res.theme, res.useVars, res.vars];
|
223
325
|
};
|
224
326
|
|
327
|
+
const genDark = (c, percentage = 0.5) => c.darken(percentage).hex();
|
328
|
+
const genLight = (c, percentage = 0.5) => c.lighten(percentage).hex();
|
329
|
+
const genContrast = (c, percentage = 0.9) => {
|
330
|
+
const isDark = c.isDark();
|
331
|
+
return c
|
332
|
+
.mix(Color(isDark ? 'white' : 'black'), percentage)
|
333
|
+
.saturate(1)
|
334
|
+
.hex();
|
335
|
+
};
|
336
|
+
|
337
|
+
const genColor = (color) => {
|
338
|
+
const mainColor = new Color(color.main || color);
|
339
|
+
|
340
|
+
return {
|
341
|
+
main: mainColor.hex(),
|
342
|
+
dark: color.dark || genDark(mainColor),
|
343
|
+
light: color.light || genLight(mainColor),
|
344
|
+
contrast: color.contrast || genContrast(mainColor)
|
345
|
+
};
|
346
|
+
};
|
347
|
+
|
348
|
+
const genColors = (colors) => {
|
349
|
+
return Object.keys(colors).reduce((acc, colorName) => {
|
350
|
+
const currentColor = colors[colorName];
|
351
|
+
|
352
|
+
return Object.assign(acc, {
|
353
|
+
[colorName]: genColor(currentColor)
|
354
|
+
});
|
355
|
+
}, {});
|
356
|
+
};
|
357
|
+
|
358
|
+
const createCssVarFallback = (first, ...rest) =>
|
359
|
+
`var(${first}${rest.length ? ` , ${createCssVarFallback(...rest)}` : ''})`;
|
360
|
+
|
361
|
+
const createCssSelector = (
|
362
|
+
baseSelector = '',
|
363
|
+
relativeSelectorOrSelectorFn = ''
|
364
|
+
) =>
|
365
|
+
isFunction(relativeSelectorOrSelectorFn)
|
366
|
+
? relativeSelectorOrSelectorFn(baseSelector)
|
367
|
+
: `${baseSelector}${/^[A-Za-z]/.test(relativeSelectorOrSelectorFn)
|
368
|
+
? ` ${relativeSelectorOrSelectorFn}`
|
369
|
+
: relativeSelectorOrSelectorFn
|
370
|
+
}`;
|
371
|
+
|
372
|
+
class StyleBuilder {
|
373
|
+
constructor() {
|
374
|
+
this.styleMap = new Map();
|
375
|
+
}
|
376
|
+
|
377
|
+
add(selector, property, value) {
|
378
|
+
if (!this.styleMap.has(selector)) {
|
379
|
+
this.styleMap.set(selector, []);
|
380
|
+
}
|
381
|
+
|
382
|
+
this.styleMap.set(selector, [
|
383
|
+
...this.styleMap.get(selector),
|
384
|
+
{ property, value }
|
385
|
+
]);
|
386
|
+
}
|
387
|
+
|
388
|
+
toString() {
|
389
|
+
return Array.from(this.styleMap.entries()).reduce(
|
390
|
+
(style, [selector, propValArr]) =>
|
391
|
+
(style += `${selector} { \n${propValArr
|
392
|
+
.map(({ property, value }) => `${property}: ${value}`)
|
393
|
+
.join(';\n')} \n}\n\n`),
|
394
|
+
''
|
395
|
+
);
|
396
|
+
}
|
397
|
+
}
|
398
|
+
|
399
|
+
const normalizeConfig = (attr, config) => {
|
400
|
+
const defaultMapping = { selector: '', property: kebabCase(attr) };
|
401
|
+
|
402
|
+
if (!config || !Object.keys(config).length) return [defaultMapping];
|
403
|
+
|
404
|
+
if (Array.isArray(config))
|
405
|
+
return config.map((entry) => Object.assign({}, defaultMapping, entry));
|
406
|
+
|
407
|
+
return [Object.assign({}, defaultMapping, config)];
|
408
|
+
};
|
409
|
+
|
410
|
+
const createStyle = (componentName, baseSelector, mappings) => {
|
411
|
+
const style = new StyleBuilder();
|
412
|
+
|
413
|
+
Object.keys(mappings).forEach((attr) => {
|
414
|
+
const attrConfig = normalizeConfig(attr, mappings[attr]);
|
415
|
+
|
416
|
+
const cssVarName = getCssVarName(componentName, attr);
|
417
|
+
|
418
|
+
attrConfig.forEach(
|
419
|
+
({ selector: relativeSelectorOrSelectorFn, property }) => {
|
420
|
+
style.add(
|
421
|
+
createCssSelector(baseSelector, relativeSelectorOrSelectorFn),
|
422
|
+
isFunction(property) ? property() : property,
|
423
|
+
createCssVarFallback(cssVarName)
|
424
|
+
);
|
425
|
+
}
|
426
|
+
);
|
427
|
+
});
|
428
|
+
|
429
|
+
return style.toString();
|
430
|
+
};
|
431
|
+
|
432
|
+
const createCssVarsList = (componentName, mappings) =>
|
433
|
+
Object.keys(mappings).reduce(
|
434
|
+
(acc, attr) =>
|
435
|
+
Object.assign(acc, { [attr]: getCssVarName(componentName, attr) }),
|
436
|
+
{}
|
437
|
+
);
|
438
|
+
|
439
|
+
// on some cases we need a selector to be more specific than another
|
440
|
+
// for this we have this fn that generate a class selector multiple times
|
441
|
+
const createClassSelectorSpecifier = (className, numOfRepeats) => Array(numOfRepeats)
|
442
|
+
.fill(`.${className}`)
|
443
|
+
.join('');
|
444
|
+
|
445
|
+
const STYLE_OVERRIDE_ATTR_PREFIX = 'st';
|
446
|
+
|
447
|
+
|
448
|
+
const createStyleMixin =
|
449
|
+
({ mappings = {} }) => (superclass) =>
|
450
|
+
class CustomStyleMixinClass extends superclass {
|
451
|
+
static get cssVarList() {
|
452
|
+
return {
|
453
|
+
...superclass.cssVarList,
|
454
|
+
...createCssVarsList(superclass.componentName, {
|
455
|
+
...mappings,
|
456
|
+
})
|
457
|
+
};
|
458
|
+
}
|
459
|
+
|
460
|
+
#overrideStyleEle;
|
461
|
+
#themeStyleEle;
|
462
|
+
#disconnectThemeManager
|
463
|
+
#componentNameSuffix
|
464
|
+
#themeSection
|
465
|
+
#rootElement
|
466
|
+
#baseSelector
|
467
|
+
#styleAttributes
|
468
|
+
|
469
|
+
// we are using this mixin also for portalMixin
|
470
|
+
// so we should be able to inject styles to other DOM elements
|
471
|
+
// this is why we need to support these overrides
|
472
|
+
constructor({
|
473
|
+
getRootElement,
|
474
|
+
componentNameSuffix = '',
|
475
|
+
themeSection = BASE_THEME_SECTION,
|
476
|
+
baseSelector
|
477
|
+
} = {}) {
|
478
|
+
super();
|
479
|
+
this.#componentNameSuffix = componentNameSuffix;
|
480
|
+
this.#themeSection = themeSection;
|
481
|
+
this.#rootElement = getRootElement?.(this) || this.shadowRoot;
|
482
|
+
this.#baseSelector = baseSelector ?? this.baseSelector;
|
483
|
+
|
484
|
+
this.#styleAttributes = Object.keys(mappings).map((key) =>
|
485
|
+
kebabCaseJoin(STYLE_OVERRIDE_ATTR_PREFIX, componentNameSuffix, key)
|
486
|
+
);
|
487
|
+
|
488
|
+
this.#createMappingStyle();
|
489
|
+
this.#createComponentTheme();
|
490
|
+
this.#createOverridesStyle();
|
491
|
+
}
|
492
|
+
|
493
|
+
get componentTheme() {
|
494
|
+
return componentsThemeManager.currentTheme?.[superclass.componentName] || ''
|
495
|
+
}
|
496
|
+
|
497
|
+
#onComponentThemeChange() {
|
498
|
+
this.#themeStyleEle.innerHTML = this.componentTheme[this.#themeSection];
|
499
|
+
}
|
500
|
+
|
501
|
+
#createComponentTheme() {
|
502
|
+
this.#themeStyleEle = document.createElement('style');
|
503
|
+
this.#themeStyleEle.id = 'style-mixin-theme';
|
504
|
+
this.#rootElement.prepend(this.#themeStyleEle);
|
505
|
+
this.#disconnectThemeManager = componentsThemeManager.onCurrentThemeChange(this.#onComponentThemeChange.bind(this));
|
506
|
+
this.#onComponentThemeChange();
|
507
|
+
}
|
508
|
+
|
509
|
+
#createOverridesStyle() {
|
510
|
+
this.#overrideStyleEle = document.createElement('style');
|
511
|
+
this.#overrideStyleEle.id = 'style-mixin-overrides';
|
512
|
+
|
513
|
+
const classSpecifier = createClassSelectorSpecifier(superclass.componentName, CSS_SELECTOR_SPECIFIER_MULTIPLY);
|
514
|
+
|
515
|
+
this.#overrideStyleEle.innerText = `:host(${classSpecifier}) {}`;
|
516
|
+
this.#rootElement.append(this.#overrideStyleEle);
|
517
|
+
}
|
518
|
+
|
519
|
+
#setAttrOverride(attrName, value) {
|
520
|
+
const style = this.#overrideStyleEle?.sheet?.cssRules[0].style;
|
521
|
+
if (!style) return;
|
522
|
+
|
523
|
+
const varName = getCssVarName(
|
524
|
+
superclass.componentName,
|
525
|
+
attrName.replace(new RegExp(`^${STYLE_OVERRIDE_ATTR_PREFIX}-`), '')
|
526
|
+
);
|
527
|
+
|
528
|
+
if (value) style?.setProperty(varName, value);
|
529
|
+
else {
|
530
|
+
style?.removeProperty(varName);
|
531
|
+
this.removeAttribute(attrName);
|
532
|
+
}
|
533
|
+
}
|
534
|
+
|
535
|
+
#updateOverridesStyle(attrs = []) {
|
536
|
+
for (const attr of attrs) {
|
537
|
+
if (this.#styleAttributes.includes(attr)) {
|
538
|
+
this.#setAttrOverride(attr, this.getAttribute(attr));
|
539
|
+
}
|
540
|
+
}
|
541
|
+
|
542
|
+
// we are rewriting the style back to the style tag
|
543
|
+
this.#overrideStyleEle.innerHTML = this.#overrideStyleEle?.sheet?.cssRules[0].cssText;
|
544
|
+
}
|
545
|
+
|
546
|
+
#createMappingStyle() {
|
547
|
+
const themeStyle = document.createElement('style');
|
548
|
+
themeStyle.id = 'style-mixin-mappings';
|
549
|
+
themeStyle.innerHTML = createStyle(
|
550
|
+
kebabCaseJoin(superclass.componentName, this.#componentNameSuffix),
|
551
|
+
this.#baseSelector,
|
552
|
+
mappings
|
553
|
+
);
|
554
|
+
this.#rootElement.prepend(themeStyle);
|
555
|
+
}
|
556
|
+
|
557
|
+
#addClassName(className) {
|
558
|
+
(this.#rootElement.classList || this.#rootElement.host.classList).add(className);
|
559
|
+
}
|
560
|
+
|
561
|
+
init() {
|
562
|
+
super.init?.();
|
563
|
+
if (this.shadowRoot.isConnected) {
|
564
|
+
this.#addClassName(superclass.componentName);
|
565
|
+
|
566
|
+
// this is instead attributeChangedCallback because we cannot use static methods in this case
|
567
|
+
observeAttributes(this, this.#updateOverridesStyle.bind(this), {});
|
568
|
+
}
|
569
|
+
}
|
570
|
+
|
571
|
+
disconnectedCallback() {
|
572
|
+
super.disconnectedCallback?.();
|
573
|
+
|
574
|
+
this.#disconnectThemeManager?.();
|
575
|
+
}
|
576
|
+
};
|
577
|
+
|
578
|
+
const draggableMixin = (superclass) =>
|
579
|
+
class DraggableMixinClass extends superclass {
|
580
|
+
#styleEle = null;
|
581
|
+
|
582
|
+
static get observedAttributes() {
|
583
|
+
const superAttrs = superclass.observedAttributes || [];
|
584
|
+
return [...superAttrs, 'draggable'];
|
585
|
+
}
|
586
|
+
|
587
|
+
constructor() {
|
588
|
+
super();
|
589
|
+
|
590
|
+
this.#styleEle = document.createElement('style');
|
591
|
+
this.#styleEle.innerText = `* { cursor: inherit!important }`;
|
592
|
+
}
|
593
|
+
|
594
|
+
#handleDraggableStyle(isDraggable) {
|
595
|
+
if (isDraggable) {
|
596
|
+
this.shadowRoot.appendChild(this.#styleEle);
|
597
|
+
} else {
|
598
|
+
this.#styleEle.remove();
|
599
|
+
}
|
600
|
+
}
|
601
|
+
|
602
|
+
get isDraggable() {
|
603
|
+
return this.hasAttribute('draggable') && this.getAttribute('draggable') !== 'false'
|
604
|
+
}
|
605
|
+
|
606
|
+
init() {
|
607
|
+
// because we are delegating the focus from the outer component,
|
608
|
+
// the D&D is not working well in the page editor
|
609
|
+
// in order to solve it we are making the inner component focusable on mouse down
|
610
|
+
// and removing it on complete
|
611
|
+
this.addEventListener('mousedown', (e) => {
|
612
|
+
if (this.isDraggable) {
|
613
|
+
const prevTabIndex = this.baseElement.getAttribute('tabindex');
|
614
|
+
this.baseElement.setAttribute('tabindex', '-1');
|
615
|
+
|
616
|
+
const onComplete = () => {
|
617
|
+
prevTabIndex ?
|
618
|
+
this.baseElement.setAttribute('tabindex', prevTabIndex) :
|
619
|
+
this.baseElement.removeAttribute('tabindex');
|
620
|
+
|
621
|
+
e.target.removeEventListener('mouseup', onComplete);
|
622
|
+
e.target.removeEventListener('dragend', onComplete);
|
623
|
+
};
|
624
|
+
|
625
|
+
e.target.addEventListener('mouseup', onComplete, { once: true });
|
626
|
+
e.target.addEventListener('dragend', onComplete, { once: true });
|
627
|
+
}
|
628
|
+
});
|
629
|
+
|
630
|
+
super.init?.();
|
631
|
+
}
|
632
|
+
|
633
|
+
attributeChangedCallback(attrName, oldValue, newValue) {
|
634
|
+
super.attributeChangedCallback?.(attrName, oldValue, newValue);
|
635
|
+
if (attrName === 'draggable') {
|
636
|
+
this.#handleDraggableStyle(newValue === 'true');
|
637
|
+
}
|
638
|
+
}
|
639
|
+
};
|
640
|
+
|
641
|
+
const componentNameValidationMixin = (superclass) =>
|
642
|
+
class ComponentNameValidationMixinClass extends superclass {
|
643
|
+
#checkComponentName() {
|
644
|
+
const currentComponentName = this.localName;
|
645
|
+
|
646
|
+
if (!superclass.componentName) {
|
647
|
+
throw Error(
|
648
|
+
`component name is not defined on super class, make sure you have a static get for "componentName"`
|
649
|
+
);
|
650
|
+
}
|
651
|
+
|
652
|
+
if (currentComponentName !== superclass.componentName) {
|
653
|
+
throw Error(
|
654
|
+
`component name mismatch, expected "${superclass.componentName}", current "${currentComponentName}"`
|
655
|
+
);
|
656
|
+
}
|
657
|
+
}
|
658
|
+
|
659
|
+
init() {
|
660
|
+
super.init?.();
|
661
|
+
this.#checkComponentName();
|
662
|
+
}
|
663
|
+
};
|
664
|
+
|
665
|
+
const hoverableMixin = (superclass) =>
|
666
|
+
class HoverableMixinClass extends superclass {
|
667
|
+
init() {
|
668
|
+
super.init?.();
|
669
|
+
|
670
|
+
this.baseElement.addEventListener('mouseover', (e) => {
|
671
|
+
this.setAttribute('hover', 'true');
|
672
|
+
e.target.addEventListener(
|
673
|
+
'mouseleave',
|
674
|
+
() => this.removeAttribute('hover'),
|
675
|
+
{ once: true }
|
676
|
+
);
|
677
|
+
});
|
678
|
+
}
|
679
|
+
};
|
680
|
+
|
681
|
+
const booleanAttributesList = [
|
682
|
+
'readonly',
|
683
|
+
'focused',
|
684
|
+
'invalid',
|
685
|
+
'has-label',
|
686
|
+
'required',
|
687
|
+
'disabled',
|
688
|
+
'checked',
|
689
|
+
'has-helper',
|
690
|
+
'has-value',
|
691
|
+
'step-buttons-visible',
|
692
|
+
'hover',
|
693
|
+
'has-error-message',
|
694
|
+
'focus-ring',
|
695
|
+
'opened',
|
696
|
+
'active'
|
697
|
+
];
|
698
|
+
|
699
|
+
const isBooleanAttribute = (attr) => {
|
700
|
+
return booleanAttributesList.includes(attr)
|
701
|
+
};
|
702
|
+
// we want all the valueless attributes to have "true" value
|
703
|
+
// and all the falsy attribute to be removed
|
704
|
+
const normalizeBooleanAttributesMixin = (superclass) => class NormalizeBooleanAttributesMixinClass extends superclass {
|
705
|
+
init() {
|
706
|
+
super.init?.();
|
707
|
+
|
708
|
+
observeAttributes(this, (attrs) =>
|
709
|
+
attrs.forEach(attr => {
|
710
|
+
const attrVal = this.getAttribute(attr);
|
711
|
+
|
712
|
+
if (isBooleanAttribute(attr)) {
|
713
|
+
if (attrVal === '') {
|
714
|
+
this.setAttribute(attr, 'true');
|
715
|
+
} else if (attrVal === 'false') {
|
716
|
+
this.removeAttribute(attr);
|
717
|
+
}
|
718
|
+
} else if (!attrVal) {
|
719
|
+
console.warn(`attribute "${attr}" has no value, should it be added to the boolean attributes list?`);
|
720
|
+
}
|
721
|
+
}), {});
|
722
|
+
}
|
723
|
+
};
|
724
|
+
|
725
|
+
const createBaseClass = ({ componentName, baseSelector = '' }) => {
|
726
|
+
class DescopeBaseClass extends HTMLElement {
|
727
|
+
static get componentName() {
|
728
|
+
return componentName;
|
729
|
+
}
|
730
|
+
|
731
|
+
#baseElement;
|
732
|
+
|
733
|
+
#isInit = true;
|
734
|
+
|
735
|
+
// base selector is the selector for the component wrapper,
|
736
|
+
// it's the highest element that is relevant for the layout
|
737
|
+
get baseSelector() {
|
738
|
+
return baseSelector
|
739
|
+
}
|
740
|
+
|
741
|
+
// this is the base element, which returned by querying the base selector
|
742
|
+
get baseElement() {
|
743
|
+
this.#baseElement ??= this.baseSelector ?
|
744
|
+
this.rootElement.querySelector(this.baseSelector) :
|
745
|
+
this;
|
746
|
+
|
747
|
+
if(!this.#baseElement) {
|
748
|
+
console.warn('missing base element for component', this.localName);
|
749
|
+
}
|
750
|
+
return this.#baseElement
|
751
|
+
}
|
752
|
+
|
753
|
+
// this is the component root level element,
|
754
|
+
// it can be either a shadow root or the component's node from the light DOM
|
755
|
+
get rootElement() {
|
756
|
+
return this.shadowRoot || this
|
757
|
+
}
|
758
|
+
|
759
|
+
connectedCallback() {
|
760
|
+
super.connectedCallback?.();
|
761
|
+
|
762
|
+
if (this.rootElement.isConnected) {
|
763
|
+
// the init function is running once, on the first time the component is connected
|
764
|
+
if (this.#isInit) {
|
765
|
+
this.#isInit = false;
|
766
|
+
this.init?.();
|
767
|
+
}
|
768
|
+
}
|
769
|
+
}
|
770
|
+
}
|
771
|
+
|
772
|
+
return compose(
|
773
|
+
componentNameValidationMixin,
|
774
|
+
hoverableMixin,
|
775
|
+
normalizeBooleanAttributesMixin
|
776
|
+
)(DescopeBaseClass)
|
777
|
+
};
|
778
|
+
|
779
|
+
// create a dispatch event function that also calls to the onevent function in case it's set
|
780
|
+
// usage example:
|
781
|
+
// #dispatchSomething = createDispatchEvent.bind(this, 'something' { ...options })
|
782
|
+
// this will dispatch a new event when called, but also call to "onsomething"
|
783
|
+
function createDispatchEvent(eventName, options = {}) {
|
784
|
+
const event = new Event(eventName, options);
|
785
|
+
|
786
|
+
this[`on${eventName}`]?.(event); // in case we got an event callback as property
|
787
|
+
this.dispatchEvent(event);
|
788
|
+
}
|
789
|
+
|
790
|
+
const createProxy = ({
|
791
|
+
componentName,
|
792
|
+
wrappedEleName,
|
793
|
+
slots = [],
|
794
|
+
style,
|
795
|
+
excludeAttrsSync = [],
|
796
|
+
includeAttrsSync = [],
|
797
|
+
includeForwardProps = []
|
798
|
+
}) => {
|
799
|
+
class ProxyClass extends createBaseClass({ componentName, baseSelector: wrappedEleName }) {
|
800
|
+
#dispatchBlur = createDispatchEvent.bind(this, 'blur')
|
801
|
+
#dispatchFocus = createDispatchEvent.bind(this, 'focus')
|
802
|
+
|
803
|
+
constructor() {
|
804
|
+
super().attachShadow({ mode: 'open', delegatesFocus: true }).innerHTML = `
|
805
|
+
<style id="create-proxy">${isFunction(style) ? style() : style
|
806
|
+
}</style>
|
807
|
+
<${wrappedEleName}>
|
808
|
+
<slot></slot>
|
809
|
+
${slots.map((slot) => `<slot name="${slot}" slot="${slot}"></slot>`).join('')}
|
810
|
+
</${wrappedEleName}>
|
811
|
+
`;
|
812
|
+
}
|
813
|
+
|
814
|
+
init() {
|
815
|
+
super.init?.();
|
816
|
+
|
817
|
+
this.baseElement.addEventListener('blur', (e) => {
|
818
|
+
this.#dispatchBlur();
|
819
|
+
});
|
820
|
+
|
821
|
+
this.baseElement.addEventListener('focus', (e) => {
|
822
|
+
this.#dispatchFocus();
|
823
|
+
});
|
824
|
+
|
825
|
+
// this is needed for components that uses props, such as combo box
|
826
|
+
forwardProps(this.baseElement, this, includeForwardProps);
|
827
|
+
|
828
|
+
syncAttrs(this.baseElement, this, {
|
829
|
+
excludeAttrs: excludeAttrsSync,
|
830
|
+
includeAttrs: includeAttrsSync
|
831
|
+
});
|
832
|
+
}
|
833
|
+
}
|
834
|
+
|
835
|
+
return ProxyClass;
|
836
|
+
};
|
837
|
+
|
838
|
+
const observedAttributes$2 = [
|
839
|
+
'required',
|
840
|
+
'pattern',
|
841
|
+
];
|
842
|
+
|
843
|
+
const errorAttributes = {
|
844
|
+
valueMissing: 'data-errormessage-value-missing',
|
845
|
+
patternMismatch: 'data-errormessage-pattern-mismatch',
|
846
|
+
tooShort: 'data-errormessage-pattern-mismatch-too-short',
|
847
|
+
tooLong: 'data-errormessage-pattern-mismatch-too-long',
|
848
|
+
};
|
849
|
+
const inputValidationMixin = (superclass) => class InputValidationMixinClass extends superclass {
|
850
|
+
static get observedAttributes() {
|
851
|
+
return [
|
852
|
+
...superclass.observedAttributes || [],
|
853
|
+
...observedAttributes$2
|
854
|
+
];
|
855
|
+
}
|
856
|
+
|
857
|
+
static get formAssociated() {
|
858
|
+
return true;
|
859
|
+
}
|
860
|
+
|
861
|
+
#internals
|
862
|
+
|
863
|
+
constructor() {
|
864
|
+
super();
|
865
|
+
|
866
|
+
this.#internals = this.attachInternals();
|
867
|
+
}
|
868
|
+
|
869
|
+
get defaultErrorMsgValueMissing() {
|
870
|
+
return 'Please fill out this field.'
|
871
|
+
}
|
872
|
+
|
873
|
+
get defaultErrorMsgPatternMismatch() {
|
874
|
+
return 'Please match the requested format.'
|
875
|
+
}
|
876
|
+
|
877
|
+
get defaultErrorMsgTooShort() {
|
878
|
+
return `Minimum length is ${this.getAttribute('minlength')}.`
|
879
|
+
}
|
880
|
+
|
881
|
+
get defaultErrorMsgTooLong() {
|
882
|
+
return `Maximum length is ${this.getAttribute('maxlength')}. `
|
883
|
+
}
|
884
|
+
|
885
|
+
getErrorMessage(flags) {
|
886
|
+
const {
|
887
|
+
valueMissing,
|
888
|
+
patternMismatch,
|
889
|
+
typeMismatch,
|
890
|
+
stepMismatch,
|
891
|
+
tooShort,
|
892
|
+
tooLong,
|
893
|
+
customError
|
894
|
+
} = flags;
|
895
|
+
switch (true) {
|
896
|
+
case valueMissing:
|
897
|
+
return this.getAttribute(errorAttributes.valueMissing) ||
|
898
|
+
this.defaultErrorMsgValueMissing
|
899
|
+
case patternMismatch || typeMismatch || stepMismatch:
|
900
|
+
return this.getAttribute(errorAttributes.patternMismatch) ||
|
901
|
+
this.defaultErrorMsgPatternMismatch
|
902
|
+
case tooShort:
|
903
|
+
return this.getAttribute(errorAttributes.tooShort) ||
|
904
|
+
this.defaultErrorMsgTooShort
|
905
|
+
case tooLong:
|
906
|
+
return this.getAttribute(errorAttributes.tooLong) ||
|
907
|
+
this.defaultErrorMsgTooLong
|
908
|
+
case customError:
|
909
|
+
return this.validationMessage
|
910
|
+
default:
|
911
|
+
return ''
|
912
|
+
}
|
913
|
+
}
|
914
|
+
|
915
|
+
#setValidity() {
|
916
|
+
const validity = this.isReadOnly ? {} : this.getValidity();
|
917
|
+
this.#internals.setValidity(validity, this.getErrorMessage(validity), this.validationTarget);
|
918
|
+
}
|
919
|
+
|
920
|
+
get validationMessage() {
|
921
|
+
return this.#internals.validationMessage;
|
922
|
+
}
|
923
|
+
|
924
|
+
getValidity() {
|
925
|
+
console.warn('getValidity', 'is not implemented');
|
926
|
+
}
|
927
|
+
|
928
|
+
checkValidity() {
|
929
|
+
return this.#internals.validity.valid
|
930
|
+
}
|
931
|
+
|
932
|
+
reportValidity() {
|
933
|
+
return this.#internals.reportValidity()
|
934
|
+
}
|
935
|
+
|
936
|
+
get validity() {
|
937
|
+
return this.#internals.validity
|
938
|
+
}
|
939
|
+
|
940
|
+
get validationTarget() {
|
941
|
+
return this.inputElement
|
942
|
+
}
|
943
|
+
|
944
|
+
setCustomValidity(errorMessage) {
|
945
|
+
if (errorMessage) {
|
946
|
+
this.#internals.setValidity({ customError: true }, errorMessage, this.validationTarget);
|
947
|
+
} else {
|
948
|
+
this.#internals.setValidity({});
|
949
|
+
this.#setValidity();
|
950
|
+
}
|
951
|
+
}
|
952
|
+
|
953
|
+
get isRequired() {
|
954
|
+
return this.hasAttribute('required') && this.getAttribute('required') !== 'false'
|
955
|
+
}
|
956
|
+
|
957
|
+
get isReadOnly() {
|
958
|
+
return this.hasAttribute('readonly') && this.getAttribute('readonly') !== 'false'
|
959
|
+
}
|
960
|
+
|
961
|
+
get pattern() {
|
962
|
+
return this.getAttribute('pattern')
|
963
|
+
}
|
964
|
+
|
965
|
+
get form() {
|
966
|
+
return this.#internals.form
|
967
|
+
}
|
968
|
+
|
969
|
+
attributeChangedCallback(attrName, oldValue, newValue) {
|
970
|
+
super.attributeChangedCallback?.(attrName, oldValue, newValue);
|
971
|
+
|
972
|
+
if (observedAttributes$2.includes(attrName)) {
|
973
|
+
this.#setValidity();
|
974
|
+
}
|
975
|
+
}
|
976
|
+
|
977
|
+
init() {
|
978
|
+
super.init?.();
|
979
|
+
this.addEventListener('change', this.#setValidity);
|
980
|
+
this.addEventListener('invalid', (e) => e.stopPropagation());
|
981
|
+
this.addEventListener('input', this.#setValidity);
|
982
|
+
|
983
|
+
// The attribute sync takes time, so getValidity returns valid,
|
984
|
+
// even when it shouldn't. This way allows all attributes to sync
|
985
|
+
// after render, before checking the validity.
|
986
|
+
setTimeout(() => this.#setValidity());
|
987
|
+
}
|
988
|
+
};
|
989
|
+
|
990
|
+
const errorAttrs = ['invalid', 'required'];
|
991
|
+
|
992
|
+
const propertyObserver = (src, target, property) => {
|
993
|
+
Object.defineProperty(src, property, {
|
994
|
+
set: function (v) {
|
995
|
+
return (target[property] = v);
|
996
|
+
},
|
997
|
+
get: function () {
|
998
|
+
return target[property];
|
999
|
+
},
|
1000
|
+
configurable: true
|
1001
|
+
});
|
1002
|
+
};
|
1003
|
+
|
1004
|
+
// recursively take the first slot child until it finds an element which is not a slot
|
1005
|
+
// stops after "nestingLevel" times
|
1006
|
+
const getNestedInput = (ele) => {
|
1007
|
+
if (!ele) return;
|
1008
|
+
|
1009
|
+
const nestingLevel = 10;
|
1010
|
+
|
1011
|
+
let nonSlotEle = ele;
|
1012
|
+
for (let i = 0; i < nestingLevel; i++) {
|
1013
|
+
nonSlotEle = nonSlotEle.assignedElements()[0];
|
1014
|
+
if (nonSlotEle.localName !== 'slot') return nonSlotEle
|
1015
|
+
}
|
1016
|
+
};
|
1017
|
+
|
1018
|
+
const proxyInputMixin = (superclass) =>
|
1019
|
+
class ProxyInputMixinClass extends inputValidationMixin(superclass) {
|
1020
|
+
static get observedAttributes() {
|
1021
|
+
return [...superclass.observedAttributes || [], ...errorAttrs];
|
1022
|
+
}
|
1023
|
+
|
1024
|
+
#inputElement
|
1025
|
+
|
1026
|
+
#dispatchChange = createDispatchEvent.bind(this, 'change')
|
1027
|
+
|
1028
|
+
constructor() {
|
1029
|
+
super();
|
1030
|
+
|
1031
|
+
this.#inputElement = super.inputElement;
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
// the web-component does not loaded immediately, so we want to defer the warning
|
1035
|
+
// and show it only if the input element was not found after the component is loaded
|
1036
|
+
warnIfInputElementIsMissing() {
|
1037
|
+
clearTimeout(this.inputElementTimerId);
|
1038
|
+
|
1039
|
+
this.inputElementTimerId = setTimeout(() => {
|
1040
|
+
!this.#inputElement && console.warn(this.localName, 'no input was found');
|
1041
|
+
}, 0);
|
1042
|
+
}
|
1043
|
+
|
1044
|
+
get inputElement() {
|
1045
|
+
this.warnIfInputElementIsMissing();
|
1046
|
+
|
1047
|
+
const inputSlot = this.baseElement.shadowRoot?.querySelector('slot[name="input"]');
|
1048
|
+
const textAreaSlot = this.baseElement.shadowRoot?.querySelector('slot[name="textarea"]');
|
1049
|
+
|
1050
|
+
this.#inputElement ??= getNestedInput(inputSlot) || getNestedInput(textAreaSlot);
|
1051
|
+
|
1052
|
+
return this.#inputElement
|
1053
|
+
}
|
1054
|
+
|
1055
|
+
set inputElement(ele) {
|
1056
|
+
this.#inputElement = ele;
|
1057
|
+
}
|
1058
|
+
|
1059
|
+
getValidity() {
|
1060
|
+
return this.inputElement?.validity || {}
|
1061
|
+
}
|
1062
|
+
|
1063
|
+
handleInternalInputErrorMessage() {
|
1064
|
+
if (!this.inputElement.checkValidity()) {
|
1065
|
+
this.inputElement.setCustomValidity(this.validationMessage);
|
1066
|
+
}
|
1067
|
+
}
|
1068
|
+
|
1069
|
+
#handleErrorMessage() {
|
1070
|
+
this.handleInternalInputErrorMessage();
|
1071
|
+
this.setAttribute('error-message', this.validationMessage);
|
1072
|
+
}
|
1073
|
+
|
1074
|
+
init() {
|
1075
|
+
super.init?.();
|
1076
|
+
|
1077
|
+
this.inputElement.addEventListener('input', (e) => {
|
1078
|
+
if (!this.inputElement.checkValidity()) {
|
1079
|
+
this.inputElement.setCustomValidity('');
|
1080
|
+
// after updating the input validity we want to trigger set validity on the wrapping element
|
1081
|
+
// so we will get the updated validity
|
1082
|
+
this.setCustomValidity('');
|
1083
|
+
|
1084
|
+
// Vaadin is getting the input event before us,
|
1085
|
+
// so in order to make sure they use the updated validity
|
1086
|
+
// we calling their fn after updating the input validity
|
1087
|
+
this.baseElement.__onInput(e);
|
1088
|
+
|
1089
|
+
this.#handleErrorMessage();
|
1090
|
+
}
|
1091
|
+
});
|
1092
|
+
|
1093
|
+
this.baseElement.addEventListener('change', () => {
|
1094
|
+
this.#dispatchChange();
|
1095
|
+
});
|
1096
|
+
|
1097
|
+
this.#inputElement.addEventListener('blur', () => {
|
1098
|
+
if (!this.checkValidity()) {
|
1099
|
+
this.setAttribute('invalid', 'true');
|
1100
|
+
this.#handleErrorMessage();
|
1101
|
+
}
|
1102
|
+
});
|
1103
|
+
|
1104
|
+
|
1105
|
+
this.addEventListener('invalid', () => {
|
1106
|
+
if (!this.checkValidity()) {
|
1107
|
+
this.setAttribute('invalid', 'true');
|
1108
|
+
}
|
1109
|
+
this.#handleErrorMessage();
|
1110
|
+
});
|
1111
|
+
|
1112
|
+
this.handleInternalInputErrorMessage();
|
1113
|
+
|
1114
|
+
// sync properties
|
1115
|
+
propertyObserver(this, this.inputElement, 'value');
|
1116
|
+
propertyObserver(this, this.inputElement, 'selectionStart');
|
1117
|
+
this.setSelectionRange = this.inputElement.setSelectionRange?.bind(this.inputElement);
|
1118
|
+
|
1119
|
+
forwardAttrs(this, this.inputElement, {includeAttrs: ['inputmode']});
|
1120
|
+
}
|
1121
|
+
};
|
1122
|
+
|
1123
|
+
// this is needed because we might generate the same css vars names
|
1124
|
+
// e.g. "overlayColor" attribute in style mixin's mapping,
|
1125
|
+
// will generate the same var as "color" attribute in portals's mapping
|
1126
|
+
// when the portal name is "overlay".
|
1127
|
+
// because of that, we are adding this separator that is also used as a differentiator
|
1128
|
+
const DISPLAY_NAME_SEPARATOR = '_';
|
1129
|
+
|
1130
|
+
const sanitizeSelector = (selector) => selector.replace(/[^\w\s]/gi, '');
|
1131
|
+
|
1132
|
+
const getDomNode = (maybeDomNode) => maybeDomNode.host || maybeDomNode;
|
1133
|
+
|
1134
|
+
const portalMixin = ({
|
1135
|
+
name,
|
1136
|
+
selector,
|
1137
|
+
mappings = {},
|
1138
|
+
forward: { attributes = [], include = true } = {}
|
1139
|
+
}) => (superclass) => {
|
1140
|
+
const eleDisplayName = name || sanitizeSelector(selector);
|
1141
|
+
|
1142
|
+
const BaseClass = createStyleMixin({
|
1143
|
+
mappings
|
1144
|
+
})(superclass);
|
1145
|
+
|
1146
|
+
return class PortalMixinClass extends BaseClass {
|
1147
|
+
static get cssVarList() {
|
1148
|
+
return {
|
1149
|
+
...BaseClass.cssVarList,
|
1150
|
+
[eleDisplayName]: createCssVarsList(kebabCaseJoin(superclass.componentName, DISPLAY_NAME_SEPARATOR + eleDisplayName), mappings)
|
1151
|
+
};
|
1152
|
+
}
|
1153
|
+
|
1154
|
+
#portalEle
|
1155
|
+
|
1156
|
+
constructor() {
|
1157
|
+
// we cannot use "this" before calling "super"
|
1158
|
+
const getRootElement = (that) => {
|
1159
|
+
const baseEle = that.shadowRoot.querySelector(that.baseSelector);
|
1160
|
+
const portal = selector ? baseEle.shadowRoot.querySelector(selector) : baseEle;
|
1161
|
+
|
1162
|
+
return portal.shadowRoot || portal
|
1163
|
+
};
|
1164
|
+
|
1165
|
+
super({
|
1166
|
+
getRootElement,
|
1167
|
+
componentNameSuffix: DISPLAY_NAME_SEPARATOR + eleDisplayName,
|
1168
|
+
themeSection: PORTAL_THEME_PREFIX + eleDisplayName,
|
1169
|
+
baseSelector: ':host'
|
1170
|
+
});
|
1171
|
+
|
1172
|
+
this.#portalEle = getDomNode(getRootElement(this));
|
1173
|
+
}
|
1174
|
+
|
1175
|
+
#handleHoverAttribute() {
|
1176
|
+
this.#portalEle.onmouseenter = (e) => { e.target.setAttribute('hover', 'true'); };
|
1177
|
+
this.#portalEle.onmouseleave = (e) => { e.target.removeAttribute('hover'); };
|
1178
|
+
}
|
1179
|
+
|
1180
|
+
init() {
|
1181
|
+
super.init?.();
|
1182
|
+
forwardAttrs(this, this.#portalEle, { [include ? 'includeAttrs' : 'excludeAttrs']: attributes });
|
1183
|
+
|
1184
|
+
this.#handleHoverAttribute();
|
1185
|
+
}
|
1186
|
+
}
|
1187
|
+
};
|
1188
|
+
|
1189
|
+
const changeMixin = (superclass) => class ChangeMixinClass extends superclass {
|
1190
|
+
#dispatchChange = createDispatchEvent.bind(this, 'change')
|
1191
|
+
|
1192
|
+
init() {
|
1193
|
+
super.init?.();
|
1194
|
+
this.prevValue = this.value;
|
1195
|
+
|
1196
|
+
this.addEventListener('change', (e) => {
|
1197
|
+
e.stopPropagation();
|
1198
|
+
});
|
1199
|
+
|
1200
|
+
this.addEventListener('blur', () => {
|
1201
|
+
if (this.value !== this.prevValue) {
|
1202
|
+
this.#dispatchChange();
|
1203
|
+
this.prevValue = this.value;
|
1204
|
+
}
|
1205
|
+
});
|
1206
|
+
}
|
1207
|
+
};
|
1208
|
+
|
1209
|
+
const inputEventsDispatchingMixin = (superclass) => class InputEventsDispatchingMixinClass extends superclass {
|
1210
|
+
init() {
|
1211
|
+
this.#blockNativeEvents();
|
1212
|
+
|
1213
|
+
super.init?.();
|
1214
|
+
}
|
1215
|
+
|
1216
|
+
// we want to block the native (trusted) events and control when these events are being dispatched
|
1217
|
+
#blockNativeEvents() {
|
1218
|
+
['blur', 'focus', 'focusin', 'focusout'].forEach(event => {
|
1219
|
+
this.addEventListener(event, (e) => {
|
1220
|
+
e.isTrusted && e.target === this && e.stopImmediatePropagation();
|
1221
|
+
});
|
1222
|
+
});
|
1223
|
+
}
|
1224
|
+
|
1225
|
+
handleFocusEventsDispatching(inputs) {
|
1226
|
+
let timerId;
|
1227
|
+
|
1228
|
+
// in order to simulate blur & focusout on root input element
|
1229
|
+
// we are checking if focus on one of the inner elements happened immediately after blur
|
1230
|
+
// if not, the component is no longer focused and we should dispatch blur & focusout
|
1231
|
+
inputs?.forEach(input => {
|
1232
|
+
input?.addEventListener('focusout', (e) => {
|
1233
|
+
e.stopImmediatePropagation();
|
1234
|
+
timerId = setTimeout(() => {
|
1235
|
+
timerId = null;
|
1236
|
+
|
1237
|
+
createDispatchEvent.call(this, 'blur');
|
1238
|
+
createDispatchEvent.call(this, 'focusout', { bubbles: true });
|
1239
|
+
});
|
1240
|
+
});
|
1241
|
+
|
1242
|
+
// in order to simulate focus & focusin on the root input element
|
1243
|
+
// we are holding a timer id and clearing it on focusin
|
1244
|
+
// if there is a timer id, it means that the root input is still focused
|
1245
|
+
// otherwise, it was not focused before, and we should dispatch focus & focusin
|
1246
|
+
const onFocus = (e) => {
|
1247
|
+
e.stopImmediatePropagation();
|
1248
|
+
clearTimeout(timerId);
|
1249
|
+
if (!timerId) {
|
1250
|
+
createDispatchEvent.call(this, 'focus');
|
1251
|
+
createDispatchEvent.call(this, 'focusin', { bubbles: true });
|
1252
|
+
}
|
1253
|
+
};
|
1254
|
+
|
1255
|
+
// some components are not dispatching focusin but only focus
|
1256
|
+
input?.addEventListener('focusin', onFocus);
|
1257
|
+
input?.addEventListener('focus', onFocus);
|
1258
|
+
});
|
1259
|
+
}
|
1260
|
+
|
1261
|
+
// we want to block the input events from propagating in case the value of the root input wasn't change
|
1262
|
+
// this can happen if we are sanitizing characters on the internal inputs and do not want it to affect the root input element value
|
1263
|
+
// in this case, on each input event, we are comparing the root input value to the previous one, and only if it does not match, we are allowing the input event to propagate
|
1264
|
+
handleInputEventDispatching() {
|
1265
|
+
let previousRootComponentValue = this.value;
|
1266
|
+
|
1267
|
+
this.addEventListener('input', (e) => {
|
1268
|
+
// we are comparing the previous value to the new one,
|
1269
|
+
// and if they have the same value, we are blocking the input event
|
1270
|
+
if (previousRootComponentValue === this.value) {
|
1271
|
+
e.stopImmediatePropagation();
|
1272
|
+
} else {
|
1273
|
+
previousRootComponentValue = this.value;
|
1274
|
+
}
|
1275
|
+
});
|
1276
|
+
}
|
1277
|
+
};
|
1278
|
+
|
1279
|
+
const createBaseInputClass = (...args) => compose(
|
1280
|
+
inputValidationMixin,
|
1281
|
+
changeMixin,
|
1282
|
+
normalizeBooleanAttributesMixin,
|
1283
|
+
inputEventsDispatchingMixin
|
1284
|
+
)(createBaseClass(...args));
|
1285
|
+
|
1286
|
+
const componentName$n = getComponentName('boolean-field-internal');
|
1287
|
+
|
1288
|
+
createBaseInputClass({ componentName: componentName$n, baseSelector: 'div' });
|
1289
|
+
|
1290
|
+
const booleanFieldMixin = (superclass) =>
|
1291
|
+
class BooleanFieldMixinClass extends superclass {
|
1292
|
+
constructor() {
|
1293
|
+
super();
|
1294
|
+
}
|
1295
|
+
|
1296
|
+
init() {
|
1297
|
+
super.init?.();
|
1298
|
+
|
1299
|
+
const template = document.createElement('template');
|
1300
|
+
template.innerHTML = `
|
1301
|
+
<${componentName$n}
|
1302
|
+
tabindex="-1"
|
1303
|
+
slot="input"
|
1304
|
+
></${componentName$n}>
|
1305
|
+
`;
|
1306
|
+
|
1307
|
+
this.baseElement.appendChild(template.content.cloneNode(true));
|
1308
|
+
this.inputElement = this.shadowRoot.querySelector(componentName$n);
|
1309
|
+
this.checkbox = this.inputElement.querySelector('vaadin-checkbox');
|
1310
|
+
|
1311
|
+
forwardAttrs(this, this.inputElement, {
|
1312
|
+
includeAttrs: [
|
1313
|
+
'required',
|
1314
|
+
'full-width',
|
1315
|
+
'size',
|
1316
|
+
'label',
|
1317
|
+
'invalid',
|
1318
|
+
]
|
1319
|
+
});
|
1320
|
+
|
1321
|
+
forwardProps(this.inputElement, this, ['checked']);
|
1322
|
+
syncAttrs(this, this.inputElement, { includeAttrs: ['checked'] });
|
1323
|
+
}
|
1324
|
+
};
|
1325
|
+
|
1326
|
+
var commonStyles = `
|
1327
|
+
:host {
|
1328
|
+
--vaadin-field-default-width: auto;
|
1329
|
+
display: inline-flex;
|
1330
|
+
}
|
1331
|
+
.wrapper {
|
1332
|
+
display: flex;
|
1333
|
+
}
|
1334
|
+
|
1335
|
+
vaadin-text-field {
|
1336
|
+
position: relative;
|
1337
|
+
padding: 0;
|
1338
|
+
display: inline-flex;
|
1339
|
+
align-items: flex-start;
|
1340
|
+
}
|
1341
|
+
vaadin-text-field::before {
|
1342
|
+
height: 0;
|
1343
|
+
margin: 0;
|
1344
|
+
}
|
1345
|
+
vaadin-text-field::part(label) {
|
1346
|
+
position: absolute;
|
1347
|
+
top: 0;
|
1348
|
+
}
|
1349
|
+
vaadin-text-field::part(input-field) {
|
1350
|
+
padding: 0;
|
1351
|
+
background: none;
|
1352
|
+
min-height: 0;
|
1353
|
+
}
|
1354
|
+
vaadin-text-field::part(input-field)::after {
|
1355
|
+
background: none;
|
1356
|
+
}
|
1357
|
+
vaadin-text-field[focus-ring]::part(input-field) {
|
1358
|
+
box-shadow: none;
|
1359
|
+
}
|
1360
|
+
vaadin-text-field[required]::part(required-indicator)::after {
|
1361
|
+
content: "*";
|
1362
|
+
}
|
1363
|
+
|
1364
|
+
vaadin-checkbox [slot="label"] {
|
1365
|
+
align-self: flex-start;
|
1366
|
+
opacity: 0;
|
1367
|
+
padding: 0;
|
1368
|
+
}
|
1369
|
+
[required] vaadin-checkbox [slot="label"] {
|
1370
|
+
padding-right: 1em;
|
1371
|
+
}
|
1372
|
+
vaadin-checkbox::part(checkbox) {
|
1373
|
+
margin: 0;
|
1374
|
+
}
|
1375
|
+
vaadin-checkbox[focus-ring]::part(checkbox) {
|
1376
|
+
box-shadow: none;
|
1377
|
+
}
|
1378
|
+
|
1379
|
+
descope-boolean-field-internal {
|
1380
|
+
-webkit-mask-image: none;
|
1381
|
+
min-height: 0;
|
1382
|
+
padding: 0;
|
1383
|
+
}
|
1384
|
+
`;
|
1385
|
+
|
1386
|
+
const componentName$m = getComponentName('checkbox');
|
1387
|
+
|
1388
|
+
const {
|
1389
|
+
host: host$a,
|
1390
|
+
component: component$1,
|
1391
|
+
checkboxElement,
|
1392
|
+
checkboxSurface,
|
1393
|
+
checkboxHiddenLabel: checkboxHiddenLabel$1,
|
1394
|
+
label: label$7,
|
1395
|
+
requiredIndicator: requiredIndicator$5
|
1396
|
+
} = {
|
1397
|
+
host: { selector: () => ':host' },
|
1398
|
+
label: { selector: '::part(label)' },
|
1399
|
+
requiredIndicator: { selector: '::part(required-indicator)::after' },
|
1400
|
+
component: { selector: 'vaadin-checkbox' },
|
1401
|
+
checkboxElement: { selector: 'vaadin-checkbox::part(checkbox)' },
|
1402
|
+
checkboxSurface: { selector: 'vaadin-checkbox::part(checkbox)::after' },
|
1403
|
+
checkboxHiddenLabel: { selector: 'vaadin-checkbox [slot="label"]' },
|
1404
|
+
};
|
1405
|
+
|
1406
|
+
const CheckboxClass = compose(
|
1407
|
+
createStyleMixin({
|
1408
|
+
mappings: {
|
1409
|
+
width: host$a,
|
1410
|
+
cursor: component$1,
|
1411
|
+
|
1412
|
+
// Checkbox
|
1413
|
+
checkboxBackgroundColor: { ...checkboxElement, property: 'background-color' },
|
1414
|
+
checkboxRadius: { ...checkboxElement, property: 'border-radius' },
|
1415
|
+
|
1416
|
+
checkboxSize: [
|
1417
|
+
{ ...checkboxElement, property: 'width' },
|
1418
|
+
{ ...label$7, property: 'margin-left' },
|
1419
|
+
{ ...checkboxElement, property: 'height' },
|
1420
|
+
{ ...checkboxSurface, property: 'font-size' },
|
1421
|
+
{ ...component$1, property: 'font-size' },
|
1422
|
+
{ ...label$7, property: 'line-height' },
|
1423
|
+
{ ...checkboxHiddenLabel$1, property: 'line-height' }
|
1424
|
+
],
|
1425
|
+
|
1426
|
+
checkboxOutlineWidth: { ...checkboxElement, property: 'outline-width' },
|
1427
|
+
checkboxOutlineOffset: { ...checkboxElement, property: 'outline-offset' },
|
1428
|
+
checkboxOutlineColor: { ...checkboxElement, property: 'outline-color' },
|
1429
|
+
checkboxOutlineStyle: { ...checkboxElement, property: 'outline-style' },
|
1430
|
+
|
1431
|
+
// Checkmark
|
1432
|
+
checkmarkTextColor: { ...checkboxSurface, property: 'color' },
|
1433
|
+
|
1434
|
+
// Label
|
1435
|
+
labelFontSize: [
|
1436
|
+
{ ...host$a, property: 'font-size' },
|
1437
|
+
{ ...checkboxElement, property: 'font-size' },
|
1438
|
+
{ ...label$7, property: 'font-size' },
|
1439
|
+
{ ...checkboxHiddenLabel$1, property: 'font-size' }
|
1440
|
+
],
|
1441
|
+
labelFontWeight: [
|
1442
|
+
{ ...label$7, property: 'font-weight' },
|
1443
|
+
{ ...checkboxHiddenLabel$1, property: 'font-weight' }
|
1444
|
+
],
|
1445
|
+
labelMargin: [
|
1446
|
+
{ ...label$7, property: 'left' },
|
1447
|
+
{ ...checkboxHiddenLabel$1, property: 'padding-left' }
|
1448
|
+
],
|
1449
|
+
labelTextColor: [
|
1450
|
+
{ ...label$7, property: 'color' },
|
1451
|
+
{ ...requiredIndicator$5, property: 'color' },
|
1452
|
+
],
|
1453
|
+
},
|
1454
|
+
}),
|
1455
|
+
draggableMixin,
|
1456
|
+
proxyInputMixin,
|
1457
|
+
componentNameValidationMixin,
|
1458
|
+
booleanFieldMixin
|
1459
|
+
)(
|
1460
|
+
createProxy({
|
1461
|
+
slots: [],
|
1462
|
+
wrappedEleName: 'vaadin-text-field',
|
1463
|
+
style: `
|
1464
|
+
${commonStyles}
|
1465
|
+
|
1466
|
+
vaadin-checkbox [slot="label"] {
|
1467
|
+
height: 100%;
|
1468
|
+
cursor: pointer;
|
1469
|
+
}
|
1470
|
+
`,
|
1471
|
+
excludeAttrsSync: ['tabindex'],
|
1472
|
+
componentName: componentName$m
|
1473
|
+
})
|
1474
|
+
);
|
1475
|
+
|
1476
|
+
const componentName$l = getComponentName('switch-toggle');
|
1477
|
+
|
1478
|
+
const {
|
1479
|
+
host: host$9,
|
1480
|
+
component,
|
1481
|
+
checkboxElement: track,
|
1482
|
+
checkboxSurface: knob,
|
1483
|
+
checkboxHiddenLabel,
|
1484
|
+
label: label$6,
|
1485
|
+
requiredIndicator: requiredIndicator$4,
|
1486
|
+
} = {
|
1487
|
+
host: { selector: () => ':host' },
|
1488
|
+
label: { selector: '::part(label)' },
|
1489
|
+
requiredIndicator: { selector: '::part(required-indicator)::after' },
|
1490
|
+
component: { selector: 'vaadin-checkbox' },
|
1491
|
+
checkboxElement: { selector: 'vaadin-checkbox::part(checkbox)' },
|
1492
|
+
checkboxSurface: { selector: 'vaadin-checkbox::part(checkbox)::after' },
|
1493
|
+
checkboxHiddenLabel: { selector: 'vaadin-checkbox [slot="label"]' },
|
1494
|
+
};
|
1495
|
+
|
1496
|
+
const SwitchToggleClass = compose(
|
1497
|
+
createStyleMixin({
|
1498
|
+
mappings: {
|
1499
|
+
width: host$9,
|
1500
|
+
cursor: [component, checkboxHiddenLabel, track],
|
1501
|
+
fontSize: [component, label$6, checkboxHiddenLabel],
|
1502
|
+
|
1503
|
+
// Track
|
1504
|
+
trackBorderWidth: { ...track, property: 'border-width' },
|
1505
|
+
trackBorderStyle: { ...track, property: 'border-style' },
|
1506
|
+
trackBorderColor: { ...track, property: 'border-color' },
|
1507
|
+
|
1508
|
+
// Checkbox
|
1509
|
+
trackBackgroundColor: { ...track, property: 'background-color' },
|
1510
|
+
trackRadius: { ...track, property: 'border-radius' },
|
1511
|
+
|
1512
|
+
trackWidth: [
|
1513
|
+
{ ...track, property: 'width' },
|
1514
|
+
],
|
1515
|
+
trackHeight: [
|
1516
|
+
{ ...knob, property: 'font-size' },
|
1517
|
+
{ ...track, property: 'height' }
|
1518
|
+
],
|
1519
|
+
switchOutlineWidth: { ...track, property: 'outline-width' },
|
1520
|
+
switchOutlineOffset: { ...track, property: 'outline-offset' },
|
1521
|
+
switchOutlineColor: { ...track, property: 'outline-color' },
|
1522
|
+
switchOutlineStyle: { ...track, property: 'outline-style' },
|
1523
|
+
|
1524
|
+
// Knob
|
1525
|
+
knobSize: [
|
1526
|
+
{ ...knob, property: 'width' },
|
1527
|
+
{ ...knob, property: 'height' },
|
1528
|
+
],
|
1529
|
+
knobTextColor: { ...knob, property: 'color' },
|
1530
|
+
knobRadius: { ...knob, property: 'border-radius' },
|
1531
|
+
knobTransition: { ...knob, property: 'transition' },
|
1532
|
+
knobColor: { ...knob, property: 'background-color' },
|
1533
|
+
knobTopOffset: { ...knob, property: 'top' },
|
1534
|
+
knobPosition: { ...knob, property: 'left' },
|
1535
|
+
|
1536
|
+
// Label
|
1537
|
+
labelMargin: [
|
1538
|
+
{ ...label$6, property: 'padding-left' },
|
1539
|
+
{ ...checkboxHiddenLabel, property: 'padding-left' }
|
1540
|
+
],
|
1541
|
+
labelLineHeight: [
|
1542
|
+
{ ...label$6, property: 'line-height' },
|
1543
|
+
{ ...checkboxHiddenLabel, property: 'line-height' }
|
1544
|
+
],
|
1545
|
+
labelFontWeight: [
|
1546
|
+
{ ...label$6, property: 'font-weight' },
|
1547
|
+
{ ...checkboxHiddenLabel, property: 'font-weight' }
|
1548
|
+
],
|
1549
|
+
labelTextColor: [
|
1550
|
+
{ ...label$6, property: 'color' },
|
1551
|
+
{ ...requiredIndicator$4, property: 'color' },
|
1552
|
+
],
|
1553
|
+
},
|
1554
|
+
}),
|
1555
|
+
draggableMixin,
|
1556
|
+
proxyInputMixin,
|
1557
|
+
componentNameValidationMixin,
|
1558
|
+
booleanFieldMixin
|
1559
|
+
)(
|
1560
|
+
createProxy({
|
1561
|
+
slots: [],
|
1562
|
+
wrappedEleName: 'vaadin-text-field',
|
1563
|
+
style: () => `
|
1564
|
+
${commonStyles}
|
1565
|
+
|
1566
|
+
vaadin-text-field::part(label) {
|
1567
|
+
left: calc(var(${SwitchToggleClass.cssVarList.trackWidth}) + var(${SwitchToggleClass.cssVarList.trackBorderWidth}) * 2);
|
1568
|
+
}
|
1569
|
+
|
1570
|
+
vaadin-checkbox[active]::part(checkbox) {
|
1571
|
+
transform: none;
|
1572
|
+
}
|
1573
|
+
vaadin-checkbox[checked]::part(checkbox) {
|
1574
|
+
background: none;
|
1575
|
+
}
|
1576
|
+
vaadin-checkbox::part(checkbox)::after {
|
1577
|
+
position: absolute;
|
1578
|
+
opacity: 1;
|
1579
|
+
content: '';
|
1580
|
+
}
|
1581
|
+
`,
|
1582
|
+
excludeAttrsSync: ['tabindex'],
|
1583
|
+
componentName: componentName$l
|
1584
|
+
})
|
1585
|
+
);
|
1586
|
+
|
1587
|
+
const componentName$k = getComponentName('button');
|
1588
|
+
|
1589
|
+
const resetStyles = `
|
1590
|
+
:host {
|
1591
|
+
display: inline-block;
|
1592
|
+
}
|
1593
|
+
vaadin-button {
|
1594
|
+
margin: 0;
|
1595
|
+
min-width: 0;
|
1596
|
+
width: 100%;
|
1597
|
+
height: auto;
|
1598
|
+
}
|
1599
|
+
vaadin-button::part(label) {
|
1600
|
+
padding: 0;
|
1601
|
+
}
|
1602
|
+
vaadin-button::part(prefix) {
|
1603
|
+
margin-left: 0;
|
1604
|
+
margin-right: 0;
|
1605
|
+
}
|
1606
|
+
`;
|
1607
|
+
|
1608
|
+
const iconStyles = `
|
1609
|
+
vaadin-button::part(prefix),
|
1610
|
+
vaadin-button::part(label) {
|
1611
|
+
display: flex;
|
1612
|
+
justify-content: center;
|
1613
|
+
align-items: center;
|
1614
|
+
}
|
1615
|
+
`;
|
1616
|
+
|
1617
|
+
const editorOverrides = `vaadin-button::part(label) { pointer-events: none; }`;
|
1618
|
+
|
1619
|
+
const { host: host$8, label: label$5 } = {
|
1620
|
+
host: { selector: () => ':host' },
|
1621
|
+
label: { selector: '::part(label)' },
|
1622
|
+
};
|
1623
|
+
|
1624
|
+
const ButtonClass = compose(
|
1625
|
+
createStyleMixin({
|
1626
|
+
mappings: {
|
1627
|
+
color: {},
|
1628
|
+
textDecoration: label$5,
|
1629
|
+
fontSize: {},
|
1630
|
+
cursor: {},
|
1631
|
+
backgroundColor: {},
|
1632
|
+
borderRadius: {},
|
1633
|
+
borderColor: {},
|
1634
|
+
borderStyle: {},
|
1635
|
+
borderWidth: {},
|
1636
|
+
width: host$8,
|
1637
|
+
gap: label$5,
|
1638
|
+
verticalPadding: [
|
1639
|
+
{ property: 'padding-top' },
|
1640
|
+
{ property: 'padding-bottom' },
|
1641
|
+
],
|
1642
|
+
horizontalPadding: [
|
1643
|
+
{ property: 'padding-left' },
|
1644
|
+
{ property: 'padding-right' },
|
1645
|
+
]
|
1646
|
+
}
|
1647
|
+
}),
|
1648
|
+
draggableMixin,
|
1649
|
+
componentNameValidationMixin
|
1650
|
+
)(
|
1651
|
+
createProxy({
|
1652
|
+
slots: ['prefix', 'label', 'suffix'],
|
1653
|
+
wrappedEleName: 'vaadin-button',
|
1654
|
+
style: () => `
|
1655
|
+
${resetStyles}
|
1656
|
+
${iconStyles}
|
1657
|
+
${loadingIndicatorStyles}
|
1658
|
+
${editorOverrides}
|
1659
|
+
`,
|
1660
|
+
excludeAttrsSync: ['tabindex'],
|
1661
|
+
componentName: componentName$k
|
1662
|
+
})
|
1663
|
+
);
|
1664
|
+
|
1665
|
+
const { color, fontSize } = ButtonClass.cssVarList;
|
1666
|
+
const loadingIndicatorStyles = `
|
1667
|
+
@keyframes spin {
|
1668
|
+
0% { -webkit-transform: rotate(0deg); }
|
1669
|
+
100% { -webkit-transform: rotate(360deg); }
|
1670
|
+
}
|
1671
|
+
:host([loading="true"]) ::before {
|
1672
|
+
animation: spin 2s linear infinite;
|
1673
|
+
position: absolute;
|
1674
|
+
content: '';
|
1675
|
+
z-index: 1;
|
1676
|
+
box-sizing: border-box;
|
1677
|
+
border-radius: 50%;
|
1678
|
+
border-bottom-color: transparent;
|
1679
|
+
border-left-color: transparent;
|
1680
|
+
border-style: solid;
|
1681
|
+
color: var(${color});
|
1682
|
+
top: calc(50% - (var(${fontSize}) / 2));
|
1683
|
+
left: calc(50% - (var(${fontSize}) / 2));
|
1684
|
+
border-width: calc(var(${fontSize}) / 10);
|
1685
|
+
width: var(${fontSize});
|
1686
|
+
height: var(${fontSize});
|
1687
|
+
}
|
1688
|
+
:host([loading="true"])::part(prefix),
|
1689
|
+
:host([loading="true"])::part(label) {
|
1690
|
+
visibility: hidden;
|
1691
|
+
}
|
1692
|
+
`;
|
1693
|
+
|
1694
|
+
const componentName$j = getComponentName('loader-linear');
|
1695
|
+
|
1696
|
+
class RawLoaderLinear extends createBaseClass({ componentName: componentName$j, baseSelector: ':host > div' }) {
|
1697
|
+
static get componentName() {
|
1698
|
+
return componentName$j;
|
1699
|
+
}
|
1700
|
+
constructor() {
|
1701
|
+
super();
|
1702
|
+
|
1703
|
+
this.attachShadow({ mode: 'open' }).innerHTML = `
|
1704
|
+
<style>
|
1705
|
+
@keyframes tilt {
|
1706
|
+
0% { transform: translateX(0); }
|
1707
|
+
50% { transform: translateX(400%); }
|
1708
|
+
}
|
1709
|
+
:host {
|
1710
|
+
position: relative;
|
1711
|
+
display: flex;
|
1712
|
+
}
|
1713
|
+
div::after {
|
1714
|
+
content: '';
|
1715
|
+
animation-name: tilt;
|
1716
|
+
position: absolute;
|
1717
|
+
left: 0;
|
1718
|
+
}
|
1719
|
+
|
1720
|
+
:host > div {
|
1721
|
+
width: 100%;
|
1722
|
+
}
|
1723
|
+
</style>
|
1724
|
+
<div></div>
|
1725
|
+
`;
|
1726
|
+
}
|
1727
|
+
}
|
1728
|
+
|
1729
|
+
const selectors$3 = {
|
1730
|
+
root: {},
|
1731
|
+
after: { selector: '::after' },
|
1732
|
+
host: { selector: () => ':host' }
|
1733
|
+
};
|
1734
|
+
|
1735
|
+
const { root: root$1, after: after$1, host: host$7 } = selectors$3;
|
1736
|
+
|
1737
|
+
const LoaderLinearClass = compose(
|
1738
|
+
createStyleMixin({
|
1739
|
+
mappings: {
|
1740
|
+
display: root$1,
|
1741
|
+
width: host$7,
|
1742
|
+
height: [root$1, after$1],
|
1743
|
+
borderRadius: [root$1, after$1],
|
1744
|
+
surfaceColor: [{ property: 'background-color' }],
|
1745
|
+
barColor: [{ ...after$1, property: 'background-color' }],
|
1746
|
+
barWidth: { ...after$1, property: 'width' },
|
1747
|
+
animationDuration: [root$1, after$1],
|
1748
|
+
animationTimingFunction: [root$1, after$1],
|
1749
|
+
animationIterationCount: [root$1, after$1]
|
1750
|
+
}
|
1751
|
+
}),
|
1752
|
+
draggableMixin,
|
1753
|
+
componentNameValidationMixin
|
1754
|
+
)(RawLoaderLinear);
|
1755
|
+
|
1756
|
+
const componentName$i = getComponentName('loader-radial');
|
1757
|
+
|
1758
|
+
class RawLoaderRadial extends createBaseClass({ componentName: componentName$i, baseSelector: ':host > div' }) {
|
1759
|
+
constructor() {
|
1760
|
+
super();
|
1761
|
+
|
1762
|
+
this.attachShadow({ mode: 'open' }).innerHTML = `
|
1763
|
+
<style>
|
1764
|
+
@keyframes spin {
|
1765
|
+
0% { transform: rotate(0deg); }
|
1766
|
+
100% { transform: rotate(360deg); }
|
1767
|
+
}
|
1768
|
+
:host {
|
1769
|
+
position: relative;
|
1770
|
+
display: inline-flex;
|
1771
|
+
}
|
1772
|
+
:host > div {
|
1773
|
+
animation-name: spin;
|
1774
|
+
}
|
1775
|
+
</style>
|
1776
|
+
<div></div>
|
1777
|
+
`;
|
1778
|
+
}
|
1779
|
+
}
|
1780
|
+
|
1781
|
+
const LoaderRadialClass = compose(
|
1782
|
+
createStyleMixin({
|
1783
|
+
mappings: {
|
1784
|
+
display: {},
|
1785
|
+
width: {},
|
1786
|
+
height: {},
|
1787
|
+
spinnerWidth: { property: 'border-width' },
|
1788
|
+
spinnerStyle: { property: 'border-style' },
|
1789
|
+
spinnerRadius: { property: 'border-radius' },
|
1790
|
+
spinnerTopColor: { property: 'border-top-color' },
|
1791
|
+
spinnerBottomColor: { property: 'border-bottom-color' },
|
1792
|
+
spinnerRightColor: { property: 'border-right-color' },
|
1793
|
+
spinnerLeftColor: { property: 'border-left-color' },
|
1794
|
+
color: {},
|
1795
|
+
animationDuration: {},
|
1796
|
+
animationTimingFunction: {},
|
1797
|
+
animationIterationCount: {}
|
1798
|
+
}
|
1799
|
+
}),
|
1800
|
+
draggableMixin,
|
1801
|
+
componentNameValidationMixin
|
1802
|
+
)(RawLoaderRadial);
|
1803
|
+
|
1804
|
+
const componentName$h = getComponentName('container');
|
1805
|
+
|
1806
|
+
class RawContainer extends createBaseClass({ componentName: componentName$h, baseSelector: ':host > slot' }) {
|
1807
|
+
constructor() {
|
1808
|
+
super();
|
1809
|
+
|
1810
|
+
this.attachShadow({ mode: 'open' }).innerHTML = `
|
1811
|
+
<style>
|
1812
|
+
:host > slot {
|
1813
|
+
box-sizing: border-box;
|
1814
|
+
width: 100%;
|
1815
|
+
height: 100%;
|
1816
|
+
display: flex;
|
1817
|
+
overflow: hidden;
|
1818
|
+
}
|
1819
|
+
:host {
|
1820
|
+
display: inline-block;
|
1821
|
+
overflow: auto;
|
1822
|
+
}
|
1823
|
+
</style>
|
1824
|
+
<slot></slot>
|
1825
|
+
`;
|
1826
|
+
}
|
1827
|
+
}
|
1828
|
+
|
1829
|
+
const ContainerClass = compose(
|
1830
|
+
createStyleMixin({
|
1831
|
+
mappings: {
|
1832
|
+
height: { selector: () => ':host' },
|
1833
|
+
width: { selector: () => ':host' },
|
1834
|
+
|
1835
|
+
verticalPadding: [
|
1836
|
+
{ property: 'padding-top' },
|
1837
|
+
{ property: 'padding-bottom' }
|
1838
|
+
],
|
1839
|
+
horizontalPadding: [
|
1840
|
+
{ property: 'padding-left' },
|
1841
|
+
{ property: 'padding-right' }
|
1842
|
+
],
|
1843
|
+
|
1844
|
+
flexDirection: {},
|
1845
|
+
justifyContent: {},
|
1846
|
+
alignItems: {},
|
1847
|
+
gap: {},
|
1848
|
+
flexWrap: {},
|
1849
|
+
|
1850
|
+
backgroundColor: {},
|
1851
|
+
color: {},
|
1852
|
+
borderRadius: {},
|
1853
|
+
|
1854
|
+
borderColor: {},
|
1855
|
+
borderStyle: {},
|
1856
|
+
borderWidth: {},
|
1857
|
+
|
1858
|
+
boxShadow: {}
|
1859
|
+
}
|
1860
|
+
}),
|
1861
|
+
draggableMixin,
|
1862
|
+
componentNameValidationMixin
|
1863
|
+
)(RawContainer);
|
1864
|
+
|
1865
|
+
const componentName$g = getComponentName('divider');
|
1866
|
+
class RawDivider extends createBaseClass({ componentName: componentName$g, baseSelector: ':host > div' }) {
|
1867
|
+
constructor() {
|
1868
|
+
super();
|
1869
|
+
|
1870
|
+
this.attachShadow({ mode: 'open' }).innerHTML = `
|
1871
|
+
<style>
|
1872
|
+
:host {
|
1873
|
+
display: inline-block;
|
1874
|
+
}
|
1875
|
+
:host > div {
|
1876
|
+
display: flex;
|
1877
|
+
height: 100%;
|
1878
|
+
width: 100%;
|
1879
|
+
}
|
1880
|
+
:host > div::before,
|
1881
|
+
:host > div::after {
|
1882
|
+
content: '';
|
1883
|
+
flex-grow: 1;
|
1884
|
+
}
|
1885
|
+
|
1886
|
+
descope-text {
|
1887
|
+
flex-grow: 0;
|
1888
|
+
flex-shrink: 0;
|
1889
|
+
min-width: fit-content;
|
1890
|
+
}
|
1891
|
+
|
1892
|
+
:host(:empty) descope-text {
|
1893
|
+
display: none;
|
1894
|
+
}
|
1895
|
+
|
1896
|
+
:host([vertical="true"]) div {
|
1897
|
+
width: fit-content;
|
1898
|
+
}
|
1899
|
+
|
1900
|
+
</style>
|
1901
|
+
<div>
|
1902
|
+
<descope-text>
|
1903
|
+
<slot></slot>
|
1904
|
+
</descope-text>
|
1905
|
+
</div>
|
1906
|
+
`;
|
1907
|
+
|
1908
|
+
this.textComponent = this.shadowRoot.querySelector('descope-text');
|
1909
|
+
|
1910
|
+
forwardAttrs(this, this.textComponent, {
|
1911
|
+
includeAttrs: ['mode', 'variant', 'italic']
|
1912
|
+
});
|
1913
|
+
}
|
1914
|
+
}
|
1915
|
+
|
1916
|
+
const selectors$2 = {
|
1917
|
+
root: { selector: '' },
|
1918
|
+
before: { selector: '::before' },
|
1919
|
+
after: { selector: '::after' },
|
1920
|
+
text: { selector: 'descope-text' },
|
1921
|
+
host: { selector: () => ':host' },
|
1922
|
+
};
|
1923
|
+
|
1924
|
+
const { root, before, after, text: text$1, host: host$6 } = selectors$2;
|
1925
|
+
|
1926
|
+
const DividerClass = compose(
|
1927
|
+
createStyleMixin({
|
1928
|
+
mappings: {
|
1929
|
+
maxTextWidth: { ...text$1, property: 'max-width' },
|
1930
|
+
minHeight: root,
|
1931
|
+
alignItems: root,
|
1932
|
+
alignSelf: root,
|
1933
|
+
flexDirection: root,
|
1934
|
+
textPadding: { ...text$1, property: 'padding' },
|
1935
|
+
width: host$6,
|
1936
|
+
padding: host$6,
|
1937
|
+
backgroundColor: [before, after],
|
1938
|
+
opacity: [before, after],
|
1939
|
+
textWidth: { ...text$1, property: 'width' },
|
1940
|
+
dividerHeight: [{ ...before, property: 'height' }, { ...after, property: 'height' }],
|
1941
|
+
dividerWidth: [{ ...before, property: 'width' }, { ...after, property: 'width' }]
|
1942
|
+
},
|
1943
|
+
}),
|
1944
|
+
draggableMixin,
|
1945
|
+
componentNameValidationMixin
|
1946
|
+
)(RawDivider);
|
1947
|
+
|
1948
|
+
const selectors$1 = {
|
1949
|
+
label: '::part(label)',
|
1950
|
+
inputWrapper: '::part(input-field)',
|
1951
|
+
readOnlyInput: '[readonly]::part(input-field)::after',
|
1952
|
+
placeholder: '> input:placeholder-shown',
|
1953
|
+
host: () => ':host',
|
1954
|
+
input: 'input'
|
1955
|
+
};
|
1956
|
+
|
1957
|
+
var textFieldMappings = {
|
1958
|
+
backgroundColor: { selector: selectors$1.inputWrapper },
|
1959
|
+
labelTextColor: { selector: selectors$1.label, property: 'color' },
|
1960
|
+
color: { selector: selectors$1.inputWrapper },
|
1961
|
+
width: { selector: selectors$1.host },
|
1962
|
+
borderColor: [
|
1963
|
+
{ selector: selectors$1.inputWrapper },
|
1964
|
+
{ selector: selectors$1.readOnlyInput }
|
1965
|
+
],
|
1966
|
+
borderWidth: [
|
1967
|
+
{ selector: selectors$1.inputWrapper },
|
1968
|
+
{ selector: selectors$1.readOnlyInput }
|
1969
|
+
],
|
1970
|
+
borderStyle: [
|
1971
|
+
{ selector: selectors$1.inputWrapper },
|
1972
|
+
{ selector: selectors$1.readOnlyInput }
|
1973
|
+
],
|
1974
|
+
borderRadius: { selector: selectors$1.inputWrapper },
|
1975
|
+
boxShadow: { selector: selectors$1.inputWrapper },
|
1976
|
+
|
1977
|
+
// we apply font-size also on the host so we can set its width with em
|
1978
|
+
fontSize: [{}, { selector: selectors$1.host }],
|
1979
|
+
|
1980
|
+
height: { selector: selectors$1.inputWrapper },
|
1981
|
+
padding: { selector: selectors$1.inputWrapper },
|
1982
|
+
margin: { selector: selectors$1.inputWrapper },
|
1983
|
+
caretColor: { selector: selectors$1.input },
|
1984
|
+
outlineColor: { selector: selectors$1.inputWrapper },
|
1985
|
+
outlineStyle: { selector: selectors$1.inputWrapper },
|
1986
|
+
outlineWidth: [
|
1987
|
+
{ selector: selectors$1.inputWrapper },
|
1988
|
+
// we need to make sure there is enough space for the outline
|
1989
|
+
{ property: 'padding' }
|
1990
|
+
],
|
1991
|
+
outlineOffset: { selector: selectors$1.inputWrapper },
|
1992
|
+
textAlign: { selector: selectors$1.input },
|
1993
|
+
placeholderColor: { selector: selectors$1.placeholder, property: 'color' }
|
1994
|
+
};
|
1995
|
+
|
1996
|
+
const componentName$f = getComponentName('email-field');
|
1997
|
+
|
1998
|
+
let overrides$4 = ``;
|
1999
|
+
|
2000
|
+
const EmailFieldClass = compose(
|
2001
|
+
createStyleMixin({
|
2002
|
+
mappings: {
|
2003
|
+
...textFieldMappings
|
2004
|
+
}
|
2005
|
+
}),
|
2006
|
+
draggableMixin,
|
2007
|
+
proxyInputMixin,
|
2008
|
+
componentNameValidationMixin
|
2009
|
+
)(
|
2010
|
+
createProxy({
|
2011
|
+
slots: ['suffix'],
|
2012
|
+
wrappedEleName: 'vaadin-email-field',
|
2013
|
+
style: () => overrides$4,
|
2014
|
+
excludeAttrsSync: ['tabindex'],
|
2015
|
+
componentName: componentName$f
|
2016
|
+
})
|
2017
|
+
);
|
2018
|
+
|
2019
|
+
overrides$4 = `
|
2020
|
+
:host {
|
2021
|
+
display: inline-block;
|
2022
|
+
min-width: 10em;
|
2023
|
+
max-width: 100%;
|
2024
|
+
}
|
2025
|
+
vaadin-email-field {
|
2026
|
+
margin: 0;
|
2027
|
+
width: 100%;
|
2028
|
+
box-sizing: border-box;
|
2029
|
+
}
|
2030
|
+
vaadin-email-field::before {
|
2031
|
+
height: 0;
|
2032
|
+
}
|
2033
|
+
vaadin-email-field > input {
|
2034
|
+
-webkit-mask-image: none;
|
2035
|
+
}
|
2036
|
+
vaadin-email-field::part(input-field) {
|
2037
|
+
overflow: hidden;
|
2038
|
+
padding: 0;
|
2039
|
+
}
|
2040
|
+
vaadin-email-field[readonly] > input:placeholder-shown {
|
2041
|
+
opacity: 1;
|
2042
|
+
}
|
2043
|
+
vaadin-email-field input:-webkit-autofill,
|
2044
|
+
vaadin-email-field input:-webkit-autofill::first-line,
|
2045
|
+
vaadin-email-field input:-webkit-autofill:hover,
|
2046
|
+
vaadin-email-field input:-webkit-autofill:active,
|
2047
|
+
vaadin-email-field input:-webkit-autofill:focus {
|
2048
|
+
-webkit-text-fill-color: var(${EmailFieldClass.cssVarList.color});
|
2049
|
+
box-shadow: 0 0 0 var(${EmailFieldClass.cssVarList.height}) var(${EmailFieldClass.cssVarList.backgroundColor}) inset;
|
2050
|
+
}
|
2051
|
+
vaadin-email-field[required]::part(required-indicator)::after {
|
2052
|
+
content: "*";
|
2053
|
+
color: var(${EmailFieldClass.cssVarList.color});
|
2054
|
+
}
|
2055
|
+
vaadin-email-field[readonly]::part(input-field)::after {
|
2056
|
+
border: 0 solid;
|
2057
|
+
}
|
2058
|
+
`;
|
2059
|
+
|
2060
|
+
const componentName$e = getComponentName('text');
|
2061
|
+
|
2062
|
+
class RawText extends createBaseClass({ componentName: componentName$e, baseSelector: ':host > slot' }) {
|
2063
|
+
constructor() {
|
2064
|
+
super();
|
2065
|
+
|
2066
|
+
this.attachShadow({ mode: 'open' }).innerHTML = `
|
2067
|
+
<style>
|
2068
|
+
:host {
|
2069
|
+
display: inline-block;
|
2070
|
+
}
|
2071
|
+
:host > slot {
|
2072
|
+
width: 100%;
|
2073
|
+
display: inline-block;
|
2074
|
+
}
|
2075
|
+
</style>
|
2076
|
+
<slot></slot>
|
2077
|
+
`;
|
2078
|
+
}
|
2079
|
+
}
|
2080
|
+
|
2081
|
+
const TextClass = compose(
|
2082
|
+
createStyleMixin({
|
2083
|
+
mappings: {
|
2084
|
+
fontFamily: {},
|
2085
|
+
lineHeight: {},
|
2086
|
+
fontStyle: {},
|
2087
|
+
fontSize: {},
|
2088
|
+
fontWeight: {},
|
2089
|
+
width: { selector: () => ':host' },
|
2090
|
+
color: {},
|
2091
|
+
letterSpacing: {},
|
2092
|
+
textShadow: {},
|
2093
|
+
borderWidth: {},
|
2094
|
+
borderStyle: {},
|
2095
|
+
borderColor: {},
|
2096
|
+
textTransform: {},
|
2097
|
+
textAlign: {},
|
2098
|
+
},
|
2099
|
+
}),
|
2100
|
+
draggableMixin,
|
2101
|
+
componentNameValidationMixin
|
2102
|
+
)(RawText);
|
2103
|
+
|
2104
|
+
const componentName$d = getComponentName('link');
|
2105
|
+
|
2106
|
+
class RawLink extends createBaseClass({ componentName: componentName$d, baseSelector: ':host a' }) {
|
2107
|
+
constructor() {
|
2108
|
+
super();
|
2109
|
+
|
2110
|
+
this.attachShadow({ mode: 'open' }).innerHTML = `
|
2111
|
+
<style>
|
2112
|
+
:host {
|
2113
|
+
display: inline-block;
|
2114
|
+
}
|
2115
|
+
:host a {
|
2116
|
+
display: inline-block;
|
2117
|
+
}
|
2118
|
+
</style>
|
2119
|
+
<div>
|
2120
|
+
<a>
|
2121
|
+
<descope-text>
|
2122
|
+
<slot></slot>
|
2123
|
+
</descope-text>
|
2124
|
+
</a>
|
2125
|
+
</div>
|
2126
|
+
`;
|
2127
|
+
|
2128
|
+
forwardAttrs(this, this.shadowRoot.querySelector('a'), {
|
2129
|
+
includeAttrs: ['href', 'target', 'tooltip'],
|
2130
|
+
mapAttrs: {
|
2131
|
+
tooltip: 'title'
|
2132
|
+
}
|
2133
|
+
});
|
2134
|
+
|
2135
|
+
forwardAttrs(this, this.shadowRoot.querySelector('descope-text'), {
|
2136
|
+
includeAttrs: ['mode', 'variant'],
|
2137
|
+
});
|
2138
|
+
}
|
2139
|
+
}
|
2140
|
+
|
2141
|
+
const selectors = {
|
2142
|
+
host: { selector: () => ':host' },
|
2143
|
+
anchor: {},
|
2144
|
+
wrapper: { selector: () => ':host > div' },
|
2145
|
+
text: { selector: () => TextClass.componentName }
|
2146
|
+
};
|
2147
|
+
|
2148
|
+
const { anchor, text, host: host$5, wrapper } = selectors;
|
2149
|
+
|
2150
|
+
const LinkClass = compose(
|
2151
|
+
createStyleMixin({
|
2152
|
+
mappings: {
|
2153
|
+
width: host$5,
|
2154
|
+
textAlign: wrapper,
|
2155
|
+
color: [anchor, { ...text, property: TextClass.cssVarList.color }],
|
2156
|
+
cursor: anchor,
|
2157
|
+
borderBottomWidth: anchor,
|
2158
|
+
borderBottomStyle: anchor,
|
2159
|
+
borderBottomColor: anchor
|
2160
|
+
},
|
2161
|
+
}),
|
2162
|
+
draggableMixin,
|
2163
|
+
componentNameValidationMixin
|
2164
|
+
)(RawLink);
|
2165
|
+
|
2166
|
+
const componentName$c = getComponentName('logo');
|
2167
|
+
|
2168
|
+
let style;
|
2169
|
+
const getStyle = () => style;
|
2170
|
+
|
2171
|
+
class RawLogo extends createBaseClass({ componentName: componentName$c, baseSelector: ':host > div' }) {
|
2172
|
+
constructor() {
|
2173
|
+
super();
|
2174
|
+
|
2175
|
+
this.attachShadow({ mode: 'open' }).innerHTML = `
|
2176
|
+
<style>
|
2177
|
+
${getStyle()}
|
2178
|
+
</style>
|
2179
|
+
<div></div>`;
|
2180
|
+
}
|
2181
|
+
}
|
2182
|
+
|
2183
|
+
const LogoClass = compose(
|
2184
|
+
createStyleMixin({
|
2185
|
+
mappings: {
|
2186
|
+
height: { selector: () => ':host' },
|
2187
|
+
width: { selector: () => ':host' },
|
2188
|
+
fallbackUrl: { property: 'content' },
|
2189
|
+
url: { property: 'content' },
|
2190
|
+
}
|
2191
|
+
}),
|
2192
|
+
draggableMixin,
|
2193
|
+
componentNameValidationMixin
|
2194
|
+
)(RawLogo);
|
2195
|
+
|
2196
|
+
style = `
|
2197
|
+
:host {
|
2198
|
+
display: inline-flex;
|
2199
|
+
}
|
2200
|
+
:host > div {
|
2201
|
+
display: inline-block;
|
2202
|
+
content: var(${LogoClass.cssVarList.url}, var(${LogoClass.cssVarList.fallbackUrl}));
|
2203
|
+
max-width: 100%;
|
2204
|
+
max-height: 100%;
|
2205
|
+
object-fit: contain;
|
2206
|
+
margin: auto;
|
2207
|
+
}
|
2208
|
+
:host([draggable="true"]) > div {
|
2209
|
+
pointer-events: none
|
2210
|
+
}
|
2211
|
+
`;
|
2212
|
+
|
2213
|
+
const componentName$b = getComponentName('number-field');
|
2214
|
+
|
2215
|
+
let overrides$3 = ``;
|
2216
|
+
|
2217
|
+
const NumberFieldClass = compose(
|
2218
|
+
createStyleMixin({
|
2219
|
+
mappings: {
|
2220
|
+
...textFieldMappings
|
2221
|
+
}
|
2222
|
+
}),
|
2223
|
+
draggableMixin,
|
2224
|
+
proxyInputMixin,
|
2225
|
+
componentNameValidationMixin
|
2226
|
+
)(
|
2227
|
+
createProxy({
|
2228
|
+
slots: ['prefix', 'suffix'],
|
2229
|
+
wrappedEleName: 'vaadin-number-field',
|
2230
|
+
style: () => overrides$3,
|
2231
|
+
excludeAttrsSync: ['tabindex'],
|
2232
|
+
componentName: componentName$b
|
2233
|
+
})
|
2234
|
+
);
|
2235
|
+
|
2236
|
+
overrides$3 = `
|
2237
|
+
:host {
|
2238
|
+
display: inline-block;
|
2239
|
+
min-width: 10em;
|
2240
|
+
max-width: 100%;
|
2241
|
+
}
|
2242
|
+
vaadin-number-field {
|
2243
|
+
margin: 0;
|
2244
|
+
padding: 0;
|
2245
|
+
width: 100%;
|
2246
|
+
}
|
2247
|
+
vaadin-number-field > input {
|
2248
|
+
-webkit-mask-image: none;
|
2249
|
+
}
|
2250
|
+
vaadin-number-field::part(input-field) {
|
2251
|
+
padding: 0;
|
2252
|
+
}
|
2253
|
+
vaadin-number-field[readonly] > input:placeholder-shown {
|
2254
|
+
opacity: 1;
|
2255
|
+
}
|
2256
|
+
vaadin-number-field input:-webkit-autofill,
|
2257
|
+
vaadin-number-field input:-webkit-autofill::first-line,
|
2258
|
+
vaadin-number-field input:-webkit-autofill:hover,
|
2259
|
+
vaadin-number-field input:-webkit-autofill:active,
|
2260
|
+
vaadin-number-field input:-webkit-autofill:focus {
|
2261
|
+
-webkit-text-fill-color: var(${NumberFieldClass.cssVarList.color});
|
2262
|
+
box-shadow: 0 0 0 var(${NumberFieldClass.cssVarList.height}) var(${NumberFieldClass.cssVarList.backgroundColor}) inset;
|
2263
|
+
}
|
2264
|
+
vaadin-number-field[required]::part(required-indicator)::after {
|
2265
|
+
content: "*";
|
2266
|
+
color: var(${NumberFieldClass.cssVarList.color});
|
2267
|
+
}
|
2268
|
+
vaadin-number-field[readonly]::part(input-field)::after {
|
2269
|
+
border: 0 solid;
|
2270
|
+
}
|
2271
|
+
`;
|
2272
|
+
|
2273
|
+
const componentName$a = getComponentName('passcode-internal');
|
2274
|
+
|
2275
|
+
createBaseInputClass({ componentName: componentName$a, baseSelector: 'div' });
|
2276
|
+
|
2277
|
+
const componentName$9 = getComponentName('text-field');
|
2278
|
+
|
2279
|
+
let overrides$2 = ``;
|
2280
|
+
|
2281
|
+
const observedAttrs = ['type'];
|
2282
|
+
|
2283
|
+
const customMixin$3 = (superclass) =>
|
2284
|
+
class TextFieldClass extends superclass {
|
2285
|
+
static get observedAttributes() {
|
2286
|
+
return observedAttrs.concat(superclass.observedAttributes || []);
|
2287
|
+
}
|
2288
|
+
|
2289
|
+
attributeChangedCallback(attrName, oldVal, newVal) {
|
2290
|
+
super.attributeChangeCallback?.(attrName, oldVal, newVal);
|
2291
|
+
|
2292
|
+
// Vaadin doesn't allow to change the input type attribute.
|
2293
|
+
// We need the ability to do that, so we're overriding their
|
2294
|
+
// behavior with their private API.
|
2295
|
+
// When receiving a `type` attribute, we use their private API
|
2296
|
+
// to set it on the input.
|
2297
|
+
if (attrName === 'type') {
|
2298
|
+
this.baseElement._setType(newVal);
|
2299
|
+
}
|
2300
|
+
}
|
2301
|
+
};
|
2302
|
+
|
2303
|
+
const TextFieldClass = compose(
|
2304
|
+
createStyleMixin({
|
2305
|
+
mappings: textFieldMappings
|
2306
|
+
}),
|
2307
|
+
draggableMixin,
|
2308
|
+
proxyInputMixin,
|
2309
|
+
componentNameValidationMixin,
|
2310
|
+
customMixin$3
|
2311
|
+
)(
|
2312
|
+
createProxy({
|
2313
|
+
slots: ['prefix', 'suffix'],
|
2314
|
+
wrappedEleName: 'vaadin-text-field',
|
2315
|
+
style: () => overrides$2,
|
2316
|
+
excludeAttrsSync: ['tabindex'],
|
2317
|
+
componentName: componentName$9
|
2318
|
+
})
|
2319
|
+
);
|
2320
|
+
|
2321
|
+
overrides$2 = `
|
2322
|
+
:host {
|
2323
|
+
display: inline-block;
|
2324
|
+
--vaadin-field-default-width: auto;
|
2325
|
+
max-width: 100%;
|
2326
|
+
min-width: 10em;
|
2327
|
+
|
2328
|
+
}
|
2329
|
+
vaadin-text-field {
|
2330
|
+
margin: 0;
|
2331
|
+
width: 100%;
|
2332
|
+
height: 100%;
|
2333
|
+
box-sizing: border-box;
|
2334
|
+
}
|
2335
|
+
|
2336
|
+
vaadin-text-field::part(input-field) {
|
2337
|
+
overflow: hidden;
|
2338
|
+
padding: 0;
|
2339
|
+
}
|
2340
|
+
vaadin-text-field[disabled] > input:placeholder-shown,
|
2341
|
+
vaadin-text-field[readonly] > input:placeholder-shown {
|
2342
|
+
opacity: 1;
|
2343
|
+
}
|
2344
|
+
vaadin-text-field input:-webkit-autofill,
|
2345
|
+
vaadin-text-field input:-webkit-autofill::first-line,
|
2346
|
+
vaadin-text-field input:-webkit-autofill:hover,
|
2347
|
+
vaadin-text-field input:-webkit-autofill:active,
|
2348
|
+
vaadin-text-field input:-webkit-autofill:focus {
|
2349
|
+
-webkit-text-fill-color: var(${TextFieldClass.cssVarList.color});
|
2350
|
+
box-shadow: 0 0 0 var(${TextFieldClass.cssVarList.height}) var(${TextFieldClass.cssVarList.backgroundColor}) inset;
|
2351
|
+
}
|
2352
|
+
|
2353
|
+
vaadin-text-field > input {
|
2354
|
+
-webkit-mask-image: none;
|
2355
|
+
min-height: 0;
|
2356
|
+
}
|
2357
|
+
|
2358
|
+
vaadin-text-field[required]::part(required-indicator)::after {
|
2359
|
+
content: "*";
|
2360
|
+
color: var(${TextFieldClass.cssVarList.color});
|
2361
|
+
}
|
2362
|
+
vaadin-text-field::part(input-field)::after {
|
2363
|
+
opacity: 0 !important;
|
2364
|
+
}
|
2365
|
+
|
2366
|
+
vaadin-text-field::before {
|
2367
|
+
height: unset;
|
2368
|
+
}
|
2369
|
+
`;
|
2370
|
+
|
2371
|
+
const componentName$8 = getComponentName('passcode');
|
2372
|
+
|
2373
|
+
const observedAttributes$1 = [
|
2374
|
+
'digits'
|
2375
|
+
];
|
2376
|
+
|
2377
|
+
const customMixin$2 = (superclass) =>
|
2378
|
+
class PasscodeMixinClass extends superclass {
|
2379
|
+
static get observedAttributes() {
|
2380
|
+
return observedAttributes$1.concat(superclass.observedAttributes || []);
|
2381
|
+
}
|
2382
|
+
|
2383
|
+
constructor() {
|
2384
|
+
super();
|
2385
|
+
}
|
2386
|
+
|
2387
|
+
get digits() {
|
2388
|
+
return Number.parseInt(this.getAttribute('digits')) || 6;
|
2389
|
+
}
|
2390
|
+
|
2391
|
+
init() {
|
2392
|
+
super.init?.();
|
2393
|
+
const template = document.createElement('template');
|
2394
|
+
|
2395
|
+
template.innerHTML = `
|
2396
|
+
<${componentName$a}
|
2397
|
+
bordered="true"
|
2398
|
+
name="code"
|
2399
|
+
tabindex="-1"
|
2400
|
+
slot="input"
|
2401
|
+
></${componentName$a}>
|
2402
|
+
`;
|
2403
|
+
|
2404
|
+
this.baseElement.appendChild(template.content.cloneNode(true));
|
2405
|
+
|
2406
|
+
this.inputElement = this.shadowRoot.querySelector(componentName$a);
|
2407
|
+
|
2408
|
+
forwardAttrs(this, this.inputElement, { includeAttrs: ['digits', 'size'] });
|
2409
|
+
}
|
2410
|
+
|
2411
|
+
attributeChangedCallback(attrName, oldValue, newValue) {
|
2412
|
+
super.attributeChangedCallback?.(attrName, oldValue, newValue);
|
2413
|
+
|
2414
|
+
if (attrName === 'digits') {
|
2415
|
+
this.style.setProperty('--passcode-digits-count', newValue);
|
2416
|
+
}
|
2417
|
+
}
|
2418
|
+
};
|
2419
|
+
|
2420
|
+
const { borderStyle, borderWidth, ...restTextFieldMappings } =
|
2421
|
+
textFieldMappings;
|
2422
|
+
|
2423
|
+
const { digitField, label: label$4, requiredIndicator: requiredIndicator$3, internalWrapper, focusedDigitField } = {
|
2424
|
+
focusedDigitField: { selector: () => `${TextFieldClass.componentName}[focused="true"]` },
|
2425
|
+
digitField: { selector: () => TextFieldClass.componentName },
|
2426
|
+
label: { selector: '::part(label)' },
|
2427
|
+
requiredIndicator: { selector: '[required]::part(required-indicator)::after' },
|
2428
|
+
internalWrapper: { selector: 'descope-passcode-internal .wrapper' }
|
2429
|
+
};
|
2430
|
+
|
2431
|
+
const textVars$1 = TextFieldClass.cssVarList;
|
2432
|
+
|
2433
|
+
const PasscodeClass = compose(
|
2434
|
+
createStyleMixin({
|
2435
|
+
mappings: {
|
2436
|
+
...restTextFieldMappings,
|
2437
|
+
borderColor: { ...digitField, property: textVars$1.borderColor },
|
2438
|
+
outlineColor: { ...digitField, property: textVars$1.outlineColor },
|
2439
|
+
outlineWidth: [
|
2440
|
+
{ ...digitField, property: textVars$1.outlineWidth },
|
2441
|
+
// we want to leave enough space to the digits outline,
|
2442
|
+
// ideally, this would be part of the text field
|
2443
|
+
{ ...internalWrapper, property: 'padding' }
|
2444
|
+
],
|
2445
|
+
color: [restTextFieldMappings.color, label$4, requiredIndicator$3],
|
2446
|
+
padding: { ...digitField, property: textVars$1.padding },
|
2447
|
+
margin: { ...digitField, property: textVars$1.margin },
|
2448
|
+
textAlign: { ...digitField, property: textVars$1.textAlign },
|
2449
|
+
caretColor: { ...digitField, property: textVars$1.caretColor },
|
2450
|
+
digitsGap: { ...internalWrapper, property: 'gap' },
|
2451
|
+
focusedDigitFieldOutlineColor: { ...focusedDigitField, property: textVars$1.outlineColor }
|
2452
|
+
},
|
2453
|
+
}),
|
2454
|
+
draggableMixin,
|
2455
|
+
proxyInputMixin,
|
2456
|
+
componentNameValidationMixin,
|
2457
|
+
customMixin$2
|
2458
|
+
)(
|
2459
|
+
createProxy({
|
2460
|
+
slots: [],
|
2461
|
+
wrappedEleName: 'vaadin-text-field',
|
2462
|
+
style: () => `
|
2463
|
+
:host {
|
2464
|
+
--vaadin-field-default-width: auto;
|
2465
|
+
display: inline-block;
|
2466
|
+
max-width: 100%;
|
2467
|
+
min-width: calc(var(--passcode-digits-count) * 2em);
|
2468
|
+
}
|
2469
|
+
:host::after {
|
2470
|
+
background-color: transparent;
|
2471
|
+
}
|
2472
|
+
:host::part(input-field)::after {
|
2473
|
+
background-color: transparent;
|
2474
|
+
}
|
2475
|
+
|
2476
|
+
descope-passcode-internal {
|
2477
|
+
-webkit-mask-image: none;
|
2478
|
+
padding: 0;
|
2479
|
+
width: 100%;
|
2480
|
+
height: 100%;
|
2481
|
+
min-height: initial;
|
2482
|
+
}
|
2483
|
+
|
2484
|
+
descope-passcode-internal .wrapper {
|
2485
|
+
box-sizing: border-box;
|
2486
|
+
min-height: initial;
|
2487
|
+
height: 100%;
|
2488
|
+
justify-content: space-between;
|
2489
|
+
}
|
2490
|
+
|
2491
|
+
descope-passcode-internal descope-text-field {
|
2492
|
+
min-width: 2em;
|
2493
|
+
max-width: var(${textVars$1.height});
|
2494
|
+
}
|
2495
|
+
|
2496
|
+
vaadin-text-field::part(input-field) {
|
2497
|
+
background-color: transparent;
|
2498
|
+
padding: 0;
|
2499
|
+
overflow: hidden;
|
2500
|
+
-webkit-mask-image: none;
|
2501
|
+
}
|
2502
|
+
|
2503
|
+
vaadin-text-field {
|
2504
|
+
margin: 0;
|
2505
|
+
padding: 0;
|
2506
|
+
width: 100%
|
2507
|
+
}
|
2508
|
+
|
2509
|
+
vaadin-text-field::before {
|
2510
|
+
height: 0;
|
2511
|
+
}
|
2512
|
+
|
2513
|
+
vaadin-text-field[readonly] > input:placeholder-shown {
|
2514
|
+
opacity: 1;
|
2515
|
+
}
|
2516
|
+
|
2517
|
+
vaadin-text-field::part(input-field):focus {
|
2518
|
+
cursor: text;
|
2519
|
+
}
|
2520
|
+
|
2521
|
+
vaadin-text-field[required]::part(required-indicator)::after {
|
2522
|
+
content: "*";
|
2523
|
+
}
|
2524
|
+
vaadin-text-field[readonly]::part(input-field)::after {
|
2525
|
+
border: 0 solid;
|
2526
|
+
}
|
2527
|
+
`,
|
2528
|
+
excludeAttrsSync: ['tabindex'],
|
2529
|
+
componentName: componentName$8
|
2530
|
+
})
|
2531
|
+
);
|
2532
|
+
|
2533
|
+
const passwordDraggableMixin = (superclass) => class PasswordDraggableMixinClass extends superclass {
|
2534
|
+
get isReadOnly() {
|
2535
|
+
return this.hasAttribute('readonly') && this.getAttribute('readonly') !== 'false'
|
2536
|
+
}
|
2537
|
+
|
2538
|
+
init() {
|
2539
|
+
// there is an issue in Chrome that input field with type password cannot be D&D
|
2540
|
+
// so in case the input is draggable & readonly, we are changing the input type to "text" before dragging
|
2541
|
+
// and return the original type when done
|
2542
|
+
this.addEventListener('mousedown', (e) => {
|
2543
|
+
if (this.isDraggable & this.isReadOnly) {
|
2544
|
+
const inputEle = this.baseElement.querySelector('input');
|
2545
|
+
const prevType = inputEle.getAttribute('type');
|
2546
|
+
|
2547
|
+
inputEle.setAttribute('type', 'text');
|
2548
|
+
setTimeout(() => inputEle.focus());
|
2549
|
+
|
2550
|
+
const onComplete = (e) => {
|
2551
|
+
inputEle.setAttribute('type', prevType);
|
2552
|
+
|
2553
|
+
e.target.removeEventListener('mouseup', onComplete);
|
2554
|
+
e.target.removeEventListener('dragend', onComplete);
|
2555
|
+
};
|
2556
|
+
|
2557
|
+
e.target.addEventListener('mouseup', onComplete, { once: true });
|
2558
|
+
e.target.addEventListener('dragend', onComplete, { once: true });
|
2559
|
+
}
|
2560
|
+
});
|
2561
|
+
|
2562
|
+
super.init?.();
|
2563
|
+
}
|
2564
|
+
};
|
2565
|
+
|
2566
|
+
const componentName$7 = getComponentName('password-field');
|
2567
|
+
|
2568
|
+
const {
|
2569
|
+
host: host$4,
|
2570
|
+
inputWrapper: inputWrapper$1,
|
2571
|
+
inputElement,
|
2572
|
+
inputElementPlaceholder,
|
2573
|
+
revealButton,
|
2574
|
+
revealButtonIcon,
|
2575
|
+
revealButtonIconOutline,
|
2576
|
+
label: label$3,
|
2577
|
+
requiredIndicator: requiredIndicator$2
|
2578
|
+
} = {
|
2579
|
+
host: { selector: () => ':host' },
|
2580
|
+
inputWrapper: { selector: '::part(input-field)' },
|
2581
|
+
inputElement: { selector: '> input' },
|
2582
|
+
inputElementPlaceholder: { selector: '> input:placeholder-shown' },
|
2583
|
+
revealButton: { selector: 'vaadin-password-field-button' },
|
2584
|
+
revealButtonIcon: { selector: () => '::part(reveal-button)::before' },
|
2585
|
+
revealButtonIconOutline: { selector: () => 'vaadin-password-field-button[focus-ring]' },
|
2586
|
+
label: { selector: '::part(label)' },
|
2587
|
+
requiredIndicator: { selector: '::part(required-indicator)::after' },
|
2588
|
+
};
|
2589
|
+
|
2590
|
+
const PasswordFieldClass = compose(
|
2591
|
+
createStyleMixin({
|
2592
|
+
mappings: {
|
2593
|
+
width: host$4,
|
2594
|
+
wrapperBorderStyle: { ...inputWrapper$1, property: 'border-style' },
|
2595
|
+
wrapperBorderWidth: { ...inputWrapper$1, property: 'border-width' },
|
2596
|
+
wrapperBorderColor: { ...inputWrapper$1, property: 'border-color' },
|
2597
|
+
wrapperBorderRadius: { ...inputWrapper$1, property: 'border-radius' },
|
2598
|
+
|
2599
|
+
revealButtonOutlineBoxShadow: [
|
2600
|
+
{
|
2601
|
+
...revealButtonIconOutline,
|
2602
|
+
property: 'box-shadow'
|
2603
|
+
}
|
2604
|
+
],
|
2605
|
+
|
2606
|
+
labelTextColor: [
|
2607
|
+
{ ...label$3, property: 'color' },
|
2608
|
+
{ ...requiredIndicator$2, property: 'color' }
|
2609
|
+
],
|
2610
|
+
inputTextColor: [
|
2611
|
+
{ ...inputElement, property: 'color' },
|
2612
|
+
{ ...revealButtonIcon, property: 'color' }
|
2613
|
+
],
|
2614
|
+
placeholderTextColor: { ...inputElementPlaceholder, property: 'color' },
|
2615
|
+
fontSize: [{}, host$4],
|
2616
|
+
height: inputWrapper$1,
|
2617
|
+
padding: inputWrapper$1,
|
2618
|
+
pointerCursor: [
|
2619
|
+
{ ...revealButton, property: 'cursor' },
|
2620
|
+
{ ...label$3, property: 'cursor' },
|
2621
|
+
{ ...requiredIndicator$2, property: 'cursor' }
|
2622
|
+
],
|
2623
|
+
outlineColor: inputWrapper$1,
|
2624
|
+
outlineStyle: inputWrapper$1,
|
2625
|
+
outlineWidth: [
|
2626
|
+
inputWrapper$1,
|
2627
|
+
// we need to make sure there is enough space for the outline
|
2628
|
+
{ property: 'padding' }
|
2629
|
+
],
|
2630
|
+
backgroundColor: inputWrapper$1
|
2631
|
+
}
|
2632
|
+
}),
|
2633
|
+
draggableMixin,
|
2634
|
+
proxyInputMixin,
|
2635
|
+
componentNameValidationMixin,
|
2636
|
+
passwordDraggableMixin
|
2637
|
+
)(
|
2638
|
+
createProxy({
|
2639
|
+
slots: ['suffix'],
|
2640
|
+
wrappedEleName: 'vaadin-password-field',
|
2641
|
+
style: `
|
2642
|
+
:host {
|
2643
|
+
display: inline-block;
|
2644
|
+
min-width: 10em;
|
2645
|
+
max-width: 100%;
|
2646
|
+
}
|
2647
|
+
vaadin-password-field {
|
2648
|
+
width: 100%;
|
2649
|
+
box-sizing: border-box;
|
2650
|
+
}
|
2651
|
+
vaadin-password-field::part(input-field) {
|
2652
|
+
padding: 0;
|
2653
|
+
}
|
2654
|
+
vaadin-password-field > input {
|
2655
|
+
min-height: 0;
|
2656
|
+
-webkit-mask-image: none;
|
2657
|
+
}
|
2658
|
+
vaadin-password-field[readonly] > input:placeholder-shown {
|
2659
|
+
opacity: 1;
|
2660
|
+
}
|
2661
|
+
vaadin-password-field::before {
|
2662
|
+
height: initial;
|
2663
|
+
}
|
2664
|
+
vaadin-password-field::part(input-field)::after {
|
2665
|
+
opacity: 0;
|
2666
|
+
}
|
2667
|
+
vaadin-password-field[required]::part(required-indicator)::after {
|
2668
|
+
content: "*";
|
2669
|
+
}
|
2670
|
+
[readonly] vaadin-password-field-button {
|
2671
|
+
pointer-events: none;
|
2672
|
+
}
|
2673
|
+
`,
|
2674
|
+
excludeAttrsSync: ['tabindex'],
|
2675
|
+
componentName: componentName$7
|
2676
|
+
})
|
2677
|
+
);
|
2678
|
+
|
2679
|
+
const componentName$6 = getComponentName('text-area');
|
2680
|
+
|
2681
|
+
const {
|
2682
|
+
host: host$3,
|
2683
|
+
placeholder: placeholder$1,
|
2684
|
+
input: input$1,
|
2685
|
+
textArea,
|
2686
|
+
label: label$2,
|
2687
|
+
requiredIndicator: requiredIndicator$1
|
2688
|
+
} = {
|
2689
|
+
host: { selector: () => ':host' },
|
2690
|
+
textArea: { selector: '> textarea' },
|
2691
|
+
label: { selector: '::part(label)' },
|
2692
|
+
input: { selector: '::part(input-field)' },
|
2693
|
+
placeholder: { selector: 'textarea:placeholder-shown' },
|
2694
|
+
requiredIndicator: { selector: '::part(required-indicator)::after' },
|
2695
|
+
};
|
2696
|
+
|
2697
|
+
let overrides$1 = ``;
|
2698
|
+
|
2699
|
+
const TextAreaClass = compose(
|
2700
|
+
createStyleMixin({
|
2701
|
+
mappings: {
|
2702
|
+
fontSize: [host$3, textArea],
|
2703
|
+
resize: textArea,
|
2704
|
+
color: textArea,
|
2705
|
+
cursor: {},
|
2706
|
+
labelColor: [
|
2707
|
+
{ ...label$2, property: 'color' },
|
2708
|
+
{ ...requiredIndicator$1, property: 'color' }
|
2709
|
+
],
|
2710
|
+
placeholderColor: { ...placeholder$1, property: 'color' },
|
2711
|
+
width: host$3,
|
2712
|
+
backgroundColor: input$1,
|
2713
|
+
borderWidth: input$1,
|
2714
|
+
borderStyle: input$1,
|
2715
|
+
borderColor: input$1,
|
2716
|
+
borderRadius: input$1,
|
2717
|
+
outlineWidth: [input$1, { property: 'padding' }],
|
2718
|
+
outlineStyle: input$1,
|
2719
|
+
outlineColor: input$1,
|
2720
|
+
outlineOffset: input$1,
|
2721
|
+
}
|
2722
|
+
}),
|
2723
|
+
draggableMixin,
|
2724
|
+
proxyInputMixin,
|
2725
|
+
componentNameValidationMixin
|
2726
|
+
)(
|
2727
|
+
createProxy({
|
2728
|
+
slots: [],
|
2729
|
+
wrappedEleName: 'vaadin-text-area',
|
2730
|
+
style: () => overrides$1,
|
2731
|
+
excludeAttrsSync: ['tabindex'],
|
2732
|
+
componentName: componentName$6
|
2733
|
+
})
|
2734
|
+
);
|
2735
|
+
|
2736
|
+
overrides$1 = `
|
2737
|
+
:host {
|
2738
|
+
display: inline-block;
|
2739
|
+
min-width: 10em;
|
2740
|
+
max-width: 100%;
|
2741
|
+
}
|
2742
|
+
vaadin-text-area {
|
2743
|
+
margin: 0;
|
2744
|
+
width: 100%;
|
2745
|
+
box-sizing: border-box;
|
2746
|
+
}
|
2747
|
+
vaadin-text-area > label,
|
2748
|
+
vaadin-text-area::part(input-field) {
|
2749
|
+
padding: 0;
|
2750
|
+
}
|
2751
|
+
vaadin-text-area[required]::part(required-indicator)::after {
|
2752
|
+
content: "*";
|
2753
|
+
}
|
2754
|
+
vaadin-text-area[disabled] > textarea:placeholder-shown,
|
2755
|
+
vaadin-text-area[readonly] > textarea:placeholder-shown {
|
2756
|
+
opacity: 1;
|
2757
|
+
}
|
2758
|
+
`;
|
2759
|
+
|
2760
|
+
const observedAttributes = ['src', 'alt'];
|
2761
|
+
|
2762
|
+
const componentName$5 = getComponentName('image');
|
2763
|
+
|
2764
|
+
const BaseClass = createBaseClass({ componentName: componentName$5, baseSelector: ':host > img' });
|
2765
|
+
class RawImage extends BaseClass {
|
2766
|
+
static get observedAttributes() {
|
2767
|
+
return observedAttributes.concat(BaseClass.observedAttributes || []);
|
2768
|
+
}
|
2769
|
+
|
2770
|
+
constructor() {
|
2771
|
+
super();
|
2772
|
+
|
2773
|
+
this.attachShadow({ mode: 'open' }).innerHTML = `
|
2774
|
+
<style>
|
2775
|
+
:host > img {
|
2776
|
+
width: 100%;
|
2777
|
+
height: 100%
|
2778
|
+
}
|
2779
|
+
:host {
|
2780
|
+
display: inline-flex;
|
2781
|
+
}
|
2782
|
+
</style>
|
2783
|
+
<img/>
|
2784
|
+
`;
|
2785
|
+
}
|
2786
|
+
|
2787
|
+
connectedCallback() {
|
2788
|
+
super.connectedCallback?.();
|
2789
|
+
|
2790
|
+
forwardAttrs(this, this.baseElement, { includeAttrs: observedAttributes });
|
2791
|
+
}
|
2792
|
+
}
|
2793
|
+
|
2794
|
+
const ImageClass = compose(
|
2795
|
+
createStyleMixin({
|
2796
|
+
mappings: {
|
2797
|
+
height: { selector: () => ':host' },
|
2798
|
+
width: { selector: () => ':host' },
|
2799
|
+
}
|
2800
|
+
}),
|
2801
|
+
draggableMixin,
|
2802
|
+
)(RawImage);
|
2803
|
+
|
2804
|
+
var CountryCodes = [
|
2805
|
+
{
|
2806
|
+
name: 'Afghanistan',
|
2807
|
+
dialCode: '+93',
|
2808
|
+
code: 'AF'
|
2809
|
+
},
|
2810
|
+
{
|
2811
|
+
name: 'Aland Islands',
|
2812
|
+
dialCode: '+358',
|
2813
|
+
code: 'AX'
|
2814
|
+
},
|
2815
|
+
{
|
2816
|
+
name: 'Albania',
|
2817
|
+
dialCode: '+355',
|
2818
|
+
code: 'AL'
|
2819
|
+
},
|
2820
|
+
{
|
2821
|
+
name: 'Algeria',
|
2822
|
+
dialCode: '+213',
|
2823
|
+
code: 'DZ'
|
2824
|
+
},
|
2825
|
+
{
|
2826
|
+
name: 'AmericanSamoa',
|
2827
|
+
dialCode: '+1684',
|
2828
|
+
code: 'AS'
|
2829
|
+
},
|
2830
|
+
{
|
2831
|
+
name: 'Andorra',
|
2832
|
+
dialCode: '+376',
|
2833
|
+
code: 'AD'
|
2834
|
+
},
|
2835
|
+
{
|
2836
|
+
name: 'Angola',
|
2837
|
+
dialCode: '+244',
|
2838
|
+
code: 'AO'
|
2839
|
+
},
|
2840
|
+
{
|
2841
|
+
name: 'Anguilla',
|
2842
|
+
dialCode: '+1264',
|
2843
|
+
code: 'AI'
|
2844
|
+
},
|
2845
|
+
{
|
2846
|
+
name: 'Antarctica',
|
2847
|
+
dialCode: '+672',
|
2848
|
+
code: 'AQ'
|
2849
|
+
},
|
2850
|
+
{
|
2851
|
+
name: 'Antigua and Barbuda',
|
2852
|
+
dialCode: '+1268',
|
2853
|
+
code: 'AG'
|
2854
|
+
},
|
2855
|
+
{
|
2856
|
+
name: 'Argentina',
|
2857
|
+
dialCode: '+54',
|
2858
|
+
code: 'AR'
|
2859
|
+
},
|
2860
|
+
{
|
2861
|
+
name: 'Armenia',
|
2862
|
+
dialCode: '+374',
|
2863
|
+
code: 'AM'
|
2864
|
+
},
|
2865
|
+
{
|
2866
|
+
name: 'Aruba',
|
2867
|
+
dialCode: '+297',
|
2868
|
+
code: 'AW'
|
2869
|
+
},
|
2870
|
+
{
|
2871
|
+
name: 'Australia',
|
2872
|
+
dialCode: '+61',
|
2873
|
+
code: 'AU'
|
2874
|
+
},
|
2875
|
+
{
|
2876
|
+
name: 'Austria',
|
2877
|
+
dialCode: '+43',
|
2878
|
+
code: 'AT'
|
2879
|
+
},
|
2880
|
+
{
|
2881
|
+
name: 'Azerbaijan',
|
2882
|
+
dialCode: '+994',
|
2883
|
+
code: 'AZ'
|
2884
|
+
},
|
2885
|
+
{
|
2886
|
+
name: 'Bahamas',
|
2887
|
+
dialCode: '+1242',
|
2888
|
+
code: 'BS'
|
2889
|
+
},
|
2890
|
+
{
|
2891
|
+
name: 'Bahrain',
|
2892
|
+
dialCode: '+973',
|
2893
|
+
code: 'BH'
|
2894
|
+
},
|
2895
|
+
{
|
2896
|
+
name: 'Bangladesh',
|
2897
|
+
dialCode: '+880',
|
2898
|
+
code: 'BD'
|
2899
|
+
},
|
2900
|
+
{
|
2901
|
+
name: 'Barbados',
|
2902
|
+
dialCode: '+1246',
|
2903
|
+
code: 'BB'
|
2904
|
+
},
|
2905
|
+
{
|
2906
|
+
name: 'Belarus',
|
2907
|
+
dialCode: '+375',
|
2908
|
+
code: 'BY'
|
2909
|
+
},
|
2910
|
+
{
|
2911
|
+
name: 'Belgium',
|
2912
|
+
dialCode: '+32',
|
2913
|
+
code: 'BE'
|
2914
|
+
},
|
2915
|
+
{
|
2916
|
+
name: 'Belize',
|
2917
|
+
dialCode: '+501',
|
2918
|
+
code: 'BZ'
|
2919
|
+
},
|
2920
|
+
{
|
2921
|
+
name: 'Benin',
|
2922
|
+
dialCode: '+229',
|
2923
|
+
code: 'BJ'
|
2924
|
+
},
|
2925
|
+
{
|
2926
|
+
name: 'Bermuda',
|
2927
|
+
dialCode: '+1441',
|
2928
|
+
code: 'BM'
|
2929
|
+
},
|
2930
|
+
{
|
2931
|
+
name: 'Bhutan',
|
2932
|
+
dialCode: '+975',
|
2933
|
+
code: 'BT'
|
2934
|
+
},
|
2935
|
+
{
|
2936
|
+
name: 'Bolivia, Plurinational State of',
|
2937
|
+
dialCode: '+591',
|
2938
|
+
code: 'BO'
|
2939
|
+
},
|
2940
|
+
{
|
2941
|
+
name: 'Bosnia and Herzegovina',
|
2942
|
+
dialCode: '+387',
|
2943
|
+
code: 'BA'
|
2944
|
+
},
|
2945
|
+
{
|
2946
|
+
name: 'Botswana',
|
2947
|
+
dialCode: '+267',
|
2948
|
+
code: 'BW'
|
2949
|
+
},
|
2950
|
+
{
|
2951
|
+
name: 'Brazil',
|
2952
|
+
dialCode: '+55',
|
2953
|
+
code: 'BR'
|
2954
|
+
},
|
2955
|
+
{
|
2956
|
+
name: 'British Indian Ocean Territory',
|
2957
|
+
dialCode: '+246',
|
2958
|
+
code: 'IO'
|
2959
|
+
},
|
2960
|
+
{
|
2961
|
+
name: 'Brunei Darussalam',
|
2962
|
+
dialCode: '+673',
|
2963
|
+
code: 'BN'
|
2964
|
+
},
|
2965
|
+
{
|
2966
|
+
name: 'Bulgaria',
|
2967
|
+
dialCode: '+359',
|
2968
|
+
code: 'BG'
|
2969
|
+
},
|
2970
|
+
{
|
2971
|
+
name: 'Burkina Faso',
|
2972
|
+
dialCode: '+226',
|
2973
|
+
code: 'BF'
|
2974
|
+
},
|
2975
|
+
{
|
2976
|
+
name: 'Burundi',
|
2977
|
+
dialCode: '+257',
|
2978
|
+
code: 'BI'
|
2979
|
+
},
|
2980
|
+
{
|
2981
|
+
name: 'Cambodia',
|
2982
|
+
dialCode: '+855',
|
2983
|
+
code: 'KH'
|
2984
|
+
},
|
2985
|
+
{
|
2986
|
+
name: 'Cameroon',
|
2987
|
+
dialCode: '+237',
|
2988
|
+
code: 'CM'
|
2989
|
+
},
|
2990
|
+
{
|
2991
|
+
name: 'Canada',
|
2992
|
+
dialCode: '+1',
|
2993
|
+
code: 'CA'
|
2994
|
+
},
|
2995
|
+
{
|
2996
|
+
name: 'Cape Verde',
|
2997
|
+
dialCode: '+238',
|
2998
|
+
code: 'CV'
|
2999
|
+
},
|
3000
|
+
{
|
3001
|
+
name: 'Cayman Islands',
|
3002
|
+
dialCode: '+345',
|
3003
|
+
code: 'KY'
|
3004
|
+
},
|
3005
|
+
{
|
3006
|
+
name: 'Central African Republic',
|
3007
|
+
dialCode: '+236',
|
3008
|
+
code: 'CF'
|
3009
|
+
},
|
3010
|
+
{
|
3011
|
+
name: 'Chad',
|
3012
|
+
dialCode: '+235',
|
3013
|
+
code: 'TD'
|
3014
|
+
},
|
3015
|
+
{
|
3016
|
+
name: 'Chile',
|
3017
|
+
dialCode: '+56',
|
3018
|
+
code: 'CL'
|
3019
|
+
},
|
3020
|
+
{
|
3021
|
+
name: 'China',
|
3022
|
+
dialCode: '+86',
|
3023
|
+
code: 'CN'
|
3024
|
+
},
|
3025
|
+
{
|
3026
|
+
name: 'Christmas Island',
|
3027
|
+
dialCode: '+61',
|
3028
|
+
code: 'CX'
|
3029
|
+
},
|
3030
|
+
{
|
3031
|
+
name: 'Cocos (Keeling) Islands',
|
3032
|
+
dialCode: '+61',
|
3033
|
+
code: 'CC'
|
3034
|
+
},
|
3035
|
+
{
|
3036
|
+
name: 'Colombia',
|
3037
|
+
dialCode: '+57',
|
3038
|
+
code: 'CO'
|
3039
|
+
},
|
3040
|
+
{
|
3041
|
+
name: 'Comoros',
|
3042
|
+
dialCode: '+269',
|
3043
|
+
code: 'KM'
|
3044
|
+
},
|
3045
|
+
{
|
3046
|
+
name: 'Congo',
|
3047
|
+
dialCode: '+242',
|
3048
|
+
code: 'CG'
|
3049
|
+
},
|
3050
|
+
{
|
3051
|
+
name: 'Congo, The Democratic Republic of the Congo',
|
3052
|
+
dialCode: '+243',
|
3053
|
+
code: 'CD'
|
3054
|
+
},
|
3055
|
+
{
|
3056
|
+
name: 'Cook Islands',
|
3057
|
+
dialCode: '+682',
|
3058
|
+
code: 'CK'
|
3059
|
+
},
|
3060
|
+
{
|
3061
|
+
name: 'Costa Rica',
|
3062
|
+
dialCode: '+506',
|
3063
|
+
code: 'CR'
|
3064
|
+
},
|
3065
|
+
{
|
3066
|
+
name: "Cote d'Ivoire",
|
3067
|
+
dialCode: '+225',
|
3068
|
+
code: 'CI'
|
3069
|
+
},
|
3070
|
+
{
|
3071
|
+
name: 'Croatia',
|
3072
|
+
dialCode: '+385',
|
3073
|
+
code: 'HR'
|
3074
|
+
},
|
3075
|
+
{
|
3076
|
+
name: 'Cuba',
|
3077
|
+
dialCode: '+53',
|
3078
|
+
code: 'CU'
|
3079
|
+
},
|
3080
|
+
{
|
3081
|
+
name: 'Cyprus',
|
3082
|
+
dialCode: '+357',
|
3083
|
+
code: 'CY'
|
3084
|
+
},
|
3085
|
+
{
|
3086
|
+
name: 'Czech Republic',
|
3087
|
+
dialCode: '+420',
|
3088
|
+
code: 'CZ'
|
3089
|
+
},
|
3090
|
+
{
|
3091
|
+
name: 'Denmark',
|
3092
|
+
dialCode: '+45',
|
3093
|
+
code: 'DK'
|
3094
|
+
},
|
3095
|
+
{
|
3096
|
+
name: 'Djibouti',
|
3097
|
+
dialCode: '+253',
|
3098
|
+
code: 'DJ'
|
3099
|
+
},
|
3100
|
+
{
|
3101
|
+
name: 'Dominica',
|
3102
|
+
dialCode: '+1767',
|
3103
|
+
code: 'DM'
|
3104
|
+
},
|
3105
|
+
{
|
3106
|
+
name: 'Dominican Republic',
|
3107
|
+
dialCode: '+1849',
|
3108
|
+
code: 'DO'
|
3109
|
+
},
|
3110
|
+
{
|
3111
|
+
name: 'Ecuador',
|
3112
|
+
dialCode: '+593',
|
3113
|
+
code: 'EC'
|
3114
|
+
},
|
3115
|
+
{
|
3116
|
+
name: 'Egypt',
|
3117
|
+
dialCode: '+20',
|
3118
|
+
code: 'EG'
|
3119
|
+
},
|
3120
|
+
{
|
3121
|
+
name: 'El Salvador',
|
3122
|
+
dialCode: '+503',
|
3123
|
+
code: 'SV'
|
3124
|
+
},
|
3125
|
+
{
|
3126
|
+
name: 'Equatorial Guinea',
|
3127
|
+
dialCode: '+240',
|
3128
|
+
code: 'GQ'
|
3129
|
+
},
|
3130
|
+
{
|
3131
|
+
name: 'Eritrea',
|
3132
|
+
dialCode: '+291',
|
3133
|
+
code: 'ER'
|
3134
|
+
},
|
3135
|
+
{
|
3136
|
+
name: 'Estonia',
|
3137
|
+
dialCode: '+372',
|
3138
|
+
code: 'EE'
|
3139
|
+
},
|
3140
|
+
{
|
3141
|
+
name: 'Ethiopia',
|
3142
|
+
dialCode: '+251',
|
3143
|
+
code: 'ET'
|
3144
|
+
},
|
3145
|
+
{
|
3146
|
+
name: 'Falkland Islands (Malvinas)',
|
3147
|
+
dialCode: '+500',
|
3148
|
+
code: 'FK'
|
3149
|
+
},
|
3150
|
+
{
|
3151
|
+
name: 'Faroe Islands',
|
3152
|
+
dialCode: '+298',
|
3153
|
+
code: 'FO'
|
3154
|
+
},
|
3155
|
+
{
|
3156
|
+
name: 'Fiji',
|
3157
|
+
dialCode: '+679',
|
3158
|
+
code: 'FJ'
|
3159
|
+
},
|
3160
|
+
{
|
3161
|
+
name: 'Finland',
|
3162
|
+
dialCode: '+358',
|
3163
|
+
code: 'FI'
|
3164
|
+
},
|
3165
|
+
{
|
3166
|
+
name: 'France',
|
3167
|
+
dialCode: '+33',
|
3168
|
+
code: 'FR'
|
3169
|
+
},
|
3170
|
+
{
|
3171
|
+
name: 'French Guiana',
|
3172
|
+
dialCode: '+594',
|
3173
|
+
code: 'GF'
|
3174
|
+
},
|
3175
|
+
{
|
3176
|
+
name: 'French Polynesia',
|
3177
|
+
dialCode: '+689',
|
3178
|
+
code: 'PF'
|
3179
|
+
},
|
3180
|
+
{
|
3181
|
+
name: 'Gabon',
|
3182
|
+
dialCode: '+241',
|
3183
|
+
code: 'GA'
|
3184
|
+
},
|
3185
|
+
{
|
3186
|
+
name: 'Gambia',
|
3187
|
+
dialCode: '+220',
|
3188
|
+
code: 'GM'
|
3189
|
+
},
|
3190
|
+
{
|
3191
|
+
name: 'Georgia',
|
3192
|
+
dialCode: '+995',
|
3193
|
+
code: 'GE'
|
3194
|
+
},
|
3195
|
+
{
|
3196
|
+
name: 'Germany',
|
3197
|
+
dialCode: '+49',
|
3198
|
+
code: 'DE'
|
3199
|
+
},
|
3200
|
+
{
|
3201
|
+
name: 'Ghana',
|
3202
|
+
dialCode: '+233',
|
3203
|
+
code: 'GH'
|
3204
|
+
},
|
3205
|
+
{
|
3206
|
+
name: 'Gibraltar',
|
3207
|
+
dialCode: '+350',
|
3208
|
+
code: 'GI'
|
3209
|
+
},
|
3210
|
+
{
|
3211
|
+
name: 'Greece',
|
3212
|
+
dialCode: '+30',
|
3213
|
+
code: 'GR'
|
3214
|
+
},
|
3215
|
+
{
|
3216
|
+
name: 'Greenland',
|
3217
|
+
dialCode: '+299',
|
3218
|
+
code: 'GL'
|
3219
|
+
},
|
3220
|
+
{
|
3221
|
+
name: 'Grenada',
|
3222
|
+
dialCode: '+1473',
|
3223
|
+
code: 'GD'
|
3224
|
+
},
|
3225
|
+
{
|
3226
|
+
name: 'Guadeloupe',
|
3227
|
+
dialCode: '+590',
|
3228
|
+
code: 'GP'
|
3229
|
+
},
|
3230
|
+
{
|
3231
|
+
name: 'Guam',
|
3232
|
+
dialCode: '+1671',
|
3233
|
+
code: 'GU'
|
3234
|
+
},
|
3235
|
+
{
|
3236
|
+
name: 'Guatemala',
|
3237
|
+
dialCode: '+502',
|
3238
|
+
code: 'GT'
|
3239
|
+
},
|
3240
|
+
{
|
3241
|
+
name: 'Guernsey',
|
3242
|
+
dialCode: '+44',
|
3243
|
+
code: 'GG'
|
3244
|
+
},
|
3245
|
+
{
|
3246
|
+
name: 'Guinea',
|
3247
|
+
dialCode: '+224',
|
3248
|
+
code: 'GN'
|
3249
|
+
},
|
3250
|
+
{
|
3251
|
+
name: 'Guinea-Bissau',
|
3252
|
+
dialCode: '+245',
|
3253
|
+
code: 'GW'
|
3254
|
+
},
|
3255
|
+
{
|
3256
|
+
name: 'Guyana',
|
3257
|
+
dialCode: '+595',
|
3258
|
+
code: 'GY'
|
3259
|
+
},
|
3260
|
+
{
|
3261
|
+
name: 'Haiti',
|
3262
|
+
dialCode: '+509',
|
3263
|
+
code: 'HT'
|
3264
|
+
},
|
3265
|
+
{
|
3266
|
+
name: 'Holy See (Vatican City State)',
|
3267
|
+
dialCode: '+379',
|
3268
|
+
code: 'VA'
|
3269
|
+
},
|
3270
|
+
{
|
3271
|
+
name: 'Honduras',
|
3272
|
+
dialCode: '+504',
|
3273
|
+
code: 'HN'
|
3274
|
+
},
|
3275
|
+
{
|
3276
|
+
name: 'Hong Kong',
|
3277
|
+
dialCode: '+852',
|
3278
|
+
code: 'HK'
|
3279
|
+
},
|
3280
|
+
{
|
3281
|
+
name: 'Hungary',
|
3282
|
+
dialCode: '+36',
|
3283
|
+
code: 'HU'
|
3284
|
+
},
|
3285
|
+
{
|
3286
|
+
name: 'Iceland',
|
3287
|
+
dialCode: '+354',
|
3288
|
+
code: 'IS'
|
3289
|
+
},
|
3290
|
+
{
|
3291
|
+
name: 'India',
|
3292
|
+
dialCode: '+91',
|
3293
|
+
code: 'IN'
|
3294
|
+
},
|
3295
|
+
{
|
3296
|
+
name: 'Indonesia',
|
3297
|
+
dialCode: '+62',
|
3298
|
+
code: 'ID'
|
3299
|
+
},
|
3300
|
+
{
|
3301
|
+
name: 'Iran, Islamic Republic of Persian Gulf',
|
3302
|
+
dialCode: '+98',
|
3303
|
+
code: 'IR'
|
3304
|
+
},
|
3305
|
+
{
|
3306
|
+
name: 'Iraq',
|
3307
|
+
dialCode: '+964',
|
3308
|
+
code: 'IQ'
|
3309
|
+
},
|
3310
|
+
{
|
3311
|
+
name: 'Ireland',
|
3312
|
+
dialCode: '+353',
|
3313
|
+
code: 'IE'
|
3314
|
+
},
|
3315
|
+
{
|
3316
|
+
name: 'Isle of Man',
|
3317
|
+
dialCode: '+44',
|
3318
|
+
code: 'IM'
|
3319
|
+
},
|
3320
|
+
{
|
3321
|
+
name: 'Israel',
|
3322
|
+
dialCode: '+972',
|
3323
|
+
code: 'IL'
|
3324
|
+
},
|
3325
|
+
{
|
3326
|
+
name: 'Italy',
|
3327
|
+
dialCode: '+39',
|
3328
|
+
code: 'IT'
|
3329
|
+
},
|
3330
|
+
{
|
3331
|
+
name: 'Jamaica',
|
3332
|
+
dialCode: '+1876',
|
3333
|
+
code: 'JM'
|
3334
|
+
},
|
3335
|
+
{
|
3336
|
+
name: 'Japan',
|
3337
|
+
dialCode: '+81',
|
3338
|
+
code: 'JP'
|
3339
|
+
},
|
3340
|
+
{
|
3341
|
+
name: 'Jersey',
|
3342
|
+
dialCode: '+44',
|
3343
|
+
code: 'JE'
|
3344
|
+
},
|
3345
|
+
{
|
3346
|
+
name: 'Jordan',
|
3347
|
+
dialCode: '+962',
|
3348
|
+
code: 'JO'
|
3349
|
+
},
|
3350
|
+
{
|
3351
|
+
name: 'Kazakhstan',
|
3352
|
+
dialCode: '+77',
|
3353
|
+
code: 'KZ'
|
3354
|
+
},
|
3355
|
+
{
|
3356
|
+
name: 'Kenya',
|
3357
|
+
dialCode: '+254',
|
3358
|
+
code: 'KE'
|
3359
|
+
},
|
3360
|
+
{
|
3361
|
+
name: 'Kiribati',
|
3362
|
+
dialCode: '+686',
|
3363
|
+
code: 'KI'
|
3364
|
+
},
|
3365
|
+
{
|
3366
|
+
name: "Korea, Democratic People's Republic of Korea",
|
3367
|
+
dialCode: '+850',
|
3368
|
+
code: 'KP'
|
3369
|
+
},
|
3370
|
+
{
|
3371
|
+
name: 'Korea, Republic of South Korea',
|
3372
|
+
dialCode: '+82',
|
3373
|
+
code: 'KR'
|
3374
|
+
},
|
3375
|
+
{
|
3376
|
+
name: 'Kuwait',
|
3377
|
+
dialCode: '+965',
|
3378
|
+
code: 'KW'
|
3379
|
+
},
|
3380
|
+
{
|
3381
|
+
name: 'Kyrgyzstan',
|
3382
|
+
dialCode: '+996',
|
3383
|
+
code: 'KG'
|
3384
|
+
},
|
3385
|
+
{
|
3386
|
+
name: 'Laos',
|
3387
|
+
dialCode: '+856',
|
3388
|
+
code: 'LA'
|
3389
|
+
},
|
3390
|
+
{
|
3391
|
+
name: 'Latvia',
|
3392
|
+
dialCode: '+371',
|
3393
|
+
code: 'LV'
|
3394
|
+
},
|
3395
|
+
{
|
3396
|
+
name: 'Lebanon',
|
3397
|
+
dialCode: '+961',
|
3398
|
+
code: 'LB'
|
3399
|
+
},
|
3400
|
+
{
|
3401
|
+
name: 'Lesotho',
|
3402
|
+
dialCode: '+266',
|
3403
|
+
code: 'LS'
|
3404
|
+
},
|
3405
|
+
{
|
3406
|
+
name: 'Liberia',
|
3407
|
+
dialCode: '+231',
|
3408
|
+
code: 'LR'
|
3409
|
+
},
|
3410
|
+
{
|
3411
|
+
name: 'Libyan Arab Jamahiriya',
|
3412
|
+
dialCode: '+218',
|
3413
|
+
code: 'LY'
|
3414
|
+
},
|
3415
|
+
{
|
3416
|
+
name: 'Liechtenstein',
|
3417
|
+
dialCode: '+423',
|
3418
|
+
code: 'LI'
|
3419
|
+
},
|
3420
|
+
{
|
3421
|
+
name: 'Lithuania',
|
3422
|
+
dialCode: '+370',
|
3423
|
+
code: 'LT'
|
3424
|
+
},
|
3425
|
+
{
|
3426
|
+
name: 'Luxembourg',
|
3427
|
+
dialCode: '+352',
|
3428
|
+
code: 'LU'
|
3429
|
+
},
|
3430
|
+
{
|
3431
|
+
name: 'Macao',
|
3432
|
+
dialCode: '+853',
|
3433
|
+
code: 'MO'
|
3434
|
+
},
|
3435
|
+
{
|
3436
|
+
name: 'Macedonia',
|
3437
|
+
dialCode: '+389',
|
3438
|
+
code: 'MK'
|
3439
|
+
},
|
3440
|
+
{
|
3441
|
+
name: 'Madagascar',
|
3442
|
+
dialCode: '+261',
|
3443
|
+
code: 'MG'
|
3444
|
+
},
|
3445
|
+
{
|
3446
|
+
name: 'Malawi',
|
3447
|
+
dialCode: '+265',
|
3448
|
+
code: 'MW'
|
3449
|
+
},
|
3450
|
+
{
|
3451
|
+
name: 'Malaysia',
|
3452
|
+
dialCode: '+60',
|
3453
|
+
code: 'MY'
|
3454
|
+
},
|
3455
|
+
{
|
3456
|
+
name: 'Maldives',
|
3457
|
+
dialCode: '+960',
|
3458
|
+
code: 'MV'
|
3459
|
+
},
|
3460
|
+
{
|
3461
|
+
name: 'Mali',
|
3462
|
+
dialCode: '+223',
|
3463
|
+
code: 'ML'
|
3464
|
+
},
|
3465
|
+
{
|
3466
|
+
name: 'Malta',
|
3467
|
+
dialCode: '+356',
|
3468
|
+
code: 'MT'
|
3469
|
+
},
|
3470
|
+
{
|
3471
|
+
name: 'Marshall Islands',
|
3472
|
+
dialCode: '+692',
|
3473
|
+
code: 'MH'
|
3474
|
+
},
|
3475
|
+
{
|
3476
|
+
name: 'Martinique',
|
3477
|
+
dialCode: '+596',
|
3478
|
+
code: 'MQ'
|
3479
|
+
},
|
3480
|
+
{
|
3481
|
+
name: 'Mauritania',
|
3482
|
+
dialCode: '+222',
|
3483
|
+
code: 'MR'
|
3484
|
+
},
|
3485
|
+
{
|
3486
|
+
name: 'Mauritius',
|
3487
|
+
dialCode: '+230',
|
3488
|
+
code: 'MU'
|
3489
|
+
},
|
3490
|
+
{
|
3491
|
+
name: 'Mayotte',
|
3492
|
+
dialCode: '+262',
|
3493
|
+
code: 'YT'
|
3494
|
+
},
|
3495
|
+
{
|
3496
|
+
name: 'Mexico',
|
3497
|
+
dialCode: '+52',
|
3498
|
+
code: 'MX'
|
3499
|
+
},
|
3500
|
+
{
|
3501
|
+
name: 'Micronesia, Federated States of Micronesia',
|
3502
|
+
dialCode: '+691',
|
3503
|
+
code: 'FM'
|
3504
|
+
},
|
3505
|
+
{
|
3506
|
+
name: 'Moldova',
|
3507
|
+
dialCode: '+373',
|
3508
|
+
code: 'MD'
|
3509
|
+
},
|
3510
|
+
{
|
3511
|
+
name: 'Monaco',
|
3512
|
+
dialCode: '+377',
|
3513
|
+
code: 'MC'
|
3514
|
+
},
|
3515
|
+
{
|
3516
|
+
name: 'Mongolia',
|
3517
|
+
dialCode: '+976',
|
3518
|
+
code: 'MN'
|
3519
|
+
},
|
3520
|
+
{
|
3521
|
+
name: 'Montenegro',
|
3522
|
+
dialCode: '+382',
|
3523
|
+
code: 'ME'
|
3524
|
+
},
|
3525
|
+
{
|
3526
|
+
name: 'Montserrat',
|
3527
|
+
dialCode: '+1664',
|
3528
|
+
code: 'MS'
|
3529
|
+
},
|
3530
|
+
{
|
3531
|
+
name: 'Morocco',
|
3532
|
+
dialCode: '+212',
|
3533
|
+
code: 'MA'
|
3534
|
+
},
|
3535
|
+
{
|
3536
|
+
name: 'Mozambique',
|
3537
|
+
dialCode: '+258',
|
3538
|
+
code: 'MZ'
|
3539
|
+
},
|
3540
|
+
{
|
3541
|
+
name: 'Myanmar',
|
3542
|
+
dialCode: '+95',
|
3543
|
+
code: 'MM'
|
3544
|
+
},
|
3545
|
+
{
|
3546
|
+
name: 'Namibia',
|
3547
|
+
dialCode: '+264',
|
3548
|
+
code: 'NA'
|
3549
|
+
},
|
3550
|
+
{
|
3551
|
+
name: 'Nauru',
|
3552
|
+
dialCode: '+674',
|
3553
|
+
code: 'NR'
|
3554
|
+
},
|
3555
|
+
{
|
3556
|
+
name: 'Nepal',
|
3557
|
+
dialCode: '+977',
|
3558
|
+
code: 'NP'
|
3559
|
+
},
|
3560
|
+
{
|
3561
|
+
name: 'Netherlands',
|
3562
|
+
dialCode: '+31',
|
3563
|
+
code: 'NL'
|
3564
|
+
},
|
3565
|
+
{
|
3566
|
+
name: 'Netherlands Antilles',
|
3567
|
+
dialCode: '+599',
|
3568
|
+
code: 'AN'
|
3569
|
+
},
|
3570
|
+
{
|
3571
|
+
name: 'New Caledonia',
|
3572
|
+
dialCode: '+687',
|
3573
|
+
code: 'NC'
|
3574
|
+
},
|
3575
|
+
{
|
3576
|
+
name: 'New Zealand',
|
3577
|
+
dialCode: '+64',
|
3578
|
+
code: 'NZ'
|
3579
|
+
},
|
3580
|
+
{
|
3581
|
+
name: 'Nicaragua',
|
3582
|
+
dialCode: '+505',
|
3583
|
+
code: 'NI'
|
3584
|
+
},
|
3585
|
+
{
|
3586
|
+
name: 'Niger',
|
3587
|
+
dialCode: '+227',
|
3588
|
+
code: 'NE'
|
3589
|
+
},
|
3590
|
+
{
|
3591
|
+
name: 'Nigeria',
|
3592
|
+
dialCode: '+234',
|
3593
|
+
code: 'NG'
|
3594
|
+
},
|
3595
|
+
{
|
3596
|
+
name: 'Niue',
|
3597
|
+
dialCode: '+683',
|
3598
|
+
code: 'NU'
|
3599
|
+
},
|
3600
|
+
{
|
3601
|
+
name: 'Norfolk Island',
|
3602
|
+
dialCode: '+672',
|
3603
|
+
code: 'NF'
|
3604
|
+
},
|
3605
|
+
{
|
3606
|
+
name: 'Northern Mariana Islands',
|
3607
|
+
dialCode: '+1670',
|
3608
|
+
code: 'MP'
|
3609
|
+
},
|
3610
|
+
{
|
3611
|
+
name: 'Norway',
|
3612
|
+
dialCode: '+47',
|
3613
|
+
code: 'NO'
|
3614
|
+
},
|
3615
|
+
{
|
3616
|
+
name: 'Oman',
|
3617
|
+
dialCode: '+968',
|
3618
|
+
code: 'OM'
|
3619
|
+
},
|
3620
|
+
{
|
3621
|
+
name: 'Pakistan',
|
3622
|
+
dialCode: '+92',
|
3623
|
+
code: 'PK'
|
3624
|
+
},
|
3625
|
+
{
|
3626
|
+
name: 'Palau',
|
3627
|
+
dialCode: '+680',
|
3628
|
+
code: 'PW'
|
3629
|
+
},
|
3630
|
+
{
|
3631
|
+
name: 'Palestinian Territory, Occupied',
|
3632
|
+
dialCode: '+970',
|
3633
|
+
code: 'PS'
|
3634
|
+
},
|
3635
|
+
{
|
3636
|
+
name: 'Panama',
|
3637
|
+
dialCode: '+507',
|
3638
|
+
code: 'PA'
|
3639
|
+
},
|
3640
|
+
{
|
3641
|
+
name: 'Papua New Guinea',
|
3642
|
+
dialCode: '+675',
|
3643
|
+
code: 'PG'
|
3644
|
+
},
|
3645
|
+
{
|
3646
|
+
name: 'Paraguay',
|
3647
|
+
dialCode: '+595',
|
3648
|
+
code: 'PY'
|
3649
|
+
},
|
3650
|
+
{
|
3651
|
+
name: 'Peru',
|
3652
|
+
dialCode: '+51',
|
3653
|
+
code: 'PE'
|
3654
|
+
},
|
3655
|
+
{
|
3656
|
+
name: 'Philippines',
|
3657
|
+
dialCode: '+63',
|
3658
|
+
code: 'PH'
|
3659
|
+
},
|
3660
|
+
{
|
3661
|
+
name: 'Pitcairn',
|
3662
|
+
dialCode: '+872',
|
3663
|
+
code: 'PN'
|
3664
|
+
},
|
3665
|
+
{
|
3666
|
+
name: 'Poland',
|
3667
|
+
dialCode: '+48',
|
3668
|
+
code: 'PL'
|
3669
|
+
},
|
3670
|
+
{
|
3671
|
+
name: 'Portugal',
|
3672
|
+
dialCode: '+351',
|
3673
|
+
code: 'PT'
|
3674
|
+
},
|
3675
|
+
{
|
3676
|
+
name: 'Puerto Rico',
|
3677
|
+
dialCode: '+1939',
|
3678
|
+
code: 'PR'
|
3679
|
+
},
|
3680
|
+
{
|
3681
|
+
name: 'Qatar',
|
3682
|
+
dialCode: '+974',
|
3683
|
+
code: 'QA'
|
3684
|
+
},
|
3685
|
+
{
|
3686
|
+
name: 'Romania',
|
3687
|
+
dialCode: '+40',
|
3688
|
+
code: 'RO'
|
3689
|
+
},
|
3690
|
+
{
|
3691
|
+
name: 'Russia',
|
3692
|
+
dialCode: '+7',
|
3693
|
+
code: 'RU'
|
3694
|
+
},
|
3695
|
+
{
|
3696
|
+
name: 'Rwanda',
|
3697
|
+
dialCode: '+250',
|
3698
|
+
code: 'RW'
|
3699
|
+
},
|
3700
|
+
{
|
3701
|
+
name: 'Reunion',
|
3702
|
+
dialCode: '+262',
|
3703
|
+
code: 'RE'
|
3704
|
+
},
|
3705
|
+
{
|
3706
|
+
name: 'Saint Barthelemy',
|
3707
|
+
dialCode: '+590',
|
3708
|
+
code: 'BL'
|
3709
|
+
},
|
3710
|
+
{
|
3711
|
+
name: 'Saint Helena, Ascension and Tristan Da Cunha',
|
3712
|
+
dialCode: '+290',
|
3713
|
+
code: 'SH'
|
3714
|
+
},
|
3715
|
+
{
|
3716
|
+
name: 'Saint Kitts and Nevis',
|
3717
|
+
dialCode: '+1869',
|
3718
|
+
code: 'KN'
|
3719
|
+
},
|
3720
|
+
{
|
3721
|
+
name: 'Saint Lucia',
|
3722
|
+
dialCode: '+1758',
|
3723
|
+
code: 'LC'
|
3724
|
+
},
|
3725
|
+
{
|
3726
|
+
name: 'Saint Martin',
|
3727
|
+
dialCode: '+590',
|
3728
|
+
code: 'MF'
|
3729
|
+
},
|
3730
|
+
{
|
3731
|
+
name: 'Saint Pierre and Miquelon',
|
3732
|
+
dialCode: '+508',
|
3733
|
+
code: 'PM'
|
3734
|
+
},
|
3735
|
+
{
|
3736
|
+
name: 'Saint Vincent and the Grenadines',
|
3737
|
+
dialCode: '+1784',
|
3738
|
+
code: 'VC'
|
3739
|
+
},
|
3740
|
+
{
|
3741
|
+
name: 'Samoa',
|
3742
|
+
dialCode: '+685',
|
3743
|
+
code: 'WS'
|
3744
|
+
},
|
3745
|
+
{
|
3746
|
+
name: 'San Marino',
|
3747
|
+
dialCode: '+378',
|
3748
|
+
code: 'SM'
|
3749
|
+
},
|
3750
|
+
{
|
3751
|
+
name: 'Sao Tome and Principe',
|
3752
|
+
dialCode: '+239',
|
3753
|
+
code: 'ST'
|
3754
|
+
},
|
3755
|
+
{
|
3756
|
+
name: 'Saudi Arabia',
|
3757
|
+
dialCode: '+966',
|
3758
|
+
code: 'SA'
|
3759
|
+
},
|
3760
|
+
{
|
3761
|
+
name: 'Senegal',
|
3762
|
+
dialCode: '+221',
|
3763
|
+
code: 'SN'
|
3764
|
+
},
|
3765
|
+
{
|
3766
|
+
name: 'Serbia',
|
3767
|
+
dialCode: '+381',
|
3768
|
+
code: 'RS'
|
3769
|
+
},
|
3770
|
+
{
|
3771
|
+
name: 'Seychelles',
|
3772
|
+
dialCode: '+248',
|
3773
|
+
code: 'SC'
|
3774
|
+
},
|
3775
|
+
{
|
3776
|
+
name: 'Sierra Leone',
|
3777
|
+
dialCode: '+232',
|
3778
|
+
code: 'SL'
|
3779
|
+
},
|
3780
|
+
{
|
3781
|
+
name: 'Singapore',
|
3782
|
+
dialCode: '+65',
|
3783
|
+
code: 'SG'
|
3784
|
+
},
|
3785
|
+
{
|
3786
|
+
name: 'Slovakia',
|
3787
|
+
dialCode: '+421',
|
3788
|
+
code: 'SK'
|
3789
|
+
},
|
3790
|
+
{
|
3791
|
+
name: 'Slovenia',
|
3792
|
+
dialCode: '+386',
|
3793
|
+
code: 'SI'
|
3794
|
+
},
|
3795
|
+
{
|
3796
|
+
name: 'Solomon Islands',
|
3797
|
+
dialCode: '+677',
|
3798
|
+
code: 'SB'
|
3799
|
+
},
|
3800
|
+
{
|
3801
|
+
name: 'Somalia',
|
3802
|
+
dialCode: '+252',
|
3803
|
+
code: 'SO'
|
3804
|
+
},
|
3805
|
+
{
|
3806
|
+
name: 'South Africa',
|
3807
|
+
dialCode: '+27',
|
3808
|
+
code: 'ZA'
|
3809
|
+
},
|
3810
|
+
{
|
3811
|
+
name: 'South Sudan',
|
3812
|
+
dialCode: '+211',
|
3813
|
+
code: 'SS'
|
3814
|
+
},
|
3815
|
+
{
|
3816
|
+
name: 'South Georgia and the South Sandwich Islands',
|
3817
|
+
dialCode: '+500',
|
3818
|
+
code: 'GS'
|
3819
|
+
},
|
3820
|
+
{
|
3821
|
+
name: 'Spain',
|
3822
|
+
dialCode: '+34',
|
3823
|
+
code: 'ES'
|
3824
|
+
},
|
3825
|
+
{
|
3826
|
+
name: 'Sri Lanka',
|
3827
|
+
dialCode: '+94',
|
3828
|
+
code: 'LK'
|
3829
|
+
},
|
3830
|
+
{
|
3831
|
+
name: 'Sudan',
|
3832
|
+
dialCode: '+249',
|
3833
|
+
code: 'SD'
|
3834
|
+
},
|
3835
|
+
{
|
3836
|
+
name: 'Suriname',
|
3837
|
+
dialCode: '+597',
|
3838
|
+
code: 'SR'
|
3839
|
+
},
|
3840
|
+
{
|
3841
|
+
name: 'Svalbard and Jan Mayen',
|
3842
|
+
dialCode: '+47',
|
3843
|
+
code: 'SJ'
|
3844
|
+
},
|
3845
|
+
{
|
3846
|
+
name: 'Swaziland',
|
3847
|
+
dialCode: '+268',
|
3848
|
+
code: 'SZ'
|
3849
|
+
},
|
3850
|
+
{
|
3851
|
+
name: 'Sweden',
|
3852
|
+
dialCode: '+46',
|
3853
|
+
code: 'SE'
|
3854
|
+
},
|
3855
|
+
{
|
3856
|
+
name: 'Switzerland',
|
3857
|
+
dialCode: '+41',
|
3858
|
+
code: 'CH'
|
3859
|
+
},
|
3860
|
+
{
|
3861
|
+
name: 'Syrian Arab Republic',
|
3862
|
+
dialCode: '+963',
|
3863
|
+
code: 'SY'
|
3864
|
+
},
|
3865
|
+
{
|
3866
|
+
name: 'Taiwan',
|
3867
|
+
dialCode: '+886',
|
3868
|
+
code: 'TW'
|
3869
|
+
},
|
3870
|
+
{
|
3871
|
+
name: 'Tajikistan',
|
3872
|
+
dialCode: '+992',
|
3873
|
+
code: 'TJ'
|
3874
|
+
},
|
3875
|
+
{
|
3876
|
+
name: 'Tanzania, United Republic of Tanzania',
|
3877
|
+
dialCode: '+255',
|
3878
|
+
code: 'TZ'
|
3879
|
+
},
|
3880
|
+
{
|
3881
|
+
name: 'Thailand',
|
3882
|
+
dialCode: '+66',
|
3883
|
+
code: 'TH'
|
3884
|
+
},
|
3885
|
+
{
|
3886
|
+
name: 'Timor-Leste',
|
3887
|
+
dialCode: '+670',
|
3888
|
+
code: 'TL'
|
3889
|
+
},
|
3890
|
+
{
|
3891
|
+
name: 'Togo',
|
3892
|
+
dialCode: '+228',
|
3893
|
+
code: 'TG'
|
3894
|
+
},
|
3895
|
+
{
|
3896
|
+
name: 'Tokelau',
|
3897
|
+
dialCode: '+690',
|
3898
|
+
code: 'TK'
|
3899
|
+
},
|
3900
|
+
{
|
3901
|
+
name: 'Tonga',
|
3902
|
+
dialCode: '+676',
|
3903
|
+
code: 'TO'
|
3904
|
+
},
|
3905
|
+
{
|
3906
|
+
name: 'Trinidad and Tobago',
|
3907
|
+
dialCode: '+1868',
|
3908
|
+
code: 'TT'
|
3909
|
+
},
|
3910
|
+
{
|
3911
|
+
name: 'Tunisia',
|
3912
|
+
dialCode: '+216',
|
3913
|
+
code: 'TN'
|
3914
|
+
},
|
3915
|
+
{
|
3916
|
+
name: 'Turkey',
|
3917
|
+
dialCode: '+90',
|
3918
|
+
code: 'TR'
|
3919
|
+
},
|
3920
|
+
{
|
3921
|
+
name: 'Turkmenistan',
|
3922
|
+
dialCode: '+993',
|
3923
|
+
code: 'TM'
|
3924
|
+
},
|
3925
|
+
{
|
3926
|
+
name: 'Turks and Caicos Islands',
|
3927
|
+
dialCode: '+1649',
|
3928
|
+
code: 'TC'
|
3929
|
+
},
|
3930
|
+
{
|
3931
|
+
name: 'Tuvalu',
|
3932
|
+
dialCode: '+688',
|
3933
|
+
code: 'TV'
|
3934
|
+
},
|
3935
|
+
{
|
3936
|
+
name: 'Uganda',
|
3937
|
+
dialCode: '+256',
|
3938
|
+
code: 'UG'
|
3939
|
+
},
|
3940
|
+
{
|
3941
|
+
name: 'Ukraine',
|
3942
|
+
dialCode: '+380',
|
3943
|
+
code: 'UA'
|
3944
|
+
},
|
3945
|
+
{
|
3946
|
+
name: 'United Arab Emirates',
|
3947
|
+
dialCode: '+971',
|
3948
|
+
code: 'AE'
|
3949
|
+
},
|
3950
|
+
{
|
3951
|
+
name: 'United Kingdom',
|
3952
|
+
dialCode: '+44',
|
3953
|
+
code: 'GB'
|
3954
|
+
},
|
3955
|
+
{
|
3956
|
+
name: 'United States',
|
3957
|
+
dialCode: '+1',
|
3958
|
+
code: 'US'
|
3959
|
+
},
|
3960
|
+
{
|
3961
|
+
name: 'Uruguay',
|
3962
|
+
dialCode: '+598',
|
3963
|
+
code: 'UY'
|
3964
|
+
},
|
3965
|
+
{
|
3966
|
+
name: 'Uzbekistan',
|
3967
|
+
dialCode: '+998',
|
3968
|
+
code: 'UZ'
|
3969
|
+
},
|
3970
|
+
{
|
3971
|
+
name: 'Vanuatu',
|
3972
|
+
dialCode: '+678',
|
3973
|
+
code: 'VU'
|
3974
|
+
},
|
3975
|
+
{
|
3976
|
+
name: 'Venezuela, Bolivarian Republic of Venezuela',
|
3977
|
+
dialCode: '+58',
|
3978
|
+
code: 'VE'
|
3979
|
+
},
|
3980
|
+
{
|
3981
|
+
name: 'Vietnam',
|
3982
|
+
dialCode: '+84',
|
3983
|
+
code: 'VN'
|
3984
|
+
},
|
3985
|
+
{
|
3986
|
+
name: 'Virgin Islands, British',
|
3987
|
+
dialCode: '+1284',
|
3988
|
+
code: 'VG'
|
3989
|
+
},
|
3990
|
+
{
|
3991
|
+
name: 'Virgin Islands, U.S.',
|
3992
|
+
dialCode: '+1340',
|
3993
|
+
code: 'VI'
|
3994
|
+
},
|
3995
|
+
{
|
3996
|
+
name: 'Wallis and Futuna',
|
3997
|
+
dialCode: '+681',
|
3998
|
+
code: 'WF'
|
3999
|
+
},
|
4000
|
+
{
|
4001
|
+
name: 'Yemen',
|
4002
|
+
dialCode: '+967',
|
4003
|
+
code: 'YE'
|
4004
|
+
},
|
4005
|
+
{
|
4006
|
+
name: 'Zambia',
|
4007
|
+
dialCode: '+260',
|
4008
|
+
code: 'ZM'
|
4009
|
+
},
|
4010
|
+
{
|
4011
|
+
name: 'Zimbabwe',
|
4012
|
+
dialCode: '+263',
|
4013
|
+
code: 'ZW'
|
4014
|
+
}
|
4015
|
+
].sort((a, b) => (a.name < b.name ? -1 : 1));
|
4016
|
+
|
4017
|
+
const componentName$4 = getComponentName('phone-field-internal');
|
4018
|
+
|
4019
|
+
createBaseInputClass({ componentName: componentName$4, baseSelector: 'div' });
|
4020
|
+
|
4021
|
+
const componentName$3 = getComponentName('combo-box');
|
4022
|
+
|
4023
|
+
|
4024
|
+
const ComboBoxMixin = (superclass) => class ComboBoxMixinClass extends superclass {
|
4025
|
+
constructor() {
|
4026
|
+
super();
|
4027
|
+
}
|
4028
|
+
|
4029
|
+
// vaadin api is to set props on their combo box node,
|
4030
|
+
// in order to avoid it, we are passing the children of this component
|
4031
|
+
// to the items & renderer props, so it will be used as the combo box items
|
4032
|
+
#onChildrenChange() {
|
4033
|
+
const baseElement = this.shadowRoot.querySelector(this.baseSelector);
|
4034
|
+
const items = Array.from(this.children);
|
4035
|
+
|
4036
|
+
// we want the data-name attribute to be accessible as an object attribute
|
4037
|
+
if (items.length) {
|
4038
|
+
items.forEach((node) => {
|
4039
|
+
Object.defineProperty(node, 'data-name', {
|
4040
|
+
value: node.getAttribute('data-name'),
|
4041
|
+
});
|
4042
|
+
Object.defineProperty(node, 'data-id', {
|
4043
|
+
value: node.getAttribute('data-id')
|
4044
|
+
});
|
4045
|
+
});
|
4046
|
+
|
4047
|
+
baseElement.items = items;
|
4048
|
+
|
4049
|
+
baseElement.renderer = (root, combo, model) => {
|
4050
|
+
root.innerHTML = model.item.outerHTML;
|
4051
|
+
};
|
4052
|
+
}
|
4053
|
+
}
|
4054
|
+
|
4055
|
+
// the default vaadin behavior is to attach the overlay to the body when opened
|
4056
|
+
// we do not want that because it's difficult to style the overlay in this way
|
4057
|
+
// so we override it to open inside the shadow DOM
|
4058
|
+
#overrideOverlaySettings() {
|
4059
|
+
const overlay = this.baseElement.shadowRoot.querySelector('vaadin-combo-box-overlay');
|
4060
|
+
|
4061
|
+
overlay._attachOverlay = function () { this.bringToFront(); };
|
4062
|
+
overlay._detachOverlay = function () { };
|
4063
|
+
overlay._enterModalState = function () { };
|
4064
|
+
}
|
4065
|
+
|
4066
|
+
init() {
|
4067
|
+
super.init?.();
|
4068
|
+
|
4069
|
+
this.#overrideOverlaySettings();
|
4070
|
+
observeChildren(this, this.#onChildrenChange.bind(this));
|
4071
|
+
}
|
4072
|
+
};
|
4073
|
+
|
4074
|
+
const {
|
4075
|
+
host: host$2,
|
4076
|
+
input,
|
4077
|
+
placeholder,
|
4078
|
+
toggle,
|
4079
|
+
label: label$1
|
4080
|
+
} = {
|
4081
|
+
host: { selector: () => ':host' },
|
4082
|
+
input: { selector: '::part(input-field)' },
|
4083
|
+
placeholder: { selector: '> input:placeholder-shown' },
|
4084
|
+
toggle: { selector: '::part(toggle-button)' },
|
4085
|
+
label: { selector: '::part(label)' }
|
4086
|
+
};
|
4087
|
+
|
4088
|
+
// const { slotted, selected } = {
|
4089
|
+
// slotted: { selector: () => '::slotted(*)' },
|
4090
|
+
// selected: { selector: () => '::slotted([selected])' }
|
4091
|
+
// }
|
4092
|
+
|
4093
|
+
const ComboBoxClass = compose(
|
4094
|
+
createStyleMixin({
|
4095
|
+
mappings: {
|
4096
|
+
width: host$2,
|
4097
|
+
height: input,
|
4098
|
+
padding: input,
|
4099
|
+
|
4100
|
+
inputBackgroundColor: { ...input, property: 'background-color' },
|
4101
|
+
boxShadow: input,
|
4102
|
+
|
4103
|
+
borderColor: input,
|
4104
|
+
borderWidth: input,
|
4105
|
+
borderStyle: input,
|
4106
|
+
borderRadius: input,
|
4107
|
+
|
4108
|
+
color: [label$1, input],
|
4109
|
+
|
4110
|
+
// we apply font-size also on the host so we can set its width with em
|
4111
|
+
fontSize: [{}, host$2],
|
4112
|
+
|
4113
|
+
placeholderColor: { ...placeholder, property: 'color' },
|
4114
|
+
|
4115
|
+
toggleCursor: { ...toggle, property: 'cursor' },
|
4116
|
+
toggleColor: { ...toggle, property: 'color' },
|
4117
|
+
|
4118
|
+
// we need to use the variables from the portal mixin
|
4119
|
+
// so we need to use an arrow function on the selector
|
4120
|
+
// for that to work, because ComboBox is not available
|
4121
|
+
// at this time.
|
4122
|
+
overlayBackground: { property: () => ComboBoxClass.cssVarList.overlay.backgroundColor },
|
4123
|
+
overlayBorder: { property: () => ComboBoxClass.cssVarList.overlay.border }
|
4124
|
+
}
|
4125
|
+
}),
|
4126
|
+
draggableMixin,
|
4127
|
+
portalMixin({
|
4128
|
+
name: 'overlay',
|
4129
|
+
selector: '',
|
4130
|
+
mappings: {
|
4131
|
+
backgroundColor: { selector: 'vaadin-combo-box-scroller' },
|
4132
|
+
// TODO: this mapping doesn't work, needs fixing.
|
4133
|
+
cursor: { selector: 'vaadin-combo-box-item' },
|
4134
|
+
},
|
4135
|
+
forward: {
|
4136
|
+
include: false,
|
4137
|
+
attributes: ['size']
|
4138
|
+
},
|
4139
|
+
}),
|
4140
|
+
proxyInputMixin,
|
4141
|
+
componentNameValidationMixin,
|
4142
|
+
ComboBoxMixin
|
4143
|
+
)(
|
4144
|
+
createProxy({
|
4145
|
+
slots: ['prefix'],
|
4146
|
+
wrappedEleName: 'vaadin-combo-box',
|
4147
|
+
style: () => `
|
4148
|
+
:host {
|
4149
|
+
display: inline-flex;
|
4150
|
+
box-sizing: border-box;
|
4151
|
+
-webkit-mask-image: none;
|
4152
|
+
}
|
4153
|
+
vaadin-combo-box {
|
4154
|
+
padding: 0;
|
4155
|
+
}
|
4156
|
+
vaadin-combo-box [slot="input"] {
|
4157
|
+
-webkit-mask-image: none;
|
4158
|
+
min-height: 0;
|
4159
|
+
}
|
4160
|
+
vaadin-combo-box::part(input-field) {
|
4161
|
+
-webkit-mask-image: none;
|
4162
|
+
border-radius: 0;
|
4163
|
+
padding: 0;
|
4164
|
+
}
|
4165
|
+
vaadin-combo-box::part(input-field)::after {
|
4166
|
+
opacity: 0;
|
4167
|
+
}
|
4168
|
+
vaadin-combo-box[readonly]::part(input-field)::after {
|
4169
|
+
border: none;
|
4170
|
+
}
|
4171
|
+
vaadin-combo-box[readonly] > input:placeholder-shown {
|
4172
|
+
opacity: 1;
|
4173
|
+
}
|
4174
|
+
`,
|
4175
|
+
// Note: we exclude `size` to avoid overriding Vaadin's ComboBox property
|
4176
|
+
// with the same name. Including it will cause Vaadin to calculate NaN size,
|
4177
|
+
// and reset items to an empty array, and opening the list box with no items
|
4178
|
+
// to display.
|
4179
|
+
excludeAttrsSync: ['tabindex', 'size'],
|
4180
|
+
componentName: componentName$3,
|
4181
|
+
includeForwardProps: ['items', 'renderer', 'selectedItem']
|
4182
|
+
})
|
4183
|
+
);
|
4184
|
+
|
4185
|
+
const textVars = TextFieldClass.cssVarList;
|
4186
|
+
const comboVars = ComboBoxClass.cssVarList;
|
4187
|
+
|
4188
|
+
const componentName$2 = getComponentName('phone-field');
|
4189
|
+
|
4190
|
+
const customMixin$1 = (superclass) =>
|
4191
|
+
class PhoneFieldMixinClass extends superclass {
|
4192
|
+
static get CountryCodes() {
|
4193
|
+
return CountryCodes;
|
4194
|
+
}
|
4195
|
+
|
4196
|
+
constructor() {
|
4197
|
+
super();
|
4198
|
+
}
|
4199
|
+
|
4200
|
+
init() {
|
4201
|
+
super.init?.();
|
4202
|
+
|
4203
|
+
const template = document.createElement('template');
|
4204
|
+
|
4205
|
+
template.innerHTML = `
|
4206
|
+
<${componentName$4}
|
4207
|
+
tabindex="-1"
|
4208
|
+
slot="input"
|
4209
|
+
></${componentName$4}>
|
4210
|
+
`;
|
4211
|
+
|
4212
|
+
this.baseElement.appendChild(template.content.cloneNode(true));
|
4213
|
+
|
4214
|
+
this.inputElement = this.shadowRoot.querySelector(componentName$4);
|
4215
|
+
|
4216
|
+
forwardAttrs(this.shadowRoot.host, this.inputElement, {
|
4217
|
+
includeAttrs: [
|
4218
|
+
'size',
|
4219
|
+
'bordered',
|
4220
|
+
'invalid',
|
4221
|
+
'minlength',
|
4222
|
+
'maxlength',
|
4223
|
+
'default-code',
|
4224
|
+
'country-input-placeholder',
|
4225
|
+
'phone-input-placeholder',
|
4226
|
+
]
|
4227
|
+
});
|
4228
|
+
}
|
4229
|
+
};
|
4230
|
+
|
4231
|
+
const {
|
4232
|
+
host: host$1,
|
4233
|
+
inputWrapper,
|
4234
|
+
countryCodeInput,
|
4235
|
+
phoneInput,
|
4236
|
+
label,
|
4237
|
+
requiredIndicator,
|
4238
|
+
separator
|
4239
|
+
} = {
|
4240
|
+
host: { selector: () => ':host' },
|
4241
|
+
inputWrapper: { selector: '::part(input-field)' },
|
4242
|
+
phoneInput: { selector: () => 'descope-text-field' },
|
4243
|
+
countryCodeInput: { selector: () => 'descope-combo-box' },
|
4244
|
+
label: { selector: '::part(label)' },
|
4245
|
+
requiredIndicator: { selector: '[required]::part(required-indicator)::after' },
|
4246
|
+
separator: { selector: 'descope-phone-field-internal .separator' }
|
4247
|
+
};
|
4248
|
+
|
4249
|
+
const PhoneFieldClass = compose(
|
4250
|
+
createStyleMixin({
|
4251
|
+
mappings: {
|
4252
|
+
fontSize: [
|
4253
|
+
host$1, inputWrapper,
|
4254
|
+
{
|
4255
|
+
selector: TextFieldClass.componentName,
|
4256
|
+
property: TextFieldClass.cssVarList.fontSize
|
4257
|
+
},
|
4258
|
+
{
|
4259
|
+
selector: ComboBoxClass.componentName,
|
4260
|
+
property: ComboBoxClass.cssVarList.fontSize
|
4261
|
+
}
|
4262
|
+
],
|
4263
|
+
|
4264
|
+
componentWidth: { ...host$1, property: 'width' },
|
4265
|
+
|
4266
|
+
wrapperBorderStyle: [
|
4267
|
+
{ ...inputWrapper, property: 'border-style' },
|
4268
|
+
{ ...separator, property: 'border-left-style' }
|
4269
|
+
],
|
4270
|
+
wrapperBorderWidth: [
|
4271
|
+
{ ...inputWrapper, property: 'border-width' },
|
4272
|
+
{ ...separator, property: 'border-left-width' }
|
4273
|
+
],
|
4274
|
+
wrapperBorderColor: [
|
4275
|
+
{ ...inputWrapper, property: 'border-color' },
|
4276
|
+
{ ...separator, property: 'border-left-color' }
|
4277
|
+
],
|
4278
|
+
wrapperBorderRadius: { ...inputWrapper, property: 'border-radius' },
|
4279
|
+
|
4280
|
+
inputHeight: { ...inputWrapper, property: 'height' },
|
4281
|
+
|
4282
|
+
countryCodeInputWidth: { ...countryCodeInput, property: comboVars.width },
|
4283
|
+
countryCodeDropdownWidth: {
|
4284
|
+
...countryCodeInput,
|
4285
|
+
property: '--vaadin-combo-box-overlay-width'
|
4286
|
+
},
|
4287
|
+
|
4288
|
+
phoneInputWidth: { ...phoneInput, property: 'width' },
|
4289
|
+
|
4290
|
+
color: [
|
4291
|
+
label,
|
4292
|
+
requiredIndicator,
|
4293
|
+
{ ...phoneInput, property: textVars.color },
|
4294
|
+
{ ...countryCodeInput, property: comboVars.color }
|
4295
|
+
],
|
4296
|
+
|
4297
|
+
placeholderColor: {
|
4298
|
+
...phoneInput,
|
4299
|
+
property: textVars.placeholderColor
|
4300
|
+
},
|
4301
|
+
|
4302
|
+
overlayItemBackgroundColor: {
|
4303
|
+
selector: 'descope-combo-box',
|
4304
|
+
property: comboVars.overlayItemBackgroundColor
|
4305
|
+
},
|
4306
|
+
|
4307
|
+
outlineStyle: inputWrapper,
|
4308
|
+
outlineWidth: [inputWrapper, { property: 'padding' }],
|
4309
|
+
outlineColor: inputWrapper,
|
4310
|
+
},
|
4311
|
+
}),
|
4312
|
+
draggableMixin,
|
4313
|
+
proxyInputMixin,
|
4314
|
+
customMixin$1,
|
4315
|
+
)(
|
4316
|
+
createProxy({
|
4317
|
+
slots: [],
|
4318
|
+
wrappedEleName: 'vaadin-text-field',
|
4319
|
+
style: () => `
|
4320
|
+
:host {
|
4321
|
+
--vaadin-field-default-width: auto;
|
4322
|
+
display: inline-block;
|
4323
|
+
max-width: 100%;
|
4324
|
+
min-width: 15em;
|
4325
|
+
}
|
4326
|
+
div {
|
4327
|
+
display: inline-flex;
|
4328
|
+
}
|
4329
|
+
vaadin-text-field {
|
4330
|
+
width: 100%;
|
4331
|
+
height: 100%;
|
4332
|
+
box-sizing: border-box;
|
4333
|
+
}
|
4334
|
+
vaadin-text-field[focus-ring]::part(input-field) {
|
4335
|
+
box-shadow: none;
|
4336
|
+
}
|
4337
|
+
vaadin-text-field::before {
|
4338
|
+
height: 0;
|
4339
|
+
}
|
4340
|
+
vaadin-text-field::part(input-field) {
|
4341
|
+
padding: 0;
|
4342
|
+
min-height: 0;
|
4343
|
+
background: transparent;
|
4344
|
+
overflow: hidden;
|
4345
|
+
}
|
4346
|
+
descope-phone-field-internal {
|
4347
|
+
-webkit-mask-image: none;
|
4348
|
+
padding: 0;
|
4349
|
+
min-height: 0;
|
4350
|
+
width: 100%;
|
4351
|
+
height: 100%;
|
4352
|
+
}
|
4353
|
+
descope-phone-field-internal > div {
|
4354
|
+
width: 100%;
|
4355
|
+
height: 100%;
|
4356
|
+
}
|
4357
|
+
descope-phone-field-internal .separator {
|
4358
|
+
flex: 0;
|
4359
|
+
border: none;
|
4360
|
+
}
|
4361
|
+
descope-combo-box {
|
4362
|
+
flex-shrink: 0;
|
4363
|
+
height: 100%;
|
4364
|
+
${comboVars.borderWidth}: 0;
|
4365
|
+
}
|
4366
|
+
descope-text-field {
|
4367
|
+
flex-grow: 1;
|
4368
|
+
min-height: 0;
|
4369
|
+
height: 100%;
|
4370
|
+
${textVars.outlineWidth}: 0;
|
4371
|
+
${textVars.borderWidth}: 0;
|
4372
|
+
${textVars.borderRadius}: 0;
|
4373
|
+
}
|
4374
|
+
vaadin-text-field[required]::part(required-indicator)::after {
|
4375
|
+
content: "*";
|
4376
|
+
}
|
4377
|
+
vaadin-text-field[readonly] > input:placeholder-shown {
|
4378
|
+
opacity: 1;
|
4379
|
+
}
|
4380
|
+
vaadin-text-field::part(input-field)::after {
|
4381
|
+
border: none;
|
4382
|
+
}
|
4383
|
+
`,
|
4384
|
+
excludeAttrsSync: ['tabindex'],
|
4385
|
+
componentName: componentName$2
|
4386
|
+
})
|
4387
|
+
);
|
4388
|
+
|
4389
|
+
const componentName$1 = getComponentName('new-password-internal');
|
4390
|
+
|
4391
|
+
const componentName = getComponentName('new-password');
|
4392
|
+
|
4393
|
+
const customMixin = (superclass) =>
|
4394
|
+
class NewPasswordMixinClass extends superclass {
|
4395
|
+
constructor() {
|
4396
|
+
super();
|
4397
|
+
}
|
4398
|
+
|
4399
|
+
init() {
|
4400
|
+
super.init?.();
|
4401
|
+
|
4402
|
+
const template = document.createElement('template');
|
4403
|
+
|
4404
|
+
template.innerHTML = `
|
4405
|
+
<${componentName$1}
|
4406
|
+
name="new-password"
|
4407
|
+
tabindex="-1"
|
4408
|
+
slot="input"
|
4409
|
+
></${componentName$1}>
|
4410
|
+
`;
|
4411
|
+
|
4412
|
+
this.baseElement.appendChild(template.content.cloneNode(true));
|
4413
|
+
|
4414
|
+
this.inputElement = this.shadowRoot.querySelector(componentName$1);
|
4415
|
+
|
4416
|
+
forwardAttrs(this, this.inputElement, {
|
4417
|
+
includeAttrs: [
|
4418
|
+
'password-label',
|
4419
|
+
'password-placeholder',
|
4420
|
+
'confirm-label',
|
4421
|
+
'confirm-placeholder',
|
4422
|
+
'full-width',
|
4423
|
+
'size',
|
4424
|
+
'bordered',
|
4425
|
+
'label',
|
4426
|
+
'has-confirm',
|
4427
|
+
'invalid',
|
4428
|
+
'readonly',
|
4429
|
+
'draggable'
|
4430
|
+
]
|
4431
|
+
});
|
4432
|
+
}
|
4433
|
+
};
|
4434
|
+
|
4435
|
+
const { host, internalInputsWrapper } = {
|
4436
|
+
host: { selector: () => ':host' },
|
4437
|
+
internalInputsWrapper: { selector: 'descope-new-password-internal .wrapper' }
|
4438
|
+
};
|
4439
|
+
|
4440
|
+
const NewPasswordClass = compose(
|
4441
|
+
createStyleMixin({
|
4442
|
+
mappings: {
|
4443
|
+
fontSize: [
|
4444
|
+
host,
|
4445
|
+
{
|
4446
|
+
selector: PasswordFieldClass.componentName,
|
4447
|
+
property: PasswordFieldClass.cssVarList.fontSize
|
4448
|
+
}
|
4449
|
+
],
|
4450
|
+
componentWidth: { ...host, property: 'width' },
|
4451
|
+
requiredContent: { ...host, property: 'content' },
|
4452
|
+
inputsGap: { ...internalInputsWrapper, property: 'gap' },
|
4453
|
+
}
|
4454
|
+
}),
|
4455
|
+
draggableMixin,
|
4456
|
+
proxyInputMixin,
|
4457
|
+
customMixin,
|
4458
|
+
)(
|
4459
|
+
createProxy({
|
4460
|
+
slots: [],
|
4461
|
+
wrappedEleName: 'vaadin-text-field',
|
4462
|
+
style: () => overrides,
|
4463
|
+
excludeAttrsSync: ['tabindex'],
|
4464
|
+
componentName
|
4465
|
+
})
|
4466
|
+
);
|
4467
|
+
|
4468
|
+
const overrides = `
|
4469
|
+
:host {
|
4470
|
+
--vaadin-field-default-width: auto;
|
4471
|
+
display: inline-block;
|
4472
|
+
min-width: 10em;
|
4473
|
+
max-width: 100%;
|
4474
|
+
}
|
4475
|
+
vaadin-text-field {
|
4476
|
+
padding: 0;
|
4477
|
+
width: 100%;
|
4478
|
+
height: 100%;
|
4479
|
+
}
|
4480
|
+
vaadin-text-field::part(input-field) {
|
4481
|
+
min-height: 0;
|
4482
|
+
background: transparent;
|
4483
|
+
overflow: hidden;
|
4484
|
+
box-shadow: none;
|
4485
|
+
padding: 0;
|
4486
|
+
}
|
4487
|
+
vaadin-text-field::part(input-field)::after {
|
4488
|
+
background: transparent;
|
4489
|
+
opacity: 0;
|
4490
|
+
}
|
4491
|
+
descope-new-password-internal {
|
4492
|
+
-webkit-mask-image: none;
|
4493
|
+
min-height: 0;
|
4494
|
+
width: 100%;
|
4495
|
+
height: 100%;
|
4496
|
+
padding: 0;
|
4497
|
+
}
|
4498
|
+
descope-new-password-internal > .wrapper {
|
4499
|
+
width: 100%;
|
4500
|
+
height: 100%;
|
4501
|
+
display: flex;
|
4502
|
+
flex-direction: column;
|
4503
|
+
}
|
4504
|
+
descope-password-field {
|
4505
|
+
display: block;
|
4506
|
+
width: 100%;
|
4507
|
+
}
|
4508
|
+
descope-new-password-internal vaadin-password-field::before {
|
4509
|
+
height: initial;
|
4510
|
+
}
|
4511
|
+
`;
|
4512
|
+
|
4513
|
+
exports.ButtonClass = ButtonClass;
|
4514
|
+
exports.CheckboxClass = CheckboxClass;
|
4515
|
+
exports.ContainerClass = ContainerClass;
|
4516
|
+
exports.DividerClass = DividerClass;
|
4517
|
+
exports.EmailFieldClass = EmailFieldClass;
|
4518
|
+
exports.ImageClass = ImageClass;
|
4519
|
+
exports.LinkClass = LinkClass;
|
4520
|
+
exports.LoaderLinearClass = LoaderLinearClass;
|
4521
|
+
exports.LoaderRadialClass = LoaderRadialClass;
|
4522
|
+
exports.LogoClass = LogoClass;
|
4523
|
+
exports.NewPasswordClass = NewPasswordClass;
|
4524
|
+
exports.NumberFieldClass = NumberFieldClass;
|
4525
|
+
exports.PasscodeClass = PasscodeClass;
|
4526
|
+
exports.PasswordFieldClass = PasswordFieldClass;
|
4527
|
+
exports.PhoneFieldClass = PhoneFieldClass;
|
4528
|
+
exports.SwitchToggleClass = SwitchToggleClass;
|
4529
|
+
exports.TextAreaClass = TextAreaClass;
|
4530
|
+
exports.TextClass = TextClass;
|
4531
|
+
exports.TextFieldClass = TextFieldClass;
|
225
4532
|
exports.componentsThemeManager = componentsThemeManager;
|
226
4533
|
exports.createComponentsTheme = createComponentsTheme;
|
227
4534
|
exports.createHelperVars = createHelperVars;
|
4535
|
+
exports.genColor = genColor;
|
4536
|
+
exports.genColors = genColors;
|
228
4537
|
exports.getThemeRefs = getThemeRefs;
|
229
4538
|
exports.globalsThemeToStyle = globalsThemeToStyle;
|
230
4539
|
exports.themeToCSSVarsObj = themeToCSSVarsObj;
|