@everymatrix/general-registration 1.21.6 → 1.21.7
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 +18645 -33506
- package/dist/components/active-mixin.js +2 -92
- package/dist/components/checkbox-group-input2.js +426 -4154
- package/dist/components/date-input2.js +2609 -6144
- package/dist/components/field-mixin.js +3943 -2126
- package/dist/components/input-field-shared-styles.js +197 -1120
- package/dist/components/password-input2.js +305 -3830
- package/dist/components/vaadin-button.js +176 -2007
- package/dist/components/vaadin-combo-box.js +2046 -5193
- package/dist/components/virtual-keyboard-controller.js +264 -161
- package/dist/esm/checkbox-group-input_13.entry.js +18645 -33506
- package/dist/general-registration/general-registration.esm.js +1 -1
- package/dist/general-registration/p-59cdc741.entry.js +3647 -0
- package/package.json +1 -9
- package/dist/general-registration/p-d90b8853.entry.js +0 -8627
|
@@ -1,2089 +1,258 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i, r as registerStyles, Q as TabindexMixin, m as FocusMixin, E as ElementMixin, j as ThemableMixin, J as ControllerMixin, P as PolymerElement, T as TooltipController, g as defineCustomElement, h as html } from './field-mixin.js';
|
|
2
2
|
import { A as ActiveMixin } from './active-mixin.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @license
|
|
28
|
-
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
29
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Dummy custom element used for collecting
|
|
34
|
-
* development time usage statistics.
|
|
35
|
-
*
|
|
36
|
-
* @private
|
|
37
|
-
*/
|
|
38
|
-
class Lumo extends HTMLElement {
|
|
39
|
-
static get is() {
|
|
40
|
-
return 'vaadin-lumo-styles';
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
static get version() {
|
|
44
|
-
return '24.2.3';
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
defineCustomElement(Lumo);
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* @license
|
|
52
|
-
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
53
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
54
|
-
*/
|
|
55
|
-
/**
|
|
56
|
-
* @polymerMixin
|
|
57
|
-
*/
|
|
58
|
-
const ThemePropertyMixin = (superClass) =>
|
|
59
|
-
class VaadinThemePropertyMixin extends superClass {
|
|
60
|
-
static get properties() {
|
|
61
|
-
return {
|
|
62
|
-
/**
|
|
63
|
-
* Helper property with theme attribute value facilitating propagation
|
|
64
|
-
* in shadow DOM.
|
|
65
|
-
*
|
|
66
|
-
* Enables the component implementation to propagate the `theme`
|
|
67
|
-
* attribute value to the sub-components in Shadow DOM by binding
|
|
68
|
-
* the sub-component's "theme" attribute to the `theme` property of
|
|
69
|
-
* the host.
|
|
70
|
-
*
|
|
71
|
-
* **NOTE:** Extending the mixin only provides the property for binding,
|
|
72
|
-
* and does not make the propagation alone.
|
|
73
|
-
*
|
|
74
|
-
* See [Styling Components: Sub-components](https://vaadin.com/docs/latest/styling/styling-components/#sub-components).
|
|
75
|
-
* page for more information.
|
|
76
|
-
*
|
|
77
|
-
* @protected
|
|
78
|
-
*/
|
|
79
|
-
_theme: {
|
|
80
|
-
type: String,
|
|
81
|
-
readOnly: true,
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
static get observedAttributes() {
|
|
87
|
-
return [...super.observedAttributes, 'theme'];
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/** @protected */
|
|
91
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
92
|
-
super.attributeChangedCallback(name, oldValue, newValue);
|
|
93
|
-
|
|
94
|
-
if (name === 'theme') {
|
|
95
|
-
this._set_theme(newValue);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* @license
|
|
102
|
-
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
103
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
104
|
-
*/
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* @typedef {Object} Theme
|
|
108
|
-
* @property {string} themeFor
|
|
109
|
-
* @property {CSSResult[]} styles
|
|
110
|
-
* @property {string | string[]} [include]
|
|
111
|
-
* @property {string} [moduleId]
|
|
112
|
-
*
|
|
113
|
-
* @typedef {CSSResult[] | CSSResult} CSSResultGroup
|
|
114
|
-
*/
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* @type {Theme[]}
|
|
118
|
-
*/
|
|
119
|
-
const themeRegistry = [];
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Check if the custom element type has themes applied.
|
|
123
|
-
* @param {Function} elementClass
|
|
124
|
-
* @returns {boolean}
|
|
125
|
-
*/
|
|
126
|
-
function classHasThemes(elementClass) {
|
|
127
|
-
return elementClass && Object.prototype.hasOwnProperty.call(elementClass, '__themes');
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Check if the custom element type has themes applied.
|
|
132
|
-
* @param {string} tagName
|
|
133
|
-
* @returns {boolean}
|
|
134
|
-
*/
|
|
135
|
-
function hasThemes(tagName) {
|
|
136
|
-
return classHasThemes(customElements.get(tagName));
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Flattens the styles into a single array of styles.
|
|
141
|
-
* @param {CSSResultGroup} styles
|
|
142
|
-
* @param {CSSResult[]} result
|
|
143
|
-
* @returns {CSSResult[]}
|
|
144
|
-
*/
|
|
145
|
-
function flattenStyles(styles = []) {
|
|
146
|
-
return [styles].flat(Infinity).filter((style) => {
|
|
147
|
-
if (style instanceof o) {
|
|
148
|
-
return true;
|
|
149
|
-
}
|
|
150
|
-
console.warn('An item in styles is not of type CSSResult. Use `unsafeCSS` or `css`.');
|
|
151
|
-
return false;
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Registers CSS styles for a component type. Make sure to register the styles before
|
|
157
|
-
* the first instance of a component of the type is attached to DOM.
|
|
158
|
-
*
|
|
159
|
-
* @param {string} themeFor The local/tag name of the component type to register the styles for
|
|
160
|
-
* @param {CSSResultGroup} styles The CSS style rules to be registered for the component type
|
|
161
|
-
* matching themeFor and included in the local scope of each component instance
|
|
162
|
-
* @param {{moduleId?: string, include?: string | string[]}} options Additional options
|
|
163
|
-
* @return {void}
|
|
164
|
-
*/
|
|
165
|
-
function registerStyles(themeFor, styles, options = {}) {
|
|
166
|
-
if (themeFor) {
|
|
167
|
-
if (hasThemes(themeFor)) {
|
|
168
|
-
console.warn(`The custom element definition for "${themeFor}"
|
|
169
|
-
was finalized before a style module was registered.
|
|
170
|
-
Make sure to add component specific style modules before
|
|
171
|
-
importing the corresponding custom element.`);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
styles = flattenStyles(styles);
|
|
176
|
-
|
|
177
|
-
if (window.Vaadin && window.Vaadin.styleModules) {
|
|
178
|
-
window.Vaadin.styleModules.registerStyles(themeFor, styles, options);
|
|
179
|
-
} else {
|
|
180
|
-
themeRegistry.push({
|
|
181
|
-
themeFor,
|
|
182
|
-
styles,
|
|
183
|
-
include: options.include,
|
|
184
|
-
moduleId: options.moduleId,
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Returns all registered themes. By default the themeRegistry is returned as is.
|
|
191
|
-
* In case the style-modules adapter is imported, the themes are obtained from there instead
|
|
192
|
-
* @returns {Theme[]}
|
|
193
|
-
*/
|
|
194
|
-
function getAllThemes() {
|
|
195
|
-
if (window.Vaadin && window.Vaadin.styleModules) {
|
|
196
|
-
return window.Vaadin.styleModules.getAllThemes();
|
|
197
|
-
}
|
|
198
|
-
return themeRegistry;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Returns true if the themeFor string matches the tag name
|
|
203
|
-
* @param {string} themeFor
|
|
204
|
-
* @param {string} tagName
|
|
205
|
-
* @returns {boolean}
|
|
206
|
-
*/
|
|
207
|
-
function matchesThemeFor(themeFor, tagName) {
|
|
208
|
-
return (themeFor || '').split(' ').some((themeForToken) => {
|
|
209
|
-
return new RegExp(`^${themeForToken.split('*').join('.*')}$`, 'u').test(tagName);
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Maps the moduleName to an include priority number which is used for
|
|
215
|
-
* determining the order in which styles are applied.
|
|
216
|
-
* @param {string} moduleName
|
|
217
|
-
* @returns {number}
|
|
218
|
-
*/
|
|
219
|
-
function getIncludePriority(moduleName = '') {
|
|
220
|
-
let includePriority = 0;
|
|
221
|
-
if (moduleName.startsWith('lumo-') || moduleName.startsWith('material-')) {
|
|
222
|
-
includePriority = 1;
|
|
223
|
-
} else if (moduleName.startsWith('vaadin-')) {
|
|
224
|
-
includePriority = 2;
|
|
225
|
-
}
|
|
226
|
-
return includePriority;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Gets an array of CSSResults matching the include property of the theme.
|
|
231
|
-
* @param {Theme} theme
|
|
232
|
-
* @returns {CSSResult[]}
|
|
233
|
-
*/
|
|
234
|
-
function getIncludedStyles(theme) {
|
|
235
|
-
const includedStyles = [];
|
|
236
|
-
if (theme.include) {
|
|
237
|
-
[].concat(theme.include).forEach((includeModuleId) => {
|
|
238
|
-
const includedTheme = getAllThemes().find((s) => s.moduleId === includeModuleId);
|
|
239
|
-
if (includedTheme) {
|
|
240
|
-
includedStyles.push(...getIncludedStyles(includedTheme), ...includedTheme.styles);
|
|
241
|
-
} else {
|
|
242
|
-
console.warn(`Included moduleId ${includeModuleId} not found in style registry`);
|
|
243
|
-
}
|
|
244
|
-
}, theme.styles);
|
|
245
|
-
}
|
|
246
|
-
return includedStyles;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Includes the styles to the template.
|
|
251
|
-
* @param {CSSResult[]} styles
|
|
252
|
-
* @param {HTMLTemplateElement} template
|
|
253
|
-
*/
|
|
254
|
-
function addStylesToTemplate(styles, template) {
|
|
255
|
-
const styleEl = document.createElement('style');
|
|
256
|
-
styleEl.innerHTML = styles.map((style) => style.cssText).join('\n');
|
|
257
|
-
template.content.appendChild(styleEl);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Returns an array of themes that should be used for styling a component matching
|
|
262
|
-
* the tag name. The array is sorted by the include order.
|
|
263
|
-
* @param {string} tagName
|
|
264
|
-
* @returns {Theme[]}
|
|
265
|
-
*/
|
|
266
|
-
function getThemes(tagName) {
|
|
267
|
-
const defaultModuleName = `${tagName}-default-theme`;
|
|
268
|
-
|
|
269
|
-
const themes = getAllThemes()
|
|
270
|
-
// Filter by matching themeFor properties
|
|
271
|
-
.filter((theme) => theme.moduleId !== defaultModuleName && matchesThemeFor(theme.themeFor, tagName))
|
|
272
|
-
.map((theme) => ({
|
|
273
|
-
...theme,
|
|
274
|
-
// Prepend styles from included themes
|
|
275
|
-
styles: [...getIncludedStyles(theme), ...theme.styles],
|
|
276
|
-
// Map moduleId to includePriority
|
|
277
|
-
includePriority: getIncludePriority(theme.moduleId),
|
|
278
|
-
}))
|
|
279
|
-
// Sort by includePriority
|
|
280
|
-
.sort((themeA, themeB) => themeB.includePriority - themeA.includePriority);
|
|
281
|
-
|
|
282
|
-
if (themes.length > 0) {
|
|
283
|
-
return themes;
|
|
284
|
-
}
|
|
285
|
-
// No theme modules found, return the default module if it exists
|
|
286
|
-
return getAllThemes().filter((theme) => theme.moduleId === defaultModuleName);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* @polymerMixin
|
|
291
|
-
* @mixes ThemePropertyMixin
|
|
292
|
-
*/
|
|
293
|
-
const ThemableMixin = (superClass) =>
|
|
294
|
-
class VaadinThemableMixin extends ThemePropertyMixin(superClass) {
|
|
295
|
-
/**
|
|
296
|
-
* Covers PolymerElement based component styling
|
|
297
|
-
* @protected
|
|
298
|
-
*/
|
|
299
|
-
static finalize() {
|
|
300
|
-
super.finalize();
|
|
301
|
-
|
|
302
|
-
// Make sure not to run the logic intended for PolymerElement when LitElement is used.
|
|
303
|
-
if (this.elementStyles) {
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
const template = this.prototype._template;
|
|
308
|
-
if (!template || classHasThemes(this)) {
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
addStylesToTemplate(this.getStylesForThis(), template);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Covers LitElement based component styling
|
|
317
|
-
*
|
|
318
|
-
* @protected
|
|
319
|
-
*/
|
|
320
|
-
static finalizeStyles(styles) {
|
|
321
|
-
// The "styles" object originates from the "static get styles()" function of
|
|
322
|
-
// a LitElement based component. The theme styles are added after it
|
|
323
|
-
// so that they can override the component styles.
|
|
324
|
-
const themeStyles = this.getStylesForThis();
|
|
325
|
-
return styles ? [...super.finalizeStyles(styles), ...themeStyles] : themeStyles;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* Get styles for the component type
|
|
330
|
-
*
|
|
331
|
-
* @private
|
|
332
|
-
*/
|
|
333
|
-
static getStylesForThis() {
|
|
334
|
-
const parent = Object.getPrototypeOf(this.prototype);
|
|
335
|
-
const inheritedThemes = (parent ? parent.constructor.__themes : []) || [];
|
|
336
|
-
this.__themes = [...inheritedThemes, ...getThemes(this.is)];
|
|
337
|
-
const themeStyles = this.__themes.flatMap((theme) => theme.styles);
|
|
338
|
-
// Remove duplicates
|
|
339
|
-
return themeStyles.filter((style, index) => index === themeStyles.lastIndexOf(style));
|
|
340
|
-
}
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* @license
|
|
345
|
-
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
346
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
347
|
-
*/
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* This is for use internally by Lumo and Material styles.
|
|
351
|
-
*
|
|
352
|
-
* @param {string} id the id to set on the created element, only for informational purposes
|
|
353
|
-
* @param {CSSResultGroup[]} styles the styles to add
|
|
354
|
-
*/
|
|
355
|
-
const addGlobalThemeStyles = (id, ...styles) => {
|
|
356
|
-
const styleTag = document.createElement('style');
|
|
357
|
-
styleTag.id = id;
|
|
358
|
-
styleTag.textContent = styles
|
|
359
|
-
.map((style) => style.toString())
|
|
360
|
-
.join('\n')
|
|
361
|
-
.replace(':host', 'html');
|
|
362
|
-
|
|
363
|
-
document.head.insertAdjacentElement('afterbegin', styleTag);
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
const addLumoGlobalStyles = (id, ...styles) => {
|
|
367
|
-
addGlobalThemeStyles(`lumo-${id}`, styles);
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* @license
|
|
372
|
-
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
373
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
374
|
-
*/
|
|
375
|
-
|
|
376
|
-
const colorBase = i`
|
|
377
|
-
:host {
|
|
378
|
-
/* Base (background) */
|
|
379
|
-
--lumo-base-color: #fff;
|
|
380
|
-
|
|
381
|
-
/* Tint */
|
|
382
|
-
--lumo-tint-5pct: hsla(0, 0%, 100%, 0.3);
|
|
383
|
-
--lumo-tint-10pct: hsla(0, 0%, 100%, 0.37);
|
|
384
|
-
--lumo-tint-20pct: hsla(0, 0%, 100%, 0.44);
|
|
385
|
-
--lumo-tint-30pct: hsla(0, 0%, 100%, 0.5);
|
|
386
|
-
--lumo-tint-40pct: hsla(0, 0%, 100%, 0.57);
|
|
387
|
-
--lumo-tint-50pct: hsla(0, 0%, 100%, 0.64);
|
|
388
|
-
--lumo-tint-60pct: hsla(0, 0%, 100%, 0.7);
|
|
389
|
-
--lumo-tint-70pct: hsla(0, 0%, 100%, 0.77);
|
|
390
|
-
--lumo-tint-80pct: hsla(0, 0%, 100%, 0.84);
|
|
391
|
-
--lumo-tint-90pct: hsla(0, 0%, 100%, 0.9);
|
|
392
|
-
--lumo-tint: #fff;
|
|
393
|
-
|
|
394
|
-
/* Shade */
|
|
395
|
-
--lumo-shade-5pct: hsla(214, 61%, 25%, 0.05);
|
|
396
|
-
--lumo-shade-10pct: hsla(214, 57%, 24%, 0.1);
|
|
397
|
-
--lumo-shade-20pct: hsla(214, 53%, 23%, 0.16);
|
|
398
|
-
--lumo-shade-30pct: hsla(214, 50%, 22%, 0.26);
|
|
399
|
-
--lumo-shade-40pct: hsla(214, 47%, 21%, 0.38);
|
|
400
|
-
--lumo-shade-50pct: hsla(214, 45%, 20%, 0.52);
|
|
401
|
-
--lumo-shade-60pct: hsla(214, 43%, 19%, 0.6);
|
|
402
|
-
--lumo-shade-70pct: hsla(214, 42%, 18%, 0.69);
|
|
403
|
-
--lumo-shade-80pct: hsla(214, 41%, 17%, 0.83);
|
|
404
|
-
--lumo-shade-90pct: hsla(214, 40%, 16%, 0.94);
|
|
405
|
-
--lumo-shade: hsl(214, 35%, 15%);
|
|
406
|
-
|
|
407
|
-
/* Contrast */
|
|
408
|
-
--lumo-contrast-5pct: var(--lumo-shade-5pct);
|
|
409
|
-
--lumo-contrast-10pct: var(--lumo-shade-10pct);
|
|
410
|
-
--lumo-contrast-20pct: var(--lumo-shade-20pct);
|
|
411
|
-
--lumo-contrast-30pct: var(--lumo-shade-30pct);
|
|
412
|
-
--lumo-contrast-40pct: var(--lumo-shade-40pct);
|
|
413
|
-
--lumo-contrast-50pct: var(--lumo-shade-50pct);
|
|
414
|
-
--lumo-contrast-60pct: var(--lumo-shade-60pct);
|
|
415
|
-
--lumo-contrast-70pct: var(--lumo-shade-70pct);
|
|
416
|
-
--lumo-contrast-80pct: var(--lumo-shade-80pct);
|
|
417
|
-
--lumo-contrast-90pct: var(--lumo-shade-90pct);
|
|
418
|
-
--lumo-contrast: var(--lumo-shade);
|
|
419
|
-
|
|
420
|
-
/* Text */
|
|
421
|
-
--lumo-header-text-color: var(--lumo-contrast);
|
|
422
|
-
--lumo-body-text-color: var(--lumo-contrast-90pct);
|
|
423
|
-
--lumo-secondary-text-color: var(--lumo-contrast-70pct);
|
|
424
|
-
--lumo-tertiary-text-color: var(--lumo-contrast-50pct);
|
|
425
|
-
--lumo-disabled-text-color: var(--lumo-contrast-30pct);
|
|
426
|
-
|
|
427
|
-
/* Primary */
|
|
428
|
-
--lumo-primary-color: hsl(214, 100%, 48%);
|
|
429
|
-
--lumo-primary-color-50pct: hsla(214, 100%, 49%, 0.76);
|
|
430
|
-
--lumo-primary-color-10pct: hsla(214, 100%, 60%, 0.13);
|
|
431
|
-
--lumo-primary-text-color: hsl(214, 100%, 43%);
|
|
432
|
-
--lumo-primary-contrast-color: #fff;
|
|
433
|
-
|
|
434
|
-
/* Error */
|
|
435
|
-
--lumo-error-color: hsl(3, 85%, 48%);
|
|
436
|
-
--lumo-error-color-50pct: hsla(3, 85%, 49%, 0.5);
|
|
437
|
-
--lumo-error-color-10pct: hsla(3, 85%, 49%, 0.1);
|
|
438
|
-
--lumo-error-text-color: hsl(3, 89%, 42%);
|
|
439
|
-
--lumo-error-contrast-color: #fff;
|
|
440
|
-
|
|
441
|
-
/* Success */
|
|
442
|
-
--lumo-success-color: hsl(145, 72%, 30%);
|
|
443
|
-
--lumo-success-color-50pct: hsla(145, 72%, 31%, 0.5);
|
|
444
|
-
--lumo-success-color-10pct: hsla(145, 72%, 31%, 0.1);
|
|
445
|
-
--lumo-success-text-color: hsl(145, 85%, 25%);
|
|
446
|
-
--lumo-success-contrast-color: #fff;
|
|
447
|
-
|
|
448
|
-
/* Warning */
|
|
449
|
-
--lumo-warning-color: hsl(48, 100%, 50%);
|
|
450
|
-
--lumo-warning-color-10pct: hsla(48, 100%, 50%, 0.25);
|
|
451
|
-
--lumo-warning-text-color: hsl(32, 100%, 30%);
|
|
452
|
-
--lumo-warning-contrast-color: var(--lumo-shade-90pct);
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
/* forced-colors mode adjustments */
|
|
456
|
-
@media (forced-colors: active) {
|
|
457
|
-
html {
|
|
458
|
-
--lumo-disabled-text-color: GrayText;
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
`;
|
|
462
|
-
|
|
463
|
-
addLumoGlobalStyles('color-props', colorBase);
|
|
464
|
-
|
|
465
|
-
const color = i`
|
|
466
|
-
[theme~='dark'] {
|
|
467
|
-
/* Base (background) */
|
|
468
|
-
--lumo-base-color: hsl(214, 35%, 21%);
|
|
469
|
-
|
|
470
|
-
/* Tint */
|
|
471
|
-
--lumo-tint-5pct: hsla(214, 65%, 85%, 0.06);
|
|
472
|
-
--lumo-tint-10pct: hsla(214, 60%, 80%, 0.14);
|
|
473
|
-
--lumo-tint-20pct: hsla(214, 64%, 82%, 0.23);
|
|
474
|
-
--lumo-tint-30pct: hsla(214, 69%, 84%, 0.32);
|
|
475
|
-
--lumo-tint-40pct: hsla(214, 73%, 86%, 0.41);
|
|
476
|
-
--lumo-tint-50pct: hsla(214, 78%, 88%, 0.5);
|
|
477
|
-
--lumo-tint-60pct: hsla(214, 82%, 90%, 0.58);
|
|
478
|
-
--lumo-tint-70pct: hsla(214, 87%, 92%, 0.69);
|
|
479
|
-
--lumo-tint-80pct: hsla(214, 91%, 94%, 0.8);
|
|
480
|
-
--lumo-tint-90pct: hsla(214, 96%, 96%, 0.9);
|
|
481
|
-
--lumo-tint: hsl(214, 100%, 98%);
|
|
482
|
-
|
|
483
|
-
/* Shade */
|
|
484
|
-
--lumo-shade-5pct: hsla(214, 0%, 0%, 0.07);
|
|
485
|
-
--lumo-shade-10pct: hsla(214, 4%, 2%, 0.15);
|
|
486
|
-
--lumo-shade-20pct: hsla(214, 8%, 4%, 0.23);
|
|
487
|
-
--lumo-shade-30pct: hsla(214, 12%, 6%, 0.32);
|
|
488
|
-
--lumo-shade-40pct: hsla(214, 16%, 8%, 0.41);
|
|
489
|
-
--lumo-shade-50pct: hsla(214, 20%, 10%, 0.5);
|
|
490
|
-
--lumo-shade-60pct: hsla(214, 24%, 12%, 0.6);
|
|
491
|
-
--lumo-shade-70pct: hsla(214, 28%, 13%, 0.7);
|
|
492
|
-
--lumo-shade-80pct: hsla(214, 32%, 13%, 0.8);
|
|
493
|
-
--lumo-shade-90pct: hsla(214, 33%, 13%, 0.9);
|
|
494
|
-
--lumo-shade: hsl(214, 33%, 13%);
|
|
495
|
-
|
|
496
|
-
/* Contrast */
|
|
497
|
-
--lumo-contrast-5pct: var(--lumo-tint-5pct);
|
|
498
|
-
--lumo-contrast-10pct: var(--lumo-tint-10pct);
|
|
499
|
-
--lumo-contrast-20pct: var(--lumo-tint-20pct);
|
|
500
|
-
--lumo-contrast-30pct: var(--lumo-tint-30pct);
|
|
501
|
-
--lumo-contrast-40pct: var(--lumo-tint-40pct);
|
|
502
|
-
--lumo-contrast-50pct: var(--lumo-tint-50pct);
|
|
503
|
-
--lumo-contrast-60pct: var(--lumo-tint-60pct);
|
|
504
|
-
--lumo-contrast-70pct: var(--lumo-tint-70pct);
|
|
505
|
-
--lumo-contrast-80pct: var(--lumo-tint-80pct);
|
|
506
|
-
--lumo-contrast-90pct: var(--lumo-tint-90pct);
|
|
507
|
-
--lumo-contrast: var(--lumo-tint);
|
|
508
|
-
|
|
509
|
-
/* Text */
|
|
510
|
-
--lumo-header-text-color: var(--lumo-contrast);
|
|
511
|
-
--lumo-body-text-color: var(--lumo-contrast-90pct);
|
|
512
|
-
--lumo-secondary-text-color: var(--lumo-contrast-70pct);
|
|
513
|
-
--lumo-tertiary-text-color: var(--lumo-contrast-50pct);
|
|
514
|
-
--lumo-disabled-text-color: var(--lumo-contrast-30pct);
|
|
515
|
-
|
|
516
|
-
/* Primary */
|
|
517
|
-
--lumo-primary-color: hsl(214, 90%, 48%);
|
|
518
|
-
--lumo-primary-color-50pct: hsla(214, 90%, 70%, 0.69);
|
|
519
|
-
--lumo-primary-color-10pct: hsla(214, 90%, 55%, 0.13);
|
|
520
|
-
--lumo-primary-text-color: hsl(214, 90%, 77%);
|
|
521
|
-
--lumo-primary-contrast-color: #fff;
|
|
522
|
-
|
|
523
|
-
/* Error */
|
|
524
|
-
--lumo-error-color: hsl(3, 79%, 49%);
|
|
525
|
-
--lumo-error-color-50pct: hsla(3, 75%, 62%, 0.5);
|
|
526
|
-
--lumo-error-color-10pct: hsla(3, 75%, 62%, 0.14);
|
|
527
|
-
--lumo-error-text-color: hsl(3, 100%, 80%);
|
|
528
|
-
|
|
529
|
-
/* Success */
|
|
530
|
-
--lumo-success-color: hsl(145, 72%, 30%);
|
|
531
|
-
--lumo-success-color-50pct: hsla(145, 92%, 51%, 0.5);
|
|
532
|
-
--lumo-success-color-10pct: hsla(145, 92%, 51%, 0.1);
|
|
533
|
-
--lumo-success-text-color: hsl(145, 85%, 46%);
|
|
534
|
-
|
|
535
|
-
/* Warning */
|
|
536
|
-
--lumo-warning-color: hsl(43, 100%, 48%);
|
|
537
|
-
--lumo-warning-color-10pct: hsla(40, 100%, 50%, 0.2);
|
|
538
|
-
--lumo-warning-text-color: hsl(45, 100%, 60%);
|
|
539
|
-
--lumo-warning-contrast-color: var(--lumo-shade-90pct);
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
html {
|
|
543
|
-
color: var(--lumo-body-text-color);
|
|
544
|
-
background-color: var(--lumo-base-color);
|
|
545
|
-
color-scheme: light;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
[theme~='dark'] {
|
|
549
|
-
color: var(--lumo-body-text-color);
|
|
550
|
-
background-color: var(--lumo-base-color);
|
|
551
|
-
color-scheme: dark;
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
h1,
|
|
555
|
-
h2,
|
|
556
|
-
h3,
|
|
557
|
-
h4,
|
|
558
|
-
h5,
|
|
559
|
-
h6 {
|
|
560
|
-
color: var(--lumo-header-text-color);
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
a:where(:any-link) {
|
|
564
|
-
color: var(--lumo-primary-text-color);
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
a:not(:any-link) {
|
|
568
|
-
color: var(--lumo-disabled-text-color);
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
blockquote {
|
|
572
|
-
color: var(--lumo-secondary-text-color);
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
code,
|
|
576
|
-
pre {
|
|
577
|
-
background-color: var(--lumo-contrast-10pct);
|
|
578
|
-
border-radius: var(--lumo-border-radius-m);
|
|
579
|
-
}
|
|
580
|
-
`;
|
|
581
|
-
|
|
582
|
-
registerStyles('', color, { moduleId: 'lumo-color' });
|
|
583
|
-
|
|
584
|
-
/**
|
|
585
|
-
* @license
|
|
586
|
-
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
587
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
588
|
-
*/
|
|
589
|
-
|
|
590
|
-
const sizing = i`
|
|
591
|
-
:host {
|
|
592
|
-
--lumo-size-xs: 1.625rem;
|
|
593
|
-
--lumo-size-s: 1.875rem;
|
|
594
|
-
--lumo-size-m: 2.25rem;
|
|
595
|
-
--lumo-size-l: 2.75rem;
|
|
596
|
-
--lumo-size-xl: 3.5rem;
|
|
597
|
-
|
|
598
|
-
/* Icons */
|
|
599
|
-
--lumo-icon-size-s: 1.25em;
|
|
600
|
-
--lumo-icon-size-m: 1.5em;
|
|
601
|
-
--lumo-icon-size-l: 2.25em;
|
|
602
|
-
/* For backwards compatibility */
|
|
603
|
-
--lumo-icon-size: var(--lumo-icon-size-m);
|
|
604
|
-
}
|
|
605
|
-
`;
|
|
606
|
-
|
|
607
|
-
addLumoGlobalStyles('sizing-props', sizing);
|
|
608
|
-
|
|
609
|
-
/**
|
|
610
|
-
* @license
|
|
611
|
-
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
612
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
613
|
-
*/
|
|
614
|
-
|
|
615
|
-
const spacing = i`
|
|
616
|
-
:host {
|
|
617
|
-
/* Square */
|
|
618
|
-
--lumo-space-xs: 0.25rem;
|
|
619
|
-
--lumo-space-s: 0.5rem;
|
|
620
|
-
--lumo-space-m: 1rem;
|
|
621
|
-
--lumo-space-l: 1.5rem;
|
|
622
|
-
--lumo-space-xl: 2.5rem;
|
|
623
|
-
|
|
624
|
-
/* Wide */
|
|
625
|
-
--lumo-space-wide-xs: calc(var(--lumo-space-xs) / 2) var(--lumo-space-xs);
|
|
626
|
-
--lumo-space-wide-s: calc(var(--lumo-space-s) / 2) var(--lumo-space-s);
|
|
627
|
-
--lumo-space-wide-m: calc(var(--lumo-space-m) / 2) var(--lumo-space-m);
|
|
628
|
-
--lumo-space-wide-l: calc(var(--lumo-space-l) / 2) var(--lumo-space-l);
|
|
629
|
-
--lumo-space-wide-xl: calc(var(--lumo-space-xl) / 2) var(--lumo-space-xl);
|
|
630
|
-
|
|
631
|
-
/* Tall */
|
|
632
|
-
--lumo-space-tall-xs: var(--lumo-space-xs) calc(var(--lumo-space-xs) / 2);
|
|
633
|
-
--lumo-space-tall-s: var(--lumo-space-s) calc(var(--lumo-space-s) / 2);
|
|
634
|
-
--lumo-space-tall-m: var(--lumo-space-m) calc(var(--lumo-space-m) / 2);
|
|
635
|
-
--lumo-space-tall-l: var(--lumo-space-l) calc(var(--lumo-space-l) / 2);
|
|
636
|
-
--lumo-space-tall-xl: var(--lumo-space-xl) calc(var(--lumo-space-xl) / 2);
|
|
637
|
-
}
|
|
638
|
-
`;
|
|
639
|
-
|
|
640
|
-
addLumoGlobalStyles('spacing-props', spacing);
|
|
641
|
-
|
|
642
|
-
/**
|
|
643
|
-
* @license
|
|
644
|
-
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
645
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
646
|
-
*/
|
|
647
|
-
|
|
648
|
-
const style = i`
|
|
649
|
-
:host {
|
|
650
|
-
/* Border radius */
|
|
651
|
-
--lumo-border-radius-s: 0.25em; /* Checkbox, badge, date-picker year indicator, etc */
|
|
652
|
-
--lumo-border-radius-m: var(--lumo-border-radius, 0.25em); /* Button, text field, menu overlay, etc */
|
|
653
|
-
--lumo-border-radius-l: 0.5em; /* Dialog, notification, etc */
|
|
654
|
-
|
|
655
|
-
/* Shadow */
|
|
656
|
-
--lumo-box-shadow-xs: 0 1px 4px -1px var(--lumo-shade-50pct);
|
|
657
|
-
--lumo-box-shadow-s: 0 2px 4px -1px var(--lumo-shade-20pct), 0 3px 12px -1px var(--lumo-shade-30pct);
|
|
658
|
-
--lumo-box-shadow-m: 0 2px 6px -1px var(--lumo-shade-20pct), 0 8px 24px -4px var(--lumo-shade-40pct);
|
|
659
|
-
--lumo-box-shadow-l: 0 3px 18px -2px var(--lumo-shade-20pct), 0 12px 48px -6px var(--lumo-shade-40pct);
|
|
660
|
-
--lumo-box-shadow-xl: 0 4px 24px -3px var(--lumo-shade-20pct), 0 18px 64px -8px var(--lumo-shade-40pct);
|
|
661
|
-
|
|
662
|
-
/* Clickable element cursor */
|
|
663
|
-
--lumo-clickable-cursor: default;
|
|
664
|
-
}
|
|
665
|
-
`;
|
|
666
|
-
|
|
667
|
-
/**
|
|
668
|
-
* Default values for component-specific custom properties.
|
|
669
|
-
*/
|
|
670
|
-
i`
|
|
671
|
-
html {
|
|
672
|
-
--vaadin-checkbox-size: calc(var(--lumo-size-m) / 2);
|
|
673
|
-
--vaadin-radio-button-size: calc(var(--lumo-size-m) / 2);
|
|
674
|
-
--vaadin-input-field-border-radius: var(--lumo-border-radius-m);
|
|
675
|
-
}
|
|
676
|
-
`;
|
|
677
|
-
|
|
678
|
-
addLumoGlobalStyles('style-props', style);
|
|
679
|
-
|
|
680
|
-
/**
|
|
681
|
-
* @license
|
|
682
|
-
* Copyright (c) 2017 - 2023 Vaadin Ltd.
|
|
683
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
684
|
-
*/
|
|
685
|
-
|
|
686
|
-
const font = i`
|
|
687
|
-
:host {
|
|
688
|
-
/* prettier-ignore */
|
|
689
|
-
--lumo-font-family: -apple-system, BlinkMacSystemFont, 'Roboto', 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
|
690
|
-
|
|
691
|
-
/* Font sizes */
|
|
692
|
-
--lumo-font-size-xxs: 0.75rem;
|
|
693
|
-
--lumo-font-size-xs: 0.8125rem;
|
|
694
|
-
--lumo-font-size-s: 0.875rem;
|
|
695
|
-
--lumo-font-size-m: 1rem;
|
|
696
|
-
--lumo-font-size-l: 1.125rem;
|
|
697
|
-
--lumo-font-size-xl: 1.375rem;
|
|
698
|
-
--lumo-font-size-xxl: 1.75rem;
|
|
699
|
-
--lumo-font-size-xxxl: 2.5rem;
|
|
700
|
-
|
|
701
|
-
/* Line heights */
|
|
702
|
-
--lumo-line-height-xs: 1.25;
|
|
703
|
-
--lumo-line-height-s: 1.375;
|
|
704
|
-
--lumo-line-height-m: 1.625;
|
|
705
|
-
}
|
|
706
|
-
`;
|
|
707
|
-
|
|
708
|
-
const typography = i`
|
|
709
|
-
body,
|
|
710
|
-
:host {
|
|
711
|
-
font-family: var(--lumo-font-family);
|
|
712
|
-
font-size: var(--lumo-font-size-m);
|
|
713
|
-
line-height: var(--lumo-line-height-m);
|
|
714
|
-
-webkit-text-size-adjust: 100%;
|
|
715
|
-
-webkit-font-smoothing: antialiased;
|
|
716
|
-
-moz-osx-font-smoothing: grayscale;
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
small,
|
|
720
|
-
[theme~='font-size-s'] {
|
|
721
|
-
font-size: var(--lumo-font-size-s);
|
|
722
|
-
line-height: var(--lumo-line-height-s);
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
[theme~='font-size-xs'] {
|
|
726
|
-
font-size: var(--lumo-font-size-xs);
|
|
727
|
-
line-height: var(--lumo-line-height-xs);
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
:where(h1, h2, h3, h4, h5, h6) {
|
|
731
|
-
font-weight: 600;
|
|
732
|
-
line-height: var(--lumo-line-height-xs);
|
|
733
|
-
margin-block: 0;
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
:where(h1) {
|
|
737
|
-
font-size: var(--lumo-font-size-xxxl);
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
:where(h2) {
|
|
741
|
-
font-size: var(--lumo-font-size-xxl);
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
:where(h3) {
|
|
745
|
-
font-size: var(--lumo-font-size-xl);
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
:where(h4) {
|
|
749
|
-
font-size: var(--lumo-font-size-l);
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
:where(h5) {
|
|
753
|
-
font-size: var(--lumo-font-size-m);
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
:where(h6) {
|
|
757
|
-
font-size: var(--lumo-font-size-xs);
|
|
758
|
-
text-transform: uppercase;
|
|
759
|
-
letter-spacing: 0.03em;
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
p,
|
|
763
|
-
blockquote {
|
|
764
|
-
margin-top: 0.5em;
|
|
765
|
-
margin-bottom: 0.75em;
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
a {
|
|
769
|
-
text-decoration: none;
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
a:where(:any-link):hover {
|
|
773
|
-
text-decoration: underline;
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
hr {
|
|
777
|
-
display: block;
|
|
778
|
-
align-self: stretch;
|
|
779
|
-
height: 1px;
|
|
780
|
-
border: 0;
|
|
781
|
-
padding: 0;
|
|
782
|
-
margin: var(--lumo-space-s) calc(var(--lumo-border-radius-m) / 2);
|
|
783
|
-
background-color: var(--lumo-contrast-10pct);
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
blockquote {
|
|
787
|
-
border-left: 2px solid var(--lumo-contrast-30pct);
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
b,
|
|
791
|
-
strong {
|
|
792
|
-
font-weight: 600;
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
/* RTL specific styles */
|
|
796
|
-
blockquote[dir='rtl'] {
|
|
797
|
-
border-left: none;
|
|
798
|
-
border-right: 2px solid var(--lumo-contrast-30pct);
|
|
799
|
-
}
|
|
800
|
-
`;
|
|
801
|
-
|
|
802
|
-
registerStyles('', typography, { moduleId: 'lumo-typography' });
|
|
803
|
-
addLumoGlobalStyles('typography-props', font);
|
|
804
|
-
|
|
805
|
-
const button = i`
|
|
806
|
-
:host {
|
|
807
|
-
/* Sizing */
|
|
808
|
-
--lumo-button-size: var(--lumo-size-m);
|
|
809
|
-
min-width: calc(var(--lumo-button-size) * 2);
|
|
810
|
-
height: var(--lumo-button-size);
|
|
811
|
-
padding: 0 calc(var(--lumo-button-size) / 3 + var(--lumo-border-radius-m) / 2);
|
|
812
|
-
margin: var(--lumo-space-xs) 0;
|
|
813
|
-
box-sizing: border-box;
|
|
814
|
-
/* Style */
|
|
815
|
-
font-family: var(--lumo-font-family);
|
|
816
|
-
font-size: var(--lumo-font-size-m);
|
|
817
|
-
font-weight: 500;
|
|
818
|
-
color: var(--_lumo-button-color, var(--lumo-primary-text-color));
|
|
819
|
-
background-color: var(--_lumo-button-background-color, var(--lumo-contrast-5pct));
|
|
820
|
-
border-radius: var(--lumo-border-radius-m);
|
|
821
|
-
cursor: var(--lumo-clickable-cursor);
|
|
822
|
-
-webkit-tap-highlight-color: transparent;
|
|
823
|
-
-webkit-font-smoothing: antialiased;
|
|
824
|
-
-moz-osx-font-smoothing: grayscale;
|
|
825
|
-
flex-shrink: 0;
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
/* Set only for the internal parts so we don't affect the host vertical alignment */
|
|
829
|
-
[part='label'],
|
|
830
|
-
[part='prefix'],
|
|
831
|
-
[part='suffix'] {
|
|
832
|
-
line-height: var(--lumo-line-height-xs);
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
[part='label'] {
|
|
836
|
-
padding: calc(var(--lumo-button-size) / 6) 0;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
:host([theme~='small']) {
|
|
840
|
-
font-size: var(--lumo-font-size-s);
|
|
841
|
-
--lumo-button-size: var(--lumo-size-s);
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
:host([theme~='large']) {
|
|
845
|
-
font-size: var(--lumo-font-size-l);
|
|
846
|
-
--lumo-button-size: var(--lumo-size-l);
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
/* For interaction states */
|
|
850
|
-
:host::before,
|
|
851
|
-
:host::after {
|
|
852
|
-
content: '';
|
|
853
|
-
/* We rely on the host always being relative */
|
|
854
|
-
position: absolute;
|
|
855
|
-
z-index: 1;
|
|
856
|
-
inset: 0;
|
|
857
|
-
background-color: currentColor;
|
|
858
|
-
border-radius: inherit;
|
|
859
|
-
opacity: 0;
|
|
860
|
-
pointer-events: none;
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
/* Hover */
|
|
864
|
-
|
|
865
|
-
@media (any-hover: hover) {
|
|
866
|
-
:host(:hover)::before {
|
|
867
|
-
opacity: 0.02;
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
/* Active */
|
|
872
|
-
|
|
873
|
-
:host::after {
|
|
874
|
-
transition: opacity 1.4s, transform 0.1s;
|
|
875
|
-
filter: blur(8px);
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
:host([active])::before {
|
|
879
|
-
opacity: 0.05;
|
|
880
|
-
transition-duration: 0s;
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
:host([active])::after {
|
|
884
|
-
opacity: 0.1;
|
|
885
|
-
transition-duration: 0s, 0s;
|
|
886
|
-
transform: scale(0);
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
/* Keyboard focus */
|
|
890
|
-
|
|
891
|
-
:host([focus-ring]) {
|
|
892
|
-
box-shadow: 0 0 0 2px var(--lumo-primary-color-50pct);
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
:host([theme~='primary'][focus-ring]) {
|
|
896
|
-
box-shadow: 0 0 0 1px var(--lumo-base-color), 0 0 0 3px var(--lumo-primary-color-50pct);
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
/* Types (primary, tertiary, tertiary-inline */
|
|
900
|
-
|
|
901
|
-
:host([theme~='tertiary']),
|
|
902
|
-
:host([theme~='tertiary-inline']) {
|
|
903
|
-
background-color: transparent !important;
|
|
904
|
-
min-width: 0;
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
:host([theme~='tertiary']) {
|
|
908
|
-
padding: 0 calc(var(--lumo-button-size) / 6);
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
:host([theme~='tertiary-inline'])::before {
|
|
912
|
-
display: none;
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
:host([theme~='tertiary-inline']) {
|
|
916
|
-
margin: 0;
|
|
917
|
-
height: auto;
|
|
918
|
-
padding: 0;
|
|
919
|
-
line-height: inherit;
|
|
920
|
-
font-size: inherit;
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
:host([theme~='tertiary-inline']) [part='label'] {
|
|
924
|
-
padding: 0;
|
|
925
|
-
overflow: visible;
|
|
926
|
-
line-height: inherit;
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
:host([theme~='primary']) {
|
|
930
|
-
background-color: var(--_lumo-button-primary-background-color, var(--lumo-primary-color));
|
|
931
|
-
color: var(--_lumo-button-primary-color, var(--lumo-primary-contrast-color));
|
|
932
|
-
font-weight: 600;
|
|
933
|
-
min-width: calc(var(--lumo-button-size) * 2.5);
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
:host([theme~='primary'])::before {
|
|
937
|
-
background-color: black;
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
@media (any-hover: hover) {
|
|
941
|
-
:host([theme~='primary']:hover)::before {
|
|
942
|
-
opacity: 0.05;
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
:host([theme~='primary'][active])::before {
|
|
947
|
-
opacity: 0.1;
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
:host([theme~='primary'][active])::after {
|
|
951
|
-
opacity: 0.2;
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
/* Colors (success, error, contrast) */
|
|
955
|
-
|
|
956
|
-
:host([theme~='success']) {
|
|
957
|
-
color: var(--lumo-success-text-color);
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
:host([theme~='success'][theme~='primary']) {
|
|
961
|
-
background-color: var(--lumo-success-color);
|
|
962
|
-
color: var(--lumo-success-contrast-color);
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
:host([theme~='error']) {
|
|
966
|
-
color: var(--lumo-error-text-color);
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
:host([theme~='error'][theme~='primary']) {
|
|
970
|
-
background-color: var(--lumo-error-color);
|
|
971
|
-
color: var(--lumo-error-contrast-color);
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
:host([theme~='contrast']) {
|
|
975
|
-
color: var(--lumo-contrast);
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
:host([theme~='contrast'][theme~='primary']) {
|
|
979
|
-
background-color: var(--lumo-contrast);
|
|
980
|
-
color: var(--lumo-base-color);
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
/* Disabled state. Keep selectors after other color variants. */
|
|
984
|
-
|
|
985
|
-
:host([disabled]) {
|
|
986
|
-
pointer-events: none;
|
|
987
|
-
color: var(--lumo-disabled-text-color);
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
:host([theme~='primary'][disabled]) {
|
|
991
|
-
background-color: var(--lumo-contrast-30pct);
|
|
992
|
-
color: var(--lumo-base-color);
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
:host([theme~='primary'][disabled]) [part] {
|
|
996
|
-
opacity: 0.7;
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
/* Icons */
|
|
1000
|
-
|
|
1001
|
-
[part] ::slotted(vaadin-icon) {
|
|
1002
|
-
display: inline-block;
|
|
1003
|
-
width: var(--lumo-icon-size-m);
|
|
1004
|
-
height: var(--lumo-icon-size-m);
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
/* Vaadin icons are based on a 16x16 grid (unlike Lumo and Material icons with 24x24), so they look too big by default */
|
|
1008
|
-
[part] ::slotted(vaadin-icon[icon^='vaadin:']) {
|
|
1009
|
-
padding: 0.25em;
|
|
1010
|
-
box-sizing: border-box !important;
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
[part='prefix'] {
|
|
1014
|
-
margin-left: -0.25em;
|
|
1015
|
-
margin-right: 0.25em;
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
[part='suffix'] {
|
|
1019
|
-
margin-left: 0.25em;
|
|
1020
|
-
margin-right: -0.25em;
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
/* Icon-only */
|
|
1024
|
-
|
|
1025
|
-
:host([theme~='icon']:not([theme~='tertiary-inline'])) {
|
|
1026
|
-
min-width: var(--lumo-button-size);
|
|
1027
|
-
padding-left: calc(var(--lumo-button-size) / 4);
|
|
1028
|
-
padding-right: calc(var(--lumo-button-size) / 4);
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
|
-
:host([theme~='icon']) [part='prefix'],
|
|
1032
|
-
:host([theme~='icon']) [part='suffix'] {
|
|
1033
|
-
margin-left: 0;
|
|
1034
|
-
margin-right: 0;
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
/* RTL specific styles */
|
|
1038
|
-
|
|
1039
|
-
:host([dir='rtl']) [part='prefix'] {
|
|
1040
|
-
margin-left: 0.25em;
|
|
1041
|
-
margin-right: -0.25em;
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
:host([dir='rtl']) [part='suffix'] {
|
|
1045
|
-
margin-left: -0.25em;
|
|
1046
|
-
margin-right: 0.25em;
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
:host([dir='rtl'][theme~='icon']) [part='prefix'],
|
|
1050
|
-
:host([dir='rtl'][theme~='icon']) [part='suffix'] {
|
|
1051
|
-
margin-left: 0;
|
|
1052
|
-
margin-right: 0;
|
|
1053
|
-
}
|
|
1054
|
-
`;
|
|
1055
|
-
|
|
1056
|
-
registerStyles('vaadin-button', button, { moduleId: 'lumo-button' });
|
|
1057
|
-
|
|
1058
|
-
/**
|
|
1059
|
-
* @license
|
|
1060
|
-
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
1061
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
1062
|
-
*/
|
|
1063
|
-
|
|
1064
|
-
/**
|
|
1065
|
-
* @typedef ReactiveController
|
|
1066
|
-
* @type {import('lit').ReactiveController}
|
|
1067
|
-
*/
|
|
1068
|
-
|
|
1069
|
-
/**
|
|
1070
|
-
* A mixin for connecting controllers to the element.
|
|
1071
|
-
*
|
|
1072
|
-
* @polymerMixin
|
|
1073
|
-
*/
|
|
1074
|
-
const ControllerMixin = dedupingMixin((superClass) => {
|
|
1075
|
-
// If the superclass extends from LitElement,
|
|
1076
|
-
// use its own controllers implementation.
|
|
1077
|
-
if (typeof superClass.prototype.addController === 'function') {
|
|
1078
|
-
return superClass;
|
|
1079
|
-
}
|
|
1080
|
-
|
|
1081
|
-
return class ControllerMixinClass extends superClass {
|
|
1082
|
-
constructor() {
|
|
1083
|
-
super();
|
|
1084
|
-
|
|
1085
|
-
/**
|
|
1086
|
-
* @type {Set<ReactiveController>}
|
|
1087
|
-
*/
|
|
1088
|
-
this.__controllers = new Set();
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
/** @protected */
|
|
1092
|
-
connectedCallback() {
|
|
1093
|
-
super.connectedCallback();
|
|
1094
|
-
|
|
1095
|
-
this.__controllers.forEach((c) => {
|
|
1096
|
-
if (c.hostConnected) {
|
|
1097
|
-
c.hostConnected();
|
|
1098
|
-
}
|
|
1099
|
-
});
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
/** @protected */
|
|
1103
|
-
disconnectedCallback() {
|
|
1104
|
-
super.disconnectedCallback();
|
|
1105
|
-
|
|
1106
|
-
this.__controllers.forEach((c) => {
|
|
1107
|
-
if (c.hostDisconnected) {
|
|
1108
|
-
c.hostDisconnected();
|
|
1109
|
-
}
|
|
1110
|
-
});
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
/**
|
|
1114
|
-
* Registers a controller to participate in the element update cycle.
|
|
1115
|
-
*
|
|
1116
|
-
* @param {ReactiveController} controller
|
|
1117
|
-
* @protected
|
|
1118
|
-
*/
|
|
1119
|
-
addController(controller) {
|
|
1120
|
-
this.__controllers.add(controller);
|
|
1121
|
-
// Call hostConnected if a controller is added after the element is attached.
|
|
1122
|
-
if (this.$ !== undefined && this.isConnected && controller.hostConnected) {
|
|
1123
|
-
controller.hostConnected();
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
/**
|
|
1128
|
-
* Removes a controller from the element.
|
|
1129
|
-
*
|
|
1130
|
-
* @param {ReactiveController} controller
|
|
1131
|
-
* @protected
|
|
1132
|
-
*/
|
|
1133
|
-
removeController(controller) {
|
|
1134
|
-
this.__controllers.delete(controller);
|
|
1135
|
-
}
|
|
1136
|
-
};
|
|
1137
|
-
});
|
|
1138
|
-
|
|
1139
|
-
/**
|
|
1140
|
-
* @license
|
|
1141
|
-
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
1142
|
-
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
|
1143
|
-
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
|
1144
|
-
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
|
1145
|
-
* Code distributed by Google as part of the polymer project is also
|
|
1146
|
-
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
|
1147
|
-
*/
|
|
1148
|
-
|
|
1149
|
-
/**
|
|
1150
|
-
* Async interface wrapper around `requestIdleCallback`. Falls back to
|
|
1151
|
-
* `setTimeout` on browsers that do not support `requestIdleCallback`.
|
|
1152
|
-
*
|
|
1153
|
-
* @namespace
|
|
1154
|
-
* @summary Async interface wrapper around `requestIdleCallback`.
|
|
1155
|
-
*/
|
|
1156
|
-
const idlePeriod = {
|
|
1157
|
-
/**
|
|
1158
|
-
* Enqueues a function called at `requestIdleCallback` timing.
|
|
1159
|
-
*
|
|
1160
|
-
* @memberof idlePeriod
|
|
1161
|
-
* @param {function(!IdleDeadline):void} fn Callback to run
|
|
1162
|
-
* @return {number} Handle used for canceling task
|
|
1163
|
-
*/
|
|
1164
|
-
run(fn) {
|
|
1165
|
-
return window.requestIdleCallback ? window.requestIdleCallback(fn) : window.setTimeout(fn, 16);
|
|
1166
|
-
},
|
|
1167
|
-
/**
|
|
1168
|
-
* Cancels a previously enqueued `idlePeriod` callback.
|
|
1169
|
-
*
|
|
1170
|
-
* @memberof idlePeriod
|
|
1171
|
-
* @param {number} handle Handle returned from `run` of callback to cancel
|
|
1172
|
-
* @return {void}
|
|
1173
|
-
*/
|
|
1174
|
-
cancel(handle) {
|
|
1175
|
-
if (window.cancelIdleCallback) {
|
|
1176
|
-
window.cancelIdleCallback(handle);
|
|
1177
|
-
} else {
|
|
1178
|
-
window.clearTimeout(handle);
|
|
1179
|
-
}
|
|
1180
|
-
},
|
|
1181
|
-
};
|
|
1182
|
-
|
|
1183
|
-
/**
|
|
1184
|
-
@license
|
|
1185
|
-
Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
1186
|
-
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
|
1187
|
-
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
|
1188
|
-
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
|
1189
|
-
Code distributed by Google as part of the polymer project is also
|
|
1190
|
-
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
|
1191
|
-
*/
|
|
1192
|
-
|
|
1193
|
-
const debouncerQueue = new Set();
|
|
1194
|
-
|
|
1195
|
-
/**
|
|
1196
|
-
* @summary Collapse multiple callbacks into one invocation after a timer.
|
|
1197
|
-
*/
|
|
1198
|
-
class Debouncer {
|
|
1199
|
-
/**
|
|
1200
|
-
* Creates a debouncer if no debouncer is passed as a parameter
|
|
1201
|
-
* or it cancels an active debouncer otherwise. The following
|
|
1202
|
-
* example shows how a debouncer can be called multiple times within a
|
|
1203
|
-
* microtask and "debounced" such that the provided callback function is
|
|
1204
|
-
* called once. Add this method to a custom element:
|
|
1205
|
-
*
|
|
1206
|
-
* ```js
|
|
1207
|
-
* import {microTask} from '@vaadin/component-base/src/async.js';
|
|
1208
|
-
* import {Debouncer} from '@vaadin/component-base/src/debounce.js';
|
|
1209
|
-
* // ...
|
|
1210
|
-
*
|
|
1211
|
-
* _debounceWork() {
|
|
1212
|
-
* this._debounceJob = Debouncer.debounce(this._debounceJob,
|
|
1213
|
-
* microTask, () => this._doWork());
|
|
1214
|
-
* }
|
|
1215
|
-
* ```
|
|
1216
|
-
*
|
|
1217
|
-
* If the `_debounceWork` method is called multiple times within the same
|
|
1218
|
-
* microtask, the `_doWork` function will be called only once at the next
|
|
1219
|
-
* microtask checkpoint.
|
|
1220
|
-
*
|
|
1221
|
-
* Note: In testing it is often convenient to avoid asynchrony. To accomplish
|
|
1222
|
-
* this with a debouncer, you can use `enqueueDebouncer` and
|
|
1223
|
-
* `flush`. For example, extend the above example by adding
|
|
1224
|
-
* `enqueueDebouncer(this._debounceJob)` at the end of the
|
|
1225
|
-
* `_debounceWork` method. Then in a test, call `flush` to ensure
|
|
1226
|
-
* the debouncer has completed.
|
|
1227
|
-
*
|
|
1228
|
-
* @param {Debouncer?} debouncer Debouncer object.
|
|
1229
|
-
* @param {!AsyncInterface} asyncModule Object with Async interface
|
|
1230
|
-
* @param {function()} callback Callback to run.
|
|
1231
|
-
* @return {!Debouncer} Returns a debouncer object.
|
|
1232
|
-
*/
|
|
1233
|
-
static debounce(debouncer, asyncModule, callback) {
|
|
1234
|
-
if (debouncer instanceof Debouncer) {
|
|
1235
|
-
// Cancel the async callback, but leave in debouncerQueue if it was
|
|
1236
|
-
// enqueued, to maintain 1.x flush order
|
|
1237
|
-
debouncer._cancelAsync();
|
|
1238
|
-
} else {
|
|
1239
|
-
debouncer = new Debouncer();
|
|
1240
|
-
}
|
|
1241
|
-
debouncer.setConfig(asyncModule, callback);
|
|
1242
|
-
return debouncer;
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1245
|
-
constructor() {
|
|
1246
|
-
this._asyncModule = null;
|
|
1247
|
-
this._callback = null;
|
|
1248
|
-
this._timer = null;
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
/**
|
|
1252
|
-
* Sets the scheduler; that is, a module with the Async interface,
|
|
1253
|
-
* a callback and optional arguments to be passed to the run function
|
|
1254
|
-
* from the async module.
|
|
1255
|
-
*
|
|
1256
|
-
* @param {!AsyncInterface} asyncModule Object with Async interface.
|
|
1257
|
-
* @param {function()} callback Callback to run.
|
|
1258
|
-
* @return {void}
|
|
1259
|
-
*/
|
|
1260
|
-
setConfig(asyncModule, callback) {
|
|
1261
|
-
this._asyncModule = asyncModule;
|
|
1262
|
-
this._callback = callback;
|
|
1263
|
-
this._timer = this._asyncModule.run(() => {
|
|
1264
|
-
this._timer = null;
|
|
1265
|
-
debouncerQueue.delete(this);
|
|
1266
|
-
this._callback();
|
|
1267
|
-
});
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
/**
|
|
1271
|
-
* Cancels an active debouncer and returns a reference to itself.
|
|
1272
|
-
*
|
|
1273
|
-
* @return {void}
|
|
1274
|
-
*/
|
|
1275
|
-
cancel() {
|
|
1276
|
-
if (this.isActive()) {
|
|
1277
|
-
this._cancelAsync();
|
|
1278
|
-
// Canceling a debouncer removes its spot from the flush queue,
|
|
1279
|
-
// so if a debouncer is manually canceled and re-debounced, it
|
|
1280
|
-
// will reset its flush order (this is a very minor difference from 1.x)
|
|
1281
|
-
// Re-debouncing via the `debounce` API retains the 1.x FIFO flush order
|
|
1282
|
-
debouncerQueue.delete(this);
|
|
1283
|
-
}
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
|
-
/**
|
|
1287
|
-
* Cancels a debouncer's async callback.
|
|
1288
|
-
*
|
|
1289
|
-
* @return {void}
|
|
1290
|
-
*/
|
|
1291
|
-
_cancelAsync() {
|
|
1292
|
-
if (this.isActive()) {
|
|
1293
|
-
this._asyncModule.cancel(/** @type {number} */ (this._timer));
|
|
1294
|
-
this._timer = null;
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
/**
|
|
1299
|
-
* Flushes an active debouncer and returns a reference to itself.
|
|
1300
|
-
*
|
|
1301
|
-
* @return {void}
|
|
1302
|
-
*/
|
|
1303
|
-
flush() {
|
|
1304
|
-
if (this.isActive()) {
|
|
1305
|
-
this.cancel();
|
|
1306
|
-
this._callback();
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
/**
|
|
1311
|
-
* Returns true if the debouncer is active.
|
|
1312
|
-
*
|
|
1313
|
-
* @return {boolean} True if active.
|
|
1314
|
-
*/
|
|
1315
|
-
isActive() {
|
|
1316
|
-
return this._timer != null;
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
/**
|
|
1321
|
-
* Adds a `Debouncer` to a list of globally flushable tasks.
|
|
1322
|
-
*
|
|
1323
|
-
* @param {!Debouncer} debouncer Debouncer to enqueue
|
|
1324
|
-
* @return {void}
|
|
1325
|
-
*/
|
|
1326
|
-
function enqueueDebouncer(debouncer) {
|
|
1327
|
-
debouncerQueue.add(debouncer);
|
|
1328
|
-
}
|
|
1329
|
-
|
|
1330
|
-
/**
|
|
1331
|
-
* @license
|
|
1332
|
-
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
1333
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
1334
|
-
*/
|
|
1335
|
-
|
|
1336
|
-
/**
|
|
1337
|
-
* Array of Vaadin custom element classes that have been subscribed to the dir changes.
|
|
1338
|
-
*/
|
|
1339
|
-
const directionSubscribers = [];
|
|
1340
|
-
|
|
1341
|
-
function alignDirs(element, documentDir, elementDir = element.getAttribute('dir')) {
|
|
1342
|
-
if (documentDir) {
|
|
1343
|
-
element.setAttribute('dir', documentDir);
|
|
1344
|
-
} else if (elementDir != null) {
|
|
1345
|
-
element.removeAttribute('dir');
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
|
-
function getDocumentDir() {
|
|
1350
|
-
return document.documentElement.getAttribute('dir');
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
function directionUpdater() {
|
|
1354
|
-
const documentDir = getDocumentDir();
|
|
1355
|
-
directionSubscribers.forEach((element) => {
|
|
1356
|
-
alignDirs(element, documentDir);
|
|
1357
|
-
});
|
|
1358
|
-
}
|
|
1359
|
-
|
|
1360
|
-
const directionObserver = new MutationObserver(directionUpdater);
|
|
1361
|
-
directionObserver.observe(document.documentElement, { attributes: true, attributeFilter: ['dir'] });
|
|
1362
|
-
|
|
1363
|
-
/**
|
|
1364
|
-
* A mixin to handle `dir` attribute based on the one set on the `<html>` element.
|
|
1365
|
-
*
|
|
1366
|
-
* @polymerMixin
|
|
1367
|
-
*/
|
|
1368
|
-
const DirMixin = (superClass) =>
|
|
1369
|
-
class VaadinDirMixin extends superClass {
|
|
1370
|
-
static get properties() {
|
|
1371
|
-
return {
|
|
1372
|
-
/**
|
|
1373
|
-
* @protected
|
|
1374
|
-
*/
|
|
1375
|
-
dir: {
|
|
1376
|
-
type: String,
|
|
1377
|
-
value: '',
|
|
1378
|
-
reflectToAttribute: true,
|
|
1379
|
-
converter: {
|
|
1380
|
-
fromAttribute: (attr) => {
|
|
1381
|
-
return !attr ? '' : attr;
|
|
1382
|
-
},
|
|
1383
|
-
toAttribute: (prop) => {
|
|
1384
|
-
return prop === '' ? null : prop;
|
|
1385
|
-
},
|
|
1386
|
-
},
|
|
1387
|
-
},
|
|
1388
|
-
};
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
|
-
/**
|
|
1392
|
-
* @return {boolean}
|
|
1393
|
-
* @protected
|
|
1394
|
-
*/
|
|
1395
|
-
get __isRTL() {
|
|
1396
|
-
return this.getAttribute('dir') === 'rtl';
|
|
1397
|
-
}
|
|
1398
|
-
|
|
1399
|
-
/** @protected */
|
|
1400
|
-
connectedCallback() {
|
|
1401
|
-
super.connectedCallback();
|
|
1402
|
-
|
|
1403
|
-
if (!this.hasAttribute('dir') || this.__restoreSubscription) {
|
|
1404
|
-
this.__subscribe();
|
|
1405
|
-
alignDirs(this, getDocumentDir(), null);
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1409
|
-
/** @protected */
|
|
1410
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
1411
|
-
super.attributeChangedCallback(name, oldValue, newValue);
|
|
1412
|
-
if (name !== 'dir') {
|
|
1413
|
-
return;
|
|
1414
|
-
}
|
|
1415
|
-
|
|
1416
|
-
const documentDir = getDocumentDir();
|
|
1417
|
-
|
|
1418
|
-
// New value equals to the document direction and the element is not subscribed to the changes
|
|
1419
|
-
const newValueEqlDocDir = newValue === documentDir && directionSubscribers.indexOf(this) === -1;
|
|
1420
|
-
// Value was emptied and the element is not subscribed to the changes
|
|
1421
|
-
const newValueEmptied = !newValue && oldValue && directionSubscribers.indexOf(this) === -1;
|
|
1422
|
-
// New value is different and the old equals to document direction and the element is not subscribed to the changes
|
|
1423
|
-
const newDiffValue = newValue !== documentDir && oldValue === documentDir;
|
|
1424
|
-
|
|
1425
|
-
if (newValueEqlDocDir || newValueEmptied) {
|
|
1426
|
-
this.__subscribe();
|
|
1427
|
-
alignDirs(this, documentDir, newValue);
|
|
1428
|
-
} else if (newDiffValue) {
|
|
1429
|
-
this.__unsubscribe();
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
|
|
1433
|
-
/** @protected */
|
|
1434
|
-
disconnectedCallback() {
|
|
1435
|
-
super.disconnectedCallback();
|
|
1436
|
-
this.__restoreSubscription = directionSubscribers.includes(this);
|
|
1437
|
-
this.__unsubscribe();
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
/** @protected */
|
|
1441
|
-
_valueToNodeAttribute(node, value, attribute) {
|
|
1442
|
-
// Override default Polymer attribute reflection to match native behavior of HTMLElement.dir property
|
|
1443
|
-
// If the property contains an empty string then it should not create an empty attribute
|
|
1444
|
-
if (attribute === 'dir' && value === '' && !node.hasAttribute('dir')) {
|
|
1445
|
-
return;
|
|
1446
|
-
}
|
|
1447
|
-
super._valueToNodeAttribute(node, value, attribute);
|
|
1448
|
-
}
|
|
1449
|
-
|
|
1450
|
-
/** @protected */
|
|
1451
|
-
_attributeToProperty(attribute, value, type) {
|
|
1452
|
-
// Override default Polymer attribute reflection to match native behavior of HTMLElement.dir property
|
|
1453
|
-
// If the attribute is removed, then the dir property should contain an empty string instead of null
|
|
1454
|
-
if (attribute === 'dir' && !value) {
|
|
1455
|
-
this.dir = '';
|
|
1456
|
-
} else {
|
|
1457
|
-
super._attributeToProperty(attribute, value, type);
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
|
-
/** @private */
|
|
1462
|
-
__subscribe() {
|
|
1463
|
-
if (!directionSubscribers.includes(this)) {
|
|
1464
|
-
directionSubscribers.push(this);
|
|
1465
|
-
}
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
|
-
/** @private */
|
|
1469
|
-
__unsubscribe() {
|
|
1470
|
-
if (directionSubscribers.includes(this)) {
|
|
1471
|
-
directionSubscribers.splice(directionSubscribers.indexOf(this), 1);
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
};
|
|
1475
|
-
|
|
1476
|
-
/**
|
|
1477
|
-
* @license
|
|
1478
|
-
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
1479
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
1480
|
-
*/
|
|
1481
|
-
|
|
1482
|
-
if (!window.Vaadin) {
|
|
1483
|
-
window.Vaadin = {};
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
|
-
/**
|
|
1487
|
-
* Array of Vaadin custom element classes that have been finalized.
|
|
1488
|
-
*/
|
|
1489
|
-
if (!window.Vaadin.registrations) {
|
|
1490
|
-
window.Vaadin.registrations = [];
|
|
1491
|
-
}
|
|
1492
|
-
|
|
1493
|
-
if (!window.Vaadin.developmentModeCallback) {
|
|
1494
|
-
window.Vaadin.developmentModeCallback = {};
|
|
1495
|
-
}
|
|
1496
|
-
|
|
1497
|
-
window.Vaadin.developmentModeCallback['vaadin-usage-statistics'] = function () {
|
|
1498
|
-
usageStatistics();
|
|
1499
|
-
};
|
|
1500
|
-
|
|
1501
|
-
let statsJob;
|
|
1502
|
-
|
|
1503
|
-
const registered = new Set();
|
|
1504
|
-
|
|
1505
|
-
/**
|
|
1506
|
-
* @polymerMixin
|
|
1507
|
-
* @mixes DirMixin
|
|
1508
|
-
*/
|
|
1509
|
-
const ElementMixin = (superClass) =>
|
|
1510
|
-
class VaadinElementMixin extends DirMixin(superClass) {
|
|
1511
|
-
static get version() {
|
|
1512
|
-
return '24.2.3';
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
/** @protected */
|
|
1516
|
-
static finalize() {
|
|
1517
|
-
super.finalize();
|
|
1518
|
-
|
|
1519
|
-
const { is } = this;
|
|
1520
|
-
|
|
1521
|
-
// Registers a class prototype for telemetry purposes.
|
|
1522
|
-
if (is && !registered.has(is)) {
|
|
1523
|
-
window.Vaadin.registrations.push(this);
|
|
1524
|
-
registered.add(is);
|
|
1525
|
-
|
|
1526
|
-
if (window.Vaadin.developmentModeCallback) {
|
|
1527
|
-
statsJob = Debouncer.debounce(statsJob, idlePeriod, () => {
|
|
1528
|
-
window.Vaadin.developmentModeCallback['vaadin-usage-statistics']();
|
|
1529
|
-
});
|
|
1530
|
-
enqueueDebouncer(statsJob);
|
|
1531
|
-
}
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
constructor() {
|
|
1536
|
-
super();
|
|
1537
|
-
|
|
1538
|
-
if (document.doctype === null) {
|
|
1539
|
-
console.warn(
|
|
1540
|
-
'Vaadin components require the "standards mode" declaration. Please add <!DOCTYPE html> to the HTML document.',
|
|
1541
|
-
);
|
|
1542
|
-
}
|
|
1543
|
-
}
|
|
1544
|
-
};
|
|
1545
|
-
|
|
1546
|
-
/**
|
|
1547
|
-
* @license
|
|
1548
|
-
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
1549
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
1550
|
-
*/
|
|
1551
|
-
|
|
1552
|
-
/**
|
|
1553
|
-
* Returns true if the given node is an empty text node, false otherwise.
|
|
1554
|
-
*
|
|
1555
|
-
* @param {Node} node
|
|
1556
|
-
* @return {boolean}
|
|
1557
|
-
*/
|
|
1558
|
-
function isEmptyTextNode(node) {
|
|
1559
|
-
return node.nodeType === Node.TEXT_NODE && node.textContent.trim() === '';
|
|
1560
|
-
}
|
|
1561
|
-
|
|
1562
|
-
/**
|
|
1563
|
-
* @license
|
|
1564
|
-
* Copyright (c) 2023 Vaadin Ltd.
|
|
1565
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
1566
|
-
*/
|
|
1567
|
-
|
|
1568
|
-
/**
|
|
1569
|
-
* A helper for observing slot changes.
|
|
1570
|
-
*/
|
|
1571
|
-
class SlotObserver {
|
|
1572
|
-
constructor(slot, callback) {
|
|
1573
|
-
/** @type HTMLSlotElement */
|
|
1574
|
-
this.slot = slot;
|
|
1575
|
-
|
|
1576
|
-
/** @type Function */
|
|
1577
|
-
this.callback = callback;
|
|
1578
|
-
|
|
1579
|
-
/** @type {Node[]} */
|
|
1580
|
-
this._storedNodes = [];
|
|
1581
|
-
|
|
1582
|
-
this._connected = false;
|
|
1583
|
-
this._scheduled = false;
|
|
1584
|
-
|
|
1585
|
-
this._boundSchedule = () => {
|
|
1586
|
-
this._schedule();
|
|
1587
|
-
};
|
|
1588
|
-
|
|
1589
|
-
this.connect();
|
|
1590
|
-
this._schedule();
|
|
4
|
+
const button = i`
|
|
5
|
+
:host {
|
|
6
|
+
/* Sizing */
|
|
7
|
+
--lumo-button-size: var(--lumo-size-m);
|
|
8
|
+
min-width: calc(var(--lumo-button-size) * 2);
|
|
9
|
+
height: var(--lumo-button-size);
|
|
10
|
+
padding: 0 calc(var(--lumo-button-size) / 3 + var(--lumo-border-radius-m) / 2);
|
|
11
|
+
margin: var(--lumo-space-xs) 0;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
/* Style */
|
|
14
|
+
font-family: var(--lumo-font-family);
|
|
15
|
+
font-size: var(--lumo-font-size-m);
|
|
16
|
+
font-weight: 500;
|
|
17
|
+
color: var(--_lumo-button-color, var(--lumo-primary-text-color));
|
|
18
|
+
background-color: var(--_lumo-button-background-color, var(--lumo-contrast-5pct));
|
|
19
|
+
border-radius: var(--lumo-border-radius-m);
|
|
20
|
+
cursor: var(--lumo-clickable-cursor);
|
|
21
|
+
-webkit-tap-highlight-color: transparent;
|
|
22
|
+
-webkit-font-smoothing: antialiased;
|
|
23
|
+
-moz-osx-font-smoothing: grayscale;
|
|
24
|
+
flex-shrink: 0;
|
|
1591
25
|
}
|
|
1592
26
|
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
connect() {
|
|
1599
|
-
this.slot.addEventListener('slotchange', this._boundSchedule);
|
|
1600
|
-
this._connected = true;
|
|
27
|
+
/* Set only for the internal parts so we don't affect the host vertical alignment */
|
|
28
|
+
[part='label'],
|
|
29
|
+
[part='prefix'],
|
|
30
|
+
[part='suffix'] {
|
|
31
|
+
line-height: var(--lumo-line-height-xs);
|
|
1601
32
|
}
|
|
1602
33
|
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
* will not be called when changes to slotted nodes occur. The `connect` method
|
|
1606
|
-
* may be subsequently called to reactivate the observer.
|
|
1607
|
-
*/
|
|
1608
|
-
disconnect() {
|
|
1609
|
-
this.slot.removeEventListener('slotchange', this._boundSchedule);
|
|
1610
|
-
this._connected = false;
|
|
34
|
+
[part='label'] {
|
|
35
|
+
padding: calc(var(--lumo-button-size) / 6) 0;
|
|
1611
36
|
}
|
|
1612
37
|
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
this._scheduled = true;
|
|
1617
|
-
|
|
1618
|
-
queueMicrotask(() => {
|
|
1619
|
-
this.flush();
|
|
1620
|
-
});
|
|
1621
|
-
}
|
|
38
|
+
:host([theme~='small']) {
|
|
39
|
+
font-size: var(--lumo-font-size-s);
|
|
40
|
+
--lumo-button-size: var(--lumo-size-s);
|
|
1622
41
|
}
|
|
1623
42
|
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
flush() {
|
|
1628
|
-
if (!this._connected) {
|
|
1629
|
-
return;
|
|
1630
|
-
}
|
|
1631
|
-
|
|
1632
|
-
this._scheduled = false;
|
|
1633
|
-
|
|
1634
|
-
this._processNodes();
|
|
43
|
+
:host([theme~='large']) {
|
|
44
|
+
font-size: var(--lumo-font-size-l);
|
|
45
|
+
--lumo-button-size: var(--lumo-size-l);
|
|
1635
46
|
}
|
|
1636
47
|
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
48
|
+
/* For interaction states */
|
|
49
|
+
:host::before,
|
|
50
|
+
:host::after {
|
|
51
|
+
content: '';
|
|
52
|
+
/* We rely on the host always being relative */
|
|
53
|
+
position: absolute;
|
|
54
|
+
z-index: 1;
|
|
55
|
+
inset: 0;
|
|
56
|
+
background-color: currentColor;
|
|
57
|
+
border-radius: inherit;
|
|
58
|
+
opacity: 0;
|
|
59
|
+
pointer-events: none;
|
|
60
|
+
}
|
|
1648
61
|
|
|
1649
|
-
|
|
1650
|
-
this._storedNodes.forEach((node, index) => {
|
|
1651
|
-
const idx = currentNodes.indexOf(node);
|
|
1652
|
-
if (idx === -1) {
|
|
1653
|
-
removedNodes.push(node);
|
|
1654
|
-
} else if (idx !== index) {
|
|
1655
|
-
movedNodes.push(node);
|
|
1656
|
-
}
|
|
1657
|
-
});
|
|
1658
|
-
}
|
|
62
|
+
/* Hover */
|
|
1659
63
|
|
|
1660
|
-
|
|
1661
|
-
|
|
64
|
+
@media (any-hover: hover) {
|
|
65
|
+
:host(:hover)::before {
|
|
66
|
+
opacity: 0.02;
|
|
1662
67
|
}
|
|
1663
|
-
|
|
1664
|
-
this._storedNodes = currentNodes;
|
|
1665
68
|
}
|
|
1666
|
-
}
|
|
1667
|
-
|
|
1668
|
-
/**
|
|
1669
|
-
* @license
|
|
1670
|
-
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
1671
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
1672
|
-
*/
|
|
1673
|
-
|
|
1674
|
-
let uniqueId = 0;
|
|
1675
|
-
|
|
1676
|
-
/**
|
|
1677
|
-
* Returns a unique integer id.
|
|
1678
|
-
*
|
|
1679
|
-
* @return {number}
|
|
1680
|
-
*/
|
|
1681
|
-
function generateUniqueId() {
|
|
1682
|
-
// eslint-disable-next-line no-plusplus
|
|
1683
|
-
return uniqueId++;
|
|
1684
|
-
}
|
|
1685
69
|
|
|
1686
|
-
|
|
1687
|
-
* @license
|
|
1688
|
-
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
1689
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
1690
|
-
*/
|
|
70
|
+
/* Active */
|
|
1691
71
|
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
class SlotController extends EventTarget {
|
|
1696
|
-
/**
|
|
1697
|
-
* Ensure that every instance has unique ID.
|
|
1698
|
-
*
|
|
1699
|
-
* @param {HTMLElement} host
|
|
1700
|
-
* @param {string} slotName
|
|
1701
|
-
* @return {string}
|
|
1702
|
-
* @protected
|
|
1703
|
-
*/
|
|
1704
|
-
static generateId(host, slotName) {
|
|
1705
|
-
const prefix = slotName || 'default';
|
|
1706
|
-
return `${prefix}-${host.localName}-${generateUniqueId()}`;
|
|
72
|
+
:host::after {
|
|
73
|
+
transition: opacity 1.4s, transform 0.1s;
|
|
74
|
+
filter: blur(8px);
|
|
1707
75
|
}
|
|
1708
76
|
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
77
|
+
:host([active])::before {
|
|
78
|
+
opacity: 0.05;
|
|
79
|
+
transition-duration: 0s;
|
|
80
|
+
}
|
|
1713
81
|
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
this.slotInitializer = initializer;
|
|
82
|
+
:host([active])::after {
|
|
83
|
+
opacity: 0.1;
|
|
84
|
+
transition-duration: 0s, 0s;
|
|
85
|
+
transform: scale(0);
|
|
86
|
+
}
|
|
1720
87
|
|
|
1721
|
-
|
|
1722
|
-
this.nodes = [];
|
|
1723
|
-
}
|
|
88
|
+
/* Keyboard focus */
|
|
1724
89
|
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
this.defaultId = this.constructor.generateId(host, slotName);
|
|
1728
|
-
}
|
|
90
|
+
:host([focus-ring]) {
|
|
91
|
+
box-shadow: 0 0 0 2px var(--lumo-primary-color-50pct);
|
|
1729
92
|
}
|
|
1730
93
|
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
this.initMultiple();
|
|
1735
|
-
} else {
|
|
1736
|
-
this.initSingle();
|
|
1737
|
-
}
|
|
94
|
+
:host([theme~='primary'][focus-ring]) {
|
|
95
|
+
box-shadow: 0 0 0 1px var(--lumo-base-color), 0 0 0 3px var(--lumo-primary-color-50pct);
|
|
96
|
+
}
|
|
1738
97
|
|
|
1739
|
-
|
|
1740
|
-
this.observeSlot();
|
|
1741
|
-
}
|
|
98
|
+
/* Types (primary, tertiary, tertiary-inline */
|
|
1742
99
|
|
|
1743
|
-
|
|
1744
|
-
|
|
100
|
+
:host([theme~='tertiary']),
|
|
101
|
+
:host([theme~='tertiary-inline']) {
|
|
102
|
+
background-color: transparent !important;
|
|
103
|
+
min-width: 0;
|
|
1745
104
|
}
|
|
1746
105
|
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
let node = this.getSlotChild();
|
|
1750
|
-
|
|
1751
|
-
if (!node) {
|
|
1752
|
-
node = this.attachDefaultNode();
|
|
1753
|
-
this.initNode(node);
|
|
1754
|
-
} else {
|
|
1755
|
-
this.node = node;
|
|
1756
|
-
this.initAddedNode(node);
|
|
1757
|
-
}
|
|
106
|
+
:host([theme~='tertiary']) {
|
|
107
|
+
padding: 0 calc(var(--lumo-button-size) / 6);
|
|
1758
108
|
}
|
|
1759
109
|
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
const children = this.getSlotChildren();
|
|
1763
|
-
|
|
1764
|
-
if (children.length === 0) {
|
|
1765
|
-
const defaultNode = this.attachDefaultNode();
|
|
1766
|
-
if (defaultNode) {
|
|
1767
|
-
this.nodes = [defaultNode];
|
|
1768
|
-
this.initNode(defaultNode);
|
|
1769
|
-
}
|
|
1770
|
-
} else {
|
|
1771
|
-
this.nodes = children;
|
|
1772
|
-
children.forEach((node) => {
|
|
1773
|
-
this.initAddedNode(node);
|
|
1774
|
-
});
|
|
1775
|
-
}
|
|
110
|
+
:host([theme~='tertiary-inline'])::before {
|
|
111
|
+
display: none;
|
|
1776
112
|
}
|
|
1777
113
|
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
const { host, slotName, tagName } = this;
|
|
1785
|
-
|
|
1786
|
-
// Check if the node was created previously and if so, reuse it.
|
|
1787
|
-
let node = this.defaultNode;
|
|
1788
|
-
|
|
1789
|
-
// Tag name is optional, sometimes we don't init default content.
|
|
1790
|
-
if (!node && tagName) {
|
|
1791
|
-
node = document.createElement(tagName);
|
|
1792
|
-
if (node instanceof Element) {
|
|
1793
|
-
if (slotName !== '') {
|
|
1794
|
-
node.setAttribute('slot', slotName);
|
|
1795
|
-
}
|
|
1796
|
-
this.node = node;
|
|
1797
|
-
this.defaultNode = node;
|
|
1798
|
-
}
|
|
1799
|
-
}
|
|
1800
|
-
|
|
1801
|
-
if (node) {
|
|
1802
|
-
host.appendChild(node);
|
|
1803
|
-
}
|
|
1804
|
-
|
|
1805
|
-
return node;
|
|
114
|
+
:host([theme~='tertiary-inline']) {
|
|
115
|
+
margin: 0;
|
|
116
|
+
height: auto;
|
|
117
|
+
padding: 0;
|
|
118
|
+
line-height: inherit;
|
|
119
|
+
font-size: inherit;
|
|
1806
120
|
}
|
|
1807
121
|
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
getSlotChildren() {
|
|
1813
|
-
const { slotName } = this;
|
|
1814
|
-
return Array.from(this.host.childNodes).filter((node) => {
|
|
1815
|
-
// Either an element (any slot) or a text node (only un-named slot).
|
|
1816
|
-
return (
|
|
1817
|
-
(node.nodeType === Node.ELEMENT_NODE && node.slot === slotName) ||
|
|
1818
|
-
(node.nodeType === Node.TEXT_NODE && node.textContent.trim() && slotName === '')
|
|
1819
|
-
);
|
|
1820
|
-
});
|
|
122
|
+
:host([theme~='tertiary-inline']) [part='label'] {
|
|
123
|
+
padding: 0;
|
|
124
|
+
overflow: visible;
|
|
125
|
+
line-height: inherit;
|
|
1821
126
|
}
|
|
1822
127
|
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
return this.getSlotChildren()[0];
|
|
128
|
+
:host([theme~='primary']) {
|
|
129
|
+
background-color: var(--_lumo-button-primary-background-color, var(--lumo-primary-color));
|
|
130
|
+
color: var(--_lumo-button-primary-color, var(--lumo-primary-contrast-color));
|
|
131
|
+
font-weight: 600;
|
|
132
|
+
min-width: calc(var(--lumo-button-size) * 2.5);
|
|
1829
133
|
}
|
|
1830
134
|
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
*
|
|
1834
|
-
* @param {Node} node
|
|
1835
|
-
* @protected
|
|
1836
|
-
*/
|
|
1837
|
-
initNode(node) {
|
|
1838
|
-
const { slotInitializer } = this;
|
|
1839
|
-
// Don't try to bind `this` to initializer (normally it's arrow function).
|
|
1840
|
-
// Instead, pass the host as a first argument to access component's state.
|
|
1841
|
-
if (slotInitializer) {
|
|
1842
|
-
slotInitializer(node, this.host);
|
|
1843
|
-
}
|
|
135
|
+
:host([theme~='primary'])::before {
|
|
136
|
+
background-color: black;
|
|
1844
137
|
}
|
|
1845
138
|
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
* @param {Node} _node
|
|
1850
|
-
* @protected
|
|
1851
|
-
*/
|
|
1852
|
-
initCustomNode(_node) {}
|
|
1853
|
-
|
|
1854
|
-
/**
|
|
1855
|
-
* Override to teardown slotted node when it's removed.
|
|
1856
|
-
*
|
|
1857
|
-
* @param {Node} _node
|
|
1858
|
-
* @protected
|
|
1859
|
-
*/
|
|
1860
|
-
teardownNode(_node) {}
|
|
1861
|
-
|
|
1862
|
-
/**
|
|
1863
|
-
* Run both `initCustomNode` and `initNode` for a custom slotted node.
|
|
1864
|
-
*
|
|
1865
|
-
* @param {Node} node
|
|
1866
|
-
* @protected
|
|
1867
|
-
*/
|
|
1868
|
-
initAddedNode(node) {
|
|
1869
|
-
if (node !== this.defaultNode) {
|
|
1870
|
-
this.initCustomNode(node);
|
|
1871
|
-
this.initNode(node);
|
|
139
|
+
@media (any-hover: hover) {
|
|
140
|
+
:host([theme~='primary']:hover)::before {
|
|
141
|
+
opacity: 0.05;
|
|
1872
142
|
}
|
|
1873
143
|
}
|
|
1874
144
|
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
*/
|
|
1879
|
-
observeSlot() {
|
|
1880
|
-
const { slotName } = this;
|
|
1881
|
-
const selector = slotName === '' ? 'slot:not([name])' : `slot[name=${slotName}]`;
|
|
1882
|
-
const slot = this.host.shadowRoot.querySelector(selector);
|
|
1883
|
-
|
|
1884
|
-
this.__slotObserver = new SlotObserver(slot, ({ addedNodes, removedNodes }) => {
|
|
1885
|
-
const current = this.multiple ? this.nodes : [this.node];
|
|
145
|
+
:host([theme~='primary'][active])::before {
|
|
146
|
+
opacity: 0.1;
|
|
147
|
+
}
|
|
1886
148
|
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
149
|
+
:host([theme~='primary'][active])::after {
|
|
150
|
+
opacity: 0.2;
|
|
151
|
+
}
|
|
1890
152
|
|
|
1891
|
-
|
|
1892
|
-
this.nodes = current.filter((node) => !removedNodes.includes(node));
|
|
153
|
+
/* Colors (success, error, contrast) */
|
|
1893
154
|
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
}
|
|
155
|
+
:host([theme~='success']) {
|
|
156
|
+
color: var(--lumo-success-text-color);
|
|
157
|
+
}
|
|
1898
158
|
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
if (this.defaultNode) {
|
|
1903
|
-
this.defaultNode.remove();
|
|
1904
|
-
}
|
|
1905
|
-
this.nodes = [...current, ...newNodes].filter((node) => node !== this.defaultNode);
|
|
1906
|
-
newNodes.forEach((node) => {
|
|
1907
|
-
this.initAddedNode(node);
|
|
1908
|
-
});
|
|
1909
|
-
} else {
|
|
1910
|
-
// Remove previous node if exists
|
|
1911
|
-
if (this.node) {
|
|
1912
|
-
this.node.remove();
|
|
1913
|
-
}
|
|
1914
|
-
this.node = newNodes[0];
|
|
1915
|
-
this.initAddedNode(this.node);
|
|
1916
|
-
}
|
|
1917
|
-
}
|
|
1918
|
-
});
|
|
159
|
+
:host([theme~='success'][theme~='primary']) {
|
|
160
|
+
background-color: var(--lumo-success-color);
|
|
161
|
+
color: var(--lumo-success-contrast-color);
|
|
1919
162
|
}
|
|
1920
|
-
}
|
|
1921
163
|
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
1926
|
-
*/
|
|
164
|
+
:host([theme~='error']) {
|
|
165
|
+
color: var(--lumo-error-text-color);
|
|
166
|
+
}
|
|
1927
167
|
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
constructor(host) {
|
|
1933
|
-
// Do not provide slot factory to create tooltip lazily.
|
|
1934
|
-
super(host, 'tooltip');
|
|
168
|
+
:host([theme~='error'][theme~='primary']) {
|
|
169
|
+
background-color: var(--lumo-error-color);
|
|
170
|
+
color: var(--lumo-error-contrast-color);
|
|
171
|
+
}
|
|
1935
172
|
|
|
1936
|
-
|
|
173
|
+
:host([theme~='contrast']) {
|
|
174
|
+
color: var(--lumo-contrast);
|
|
1937
175
|
}
|
|
1938
176
|
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
* @protected
|
|
1944
|
-
* @override
|
|
1945
|
-
*/
|
|
1946
|
-
initCustomNode(tooltipNode) {
|
|
1947
|
-
tooltipNode.target = this.target;
|
|
1948
|
-
|
|
1949
|
-
if (this.ariaTarget !== undefined) {
|
|
1950
|
-
tooltipNode.ariaTarget = this.ariaTarget;
|
|
1951
|
-
}
|
|
177
|
+
:host([theme~='contrast'][theme~='primary']) {
|
|
178
|
+
background-color: var(--lumo-contrast);
|
|
179
|
+
color: var(--lumo-base-color);
|
|
180
|
+
}
|
|
1952
181
|
|
|
1953
|
-
|
|
1954
|
-
tooltipNode.context = this.context;
|
|
1955
|
-
}
|
|
182
|
+
/* Disabled state. Keep selectors after other color variants. */
|
|
1956
183
|
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
184
|
+
:host([disabled]) {
|
|
185
|
+
pointer-events: none;
|
|
186
|
+
color: var(--lumo-disabled-text-color);
|
|
187
|
+
}
|
|
1960
188
|
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
189
|
+
:host([theme~='primary'][disabled]) {
|
|
190
|
+
background-color: var(--lumo-contrast-30pct);
|
|
191
|
+
color: var(--lumo-base-color);
|
|
192
|
+
}
|
|
1964
193
|
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
194
|
+
:host([theme~='primary'][disabled]) [part] {
|
|
195
|
+
opacity: 0.7;
|
|
196
|
+
}
|
|
1968
197
|
|
|
1969
|
-
|
|
1970
|
-
tooltipNode.shouldShow = this.shouldShow;
|
|
1971
|
-
}
|
|
198
|
+
/* Icons */
|
|
1972
199
|
|
|
1973
|
-
|
|
200
|
+
[part] ::slotted(vaadin-icon) {
|
|
201
|
+
display: inline-block;
|
|
202
|
+
width: var(--lumo-icon-size-m);
|
|
203
|
+
height: var(--lumo-icon-size-m);
|
|
1974
204
|
}
|
|
1975
205
|
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
* @protected
|
|
1981
|
-
* @override
|
|
1982
|
-
*/
|
|
1983
|
-
teardownNode() {
|
|
1984
|
-
this.__notifyChange();
|
|
206
|
+
/* Vaadin icons are based on a 16x16 grid (unlike Lumo and Material icons with 24x24), so they look too big by default */
|
|
207
|
+
[part] ::slotted(vaadin-icon[icon^='vaadin:']) {
|
|
208
|
+
padding: 0.25em;
|
|
209
|
+
box-sizing: border-box !important;
|
|
1985
210
|
}
|
|
1986
211
|
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
* @param {HTMLElement} ariaTarget
|
|
1991
|
-
*/
|
|
1992
|
-
setAriaTarget(ariaTarget) {
|
|
1993
|
-
this.ariaTarget = ariaTarget;
|
|
1994
|
-
|
|
1995
|
-
const tooltipNode = this.node;
|
|
1996
|
-
if (tooltipNode) {
|
|
1997
|
-
tooltipNode.ariaTarget = ariaTarget;
|
|
1998
|
-
}
|
|
212
|
+
[part='prefix'] {
|
|
213
|
+
margin-left: -0.25em;
|
|
214
|
+
margin-right: 0.25em;
|
|
1999
215
|
}
|
|
2000
216
|
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
*/
|
|
2005
|
-
setContext(context) {
|
|
2006
|
-
this.context = context;
|
|
2007
|
-
|
|
2008
|
-
const tooltipNode = this.node;
|
|
2009
|
-
if (tooltipNode) {
|
|
2010
|
-
tooltipNode.context = context;
|
|
2011
|
-
}
|
|
217
|
+
[part='suffix'] {
|
|
218
|
+
margin-left: 0.25em;
|
|
219
|
+
margin-right: -0.25em;
|
|
2012
220
|
}
|
|
2013
221
|
|
|
2014
|
-
|
|
2015
|
-
* Toggle manual state on the slotted tooltip.
|
|
2016
|
-
* @param {boolean} manual
|
|
2017
|
-
*/
|
|
2018
|
-
setManual(manual) {
|
|
2019
|
-
this.manual = manual;
|
|
222
|
+
/* Icon-only */
|
|
2020
223
|
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
224
|
+
:host([theme~='icon']:not([theme~='tertiary-inline'])) {
|
|
225
|
+
min-width: var(--lumo-button-size);
|
|
226
|
+
padding-left: calc(var(--lumo-button-size) / 4);
|
|
227
|
+
padding-right: calc(var(--lumo-button-size) / 4);
|
|
2025
228
|
}
|
|
2026
229
|
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
setOpened(opened) {
|
|
2032
|
-
this.opened = opened;
|
|
2033
|
-
|
|
2034
|
-
const tooltipNode = this.node;
|
|
2035
|
-
if (tooltipNode) {
|
|
2036
|
-
tooltipNode.opened = opened;
|
|
2037
|
-
}
|
|
230
|
+
:host([theme~='icon']) [part='prefix'],
|
|
231
|
+
:host([theme~='icon']) [part='suffix'] {
|
|
232
|
+
margin-left: 0;
|
|
233
|
+
margin-right: 0;
|
|
2038
234
|
}
|
|
2039
235
|
|
|
2040
|
-
|
|
2041
|
-
* Set default position for the slotted tooltip.
|
|
2042
|
-
* This can be overridden by setting the position
|
|
2043
|
-
* using corresponding property or attribute.
|
|
2044
|
-
* @param {string} position
|
|
2045
|
-
*/
|
|
2046
|
-
setPosition(position) {
|
|
2047
|
-
this.position = position;
|
|
2048
|
-
|
|
2049
|
-
const tooltipNode = this.node;
|
|
2050
|
-
if (tooltipNode) {
|
|
2051
|
-
tooltipNode._position = position;
|
|
2052
|
-
}
|
|
2053
|
-
}
|
|
236
|
+
/* RTL specific styles */
|
|
2054
237
|
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
* @param {Function} shouldShow
|
|
2059
|
-
*/
|
|
2060
|
-
setShouldShow(shouldShow) {
|
|
2061
|
-
this.shouldShow = shouldShow;
|
|
2062
|
-
|
|
2063
|
-
const tooltipNode = this.node;
|
|
2064
|
-
if (tooltipNode) {
|
|
2065
|
-
tooltipNode.shouldShow = shouldShow;
|
|
2066
|
-
}
|
|
238
|
+
:host([dir='rtl']) [part='prefix'] {
|
|
239
|
+
margin-left: 0.25em;
|
|
240
|
+
margin-right: -0.25em;
|
|
2067
241
|
}
|
|
2068
242
|
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
*/
|
|
2073
|
-
setTarget(target) {
|
|
2074
|
-
this.target = target;
|
|
2075
|
-
|
|
2076
|
-
const tooltipNode = this.node;
|
|
2077
|
-
if (tooltipNode) {
|
|
2078
|
-
tooltipNode.target = target;
|
|
2079
|
-
}
|
|
243
|
+
:host([dir='rtl']) [part='suffix'] {
|
|
244
|
+
margin-left: -0.25em;
|
|
245
|
+
margin-right: 0.25em;
|
|
2080
246
|
}
|
|
2081
247
|
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
248
|
+
:host([dir='rtl'][theme~='icon']) [part='prefix'],
|
|
249
|
+
:host([dir='rtl'][theme~='icon']) [part='suffix'] {
|
|
250
|
+
margin-left: 0;
|
|
251
|
+
margin-right: 0;
|
|
2085
252
|
}
|
|
2086
|
-
|
|
253
|
+
`;
|
|
254
|
+
|
|
255
|
+
registerStyles('vaadin-button', button, { moduleId: 'lumo-button' });
|
|
2087
256
|
|
|
2088
257
|
/**
|
|
2089
258
|
* @license
|