@everymatrix/general-registration 1.21.1 → 1.21.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/checkbox-group-input_13.cjs.entry.js +36089 -20728
- package/dist/components/active-mixin.js +97 -7
- package/dist/components/checkbox-group-input2.js +4169 -496
- package/dist/components/date-input2.js +8052 -3274
- package/dist/components/field-mixin.js +1879 -3982
- package/dist/components/input-field-shared-styles.js +1347 -327
- package/dist/components/password-input2.js +3860 -288
- package/dist/components/vaadin-button.js +2088 -228
- package/dist/components/vaadin-combo-box.js +4117 -809
- package/dist/components/virtual-keyboard-controller.js +1056 -1816
- package/dist/esm/checkbox-group-input_13.entry.js +36089 -20728
- package/dist/general-registration/general-registration.esm.js +1 -1
- package/dist/general-registration/p-d90b8853.entry.js +8627 -0
- package/package.json +6 -6
- package/dist/components/pattern-mixin.js +0 -85
- package/dist/general-registration/p-7cae0c34.entry.js +0 -3584
|
@@ -1,364 +1,3561 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
1
|
+
import { proxyCustomElement, HTMLElement as HTMLElement$1, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { t as translate, a as tooltipIconSvg } from './tooltipIcon.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { P as PatternMixin } from './pattern-mixin.js';
|
|
3
|
+
import { a as InputControlMixin, i as inputFieldShared$2 } from './input-field-shared-styles.js';
|
|
4
|
+
import { o, i, u as usageStatistics, e as InputController, f as LabelledInputController, h as html, P as PolymerElement } from './field-mixin.js';
|
|
6
5
|
import { b as button, B as Button } from './vaadin-button.js';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* @license
|
|
10
|
-
* Copyright (c)
|
|
9
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
11
10
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
12
11
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
function defineCustomElement$2(CustomElement) {
|
|
13
|
+
const defined = customElements.get(CustomElement.is);
|
|
14
|
+
if (!defined) {
|
|
15
|
+
customElements.define(CustomElement.is, CustomElement);
|
|
16
|
+
} else {
|
|
17
|
+
const definedVersion = defined.version;
|
|
18
|
+
if (definedVersion && CustomElement.version && definedVersion === CustomElement.version) {
|
|
19
|
+
// Just loading the same thing again
|
|
20
|
+
console.warn(`The component ${CustomElement.is} has been loaded twice`);
|
|
21
|
+
} else {
|
|
22
|
+
console.error(
|
|
23
|
+
`Tried to define ${CustomElement.is} version ${CustomElement.version} when version ${defined.version} is already in use. Something will probably break.`,
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
17
28
|
|
|
18
29
|
/**
|
|
19
30
|
* @license
|
|
20
|
-
* Copyright (c)
|
|
31
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
21
32
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
22
33
|
*/
|
|
23
34
|
|
|
24
35
|
/**
|
|
25
|
-
*
|
|
36
|
+
* Dummy custom element used for collecting
|
|
37
|
+
* development time usage statistics.
|
|
26
38
|
*
|
|
39
|
+
* @private
|
|
40
|
+
*/
|
|
41
|
+
class Lumo$1 extends HTMLElement {
|
|
42
|
+
static get is() {
|
|
43
|
+
return 'vaadin-lumo-styles';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static get version() {
|
|
47
|
+
return '24.2.3';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
defineCustomElement$2(Lumo$1);
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @license
|
|
55
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
56
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
57
|
+
*/
|
|
58
|
+
/**
|
|
27
59
|
* @polymerMixin
|
|
28
|
-
* @mixes InputControlMixin
|
|
29
60
|
*/
|
|
30
|
-
const
|
|
31
|
-
class
|
|
61
|
+
const ThemePropertyMixin = (superClass) =>
|
|
62
|
+
class VaadinThemePropertyMixin extends superClass {
|
|
32
63
|
static get properties() {
|
|
33
64
|
return {
|
|
34
65
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
|
|
50
|
-
autocorrect: {
|
|
51
|
-
type: String,
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* This is a property supported by Safari and Chrome that is used to control whether
|
|
56
|
-
* autocapitalization should be enabled when the user is entering/editing the text.
|
|
57
|
-
* Possible values are:
|
|
58
|
-
* characters: Characters capitalization.
|
|
59
|
-
* words: Words capitalization.
|
|
60
|
-
* sentences: Sentences capitalization.
|
|
61
|
-
* none: No capitalization.
|
|
66
|
+
* Helper property with theme attribute value facilitating propagation
|
|
67
|
+
* in shadow DOM.
|
|
68
|
+
*
|
|
69
|
+
* Enables the component implementation to propagate the `theme`
|
|
70
|
+
* attribute value to the sub-components in Shadow DOM by binding
|
|
71
|
+
* the sub-component's "theme" attribute to the `theme` property of
|
|
72
|
+
* the host.
|
|
73
|
+
*
|
|
74
|
+
* **NOTE:** Extending the mixin only provides the property for binding,
|
|
75
|
+
* and does not make the propagation alone.
|
|
76
|
+
*
|
|
77
|
+
* See [Styling Components: Sub-components](https://vaadin.com/docs/latest/styling/styling-components/#sub-components).
|
|
78
|
+
* page for more information.
|
|
79
|
+
*
|
|
80
|
+
* @protected
|
|
62
81
|
*/
|
|
63
|
-
|
|
82
|
+
_theme: {
|
|
64
83
|
type: String,
|
|
65
|
-
|
|
84
|
+
readOnly: true,
|
|
66
85
|
},
|
|
67
86
|
};
|
|
68
87
|
}
|
|
69
88
|
|
|
70
|
-
static get
|
|
71
|
-
return [...super.
|
|
89
|
+
static get observedAttributes() {
|
|
90
|
+
return [...super.observedAttributes, 'theme'];
|
|
72
91
|
}
|
|
73
92
|
|
|
74
|
-
/**
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
* @override
|
|
78
|
-
*/
|
|
79
|
-
_inputElementChanged(input) {
|
|
80
|
-
super._inputElementChanged(input);
|
|
81
|
-
|
|
82
|
-
if (input) {
|
|
83
|
-
// Discard value set on the custom slotted input.
|
|
84
|
-
if (input.value && input.value !== this.value) {
|
|
85
|
-
console.warn(`Please define value on the <${this.localName}> component!`);
|
|
86
|
-
input.value = '';
|
|
87
|
-
}
|
|
93
|
+
/** @protected */
|
|
94
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
95
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
88
96
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
97
|
+
if (name === 'theme') {
|
|
98
|
+
this._set_theme(newValue);
|
|
92
99
|
}
|
|
93
100
|
}
|
|
101
|
+
};
|
|
94
102
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
103
|
+
/**
|
|
104
|
+
* @license
|
|
105
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
106
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @typedef {Object} Theme
|
|
111
|
+
* @property {string} themeFor
|
|
112
|
+
* @property {CSSResult[]} styles
|
|
113
|
+
* @property {string | string[]} [include]
|
|
114
|
+
* @property {string} [moduleId]
|
|
115
|
+
*
|
|
116
|
+
* @typedef {CSSResult[] | CSSResult} CSSResultGroup
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @type {Theme[]}
|
|
121
|
+
*/
|
|
122
|
+
const themeRegistry = [];
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Check if the custom element type has themes applied.
|
|
126
|
+
* @param {Function} elementClass
|
|
127
|
+
* @returns {boolean}
|
|
128
|
+
*/
|
|
129
|
+
function classHasThemes$1(elementClass) {
|
|
130
|
+
return elementClass && Object.prototype.hasOwnProperty.call(elementClass, '__themes');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Check if the custom element type has themes applied.
|
|
135
|
+
* @param {string} tagName
|
|
136
|
+
* @returns {boolean}
|
|
137
|
+
*/
|
|
138
|
+
function hasThemes$1(tagName) {
|
|
139
|
+
return classHasThemes$1(customElements.get(tagName));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Flattens the styles into a single array of styles.
|
|
144
|
+
* @param {CSSResultGroup} styles
|
|
145
|
+
* @param {CSSResult[]} result
|
|
146
|
+
* @returns {CSSResult[]}
|
|
147
|
+
*/
|
|
148
|
+
function flattenStyles$1(styles = []) {
|
|
149
|
+
return [styles].flat(Infinity).filter((style) => {
|
|
150
|
+
if (style instanceof o) {
|
|
151
|
+
return true;
|
|
98
152
|
}
|
|
153
|
+
console.warn('An item in styles is not of type CSSResult. Use `unsafeCSS` or `css`.');
|
|
154
|
+
return false;
|
|
155
|
+
});
|
|
156
|
+
}
|
|
99
157
|
|
|
100
|
-
|
|
101
|
-
|
|
158
|
+
/**
|
|
159
|
+
* Registers CSS styles for a component type. Make sure to register the styles before
|
|
160
|
+
* the first instance of a component of the type is attached to DOM.
|
|
161
|
+
*
|
|
162
|
+
* @param {string} themeFor The local/tag name of the component type to register the styles for
|
|
163
|
+
* @param {CSSResultGroup} styles The CSS style rules to be registered for the component type
|
|
164
|
+
* matching themeFor and included in the local scope of each component instance
|
|
165
|
+
* @param {{moduleId?: string, include?: string | string[]}} options Additional options
|
|
166
|
+
* @return {void}
|
|
167
|
+
*/
|
|
168
|
+
function registerStyles$1(themeFor, styles, options = {}) {
|
|
169
|
+
if (themeFor) {
|
|
170
|
+
if (hasThemes$1(themeFor)) {
|
|
171
|
+
console.warn(`The custom element definition for "${themeFor}"
|
|
172
|
+
was finalized before a style module was registered.
|
|
173
|
+
Make sure to add component specific style modules before
|
|
174
|
+
importing the corresponding custom element.`);
|
|
102
175
|
}
|
|
176
|
+
}
|
|
103
177
|
|
|
104
|
-
|
|
105
|
-
* Override an event listener from `FocusMixin`.
|
|
106
|
-
* @param {boolean} focused
|
|
107
|
-
* @protected
|
|
108
|
-
* @override
|
|
109
|
-
*/
|
|
110
|
-
_setFocused(focused) {
|
|
111
|
-
super._setFocused(focused);
|
|
178
|
+
styles = flattenStyles$1(styles);
|
|
112
179
|
|
|
113
|
-
|
|
114
|
-
|
|
180
|
+
if (window.Vaadin && window.Vaadin.styleModules) {
|
|
181
|
+
window.Vaadin.styleModules.registerStyles(themeFor, styles, options);
|
|
182
|
+
} else {
|
|
183
|
+
themeRegistry.push({
|
|
184
|
+
themeFor,
|
|
185
|
+
styles,
|
|
186
|
+
include: options.include,
|
|
187
|
+
moduleId: options.moduleId,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Returns all registered themes. By default the themeRegistry is returned as is.
|
|
194
|
+
* In case the style-modules adapter is imported, the themes are obtained from there instead
|
|
195
|
+
* @returns {Theme[]}
|
|
196
|
+
*/
|
|
197
|
+
function getAllThemes() {
|
|
198
|
+
if (window.Vaadin && window.Vaadin.styleModules) {
|
|
199
|
+
return window.Vaadin.styleModules.getAllThemes();
|
|
200
|
+
}
|
|
201
|
+
return themeRegistry;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Returns true if the themeFor string matches the tag name
|
|
206
|
+
* @param {string} themeFor
|
|
207
|
+
* @param {string} tagName
|
|
208
|
+
* @returns {boolean}
|
|
209
|
+
*/
|
|
210
|
+
function matchesThemeFor(themeFor, tagName) {
|
|
211
|
+
return (themeFor || '').split(' ').some((themeForToken) => {
|
|
212
|
+
return new RegExp(`^${themeForToken.split('*').join('.*')}$`, 'u').test(tagName);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Maps the moduleName to an include priority number which is used for
|
|
218
|
+
* determining the order in which styles are applied.
|
|
219
|
+
* @param {string} moduleName
|
|
220
|
+
* @returns {number}
|
|
221
|
+
*/
|
|
222
|
+
function getIncludePriority(moduleName = '') {
|
|
223
|
+
let includePriority = 0;
|
|
224
|
+
if (moduleName.startsWith('lumo-') || moduleName.startsWith('material-')) {
|
|
225
|
+
includePriority = 1;
|
|
226
|
+
} else if (moduleName.startsWith('vaadin-')) {
|
|
227
|
+
includePriority = 2;
|
|
228
|
+
}
|
|
229
|
+
return includePriority;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Gets an array of CSSResults matching the include property of the theme.
|
|
234
|
+
* @param {Theme} theme
|
|
235
|
+
* @returns {CSSResult[]}
|
|
236
|
+
*/
|
|
237
|
+
function getIncludedStyles(theme) {
|
|
238
|
+
const includedStyles = [];
|
|
239
|
+
if (theme.include) {
|
|
240
|
+
[].concat(theme.include).forEach((includeModuleId) => {
|
|
241
|
+
const includedTheme = getAllThemes().find((s) => s.moduleId === includeModuleId);
|
|
242
|
+
if (includedTheme) {
|
|
243
|
+
includedStyles.push(...getIncludedStyles(includedTheme), ...includedTheme.styles);
|
|
244
|
+
} else {
|
|
245
|
+
console.warn(`Included moduleId ${includeModuleId} not found in style registry`);
|
|
115
246
|
}
|
|
116
|
-
}
|
|
247
|
+
}, theme.styles);
|
|
248
|
+
}
|
|
249
|
+
return includedStyles;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Includes the styles to the template.
|
|
254
|
+
* @param {CSSResult[]} styles
|
|
255
|
+
* @param {HTMLTemplateElement} template
|
|
256
|
+
*/
|
|
257
|
+
function addStylesToTemplate(styles, template) {
|
|
258
|
+
const styleEl = document.createElement('style');
|
|
259
|
+
styleEl.innerHTML = styles.map((style) => style.cssText).join('\n');
|
|
260
|
+
template.content.appendChild(styleEl);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Returns an array of themes that should be used for styling a component matching
|
|
265
|
+
* the tag name. The array is sorted by the include order.
|
|
266
|
+
* @param {string} tagName
|
|
267
|
+
* @returns {Theme[]}
|
|
268
|
+
*/
|
|
269
|
+
function getThemes(tagName) {
|
|
270
|
+
const defaultModuleName = `${tagName}-default-theme`;
|
|
271
|
+
|
|
272
|
+
const themes = getAllThemes()
|
|
273
|
+
// Filter by matching themeFor properties
|
|
274
|
+
.filter((theme) => theme.moduleId !== defaultModuleName && matchesThemeFor(theme.themeFor, tagName))
|
|
275
|
+
.map((theme) => ({
|
|
276
|
+
...theme,
|
|
277
|
+
// Prepend styles from included themes
|
|
278
|
+
styles: [...getIncludedStyles(theme), ...theme.styles],
|
|
279
|
+
// Map moduleId to includePriority
|
|
280
|
+
includePriority: getIncludePriority(theme.moduleId),
|
|
281
|
+
}))
|
|
282
|
+
// Sort by includePriority
|
|
283
|
+
.sort((themeA, themeB) => themeB.includePriority - themeA.includePriority);
|
|
284
|
+
|
|
285
|
+
if (themes.length > 0) {
|
|
286
|
+
return themes;
|
|
287
|
+
}
|
|
288
|
+
// No theme modules found, return the default module if it exists
|
|
289
|
+
return getAllThemes().filter((theme) => theme.moduleId === defaultModuleName);
|
|
290
|
+
}
|
|
117
291
|
|
|
292
|
+
/**
|
|
293
|
+
* @polymerMixin
|
|
294
|
+
* @mixes ThemePropertyMixin
|
|
295
|
+
*/
|
|
296
|
+
const ThemableMixin = (superClass) =>
|
|
297
|
+
class VaadinThemableMixin extends ThemePropertyMixin(superClass) {
|
|
118
298
|
/**
|
|
119
|
-
*
|
|
120
|
-
* to mark as valid after user started typing.
|
|
121
|
-
* @param {Event} event
|
|
299
|
+
* Covers PolymerElement based component styling
|
|
122
300
|
* @protected
|
|
123
|
-
* @override
|
|
124
301
|
*/
|
|
125
|
-
|
|
126
|
-
super.
|
|
302
|
+
static finalize() {
|
|
303
|
+
super.finalize();
|
|
127
304
|
|
|
128
|
-
|
|
129
|
-
|
|
305
|
+
// Make sure not to run the logic intended for PolymerElement when LitElement is used.
|
|
306
|
+
if (this.elementStyles) {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
const template = this.prototype._template;
|
|
311
|
+
if (!template || classHasThemes$1(this)) {
|
|
312
|
+
return;
|
|
130
313
|
}
|
|
314
|
+
|
|
315
|
+
addStylesToTemplate(this.getStylesForThis(), template);
|
|
131
316
|
}
|
|
132
317
|
|
|
133
318
|
/**
|
|
134
|
-
*
|
|
135
|
-
* when a new value is set programmatically.
|
|
319
|
+
* Covers LitElement based component styling
|
|
136
320
|
*
|
|
137
|
-
* @param {string | undefined} newValue
|
|
138
|
-
* @param {string | undefined} oldValue
|
|
139
321
|
* @protected
|
|
140
|
-
* @override
|
|
141
322
|
*/
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
323
|
+
static finalizeStyles(styles) {
|
|
324
|
+
// The "styles" object originates from the "static get styles()" function of
|
|
325
|
+
// a LitElement based component. The theme styles are added after it
|
|
326
|
+
// so that they can override the component styles.
|
|
327
|
+
const themeStyles = this.getStylesForThis();
|
|
328
|
+
return styles ? [...super.finalizeStyles(styles), ...themeStyles] : themeStyles;
|
|
329
|
+
}
|
|
148
330
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
331
|
+
/**
|
|
332
|
+
* Get styles for the component type
|
|
333
|
+
*
|
|
334
|
+
* @private
|
|
335
|
+
*/
|
|
336
|
+
static getStylesForThis() {
|
|
337
|
+
const parent = Object.getPrototypeOf(this.prototype);
|
|
338
|
+
const inheritedThemes = (parent ? parent.constructor.__themes : []) || [];
|
|
339
|
+
this.__themes = [...inheritedThemes, ...getThemes(this.is)];
|
|
340
|
+
const themeStyles = this.__themes.flatMap((theme) => theme.styles);
|
|
341
|
+
// Remove duplicates
|
|
342
|
+
return themeStyles.filter((style, index) => index === themeStyles.lastIndexOf(style));
|
|
152
343
|
}
|
|
153
344
|
};
|
|
154
345
|
|
|
155
346
|
/**
|
|
156
347
|
* @license
|
|
157
|
-
* Copyright (c) 2017 -
|
|
348
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
158
349
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
159
350
|
*/
|
|
160
351
|
|
|
161
|
-
registerStyles('vaadin-text-field', inputFieldShared$1, { moduleId: 'vaadin-text-field-styles' });
|
|
162
|
-
|
|
163
352
|
/**
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
* ```html
|
|
167
|
-
* <vaadin-text-field label="First Name"></vaadin-text-field>
|
|
168
|
-
* ```
|
|
169
|
-
*
|
|
170
|
-
* ### Prefixes and suffixes
|
|
353
|
+
* This is for use internally by Lumo and Material styles.
|
|
171
354
|
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* In order for an element to be considered as a prefix, it must have the slot
|
|
175
|
-
* attribute set to `prefix` (and similarly for `suffix`).
|
|
176
|
-
*
|
|
177
|
-
* ```html
|
|
178
|
-
* <vaadin-text-field label="Email address">
|
|
179
|
-
* <div slot="prefix">Sent to:</div>
|
|
180
|
-
* <div slot="suffix">@vaadin.com</div>
|
|
181
|
-
* </vaadin-text-field>
|
|
182
|
-
* ```
|
|
183
|
-
*
|
|
184
|
-
* ### Styling
|
|
185
|
-
*
|
|
186
|
-
* The following custom properties are available for styling:
|
|
187
|
-
*
|
|
188
|
-
* Custom property | Description | Default
|
|
189
|
-
* -------------------------------|----------------------------|---------
|
|
190
|
-
* `--vaadin-field-default-width` | Default width of the field | `12em`
|
|
191
|
-
*
|
|
192
|
-
* The following shadow DOM parts are available for styling:
|
|
193
|
-
*
|
|
194
|
-
* Part name | Description
|
|
195
|
-
* ---------------------|----------------
|
|
196
|
-
* `label` | The label element
|
|
197
|
-
* `input-field` | The element that wraps prefix, value and suffix
|
|
198
|
-
* `clear-button` | The clear button
|
|
199
|
-
* `error-message` | The error message element
|
|
200
|
-
* `helper-text` | The helper text element wrapper
|
|
201
|
-
* `required-indicator` | The `required` state indicator element
|
|
202
|
-
*
|
|
203
|
-
* The following state attributes are available for styling:
|
|
204
|
-
*
|
|
205
|
-
* Attribute | Description | Part name
|
|
206
|
-
* --------------------|-------------|------------
|
|
207
|
-
* `disabled` | Set to a disabled text field | :host
|
|
208
|
-
* `has-value` | Set when the element has a value | :host
|
|
209
|
-
* `has-label` | Set when the element has a label | :host
|
|
210
|
-
* `has-helper` | Set when the element has helper text or slot | :host
|
|
211
|
-
* `has-error-message` | Set when the element has an error message | :host
|
|
212
|
-
* `invalid` | Set when the element is invalid | :host
|
|
213
|
-
* `input-prevented` | Temporarily set when invalid input is prevented | :host
|
|
214
|
-
* `focused` | Set when the element is focused | :host
|
|
215
|
-
* `focus-ring` | Set when the element is keyboard focused | :host
|
|
216
|
-
* `readonly` | Set to a readonly text field | :host
|
|
217
|
-
*
|
|
218
|
-
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
219
|
-
*
|
|
220
|
-
* @fires {Event} input - Fired when the value is changed by the user: on every typing keystroke, and the value is cleared using the clear button.
|
|
221
|
-
* @fires {Event} change - Fired when the user commits a value change.
|
|
222
|
-
* @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
|
|
223
|
-
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
224
|
-
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
225
|
-
*
|
|
226
|
-
* @extends HTMLElement
|
|
227
|
-
* @mixes ElementMixin
|
|
228
|
-
* @mixes ThemableMixin
|
|
229
|
-
* @mixes PatternMixin
|
|
230
|
-
* @mixes InputFieldMixin
|
|
355
|
+
* @param {string} id the id to set on the created element, only for informational purposes
|
|
356
|
+
* @param {CSSResultGroup[]} styles the styles to add
|
|
231
357
|
*/
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
358
|
+
const addGlobalThemeStyles$1 = (id, ...styles) => {
|
|
359
|
+
const styleTag = document.createElement('style');
|
|
360
|
+
styleTag.id = id;
|
|
361
|
+
styleTag.textContent = styles
|
|
362
|
+
.map((style) => style.toString())
|
|
363
|
+
.join('\n')
|
|
364
|
+
.replace(':host', 'html');
|
|
236
365
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
366
|
+
document.head.insertAdjacentElement('afterbegin', styleTag);
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
const addLumoGlobalStyles$1 = (id, ...styles) => {
|
|
370
|
+
addGlobalThemeStyles$1(`lumo-${id}`, styles);
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* @license
|
|
375
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
376
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
377
|
+
*/
|
|
378
|
+
|
|
379
|
+
const colorBase$1 = i`
|
|
380
|
+
:host {
|
|
381
|
+
/* Base (background) */
|
|
382
|
+
--lumo-base-color: #fff;
|
|
383
|
+
|
|
384
|
+
/* Tint */
|
|
385
|
+
--lumo-tint-5pct: hsla(0, 0%, 100%, 0.3);
|
|
386
|
+
--lumo-tint-10pct: hsla(0, 0%, 100%, 0.37);
|
|
387
|
+
--lumo-tint-20pct: hsla(0, 0%, 100%, 0.44);
|
|
388
|
+
--lumo-tint-30pct: hsla(0, 0%, 100%, 0.5);
|
|
389
|
+
--lumo-tint-40pct: hsla(0, 0%, 100%, 0.57);
|
|
390
|
+
--lumo-tint-50pct: hsla(0, 0%, 100%, 0.64);
|
|
391
|
+
--lumo-tint-60pct: hsla(0, 0%, 100%, 0.7);
|
|
392
|
+
--lumo-tint-70pct: hsla(0, 0%, 100%, 0.77);
|
|
393
|
+
--lumo-tint-80pct: hsla(0, 0%, 100%, 0.84);
|
|
394
|
+
--lumo-tint-90pct: hsla(0, 0%, 100%, 0.9);
|
|
395
|
+
--lumo-tint: #fff;
|
|
396
|
+
|
|
397
|
+
/* Shade */
|
|
398
|
+
--lumo-shade-5pct: hsla(214, 61%, 25%, 0.05);
|
|
399
|
+
--lumo-shade-10pct: hsla(214, 57%, 24%, 0.1);
|
|
400
|
+
--lumo-shade-20pct: hsla(214, 53%, 23%, 0.16);
|
|
401
|
+
--lumo-shade-30pct: hsla(214, 50%, 22%, 0.26);
|
|
402
|
+
--lumo-shade-40pct: hsla(214, 47%, 21%, 0.38);
|
|
403
|
+
--lumo-shade-50pct: hsla(214, 45%, 20%, 0.52);
|
|
404
|
+
--lumo-shade-60pct: hsla(214, 43%, 19%, 0.6);
|
|
405
|
+
--lumo-shade-70pct: hsla(214, 42%, 18%, 0.69);
|
|
406
|
+
--lumo-shade-80pct: hsla(214, 41%, 17%, 0.83);
|
|
407
|
+
--lumo-shade-90pct: hsla(214, 40%, 16%, 0.94);
|
|
408
|
+
--lumo-shade: hsl(214, 35%, 15%);
|
|
409
|
+
|
|
410
|
+
/* Contrast */
|
|
411
|
+
--lumo-contrast-5pct: var(--lumo-shade-5pct);
|
|
412
|
+
--lumo-contrast-10pct: var(--lumo-shade-10pct);
|
|
413
|
+
--lumo-contrast-20pct: var(--lumo-shade-20pct);
|
|
414
|
+
--lumo-contrast-30pct: var(--lumo-shade-30pct);
|
|
415
|
+
--lumo-contrast-40pct: var(--lumo-shade-40pct);
|
|
416
|
+
--lumo-contrast-50pct: var(--lumo-shade-50pct);
|
|
417
|
+
--lumo-contrast-60pct: var(--lumo-shade-60pct);
|
|
418
|
+
--lumo-contrast-70pct: var(--lumo-shade-70pct);
|
|
419
|
+
--lumo-contrast-80pct: var(--lumo-shade-80pct);
|
|
420
|
+
--lumo-contrast-90pct: var(--lumo-shade-90pct);
|
|
421
|
+
--lumo-contrast: var(--lumo-shade);
|
|
422
|
+
|
|
423
|
+
/* Text */
|
|
424
|
+
--lumo-header-text-color: var(--lumo-contrast);
|
|
425
|
+
--lumo-body-text-color: var(--lumo-contrast-90pct);
|
|
426
|
+
--lumo-secondary-text-color: var(--lumo-contrast-70pct);
|
|
427
|
+
--lumo-tertiary-text-color: var(--lumo-contrast-50pct);
|
|
428
|
+
--lumo-disabled-text-color: var(--lumo-contrast-30pct);
|
|
429
|
+
|
|
430
|
+
/* Primary */
|
|
431
|
+
--lumo-primary-color: hsl(214, 100%, 48%);
|
|
432
|
+
--lumo-primary-color-50pct: hsla(214, 100%, 49%, 0.76);
|
|
433
|
+
--lumo-primary-color-10pct: hsla(214, 100%, 60%, 0.13);
|
|
434
|
+
--lumo-primary-text-color: hsl(214, 100%, 43%);
|
|
435
|
+
--lumo-primary-contrast-color: #fff;
|
|
436
|
+
|
|
437
|
+
/* Error */
|
|
438
|
+
--lumo-error-color: hsl(3, 85%, 48%);
|
|
439
|
+
--lumo-error-color-50pct: hsla(3, 85%, 49%, 0.5);
|
|
440
|
+
--lumo-error-color-10pct: hsla(3, 85%, 49%, 0.1);
|
|
441
|
+
--lumo-error-text-color: hsl(3, 89%, 42%);
|
|
442
|
+
--lumo-error-contrast-color: #fff;
|
|
443
|
+
|
|
444
|
+
/* Success */
|
|
445
|
+
--lumo-success-color: hsl(145, 72%, 30%);
|
|
446
|
+
--lumo-success-color-50pct: hsla(145, 72%, 31%, 0.5);
|
|
447
|
+
--lumo-success-color-10pct: hsla(145, 72%, 31%, 0.1);
|
|
448
|
+
--lumo-success-text-color: hsl(145, 85%, 25%);
|
|
449
|
+
--lumo-success-contrast-color: #fff;
|
|
450
|
+
|
|
451
|
+
/* Warning */
|
|
452
|
+
--lumo-warning-color: hsl(48, 100%, 50%);
|
|
453
|
+
--lumo-warning-color-10pct: hsla(48, 100%, 50%, 0.25);
|
|
454
|
+
--lumo-warning-text-color: hsl(32, 100%, 30%);
|
|
455
|
+
--lumo-warning-contrast-color: var(--lumo-shade-90pct);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/* forced-colors mode adjustments */
|
|
459
|
+
@media (forced-colors: active) {
|
|
460
|
+
html {
|
|
461
|
+
--lumo-disabled-text-color: GrayText;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
`;
|
|
465
|
+
|
|
466
|
+
addLumoGlobalStyles$1('color-props', colorBase$1);
|
|
467
|
+
|
|
468
|
+
const color$1 = i`
|
|
469
|
+
[theme~='dark'] {
|
|
470
|
+
/* Base (background) */
|
|
471
|
+
--lumo-base-color: hsl(214, 35%, 21%);
|
|
472
|
+
|
|
473
|
+
/* Tint */
|
|
474
|
+
--lumo-tint-5pct: hsla(214, 65%, 85%, 0.06);
|
|
475
|
+
--lumo-tint-10pct: hsla(214, 60%, 80%, 0.14);
|
|
476
|
+
--lumo-tint-20pct: hsla(214, 64%, 82%, 0.23);
|
|
477
|
+
--lumo-tint-30pct: hsla(214, 69%, 84%, 0.32);
|
|
478
|
+
--lumo-tint-40pct: hsla(214, 73%, 86%, 0.41);
|
|
479
|
+
--lumo-tint-50pct: hsla(214, 78%, 88%, 0.5);
|
|
480
|
+
--lumo-tint-60pct: hsla(214, 82%, 90%, 0.58);
|
|
481
|
+
--lumo-tint-70pct: hsla(214, 87%, 92%, 0.69);
|
|
482
|
+
--lumo-tint-80pct: hsla(214, 91%, 94%, 0.8);
|
|
483
|
+
--lumo-tint-90pct: hsla(214, 96%, 96%, 0.9);
|
|
484
|
+
--lumo-tint: hsl(214, 100%, 98%);
|
|
485
|
+
|
|
486
|
+
/* Shade */
|
|
487
|
+
--lumo-shade-5pct: hsla(214, 0%, 0%, 0.07);
|
|
488
|
+
--lumo-shade-10pct: hsla(214, 4%, 2%, 0.15);
|
|
489
|
+
--lumo-shade-20pct: hsla(214, 8%, 4%, 0.23);
|
|
490
|
+
--lumo-shade-30pct: hsla(214, 12%, 6%, 0.32);
|
|
491
|
+
--lumo-shade-40pct: hsla(214, 16%, 8%, 0.41);
|
|
492
|
+
--lumo-shade-50pct: hsla(214, 20%, 10%, 0.5);
|
|
493
|
+
--lumo-shade-60pct: hsla(214, 24%, 12%, 0.6);
|
|
494
|
+
--lumo-shade-70pct: hsla(214, 28%, 13%, 0.7);
|
|
495
|
+
--lumo-shade-80pct: hsla(214, 32%, 13%, 0.8);
|
|
496
|
+
--lumo-shade-90pct: hsla(214, 33%, 13%, 0.9);
|
|
497
|
+
--lumo-shade: hsl(214, 33%, 13%);
|
|
498
|
+
|
|
499
|
+
/* Contrast */
|
|
500
|
+
--lumo-contrast-5pct: var(--lumo-tint-5pct);
|
|
501
|
+
--lumo-contrast-10pct: var(--lumo-tint-10pct);
|
|
502
|
+
--lumo-contrast-20pct: var(--lumo-tint-20pct);
|
|
503
|
+
--lumo-contrast-30pct: var(--lumo-tint-30pct);
|
|
504
|
+
--lumo-contrast-40pct: var(--lumo-tint-40pct);
|
|
505
|
+
--lumo-contrast-50pct: var(--lumo-tint-50pct);
|
|
506
|
+
--lumo-contrast-60pct: var(--lumo-tint-60pct);
|
|
507
|
+
--lumo-contrast-70pct: var(--lumo-tint-70pct);
|
|
508
|
+
--lumo-contrast-80pct: var(--lumo-tint-80pct);
|
|
509
|
+
--lumo-contrast-90pct: var(--lumo-tint-90pct);
|
|
510
|
+
--lumo-contrast: var(--lumo-tint);
|
|
511
|
+
|
|
512
|
+
/* Text */
|
|
513
|
+
--lumo-header-text-color: var(--lumo-contrast);
|
|
514
|
+
--lumo-body-text-color: var(--lumo-contrast-90pct);
|
|
515
|
+
--lumo-secondary-text-color: var(--lumo-contrast-70pct);
|
|
516
|
+
--lumo-tertiary-text-color: var(--lumo-contrast-50pct);
|
|
517
|
+
--lumo-disabled-text-color: var(--lumo-contrast-30pct);
|
|
518
|
+
|
|
519
|
+
/* Primary */
|
|
520
|
+
--lumo-primary-color: hsl(214, 90%, 48%);
|
|
521
|
+
--lumo-primary-color-50pct: hsla(214, 90%, 70%, 0.69);
|
|
522
|
+
--lumo-primary-color-10pct: hsla(214, 90%, 55%, 0.13);
|
|
523
|
+
--lumo-primary-text-color: hsl(214, 90%, 77%);
|
|
524
|
+
--lumo-primary-contrast-color: #fff;
|
|
525
|
+
|
|
526
|
+
/* Error */
|
|
527
|
+
--lumo-error-color: hsl(3, 79%, 49%);
|
|
528
|
+
--lumo-error-color-50pct: hsla(3, 75%, 62%, 0.5);
|
|
529
|
+
--lumo-error-color-10pct: hsla(3, 75%, 62%, 0.14);
|
|
530
|
+
--lumo-error-text-color: hsl(3, 100%, 80%);
|
|
531
|
+
|
|
532
|
+
/* Success */
|
|
533
|
+
--lumo-success-color: hsl(145, 72%, 30%);
|
|
534
|
+
--lumo-success-color-50pct: hsla(145, 92%, 51%, 0.5);
|
|
535
|
+
--lumo-success-color-10pct: hsla(145, 92%, 51%, 0.1);
|
|
536
|
+
--lumo-success-text-color: hsl(145, 85%, 46%);
|
|
537
|
+
|
|
538
|
+
/* Warning */
|
|
539
|
+
--lumo-warning-color: hsl(43, 100%, 48%);
|
|
540
|
+
--lumo-warning-color-10pct: hsla(40, 100%, 50%, 0.2);
|
|
541
|
+
--lumo-warning-text-color: hsl(45, 100%, 60%);
|
|
542
|
+
--lumo-warning-contrast-color: var(--lumo-shade-90pct);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
html {
|
|
546
|
+
color: var(--lumo-body-text-color);
|
|
547
|
+
background-color: var(--lumo-base-color);
|
|
548
|
+
color-scheme: light;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
[theme~='dark'] {
|
|
552
|
+
color: var(--lumo-body-text-color);
|
|
553
|
+
background-color: var(--lumo-base-color);
|
|
554
|
+
color-scheme: dark;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
h1,
|
|
558
|
+
h2,
|
|
559
|
+
h3,
|
|
560
|
+
h4,
|
|
561
|
+
h5,
|
|
562
|
+
h6 {
|
|
563
|
+
color: var(--lumo-header-text-color);
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
a:where(:any-link) {
|
|
567
|
+
color: var(--lumo-primary-text-color);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
a:not(:any-link) {
|
|
571
|
+
color: var(--lumo-disabled-text-color);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
blockquote {
|
|
575
|
+
color: var(--lumo-secondary-text-color);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
code,
|
|
579
|
+
pre {
|
|
580
|
+
background-color: var(--lumo-contrast-10pct);
|
|
581
|
+
border-radius: var(--lumo-border-radius-m);
|
|
582
|
+
}
|
|
583
|
+
`;
|
|
584
|
+
|
|
585
|
+
registerStyles$1('', color$1, { moduleId: 'lumo-color' });
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* @license
|
|
589
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
590
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
591
|
+
*/
|
|
592
|
+
|
|
593
|
+
const fontIcons$1 = i`
|
|
594
|
+
@font-face {
|
|
595
|
+
font-family: 'lumo-icons';
|
|
596
|
+
src: url(data:application/font-woff;charset=utf-8;base64,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)
|
|
597
|
+
format('woff');
|
|
598
|
+
font-weight: normal;
|
|
599
|
+
font-style: normal;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
html {
|
|
603
|
+
--lumo-icons-align-center: '\\ea01';
|
|
604
|
+
--lumo-icons-align-left: '\\ea02';
|
|
605
|
+
--lumo-icons-align-right: '\\ea03';
|
|
606
|
+
--lumo-icons-angle-down: '\\ea04';
|
|
607
|
+
--lumo-icons-angle-left: '\\ea05';
|
|
608
|
+
--lumo-icons-angle-right: '\\ea06';
|
|
609
|
+
--lumo-icons-angle-up: '\\ea07';
|
|
610
|
+
--lumo-icons-arrow-down: '\\ea08';
|
|
611
|
+
--lumo-icons-arrow-left: '\\ea09';
|
|
612
|
+
--lumo-icons-arrow-right: '\\ea0a';
|
|
613
|
+
--lumo-icons-arrow-up: '\\ea0b';
|
|
614
|
+
--lumo-icons-bar-chart: '\\ea0c';
|
|
615
|
+
--lumo-icons-bell: '\\ea0d';
|
|
616
|
+
--lumo-icons-calendar: '\\ea0e';
|
|
617
|
+
--lumo-icons-checkmark: '\\ea0f';
|
|
618
|
+
--lumo-icons-chevron-down: '\\ea10';
|
|
619
|
+
--lumo-icons-chevron-left: '\\ea11';
|
|
620
|
+
--lumo-icons-chevron-right: '\\ea12';
|
|
621
|
+
--lumo-icons-chevron-up: '\\ea13';
|
|
622
|
+
--lumo-icons-clock: '\\ea14';
|
|
623
|
+
--lumo-icons-cog: '\\ea15';
|
|
624
|
+
--lumo-icons-cross: '\\ea16';
|
|
625
|
+
--lumo-icons-download: '\\ea17';
|
|
626
|
+
--lumo-icons-dropdown: '\\ea18';
|
|
627
|
+
--lumo-icons-edit: '\\ea19';
|
|
628
|
+
--lumo-icons-error: '\\ea1a';
|
|
629
|
+
--lumo-icons-eye: '\\ea1b';
|
|
630
|
+
--lumo-icons-eye-disabled: '\\ea1c';
|
|
631
|
+
--lumo-icons-menu: '\\ea1d';
|
|
632
|
+
--lumo-icons-minus: '\\ea1e';
|
|
633
|
+
--lumo-icons-ordered-list: '\\ea1f';
|
|
634
|
+
--lumo-icons-phone: '\\ea20';
|
|
635
|
+
--lumo-icons-photo: '\\ea21';
|
|
636
|
+
--lumo-icons-play: '\\ea22';
|
|
637
|
+
--lumo-icons-plus: '\\ea23';
|
|
638
|
+
--lumo-icons-redo: '\\ea24';
|
|
639
|
+
--lumo-icons-reload: '\\ea25';
|
|
640
|
+
--lumo-icons-search: '\\ea26';
|
|
641
|
+
--lumo-icons-undo: '\\ea27';
|
|
642
|
+
--lumo-icons-unordered-list: '\\ea28';
|
|
643
|
+
--lumo-icons-upload: '\\ea29';
|
|
644
|
+
--lumo-icons-user: '\\ea2a';
|
|
645
|
+
}
|
|
646
|
+
`;
|
|
647
|
+
|
|
648
|
+
addLumoGlobalStyles$1('font-icons', fontIcons$1);
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* @license
|
|
652
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
653
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
654
|
+
*/
|
|
655
|
+
|
|
656
|
+
const sizing$1 = i`
|
|
657
|
+
:host {
|
|
658
|
+
--lumo-size-xs: 1.625rem;
|
|
659
|
+
--lumo-size-s: 1.875rem;
|
|
660
|
+
--lumo-size-m: 2.25rem;
|
|
661
|
+
--lumo-size-l: 2.75rem;
|
|
662
|
+
--lumo-size-xl: 3.5rem;
|
|
663
|
+
|
|
664
|
+
/* Icons */
|
|
665
|
+
--lumo-icon-size-s: 1.25em;
|
|
666
|
+
--lumo-icon-size-m: 1.5em;
|
|
667
|
+
--lumo-icon-size-l: 2.25em;
|
|
668
|
+
/* For backwards compatibility */
|
|
669
|
+
--lumo-icon-size: var(--lumo-icon-size-m);
|
|
670
|
+
}
|
|
671
|
+
`;
|
|
672
|
+
|
|
673
|
+
addLumoGlobalStyles$1('sizing-props', sizing$1);
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* @license
|
|
677
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
678
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
679
|
+
*/
|
|
680
|
+
|
|
681
|
+
const spacing$1 = i`
|
|
682
|
+
:host {
|
|
683
|
+
/* Square */
|
|
684
|
+
--lumo-space-xs: 0.25rem;
|
|
685
|
+
--lumo-space-s: 0.5rem;
|
|
686
|
+
--lumo-space-m: 1rem;
|
|
687
|
+
--lumo-space-l: 1.5rem;
|
|
688
|
+
--lumo-space-xl: 2.5rem;
|
|
689
|
+
|
|
690
|
+
/* Wide */
|
|
691
|
+
--lumo-space-wide-xs: calc(var(--lumo-space-xs) / 2) var(--lumo-space-xs);
|
|
692
|
+
--lumo-space-wide-s: calc(var(--lumo-space-s) / 2) var(--lumo-space-s);
|
|
693
|
+
--lumo-space-wide-m: calc(var(--lumo-space-m) / 2) var(--lumo-space-m);
|
|
694
|
+
--lumo-space-wide-l: calc(var(--lumo-space-l) / 2) var(--lumo-space-l);
|
|
695
|
+
--lumo-space-wide-xl: calc(var(--lumo-space-xl) / 2) var(--lumo-space-xl);
|
|
696
|
+
|
|
697
|
+
/* Tall */
|
|
698
|
+
--lumo-space-tall-xs: var(--lumo-space-xs) calc(var(--lumo-space-xs) / 2);
|
|
699
|
+
--lumo-space-tall-s: var(--lumo-space-s) calc(var(--lumo-space-s) / 2);
|
|
700
|
+
--lumo-space-tall-m: var(--lumo-space-m) calc(var(--lumo-space-m) / 2);
|
|
701
|
+
--lumo-space-tall-l: var(--lumo-space-l) calc(var(--lumo-space-l) / 2);
|
|
702
|
+
--lumo-space-tall-xl: var(--lumo-space-xl) calc(var(--lumo-space-xl) / 2);
|
|
703
|
+
}
|
|
704
|
+
`;
|
|
705
|
+
|
|
706
|
+
addLumoGlobalStyles$1('spacing-props', spacing$1);
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* @license
|
|
710
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
711
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
712
|
+
*/
|
|
713
|
+
|
|
714
|
+
const style$1 = i`
|
|
715
|
+
:host {
|
|
716
|
+
/* Border radius */
|
|
717
|
+
--lumo-border-radius-s: 0.25em; /* Checkbox, badge, date-picker year indicator, etc */
|
|
718
|
+
--lumo-border-radius-m: var(--lumo-border-radius, 0.25em); /* Button, text field, menu overlay, etc */
|
|
719
|
+
--lumo-border-radius-l: 0.5em; /* Dialog, notification, etc */
|
|
720
|
+
|
|
721
|
+
/* Shadow */
|
|
722
|
+
--lumo-box-shadow-xs: 0 1px 4px -1px var(--lumo-shade-50pct);
|
|
723
|
+
--lumo-box-shadow-s: 0 2px 4px -1px var(--lumo-shade-20pct), 0 3px 12px -1px var(--lumo-shade-30pct);
|
|
724
|
+
--lumo-box-shadow-m: 0 2px 6px -1px var(--lumo-shade-20pct), 0 8px 24px -4px var(--lumo-shade-40pct);
|
|
725
|
+
--lumo-box-shadow-l: 0 3px 18px -2px var(--lumo-shade-20pct), 0 12px 48px -6px var(--lumo-shade-40pct);
|
|
726
|
+
--lumo-box-shadow-xl: 0 4px 24px -3px var(--lumo-shade-20pct), 0 18px 64px -8px var(--lumo-shade-40pct);
|
|
727
|
+
|
|
728
|
+
/* Clickable element cursor */
|
|
729
|
+
--lumo-clickable-cursor: default;
|
|
730
|
+
}
|
|
731
|
+
`;
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* Default values for component-specific custom properties.
|
|
735
|
+
*/
|
|
736
|
+
i`
|
|
737
|
+
html {
|
|
738
|
+
--vaadin-checkbox-size: calc(var(--lumo-size-m) / 2);
|
|
739
|
+
--vaadin-radio-button-size: calc(var(--lumo-size-m) / 2);
|
|
740
|
+
--vaadin-input-field-border-radius: var(--lumo-border-radius-m);
|
|
741
|
+
}
|
|
742
|
+
`;
|
|
743
|
+
|
|
744
|
+
addLumoGlobalStyles$1('style-props', style$1);
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* @license
|
|
748
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
749
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
750
|
+
*/
|
|
751
|
+
|
|
752
|
+
const font$1 = i`
|
|
753
|
+
:host {
|
|
754
|
+
/* prettier-ignore */
|
|
755
|
+
--lumo-font-family: -apple-system, BlinkMacSystemFont, 'Roboto', 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
|
756
|
+
|
|
757
|
+
/* Font sizes */
|
|
758
|
+
--lumo-font-size-xxs: 0.75rem;
|
|
759
|
+
--lumo-font-size-xs: 0.8125rem;
|
|
760
|
+
--lumo-font-size-s: 0.875rem;
|
|
761
|
+
--lumo-font-size-m: 1rem;
|
|
762
|
+
--lumo-font-size-l: 1.125rem;
|
|
763
|
+
--lumo-font-size-xl: 1.375rem;
|
|
764
|
+
--lumo-font-size-xxl: 1.75rem;
|
|
765
|
+
--lumo-font-size-xxxl: 2.5rem;
|
|
766
|
+
|
|
767
|
+
/* Line heights */
|
|
768
|
+
--lumo-line-height-xs: 1.25;
|
|
769
|
+
--lumo-line-height-s: 1.375;
|
|
770
|
+
--lumo-line-height-m: 1.625;
|
|
771
|
+
}
|
|
772
|
+
`;
|
|
773
|
+
|
|
774
|
+
const typography$1 = i`
|
|
775
|
+
body,
|
|
776
|
+
:host {
|
|
777
|
+
font-family: var(--lumo-font-family);
|
|
778
|
+
font-size: var(--lumo-font-size-m);
|
|
779
|
+
line-height: var(--lumo-line-height-m);
|
|
780
|
+
-webkit-text-size-adjust: 100%;
|
|
781
|
+
-webkit-font-smoothing: antialiased;
|
|
782
|
+
-moz-osx-font-smoothing: grayscale;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
small,
|
|
786
|
+
[theme~='font-size-s'] {
|
|
787
|
+
font-size: var(--lumo-font-size-s);
|
|
788
|
+
line-height: var(--lumo-line-height-s);
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
[theme~='font-size-xs'] {
|
|
792
|
+
font-size: var(--lumo-font-size-xs);
|
|
793
|
+
line-height: var(--lumo-line-height-xs);
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
:where(h1, h2, h3, h4, h5, h6) {
|
|
797
|
+
font-weight: 600;
|
|
798
|
+
line-height: var(--lumo-line-height-xs);
|
|
799
|
+
margin-block: 0;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
:where(h1) {
|
|
803
|
+
font-size: var(--lumo-font-size-xxxl);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
:where(h2) {
|
|
807
|
+
font-size: var(--lumo-font-size-xxl);
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
:where(h3) {
|
|
811
|
+
font-size: var(--lumo-font-size-xl);
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
:where(h4) {
|
|
815
|
+
font-size: var(--lumo-font-size-l);
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
:where(h5) {
|
|
819
|
+
font-size: var(--lumo-font-size-m);
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
:where(h6) {
|
|
823
|
+
font-size: var(--lumo-font-size-xs);
|
|
824
|
+
text-transform: uppercase;
|
|
825
|
+
letter-spacing: 0.03em;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
p,
|
|
829
|
+
blockquote {
|
|
830
|
+
margin-top: 0.5em;
|
|
831
|
+
margin-bottom: 0.75em;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
a {
|
|
835
|
+
text-decoration: none;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
a:where(:any-link):hover {
|
|
839
|
+
text-decoration: underline;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
hr {
|
|
843
|
+
display: block;
|
|
844
|
+
align-self: stretch;
|
|
845
|
+
height: 1px;
|
|
846
|
+
border: 0;
|
|
847
|
+
padding: 0;
|
|
848
|
+
margin: var(--lumo-space-s) calc(var(--lumo-border-radius-m) / 2);
|
|
849
|
+
background-color: var(--lumo-contrast-10pct);
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
blockquote {
|
|
853
|
+
border-left: 2px solid var(--lumo-contrast-30pct);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
b,
|
|
857
|
+
strong {
|
|
858
|
+
font-weight: 600;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/* RTL specific styles */
|
|
862
|
+
blockquote[dir='rtl'] {
|
|
863
|
+
border-left: none;
|
|
864
|
+
border-right: 2px solid var(--lumo-contrast-30pct);
|
|
865
|
+
}
|
|
866
|
+
`;
|
|
867
|
+
|
|
868
|
+
registerStyles$1('', typography$1, { moduleId: 'lumo-typography' });
|
|
869
|
+
addLumoGlobalStyles$1('typography-props', font$1);
|
|
870
|
+
|
|
871
|
+
/**
|
|
872
|
+
* @license
|
|
873
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
874
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
875
|
+
*/
|
|
876
|
+
|
|
877
|
+
const fieldButton$1 = i`
|
|
878
|
+
[part$='button'] {
|
|
879
|
+
flex: none;
|
|
880
|
+
width: 1em;
|
|
881
|
+
height: 1em;
|
|
882
|
+
line-height: 1;
|
|
883
|
+
font-size: var(--lumo-icon-size-m);
|
|
884
|
+
text-align: center;
|
|
885
|
+
color: var(--lumo-contrast-60pct);
|
|
886
|
+
transition: 0.2s color;
|
|
887
|
+
cursor: var(--lumo-clickable-cursor);
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
[part$='button']:hover {
|
|
891
|
+
color: var(--lumo-contrast-90pct);
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
:host([disabled]) [part$='button'],
|
|
895
|
+
:host([readonly]) [part$='button'] {
|
|
896
|
+
color: var(--lumo-contrast-20pct);
|
|
897
|
+
cursor: default;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
[part$='button']::before {
|
|
901
|
+
font-family: 'lumo-icons';
|
|
902
|
+
display: block;
|
|
903
|
+
}
|
|
904
|
+
`;
|
|
905
|
+
registerStyles$1('', fieldButton$1, { moduleId: 'lumo-field-button' });
|
|
906
|
+
|
|
907
|
+
/**
|
|
908
|
+
* @license
|
|
909
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
910
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
911
|
+
*/
|
|
912
|
+
|
|
913
|
+
const helper$1 = i`
|
|
914
|
+
:host([has-helper]) [part='helper-text']::before {
|
|
915
|
+
content: '';
|
|
916
|
+
display: block;
|
|
917
|
+
height: 0.4em;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
[part='helper-text'] {
|
|
921
|
+
display: block;
|
|
922
|
+
color: var(--lumo-secondary-text-color);
|
|
923
|
+
font-size: var(--lumo-font-size-xs);
|
|
924
|
+
line-height: var(--lumo-line-height-xs);
|
|
925
|
+
margin-left: calc(var(--lumo-border-radius-m) / 4);
|
|
926
|
+
transition: color 0.2s;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
:host(:hover:not([readonly])) [part='helper-text'] {
|
|
930
|
+
color: var(--lumo-body-text-color);
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
:host([disabled]) [part='helper-text'] {
|
|
934
|
+
color: var(--lumo-disabled-text-color);
|
|
935
|
+
-webkit-text-fill-color: var(--lumo-disabled-text-color);
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
:host([has-helper][theme~='helper-above-field']) [part='helper-text']::before {
|
|
939
|
+
display: none;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
:host([has-helper][theme~='helper-above-field']) [part='helper-text']::after {
|
|
943
|
+
content: '';
|
|
944
|
+
display: block;
|
|
945
|
+
height: 0.4em;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
:host([has-helper][theme~='helper-above-field']) [part='label'] {
|
|
949
|
+
order: 0;
|
|
950
|
+
padding-bottom: 0.4em;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
:host([has-helper][theme~='helper-above-field']) [part='helper-text'] {
|
|
954
|
+
order: 1;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
:host([has-helper][theme~='helper-above-field']) [part='label'] + * {
|
|
958
|
+
order: 2;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
:host([has-helper][theme~='helper-above-field']) [part='error-message'] {
|
|
962
|
+
order: 3;
|
|
963
|
+
}
|
|
964
|
+
`;
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* @license
|
|
968
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
969
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
970
|
+
*/
|
|
971
|
+
|
|
972
|
+
const requiredField$1 = i`
|
|
973
|
+
[part='label'] {
|
|
974
|
+
align-self: flex-start;
|
|
975
|
+
color: var(--lumo-secondary-text-color);
|
|
976
|
+
font-weight: 500;
|
|
977
|
+
font-size: var(--lumo-font-size-s);
|
|
978
|
+
margin-left: calc(var(--lumo-border-radius-m) / 4);
|
|
979
|
+
transition: color 0.2s;
|
|
980
|
+
line-height: 1;
|
|
981
|
+
padding-right: 1em;
|
|
982
|
+
padding-bottom: 0.5em;
|
|
983
|
+
/* As a workaround for diacritics being cut off, add a top padding and a
|
|
984
|
+
negative margin to compensate */
|
|
985
|
+
padding-top: 0.25em;
|
|
986
|
+
margin-top: -0.25em;
|
|
987
|
+
overflow: hidden;
|
|
988
|
+
white-space: nowrap;
|
|
989
|
+
text-overflow: ellipsis;
|
|
990
|
+
position: relative;
|
|
991
|
+
max-width: 100%;
|
|
992
|
+
box-sizing: border-box;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
:host([has-label])::before {
|
|
996
|
+
margin-top: calc(var(--lumo-font-size-s) * 1.5);
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
:host([has-label][theme~='small'])::before {
|
|
1000
|
+
margin-top: calc(var(--lumo-font-size-xs) * 1.5);
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
:host([has-label]) {
|
|
1004
|
+
padding-top: var(--lumo-space-m);
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
:host([has-label]) ::slotted([slot='tooltip']) {
|
|
1008
|
+
--vaadin-tooltip-offset-bottom: calc((var(--lumo-space-m) - var(--lumo-space-xs)) * -1);
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
:host([required]) [part='required-indicator']::after {
|
|
1012
|
+
content: var(--lumo-required-field-indicator, '\\2022');
|
|
1013
|
+
transition: opacity 0.2s;
|
|
1014
|
+
color: var(--lumo-required-field-indicator-color, var(--lumo-primary-text-color));
|
|
1015
|
+
position: absolute;
|
|
1016
|
+
right: 0;
|
|
1017
|
+
width: 1em;
|
|
1018
|
+
text-align: center;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
:host([invalid]) [part='required-indicator']::after {
|
|
1022
|
+
color: var(--lumo-required-field-indicator-color, var(--lumo-error-text-color));
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
[part='error-message'] {
|
|
1026
|
+
margin-left: calc(var(--lumo-border-radius-m) / 4);
|
|
1027
|
+
font-size: var(--lumo-font-size-xs);
|
|
1028
|
+
line-height: var(--lumo-line-height-xs);
|
|
1029
|
+
color: var(--lumo-error-text-color);
|
|
1030
|
+
will-change: max-height;
|
|
1031
|
+
transition: 0.4s max-height;
|
|
1032
|
+
max-height: 5em;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
:host([has-error-message]) [part='error-message']::before,
|
|
1036
|
+
:host([has-error-message]) [part='error-message']::after {
|
|
1037
|
+
content: '';
|
|
1038
|
+
display: block;
|
|
1039
|
+
height: 0.4em;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
:host(:not([invalid])) [part='error-message'] {
|
|
1043
|
+
max-height: 0;
|
|
1044
|
+
overflow: hidden;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
/* RTL specific styles */
|
|
1048
|
+
|
|
1049
|
+
:host([dir='rtl']) [part='label'] {
|
|
1050
|
+
margin-left: 0;
|
|
1051
|
+
margin-right: calc(var(--lumo-border-radius-m) / 4);
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
:host([dir='rtl']) [part='label'] {
|
|
1055
|
+
padding-left: 1em;
|
|
1056
|
+
padding-right: 0;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
:host([dir='rtl']) [part='required-indicator']::after {
|
|
1060
|
+
right: auto;
|
|
1061
|
+
left: 0;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
:host([dir='rtl']) [part='error-message'] {
|
|
1065
|
+
margin-left: 0;
|
|
1066
|
+
margin-right: calc(var(--lumo-border-radius-m) / 4);
|
|
1067
|
+
}
|
|
1068
|
+
`;
|
|
1069
|
+
|
|
1070
|
+
registerStyles$1('', requiredField$1, { moduleId: 'lumo-required-field' });
|
|
1071
|
+
|
|
1072
|
+
/**
|
|
1073
|
+
* @license
|
|
1074
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
1075
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
1076
|
+
*/
|
|
1077
|
+
|
|
1078
|
+
const inputField$1 = i`
|
|
1079
|
+
:host {
|
|
1080
|
+
--lumo-text-field-size: var(--lumo-size-m);
|
|
1081
|
+
color: var(--lumo-body-text-color);
|
|
1082
|
+
font-size: var(--lumo-font-size-m);
|
|
1083
|
+
font-family: var(--lumo-font-family);
|
|
1084
|
+
-webkit-font-smoothing: antialiased;
|
|
1085
|
+
-moz-osx-font-smoothing: grayscale;
|
|
1086
|
+
-webkit-tap-highlight-color: transparent;
|
|
1087
|
+
padding: var(--lumo-space-xs) 0;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
:host::before {
|
|
1091
|
+
height: var(--lumo-text-field-size);
|
|
1092
|
+
box-sizing: border-box;
|
|
1093
|
+
display: inline-flex;
|
|
1094
|
+
align-items: center;
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
:host([focused]:not([readonly])) [part='label'] {
|
|
1098
|
+
color: var(--lumo-primary-text-color);
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
:host([focused]) [part='input-field'] ::slotted(:is(input, textarea)) {
|
|
1102
|
+
-webkit-mask-image: none;
|
|
1103
|
+
mask-image: none;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
::slotted(:is(input, textarea):placeholder-shown) {
|
|
1107
|
+
color: var(--lumo-secondary-text-color);
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
/* Hover */
|
|
1111
|
+
:host(:hover:not([readonly]):not([focused])) [part='label'] {
|
|
1112
|
+
color: var(--lumo-body-text-color);
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
:host(:hover:not([readonly]):not([focused])) [part='input-field']::after {
|
|
1116
|
+
opacity: 0.1;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
/* Touch device adjustment */
|
|
1120
|
+
@media (pointer: coarse) {
|
|
1121
|
+
:host(:hover:not([readonly]):not([focused])) [part='label'] {
|
|
1122
|
+
color: var(--lumo-secondary-text-color);
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
:host(:hover:not([readonly]):not([focused])) [part='input-field']::after {
|
|
1126
|
+
opacity: 0;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
:host(:active:not([readonly]):not([focused])) [part='input-field']::after {
|
|
1130
|
+
opacity: 0.2;
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
/* Trigger when not focusing using the keyboard */
|
|
1135
|
+
:host([focused]:not([focus-ring]):not([readonly])) [part='input-field']::after {
|
|
1136
|
+
transform: scaleX(0);
|
|
1137
|
+
transition-duration: 0.15s, 1s;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
/* Focus-ring */
|
|
1141
|
+
:host([focus-ring]) [part='input-field'] {
|
|
1142
|
+
box-shadow: 0 0 0 2px var(--lumo-primary-color-50pct);
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
/* Read-only and disabled */
|
|
1146
|
+
:host(:is([readonly], [disabled])) ::slotted(:is(input, textarea):placeholder-shown) {
|
|
1147
|
+
opacity: 0;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
/* Read-only style */
|
|
1151
|
+
:host([readonly]) {
|
|
1152
|
+
--vaadin-input-field-border-color: transparent;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
/* Disabled style */
|
|
1156
|
+
:host([disabled]) {
|
|
1157
|
+
pointer-events: none;
|
|
1158
|
+
--vaadin-input-field-border-color: var(--lumo-contrast-20pct);
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
:host([disabled]) [part='label'],
|
|
1162
|
+
:host([disabled]) [part='input-field'] ::slotted(*) {
|
|
1163
|
+
color: var(--lumo-disabled-text-color);
|
|
1164
|
+
-webkit-text-fill-color: var(--lumo-disabled-text-color);
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
/* Invalid style */
|
|
1168
|
+
:host([invalid]) {
|
|
1169
|
+
--vaadin-input-field-border-color: var(--lumo-error-color);
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
:host([invalid][focus-ring]) [part='input-field'] {
|
|
1173
|
+
box-shadow: 0 0 0 2px var(--lumo-error-color-50pct);
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
:host([input-prevented]) [part='input-field'] {
|
|
1177
|
+
animation: shake 0.15s infinite;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
@keyframes shake {
|
|
1181
|
+
25% {
|
|
1182
|
+
transform: translateX(4px);
|
|
1183
|
+
}
|
|
1184
|
+
75% {
|
|
1185
|
+
transform: translateX(-4px);
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
/* Small theme */
|
|
1190
|
+
:host([theme~='small']) {
|
|
1191
|
+
font-size: var(--lumo-font-size-s);
|
|
1192
|
+
--lumo-text-field-size: var(--lumo-size-s);
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
:host([theme~='small']) [part='label'] {
|
|
1196
|
+
font-size: var(--lumo-font-size-xs);
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
:host([theme~='small']) [part='error-message'] {
|
|
1200
|
+
font-size: var(--lumo-font-size-xxs);
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
/* Slotted content */
|
|
1204
|
+
[part='input-field'] ::slotted(:not(vaadin-icon):not(input):not(textarea)) {
|
|
1205
|
+
color: var(--lumo-secondary-text-color);
|
|
1206
|
+
font-weight: 400;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
[part='clear-button']::before {
|
|
1210
|
+
content: var(--lumo-icons-cross);
|
|
1211
|
+
}
|
|
1212
|
+
`;
|
|
1213
|
+
|
|
1214
|
+
const inputFieldShared$1 = [requiredField$1, fieldButton$1, helper$1, inputField$1];
|
|
1215
|
+
|
|
1216
|
+
registerStyles$1('', inputFieldShared$1, {
|
|
1217
|
+
moduleId: 'lumo-input-field-shared-styles',
|
|
1218
|
+
});
|
|
1219
|
+
|
|
1220
|
+
/**
|
|
1221
|
+
* @license
|
|
1222
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
1223
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
1224
|
+
*/
|
|
1225
|
+
|
|
1226
|
+
registerStyles$1('vaadin-text-field', inputFieldShared$1, {
|
|
1227
|
+
moduleId: 'lumo-text-field-styles',
|
|
1228
|
+
});
|
|
1229
|
+
|
|
1230
|
+
/**
|
|
1231
|
+
* @license
|
|
1232
|
+
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
1233
|
+
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
|
1234
|
+
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
|
1235
|
+
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
|
1236
|
+
* Code distributed by Google as part of the polymer project is also
|
|
1237
|
+
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
|
1238
|
+
*/
|
|
1239
|
+
|
|
1240
|
+
/**
|
|
1241
|
+
* Async interface wrapper around `requestIdleCallback`. Falls back to
|
|
1242
|
+
* `setTimeout` on browsers that do not support `requestIdleCallback`.
|
|
1243
|
+
*
|
|
1244
|
+
* @namespace
|
|
1245
|
+
* @summary Async interface wrapper around `requestIdleCallback`.
|
|
1246
|
+
*/
|
|
1247
|
+
const idlePeriod = {
|
|
1248
|
+
/**
|
|
1249
|
+
* Enqueues a function called at `requestIdleCallback` timing.
|
|
1250
|
+
*
|
|
1251
|
+
* @memberof idlePeriod
|
|
1252
|
+
* @param {function(!IdleDeadline):void} fn Callback to run
|
|
1253
|
+
* @return {number} Handle used for canceling task
|
|
1254
|
+
*/
|
|
1255
|
+
run(fn) {
|
|
1256
|
+
return window.requestIdleCallback ? window.requestIdleCallback(fn) : window.setTimeout(fn, 16);
|
|
1257
|
+
},
|
|
1258
|
+
/**
|
|
1259
|
+
* Cancels a previously enqueued `idlePeriod` callback.
|
|
1260
|
+
*
|
|
1261
|
+
* @memberof idlePeriod
|
|
1262
|
+
* @param {number} handle Handle returned from `run` of callback to cancel
|
|
1263
|
+
* @return {void}
|
|
1264
|
+
*/
|
|
1265
|
+
cancel(handle) {
|
|
1266
|
+
if (window.cancelIdleCallback) {
|
|
1267
|
+
window.cancelIdleCallback(handle);
|
|
1268
|
+
} else {
|
|
1269
|
+
window.clearTimeout(handle);
|
|
1270
|
+
}
|
|
1271
|
+
},
|
|
1272
|
+
};
|
|
1273
|
+
|
|
1274
|
+
/**
|
|
1275
|
+
@license
|
|
1276
|
+
Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
1277
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
|
1278
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
|
1279
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
|
1280
|
+
Code distributed by Google as part of the polymer project is also
|
|
1281
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
|
1282
|
+
*/
|
|
1283
|
+
|
|
1284
|
+
const debouncerQueue = new Set();
|
|
1285
|
+
|
|
1286
|
+
/**
|
|
1287
|
+
* @summary Collapse multiple callbacks into one invocation after a timer.
|
|
1288
|
+
*/
|
|
1289
|
+
class Debouncer {
|
|
1290
|
+
/**
|
|
1291
|
+
* Creates a debouncer if no debouncer is passed as a parameter
|
|
1292
|
+
* or it cancels an active debouncer otherwise. The following
|
|
1293
|
+
* example shows how a debouncer can be called multiple times within a
|
|
1294
|
+
* microtask and "debounced" such that the provided callback function is
|
|
1295
|
+
* called once. Add this method to a custom element:
|
|
1296
|
+
*
|
|
1297
|
+
* ```js
|
|
1298
|
+
* import {microTask} from '@vaadin/component-base/src/async.js';
|
|
1299
|
+
* import {Debouncer} from '@vaadin/component-base/src/debounce.js';
|
|
1300
|
+
* // ...
|
|
1301
|
+
*
|
|
1302
|
+
* _debounceWork() {
|
|
1303
|
+
* this._debounceJob = Debouncer.debounce(this._debounceJob,
|
|
1304
|
+
* microTask, () => this._doWork());
|
|
1305
|
+
* }
|
|
1306
|
+
* ```
|
|
1307
|
+
*
|
|
1308
|
+
* If the `_debounceWork` method is called multiple times within the same
|
|
1309
|
+
* microtask, the `_doWork` function will be called only once at the next
|
|
1310
|
+
* microtask checkpoint.
|
|
1311
|
+
*
|
|
1312
|
+
* Note: In testing it is often convenient to avoid asynchrony. To accomplish
|
|
1313
|
+
* this with a debouncer, you can use `enqueueDebouncer` and
|
|
1314
|
+
* `flush`. For example, extend the above example by adding
|
|
1315
|
+
* `enqueueDebouncer(this._debounceJob)` at the end of the
|
|
1316
|
+
* `_debounceWork` method. Then in a test, call `flush` to ensure
|
|
1317
|
+
* the debouncer has completed.
|
|
1318
|
+
*
|
|
1319
|
+
* @param {Debouncer?} debouncer Debouncer object.
|
|
1320
|
+
* @param {!AsyncInterface} asyncModule Object with Async interface
|
|
1321
|
+
* @param {function()} callback Callback to run.
|
|
1322
|
+
* @return {!Debouncer} Returns a debouncer object.
|
|
1323
|
+
*/
|
|
1324
|
+
static debounce(debouncer, asyncModule, callback) {
|
|
1325
|
+
if (debouncer instanceof Debouncer) {
|
|
1326
|
+
// Cancel the async callback, but leave in debouncerQueue if it was
|
|
1327
|
+
// enqueued, to maintain 1.x flush order
|
|
1328
|
+
debouncer._cancelAsync();
|
|
1329
|
+
} else {
|
|
1330
|
+
debouncer = new Debouncer();
|
|
1331
|
+
}
|
|
1332
|
+
debouncer.setConfig(asyncModule, callback);
|
|
1333
|
+
return debouncer;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
constructor() {
|
|
1337
|
+
this._asyncModule = null;
|
|
1338
|
+
this._callback = null;
|
|
1339
|
+
this._timer = null;
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
/**
|
|
1343
|
+
* Sets the scheduler; that is, a module with the Async interface,
|
|
1344
|
+
* a callback and optional arguments to be passed to the run function
|
|
1345
|
+
* from the async module.
|
|
1346
|
+
*
|
|
1347
|
+
* @param {!AsyncInterface} asyncModule Object with Async interface.
|
|
1348
|
+
* @param {function()} callback Callback to run.
|
|
1349
|
+
* @return {void}
|
|
1350
|
+
*/
|
|
1351
|
+
setConfig(asyncModule, callback) {
|
|
1352
|
+
this._asyncModule = asyncModule;
|
|
1353
|
+
this._callback = callback;
|
|
1354
|
+
this._timer = this._asyncModule.run(() => {
|
|
1355
|
+
this._timer = null;
|
|
1356
|
+
debouncerQueue.delete(this);
|
|
1357
|
+
this._callback();
|
|
1358
|
+
});
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* Cancels an active debouncer and returns a reference to itself.
|
|
1363
|
+
*
|
|
1364
|
+
* @return {void}
|
|
1365
|
+
*/
|
|
1366
|
+
cancel() {
|
|
1367
|
+
if (this.isActive()) {
|
|
1368
|
+
this._cancelAsync();
|
|
1369
|
+
// Canceling a debouncer removes its spot from the flush queue,
|
|
1370
|
+
// so if a debouncer is manually canceled and re-debounced, it
|
|
1371
|
+
// will reset its flush order (this is a very minor difference from 1.x)
|
|
1372
|
+
// Re-debouncing via the `debounce` API retains the 1.x FIFO flush order
|
|
1373
|
+
debouncerQueue.delete(this);
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
/**
|
|
1378
|
+
* Cancels a debouncer's async callback.
|
|
1379
|
+
*
|
|
1380
|
+
* @return {void}
|
|
1381
|
+
*/
|
|
1382
|
+
_cancelAsync() {
|
|
1383
|
+
if (this.isActive()) {
|
|
1384
|
+
this._asyncModule.cancel(/** @type {number} */ (this._timer));
|
|
1385
|
+
this._timer = null;
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
/**
|
|
1390
|
+
* Flushes an active debouncer and returns a reference to itself.
|
|
1391
|
+
*
|
|
1392
|
+
* @return {void}
|
|
1393
|
+
*/
|
|
1394
|
+
flush() {
|
|
1395
|
+
if (this.isActive()) {
|
|
1396
|
+
this.cancel();
|
|
1397
|
+
this._callback();
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
/**
|
|
1402
|
+
* Returns true if the debouncer is active.
|
|
1403
|
+
*
|
|
1404
|
+
* @return {boolean} True if active.
|
|
1405
|
+
*/
|
|
1406
|
+
isActive() {
|
|
1407
|
+
return this._timer != null;
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
/**
|
|
1412
|
+
* Adds a `Debouncer` to a list of globally flushable tasks.
|
|
1413
|
+
*
|
|
1414
|
+
* @param {!Debouncer} debouncer Debouncer to enqueue
|
|
1415
|
+
* @return {void}
|
|
1416
|
+
*/
|
|
1417
|
+
function enqueueDebouncer(debouncer) {
|
|
1418
|
+
debouncerQueue.add(debouncer);
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
/**
|
|
1422
|
+
* @license
|
|
1423
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
1424
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
1425
|
+
*/
|
|
1426
|
+
|
|
1427
|
+
/**
|
|
1428
|
+
* Array of Vaadin custom element classes that have been subscribed to the dir changes.
|
|
1429
|
+
*/
|
|
1430
|
+
const directionSubscribers = [];
|
|
1431
|
+
|
|
1432
|
+
function alignDirs(element, documentDir, elementDir = element.getAttribute('dir')) {
|
|
1433
|
+
if (documentDir) {
|
|
1434
|
+
element.setAttribute('dir', documentDir);
|
|
1435
|
+
} else if (elementDir != null) {
|
|
1436
|
+
element.removeAttribute('dir');
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
function getDocumentDir() {
|
|
1441
|
+
return document.documentElement.getAttribute('dir');
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
function directionUpdater() {
|
|
1445
|
+
const documentDir = getDocumentDir();
|
|
1446
|
+
directionSubscribers.forEach((element) => {
|
|
1447
|
+
alignDirs(element, documentDir);
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
const directionObserver = new MutationObserver(directionUpdater);
|
|
1452
|
+
directionObserver.observe(document.documentElement, { attributes: true, attributeFilter: ['dir'] });
|
|
1453
|
+
|
|
1454
|
+
/**
|
|
1455
|
+
* A mixin to handle `dir` attribute based on the one set on the `<html>` element.
|
|
1456
|
+
*
|
|
1457
|
+
* @polymerMixin
|
|
1458
|
+
*/
|
|
1459
|
+
const DirMixin = (superClass) =>
|
|
1460
|
+
class VaadinDirMixin extends superClass {
|
|
1461
|
+
static get properties() {
|
|
1462
|
+
return {
|
|
1463
|
+
/**
|
|
1464
|
+
* @protected
|
|
1465
|
+
*/
|
|
1466
|
+
dir: {
|
|
1467
|
+
type: String,
|
|
1468
|
+
value: '',
|
|
1469
|
+
reflectToAttribute: true,
|
|
1470
|
+
converter: {
|
|
1471
|
+
fromAttribute: (attr) => {
|
|
1472
|
+
return !attr ? '' : attr;
|
|
1473
|
+
},
|
|
1474
|
+
toAttribute: (prop) => {
|
|
1475
|
+
return prop === '' ? null : prop;
|
|
1476
|
+
},
|
|
1477
|
+
},
|
|
1478
|
+
},
|
|
1479
|
+
};
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
/**
|
|
1483
|
+
* @return {boolean}
|
|
1484
|
+
* @protected
|
|
1485
|
+
*/
|
|
1486
|
+
get __isRTL() {
|
|
1487
|
+
return this.getAttribute('dir') === 'rtl';
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
/** @protected */
|
|
1491
|
+
connectedCallback() {
|
|
1492
|
+
super.connectedCallback();
|
|
1493
|
+
|
|
1494
|
+
if (!this.hasAttribute('dir') || this.__restoreSubscription) {
|
|
1495
|
+
this.__subscribe();
|
|
1496
|
+
alignDirs(this, getDocumentDir(), null);
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
/** @protected */
|
|
1501
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
1502
|
+
super.attributeChangedCallback(name, oldValue, newValue);
|
|
1503
|
+
if (name !== 'dir') {
|
|
1504
|
+
return;
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
const documentDir = getDocumentDir();
|
|
1508
|
+
|
|
1509
|
+
// New value equals to the document direction and the element is not subscribed to the changes
|
|
1510
|
+
const newValueEqlDocDir = newValue === documentDir && directionSubscribers.indexOf(this) === -1;
|
|
1511
|
+
// Value was emptied and the element is not subscribed to the changes
|
|
1512
|
+
const newValueEmptied = !newValue && oldValue && directionSubscribers.indexOf(this) === -1;
|
|
1513
|
+
// New value is different and the old equals to document direction and the element is not subscribed to the changes
|
|
1514
|
+
const newDiffValue = newValue !== documentDir && oldValue === documentDir;
|
|
1515
|
+
|
|
1516
|
+
if (newValueEqlDocDir || newValueEmptied) {
|
|
1517
|
+
this.__subscribe();
|
|
1518
|
+
alignDirs(this, documentDir, newValue);
|
|
1519
|
+
} else if (newDiffValue) {
|
|
1520
|
+
this.__unsubscribe();
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
/** @protected */
|
|
1525
|
+
disconnectedCallback() {
|
|
1526
|
+
super.disconnectedCallback();
|
|
1527
|
+
this.__restoreSubscription = directionSubscribers.includes(this);
|
|
1528
|
+
this.__unsubscribe();
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
/** @protected */
|
|
1532
|
+
_valueToNodeAttribute(node, value, attribute) {
|
|
1533
|
+
// Override default Polymer attribute reflection to match native behavior of HTMLElement.dir property
|
|
1534
|
+
// If the property contains an empty string then it should not create an empty attribute
|
|
1535
|
+
if (attribute === 'dir' && value === '' && !node.hasAttribute('dir')) {
|
|
1536
|
+
return;
|
|
1537
|
+
}
|
|
1538
|
+
super._valueToNodeAttribute(node, value, attribute);
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
/** @protected */
|
|
1542
|
+
_attributeToProperty(attribute, value, type) {
|
|
1543
|
+
// Override default Polymer attribute reflection to match native behavior of HTMLElement.dir property
|
|
1544
|
+
// If the attribute is removed, then the dir property should contain an empty string instead of null
|
|
1545
|
+
if (attribute === 'dir' && !value) {
|
|
1546
|
+
this.dir = '';
|
|
1547
|
+
} else {
|
|
1548
|
+
super._attributeToProperty(attribute, value, type);
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
/** @private */
|
|
1553
|
+
__subscribe() {
|
|
1554
|
+
if (!directionSubscribers.includes(this)) {
|
|
1555
|
+
directionSubscribers.push(this);
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
/** @private */
|
|
1560
|
+
__unsubscribe() {
|
|
1561
|
+
if (directionSubscribers.includes(this)) {
|
|
1562
|
+
directionSubscribers.splice(directionSubscribers.indexOf(this), 1);
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
};
|
|
1566
|
+
|
|
1567
|
+
/**
|
|
1568
|
+
* @license
|
|
1569
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
1570
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
1571
|
+
*/
|
|
1572
|
+
|
|
1573
|
+
if (!window.Vaadin) {
|
|
1574
|
+
window.Vaadin = {};
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
/**
|
|
1578
|
+
* Array of Vaadin custom element classes that have been finalized.
|
|
1579
|
+
*/
|
|
1580
|
+
if (!window.Vaadin.registrations) {
|
|
1581
|
+
window.Vaadin.registrations = [];
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
if (!window.Vaadin.developmentModeCallback) {
|
|
1585
|
+
window.Vaadin.developmentModeCallback = {};
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
window.Vaadin.developmentModeCallback['vaadin-usage-statistics'] = function () {
|
|
1589
|
+
usageStatistics();
|
|
1590
|
+
};
|
|
1591
|
+
|
|
1592
|
+
let statsJob;
|
|
1593
|
+
|
|
1594
|
+
const registered = new Set();
|
|
1595
|
+
|
|
1596
|
+
/**
|
|
1597
|
+
* @polymerMixin
|
|
1598
|
+
* @mixes DirMixin
|
|
1599
|
+
*/
|
|
1600
|
+
const ElementMixin = (superClass) =>
|
|
1601
|
+
class VaadinElementMixin extends DirMixin(superClass) {
|
|
1602
|
+
static get version() {
|
|
1603
|
+
return '24.2.3';
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
/** @protected */
|
|
1607
|
+
static finalize() {
|
|
1608
|
+
super.finalize();
|
|
1609
|
+
|
|
1610
|
+
const { is } = this;
|
|
1611
|
+
|
|
1612
|
+
// Registers a class prototype for telemetry purposes.
|
|
1613
|
+
if (is && !registered.has(is)) {
|
|
1614
|
+
window.Vaadin.registrations.push(this);
|
|
1615
|
+
registered.add(is);
|
|
1616
|
+
|
|
1617
|
+
if (window.Vaadin.developmentModeCallback) {
|
|
1618
|
+
statsJob = Debouncer.debounce(statsJob, idlePeriod, () => {
|
|
1619
|
+
window.Vaadin.developmentModeCallback['vaadin-usage-statistics']();
|
|
1620
|
+
});
|
|
1621
|
+
enqueueDebouncer(statsJob);
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
constructor() {
|
|
1627
|
+
super();
|
|
1628
|
+
|
|
1629
|
+
if (document.doctype === null) {
|
|
1630
|
+
console.warn(
|
|
1631
|
+
'Vaadin components require the "standards mode" declaration. Please add <!DOCTYPE html> to the HTML document.',
|
|
1632
|
+
);
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
};
|
|
1636
|
+
|
|
1637
|
+
/**
|
|
1638
|
+
* @license
|
|
1639
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
1640
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
1641
|
+
*/
|
|
1642
|
+
|
|
1643
|
+
/**
|
|
1644
|
+
* Returns true if the given node is an empty text node, false otherwise.
|
|
1645
|
+
*
|
|
1646
|
+
* @param {Node} node
|
|
1647
|
+
* @return {boolean}
|
|
1648
|
+
*/
|
|
1649
|
+
function isEmptyTextNode$1(node) {
|
|
1650
|
+
return node.nodeType === Node.TEXT_NODE && node.textContent.trim() === '';
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
/**
|
|
1654
|
+
* @license
|
|
1655
|
+
* Copyright (c) 2023 Vaadin Ltd.
|
|
1656
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
1657
|
+
*/
|
|
1658
|
+
|
|
1659
|
+
/**
|
|
1660
|
+
* A helper for observing slot changes.
|
|
1661
|
+
*/
|
|
1662
|
+
class SlotObserver$1 {
|
|
1663
|
+
constructor(slot, callback) {
|
|
1664
|
+
/** @type HTMLSlotElement */
|
|
1665
|
+
this.slot = slot;
|
|
1666
|
+
|
|
1667
|
+
/** @type Function */
|
|
1668
|
+
this.callback = callback;
|
|
1669
|
+
|
|
1670
|
+
/** @type {Node[]} */
|
|
1671
|
+
this._storedNodes = [];
|
|
1672
|
+
|
|
1673
|
+
this._connected = false;
|
|
1674
|
+
this._scheduled = false;
|
|
1675
|
+
|
|
1676
|
+
this._boundSchedule = () => {
|
|
1677
|
+
this._schedule();
|
|
1678
|
+
};
|
|
1679
|
+
|
|
1680
|
+
this.connect();
|
|
1681
|
+
this._schedule();
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
/**
|
|
1685
|
+
* Activates an observer. This method is automatically called when
|
|
1686
|
+
* a `SlotObserver` is created. It should only be called to re-activate
|
|
1687
|
+
* an observer that has been deactivated via the `disconnect` method.
|
|
1688
|
+
*/
|
|
1689
|
+
connect() {
|
|
1690
|
+
this.slot.addEventListener('slotchange', this._boundSchedule);
|
|
1691
|
+
this._connected = true;
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1694
|
+
/**
|
|
1695
|
+
* Deactivates the observer. After calling this method the observer callback
|
|
1696
|
+
* will not be called when changes to slotted nodes occur. The `connect` method
|
|
1697
|
+
* may be subsequently called to reactivate the observer.
|
|
1698
|
+
*/
|
|
1699
|
+
disconnect() {
|
|
1700
|
+
this.slot.removeEventListener('slotchange', this._boundSchedule);
|
|
1701
|
+
this._connected = false;
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
/** @private */
|
|
1705
|
+
_schedule() {
|
|
1706
|
+
if (!this._scheduled) {
|
|
1707
|
+
this._scheduled = true;
|
|
1708
|
+
|
|
1709
|
+
queueMicrotask(() => {
|
|
1710
|
+
this.flush();
|
|
1711
|
+
});
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
/**
|
|
1716
|
+
* Run the observer callback synchronously.
|
|
1717
|
+
*/
|
|
1718
|
+
flush() {
|
|
1719
|
+
if (!this._connected) {
|
|
1720
|
+
return;
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
this._scheduled = false;
|
|
1724
|
+
|
|
1725
|
+
this._processNodes();
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
/** @private */
|
|
1729
|
+
_processNodes() {
|
|
1730
|
+
const currentNodes = this.slot.assignedNodes({ flatten: true });
|
|
1731
|
+
|
|
1732
|
+
let addedNodes = [];
|
|
1733
|
+
const removedNodes = [];
|
|
1734
|
+
const movedNodes = [];
|
|
1735
|
+
|
|
1736
|
+
if (currentNodes.length) {
|
|
1737
|
+
addedNodes = currentNodes.filter((node) => !this._storedNodes.includes(node));
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
if (this._storedNodes.length) {
|
|
1741
|
+
this._storedNodes.forEach((node, index) => {
|
|
1742
|
+
const idx = currentNodes.indexOf(node);
|
|
1743
|
+
if (idx === -1) {
|
|
1744
|
+
removedNodes.push(node);
|
|
1745
|
+
} else if (idx !== index) {
|
|
1746
|
+
movedNodes.push(node);
|
|
1747
|
+
}
|
|
1748
|
+
});
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
if (addedNodes.length || removedNodes.length || movedNodes.length) {
|
|
1752
|
+
this.callback({ addedNodes, movedNodes, removedNodes });
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
this._storedNodes = currentNodes;
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
/**
|
|
1760
|
+
* @license
|
|
1761
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
1762
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
1763
|
+
*/
|
|
1764
|
+
|
|
1765
|
+
let uniqueId$1 = 0;
|
|
1766
|
+
|
|
1767
|
+
/**
|
|
1768
|
+
* Returns a unique integer id.
|
|
1769
|
+
*
|
|
1770
|
+
* @return {number}
|
|
1771
|
+
*/
|
|
1772
|
+
function generateUniqueId$1() {
|
|
1773
|
+
// eslint-disable-next-line no-plusplus
|
|
1774
|
+
return uniqueId$1++;
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
/**
|
|
1778
|
+
* @license
|
|
1779
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
1780
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
1781
|
+
*/
|
|
1782
|
+
|
|
1783
|
+
/**
|
|
1784
|
+
* A controller for providing content to slot element and observing changes.
|
|
1785
|
+
*/
|
|
1786
|
+
class SlotController$1 extends EventTarget {
|
|
1787
|
+
/**
|
|
1788
|
+
* Ensure that every instance has unique ID.
|
|
1789
|
+
*
|
|
1790
|
+
* @param {HTMLElement} host
|
|
1791
|
+
* @param {string} slotName
|
|
1792
|
+
* @return {string}
|
|
1793
|
+
* @protected
|
|
1794
|
+
*/
|
|
1795
|
+
static generateId(host, slotName) {
|
|
1796
|
+
const prefix = slotName || 'default';
|
|
1797
|
+
return `${prefix}-${host.localName}-${generateUniqueId$1()}`;
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
constructor(host, slotName, tagName, config = {}) {
|
|
1801
|
+
super();
|
|
1802
|
+
|
|
1803
|
+
const { initializer, multiple, observe, useUniqueId } = config;
|
|
1804
|
+
|
|
1805
|
+
this.host = host;
|
|
1806
|
+
this.slotName = slotName;
|
|
1807
|
+
this.tagName = tagName;
|
|
1808
|
+
this.observe = typeof observe === 'boolean' ? observe : true;
|
|
1809
|
+
this.multiple = typeof multiple === 'boolean' ? multiple : false;
|
|
1810
|
+
this.slotInitializer = initializer;
|
|
1811
|
+
|
|
1812
|
+
if (multiple) {
|
|
1813
|
+
this.nodes = [];
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
// Only generate the default ID if requested by the controller.
|
|
1817
|
+
if (useUniqueId) {
|
|
1818
|
+
this.defaultId = this.constructor.generateId(host, slotName);
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
hostConnected() {
|
|
1823
|
+
if (!this.initialized) {
|
|
1824
|
+
if (this.multiple) {
|
|
1825
|
+
this.initMultiple();
|
|
1826
|
+
} else {
|
|
1827
|
+
this.initSingle();
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
if (this.observe) {
|
|
1831
|
+
this.observeSlot();
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
this.initialized = true;
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
/** @protected */
|
|
1839
|
+
initSingle() {
|
|
1840
|
+
let node = this.getSlotChild();
|
|
1841
|
+
|
|
1842
|
+
if (!node) {
|
|
1843
|
+
node = this.attachDefaultNode();
|
|
1844
|
+
this.initNode(node);
|
|
1845
|
+
} else {
|
|
1846
|
+
this.node = node;
|
|
1847
|
+
this.initAddedNode(node);
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
/** @protected */
|
|
1852
|
+
initMultiple() {
|
|
1853
|
+
const children = this.getSlotChildren();
|
|
1854
|
+
|
|
1855
|
+
if (children.length === 0) {
|
|
1856
|
+
const defaultNode = this.attachDefaultNode();
|
|
1857
|
+
if (defaultNode) {
|
|
1858
|
+
this.nodes = [defaultNode];
|
|
1859
|
+
this.initNode(defaultNode);
|
|
1860
|
+
}
|
|
1861
|
+
} else {
|
|
1862
|
+
this.nodes = children;
|
|
1863
|
+
children.forEach((node) => {
|
|
1864
|
+
this.initAddedNode(node);
|
|
1865
|
+
});
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
/**
|
|
1870
|
+
* Create and attach default node using the provided tag name, if any.
|
|
1871
|
+
* @return {Node | undefined}
|
|
1872
|
+
* @protected
|
|
1873
|
+
*/
|
|
1874
|
+
attachDefaultNode() {
|
|
1875
|
+
const { host, slotName, tagName } = this;
|
|
1876
|
+
|
|
1877
|
+
// Check if the node was created previously and if so, reuse it.
|
|
1878
|
+
let node = this.defaultNode;
|
|
1879
|
+
|
|
1880
|
+
// Tag name is optional, sometimes we don't init default content.
|
|
1881
|
+
if (!node && tagName) {
|
|
1882
|
+
node = document.createElement(tagName);
|
|
1883
|
+
if (node instanceof Element) {
|
|
1884
|
+
if (slotName !== '') {
|
|
1885
|
+
node.setAttribute('slot', slotName);
|
|
1886
|
+
}
|
|
1887
|
+
this.node = node;
|
|
1888
|
+
this.defaultNode = node;
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
if (node) {
|
|
1893
|
+
host.appendChild(node);
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
return node;
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
/**
|
|
1900
|
+
* Return the list of nodes matching the slot managed by the controller.
|
|
1901
|
+
* @return {Node}
|
|
1902
|
+
*/
|
|
1903
|
+
getSlotChildren() {
|
|
1904
|
+
const { slotName } = this;
|
|
1905
|
+
return Array.from(this.host.childNodes).filter((node) => {
|
|
1906
|
+
// Either an element (any slot) or a text node (only un-named slot).
|
|
1907
|
+
return (
|
|
1908
|
+
(node.nodeType === Node.ELEMENT_NODE && node.slot === slotName) ||
|
|
1909
|
+
(node.nodeType === Node.TEXT_NODE && node.textContent.trim() && slotName === '')
|
|
1910
|
+
);
|
|
1911
|
+
});
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
/**
|
|
1915
|
+
* Return a reference to the node managed by the controller.
|
|
1916
|
+
* @return {Node}
|
|
1917
|
+
*/
|
|
1918
|
+
getSlotChild() {
|
|
1919
|
+
return this.getSlotChildren()[0];
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
/**
|
|
1923
|
+
* Run `slotInitializer` for the node managed by the controller.
|
|
1924
|
+
*
|
|
1925
|
+
* @param {Node} node
|
|
1926
|
+
* @protected
|
|
1927
|
+
*/
|
|
1928
|
+
initNode(node) {
|
|
1929
|
+
const { slotInitializer } = this;
|
|
1930
|
+
// Don't try to bind `this` to initializer (normally it's arrow function).
|
|
1931
|
+
// Instead, pass the host as a first argument to access component's state.
|
|
1932
|
+
if (slotInitializer) {
|
|
1933
|
+
slotInitializer(node, this.host);
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
/**
|
|
1938
|
+
* Override to initialize the newly added custom node.
|
|
1939
|
+
*
|
|
1940
|
+
* @param {Node} _node
|
|
1941
|
+
* @protected
|
|
1942
|
+
*/
|
|
1943
|
+
initCustomNode(_node) {}
|
|
1944
|
+
|
|
1945
|
+
/**
|
|
1946
|
+
* Override to teardown slotted node when it's removed.
|
|
1947
|
+
*
|
|
1948
|
+
* @param {Node} _node
|
|
1949
|
+
* @protected
|
|
1950
|
+
*/
|
|
1951
|
+
teardownNode(_node) {}
|
|
1952
|
+
|
|
1953
|
+
/**
|
|
1954
|
+
* Run both `initCustomNode` and `initNode` for a custom slotted node.
|
|
1955
|
+
*
|
|
1956
|
+
* @param {Node} node
|
|
1957
|
+
* @protected
|
|
1958
|
+
*/
|
|
1959
|
+
initAddedNode(node) {
|
|
1960
|
+
if (node !== this.defaultNode) {
|
|
1961
|
+
this.initCustomNode(node);
|
|
1962
|
+
this.initNode(node);
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
/**
|
|
1967
|
+
* Setup the observer to manage slot content changes.
|
|
1968
|
+
* @protected
|
|
1969
|
+
*/
|
|
1970
|
+
observeSlot() {
|
|
1971
|
+
const { slotName } = this;
|
|
1972
|
+
const selector = slotName === '' ? 'slot:not([name])' : `slot[name=${slotName}]`;
|
|
1973
|
+
const slot = this.host.shadowRoot.querySelector(selector);
|
|
1974
|
+
|
|
1975
|
+
this.__slotObserver = new SlotObserver$1(slot, ({ addedNodes, removedNodes }) => {
|
|
1976
|
+
const current = this.multiple ? this.nodes : [this.node];
|
|
1977
|
+
|
|
1978
|
+
// Calling `slot.assignedNodes()` includes whitespace text nodes in case of default slot:
|
|
1979
|
+
// unlike comment nodes, they are not filtered out. So we need to manually ignore them.
|
|
1980
|
+
const newNodes = addedNodes.filter((node) => !isEmptyTextNode$1(node) && !current.includes(node));
|
|
1981
|
+
|
|
1982
|
+
if (removedNodes.length) {
|
|
1983
|
+
this.nodes = current.filter((node) => !removedNodes.includes(node));
|
|
1984
|
+
|
|
1985
|
+
removedNodes.forEach((node) => {
|
|
1986
|
+
this.teardownNode(node);
|
|
1987
|
+
});
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
if (newNodes && newNodes.length > 0) {
|
|
1991
|
+
if (this.multiple) {
|
|
1992
|
+
// Remove default node if exists
|
|
1993
|
+
if (this.defaultNode) {
|
|
1994
|
+
this.defaultNode.remove();
|
|
1995
|
+
}
|
|
1996
|
+
this.nodes = [...current, ...newNodes].filter((node) => node !== this.defaultNode);
|
|
1997
|
+
newNodes.forEach((node) => {
|
|
1998
|
+
this.initAddedNode(node);
|
|
1999
|
+
});
|
|
2000
|
+
} else {
|
|
2001
|
+
// Remove previous node if exists
|
|
2002
|
+
if (this.node) {
|
|
2003
|
+
this.node.remove();
|
|
2004
|
+
}
|
|
2005
|
+
this.node = newNodes[0];
|
|
2006
|
+
this.initAddedNode(this.node);
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
});
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
/**
|
|
2014
|
+
* @license
|
|
2015
|
+
* Copyright (c) 2022 - 2023 Vaadin Ltd.
|
|
2016
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
2017
|
+
*/
|
|
2018
|
+
|
|
2019
|
+
/**
|
|
2020
|
+
* A controller that manages the slotted tooltip element.
|
|
2021
|
+
*/
|
|
2022
|
+
class TooltipController extends SlotController$1 {
|
|
2023
|
+
constructor(host) {
|
|
2024
|
+
// Do not provide slot factory to create tooltip lazily.
|
|
2025
|
+
super(host, 'tooltip');
|
|
2026
|
+
|
|
2027
|
+
this.setTarget(host);
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
/**
|
|
2031
|
+
* Override to initialize the newly added custom tooltip.
|
|
2032
|
+
*
|
|
2033
|
+
* @param {Node} tooltipNode
|
|
2034
|
+
* @protected
|
|
2035
|
+
* @override
|
|
2036
|
+
*/
|
|
2037
|
+
initCustomNode(tooltipNode) {
|
|
2038
|
+
tooltipNode.target = this.target;
|
|
2039
|
+
|
|
2040
|
+
if (this.ariaTarget !== undefined) {
|
|
2041
|
+
tooltipNode.ariaTarget = this.ariaTarget;
|
|
2042
|
+
}
|
|
2043
|
+
|
|
2044
|
+
if (this.context !== undefined) {
|
|
2045
|
+
tooltipNode.context = this.context;
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
if (this.manual !== undefined) {
|
|
2049
|
+
tooltipNode.manual = this.manual;
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
if (this.opened !== undefined) {
|
|
2053
|
+
tooltipNode.opened = this.opened;
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
if (this.position !== undefined) {
|
|
2057
|
+
tooltipNode._position = this.position;
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
if (this.shouldShow !== undefined) {
|
|
2061
|
+
tooltipNode.shouldShow = this.shouldShow;
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
this.__notifyChange();
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
/**
|
|
2068
|
+
* Override to notify the host when the tooltip is removed.
|
|
2069
|
+
*
|
|
2070
|
+
* @param {Node} tooltipNode
|
|
2071
|
+
* @protected
|
|
2072
|
+
* @override
|
|
2073
|
+
*/
|
|
2074
|
+
teardownNode() {
|
|
2075
|
+
this.__notifyChange();
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
/**
|
|
2079
|
+
* Set an HTML element for linking with the tooltip overlay
|
|
2080
|
+
* via `aria-describedby` attribute used by screen readers.
|
|
2081
|
+
* @param {HTMLElement} ariaTarget
|
|
2082
|
+
*/
|
|
2083
|
+
setAriaTarget(ariaTarget) {
|
|
2084
|
+
this.ariaTarget = ariaTarget;
|
|
2085
|
+
|
|
2086
|
+
const tooltipNode = this.node;
|
|
2087
|
+
if (tooltipNode) {
|
|
2088
|
+
tooltipNode.ariaTarget = ariaTarget;
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
/**
|
|
2093
|
+
* Set a context object to be used by generator.
|
|
2094
|
+
* @param {object} context
|
|
2095
|
+
*/
|
|
2096
|
+
setContext(context) {
|
|
2097
|
+
this.context = context;
|
|
2098
|
+
|
|
2099
|
+
const tooltipNode = this.node;
|
|
2100
|
+
if (tooltipNode) {
|
|
2101
|
+
tooltipNode.context = context;
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
/**
|
|
2106
|
+
* Toggle manual state on the slotted tooltip.
|
|
2107
|
+
* @param {boolean} manual
|
|
2108
|
+
*/
|
|
2109
|
+
setManual(manual) {
|
|
2110
|
+
this.manual = manual;
|
|
2111
|
+
|
|
2112
|
+
const tooltipNode = this.node;
|
|
2113
|
+
if (tooltipNode) {
|
|
2114
|
+
tooltipNode.manual = manual;
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
/**
|
|
2119
|
+
* Toggle opened state on the slotted tooltip.
|
|
2120
|
+
* @param {boolean} opened
|
|
2121
|
+
*/
|
|
2122
|
+
setOpened(opened) {
|
|
2123
|
+
this.opened = opened;
|
|
2124
|
+
|
|
2125
|
+
const tooltipNode = this.node;
|
|
2126
|
+
if (tooltipNode) {
|
|
2127
|
+
tooltipNode.opened = opened;
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2131
|
+
/**
|
|
2132
|
+
* Set default position for the slotted tooltip.
|
|
2133
|
+
* This can be overridden by setting the position
|
|
2134
|
+
* using corresponding property or attribute.
|
|
2135
|
+
* @param {string} position
|
|
2136
|
+
*/
|
|
2137
|
+
setPosition(position) {
|
|
2138
|
+
this.position = position;
|
|
2139
|
+
|
|
2140
|
+
const tooltipNode = this.node;
|
|
2141
|
+
if (tooltipNode) {
|
|
2142
|
+
tooltipNode._position = position;
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
/**
|
|
2147
|
+
* Set function used to detect whether to show
|
|
2148
|
+
* the tooltip based on a condition.
|
|
2149
|
+
* @param {Function} shouldShow
|
|
2150
|
+
*/
|
|
2151
|
+
setShouldShow(shouldShow) {
|
|
2152
|
+
this.shouldShow = shouldShow;
|
|
2153
|
+
|
|
2154
|
+
const tooltipNode = this.node;
|
|
2155
|
+
if (tooltipNode) {
|
|
2156
|
+
tooltipNode.shouldShow = shouldShow;
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
/**
|
|
2161
|
+
* Set an HTML element to attach the tooltip to.
|
|
2162
|
+
* @param {HTMLElement} target
|
|
2163
|
+
*/
|
|
2164
|
+
setTarget(target) {
|
|
2165
|
+
this.target = target;
|
|
2166
|
+
|
|
2167
|
+
const tooltipNode = this.node;
|
|
2168
|
+
if (tooltipNode) {
|
|
2169
|
+
tooltipNode.target = target;
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
|
|
2173
|
+
/** @private */
|
|
2174
|
+
__notifyChange() {
|
|
2175
|
+
this.dispatchEvent(new CustomEvent('tooltip-changed', { detail: { node: this.node } }));
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2179
|
+
/**
|
|
2180
|
+
* @license
|
|
2181
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
2182
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
2183
|
+
*/
|
|
2184
|
+
|
|
2185
|
+
/**
|
|
2186
|
+
* A mixin to provide logic for vaadin-text-field and related components.
|
|
2187
|
+
*
|
|
2188
|
+
* @polymerMixin
|
|
2189
|
+
* @mixes InputControlMixin
|
|
2190
|
+
*/
|
|
2191
|
+
const InputFieldMixin = (superclass) =>
|
|
2192
|
+
class InputFieldMixinClass extends InputControlMixin(superclass) {
|
|
2193
|
+
static get properties() {
|
|
2194
|
+
return {
|
|
2195
|
+
/**
|
|
2196
|
+
* Whether the value of the control can be automatically completed by the browser.
|
|
2197
|
+
* List of available options at:
|
|
2198
|
+
* https://developer.mozilla.org/en/docs/Web/HTML/Element/input#attr-autocomplete
|
|
2199
|
+
*/
|
|
2200
|
+
autocomplete: {
|
|
2201
|
+
type: String,
|
|
2202
|
+
},
|
|
2203
|
+
|
|
2204
|
+
/**
|
|
2205
|
+
* This is a property supported by Safari that is used to control whether
|
|
2206
|
+
* autocorrection should be enabled when the user is entering/editing the text.
|
|
2207
|
+
* Possible values are:
|
|
2208
|
+
* on: Enable autocorrection.
|
|
2209
|
+
* off: Disable autocorrection.
|
|
2210
|
+
*/
|
|
2211
|
+
autocorrect: {
|
|
2212
|
+
type: String,
|
|
2213
|
+
},
|
|
2214
|
+
|
|
2215
|
+
/**
|
|
2216
|
+
* This is a property supported by Safari and Chrome that is used to control whether
|
|
2217
|
+
* autocapitalization should be enabled when the user is entering/editing the text.
|
|
2218
|
+
* Possible values are:
|
|
2219
|
+
* characters: Characters capitalization.
|
|
2220
|
+
* words: Words capitalization.
|
|
2221
|
+
* sentences: Sentences capitalization.
|
|
2222
|
+
* none: No capitalization.
|
|
2223
|
+
*/
|
|
2224
|
+
autocapitalize: {
|
|
2225
|
+
type: String,
|
|
2226
|
+
reflectToAttribute: true,
|
|
2227
|
+
},
|
|
2228
|
+
};
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
static get delegateAttrs() {
|
|
2232
|
+
return [...super.delegateAttrs, 'autocapitalize', 'autocomplete', 'autocorrect'];
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
// Workaround for https://github.com/Polymer/polymer/issues/5259
|
|
2236
|
+
get __data() {
|
|
2237
|
+
return this.__dataValue || {};
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
set __data(value) {
|
|
2241
|
+
this.__dataValue = value;
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
/**
|
|
2245
|
+
* @param {HTMLElement} input
|
|
2246
|
+
* @protected
|
|
2247
|
+
* @override
|
|
2248
|
+
*/
|
|
2249
|
+
_inputElementChanged(input) {
|
|
2250
|
+
super._inputElementChanged(input);
|
|
2251
|
+
|
|
2252
|
+
if (input) {
|
|
2253
|
+
// Discard value set on the custom slotted input.
|
|
2254
|
+
if (input.value && input.value !== this.value) {
|
|
2255
|
+
console.warn(`Please define value on the <${this.localName}> component!`);
|
|
2256
|
+
input.value = '';
|
|
2257
|
+
}
|
|
2258
|
+
|
|
2259
|
+
if (this.value) {
|
|
2260
|
+
input.value = this.value;
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
/**
|
|
2266
|
+
* Override an event listener from `FocusMixin`.
|
|
2267
|
+
* @param {boolean} focused
|
|
2268
|
+
* @protected
|
|
2269
|
+
* @override
|
|
2270
|
+
*/
|
|
2271
|
+
_setFocused(focused) {
|
|
2272
|
+
super._setFocused(focused);
|
|
2273
|
+
|
|
2274
|
+
// Do not validate when focusout is caused by document
|
|
2275
|
+
// losing focus, which happens on browser tab switch.
|
|
2276
|
+
if (!focused && document.hasFocus()) {
|
|
2277
|
+
this.validate();
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
/**
|
|
2282
|
+
* Override an event listener from `InputMixin`
|
|
2283
|
+
* to mark as valid after user started typing.
|
|
2284
|
+
* @param {Event} event
|
|
2285
|
+
* @protected
|
|
2286
|
+
* @override
|
|
2287
|
+
*/
|
|
2288
|
+
_onInput(event) {
|
|
2289
|
+
super._onInput(event);
|
|
2290
|
+
|
|
2291
|
+
if (this.invalid) {
|
|
2292
|
+
this.validate();
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
/**
|
|
2297
|
+
* Override an observer from `InputMixin` to validate the field
|
|
2298
|
+
* when a new value is set programmatically.
|
|
2299
|
+
*
|
|
2300
|
+
* @param {string | undefined} newValue
|
|
2301
|
+
* @param {string | undefined} oldValue
|
|
2302
|
+
* @protected
|
|
2303
|
+
* @override
|
|
2304
|
+
*/
|
|
2305
|
+
_valueChanged(newValue, oldValue) {
|
|
2306
|
+
super._valueChanged(newValue, oldValue);
|
|
2307
|
+
|
|
2308
|
+
if (oldValue === undefined) {
|
|
2309
|
+
return;
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2312
|
+
if (this.invalid) {
|
|
2313
|
+
this.validate();
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
};
|
|
2317
|
+
|
|
2318
|
+
/**
|
|
2319
|
+
* @license
|
|
2320
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
2321
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
2322
|
+
*/
|
|
2323
|
+
|
|
2324
|
+
/**
|
|
2325
|
+
* A mixin providing common text field functionality.
|
|
2326
|
+
*
|
|
2327
|
+
* @polymerMixin
|
|
2328
|
+
* @mixes InputFieldMixin
|
|
2329
|
+
*/
|
|
2330
|
+
const TextFieldMixin = (superClass) =>
|
|
2331
|
+
class TextFieldMixinClass extends InputFieldMixin(superClass) {
|
|
2332
|
+
static get properties() {
|
|
2333
|
+
return {
|
|
2334
|
+
/**
|
|
2335
|
+
* Maximum number of characters (in Unicode code points) that the user can enter.
|
|
2336
|
+
*/
|
|
2337
|
+
maxlength: {
|
|
2338
|
+
type: Number,
|
|
2339
|
+
},
|
|
2340
|
+
|
|
2341
|
+
/**
|
|
2342
|
+
* Minimum number of characters (in Unicode code points) that the user can enter.
|
|
2343
|
+
*/
|
|
2344
|
+
minlength: {
|
|
2345
|
+
type: Number,
|
|
2346
|
+
},
|
|
2347
|
+
|
|
2348
|
+
/**
|
|
2349
|
+
* A regular expression that the value is checked against.
|
|
2350
|
+
* The pattern must match the entire value, not just some subset.
|
|
2351
|
+
*/
|
|
2352
|
+
pattern: {
|
|
2353
|
+
type: String,
|
|
2354
|
+
},
|
|
2355
|
+
};
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2358
|
+
static get delegateAttrs() {
|
|
2359
|
+
return [...super.delegateAttrs, 'maxlength', 'minlength', 'pattern'];
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2362
|
+
static get constraints() {
|
|
2363
|
+
return [...super.constraints, 'maxlength', 'minlength', 'pattern'];
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
constructor() {
|
|
2367
|
+
super();
|
|
2368
|
+
this._setType('text');
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2371
|
+
/** @protected */
|
|
2372
|
+
get clearElement() {
|
|
2373
|
+
return this.$.clearButton;
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
/** @protected */
|
|
2377
|
+
ready() {
|
|
2378
|
+
super.ready();
|
|
2379
|
+
|
|
2380
|
+
this.addController(
|
|
2381
|
+
new InputController(this, (input) => {
|
|
2382
|
+
this._setInputElement(input);
|
|
2383
|
+
this._setFocusElement(input);
|
|
2384
|
+
this.stateTarget = input;
|
|
2385
|
+
this.ariaTarget = input;
|
|
2386
|
+
}),
|
|
2387
|
+
);
|
|
2388
|
+
this.addController(new LabelledInputController(this.inputElement, this._labelController));
|
|
2389
|
+
}
|
|
2390
|
+
};
|
|
2391
|
+
|
|
2392
|
+
/**
|
|
2393
|
+
* @license
|
|
2394
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
2395
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
2396
|
+
*/
|
|
2397
|
+
|
|
2398
|
+
registerStyles$1('vaadin-text-field', inputFieldShared$2, { moduleId: 'vaadin-text-field-styles' });
|
|
2399
|
+
|
|
2400
|
+
/**
|
|
2401
|
+
* `<vaadin-text-field>` is a web component that allows the user to input and edit text.
|
|
2402
|
+
*
|
|
2403
|
+
* ```html
|
|
2404
|
+
* <vaadin-text-field label="First Name"></vaadin-text-field>
|
|
2405
|
+
* ```
|
|
2406
|
+
*
|
|
2407
|
+
* ### Prefixes and suffixes
|
|
2408
|
+
*
|
|
2409
|
+
* These are child elements of a `<vaadin-text-field>` that are displayed
|
|
2410
|
+
* inline with the input, before or after.
|
|
2411
|
+
* In order for an element to be considered as a prefix, it must have the slot
|
|
2412
|
+
* attribute set to `prefix` (and similarly for `suffix`).
|
|
2413
|
+
*
|
|
2414
|
+
* ```html
|
|
2415
|
+
* <vaadin-text-field label="Email address">
|
|
2416
|
+
* <div slot="prefix">Sent to:</div>
|
|
2417
|
+
* <div slot="suffix">@vaadin.com</div>
|
|
2418
|
+
* </vaadin-text-field>
|
|
2419
|
+
* ```
|
|
2420
|
+
*
|
|
2421
|
+
* ### Styling
|
|
2422
|
+
*
|
|
2423
|
+
* The following custom properties are available for styling:
|
|
2424
|
+
*
|
|
2425
|
+
* Custom property | Description | Default
|
|
2426
|
+
* -------------------------------|----------------------------|---------
|
|
2427
|
+
* `--vaadin-field-default-width` | Default width of the field | `12em`
|
|
2428
|
+
*
|
|
2429
|
+
* The following shadow DOM parts are available for styling:
|
|
2430
|
+
*
|
|
2431
|
+
* Part name | Description
|
|
2432
|
+
* ---------------------|----------------
|
|
2433
|
+
* `label` | The label element
|
|
2434
|
+
* `input-field` | The element that wraps prefix, value and suffix
|
|
2435
|
+
* `clear-button` | The clear button
|
|
2436
|
+
* `error-message` | The error message element
|
|
2437
|
+
* `helper-text` | The helper text element wrapper
|
|
2438
|
+
* `required-indicator` | The `required` state indicator element
|
|
2439
|
+
*
|
|
2440
|
+
* The following state attributes are available for styling:
|
|
2441
|
+
*
|
|
2442
|
+
* Attribute | Description | Part name
|
|
2443
|
+
* --------------------|-------------|------------
|
|
2444
|
+
* `disabled` | Set to a disabled text field | :host
|
|
2445
|
+
* `has-value` | Set when the element has a value | :host
|
|
2446
|
+
* `has-label` | Set when the element has a label | :host
|
|
2447
|
+
* `has-helper` | Set when the element has helper text or slot | :host
|
|
2448
|
+
* `has-error-message` | Set when the element has an error message | :host
|
|
2449
|
+
* `invalid` | Set when the element is invalid | :host
|
|
2450
|
+
* `input-prevented` | Temporarily set when invalid input is prevented | :host
|
|
2451
|
+
* `focused` | Set when the element is focused | :host
|
|
2452
|
+
* `focus-ring` | Set when the element is keyboard focused | :host
|
|
2453
|
+
* `readonly` | Set to a readonly text field | :host
|
|
2454
|
+
*
|
|
2455
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
2456
|
+
*
|
|
2457
|
+
* @fires {Event} input - Fired when the value is changed by the user: on every typing keystroke, and the value is cleared using the clear button.
|
|
2458
|
+
* @fires {Event} change - Fired when the user commits a value change.
|
|
2459
|
+
* @fires {CustomEvent} invalid-changed - Fired when the `invalid` property changes.
|
|
2460
|
+
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
2461
|
+
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
2462
|
+
*
|
|
2463
|
+
* @customElement
|
|
2464
|
+
* @extends HTMLElement
|
|
2465
|
+
* @mixes ElementMixin
|
|
2466
|
+
* @mixes ThemableMixin
|
|
2467
|
+
* @mixes TextFieldMixin
|
|
2468
|
+
*/
|
|
2469
|
+
class TextField extends TextFieldMixin(ThemableMixin(ElementMixin(PolymerElement))) {
|
|
2470
|
+
static get is() {
|
|
2471
|
+
return 'vaadin-text-field';
|
|
2472
|
+
}
|
|
2473
|
+
|
|
2474
|
+
static get template() {
|
|
2475
|
+
return html`
|
|
2476
|
+
<style>
|
|
2477
|
+
[part='input-field'] {
|
|
241
2478
|
flex-grow: 0;
|
|
242
2479
|
}
|
|
243
2480
|
</style>
|
|
244
2481
|
|
|
245
|
-
<div class="vaadin-field-container">
|
|
246
|
-
<div part="label">
|
|
247
|
-
<slot name="label"></slot>
|
|
248
|
-
<span part="required-indicator" aria-hidden="true" on-click="focus"></span>
|
|
249
|
-
</div>
|
|
2482
|
+
<div class="vaadin-field-container">
|
|
2483
|
+
<div part="label">
|
|
2484
|
+
<slot name="label"></slot>
|
|
2485
|
+
<span part="required-indicator" aria-hidden="true" on-click="focus"></span>
|
|
2486
|
+
</div>
|
|
2487
|
+
|
|
2488
|
+
<vaadin-input-container
|
|
2489
|
+
part="input-field"
|
|
2490
|
+
readonly="[[readonly]]"
|
|
2491
|
+
disabled="[[disabled]]"
|
|
2492
|
+
invalid="[[invalid]]"
|
|
2493
|
+
theme$="[[_theme]]"
|
|
2494
|
+
>
|
|
2495
|
+
<slot name="prefix" slot="prefix"></slot>
|
|
2496
|
+
<slot name="input"></slot>
|
|
2497
|
+
<slot name="suffix" slot="suffix"></slot>
|
|
2498
|
+
<div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
|
|
2499
|
+
</vaadin-input-container>
|
|
2500
|
+
|
|
2501
|
+
<div part="helper-text">
|
|
2502
|
+
<slot name="helper"></slot>
|
|
2503
|
+
</div>
|
|
2504
|
+
|
|
2505
|
+
<div part="error-message">
|
|
2506
|
+
<slot name="error-message"></slot>
|
|
2507
|
+
</div>
|
|
2508
|
+
</div>
|
|
2509
|
+
<slot name="tooltip"></slot>
|
|
2510
|
+
`;
|
|
2511
|
+
}
|
|
2512
|
+
|
|
2513
|
+
static get properties() {
|
|
2514
|
+
return {
|
|
2515
|
+
/**
|
|
2516
|
+
* Maximum number of characters (in Unicode code points) that the user can enter.
|
|
2517
|
+
*/
|
|
2518
|
+
maxlength: {
|
|
2519
|
+
type: Number,
|
|
2520
|
+
},
|
|
2521
|
+
|
|
2522
|
+
/**
|
|
2523
|
+
* Minimum number of characters (in Unicode code points) that the user can enter.
|
|
2524
|
+
*/
|
|
2525
|
+
minlength: {
|
|
2526
|
+
type: Number,
|
|
2527
|
+
},
|
|
2528
|
+
};
|
|
2529
|
+
}
|
|
2530
|
+
|
|
2531
|
+
/** @protected */
|
|
2532
|
+
ready() {
|
|
2533
|
+
super.ready();
|
|
2534
|
+
|
|
2535
|
+
this._tooltipController = new TooltipController(this);
|
|
2536
|
+
this._tooltipController.setPosition('top');
|
|
2537
|
+
this._tooltipController.setAriaTarget(this.inputElement);
|
|
2538
|
+
this.addController(this._tooltipController);
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2542
|
+
defineCustomElement$2(TextField);
|
|
2543
|
+
|
|
2544
|
+
/**
|
|
2545
|
+
* @license
|
|
2546
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
2547
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
2548
|
+
*/
|
|
2549
|
+
|
|
2550
|
+
/**
|
|
2551
|
+
* Check if the custom element type has themes applied.
|
|
2552
|
+
* @param {Function} elementClass
|
|
2553
|
+
* @returns {boolean}
|
|
2554
|
+
*/
|
|
2555
|
+
function classHasThemes(elementClass) {
|
|
2556
|
+
return elementClass && Object.prototype.hasOwnProperty.call(elementClass, '__themes');
|
|
2557
|
+
}
|
|
2558
|
+
|
|
2559
|
+
/**
|
|
2560
|
+
* Check if the custom element type has themes applied.
|
|
2561
|
+
* @param {string} tagName
|
|
2562
|
+
* @returns {boolean}
|
|
2563
|
+
*/
|
|
2564
|
+
function hasThemes(tagName) {
|
|
2565
|
+
return classHasThemes(customElements.get(tagName));
|
|
2566
|
+
}
|
|
2567
|
+
|
|
2568
|
+
/**
|
|
2569
|
+
* Flattens the styles into a single array of styles.
|
|
2570
|
+
* @param {CSSResultGroup} styles
|
|
2571
|
+
* @param {CSSResult[]} result
|
|
2572
|
+
* @returns {CSSResult[]}
|
|
2573
|
+
*/
|
|
2574
|
+
function flattenStyles(styles = []) {
|
|
2575
|
+
return [styles].flat(Infinity).filter((style) => {
|
|
2576
|
+
if (style instanceof o) {
|
|
2577
|
+
return true;
|
|
2578
|
+
}
|
|
2579
|
+
console.warn('An item in styles is not of type CSSResult. Use `unsafeCSS` or `css`.');
|
|
2580
|
+
return false;
|
|
2581
|
+
});
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
/**
|
|
2585
|
+
* Registers CSS styles for a component type. Make sure to register the styles before
|
|
2586
|
+
* the first instance of a component of the type is attached to DOM.
|
|
2587
|
+
*
|
|
2588
|
+
* @param {string} themeFor The local/tag name of the component type to register the styles for
|
|
2589
|
+
* @param {CSSResultGroup} styles The CSS style rules to be registered for the component type
|
|
2590
|
+
* matching themeFor and included in the local scope of each component instance
|
|
2591
|
+
* @param {{moduleId?: string, include?: string | string[]}} options Additional options
|
|
2592
|
+
* @return {void}
|
|
2593
|
+
*/
|
|
2594
|
+
function registerStyles(themeFor, styles, options = {}) {
|
|
2595
|
+
if (themeFor) {
|
|
2596
|
+
if (hasThemes(themeFor)) {
|
|
2597
|
+
console.warn(`The custom element definition for "${themeFor}"
|
|
2598
|
+
was finalized before a style module was registered.
|
|
2599
|
+
Make sure to add component specific style modules before
|
|
2600
|
+
importing the corresponding custom element.`);
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
|
|
2604
|
+
styles = flattenStyles(styles);
|
|
2605
|
+
|
|
2606
|
+
if (window.Vaadin && window.Vaadin.styleModules) {
|
|
2607
|
+
window.Vaadin.styleModules.registerStyles(themeFor, styles, options);
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
/**
|
|
2612
|
+
* @license
|
|
2613
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
2614
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
2615
|
+
*/
|
|
2616
|
+
|
|
2617
|
+
const passwordFieldButton = i`
|
|
2618
|
+
:host {
|
|
2619
|
+
position: absolute;
|
|
2620
|
+
right: 0;
|
|
2621
|
+
top: 0;
|
|
2622
|
+
margin: 0;
|
|
2623
|
+
padding: 0;
|
|
2624
|
+
width: 100%;
|
|
2625
|
+
height: 100%;
|
|
2626
|
+
min-width: auto;
|
|
2627
|
+
background: transparent;
|
|
2628
|
+
outline: none;
|
|
2629
|
+
}
|
|
2630
|
+
`;
|
|
2631
|
+
|
|
2632
|
+
registerStyles('vaadin-password-field-button', [button, passwordFieldButton], {
|
|
2633
|
+
moduleId: 'lumo-password-field-button',
|
|
2634
|
+
});
|
|
2635
|
+
|
|
2636
|
+
/**
|
|
2637
|
+
* @license
|
|
2638
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
2639
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
2640
|
+
*/
|
|
2641
|
+
function defineCustomElement$1(CustomElement) {
|
|
2642
|
+
const defined = customElements.get(CustomElement.is);
|
|
2643
|
+
if (!defined) {
|
|
2644
|
+
customElements.define(CustomElement.is, CustomElement);
|
|
2645
|
+
} else {
|
|
2646
|
+
const definedVersion = defined.version;
|
|
2647
|
+
if (definedVersion && CustomElement.version && definedVersion === CustomElement.version) {
|
|
2648
|
+
// Just loading the same thing again
|
|
2649
|
+
console.warn(`The component ${CustomElement.is} has been loaded twice`);
|
|
2650
|
+
} else {
|
|
2651
|
+
console.error(
|
|
2652
|
+
`Tried to define ${CustomElement.is} version ${CustomElement.version} when version ${defined.version} is already in use. Something will probably break.`,
|
|
2653
|
+
);
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
/**
|
|
2659
|
+
* @license
|
|
2660
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
2661
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
2662
|
+
*/
|
|
2663
|
+
|
|
2664
|
+
/**
|
|
2665
|
+
* Dummy custom element used for collecting
|
|
2666
|
+
* development time usage statistics.
|
|
2667
|
+
*
|
|
2668
|
+
* @private
|
|
2669
|
+
*/
|
|
2670
|
+
class Lumo extends HTMLElement {
|
|
2671
|
+
static get is() {
|
|
2672
|
+
return 'vaadin-lumo-styles';
|
|
2673
|
+
}
|
|
2674
|
+
|
|
2675
|
+
static get version() {
|
|
2676
|
+
return '24.2.3';
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
defineCustomElement$1(Lumo);
|
|
2681
|
+
|
|
2682
|
+
/**
|
|
2683
|
+
* @license
|
|
2684
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
2685
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
2686
|
+
*/
|
|
2687
|
+
|
|
2688
|
+
/**
|
|
2689
|
+
* This is for use internally by Lumo and Material styles.
|
|
2690
|
+
*
|
|
2691
|
+
* @param {string} id the id to set on the created element, only for informational purposes
|
|
2692
|
+
* @param {CSSResultGroup[]} styles the styles to add
|
|
2693
|
+
*/
|
|
2694
|
+
const addGlobalThemeStyles = (id, ...styles) => {
|
|
2695
|
+
const styleTag = document.createElement('style');
|
|
2696
|
+
styleTag.id = id;
|
|
2697
|
+
styleTag.textContent = styles
|
|
2698
|
+
.map((style) => style.toString())
|
|
2699
|
+
.join('\n')
|
|
2700
|
+
.replace(':host', 'html');
|
|
2701
|
+
|
|
2702
|
+
document.head.insertAdjacentElement('afterbegin', styleTag);
|
|
2703
|
+
};
|
|
2704
|
+
|
|
2705
|
+
const addLumoGlobalStyles = (id, ...styles) => {
|
|
2706
|
+
addGlobalThemeStyles(`lumo-${id}`, styles);
|
|
2707
|
+
};
|
|
2708
|
+
|
|
2709
|
+
/**
|
|
2710
|
+
* @license
|
|
2711
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
2712
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
2713
|
+
*/
|
|
2714
|
+
|
|
2715
|
+
const fontIcons = i`
|
|
2716
|
+
@font-face {
|
|
2717
|
+
font-family: 'lumo-icons';
|
|
2718
|
+
src: url(data:application/font-woff;charset=utf-8;base64,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)
|
|
2719
|
+
format('woff');
|
|
2720
|
+
font-weight: normal;
|
|
2721
|
+
font-style: normal;
|
|
2722
|
+
}
|
|
2723
|
+
|
|
2724
|
+
html {
|
|
2725
|
+
--lumo-icons-align-center: '\\ea01';
|
|
2726
|
+
--lumo-icons-align-left: '\\ea02';
|
|
2727
|
+
--lumo-icons-align-right: '\\ea03';
|
|
2728
|
+
--lumo-icons-angle-down: '\\ea04';
|
|
2729
|
+
--lumo-icons-angle-left: '\\ea05';
|
|
2730
|
+
--lumo-icons-angle-right: '\\ea06';
|
|
2731
|
+
--lumo-icons-angle-up: '\\ea07';
|
|
2732
|
+
--lumo-icons-arrow-down: '\\ea08';
|
|
2733
|
+
--lumo-icons-arrow-left: '\\ea09';
|
|
2734
|
+
--lumo-icons-arrow-right: '\\ea0a';
|
|
2735
|
+
--lumo-icons-arrow-up: '\\ea0b';
|
|
2736
|
+
--lumo-icons-bar-chart: '\\ea0c';
|
|
2737
|
+
--lumo-icons-bell: '\\ea0d';
|
|
2738
|
+
--lumo-icons-calendar: '\\ea0e';
|
|
2739
|
+
--lumo-icons-checkmark: '\\ea0f';
|
|
2740
|
+
--lumo-icons-chevron-down: '\\ea10';
|
|
2741
|
+
--lumo-icons-chevron-left: '\\ea11';
|
|
2742
|
+
--lumo-icons-chevron-right: '\\ea12';
|
|
2743
|
+
--lumo-icons-chevron-up: '\\ea13';
|
|
2744
|
+
--lumo-icons-clock: '\\ea14';
|
|
2745
|
+
--lumo-icons-cog: '\\ea15';
|
|
2746
|
+
--lumo-icons-cross: '\\ea16';
|
|
2747
|
+
--lumo-icons-download: '\\ea17';
|
|
2748
|
+
--lumo-icons-dropdown: '\\ea18';
|
|
2749
|
+
--lumo-icons-edit: '\\ea19';
|
|
2750
|
+
--lumo-icons-error: '\\ea1a';
|
|
2751
|
+
--lumo-icons-eye: '\\ea1b';
|
|
2752
|
+
--lumo-icons-eye-disabled: '\\ea1c';
|
|
2753
|
+
--lumo-icons-menu: '\\ea1d';
|
|
2754
|
+
--lumo-icons-minus: '\\ea1e';
|
|
2755
|
+
--lumo-icons-ordered-list: '\\ea1f';
|
|
2756
|
+
--lumo-icons-phone: '\\ea20';
|
|
2757
|
+
--lumo-icons-photo: '\\ea21';
|
|
2758
|
+
--lumo-icons-play: '\\ea22';
|
|
2759
|
+
--lumo-icons-plus: '\\ea23';
|
|
2760
|
+
--lumo-icons-redo: '\\ea24';
|
|
2761
|
+
--lumo-icons-reload: '\\ea25';
|
|
2762
|
+
--lumo-icons-search: '\\ea26';
|
|
2763
|
+
--lumo-icons-undo: '\\ea27';
|
|
2764
|
+
--lumo-icons-unordered-list: '\\ea28';
|
|
2765
|
+
--lumo-icons-upload: '\\ea29';
|
|
2766
|
+
--lumo-icons-user: '\\ea2a';
|
|
2767
|
+
}
|
|
2768
|
+
`;
|
|
250
2769
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
2770
|
+
addLumoGlobalStyles('font-icons', fontIcons);
|
|
2771
|
+
|
|
2772
|
+
/**
|
|
2773
|
+
* @license
|
|
2774
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
2775
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
2776
|
+
*/
|
|
2777
|
+
|
|
2778
|
+
const sizing = i`
|
|
2779
|
+
:host {
|
|
2780
|
+
--lumo-size-xs: 1.625rem;
|
|
2781
|
+
--lumo-size-s: 1.875rem;
|
|
2782
|
+
--lumo-size-m: 2.25rem;
|
|
2783
|
+
--lumo-size-l: 2.75rem;
|
|
2784
|
+
--lumo-size-xl: 3.5rem;
|
|
2785
|
+
|
|
2786
|
+
/* Icons */
|
|
2787
|
+
--lumo-icon-size-s: 1.25em;
|
|
2788
|
+
--lumo-icon-size-m: 1.5em;
|
|
2789
|
+
--lumo-icon-size-l: 2.25em;
|
|
2790
|
+
/* For backwards compatibility */
|
|
2791
|
+
--lumo-icon-size: var(--lumo-icon-size-m);
|
|
2792
|
+
}
|
|
2793
|
+
`;
|
|
2794
|
+
|
|
2795
|
+
addLumoGlobalStyles('sizing-props', sizing);
|
|
2796
|
+
|
|
2797
|
+
/**
|
|
2798
|
+
* @license
|
|
2799
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
2800
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
2801
|
+
*/
|
|
2802
|
+
|
|
2803
|
+
const style = i`
|
|
2804
|
+
:host {
|
|
2805
|
+
/* Border radius */
|
|
2806
|
+
--lumo-border-radius-s: 0.25em; /* Checkbox, badge, date-picker year indicator, etc */
|
|
2807
|
+
--lumo-border-radius-m: var(--lumo-border-radius, 0.25em); /* Button, text field, menu overlay, etc */
|
|
2808
|
+
--lumo-border-radius-l: 0.5em; /* Dialog, notification, etc */
|
|
2809
|
+
|
|
2810
|
+
/* Shadow */
|
|
2811
|
+
--lumo-box-shadow-xs: 0 1px 4px -1px var(--lumo-shade-50pct);
|
|
2812
|
+
--lumo-box-shadow-s: 0 2px 4px -1px var(--lumo-shade-20pct), 0 3px 12px -1px var(--lumo-shade-30pct);
|
|
2813
|
+
--lumo-box-shadow-m: 0 2px 6px -1px var(--lumo-shade-20pct), 0 8px 24px -4px var(--lumo-shade-40pct);
|
|
2814
|
+
--lumo-box-shadow-l: 0 3px 18px -2px var(--lumo-shade-20pct), 0 12px 48px -6px var(--lumo-shade-40pct);
|
|
2815
|
+
--lumo-box-shadow-xl: 0 4px 24px -3px var(--lumo-shade-20pct), 0 18px 64px -8px var(--lumo-shade-40pct);
|
|
2816
|
+
|
|
2817
|
+
/* Clickable element cursor */
|
|
2818
|
+
--lumo-clickable-cursor: default;
|
|
2819
|
+
}
|
|
2820
|
+
`;
|
|
2821
|
+
|
|
2822
|
+
/**
|
|
2823
|
+
* Default values for component-specific custom properties.
|
|
2824
|
+
*/
|
|
2825
|
+
i`
|
|
2826
|
+
html {
|
|
2827
|
+
--vaadin-checkbox-size: calc(var(--lumo-size-m) / 2);
|
|
2828
|
+
--vaadin-radio-button-size: calc(var(--lumo-size-m) / 2);
|
|
2829
|
+
--vaadin-input-field-border-radius: var(--lumo-border-radius-m);
|
|
2830
|
+
}
|
|
2831
|
+
`;
|
|
2832
|
+
|
|
2833
|
+
addLumoGlobalStyles('style-props', style);
|
|
2834
|
+
|
|
2835
|
+
/**
|
|
2836
|
+
* @license
|
|
2837
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
2838
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
2839
|
+
*/
|
|
2840
|
+
|
|
2841
|
+
const colorBase = i`
|
|
2842
|
+
:host {
|
|
2843
|
+
/* Base (background) */
|
|
2844
|
+
--lumo-base-color: #fff;
|
|
2845
|
+
|
|
2846
|
+
/* Tint */
|
|
2847
|
+
--lumo-tint-5pct: hsla(0, 0%, 100%, 0.3);
|
|
2848
|
+
--lumo-tint-10pct: hsla(0, 0%, 100%, 0.37);
|
|
2849
|
+
--lumo-tint-20pct: hsla(0, 0%, 100%, 0.44);
|
|
2850
|
+
--lumo-tint-30pct: hsla(0, 0%, 100%, 0.5);
|
|
2851
|
+
--lumo-tint-40pct: hsla(0, 0%, 100%, 0.57);
|
|
2852
|
+
--lumo-tint-50pct: hsla(0, 0%, 100%, 0.64);
|
|
2853
|
+
--lumo-tint-60pct: hsla(0, 0%, 100%, 0.7);
|
|
2854
|
+
--lumo-tint-70pct: hsla(0, 0%, 100%, 0.77);
|
|
2855
|
+
--lumo-tint-80pct: hsla(0, 0%, 100%, 0.84);
|
|
2856
|
+
--lumo-tint-90pct: hsla(0, 0%, 100%, 0.9);
|
|
2857
|
+
--lumo-tint: #fff;
|
|
2858
|
+
|
|
2859
|
+
/* Shade */
|
|
2860
|
+
--lumo-shade-5pct: hsla(214, 61%, 25%, 0.05);
|
|
2861
|
+
--lumo-shade-10pct: hsla(214, 57%, 24%, 0.1);
|
|
2862
|
+
--lumo-shade-20pct: hsla(214, 53%, 23%, 0.16);
|
|
2863
|
+
--lumo-shade-30pct: hsla(214, 50%, 22%, 0.26);
|
|
2864
|
+
--lumo-shade-40pct: hsla(214, 47%, 21%, 0.38);
|
|
2865
|
+
--lumo-shade-50pct: hsla(214, 45%, 20%, 0.52);
|
|
2866
|
+
--lumo-shade-60pct: hsla(214, 43%, 19%, 0.6);
|
|
2867
|
+
--lumo-shade-70pct: hsla(214, 42%, 18%, 0.69);
|
|
2868
|
+
--lumo-shade-80pct: hsla(214, 41%, 17%, 0.83);
|
|
2869
|
+
--lumo-shade-90pct: hsla(214, 40%, 16%, 0.94);
|
|
2870
|
+
--lumo-shade: hsl(214, 35%, 15%);
|
|
2871
|
+
|
|
2872
|
+
/* Contrast */
|
|
2873
|
+
--lumo-contrast-5pct: var(--lumo-shade-5pct);
|
|
2874
|
+
--lumo-contrast-10pct: var(--lumo-shade-10pct);
|
|
2875
|
+
--lumo-contrast-20pct: var(--lumo-shade-20pct);
|
|
2876
|
+
--lumo-contrast-30pct: var(--lumo-shade-30pct);
|
|
2877
|
+
--lumo-contrast-40pct: var(--lumo-shade-40pct);
|
|
2878
|
+
--lumo-contrast-50pct: var(--lumo-shade-50pct);
|
|
2879
|
+
--lumo-contrast-60pct: var(--lumo-shade-60pct);
|
|
2880
|
+
--lumo-contrast-70pct: var(--lumo-shade-70pct);
|
|
2881
|
+
--lumo-contrast-80pct: var(--lumo-shade-80pct);
|
|
2882
|
+
--lumo-contrast-90pct: var(--lumo-shade-90pct);
|
|
2883
|
+
--lumo-contrast: var(--lumo-shade);
|
|
2884
|
+
|
|
2885
|
+
/* Text */
|
|
2886
|
+
--lumo-header-text-color: var(--lumo-contrast);
|
|
2887
|
+
--lumo-body-text-color: var(--lumo-contrast-90pct);
|
|
2888
|
+
--lumo-secondary-text-color: var(--lumo-contrast-70pct);
|
|
2889
|
+
--lumo-tertiary-text-color: var(--lumo-contrast-50pct);
|
|
2890
|
+
--lumo-disabled-text-color: var(--lumo-contrast-30pct);
|
|
2891
|
+
|
|
2892
|
+
/* Primary */
|
|
2893
|
+
--lumo-primary-color: hsl(214, 100%, 48%);
|
|
2894
|
+
--lumo-primary-color-50pct: hsla(214, 100%, 49%, 0.76);
|
|
2895
|
+
--lumo-primary-color-10pct: hsla(214, 100%, 60%, 0.13);
|
|
2896
|
+
--lumo-primary-text-color: hsl(214, 100%, 43%);
|
|
2897
|
+
--lumo-primary-contrast-color: #fff;
|
|
2898
|
+
|
|
2899
|
+
/* Error */
|
|
2900
|
+
--lumo-error-color: hsl(3, 85%, 48%);
|
|
2901
|
+
--lumo-error-color-50pct: hsla(3, 85%, 49%, 0.5);
|
|
2902
|
+
--lumo-error-color-10pct: hsla(3, 85%, 49%, 0.1);
|
|
2903
|
+
--lumo-error-text-color: hsl(3, 89%, 42%);
|
|
2904
|
+
--lumo-error-contrast-color: #fff;
|
|
2905
|
+
|
|
2906
|
+
/* Success */
|
|
2907
|
+
--lumo-success-color: hsl(145, 72%, 30%);
|
|
2908
|
+
--lumo-success-color-50pct: hsla(145, 72%, 31%, 0.5);
|
|
2909
|
+
--lumo-success-color-10pct: hsla(145, 72%, 31%, 0.1);
|
|
2910
|
+
--lumo-success-text-color: hsl(145, 85%, 25%);
|
|
2911
|
+
--lumo-success-contrast-color: #fff;
|
|
2912
|
+
|
|
2913
|
+
/* Warning */
|
|
2914
|
+
--lumo-warning-color: hsl(48, 100%, 50%);
|
|
2915
|
+
--lumo-warning-color-10pct: hsla(48, 100%, 50%, 0.25);
|
|
2916
|
+
--lumo-warning-text-color: hsl(32, 100%, 30%);
|
|
2917
|
+
--lumo-warning-contrast-color: var(--lumo-shade-90pct);
|
|
2918
|
+
}
|
|
2919
|
+
|
|
2920
|
+
/* forced-colors mode adjustments */
|
|
2921
|
+
@media (forced-colors: active) {
|
|
2922
|
+
html {
|
|
2923
|
+
--lumo-disabled-text-color: GrayText;
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
`;
|
|
2927
|
+
|
|
2928
|
+
addLumoGlobalStyles('color-props', colorBase);
|
|
2929
|
+
|
|
2930
|
+
const color = i`
|
|
2931
|
+
[theme~='dark'] {
|
|
2932
|
+
/* Base (background) */
|
|
2933
|
+
--lumo-base-color: hsl(214, 35%, 21%);
|
|
2934
|
+
|
|
2935
|
+
/* Tint */
|
|
2936
|
+
--lumo-tint-5pct: hsla(214, 65%, 85%, 0.06);
|
|
2937
|
+
--lumo-tint-10pct: hsla(214, 60%, 80%, 0.14);
|
|
2938
|
+
--lumo-tint-20pct: hsla(214, 64%, 82%, 0.23);
|
|
2939
|
+
--lumo-tint-30pct: hsla(214, 69%, 84%, 0.32);
|
|
2940
|
+
--lumo-tint-40pct: hsla(214, 73%, 86%, 0.41);
|
|
2941
|
+
--lumo-tint-50pct: hsla(214, 78%, 88%, 0.5);
|
|
2942
|
+
--lumo-tint-60pct: hsla(214, 82%, 90%, 0.58);
|
|
2943
|
+
--lumo-tint-70pct: hsla(214, 87%, 92%, 0.69);
|
|
2944
|
+
--lumo-tint-80pct: hsla(214, 91%, 94%, 0.8);
|
|
2945
|
+
--lumo-tint-90pct: hsla(214, 96%, 96%, 0.9);
|
|
2946
|
+
--lumo-tint: hsl(214, 100%, 98%);
|
|
2947
|
+
|
|
2948
|
+
/* Shade */
|
|
2949
|
+
--lumo-shade-5pct: hsla(214, 0%, 0%, 0.07);
|
|
2950
|
+
--lumo-shade-10pct: hsla(214, 4%, 2%, 0.15);
|
|
2951
|
+
--lumo-shade-20pct: hsla(214, 8%, 4%, 0.23);
|
|
2952
|
+
--lumo-shade-30pct: hsla(214, 12%, 6%, 0.32);
|
|
2953
|
+
--lumo-shade-40pct: hsla(214, 16%, 8%, 0.41);
|
|
2954
|
+
--lumo-shade-50pct: hsla(214, 20%, 10%, 0.5);
|
|
2955
|
+
--lumo-shade-60pct: hsla(214, 24%, 12%, 0.6);
|
|
2956
|
+
--lumo-shade-70pct: hsla(214, 28%, 13%, 0.7);
|
|
2957
|
+
--lumo-shade-80pct: hsla(214, 32%, 13%, 0.8);
|
|
2958
|
+
--lumo-shade-90pct: hsla(214, 33%, 13%, 0.9);
|
|
2959
|
+
--lumo-shade: hsl(214, 33%, 13%);
|
|
2960
|
+
|
|
2961
|
+
/* Contrast */
|
|
2962
|
+
--lumo-contrast-5pct: var(--lumo-tint-5pct);
|
|
2963
|
+
--lumo-contrast-10pct: var(--lumo-tint-10pct);
|
|
2964
|
+
--lumo-contrast-20pct: var(--lumo-tint-20pct);
|
|
2965
|
+
--lumo-contrast-30pct: var(--lumo-tint-30pct);
|
|
2966
|
+
--lumo-contrast-40pct: var(--lumo-tint-40pct);
|
|
2967
|
+
--lumo-contrast-50pct: var(--lumo-tint-50pct);
|
|
2968
|
+
--lumo-contrast-60pct: var(--lumo-tint-60pct);
|
|
2969
|
+
--lumo-contrast-70pct: var(--lumo-tint-70pct);
|
|
2970
|
+
--lumo-contrast-80pct: var(--lumo-tint-80pct);
|
|
2971
|
+
--lumo-contrast-90pct: var(--lumo-tint-90pct);
|
|
2972
|
+
--lumo-contrast: var(--lumo-tint);
|
|
2973
|
+
|
|
2974
|
+
/* Text */
|
|
2975
|
+
--lumo-header-text-color: var(--lumo-contrast);
|
|
2976
|
+
--lumo-body-text-color: var(--lumo-contrast-90pct);
|
|
2977
|
+
--lumo-secondary-text-color: var(--lumo-contrast-70pct);
|
|
2978
|
+
--lumo-tertiary-text-color: var(--lumo-contrast-50pct);
|
|
2979
|
+
--lumo-disabled-text-color: var(--lumo-contrast-30pct);
|
|
2980
|
+
|
|
2981
|
+
/* Primary */
|
|
2982
|
+
--lumo-primary-color: hsl(214, 90%, 48%);
|
|
2983
|
+
--lumo-primary-color-50pct: hsla(214, 90%, 70%, 0.69);
|
|
2984
|
+
--lumo-primary-color-10pct: hsla(214, 90%, 55%, 0.13);
|
|
2985
|
+
--lumo-primary-text-color: hsl(214, 90%, 77%);
|
|
2986
|
+
--lumo-primary-contrast-color: #fff;
|
|
2987
|
+
|
|
2988
|
+
/* Error */
|
|
2989
|
+
--lumo-error-color: hsl(3, 79%, 49%);
|
|
2990
|
+
--lumo-error-color-50pct: hsla(3, 75%, 62%, 0.5);
|
|
2991
|
+
--lumo-error-color-10pct: hsla(3, 75%, 62%, 0.14);
|
|
2992
|
+
--lumo-error-text-color: hsl(3, 100%, 80%);
|
|
2993
|
+
|
|
2994
|
+
/* Success */
|
|
2995
|
+
--lumo-success-color: hsl(145, 72%, 30%);
|
|
2996
|
+
--lumo-success-color-50pct: hsla(145, 92%, 51%, 0.5);
|
|
2997
|
+
--lumo-success-color-10pct: hsla(145, 92%, 51%, 0.1);
|
|
2998
|
+
--lumo-success-text-color: hsl(145, 85%, 46%);
|
|
2999
|
+
|
|
3000
|
+
/* Warning */
|
|
3001
|
+
--lumo-warning-color: hsl(43, 100%, 48%);
|
|
3002
|
+
--lumo-warning-color-10pct: hsla(40, 100%, 50%, 0.2);
|
|
3003
|
+
--lumo-warning-text-color: hsl(45, 100%, 60%);
|
|
3004
|
+
--lumo-warning-contrast-color: var(--lumo-shade-90pct);
|
|
3005
|
+
}
|
|
3006
|
+
|
|
3007
|
+
html {
|
|
3008
|
+
color: var(--lumo-body-text-color);
|
|
3009
|
+
background-color: var(--lumo-base-color);
|
|
3010
|
+
color-scheme: light;
|
|
3011
|
+
}
|
|
3012
|
+
|
|
3013
|
+
[theme~='dark'] {
|
|
3014
|
+
color: var(--lumo-body-text-color);
|
|
3015
|
+
background-color: var(--lumo-base-color);
|
|
3016
|
+
color-scheme: dark;
|
|
3017
|
+
}
|
|
3018
|
+
|
|
3019
|
+
h1,
|
|
3020
|
+
h2,
|
|
3021
|
+
h3,
|
|
3022
|
+
h4,
|
|
3023
|
+
h5,
|
|
3024
|
+
h6 {
|
|
3025
|
+
color: var(--lumo-header-text-color);
|
|
3026
|
+
}
|
|
3027
|
+
|
|
3028
|
+
a:where(:any-link) {
|
|
3029
|
+
color: var(--lumo-primary-text-color);
|
|
3030
|
+
}
|
|
3031
|
+
|
|
3032
|
+
a:not(:any-link) {
|
|
3033
|
+
color: var(--lumo-disabled-text-color);
|
|
3034
|
+
}
|
|
3035
|
+
|
|
3036
|
+
blockquote {
|
|
3037
|
+
color: var(--lumo-secondary-text-color);
|
|
3038
|
+
}
|
|
3039
|
+
|
|
3040
|
+
code,
|
|
3041
|
+
pre {
|
|
3042
|
+
background-color: var(--lumo-contrast-10pct);
|
|
3043
|
+
border-radius: var(--lumo-border-radius-m);
|
|
3044
|
+
}
|
|
3045
|
+
`;
|
|
3046
|
+
|
|
3047
|
+
registerStyles('', color, { moduleId: 'lumo-color' });
|
|
3048
|
+
|
|
3049
|
+
/**
|
|
3050
|
+
* @license
|
|
3051
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
3052
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
3053
|
+
*/
|
|
3054
|
+
|
|
3055
|
+
const spacing = i`
|
|
3056
|
+
:host {
|
|
3057
|
+
/* Square */
|
|
3058
|
+
--lumo-space-xs: 0.25rem;
|
|
3059
|
+
--lumo-space-s: 0.5rem;
|
|
3060
|
+
--lumo-space-m: 1rem;
|
|
3061
|
+
--lumo-space-l: 1.5rem;
|
|
3062
|
+
--lumo-space-xl: 2.5rem;
|
|
3063
|
+
|
|
3064
|
+
/* Wide */
|
|
3065
|
+
--lumo-space-wide-xs: calc(var(--lumo-space-xs) / 2) var(--lumo-space-xs);
|
|
3066
|
+
--lumo-space-wide-s: calc(var(--lumo-space-s) / 2) var(--lumo-space-s);
|
|
3067
|
+
--lumo-space-wide-m: calc(var(--lumo-space-m) / 2) var(--lumo-space-m);
|
|
3068
|
+
--lumo-space-wide-l: calc(var(--lumo-space-l) / 2) var(--lumo-space-l);
|
|
3069
|
+
--lumo-space-wide-xl: calc(var(--lumo-space-xl) / 2) var(--lumo-space-xl);
|
|
3070
|
+
|
|
3071
|
+
/* Tall */
|
|
3072
|
+
--lumo-space-tall-xs: var(--lumo-space-xs) calc(var(--lumo-space-xs) / 2);
|
|
3073
|
+
--lumo-space-tall-s: var(--lumo-space-s) calc(var(--lumo-space-s) / 2);
|
|
3074
|
+
--lumo-space-tall-m: var(--lumo-space-m) calc(var(--lumo-space-m) / 2);
|
|
3075
|
+
--lumo-space-tall-l: var(--lumo-space-l) calc(var(--lumo-space-l) / 2);
|
|
3076
|
+
--lumo-space-tall-xl: var(--lumo-space-xl) calc(var(--lumo-space-xl) / 2);
|
|
3077
|
+
}
|
|
3078
|
+
`;
|
|
3079
|
+
|
|
3080
|
+
addLumoGlobalStyles('spacing-props', spacing);
|
|
3081
|
+
|
|
3082
|
+
/**
|
|
3083
|
+
* @license
|
|
3084
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
3085
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
3086
|
+
*/
|
|
3087
|
+
|
|
3088
|
+
const font = i`
|
|
3089
|
+
:host {
|
|
3090
|
+
/* prettier-ignore */
|
|
3091
|
+
--lumo-font-family: -apple-system, BlinkMacSystemFont, 'Roboto', 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
|
3092
|
+
|
|
3093
|
+
/* Font sizes */
|
|
3094
|
+
--lumo-font-size-xxs: 0.75rem;
|
|
3095
|
+
--lumo-font-size-xs: 0.8125rem;
|
|
3096
|
+
--lumo-font-size-s: 0.875rem;
|
|
3097
|
+
--lumo-font-size-m: 1rem;
|
|
3098
|
+
--lumo-font-size-l: 1.125rem;
|
|
3099
|
+
--lumo-font-size-xl: 1.375rem;
|
|
3100
|
+
--lumo-font-size-xxl: 1.75rem;
|
|
3101
|
+
--lumo-font-size-xxxl: 2.5rem;
|
|
3102
|
+
|
|
3103
|
+
/* Line heights */
|
|
3104
|
+
--lumo-line-height-xs: 1.25;
|
|
3105
|
+
--lumo-line-height-s: 1.375;
|
|
3106
|
+
--lumo-line-height-m: 1.625;
|
|
3107
|
+
}
|
|
3108
|
+
`;
|
|
3109
|
+
|
|
3110
|
+
const typography = i`
|
|
3111
|
+
body,
|
|
3112
|
+
:host {
|
|
3113
|
+
font-family: var(--lumo-font-family);
|
|
3114
|
+
font-size: var(--lumo-font-size-m);
|
|
3115
|
+
line-height: var(--lumo-line-height-m);
|
|
3116
|
+
-webkit-text-size-adjust: 100%;
|
|
3117
|
+
-webkit-font-smoothing: antialiased;
|
|
3118
|
+
-moz-osx-font-smoothing: grayscale;
|
|
3119
|
+
}
|
|
3120
|
+
|
|
3121
|
+
small,
|
|
3122
|
+
[theme~='font-size-s'] {
|
|
3123
|
+
font-size: var(--lumo-font-size-s);
|
|
3124
|
+
line-height: var(--lumo-line-height-s);
|
|
3125
|
+
}
|
|
3126
|
+
|
|
3127
|
+
[theme~='font-size-xs'] {
|
|
3128
|
+
font-size: var(--lumo-font-size-xs);
|
|
3129
|
+
line-height: var(--lumo-line-height-xs);
|
|
3130
|
+
}
|
|
3131
|
+
|
|
3132
|
+
:where(h1, h2, h3, h4, h5, h6) {
|
|
3133
|
+
font-weight: 600;
|
|
3134
|
+
line-height: var(--lumo-line-height-xs);
|
|
3135
|
+
margin-block: 0;
|
|
3136
|
+
}
|
|
3137
|
+
|
|
3138
|
+
:where(h1) {
|
|
3139
|
+
font-size: var(--lumo-font-size-xxxl);
|
|
3140
|
+
}
|
|
3141
|
+
|
|
3142
|
+
:where(h2) {
|
|
3143
|
+
font-size: var(--lumo-font-size-xxl);
|
|
3144
|
+
}
|
|
3145
|
+
|
|
3146
|
+
:where(h3) {
|
|
3147
|
+
font-size: var(--lumo-font-size-xl);
|
|
3148
|
+
}
|
|
3149
|
+
|
|
3150
|
+
:where(h4) {
|
|
3151
|
+
font-size: var(--lumo-font-size-l);
|
|
3152
|
+
}
|
|
3153
|
+
|
|
3154
|
+
:where(h5) {
|
|
3155
|
+
font-size: var(--lumo-font-size-m);
|
|
3156
|
+
}
|
|
3157
|
+
|
|
3158
|
+
:where(h6) {
|
|
3159
|
+
font-size: var(--lumo-font-size-xs);
|
|
3160
|
+
text-transform: uppercase;
|
|
3161
|
+
letter-spacing: 0.03em;
|
|
3162
|
+
}
|
|
3163
|
+
|
|
3164
|
+
p,
|
|
3165
|
+
blockquote {
|
|
3166
|
+
margin-top: 0.5em;
|
|
3167
|
+
margin-bottom: 0.75em;
|
|
3168
|
+
}
|
|
3169
|
+
|
|
3170
|
+
a {
|
|
3171
|
+
text-decoration: none;
|
|
3172
|
+
}
|
|
3173
|
+
|
|
3174
|
+
a:where(:any-link):hover {
|
|
3175
|
+
text-decoration: underline;
|
|
3176
|
+
}
|
|
3177
|
+
|
|
3178
|
+
hr {
|
|
3179
|
+
display: block;
|
|
3180
|
+
align-self: stretch;
|
|
3181
|
+
height: 1px;
|
|
3182
|
+
border: 0;
|
|
3183
|
+
padding: 0;
|
|
3184
|
+
margin: var(--lumo-space-s) calc(var(--lumo-border-radius-m) / 2);
|
|
3185
|
+
background-color: var(--lumo-contrast-10pct);
|
|
3186
|
+
}
|
|
3187
|
+
|
|
3188
|
+
blockquote {
|
|
3189
|
+
border-left: 2px solid var(--lumo-contrast-30pct);
|
|
3190
|
+
}
|
|
3191
|
+
|
|
3192
|
+
b,
|
|
3193
|
+
strong {
|
|
3194
|
+
font-weight: 600;
|
|
3195
|
+
}
|
|
3196
|
+
|
|
3197
|
+
/* RTL specific styles */
|
|
3198
|
+
blockquote[dir='rtl'] {
|
|
3199
|
+
border-left: none;
|
|
3200
|
+
border-right: 2px solid var(--lumo-contrast-30pct);
|
|
3201
|
+
}
|
|
3202
|
+
`;
|
|
3203
|
+
|
|
3204
|
+
registerStyles('', typography, { moduleId: 'lumo-typography' });
|
|
3205
|
+
addLumoGlobalStyles('typography-props', font);
|
|
3206
|
+
|
|
3207
|
+
/**
|
|
3208
|
+
* @license
|
|
3209
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
3210
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
3211
|
+
*/
|
|
3212
|
+
|
|
3213
|
+
const fieldButton = i`
|
|
3214
|
+
[part$='button'] {
|
|
3215
|
+
flex: none;
|
|
3216
|
+
width: 1em;
|
|
3217
|
+
height: 1em;
|
|
3218
|
+
line-height: 1;
|
|
3219
|
+
font-size: var(--lumo-icon-size-m);
|
|
3220
|
+
text-align: center;
|
|
3221
|
+
color: var(--lumo-contrast-60pct);
|
|
3222
|
+
transition: 0.2s color;
|
|
3223
|
+
cursor: var(--lumo-clickable-cursor);
|
|
3224
|
+
}
|
|
3225
|
+
|
|
3226
|
+
[part$='button']:hover {
|
|
3227
|
+
color: var(--lumo-contrast-90pct);
|
|
3228
|
+
}
|
|
3229
|
+
|
|
3230
|
+
:host([disabled]) [part$='button'],
|
|
3231
|
+
:host([readonly]) [part$='button'] {
|
|
3232
|
+
color: var(--lumo-contrast-20pct);
|
|
3233
|
+
cursor: default;
|
|
3234
|
+
}
|
|
3235
|
+
|
|
3236
|
+
[part$='button']::before {
|
|
3237
|
+
font-family: 'lumo-icons';
|
|
3238
|
+
display: block;
|
|
3239
|
+
}
|
|
3240
|
+
`;
|
|
3241
|
+
registerStyles('', fieldButton, { moduleId: 'lumo-field-button' });
|
|
3242
|
+
|
|
3243
|
+
/**
|
|
3244
|
+
* @license
|
|
3245
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
3246
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
3247
|
+
*/
|
|
3248
|
+
|
|
3249
|
+
const helper = i`
|
|
3250
|
+
:host([has-helper]) [part='helper-text']::before {
|
|
3251
|
+
content: '';
|
|
3252
|
+
display: block;
|
|
3253
|
+
height: 0.4em;
|
|
3254
|
+
}
|
|
3255
|
+
|
|
3256
|
+
[part='helper-text'] {
|
|
3257
|
+
display: block;
|
|
3258
|
+
color: var(--lumo-secondary-text-color);
|
|
3259
|
+
font-size: var(--lumo-font-size-xs);
|
|
3260
|
+
line-height: var(--lumo-line-height-xs);
|
|
3261
|
+
margin-left: calc(var(--lumo-border-radius-m) / 4);
|
|
3262
|
+
transition: color 0.2s;
|
|
3263
|
+
}
|
|
3264
|
+
|
|
3265
|
+
:host(:hover:not([readonly])) [part='helper-text'] {
|
|
3266
|
+
color: var(--lumo-body-text-color);
|
|
3267
|
+
}
|
|
3268
|
+
|
|
3269
|
+
:host([disabled]) [part='helper-text'] {
|
|
3270
|
+
color: var(--lumo-disabled-text-color);
|
|
3271
|
+
-webkit-text-fill-color: var(--lumo-disabled-text-color);
|
|
3272
|
+
}
|
|
3273
|
+
|
|
3274
|
+
:host([has-helper][theme~='helper-above-field']) [part='helper-text']::before {
|
|
3275
|
+
display: none;
|
|
3276
|
+
}
|
|
3277
|
+
|
|
3278
|
+
:host([has-helper][theme~='helper-above-field']) [part='helper-text']::after {
|
|
3279
|
+
content: '';
|
|
3280
|
+
display: block;
|
|
3281
|
+
height: 0.4em;
|
|
3282
|
+
}
|
|
3283
|
+
|
|
3284
|
+
:host([has-helper][theme~='helper-above-field']) [part='label'] {
|
|
3285
|
+
order: 0;
|
|
3286
|
+
padding-bottom: 0.4em;
|
|
3287
|
+
}
|
|
3288
|
+
|
|
3289
|
+
:host([has-helper][theme~='helper-above-field']) [part='helper-text'] {
|
|
3290
|
+
order: 1;
|
|
3291
|
+
}
|
|
3292
|
+
|
|
3293
|
+
:host([has-helper][theme~='helper-above-field']) [part='label'] + * {
|
|
3294
|
+
order: 2;
|
|
3295
|
+
}
|
|
3296
|
+
|
|
3297
|
+
:host([has-helper][theme~='helper-above-field']) [part='error-message'] {
|
|
3298
|
+
order: 3;
|
|
3299
|
+
}
|
|
3300
|
+
`;
|
|
3301
|
+
|
|
3302
|
+
/**
|
|
3303
|
+
* @license
|
|
3304
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
3305
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
3306
|
+
*/
|
|
3307
|
+
|
|
3308
|
+
const requiredField = i`
|
|
3309
|
+
[part='label'] {
|
|
3310
|
+
align-self: flex-start;
|
|
3311
|
+
color: var(--lumo-secondary-text-color);
|
|
3312
|
+
font-weight: 500;
|
|
3313
|
+
font-size: var(--lumo-font-size-s);
|
|
3314
|
+
margin-left: calc(var(--lumo-border-radius-m) / 4);
|
|
3315
|
+
transition: color 0.2s;
|
|
3316
|
+
line-height: 1;
|
|
3317
|
+
padding-right: 1em;
|
|
3318
|
+
padding-bottom: 0.5em;
|
|
3319
|
+
/* As a workaround for diacritics being cut off, add a top padding and a
|
|
3320
|
+
negative margin to compensate */
|
|
3321
|
+
padding-top: 0.25em;
|
|
3322
|
+
margin-top: -0.25em;
|
|
3323
|
+
overflow: hidden;
|
|
3324
|
+
white-space: nowrap;
|
|
3325
|
+
text-overflow: ellipsis;
|
|
3326
|
+
position: relative;
|
|
3327
|
+
max-width: 100%;
|
|
3328
|
+
box-sizing: border-box;
|
|
3329
|
+
}
|
|
3330
|
+
|
|
3331
|
+
:host([has-label])::before {
|
|
3332
|
+
margin-top: calc(var(--lumo-font-size-s) * 1.5);
|
|
3333
|
+
}
|
|
3334
|
+
|
|
3335
|
+
:host([has-label][theme~='small'])::before {
|
|
3336
|
+
margin-top: calc(var(--lumo-font-size-xs) * 1.5);
|
|
3337
|
+
}
|
|
3338
|
+
|
|
3339
|
+
:host([has-label]) {
|
|
3340
|
+
padding-top: var(--lumo-space-m);
|
|
3341
|
+
}
|
|
3342
|
+
|
|
3343
|
+
:host([has-label]) ::slotted([slot='tooltip']) {
|
|
3344
|
+
--vaadin-tooltip-offset-bottom: calc((var(--lumo-space-m) - var(--lumo-space-xs)) * -1);
|
|
3345
|
+
}
|
|
3346
|
+
|
|
3347
|
+
:host([required]) [part='required-indicator']::after {
|
|
3348
|
+
content: var(--lumo-required-field-indicator, '\\2022');
|
|
3349
|
+
transition: opacity 0.2s;
|
|
3350
|
+
color: var(--lumo-required-field-indicator-color, var(--lumo-primary-text-color));
|
|
3351
|
+
position: absolute;
|
|
3352
|
+
right: 0;
|
|
3353
|
+
width: 1em;
|
|
3354
|
+
text-align: center;
|
|
3355
|
+
}
|
|
3356
|
+
|
|
3357
|
+
:host([invalid]) [part='required-indicator']::after {
|
|
3358
|
+
color: var(--lumo-required-field-indicator-color, var(--lumo-error-text-color));
|
|
3359
|
+
}
|
|
3360
|
+
|
|
3361
|
+
[part='error-message'] {
|
|
3362
|
+
margin-left: calc(var(--lumo-border-radius-m) / 4);
|
|
3363
|
+
font-size: var(--lumo-font-size-xs);
|
|
3364
|
+
line-height: var(--lumo-line-height-xs);
|
|
3365
|
+
color: var(--lumo-error-text-color);
|
|
3366
|
+
will-change: max-height;
|
|
3367
|
+
transition: 0.4s max-height;
|
|
3368
|
+
max-height: 5em;
|
|
3369
|
+
}
|
|
3370
|
+
|
|
3371
|
+
:host([has-error-message]) [part='error-message']::before,
|
|
3372
|
+
:host([has-error-message]) [part='error-message']::after {
|
|
3373
|
+
content: '';
|
|
3374
|
+
display: block;
|
|
3375
|
+
height: 0.4em;
|
|
3376
|
+
}
|
|
3377
|
+
|
|
3378
|
+
:host(:not([invalid])) [part='error-message'] {
|
|
3379
|
+
max-height: 0;
|
|
3380
|
+
overflow: hidden;
|
|
3381
|
+
}
|
|
3382
|
+
|
|
3383
|
+
/* RTL specific styles */
|
|
3384
|
+
|
|
3385
|
+
:host([dir='rtl']) [part='label'] {
|
|
3386
|
+
margin-left: 0;
|
|
3387
|
+
margin-right: calc(var(--lumo-border-radius-m) / 4);
|
|
3388
|
+
}
|
|
3389
|
+
|
|
3390
|
+
:host([dir='rtl']) [part='label'] {
|
|
3391
|
+
padding-left: 1em;
|
|
3392
|
+
padding-right: 0;
|
|
3393
|
+
}
|
|
3394
|
+
|
|
3395
|
+
:host([dir='rtl']) [part='required-indicator']::after {
|
|
3396
|
+
right: auto;
|
|
3397
|
+
left: 0;
|
|
3398
|
+
}
|
|
3399
|
+
|
|
3400
|
+
:host([dir='rtl']) [part='error-message'] {
|
|
3401
|
+
margin-left: 0;
|
|
3402
|
+
margin-right: calc(var(--lumo-border-radius-m) / 4);
|
|
3403
|
+
}
|
|
3404
|
+
`;
|
|
3405
|
+
|
|
3406
|
+
registerStyles('', requiredField, { moduleId: 'lumo-required-field' });
|
|
3407
|
+
|
|
3408
|
+
/**
|
|
3409
|
+
* @license
|
|
3410
|
+
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
3411
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
3412
|
+
*/
|
|
3413
|
+
|
|
3414
|
+
const inputField = i`
|
|
3415
|
+
:host {
|
|
3416
|
+
--lumo-text-field-size: var(--lumo-size-m);
|
|
3417
|
+
color: var(--lumo-body-text-color);
|
|
3418
|
+
font-size: var(--lumo-font-size-m);
|
|
3419
|
+
font-family: var(--lumo-font-family);
|
|
3420
|
+
-webkit-font-smoothing: antialiased;
|
|
3421
|
+
-moz-osx-font-smoothing: grayscale;
|
|
3422
|
+
-webkit-tap-highlight-color: transparent;
|
|
3423
|
+
padding: var(--lumo-space-xs) 0;
|
|
3424
|
+
}
|
|
3425
|
+
|
|
3426
|
+
:host::before {
|
|
3427
|
+
height: var(--lumo-text-field-size);
|
|
3428
|
+
box-sizing: border-box;
|
|
3429
|
+
display: inline-flex;
|
|
3430
|
+
align-items: center;
|
|
3431
|
+
}
|
|
3432
|
+
|
|
3433
|
+
:host([focused]:not([readonly])) [part='label'] {
|
|
3434
|
+
color: var(--lumo-primary-text-color);
|
|
3435
|
+
}
|
|
3436
|
+
|
|
3437
|
+
:host([focused]) [part='input-field'] ::slotted(:is(input, textarea)) {
|
|
3438
|
+
-webkit-mask-image: none;
|
|
3439
|
+
mask-image: none;
|
|
3440
|
+
}
|
|
3441
|
+
|
|
3442
|
+
::slotted(:is(input, textarea):placeholder-shown) {
|
|
3443
|
+
color: var(--lumo-secondary-text-color);
|
|
3444
|
+
}
|
|
3445
|
+
|
|
3446
|
+
/* Hover */
|
|
3447
|
+
:host(:hover:not([readonly]):not([focused])) [part='label'] {
|
|
3448
|
+
color: var(--lumo-body-text-color);
|
|
3449
|
+
}
|
|
3450
|
+
|
|
3451
|
+
:host(:hover:not([readonly]):not([focused])) [part='input-field']::after {
|
|
3452
|
+
opacity: 0.1;
|
|
3453
|
+
}
|
|
3454
|
+
|
|
3455
|
+
/* Touch device adjustment */
|
|
3456
|
+
@media (pointer: coarse) {
|
|
3457
|
+
:host(:hover:not([readonly]):not([focused])) [part='label'] {
|
|
3458
|
+
color: var(--lumo-secondary-text-color);
|
|
3459
|
+
}
|
|
263
3460
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
3461
|
+
:host(:hover:not([readonly]):not([focused])) [part='input-field']::after {
|
|
3462
|
+
opacity: 0;
|
|
3463
|
+
}
|
|
267
3464
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
</div>
|
|
272
|
-
<slot name="tooltip"></slot>
|
|
273
|
-
`;
|
|
3465
|
+
:host(:active:not([readonly]):not([focused])) [part='input-field']::after {
|
|
3466
|
+
opacity: 0.2;
|
|
3467
|
+
}
|
|
274
3468
|
}
|
|
275
3469
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
maxlength: {
|
|
282
|
-
type: Number,
|
|
283
|
-
},
|
|
3470
|
+
/* Trigger when not focusing using the keyboard */
|
|
3471
|
+
:host([focused]:not([focus-ring]):not([readonly])) [part='input-field']::after {
|
|
3472
|
+
transform: scaleX(0);
|
|
3473
|
+
transition-duration: 0.15s, 1s;
|
|
3474
|
+
}
|
|
284
3475
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
minlength: {
|
|
289
|
-
type: Number,
|
|
290
|
-
},
|
|
291
|
-
};
|
|
3476
|
+
/* Focus-ring */
|
|
3477
|
+
:host([focus-ring]) [part='input-field'] {
|
|
3478
|
+
box-shadow: 0 0 0 2px var(--lumo-primary-color-50pct);
|
|
292
3479
|
}
|
|
293
3480
|
|
|
294
|
-
|
|
295
|
-
|
|
3481
|
+
/* Read-only and disabled */
|
|
3482
|
+
:host(:is([readonly], [disabled])) ::slotted(:is(input, textarea):placeholder-shown) {
|
|
3483
|
+
opacity: 0;
|
|
296
3484
|
}
|
|
297
3485
|
|
|
298
|
-
|
|
299
|
-
|
|
3486
|
+
/* Read-only style */
|
|
3487
|
+
:host([readonly]) {
|
|
3488
|
+
--vaadin-input-field-border-color: transparent;
|
|
300
3489
|
}
|
|
301
3490
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
3491
|
+
/* Disabled style */
|
|
3492
|
+
:host([disabled]) {
|
|
3493
|
+
pointer-events: none;
|
|
3494
|
+
--vaadin-input-field-border-color: var(--lumo-contrast-20pct);
|
|
305
3495
|
}
|
|
306
3496
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
3497
|
+
:host([disabled]) [part='label'],
|
|
3498
|
+
:host([disabled]) [part='input-field'] ::slotted(*) {
|
|
3499
|
+
color: var(--lumo-disabled-text-color);
|
|
3500
|
+
-webkit-text-fill-color: var(--lumo-disabled-text-color);
|
|
310
3501
|
}
|
|
311
3502
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
3503
|
+
/* Invalid style */
|
|
3504
|
+
:host([invalid]) {
|
|
3505
|
+
--vaadin-input-field-border-color: var(--lumo-error-color);
|
|
3506
|
+
}
|
|
315
3507
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
this._setFocusElement(input);
|
|
320
|
-
this.stateTarget = input;
|
|
321
|
-
this.ariaTarget = input;
|
|
322
|
-
}),
|
|
323
|
-
);
|
|
324
|
-
this.addController(new LabelledInputController(this.inputElement, this._labelController));
|
|
3508
|
+
:host([invalid][focus-ring]) [part='input-field'] {
|
|
3509
|
+
box-shadow: 0 0 0 2px var(--lumo-error-color-50pct);
|
|
3510
|
+
}
|
|
325
3511
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
this.addController(this._tooltipController);
|
|
3512
|
+
:host([input-prevented]) [part='input-field'] {
|
|
3513
|
+
animation: shake 0.15s infinite;
|
|
329
3514
|
}
|
|
330
|
-
}
|
|
331
3515
|
|
|
332
|
-
|
|
3516
|
+
@keyframes shake {
|
|
3517
|
+
25% {
|
|
3518
|
+
transform: translateX(4px);
|
|
3519
|
+
}
|
|
3520
|
+
75% {
|
|
3521
|
+
transform: translateX(-4px);
|
|
3522
|
+
}
|
|
3523
|
+
}
|
|
333
3524
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
3525
|
+
/* Small theme */
|
|
3526
|
+
:host([theme~='small']) {
|
|
3527
|
+
font-size: var(--lumo-font-size-s);
|
|
3528
|
+
--lumo-text-field-size: var(--lumo-size-s);
|
|
3529
|
+
}
|
|
339
3530
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
3531
|
+
:host([theme~='small']) [part='label'] {
|
|
3532
|
+
font-size: var(--lumo-font-size-xs);
|
|
3533
|
+
}
|
|
3534
|
+
|
|
3535
|
+
:host([theme~='small']) [part='error-message'] {
|
|
3536
|
+
font-size: var(--lumo-font-size-xxs);
|
|
3537
|
+
}
|
|
3538
|
+
|
|
3539
|
+
/* Slotted content */
|
|
3540
|
+
[part='input-field'] ::slotted(:not(vaadin-icon):not(input):not(textarea)) {
|
|
3541
|
+
color: var(--lumo-secondary-text-color);
|
|
3542
|
+
font-weight: 400;
|
|
3543
|
+
}
|
|
3544
|
+
|
|
3545
|
+
[part='clear-button']::before {
|
|
3546
|
+
content: var(--lumo-icons-cross);
|
|
352
3547
|
}
|
|
353
3548
|
`;
|
|
354
3549
|
|
|
355
|
-
|
|
356
|
-
|
|
3550
|
+
const inputFieldShared = [requiredField, fieldButton, helper, inputField];
|
|
3551
|
+
|
|
3552
|
+
registerStyles('', inputFieldShared, {
|
|
3553
|
+
moduleId: 'lumo-input-field-shared-styles',
|
|
357
3554
|
});
|
|
358
3555
|
|
|
359
3556
|
/**
|
|
360
3557
|
* @license
|
|
361
|
-
* Copyright (c) 2021 -
|
|
3558
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
362
3559
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
363
3560
|
*/
|
|
364
3561
|
|
|
@@ -386,13 +3583,14 @@ registerStyles('vaadin-password-field', [inputFieldShared, passwordField], { mod
|
|
|
386
3583
|
|
|
387
3584
|
/**
|
|
388
3585
|
* @license
|
|
389
|
-
* Copyright (c) 2021 -
|
|
3586
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
390
3587
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
391
3588
|
*/
|
|
392
3589
|
|
|
393
3590
|
/**
|
|
394
3591
|
* An element used internally by `<vaadin-password-field>`. Not intended to be used separately.
|
|
395
3592
|
*
|
|
3593
|
+
* @customElement
|
|
396
3594
|
* @extends Button
|
|
397
3595
|
* @private
|
|
398
3596
|
*/
|
|
@@ -417,11 +3615,387 @@ class PasswordFieldButton extends Button {
|
|
|
417
3615
|
}
|
|
418
3616
|
}
|
|
419
3617
|
|
|
420
|
-
|
|
3618
|
+
defineCustomElement$1(PasswordFieldButton);
|
|
3619
|
+
|
|
3620
|
+
/**
|
|
3621
|
+
* @license
|
|
3622
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
3623
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
3624
|
+
*/
|
|
3625
|
+
|
|
3626
|
+
/**
|
|
3627
|
+
* Returns true if the given node is an empty text node, false otherwise.
|
|
3628
|
+
*
|
|
3629
|
+
* @param {Node} node
|
|
3630
|
+
* @return {boolean}
|
|
3631
|
+
*/
|
|
3632
|
+
function isEmptyTextNode(node) {
|
|
3633
|
+
return node.nodeType === Node.TEXT_NODE && node.textContent.trim() === '';
|
|
3634
|
+
}
|
|
3635
|
+
|
|
3636
|
+
/**
|
|
3637
|
+
* @license
|
|
3638
|
+
* Copyright (c) 2023 Vaadin Ltd.
|
|
3639
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
3640
|
+
*/
|
|
3641
|
+
|
|
3642
|
+
/**
|
|
3643
|
+
* A helper for observing slot changes.
|
|
3644
|
+
*/
|
|
3645
|
+
class SlotObserver {
|
|
3646
|
+
constructor(slot, callback) {
|
|
3647
|
+
/** @type HTMLSlotElement */
|
|
3648
|
+
this.slot = slot;
|
|
3649
|
+
|
|
3650
|
+
/** @type Function */
|
|
3651
|
+
this.callback = callback;
|
|
3652
|
+
|
|
3653
|
+
/** @type {Node[]} */
|
|
3654
|
+
this._storedNodes = [];
|
|
3655
|
+
|
|
3656
|
+
this._connected = false;
|
|
3657
|
+
this._scheduled = false;
|
|
3658
|
+
|
|
3659
|
+
this._boundSchedule = () => {
|
|
3660
|
+
this._schedule();
|
|
3661
|
+
};
|
|
3662
|
+
|
|
3663
|
+
this.connect();
|
|
3664
|
+
this._schedule();
|
|
3665
|
+
}
|
|
3666
|
+
|
|
3667
|
+
/**
|
|
3668
|
+
* Activates an observer. This method is automatically called when
|
|
3669
|
+
* a `SlotObserver` is created. It should only be called to re-activate
|
|
3670
|
+
* an observer that has been deactivated via the `disconnect` method.
|
|
3671
|
+
*/
|
|
3672
|
+
connect() {
|
|
3673
|
+
this.slot.addEventListener('slotchange', this._boundSchedule);
|
|
3674
|
+
this._connected = true;
|
|
3675
|
+
}
|
|
3676
|
+
|
|
3677
|
+
/**
|
|
3678
|
+
* Deactivates the observer. After calling this method the observer callback
|
|
3679
|
+
* will not be called when changes to slotted nodes occur. The `connect` method
|
|
3680
|
+
* may be subsequently called to reactivate the observer.
|
|
3681
|
+
*/
|
|
3682
|
+
disconnect() {
|
|
3683
|
+
this.slot.removeEventListener('slotchange', this._boundSchedule);
|
|
3684
|
+
this._connected = false;
|
|
3685
|
+
}
|
|
3686
|
+
|
|
3687
|
+
/** @private */
|
|
3688
|
+
_schedule() {
|
|
3689
|
+
if (!this._scheduled) {
|
|
3690
|
+
this._scheduled = true;
|
|
3691
|
+
|
|
3692
|
+
queueMicrotask(() => {
|
|
3693
|
+
this.flush();
|
|
3694
|
+
});
|
|
3695
|
+
}
|
|
3696
|
+
}
|
|
3697
|
+
|
|
3698
|
+
/**
|
|
3699
|
+
* Run the observer callback synchronously.
|
|
3700
|
+
*/
|
|
3701
|
+
flush() {
|
|
3702
|
+
if (!this._connected) {
|
|
3703
|
+
return;
|
|
3704
|
+
}
|
|
3705
|
+
|
|
3706
|
+
this._scheduled = false;
|
|
3707
|
+
|
|
3708
|
+
this._processNodes();
|
|
3709
|
+
}
|
|
3710
|
+
|
|
3711
|
+
/** @private */
|
|
3712
|
+
_processNodes() {
|
|
3713
|
+
const currentNodes = this.slot.assignedNodes({ flatten: true });
|
|
3714
|
+
|
|
3715
|
+
let addedNodes = [];
|
|
3716
|
+
const removedNodes = [];
|
|
3717
|
+
const movedNodes = [];
|
|
3718
|
+
|
|
3719
|
+
if (currentNodes.length) {
|
|
3720
|
+
addedNodes = currentNodes.filter((node) => !this._storedNodes.includes(node));
|
|
3721
|
+
}
|
|
3722
|
+
|
|
3723
|
+
if (this._storedNodes.length) {
|
|
3724
|
+
this._storedNodes.forEach((node, index) => {
|
|
3725
|
+
const idx = currentNodes.indexOf(node);
|
|
3726
|
+
if (idx === -1) {
|
|
3727
|
+
removedNodes.push(node);
|
|
3728
|
+
} else if (idx !== index) {
|
|
3729
|
+
movedNodes.push(node);
|
|
3730
|
+
}
|
|
3731
|
+
});
|
|
3732
|
+
}
|
|
3733
|
+
|
|
3734
|
+
if (addedNodes.length || removedNodes.length || movedNodes.length) {
|
|
3735
|
+
this.callback({ addedNodes, movedNodes, removedNodes });
|
|
3736
|
+
}
|
|
3737
|
+
|
|
3738
|
+
this._storedNodes = currentNodes;
|
|
3739
|
+
}
|
|
3740
|
+
}
|
|
3741
|
+
|
|
3742
|
+
/**
|
|
3743
|
+
* @license
|
|
3744
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
3745
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
3746
|
+
*/
|
|
3747
|
+
|
|
3748
|
+
let uniqueId = 0;
|
|
3749
|
+
|
|
3750
|
+
/**
|
|
3751
|
+
* Returns a unique integer id.
|
|
3752
|
+
*
|
|
3753
|
+
* @return {number}
|
|
3754
|
+
*/
|
|
3755
|
+
function generateUniqueId() {
|
|
3756
|
+
// eslint-disable-next-line no-plusplus
|
|
3757
|
+
return uniqueId++;
|
|
3758
|
+
}
|
|
3759
|
+
|
|
3760
|
+
/**
|
|
3761
|
+
* @license
|
|
3762
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
3763
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
3764
|
+
*/
|
|
3765
|
+
|
|
3766
|
+
/**
|
|
3767
|
+
* A controller for providing content to slot element and observing changes.
|
|
3768
|
+
*/
|
|
3769
|
+
class SlotController extends EventTarget {
|
|
3770
|
+
/**
|
|
3771
|
+
* Ensure that every instance has unique ID.
|
|
3772
|
+
*
|
|
3773
|
+
* @param {HTMLElement} host
|
|
3774
|
+
* @param {string} slotName
|
|
3775
|
+
* @return {string}
|
|
3776
|
+
* @protected
|
|
3777
|
+
*/
|
|
3778
|
+
static generateId(host, slotName) {
|
|
3779
|
+
const prefix = slotName || 'default';
|
|
3780
|
+
return `${prefix}-${host.localName}-${generateUniqueId()}`;
|
|
3781
|
+
}
|
|
3782
|
+
|
|
3783
|
+
constructor(host, slotName, tagName, config = {}) {
|
|
3784
|
+
super();
|
|
3785
|
+
|
|
3786
|
+
const { initializer, multiple, observe, useUniqueId } = config;
|
|
3787
|
+
|
|
3788
|
+
this.host = host;
|
|
3789
|
+
this.slotName = slotName;
|
|
3790
|
+
this.tagName = tagName;
|
|
3791
|
+
this.observe = typeof observe === 'boolean' ? observe : true;
|
|
3792
|
+
this.multiple = typeof multiple === 'boolean' ? multiple : false;
|
|
3793
|
+
this.slotInitializer = initializer;
|
|
3794
|
+
|
|
3795
|
+
if (multiple) {
|
|
3796
|
+
this.nodes = [];
|
|
3797
|
+
}
|
|
3798
|
+
|
|
3799
|
+
// Only generate the default ID if requested by the controller.
|
|
3800
|
+
if (useUniqueId) {
|
|
3801
|
+
this.defaultId = this.constructor.generateId(host, slotName);
|
|
3802
|
+
}
|
|
3803
|
+
}
|
|
3804
|
+
|
|
3805
|
+
hostConnected() {
|
|
3806
|
+
if (!this.initialized) {
|
|
3807
|
+
if (this.multiple) {
|
|
3808
|
+
this.initMultiple();
|
|
3809
|
+
} else {
|
|
3810
|
+
this.initSingle();
|
|
3811
|
+
}
|
|
3812
|
+
|
|
3813
|
+
if (this.observe) {
|
|
3814
|
+
this.observeSlot();
|
|
3815
|
+
}
|
|
3816
|
+
|
|
3817
|
+
this.initialized = true;
|
|
3818
|
+
}
|
|
3819
|
+
}
|
|
3820
|
+
|
|
3821
|
+
/** @protected */
|
|
3822
|
+
initSingle() {
|
|
3823
|
+
let node = this.getSlotChild();
|
|
3824
|
+
|
|
3825
|
+
if (!node) {
|
|
3826
|
+
node = this.attachDefaultNode();
|
|
3827
|
+
this.initNode(node);
|
|
3828
|
+
} else {
|
|
3829
|
+
this.node = node;
|
|
3830
|
+
this.initAddedNode(node);
|
|
3831
|
+
}
|
|
3832
|
+
}
|
|
3833
|
+
|
|
3834
|
+
/** @protected */
|
|
3835
|
+
initMultiple() {
|
|
3836
|
+
const children = this.getSlotChildren();
|
|
3837
|
+
|
|
3838
|
+
if (children.length === 0) {
|
|
3839
|
+
const defaultNode = this.attachDefaultNode();
|
|
3840
|
+
if (defaultNode) {
|
|
3841
|
+
this.nodes = [defaultNode];
|
|
3842
|
+
this.initNode(defaultNode);
|
|
3843
|
+
}
|
|
3844
|
+
} else {
|
|
3845
|
+
this.nodes = children;
|
|
3846
|
+
children.forEach((node) => {
|
|
3847
|
+
this.initAddedNode(node);
|
|
3848
|
+
});
|
|
3849
|
+
}
|
|
3850
|
+
}
|
|
3851
|
+
|
|
3852
|
+
/**
|
|
3853
|
+
* Create and attach default node using the provided tag name, if any.
|
|
3854
|
+
* @return {Node | undefined}
|
|
3855
|
+
* @protected
|
|
3856
|
+
*/
|
|
3857
|
+
attachDefaultNode() {
|
|
3858
|
+
const { host, slotName, tagName } = this;
|
|
3859
|
+
|
|
3860
|
+
// Check if the node was created previously and if so, reuse it.
|
|
3861
|
+
let node = this.defaultNode;
|
|
3862
|
+
|
|
3863
|
+
// Tag name is optional, sometimes we don't init default content.
|
|
3864
|
+
if (!node && tagName) {
|
|
3865
|
+
node = document.createElement(tagName);
|
|
3866
|
+
if (node instanceof Element) {
|
|
3867
|
+
if (slotName !== '') {
|
|
3868
|
+
node.setAttribute('slot', slotName);
|
|
3869
|
+
}
|
|
3870
|
+
this.node = node;
|
|
3871
|
+
this.defaultNode = node;
|
|
3872
|
+
}
|
|
3873
|
+
}
|
|
3874
|
+
|
|
3875
|
+
if (node) {
|
|
3876
|
+
host.appendChild(node);
|
|
3877
|
+
}
|
|
3878
|
+
|
|
3879
|
+
return node;
|
|
3880
|
+
}
|
|
3881
|
+
|
|
3882
|
+
/**
|
|
3883
|
+
* Return the list of nodes matching the slot managed by the controller.
|
|
3884
|
+
* @return {Node}
|
|
3885
|
+
*/
|
|
3886
|
+
getSlotChildren() {
|
|
3887
|
+
const { slotName } = this;
|
|
3888
|
+
return Array.from(this.host.childNodes).filter((node) => {
|
|
3889
|
+
// Either an element (any slot) or a text node (only un-named slot).
|
|
3890
|
+
return (
|
|
3891
|
+
(node.nodeType === Node.ELEMENT_NODE && node.slot === slotName) ||
|
|
3892
|
+
(node.nodeType === Node.TEXT_NODE && node.textContent.trim() && slotName === '')
|
|
3893
|
+
);
|
|
3894
|
+
});
|
|
3895
|
+
}
|
|
3896
|
+
|
|
3897
|
+
/**
|
|
3898
|
+
* Return a reference to the node managed by the controller.
|
|
3899
|
+
* @return {Node}
|
|
3900
|
+
*/
|
|
3901
|
+
getSlotChild() {
|
|
3902
|
+
return this.getSlotChildren()[0];
|
|
3903
|
+
}
|
|
3904
|
+
|
|
3905
|
+
/**
|
|
3906
|
+
* Run `slotInitializer` for the node managed by the controller.
|
|
3907
|
+
*
|
|
3908
|
+
* @param {Node} node
|
|
3909
|
+
* @protected
|
|
3910
|
+
*/
|
|
3911
|
+
initNode(node) {
|
|
3912
|
+
const { slotInitializer } = this;
|
|
3913
|
+
// Don't try to bind `this` to initializer (normally it's arrow function).
|
|
3914
|
+
// Instead, pass the host as a first argument to access component's state.
|
|
3915
|
+
if (slotInitializer) {
|
|
3916
|
+
slotInitializer(node, this.host);
|
|
3917
|
+
}
|
|
3918
|
+
}
|
|
3919
|
+
|
|
3920
|
+
/**
|
|
3921
|
+
* Override to initialize the newly added custom node.
|
|
3922
|
+
*
|
|
3923
|
+
* @param {Node} _node
|
|
3924
|
+
* @protected
|
|
3925
|
+
*/
|
|
3926
|
+
initCustomNode(_node) {}
|
|
3927
|
+
|
|
3928
|
+
/**
|
|
3929
|
+
* Override to teardown slotted node when it's removed.
|
|
3930
|
+
*
|
|
3931
|
+
* @param {Node} _node
|
|
3932
|
+
* @protected
|
|
3933
|
+
*/
|
|
3934
|
+
teardownNode(_node) {}
|
|
3935
|
+
|
|
3936
|
+
/**
|
|
3937
|
+
* Run both `initCustomNode` and `initNode` for a custom slotted node.
|
|
3938
|
+
*
|
|
3939
|
+
* @param {Node} node
|
|
3940
|
+
* @protected
|
|
3941
|
+
*/
|
|
3942
|
+
initAddedNode(node) {
|
|
3943
|
+
if (node !== this.defaultNode) {
|
|
3944
|
+
this.initCustomNode(node);
|
|
3945
|
+
this.initNode(node);
|
|
3946
|
+
}
|
|
3947
|
+
}
|
|
3948
|
+
|
|
3949
|
+
/**
|
|
3950
|
+
* Setup the observer to manage slot content changes.
|
|
3951
|
+
* @protected
|
|
3952
|
+
*/
|
|
3953
|
+
observeSlot() {
|
|
3954
|
+
const { slotName } = this;
|
|
3955
|
+
const selector = slotName === '' ? 'slot:not([name])' : `slot[name=${slotName}]`;
|
|
3956
|
+
const slot = this.host.shadowRoot.querySelector(selector);
|
|
3957
|
+
|
|
3958
|
+
this.__slotObserver = new SlotObserver(slot, ({ addedNodes, removedNodes }) => {
|
|
3959
|
+
const current = this.multiple ? this.nodes : [this.node];
|
|
3960
|
+
|
|
3961
|
+
// Calling `slot.assignedNodes()` includes whitespace text nodes in case of default slot:
|
|
3962
|
+
// unlike comment nodes, they are not filtered out. So we need to manually ignore them.
|
|
3963
|
+
const newNodes = addedNodes.filter((node) => !isEmptyTextNode(node) && !current.includes(node));
|
|
3964
|
+
|
|
3965
|
+
if (removedNodes.length) {
|
|
3966
|
+
this.nodes = current.filter((node) => !removedNodes.includes(node));
|
|
3967
|
+
|
|
3968
|
+
removedNodes.forEach((node) => {
|
|
3969
|
+
this.teardownNode(node);
|
|
3970
|
+
});
|
|
3971
|
+
}
|
|
3972
|
+
|
|
3973
|
+
if (newNodes && newNodes.length > 0) {
|
|
3974
|
+
if (this.multiple) {
|
|
3975
|
+
// Remove default node if exists
|
|
3976
|
+
if (this.defaultNode) {
|
|
3977
|
+
this.defaultNode.remove();
|
|
3978
|
+
}
|
|
3979
|
+
this.nodes = [...current, ...newNodes].filter((node) => node !== this.defaultNode);
|
|
3980
|
+
newNodes.forEach((node) => {
|
|
3981
|
+
this.initAddedNode(node);
|
|
3982
|
+
});
|
|
3983
|
+
} else {
|
|
3984
|
+
// Remove previous node if exists
|
|
3985
|
+
if (this.node) {
|
|
3986
|
+
this.node.remove();
|
|
3987
|
+
}
|
|
3988
|
+
this.node = newNodes[0];
|
|
3989
|
+
this.initAddedNode(this.node);
|
|
3990
|
+
}
|
|
3991
|
+
}
|
|
3992
|
+
});
|
|
3993
|
+
}
|
|
3994
|
+
}
|
|
421
3995
|
|
|
422
3996
|
/**
|
|
423
3997
|
* @license
|
|
424
|
-
* Copyright (c) 2021 -
|
|
3998
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
425
3999
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
426
4000
|
*/
|
|
427
4001
|
|
|
@@ -457,7 +4031,7 @@ let memoizedTemplate;
|
|
|
457
4031
|
* -------------------|---------------------------------
|
|
458
4032
|
* `password-visible` | Set when the password is visible
|
|
459
4033
|
*
|
|
460
|
-
* See [Styling Components](https://vaadin.com/docs/latest/styling/
|
|
4034
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
461
4035
|
*
|
|
462
4036
|
* @fires {Event} input - Fired when the value is changed by the user: on every typing keystroke, and the value is cleared using the clear button.
|
|
463
4037
|
* @fires {Event} change - Fired when the user commits a value change.
|
|
@@ -465,6 +4039,7 @@ let memoizedTemplate;
|
|
|
465
4039
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
466
4040
|
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
467
4041
|
*
|
|
4042
|
+
* @customElement
|
|
468
4043
|
* @extends TextField
|
|
469
4044
|
*/
|
|
470
4045
|
class PasswordField extends TextField {
|
|
@@ -538,6 +4113,14 @@ class PasswordField extends TextField {
|
|
|
538
4113
|
return ['__i18nChanged(i18n.*)'];
|
|
539
4114
|
}
|
|
540
4115
|
|
|
4116
|
+
constructor() {
|
|
4117
|
+
super();
|
|
4118
|
+
this._setType('password');
|
|
4119
|
+
this.__boundRevealButtonClick = this._onRevealButtonClick.bind(this);
|
|
4120
|
+
this.__boundRevealButtonMouseDown = this._onRevealButtonMouseDown.bind(this);
|
|
4121
|
+
this.__lastChange = '';
|
|
4122
|
+
}
|
|
4123
|
+
|
|
541
4124
|
/** @protected */
|
|
542
4125
|
get slotStyles() {
|
|
543
4126
|
const tag = this.localName;
|
|
@@ -556,31 +4139,20 @@ class PasswordField extends TextField {
|
|
|
556
4139
|
return this._revealButtonController && this._revealButtonController.node;
|
|
557
4140
|
}
|
|
558
4141
|
|
|
559
|
-
constructor() {
|
|
560
|
-
super();
|
|
561
|
-
this._setType('password');
|
|
562
|
-
this.__boundRevealButtonClick = this._onRevealButtonClick.bind(this);
|
|
563
|
-
this.__boundRevealButtonMouseDown = this._onRevealButtonMouseDown.bind(this);
|
|
564
|
-
this.__lastChange = '';
|
|
565
|
-
}
|
|
566
|
-
|
|
567
4142
|
/** @protected */
|
|
568
4143
|
ready() {
|
|
569
4144
|
super.ready();
|
|
570
4145
|
|
|
571
4146
|
this._revealPart = this.shadowRoot.querySelector('[part="reveal-button"]');
|
|
572
4147
|
|
|
573
|
-
this._revealButtonController = new SlotController(
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
() => document.createElement('vaadin-password-field-button'),
|
|
577
|
-
(host, btn) => {
|
|
578
|
-
btn.disabled = host.disabled;
|
|
4148
|
+
this._revealButtonController = new SlotController(this, 'reveal', 'vaadin-password-field-button', {
|
|
4149
|
+
initializer: (btn) => {
|
|
4150
|
+
btn.disabled = this.disabled;
|
|
579
4151
|
|
|
580
|
-
btn.addEventListener('click',
|
|
581
|
-
btn.addEventListener('mousedown',
|
|
4152
|
+
btn.addEventListener('click', this.__boundRevealButtonClick);
|
|
4153
|
+
btn.addEventListener('mousedown', this.__boundRevealButtonMouseDown);
|
|
582
4154
|
},
|
|
583
|
-
);
|
|
4155
|
+
});
|
|
584
4156
|
this.addController(this._revealButtonController);
|
|
585
4157
|
|
|
586
4158
|
this.__updateAriaLabel(this.i18n);
|
|
@@ -737,11 +4309,11 @@ class PasswordField extends TextField {
|
|
|
737
4309
|
}
|
|
738
4310
|
}
|
|
739
4311
|
|
|
740
|
-
|
|
4312
|
+
defineCustomElement$1(PasswordField);
|
|
741
4313
|
|
|
742
4314
|
const passwordInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.password{font-family:\"Roboto\";font-style:normal}.password__wrapper{position:relative;width:100%}.password__wrapper--autofilled{pointer-events:none}.password__wrapper--autofilled .password__label{color:#979797}.password__wrapper--autofilled .password__input::part(input-field){color:#979797}.password__wrapper--flex{display:flex;gap:5px}.password__wrapper--relative{position:relative}.password__label{font-family:inherit;font-style:normal;font-weight:500;font-size:16px;line-height:20px;color:#2A3841}.password__label--required::after{content:\"*\";font-family:inherit;color:#2A3841;margin-left:2px}.password__input{width:inherit;border:none;margin-bottom:5px}.password__input[focused]::part(input-field){border-color:#3E3E3E}.password__input[invalid]::part(input-field){border-color:#cc0000b3}.password__input::part(input-field){border-radius:4px;background-color:transparent;font-family:inherit;font-style:normal;font-weight:300;font-size:16px;line-height:19px;color:#2A2E3F;width:100%;position:relative;border:2px solid #DEE1EE}.password__input>input:placeholder-shown{color:#979797}.password__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000b3}.password__complexity{position:relative;padding:10px;display:flex;flex-direction:column;gap:20px;justify-content:center;margin-top:20px;font-weight:300;background:#FFFFFF;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;height:150px;border:1px solid #B0B0B0}.password__complexity--strength{display:flex;justify-content:space-evenly}.password__complexity--strength meter::-webkit-meter-optimum-value{background:#1F1F1F}.password__complexity--strength meter::-moz-meter-bar{background:#B0B0B0}.password__complexity--hidden{display:none}.password__complexity--text-bold{font-weight:500}.password__complexity--checkbox{margin-right:5px}.password__complexity:after{content:\"\";position:absolute;width:25px;height:25px;border-top:1px solid #B0B0B0;border-right:0 solid #B0B0B0;border-left:1px solid #B0B0B0;border-bottom:0 solid #B0B0B0;bottom:92%;left:50%;margin-left:-25px;transform:rotate(45deg);margin-top:-25px;background-color:#FFFFFF}.password__tooltip-icon{width:16px;height:auto}.password__tooltip{position:absolute;top:0;left:20px;background-color:#FFFFFF;border:1px solid #B0B0B0;color:#2B2D3F;padding:10px;border-radius:5px;opacity:0;transition:opacity 0.3s ease-in-out;z-index:10}.password__tooltip.visible{opacity:1}";
|
|
743
4315
|
|
|
744
|
-
const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
4316
|
+
const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement$1 {
|
|
745
4317
|
constructor() {
|
|
746
4318
|
super();
|
|
747
4319
|
this.__registerHost();
|