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