@redvars/peacock 3.2.0 → 3.2.1

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.
Files changed (59) hide show
  1. package/dist/custom-elements-jsdocs.json +586 -586
  2. package/dist/custom-elements.json +4745 -4726
  3. package/dist/field.js.map +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/peacock-loader.js +3 -3
  6. package/dist/peacock-loader.js.map +1 -1
  7. package/dist/src/date-picker/date-picker.d.ts +50 -0
  8. package/dist/src/date-picker/index.d.ts +1 -0
  9. package/dist/src/field/field.d.ts +30 -0
  10. package/dist/src/field/index.d.ts +1 -0
  11. package/dist/src/index.d.ts +7 -1
  12. package/dist/src/input/index.d.ts +1 -7
  13. package/dist/src/input/input.d.ts +51 -0
  14. package/dist/src/number-field/index.d.ts +1 -0
  15. package/dist/src/number-field/number-field.d.ts +55 -0
  16. package/dist/src/switch/index.d.ts +1 -0
  17. package/dist/src/switch/switch.d.ts +89 -0
  18. package/dist/src/textarea/index.d.ts +1 -0
  19. package/dist/src/textarea/textarea.d.ts +51 -0
  20. package/dist/src/time-picker/index.d.ts +1 -0
  21. package/dist/src/time-picker/time-picker.d.ts +50 -0
  22. package/dist/switch-B3NU_cKN.js +2737 -0
  23. package/dist/switch-B3NU_cKN.js.map +1 -0
  24. package/dist/switch-BCbVyXJW.js +2736 -0
  25. package/dist/switch-BCbVyXJW.js.map +1 -0
  26. package/dist/switch-C7A-AMS6.js +2737 -0
  27. package/dist/switch-C7A-AMS6.js.map +1 -0
  28. package/dist/switch-Cqzu1Bd4.js +2737 -0
  29. package/dist/switch-Cqzu1Bd4.js.map +1 -0
  30. package/dist/switch-K9zwiDEK.js +2736 -0
  31. package/dist/switch-K9zwiDEK.js.map +1 -0
  32. package/dist/tsconfig.tsbuildinfo +1 -1
  33. package/dist/typedoc.json +10361 -10361
  34. package/package.json +1 -1
  35. package/readme.md +51 -50
  36. package/src/{input/date-picker → date-picker}/date-picker.scss +1 -1
  37. package/src/{input/date-picker → date-picker}/date-picker.ts +3 -3
  38. package/src/date-picker/index.ts +1 -0
  39. package/src/{input/field → field}/field.scss +1 -1
  40. package/src/{input/field → field}/field.ts +1 -1
  41. package/src/field/index.ts +1 -0
  42. package/src/index.ts +7 -9
  43. package/src/input/index.ts +1 -7
  44. package/src/input/{input/input.scss → input.scss} +1 -1
  45. package/src/input/{input/input.ts → input.ts} +3 -3
  46. package/src/number-field/index.ts +1 -0
  47. package/src/{input/number/number.scss → number-field/number-field.scss} +1 -1
  48. package/src/{input/number → number-field}/number-field.ts +4 -4
  49. package/src/peacock-loader.ts +9 -9
  50. package/src/switch/index.ts +1 -0
  51. package/src/{input/toggle/toggle.scss → switch/switch.scss} +23 -23
  52. package/src/{input/toggle/toggle.ts → switch/switch.ts} +19 -21
  53. package/src/textarea/index.ts +1 -0
  54. package/src/{input/textarea → textarea}/textarea.scss +1 -1
  55. package/src/{input/textarea → textarea}/textarea.ts +3 -3
  56. package/src/time-picker/index.ts +1 -0
  57. package/src/{input/time-picker → time-picker}/time-picker.scss +1 -1
  58. package/src/{input/time-picker → time-picker}/time-picker.ts +3 -3
  59. package/src/input/toggle/index.ts +0 -1
@@ -0,0 +1,2736 @@
1
+ import { _ as __decorate, n, a as __classPrivateFieldGet } from './property-DNVWDdPC.js';
2
+ import { i, b, A } from './lit-element-CA46RFZ_.js';
3
+ import { r } from './state-CV1fRmOT.js';
4
+ import { e } from './class-map-BmCohX9p.js';
5
+ import { throttle, observerSlotChangesWithCallback, redispatchEvent } from './utils.js';
6
+ import { s as spread } from './spread-axRTFMoH.js';
7
+ import { BaseButton } from './BaseButton.js';
8
+ import { o } from './style-map-CdmclYgz.js';
9
+ import { BaseProgress } from './base-progress.js';
10
+ import { e as e$1 } from './query-QBcUV-L_.js';
11
+ import BaseInput from './BaseInput.js';
12
+
13
+ var css_248z$b = i`* {
14
+ box-sizing: border-box;
15
+ }
16
+
17
+ .screen-reader-only {
18
+ display: none !important;
19
+ }
20
+
21
+ :host {
22
+ display: inline-flex;
23
+ --z-index-button: 0;
24
+ --button-height: unset;
25
+ --button-icon-size: unset;
26
+ --button-container-shape: unset;
27
+ --button-container-shape-start-start: unset;
28
+ --button-container-shape-start-end: unset;
29
+ --button-container-shape-end-start: unset;
30
+ --button-container-shape-end-end: unset;
31
+ --button-container-shape-variant: unset;
32
+ }
33
+
34
+ /**
35
+ * Private CSS Variables
36
+ * These variables are used internally within the button component
37
+ */
38
+ slot::slotted(*) {
39
+ --icon-size: var(--button-icon-size, var(--_button-icon-size));
40
+ --icon-color: var(--_input-text-color);
41
+ }
42
+
43
+ /*
44
+ * Reset native button/link styles
45
+ */
46
+ .button.button-element {
47
+ background: transparent;
48
+ border: none;
49
+ appearance: none;
50
+ margin: 0;
51
+ outline: none;
52
+ text-decoration: none;
53
+ }
54
+
55
+ .button {
56
+ position: relative;
57
+ display: inline-flex;
58
+ flex-direction: column;
59
+ align-items: center;
60
+ justify-content: center;
61
+ height: var(--button-height, var(--_button-height));
62
+ padding: 0 var(--_container-padding);
63
+ width: 100%;
64
+ font-family: var(--font-family-sans) !important;
65
+ cursor: pointer;
66
+ --_container-shape-start-start: var(--button-container-shape-start-start, var(--button-container-shape, var(--shape-corner-medium)));
67
+ --_container-shape-start-end: var(--button-container-shape-start-end, var(--button-container-shape, var(--shape-corner-medium)));
68
+ --_container-shape-end-start: var(--button-container-shape-end-start, var(--button-container-shape, var(--shape-corner-medium)));
69
+ --_container-shape-end-end: var(--button-container-shape-end-end, var(--button-container-shape, var(--shape-corner-medium)));
70
+ --_container-corner-shape-variant: var(--button-container-shape-variant, squircle);
71
+ }
72
+ .button .button-content {
73
+ display: flex;
74
+ align-items: center;
75
+ justify-content: center;
76
+ gap: var(--_button-icon-label-spacing);
77
+ width: 100%;
78
+ z-index: 1;
79
+ color: var(--_input-text-color);
80
+ opacity: var(--_label-text-opacity, 1);
81
+ --icon-size: var(--button-icon-size, var(--_button-icon-size));
82
+ --icon-color: var(--_input-text-color);
83
+ }
84
+ .button .button-content .slot-container {
85
+ display: none;
86
+ }
87
+ .button.disabled {
88
+ cursor: not-allowed;
89
+ }
90
+ .button {
91
+ /*
92
+ Background layers
93
+ */
94
+ }
95
+ .button .focus-ring {
96
+ --focus-ring-container-shape-start-start: var(--_container-shape-start-start);
97
+ --focus-ring-container-shape-start-end: var(--_container-shape-start-end);
98
+ --focus-ring-container-shape-end-start: var(--_container-shape-end-start);
99
+ --focus-ring-container-shape-end-end: var(--_container-shape-end-end);
100
+ --focus-ring-container-shape-variant: var(--_container-corner-shape-variant);
101
+ }
102
+ .button .ripple {
103
+ border-start-start-radius: var(--_container-shape-start-start);
104
+ border-start-end-radius: var(--_container-shape-start-end);
105
+ border-end-start-radius: var(--_container-shape-end-start);
106
+ border-end-end-radius: var(--_container-shape-end-end);
107
+ corner-shape: var(--_container-corner-shape-variant);
108
+ }
109
+ .button .background {
110
+ display: block;
111
+ position: absolute;
112
+ left: 0;
113
+ width: 100%;
114
+ height: 100%;
115
+ background-color: var(--_container-color);
116
+ opacity: var(--_container-opacity, 1);
117
+ border-start-start-radius: var(--_container-shape-start-start);
118
+ border-start-end-radius: var(--_container-shape-start-end);
119
+ border-end-start-radius: var(--_container-shape-end-start);
120
+ border-end-end-radius: var(--_container-shape-end-end);
121
+ corner-shape: var(--_container-corner-shape-variant);
122
+ pointer-events: none;
123
+ }
124
+ .button .skeleton {
125
+ display: none;
126
+ width: 100%;
127
+ height: 100%;
128
+ z-index: 2;
129
+ position: absolute;
130
+ top: 0;
131
+ left: 0;
132
+ --skeleton-container-shape-start-start: var(--_container-shape-start-start);
133
+ --skeleton-container-shape-start-end: var(--_container-shape-start-end);
134
+ --skeleton-container-shape-end-start: var(--_container-shape-end-start);
135
+ --skeleton-container-shape-end-end: var(--_container-shape-end-end);
136
+ --skeleton-container-shape-variant: var(--_container-corner-shape-variant);
137
+ }
138
+ .button .ripple {
139
+ --ripple-state-opacity: var(--_container-state-opacity, 0);
140
+ --ripple-pressed-color: var(--_container-state-color);
141
+ }
142
+ .button .elevation {
143
+ --elevation-level: var(--_container-elevation-level);
144
+ transition-duration: 280ms;
145
+ --elevation-container-shape-start-start: var(--_container-shape-start-start);
146
+ --elevation-container-shape-start-end: var(--_container-shape-start-end);
147
+ --elevation-container-shape-end-start: var(--_container-shape-end-start);
148
+ --elevation-container-shape-end-end: var(--_container-shape-end-end);
149
+ --elevation-container-shape-variant: var(--_container-corner-shape-variant);
150
+ }
151
+ .button .neo-background {
152
+ display: none;
153
+ position: absolute;
154
+ background: var(--color-inverse-surface);
155
+ border-start-start-radius: var(--_container-shape-start-start);
156
+ border-start-end-radius: var(--_container-shape-start-end);
157
+ border-end-start-radius: var(--_container-shape-end-start);
158
+ border-end-end-radius: var(--_container-shape-end-end);
159
+ corner-shape: var(--_container-corner-shape-variant);
160
+ width: 100%;
161
+ height: 100%;
162
+ pointer-events: none;
163
+ transform: translateX(0.25rem) translateY(0.25rem);
164
+ }
165
+ .button .neo-background:before {
166
+ z-index: 0;
167
+ content: "";
168
+ position: absolute;
169
+ pointer-events: none;
170
+ border-start-start-radius: var(--_container-shape-start-start);
171
+ border-start-end-radius: var(--_container-shape-start-end);
172
+ border-end-start-radius: var(--_container-shape-end-start);
173
+ border-end-end-radius: var(--_container-shape-end-end);
174
+ corner-shape: var(--_container-corner-shape-variant);
175
+ width: 100%;
176
+ height: 100%;
177
+ background: white;
178
+ left: 0;
179
+ transform: translateX(-0.25rem) translateY(-0.25rem);
180
+ }
181
+ .button .outline {
182
+ z-index: 0;
183
+ display: none;
184
+ position: absolute;
185
+ left: 0;
186
+ width: 100%;
187
+ height: 100%;
188
+ pointer-events: none;
189
+ border: var(--_outline-width) solid var(--_outline-color);
190
+ opacity: var(--_outline-opacity, 1);
191
+ border-start-start-radius: var(--_container-shape-start-start);
192
+ border-start-end-radius: var(--_container-shape-start-end);
193
+ border-end-start-radius: var(--_container-shape-end-start);
194
+ border-end-end-radius: var(--_container-shape-end-end);
195
+ corner-shape: var(--_container-corner-shape-variant);
196
+ }
197
+ .button.has-content .slot-container {
198
+ display: flex;
199
+ flex: none;
200
+ justify-content: center;
201
+ }
202
+ .button.show-skeleton .background {
203
+ display: none;
204
+ }
205
+ .button.show-skeleton .neo-background {
206
+ display: none;
207
+ }
208
+ .button.show-skeleton .neo-background:before {
209
+ display: none;
210
+ }
211
+ .button.show-skeleton .ripple {
212
+ display: none;
213
+ }
214
+ .button.show-skeleton .skeleton {
215
+ display: block;
216
+ }
217
+
218
+ /**
219
+ * Button variant definitions
220
+ */
221
+ .button.variant-elevated {
222
+ --_container-color: var(--elevated-button-container-color);
223
+ --_input-text-color: var(--elevated-button-label-text-color);
224
+ --_container-elevation-level: 1;
225
+ --_container-state-color: var(--_input-text-color);
226
+ }
227
+ .button.variant-elevated:hover:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
228
+ --_container-elevation-level: 2;
229
+ --_container-state-opacity: 0.08;
230
+ }
231
+ .button.variant-elevated.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
232
+ --_container-elevation-level: 1;
233
+ --_container-state-opacity: 0.12;
234
+ }
235
+ .button.variant-elevated.disabled {
236
+ --_container-color: var(--color-on-surface);
237
+ --_container-opacity: 0.1;
238
+ --_input-text-color: var(--color-on-surface);
239
+ --_label-text-opacity: 0.38;
240
+ }
241
+ .button.variant-elevated.disabled .ripple {
242
+ display: none;
243
+ }
244
+
245
+ .button.variant-filled {
246
+ --_container-color: var(--filled-button-container-color);
247
+ --_input-text-color: var(--filled-button-label-text-color);
248
+ --_container-state-color: var(--_input-text-color);
249
+ }
250
+ .button.variant-filled:hover:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
251
+ --_container-elevation-level: 1;
252
+ --_container-state-opacity: 0.08;
253
+ }
254
+ .button.variant-filled.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
255
+ --_container-elevation-level: 0;
256
+ --_container-state-opacity: 0.1;
257
+ }
258
+ .button.variant-filled.disabled {
259
+ --_container-color: var(--color-on-surface);
260
+ --_container-opacity: 0.1;
261
+ --_input-text-color: var(--color-on-surface);
262
+ --_label-text-opacity: 0.38;
263
+ }
264
+ .button.variant-filled.disabled .ripple {
265
+ display: none;
266
+ }
267
+
268
+ .button.variant-tonal {
269
+ --_container-color: var(--tonal-button-container-color);
270
+ --_input-text-color: var(--tonal-button-label-text-color);
271
+ --_container-state-color: var(--_input-text-color);
272
+ }
273
+ .button.variant-tonal:hover:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
274
+ --_container-elevation-level: 1;
275
+ --_container-state-opacity: 0.08;
276
+ }
277
+ .button.variant-tonal.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
278
+ --_container-elevation-level: 0;
279
+ --_container-state-opacity: 0.12;
280
+ }
281
+ .button.variant-tonal.disabled {
282
+ --_container-color: var(--color-on-surface);
283
+ --_container-opacity: 0.1;
284
+ --_input-text-color: var(--color-on-surface);
285
+ --_label-text-opacity: 0.38;
286
+ }
287
+ .button.variant-tonal.disabled .ripple {
288
+ display: none;
289
+ }
290
+
291
+ .button.variant-outlined {
292
+ --_outline-width: var(--outlined-button-outline-width, 0.0675rem);
293
+ --_outline-color: var(--outlined-button-outline-color);
294
+ --_input-text-color: var(--outlined-button-label-text-color);
295
+ --_container-state-color: var(--_input-text-color);
296
+ }
297
+ .button.variant-outlined .outline {
298
+ display: block;
299
+ }
300
+ .button.variant-outlined:hover:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
301
+ --_container-state-opacity: 0.08;
302
+ }
303
+ .button.variant-outlined.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
304
+ --_container-state-opacity: 0.12;
305
+ }
306
+ .button.variant-outlined.disabled {
307
+ --_outline-color: var(--color-on-surface);
308
+ --_input-text-color: var(--color-on-surface);
309
+ --_label-text-opacity: 0.38;
310
+ --_outline-opacity: 0.12;
311
+ }
312
+ .button.variant-outlined.disabled .ripple {
313
+ display: none;
314
+ }
315
+
316
+ .button.variant-text {
317
+ --_input-text-color: var(--text-button-label-text-color);
318
+ --_container-state-color: var(--_input-text-color);
319
+ }
320
+ .button.variant-text:hover:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
321
+ --_container-state-opacity: 0.08;
322
+ }
323
+ .button.variant-text.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
324
+ --_container-state-opacity: 0.12;
325
+ }
326
+ .button.variant-text.disabled {
327
+ --_input-text-color: var(--color-on-surface);
328
+ --_label-text-opacity: 0.38;
329
+ }
330
+ .button.variant-text.disabled .ripple {
331
+ display: none;
332
+ }
333
+
334
+ .button.variant-neo {
335
+ --_container-color: var(--neo-button-container-color);
336
+ --_input-text-color: var(--neo-button-label-text-color);
337
+ --_outline-width: var(--outlined-button-outline-width, 0.125rem);
338
+ --_outline-color: var(--color-inverse-surface);
339
+ }
340
+ .button.variant-neo .outline {
341
+ display: block;
342
+ }
343
+ .button.variant-neo .neo-background {
344
+ display: block;
345
+ }
346
+ .button.variant-neo .ripple {
347
+ display: none;
348
+ }
349
+ .button.variant-neo.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) .background, .button.variant-neo.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) .button-content, .button.variant-neo.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) .outline {
350
+ transform: translateX(0.25rem) translateY(0.25rem);
351
+ }
352
+ .button.variant-neo.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) .neo-background:before {
353
+ transform: translateX(0) translateY(0);
354
+ }
355
+ .button.variant-neo.disabled {
356
+ --_container-color: var(--color-on-surface);
357
+ --_container-opacity: 0.1;
358
+ --_input-text-color: var(--color-on-surface);
359
+ --_label-text-opacity: 0.38;
360
+ --_outline-opacity: 0.12;
361
+ }
362
+ .button.variant-neo.disabled .ripple {
363
+ display: none;
364
+ }
365
+
366
+ :host([block]) {
367
+ width: 100%;
368
+ }`;
369
+
370
+ var css_248z$a = i`:host([color=primary]) {
371
+ --filled-button-container-color: var(--color-primary);
372
+ --filled-button-label-text-color: var(--color-on-primary);
373
+ --tonal-button-container-color: var(--color-primary-container);
374
+ --tonal-button-label-text-color: var(--color-on-primary-container);
375
+ --elevated-button-container-color: var(--color-surface-container-low);
376
+ --elevated-button-label-text-color: var(--color-primary);
377
+ --outlined-button-outline-color: var(--color-primary);
378
+ --outlined-button-label-text-color: var(--color-primary);
379
+ --text-button-label-text-color: var(--color-primary);
380
+ --neo-button-container-color: var(--color-primary);
381
+ --neo-button-label-text-color: var(--color-on-primary);
382
+ }
383
+
384
+ :host([color=secondary]) {
385
+ --filled-button-container-color: var(--color-secondary);
386
+ --filled-button-label-text-color: var(--color-on-secondary);
387
+ --tonal-button-container-color: var(--color-secondary-container);
388
+ --tonal-button-label-text-color: var(--color-on-secondary-container);
389
+ --elevated-button-container-color: var(--color-surface-container-low);
390
+ --elevated-button-label-text-color: var(--color-secondary);
391
+ --outlined-button-outline-color: var(--color-secondary);
392
+ --outlined-button-label-text-color: var(--color-secondary);
393
+ --text-button-label-text-color: var(--color-secondary);
394
+ --neo-button-container-color: var(--color-secondary);
395
+ --neo-button-label-text-color: var(--color-on-secondary);
396
+ }
397
+
398
+ :host([color=tertiary]) {
399
+ --filled-button-container-color: var(--color-tertiary);
400
+ --filled-button-label-text-color: var(--color-on-tertiary);
401
+ --tonal-button-container-color: var(--color-tertiary-container);
402
+ --tonal-button-label-text-color: var(--color-on-tertiary-container);
403
+ --elevated-button-container-color: var(--color-surface-container-low);
404
+ --elevated-button-label-text-color: var(--color-tertiary);
405
+ --outlined-button-outline-color: var(--color-tertiary);
406
+ --outlined-button-label-text-color: var(--color-tertiary);
407
+ --text-button-label-text-color: var(--color-tertiary);
408
+ --neo-button-container-color: var(--color-tertiary);
409
+ --neo-button-label-text-color: var(--color-on-tertiary);
410
+ }
411
+
412
+ :host([color=success]) {
413
+ --filled-button-container-color: var(--color-success);
414
+ --filled-button-label-text-color: var(--color-on-success);
415
+ --tonal-button-container-color: var(--color-success-container);
416
+ --tonal-button-label-text-color: var(--color-on-success-container);
417
+ --elevated-button-container-color: var(--color-surface-container-low);
418
+ --elevated-button-label-text-color: var(--color-success);
419
+ --outlined-button-outline-color: var(--color-success);
420
+ --outlined-button-label-text-color: var(--color-success);
421
+ --text-button-label-text-color: var(--color-success);
422
+ --neo-button-container-color: var(--color-success);
423
+ --neo-button-label-text-color: var(--color-on-success);
424
+ }
425
+
426
+ :host([color=danger]) {
427
+ --filled-button-container-color: var(--color-error);
428
+ --filled-button-label-text-color: var(--color-on-error);
429
+ --tonal-button-container-color: var(--color-error-container);
430
+ --tonal-button-label-text-color: var(--color-on-error-container);
431
+ --elevated-button-container-color: var(--color-surface-container-low);
432
+ --elevated-button-label-text-color: var(--color-error);
433
+ --outlined-button-outline-color: var(--color-error);
434
+ --outlined-button-label-text-color: var(--color-error);
435
+ --text-button-label-text-color: var(--color-error);
436
+ --neo-button-container-color: var(--color-error);
437
+ --neo-button-label-text-color: var(--color-on-error);
438
+ }
439
+
440
+ :host([color=dark]) {
441
+ --filled-button-container-color: var(--color-on-surface);
442
+ --filled-button-label-text-color: var(--color-surface);
443
+ --tonal-button-container-color: var(--color-surface-container);
444
+ --tonal-button-label-text-color: var(--color-on-surface-container);
445
+ --elevated-button-container-color: var(--color-surface-container-low);
446
+ --elevated-button-label-text-color: var(--color-on-surface);
447
+ --outlined-button-outline-color: var(--color-on-surface);
448
+ --outlined-button-label-text-color: var(--color-on-surface);
449
+ --text-button-label-text-color: var(--color-on-surface);
450
+ --neo-button-container-color: var(--color-on-surface);
451
+ --neo-button-label-text-color: var(--color-surface);
452
+ }
453
+
454
+ :host([color=light]) {
455
+ --filled-button-container-color: var(--color-surface);
456
+ --filled-button-label-text-color: var(--color-on-surface);
457
+ --tonal-button-container-color: var(--color-on-surface-container);
458
+ --tonal-button-label-text-color: var(--color-surface-container);
459
+ --elevated-button-container-color: var(--color-surface-container-low);
460
+ --elevated-button-label-text-color: var(--color-white);
461
+ --outlined-button-outline-color: var(--color-surface);
462
+ --outlined-button-label-text-color: var(--color-surface);
463
+ --text-button-label-text-color: var(--color-surface);
464
+ --neo-button-container-color: var(--color-surface);
465
+ --neo-button-label-text-color: var(--color-on-surface);
466
+ }`;
467
+
468
+ var css_248z$9 = i`.button.size-xs,
469
+ .button.size-extra-small {
470
+ --_button-height: 2rem;
471
+ --_button-icon-size: 1rem;
472
+ --_container-padding: 0.75rem;
473
+ font-size: 0.875rem !important;
474
+ font-weight: var(--font-weight-medium) !important;
475
+ line-height: 1.25rem !important;
476
+ letter-spacing: 0.1px !important;
477
+ }
478
+
479
+ .button.size-sm,
480
+ .button.size-small {
481
+ --_button-height: 2.5rem;
482
+ --_button-icon-size: 1.25rem;
483
+ --_container-padding: 1rem;
484
+ --_button-icon-label-spacing: 0.5rem;
485
+ font-size: 0.875rem !important;
486
+ font-weight: var(--font-weight-medium) !important;
487
+ line-height: 1.25rem !important;
488
+ letter-spacing: 0.1px !important;
489
+ }
490
+
491
+ .button.size-md,
492
+ .button.size-medium {
493
+ --_button-height: 3.5rem;
494
+ --_button-icon-size: 1.5rem;
495
+ --_container-padding: 1.5rem;
496
+ font-size: 1rem !important;
497
+ font-weight: var(--font-weight-medium) !important;
498
+ line-height: 1.5rem !important;
499
+ letter-spacing: 0.15px !important;
500
+ }
501
+
502
+ .button.size-lg,
503
+ .button.size-large {
504
+ --_button-height: 6rem;
505
+ --_button-icon-size: 2rem;
506
+ --_container-padding: 3rem;
507
+ font-size: 1.5rem !important;
508
+ font-weight: var(--font-weight-regular) !important;
509
+ line-height: 2rem !important;
510
+ letter-spacing: 0 !important;
511
+ }
512
+
513
+ .button.size-xl {
514
+ --_button-height: 8.5rem;
515
+ --_button-icon-size: 2.5rem;
516
+ --_container-padding: 4rem;
517
+ font-size: 2rem !important;
518
+ font-weight: var(--font-weight-regular) !important;
519
+ line-height: 2.5rem !important;
520
+ letter-spacing: 0 !important;
521
+ }`;
522
+
523
+ var _Button_tabindex;
524
+ /**
525
+ * @label Button
526
+ * @tag base-button
527
+ * @rawTag button
528
+ *
529
+ * @summary Buttons help people initiate actions, from sending an email, to sharing a document, to liking a post.
530
+ * @overview
531
+ * <p>Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. Button labels express what action will occur when the user interacts with it.</p>
532
+ *
533
+ * @cssprop --button-container-shape: Defines the border radius of the button container shape.
534
+ *
535
+ * @cssprop --button-container-shape-start-start: Defines the start position of the button container shape.
536
+ * @cssprop --button-container-shape-start-end: Defines the end position of the button container shape.
537
+ * @cssprop --button-container-shape-end-start: Defines the start position of the button container shape.
538
+ * @cssprop --button-container-shape-end-end: Defines the end position of the button container shape.
539
+ *
540
+ *
541
+ * @cssprop --filled-button-container-color: Color of the filled button container.
542
+ * @cssprop --filled-button-label-text-color: Text color of the filled button label.
543
+ *
544
+ * @cssprop --outlined-button-container-color: Color of the outlined button container.
545
+ * @cssprop --outlined-button-label-text-color: Text color of the outlined button label.
546
+ *
547
+ * @cssprop --text-button-label-text-color: Text color of the text button label.
548
+ *
549
+ * @cssprop --tonal-button-container-color: Color of the tonal button container.
550
+ * @cssprop --tonal-button-label-text-color: Text color of the tonal button label.
551
+ *
552
+ * @cssprop --elevated-button-container-color: Color of the elevated button container.
553
+ * @cssprop --elevated-button-label-text-color: Text color of the elevated button label.
554
+ *
555
+ * @cssprop --neo-button-container-color: Color of the neo button container.
556
+ * @cssprop --neo-button-label-text-color: Text color of the neo button label.
557
+ *
558
+ * @fires {CustomEvent} button:click - Dispatched when the button is clicked.
559
+ *
560
+ * @example
561
+ * ```html
562
+ * <base-button>Button</base-button>
563
+ * ```
564
+ * @tags display
565
+ */
566
+ class Button extends BaseButton {
567
+ constructor() {
568
+ super(...arguments);
569
+ _Button_tabindex.set(this, 0);
570
+ /**
571
+ * Icon alignment.
572
+ * Possible values are `"start"`, `"end"`. Defaults to `"end"`.
573
+ */
574
+ this.iconAlign = 'end';
575
+ this.slotHasContent = false;
576
+ }
577
+ firstUpdated() {
578
+ this.__dispatchClickWithThrottle = throttle(this.__dispatchClick, this.throttleDelay);
579
+ observerSlotChangesWithCallback(this.renderRoot.querySelector('slot'), hasContent => {
580
+ this.slotHasContent = hasContent;
581
+ this.requestUpdate();
582
+ });
583
+ this.__convertTypeToVariantAndColor();
584
+ }
585
+ render() {
586
+ const isLink = this.__isLink();
587
+ const cssClasses = {
588
+ button: true,
589
+ 'button-element': true,
590
+ [`size-${this.size}`]: true,
591
+ [`variant-${this.variant}`]: true,
592
+ [`color-${this.color}`]: true,
593
+ disabled: this.disabled || this.softDisabled,
594
+ pressed: this.isPressed,
595
+ 'has-content': this.slotHasContent,
596
+ 'show-skeleton': this.skeleton,
597
+ };
598
+ if (!isLink) {
599
+ return b `<button
600
+ class=${e(cssClasses)}
601
+ id="button"
602
+ tabindex=${__classPrivateFieldGet(this, _Button_tabindex, "f")}
603
+ type=${this.htmlType}
604
+ @mousedown=${this.__handlePress}
605
+ @keydown=${this.__handlePress}
606
+ @keyup=${this.__handlePress}
607
+ ?aria-describedby=${this.__getDisabledReasonID()}
608
+ aria-disabled=${`${this.disabled || this.softDisabled}`}
609
+ ?disabled=${this.disabled}
610
+ ${spread(this.configAria)}
611
+ >
612
+ ${this.renderButtonContent()}
613
+ </button>
614
+ ${this.__renderTooltip()}`;
615
+ }
616
+ return b `<a
617
+ class=${e(cssClasses)}
618
+ id="button"
619
+ tabindex=${__classPrivateFieldGet(this, _Button_tabindex, "f")}
620
+ href=${this.href}
621
+ target=${this.target}
622
+ @mousedown=${this.__handlePress}
623
+ @keydown=${this.__handlePress}
624
+ @keyup=${this.__handlePress}
625
+ role="button"
626
+ ?aria-describedby=${this.__getDisabledReasonID()}
627
+ aria-disabled=${`${this.disabled}`}
628
+ ${spread(this.configAria)}
629
+ >
630
+ ${this.renderButtonContent()}
631
+ </a>
632
+ ${this.__renderTooltip()}`;
633
+ }
634
+ renderButtonContent() {
635
+ return b `
636
+ <focus-ring class="focus-ring" .control=${this}></focus-ring>
637
+ <base-elevation class="elevation"></base-elevation>
638
+ <div class="neo-background"></div>
639
+ <div class="background"></div>
640
+ <div class="outline"></div>
641
+ <base-ripple class="ripple"></base-ripple>
642
+ <base-skeleton class="skeleton"></base-skeleton>
643
+
644
+ <div class="button-content">
645
+ ${this.iconAlign === 'start'
646
+ ? b `<slot name="icon"></slot>`
647
+ : A}
648
+
649
+ <div class="slot-container">
650
+ <slot></slot>
651
+ </div>
652
+
653
+ ${this.iconAlign === 'end' ? b `<slot name="icon"></slot>` : A}
654
+ </div>
655
+
656
+ ${this.__renderDisabledReason()}
657
+ `;
658
+ }
659
+ }
660
+ _Button_tabindex = new WeakMap();
661
+ Button.styles = [css_248z$b, css_248z$a, css_248z$9];
662
+ __decorate([
663
+ n({ attribute: 'icon-align' })
664
+ ], Button.prototype, "iconAlign", void 0);
665
+ __decorate([
666
+ r()
667
+ ], Button.prototype, "slotHasContent", void 0);
668
+
669
+ var css_248z$8 = i`.button {
670
+ --_container-padding: 0.75rem;
671
+ width: var(--_button-height);
672
+ --_container-padding: 0;
673
+ }
674
+
675
+ .button.size-xs,
676
+ .button.size-extra-small {
677
+ --_button-height: 2rem;
678
+ --_button-icon-size: 1rem;
679
+ }
680
+
681
+ .button.size-sm,
682
+ .button.size-small {
683
+ --_button-height: 2.5rem;
684
+ --_button-icon-size: 1.25rem;
685
+ --_button-icon-label-spacing: 0.5rem;
686
+ }
687
+
688
+ .button.size-md,
689
+ .button.size-medium {
690
+ --_button-height: 3.5rem;
691
+ --_button-icon-size: 1.5rem;
692
+ }
693
+
694
+ .button.size-lg,
695
+ .button.size-large {
696
+ --_button-height: 6rem;
697
+ --_button-icon-size: 2rem;
698
+ }
699
+
700
+ .button.size-xl {
701
+ --_button-height: 8.5rem;
702
+ --_button-icon-size: 2.5rem;
703
+ }`;
704
+
705
+ var _IconButton_id, _IconButton_tabindex;
706
+ /**
707
+ * @label Icon Button
708
+ * @tag icon-button
709
+ * @rawTag icon-button
710
+ *
711
+ * @summary Icon buttons allow users to take actions, and make choices, with a single tap.
712
+ *
713
+ * @overview
714
+ * <p>Icon buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. IconButton labels express what action will occur when the user interacts with it.</p>
715
+ *
716
+ * @cssprop --button-container-shape: Defines the border radius of the button container shape.
717
+ *
718
+ * @cssprop --button-container-shape-start-start: Defines the start position of the button container shape.
719
+ * @cssprop --button-container-shape-start-end: Defines the end position of the button container shape.
720
+ * @cssprop --button-container-shape-end-start: Defines the start position of the button container shape.
721
+ * @cssprop --button-container-shape-end-end: Defines the end position of the button container shape.
722
+ *
723
+ *
724
+ * @cssprop --filled-button-container-color: Color of the filled button container.
725
+ * @cssprop --filled-button-label-text-color: Text color of the filled button label.
726
+ *
727
+ * @cssprop --outlined-button-container-color: Color of the outlined button container.
728
+ * @cssprop --outlined-button-label-text-color: Text color of the outlined button label.
729
+ *
730
+ * @cssprop --text-button-label-text-color: Text color of the text button label.
731
+ *
732
+ * @cssprop --tonal-button-container-color: Color of the tonal button container.
733
+ * @cssprop --tonal-button-label-text-color: Text color of the tonal button label.
734
+ *
735
+ * @cssprop --elevated-button-container-color: Color of the elevated button container.
736
+ * @cssprop --elevated-button-label-text-color: Text color of the elevated button label.
737
+ *
738
+ * @cssprop --neo-button-container-color: Color of the neo button container.
739
+ * @cssprop --neo-button-label-text-color: Text color of the neo button label.
740
+ *
741
+ * @fires {CustomEvent} button:click - Dispatched when the button is clicked.
742
+ *
743
+ * @example
744
+ * ```html
745
+ * <icon-button name="home"></icon-button>
746
+ * ```
747
+ * @tags display
748
+ */
749
+ class IconButton extends BaseButton {
750
+ constructor() {
751
+ super(...arguments);
752
+ _IconButton_id.set(this, crypto.randomUUID());
753
+ _IconButton_tabindex.set(this, 0);
754
+ this.provider = 'material-symbols';
755
+ }
756
+ firstUpdated() {
757
+ this.__dispatchClickWithThrottle = throttle(this.__dispatchClick, this.throttleDelay);
758
+ this.__convertTypeToVariantAndColor();
759
+ }
760
+ render() {
761
+ const isLink = this.__isLink();
762
+ const cssClasses = {
763
+ button: true,
764
+ 'button-element': true,
765
+ [`size-${this.size}`]: true,
766
+ [`variant-${this.variant}`]: true,
767
+ [`color-${this.color}`]: true,
768
+ disabled: this.disabled || this.softDisabled,
769
+ pressed: this.isPressed,
770
+ skeleton: this.skeleton,
771
+ };
772
+ if (!isLink) {
773
+ return b `<button
774
+ class=${e(cssClasses)}
775
+ id="button"
776
+ tabindex=${__classPrivateFieldGet(this, _IconButton_tabindex, "f")}
777
+ type=${this.htmlType}
778
+ @click=${this.__dispatchClickWithThrottle}
779
+ @mousedown=${this.__handlePress}
780
+ @keydown=${this.__handlePress}
781
+ @keyup=${this.__handlePress}
782
+ ?aria-describedby=${(this.disabled || this.softDisabled) &&
783
+ this.disabledReason
784
+ ? `disabled-reason-${__classPrivateFieldGet(this, _IconButton_id, "f")}`
785
+ : null}
786
+ aria-disabled=${`${this.disabled || this.softDisabled}`}
787
+ ?disabled=${this.disabled}
788
+ ${spread(this.configAria)}
789
+ >
790
+ ${this.renderButtonContent()}
791
+ </button>
792
+ ${this.__renderTooltip()}`;
793
+ }
794
+ return b `<a
795
+ class=${e(cssClasses)}
796
+ id="button"
797
+ tabindex=${__classPrivateFieldGet(this, _IconButton_tabindex, "f")}
798
+ href=${this.href}
799
+ target=${this.target}
800
+ @click=${this.__dispatchClickWithThrottle}
801
+ @mousedown=${this.__handlePress}
802
+ @keydown=${this.__handlePress}
803
+ @keyup=${this.__handlePress}
804
+ role="button"
805
+ aria-describedby=${this.disabled && this.disabledReason
806
+ ? `disabled-reason-${__classPrivateFieldGet(this, _IconButton_id, "f")}`
807
+ : null}
808
+ aria-disabled=${`${this.disabled}`}
809
+ ${spread(this.configAria)}
810
+ >
811
+ ${this.renderButtonContent()}
812
+ </a>
813
+ ${this.__renderTooltip()}`;
814
+ }
815
+ renderButtonContent() {
816
+ return b `
817
+ <focus-ring class="focus-ring" .control=${this}></focus-ring>
818
+ <base-elevation class="elevation"></base-elevation>
819
+ <div class="neo-background"></div>
820
+ <div class="background"></div>
821
+ <div class="outline"></div>
822
+ <base-ripple class="ripple"></base-ripple>
823
+ <base-skeleton class="skeleton"></base-skeleton>
824
+
825
+ <div class="button-content">
826
+ <base-icon
827
+ name=${this.name}
828
+ src=${this.src}
829
+ provider=${this.provider}
830
+ ></base-icon>
831
+ </div>
832
+
833
+ ${this.__renderDisabledReason()}
834
+ `;
835
+ }
836
+ }
837
+ _IconButton_id = new WeakMap(), _IconButton_tabindex = new WeakMap();
838
+ IconButton.styles = [css_248z$b, css_248z$a, css_248z$8];
839
+ __decorate([
840
+ n({ type: String, reflect: true })
841
+ ], IconButton.prototype, "name", void 0);
842
+ __decorate([
843
+ n({ type: String, reflect: true })
844
+ ], IconButton.prototype, "src", void 0);
845
+ __decorate([
846
+ n({ type: String })
847
+ ], IconButton.prototype, "provider", void 0);
848
+
849
+ var css_248z$7 = i`:host {
850
+ display: block;
851
+ --progress-height: 0.25rem;
852
+ --progress-container-color: var(--color-primary);
853
+ --progress-track-color: var(--color-secondary-container);
854
+ min-width: 2.5rem;
855
+ }
856
+
857
+ .linear-progress {
858
+ display: flex;
859
+ flex-direction: column;
860
+ }
861
+ .linear-progress .progress-header {
862
+ display: flex;
863
+ align-items: center;
864
+ }
865
+ .linear-progress .progress-header .progress-label {
866
+ font-family: var(--typography-label-medium-font-family) !important;
867
+ font-size: var(--typography-label-medium-font-size) !important;
868
+ font-weight: var(--typography-label-medium-font-weight) !important;
869
+ line-height: var(--typography-label-medium-line-height) !important;
870
+ letter-spacing: var(--typography-label-medium-letter-spacing) !important;
871
+ color: var(--color-on-surface);
872
+ flex: 1;
873
+ }
874
+ .linear-progress .progress-body {
875
+ display: flex;
876
+ flex-direction: column;
877
+ }
878
+ .linear-progress .progress-body .linear-progress-container {
879
+ position: relative;
880
+ display: flex;
881
+ align-items: flex-start;
882
+ width: 100%;
883
+ margin: var(--spacing-100) 0;
884
+ }
885
+ .linear-progress .progress-body .linear-progress-container .track {
886
+ position: relative;
887
+ }
888
+ .linear-progress .progress-body .linear-progress-container .track:after {
889
+ content: "";
890
+ position: absolute;
891
+ display: block;
892
+ top: 0;
893
+ left: 0;
894
+ width: calc(100% - 0.25rem);
895
+ height: var(--progress-height);
896
+ background: var(--progress-track-color);
897
+ border-radius: var(--shape-corner-full);
898
+ }
899
+ .linear-progress .progress-body .linear-progress-container .track-start:after {
900
+ margin-inline-end: 0.25rem;
901
+ }
902
+ .linear-progress .progress-body .linear-progress-container .active-indicator {
903
+ height: var(--progress-height);
904
+ background: var(--progress-container-color);
905
+ border-radius: var(--shape-corner-full);
906
+ }
907
+ .linear-progress .progress-body .linear-progress-container .track-end {
908
+ flex: 1;
909
+ }
910
+ .linear-progress .progress-body .linear-progress-container .track-end:after {
911
+ margin-inline-start: 0.25rem;
912
+ }
913
+ .linear-progress .progress-body .progress-helper {
914
+ font-family: var(--typography-body-small-font-family) !important;
915
+ font-size: var(--typography-body-small-font-size) !important;
916
+ font-weight: var(--typography-body-small-font-weight) !important;
917
+ line-height: var(--typography-body-small-line-height) !important;
918
+ letter-spacing: var(--typography-body-small-letter-spacing) !important;
919
+ color: var(--color-on-surface-variant);
920
+ }
921
+ .linear-progress:not(.indeterminate) .track-start {
922
+ transition: width var(--duration-medium2) var(--easing-standard);
923
+ }
924
+ .linear-progress:not(.indeterminate) .active-indicator {
925
+ transition: width var(--duration-medium2) var(--easing-standard);
926
+ }
927
+ .linear-progress.indeterminate .linear-progress-container .track-start {
928
+ animation-duration: 3s;
929
+ animation-iteration-count: infinite;
930
+ animation-name: track-start-indeterminate;
931
+ animation-timing-function: var(--easing-linear);
932
+ }
933
+ .linear-progress.indeterminate .linear-progress-container .active-indicator {
934
+ animation-duration: 3s;
935
+ animation-iteration-count: infinite;
936
+ animation-name: active-indicator-indeterminate;
937
+ animation-timing-function: var(--easing-linear);
938
+ }
939
+ .linear-progress.inline {
940
+ flex-direction: row;
941
+ gap: var(--spacing-200);
942
+ }
943
+ .linear-progress.inline .progress-body {
944
+ flex: 1;
945
+ }
946
+
947
+ @keyframes track-start-indeterminate {
948
+ 0% {
949
+ width: 0;
950
+ }
951
+ 50% {
952
+ width: 33%;
953
+ }
954
+ 80%, to {
955
+ width: 100%;
956
+ padding-inline-end: 0;
957
+ }
958
+ }
959
+ @keyframes active-indicator-indeterminate {
960
+ 0% {
961
+ width: 0;
962
+ }
963
+ 50% {
964
+ width: 33%;
965
+ }
966
+ 80%, to {
967
+ width: 0;
968
+ }
969
+ }`;
970
+
971
+ /**
972
+ * @label Linear Progress
973
+ * @tag linear-progress
974
+ * @rawTag linear-progress
975
+ *
976
+ * @summary A linear progress indicator is a visual representation of progress toward a specific goal.
977
+ *
978
+ * @example
979
+ * ```html
980
+ * <linear-progress value="30" style="width:10rem"></linear-progress>
981
+ * ```
982
+ */
983
+ class LinearProgress extends BaseProgress {
984
+ render() {
985
+ return b `
986
+ <div
987
+ class="${e({
988
+ 'linear-progress': true,
989
+ indeterminate: this.indeterminate,
990
+ inline: this.inline,
991
+ })}"
992
+ >
993
+ ${this.label
994
+ ? b `<div class="progress-header">
995
+ <label class="progress-label">${this.label}</label>
996
+ </div>`
997
+ : ''}
998
+
999
+ <div class="progress-body">
1000
+ <div
1001
+ class="linear-progress-container"
1002
+ title=${this.label}
1003
+ ?aria-valuenow="${this.__getPercentageValue()}"
1004
+ aria-valuemin="0"
1005
+ aria-valuemax="100"
1006
+ role="progressbar"
1007
+ >
1008
+ <div class="track track-start"></div>
1009
+ <div
1010
+ class="active-indicator"
1011
+ style="${o({
1012
+ width: `${this.__getPercentageValue()}%`,
1013
+ })}"
1014
+ ></div>
1015
+ <div class="track track-end"></div>
1016
+ </div>
1017
+
1018
+ ${this.helperText
1019
+ ? b `<div class="progress-helper">${this.helperText}</div>`
1020
+ : ''}
1021
+ </div>
1022
+ </div>
1023
+ `;
1024
+ }
1025
+ }
1026
+ // Lit components use static styles for better performance
1027
+ LinearProgress.styles = [css_248z$7];
1028
+
1029
+ var css_248z$6 = i`:host {
1030
+ display: inline-block;
1031
+ --progress-height: 1.5rem;
1032
+ --progress-line-thickness: 4px;
1033
+ --progress-container-color: var(--color-primary);
1034
+ --progress-track-color: var(--color-secondary-container);
1035
+ }
1036
+
1037
+ .circular-progress {
1038
+ display: flex;
1039
+ flex-direction: column;
1040
+ }
1041
+ .circular-progress .circular-progress-container {
1042
+ position: relative;
1043
+ width: 100%;
1044
+ --_container-height: clamp(0rem, var(--progress-height), 15rem);
1045
+ height: var(--_container-height);
1046
+ }
1047
+ .circular-progress .circular-progress-container .progress-label {
1048
+ font-family: var(--typography-label-large-emphasized-font-family) !important;
1049
+ font-size: var(--typography-label-large-emphasized-font-size) !important;
1050
+ font-weight: var(--typography-label-large-emphasized-font-weight) !important;
1051
+ line-height: var(--typography-label-large-emphasized-line-height) !important;
1052
+ letter-spacing: var(--typography-label-large-emphasized-letter-spacing) !important;
1053
+ color: var(--color-on-surface);
1054
+ flex: 1;
1055
+ width: 100%;
1056
+ height: 100%;
1057
+ display: flex;
1058
+ align-items: center;
1059
+ justify-content: center;
1060
+ }
1061
+ .circular-progress .circular-progress-container svg {
1062
+ transform: rotate(-90deg);
1063
+ width: 100%;
1064
+ height: 100%;
1065
+ }
1066
+ .circular-progress .circular-progress-container circle {
1067
+ fill: none;
1068
+ stroke-linecap: round;
1069
+ transition: stroke-dashoffset var(--duration-medium2) var(--easing-standard);
1070
+ }
1071
+ .circular-progress .circular-progress-container .track {
1072
+ stroke: var(--progress-track-color);
1073
+ stroke-width: calc(var(--progress-line-thickness) / (tan(atan2(var(--_container-height), 1px)) / 16));
1074
+ }
1075
+ .circular-progress .circular-progress-container .active-indicator {
1076
+ stroke: var(--progress-container-color);
1077
+ stroke-width: calc(var(--progress-line-thickness) / (tan(atan2(var(--_container-height), 1px)) / 16));
1078
+ }
1079
+ .circular-progress.indeterminate .active-indicator {
1080
+ animation: arc-indeterminate 1.5s ease-in-out infinite;
1081
+ }
1082
+ .circular-progress .progress-label {
1083
+ font-family: var(--typography-label-medium-font-family) !important;
1084
+ font-size: var(--typography-label-medium-font-size) !important;
1085
+ font-weight: var(--typography-label-medium-font-weight) !important;
1086
+ line-height: var(--typography-label-medium-line-height) !important;
1087
+ letter-spacing: var(--typography-label-medium-letter-spacing) !important;
1088
+ color: var(--color-on-surface);
1089
+ }
1090
+ .circular-progress .progress-helper {
1091
+ font-family: var(--typography-label-small-font-family) !important;
1092
+ font-size: var(--typography-label-small-font-size) !important;
1093
+ font-weight: var(--typography-label-small-font-weight) !important;
1094
+ line-height: var(--typography-label-small-line-height) !important;
1095
+ letter-spacing: var(--typography-label-small-letter-spacing) !important;
1096
+ color: var(--color-on-surface-variant);
1097
+ text-align: center;
1098
+ }
1099
+ .circular-progress.inline {
1100
+ flex-direction: row;
1101
+ align-items: center;
1102
+ gap: var(--spacing-200);
1103
+ }
1104
+ .circular-progress.inline .progress-footer {
1105
+ flex: 1;
1106
+ }
1107
+ .circular-progress.inline .progress-helper {
1108
+ text-align: right;
1109
+ }
1110
+
1111
+ @keyframes rotate-container {
1112
+ 100% {
1113
+ transform: rotate(360deg);
1114
+ }
1115
+ }
1116
+ @keyframes arc-indeterminate {
1117
+ 0% {
1118
+ stroke-dasharray: 1, 150;
1119
+ stroke-dashoffset: 0;
1120
+ }
1121
+ 50% {
1122
+ stroke-dasharray: 90, 150;
1123
+ stroke-dashoffset: -35;
1124
+ }
1125
+ 100% {
1126
+ stroke-dasharray: 90, 150;
1127
+ stroke-dashoffset: -124;
1128
+ }
1129
+ }`;
1130
+
1131
+ /**
1132
+ * @label Circular Progress
1133
+ * @tag circular-progress
1134
+ * @rawTag circular-progress
1135
+ *
1136
+ * @summary A circular progress indicator is a visual representation of progress toward a specific goal.
1137
+ *
1138
+ * @example
1139
+ * ```html
1140
+ * <circular-progress value="30"></circular-progress>
1141
+ * ```
1142
+ */
1143
+ class CircularProgress extends BaseProgress {
1144
+ render() {
1145
+ const percentage = this.__getPercentageValue();
1146
+ // Radius of 18 with stroke 4 fits nicely in a 40x40 viewBox
1147
+ const radius = 6;
1148
+ const circumference = 2 * Math.PI * radius;
1149
+ const offset = circumference - (percentage / 100) * circumference;
1150
+ return b `
1151
+ <div
1152
+ class="${e({
1153
+ 'circular-progress': true,
1154
+ indeterminate: this.indeterminate,
1155
+ inline: this.inline,
1156
+ })}"
1157
+ title=${this.label}
1158
+ role="progressbar"
1159
+ aria-valuenow="${this.indeterminate ? undefined : percentage}"
1160
+ aria-valuemin="0"
1161
+ aria-valuemax="100"
1162
+ >
1163
+ <div class="circular-progress-container">
1164
+ <svg viewBox="0 0 16 16">
1165
+ <circle class="track" cx="8" cy="8" r="6"></circle>
1166
+ <circle
1167
+ class="active-indicator"
1168
+ cx="8"
1169
+ cy="8"
1170
+ r="6"
1171
+ style="${o({
1172
+ strokeDasharray: `${circumference}`,
1173
+ strokeDashoffset: this.indeterminate ? undefined : `${offset}`,
1174
+ })}"
1175
+ ></circle>
1176
+ </svg>
1177
+ </div>
1178
+
1179
+ <div class="progress-footer">
1180
+ ${this.label
1181
+ ? b `<div class="progress-label">${this.label}</div>`
1182
+ : ''}
1183
+ ${this.helperText
1184
+ ? b `<div class="progress-helper">${this.helperText}</div>`
1185
+ : ''}
1186
+ </div>
1187
+ </div>
1188
+ `;
1189
+ }
1190
+ }
1191
+ // Lit components use static styles for better performance
1192
+ CircularProgress.styles = [css_248z$6];
1193
+
1194
+ var css_248z$5 = i`* {
1195
+ box-sizing: border-box;
1196
+ }
1197
+
1198
+ .screen-reader-only {
1199
+ display: none !important;
1200
+ }
1201
+
1202
+ :host {
1203
+ display: block;
1204
+ width: 100%;
1205
+ }
1206
+
1207
+ .input-element {
1208
+ border: none;
1209
+ outline: none;
1210
+ margin: 0;
1211
+ padding: 0;
1212
+ }
1213
+
1214
+ .input-wrapper .input {
1215
+ flex: 1;
1216
+ width: 100%;
1217
+ background: none;
1218
+ cursor: inherit;
1219
+ }
1220
+ .input-wrapper .password-toggle {
1221
+ --button-container-shape: var(--shape-corner-full);
1222
+ }`;
1223
+
1224
+ /**
1225
+ * @label Input
1226
+ * @tag input-field
1227
+ * @rawTag input
1228
+ *
1229
+ * @summary The Input component is used to capture user input.
1230
+ *
1231
+ * @example
1232
+ * ```html
1233
+ * <input-field label="Name" required placeholder="Enter your name"></input-field>
1234
+ * ```
1235
+ */
1236
+ class Input extends BaseInput {
1237
+ constructor() {
1238
+ super(...arguments);
1239
+ this.value = '';
1240
+ this.name = '';
1241
+ this.placeholder = '';
1242
+ this.label = '';
1243
+ this.inline = false;
1244
+ this.size = 'md';
1245
+ this.type = 'text';
1246
+ this.autocomplete = 'off';
1247
+ this.configAria = {};
1248
+ this.variant = 'default';
1249
+ /**
1250
+ * Helper text to display below the input.
1251
+ */
1252
+ this.helperText = '';
1253
+ this.error = false;
1254
+ this.errorText = '';
1255
+ this.warning = false;
1256
+ this.warningText = '';
1257
+ this.focused = false;
1258
+ this.passwordVisible = false;
1259
+ /**
1260
+ * Returns true when the text field has been interacted with. Native
1261
+ * validation errors only display in response to user interactions.
1262
+ */
1263
+ this.dirty = false;
1264
+ }
1265
+ connectedCallback() {
1266
+ super.connectedCallback();
1267
+ this.handleInitialAttributes();
1268
+ }
1269
+ handleInitialAttributes() {
1270
+ if (this.hasAttribute('tabindex')) {
1271
+ this.tabindex = this.getAttribute('tabindex') || undefined;
1272
+ this.removeAttribute('tabindex');
1273
+ }
1274
+ Array.from(this.attributes).forEach(attr => {
1275
+ if (attr.name.startsWith('aria-')) {
1276
+ this.configAria[attr.name] = attr.value;
1277
+ this.removeAttribute(attr.name);
1278
+ }
1279
+ });
1280
+ }
1281
+ __handleInput(event) {
1282
+ this.dirty = true;
1283
+ this.value = event.target.value;
1284
+ }
1285
+ focus() {
1286
+ this.inputElement?.focus();
1287
+ }
1288
+ blur() {
1289
+ this.inputElement?.blur();
1290
+ }
1291
+ __handleFocusChange() {
1292
+ // When calling focus() or reportValidity() during change, it's possible
1293
+ // for blur to be called after the new focus event. Rather than set
1294
+ // `this.focused` to true/false on focus/blur, we always set it to whether
1295
+ // or not the input itself is focused.
1296
+ this.focused = this.inputElement?.matches(':focus') ?? false;
1297
+ }
1298
+ __redispatchEvent(event) {
1299
+ redispatchEvent(this, event);
1300
+ }
1301
+ render() {
1302
+ const displayType = this.type === 'password' && this.passwordVisible ? 'text' : this.type;
1303
+ return b `
1304
+ <base-field
1305
+ ?required=${this.required}
1306
+ ?disabled=${this.disabled}
1307
+ ?readonly=${this.readonly}
1308
+ ?skeleton=${this.skeleton}
1309
+ helper-text=${this.helperText}
1310
+ ?error=${this.error}
1311
+ error-text=${this.errorText}
1312
+ ?warning=${this.warning}
1313
+ variant=${this.variant}
1314
+ ?populated=${!!this.value}
1315
+ warning-text=${this.warningText}
1316
+ label=${this.label}
1317
+ ?focused=${this.focused}
1318
+ .host=${this}
1319
+ class="input-wrapper"
1320
+ >
1321
+ <slot name="start" slot="field-start"></slot>
1322
+
1323
+ <input
1324
+ class="input input-element"
1325
+ name=${this.name}
1326
+ type=${displayType}
1327
+ placeholder=${this.placeholder}
1328
+ autocomplete=${this.autocomplete}
1329
+ .value=${this.value}
1330
+ ?tabindex=${this.tabindex}
1331
+ ?readonly=${this.readonly}
1332
+ ?required=${this.required}
1333
+ ?disabled=${this.disabled}
1334
+ @input=${this.__handleInput}
1335
+ @change=${this.__redispatchEvent}
1336
+ @focus=${this.__handleFocusChange}
1337
+ @blur=${this.__handleFocusChange}
1338
+ ${spread(this.configAria)}
1339
+ />
1340
+
1341
+ ${this.type === 'password'
1342
+ ? b `
1343
+ <pc-tooltip
1344
+ slot="field-end"
1345
+ content=${this.passwordVisible
1346
+ ? 'Hide password'
1347
+ : 'Show password'}
1348
+ >
1349
+ <icon-button
1350
+ class="password-toggle"
1351
+ variant="text"
1352
+ name=${this.passwordVisible ? 'visibility_off' : 'visibility'}
1353
+ @click=${() => {
1354
+ this.passwordVisible = !this.passwordVisible;
1355
+ }}
1356
+ >
1357
+ </icon-button>
1358
+ </pc-tooltip>
1359
+ `
1360
+ : A}
1361
+
1362
+ <slot name="end" slot="field-end"></slot>
1363
+ </base-field>
1364
+ `;
1365
+ }
1366
+ }
1367
+ Input.styles = [css_248z$5];
1368
+ __decorate([
1369
+ n({ type: String })
1370
+ ], Input.prototype, "value", void 0);
1371
+ __decorate([
1372
+ n({ type: String })
1373
+ ], Input.prototype, "name", void 0);
1374
+ __decorate([
1375
+ n({ type: String })
1376
+ ], Input.prototype, "placeholder", void 0);
1377
+ __decorate([
1378
+ n({ type: String })
1379
+ ], Input.prototype, "label", void 0);
1380
+ __decorate([
1381
+ n({ type: Boolean, reflect: true })
1382
+ ], Input.prototype, "inline", void 0);
1383
+ __decorate([
1384
+ n({ type: String, reflect: true })
1385
+ ], Input.prototype, "size", void 0);
1386
+ __decorate([
1387
+ n({ type: String })
1388
+ ], Input.prototype, "type", void 0);
1389
+ __decorate([
1390
+ n({ type: String })
1391
+ ], Input.prototype, "autocomplete", void 0);
1392
+ __decorate([
1393
+ n({ type: Object })
1394
+ ], Input.prototype, "configAria", void 0);
1395
+ __decorate([
1396
+ n({ type: String })
1397
+ ], Input.prototype, "variant", void 0);
1398
+ __decorate([
1399
+ n({ type: String, attribute: 'helper-text' })
1400
+ ], Input.prototype, "helperText", void 0);
1401
+ __decorate([
1402
+ n({ type: Boolean })
1403
+ ], Input.prototype, "error", void 0);
1404
+ __decorate([
1405
+ n({ type: String, attribute: 'error-text' })
1406
+ ], Input.prototype, "errorText", void 0);
1407
+ __decorate([
1408
+ n({ type: Boolean })
1409
+ ], Input.prototype, "warning", void 0);
1410
+ __decorate([
1411
+ n({ type: String, attribute: 'warning-text' })
1412
+ ], Input.prototype, "warningText", void 0);
1413
+ __decorate([
1414
+ r()
1415
+ ], Input.prototype, "focused", void 0);
1416
+ __decorate([
1417
+ r()
1418
+ ], Input.prototype, "passwordVisible", void 0);
1419
+ __decorate([
1420
+ r()
1421
+ ], Input.prototype, "dirty", void 0);
1422
+ __decorate([
1423
+ e$1('.input-element')
1424
+ ], Input.prototype, "inputElement", void 0);
1425
+
1426
+ var css_248z$4 = i`* {
1427
+ box-sizing: border-box;
1428
+ }
1429
+
1430
+ .screen-reader-only {
1431
+ display: none !important;
1432
+ }
1433
+
1434
+ :host {
1435
+ display: block;
1436
+ width: 100%;
1437
+ }
1438
+
1439
+ .input-element {
1440
+ border: none;
1441
+ outline: none;
1442
+ margin: 0;
1443
+ padding: 0;
1444
+ }
1445
+
1446
+ .input-wrapper .input {
1447
+ flex: 1;
1448
+ width: 100%;
1449
+ background: none;
1450
+ cursor: inherit;
1451
+ }
1452
+ .input-wrapper .password-toggle {
1453
+ --button-container-shape: var(--shape-corner-full);
1454
+ }
1455
+
1456
+ .stepper {
1457
+ /* Chrome, Safari, Edge, Opera */
1458
+ }
1459
+ .stepper input::-webkit-outer-spin-button,
1460
+ .stepper input::-webkit-inner-spin-button {
1461
+ -webkit-appearance: none;
1462
+ margin: 0;
1463
+ }
1464
+ .stepper {
1465
+ /* Firefox */
1466
+ }
1467
+ .stepper input[type=number] {
1468
+ -moz-appearance: textfield;
1469
+ }`;
1470
+
1471
+ var _NumberField_id;
1472
+ /**
1473
+ * @label Number Field
1474
+ * @tag number-field
1475
+ * @rawTag number
1476
+ *
1477
+ * @summary The Number Field component is used to capture numeric user input.
1478
+ *
1479
+ * @example
1480
+ * ```html
1481
+ * <number-field label="Age" placeholder="Enter your age"></number-field>
1482
+ * ```
1483
+ */
1484
+ class NumberField extends BaseInput {
1485
+ constructor() {
1486
+ super(...arguments);
1487
+ _NumberField_id.set(this, crypto.randomUUID());
1488
+ this.name = '';
1489
+ this.placeholder = '';
1490
+ this.label = '';
1491
+ this.inline = false;
1492
+ this.size = 'md';
1493
+ this.autocomplete = 'off';
1494
+ this.configAria = {};
1495
+ /**
1496
+ * Helper text to display below the input.
1497
+ */
1498
+ this.helperText = '';
1499
+ this.error = false;
1500
+ this.errorText = '';
1501
+ this.warning = false;
1502
+ this.warningText = '';
1503
+ this.stepper = false;
1504
+ this.focused = false;
1505
+ /**
1506
+ * Returns true when the text field has been interacted with. Native
1507
+ * validation errors only display in response to user interactions.
1508
+ */
1509
+ this.dirty = false;
1510
+ }
1511
+ connectedCallback() {
1512
+ super.connectedCallback();
1513
+ this.handleInitialAttributes();
1514
+ }
1515
+ handleInitialAttributes() {
1516
+ if (this.hasAttribute('tabindex')) {
1517
+ this.tabindex = this.getAttribute('tabindex') || undefined;
1518
+ this.removeAttribute('tabindex');
1519
+ }
1520
+ Array.from(this.attributes).forEach(attr => {
1521
+ if (attr.name.startsWith('aria-')) {
1522
+ this.configAria[attr.name] = attr.value;
1523
+ this.removeAttribute(attr.name);
1524
+ }
1525
+ });
1526
+ }
1527
+ __handleInput(event) {
1528
+ this.dirty = true;
1529
+ this.value = Number(event.target.value);
1530
+ }
1531
+ focus() {
1532
+ this.inputElement?.focus();
1533
+ }
1534
+ blur() {
1535
+ this.inputElement?.blur();
1536
+ }
1537
+ __handleFocusChange() {
1538
+ // When calling focus() or reportValidity() during change, it's possible
1539
+ // for blur to be called after the new focus event. Rather than set
1540
+ // `this.focused` to true/false on focus/blur, we always set it to whether
1541
+ // or not the input itself is focused.
1542
+ this.focused = this.inputElement?.matches(':focus') ?? false;
1543
+ }
1544
+ __redispatchEvent(event) {
1545
+ redispatchEvent(this, event);
1546
+ }
1547
+ stepUp() {
1548
+ this.inputElement?.stepUp();
1549
+ }
1550
+ stepDown() {
1551
+ this.inputElement?.stepDown();
1552
+ }
1553
+ render() {
1554
+ const classes = {
1555
+ 'input-wrapper': true,
1556
+ stepper: this.stepper,
1557
+ };
1558
+ return b `
1559
+ <base-field
1560
+ ?required=${this.required}
1561
+ ?disabled=${this.disabled}
1562
+ ?readonly=${this.readonly}
1563
+ ?skeleton=${this.skeleton}
1564
+ helper-text=${this.helperText}
1565
+ ?error=${this.error}
1566
+ error-text=${this.errorText}
1567
+ ?warning=${this.warning}
1568
+ warning-text=${this.warningText}
1569
+ label=${this.label}
1570
+ ?focused=${this.focused}
1571
+ .host=${this}
1572
+ class=${e(classes)}
1573
+ >
1574
+ ${this.stepper && !this.disabled
1575
+ ? b `<icon-button
1576
+ class="stepper"
1577
+ name="remove"
1578
+ variant="text"
1579
+ slot="field-start"
1580
+ @click=${this.stepDown}
1581
+ ></icon-button>`
1582
+ : A}
1583
+
1584
+ <slot name="start" slot="field-start"></slot>
1585
+
1586
+ <input
1587
+ class="input input-element"
1588
+ name=${this.name}
1589
+ type="number"
1590
+ placeholder=${this.placeholder}
1591
+ autocomplete=${this.autocomplete}
1592
+ .value=${this.value}
1593
+ ?tabindex=${this.tabindex}
1594
+ ?readonly=${this.readonly}
1595
+ ?required=${this.required}
1596
+ ?disabled=${this.disabled}
1597
+ min=${this.min}
1598
+ max=${this.max}
1599
+ step=${this.step}
1600
+ @input=${this.__handleInput}
1601
+ @change=${this.__redispatchEvent}
1602
+ @focus=${this.__handleFocusChange}
1603
+ @blur=${this.__handleFocusChange}
1604
+ ${spread(this.configAria)}
1605
+ />
1606
+
1607
+ <slot name="end" slot="field-end"></slot>
1608
+
1609
+ ${this.stepper && !this.disabled
1610
+ ? b `<icon-button
1611
+ class="stepper"
1612
+ variant="text"
1613
+ name="add"
1614
+ slot="field-end"
1615
+ @click=${this.stepUp}
1616
+ ></icon-button>`
1617
+ : A}
1618
+ </base-field>
1619
+ `;
1620
+ }
1621
+ }
1622
+ _NumberField_id = new WeakMap();
1623
+ NumberField.styles = [css_248z$4];
1624
+ __decorate([
1625
+ n({ type: Number })
1626
+ ], NumberField.prototype, "value", void 0);
1627
+ __decorate([
1628
+ n({ type: String })
1629
+ ], NumberField.prototype, "name", void 0);
1630
+ __decorate([
1631
+ n({ type: String })
1632
+ ], NumberField.prototype, "placeholder", void 0);
1633
+ __decorate([
1634
+ n({ type: String })
1635
+ ], NumberField.prototype, "label", void 0);
1636
+ __decorate([
1637
+ n({ type: Boolean, reflect: true })
1638
+ ], NumberField.prototype, "inline", void 0);
1639
+ __decorate([
1640
+ n({ type: String, reflect: true })
1641
+ ], NumberField.prototype, "size", void 0);
1642
+ __decorate([
1643
+ n({ type: Number })
1644
+ ], NumberField.prototype, "max", void 0);
1645
+ __decorate([
1646
+ n({ type: Number })
1647
+ ], NumberField.prototype, "min", void 0);
1648
+ __decorate([
1649
+ n({ type: Number })
1650
+ ], NumberField.prototype, "step", void 0);
1651
+ __decorate([
1652
+ n({ type: String })
1653
+ ], NumberField.prototype, "autocomplete", void 0);
1654
+ __decorate([
1655
+ n({ type: Object })
1656
+ ], NumberField.prototype, "configAria", void 0);
1657
+ __decorate([
1658
+ n({ type: String, attribute: 'helper-text' })
1659
+ ], NumberField.prototype, "helperText", void 0);
1660
+ __decorate([
1661
+ n({ type: Boolean })
1662
+ ], NumberField.prototype, "error", void 0);
1663
+ __decorate([
1664
+ n({ type: String, attribute: 'error-text' })
1665
+ ], NumberField.prototype, "errorText", void 0);
1666
+ __decorate([
1667
+ n({ type: Boolean })
1668
+ ], NumberField.prototype, "warning", void 0);
1669
+ __decorate([
1670
+ n({ type: String, attribute: 'warning-text' })
1671
+ ], NumberField.prototype, "warningText", void 0);
1672
+ __decorate([
1673
+ n({ type: Boolean })
1674
+ ], NumberField.prototype, "stepper", void 0);
1675
+ __decorate([
1676
+ r()
1677
+ ], NumberField.prototype, "focused", void 0);
1678
+ __decorate([
1679
+ r()
1680
+ ], NumberField.prototype, "dirty", void 0);
1681
+ __decorate([
1682
+ e$1('.input-element')
1683
+ ], NumberField.prototype, "inputElement", void 0);
1684
+
1685
+ var css_248z$3 = i`* {
1686
+ box-sizing: border-box;
1687
+ }
1688
+
1689
+ .screen-reader-only {
1690
+ display: none !important;
1691
+ }
1692
+
1693
+ :host {
1694
+ display: block;
1695
+ width: 100%;
1696
+ }
1697
+
1698
+ .input-element {
1699
+ border: none;
1700
+ outline: none;
1701
+ margin: 0;
1702
+ padding: 0;
1703
+ }
1704
+
1705
+ .input-wrapper .input {
1706
+ flex: 1;
1707
+ width: 100%;
1708
+ background: none;
1709
+ cursor: inherit;
1710
+ }
1711
+ .input-wrapper .input::-webkit-inner-spin-button,
1712
+ .input-wrapper .input::-webkit-calendar-picker-indicator {
1713
+ display: none;
1714
+ -webkit-appearance: none;
1715
+ }`;
1716
+
1717
+ /**
1718
+ * @label Date Picker
1719
+ * @tag date-picker
1720
+ * @rawTag date-picker
1721
+ *
1722
+ * @summary The Date Picker component is used to capture date user input.
1723
+ *
1724
+ * @example
1725
+ * ```html
1726
+ * <date-picker label="Name" required placeholder="Enter your name"></date-picker>
1727
+ * ```
1728
+ */
1729
+ class DatePicker extends BaseInput {
1730
+ constructor() {
1731
+ super(...arguments);
1732
+ this.value = '';
1733
+ this.name = '';
1734
+ this.placeholder = '';
1735
+ this.label = '';
1736
+ this.inline = false;
1737
+ this.size = 'md';
1738
+ this.autocomplete = 'off';
1739
+ this.configAria = {};
1740
+ this.variant = 'default';
1741
+ /**
1742
+ * Helper text to display below the input.
1743
+ */
1744
+ this.helperText = '';
1745
+ this.error = false;
1746
+ this.errorText = '';
1747
+ this.warning = false;
1748
+ this.warningText = '';
1749
+ this.focused = false;
1750
+ this.passwordVisible = false;
1751
+ /**
1752
+ * Returns true when the text field has been interacted with. Native
1753
+ * validation errors only display in response to user interactions.
1754
+ */
1755
+ this.dirty = false;
1756
+ }
1757
+ connectedCallback() {
1758
+ super.connectedCallback();
1759
+ this.handleInitialAttributes();
1760
+ }
1761
+ handleInitialAttributes() {
1762
+ if (this.hasAttribute('tabindex')) {
1763
+ this.tabindex = this.getAttribute('tabindex') || undefined;
1764
+ this.removeAttribute('tabindex');
1765
+ }
1766
+ Array.from(this.attributes).forEach(attr => {
1767
+ if (attr.name.startsWith('aria-')) {
1768
+ this.configAria[attr.name] = attr.value;
1769
+ this.removeAttribute(attr.name);
1770
+ }
1771
+ });
1772
+ }
1773
+ __handleInput(event) {
1774
+ this.dirty = true;
1775
+ this.value = event.target.value;
1776
+ }
1777
+ focus() {
1778
+ this.inputElement?.focus();
1779
+ }
1780
+ blur() {
1781
+ this.inputElement?.blur();
1782
+ }
1783
+ __handleFocusChange() {
1784
+ // When calling focus() or reportValidity() during change, it's possible
1785
+ // for blur to be called after the new focus event. Rather than set
1786
+ // `this.focused` to true/false on focus/blur, we always set it to whether
1787
+ // or not the input itself is focused.
1788
+ this.focused = this.inputElement?.matches(':focus') ?? false;
1789
+ }
1790
+ __redispatchEvent(event) {
1791
+ redispatchEvent(this, event);
1792
+ }
1793
+ render() {
1794
+ return b `
1795
+ <base-field
1796
+ ?required=${this.required}
1797
+ ?disabled=${this.disabled}
1798
+ ?readonly=${this.readonly}
1799
+ ?skeleton=${this.skeleton}
1800
+ helper-text=${this.helperText}
1801
+ ?error=${this.error}
1802
+ error-text=${this.errorText}
1803
+ ?warning=${this.warning}
1804
+ variant=${this.variant}
1805
+ ?populated=${!!this.value}
1806
+ warning-text=${this.warningText}
1807
+ label=${this.label}
1808
+ ?focused=${this.focused}
1809
+ .host=${this}
1810
+ class="input-wrapper"
1811
+ >
1812
+ <slot name="start" slot="field-start"></slot>
1813
+
1814
+ <input
1815
+ class="input input-element"
1816
+ name=${this.name}
1817
+ type="date"
1818
+ placeholder=${this.placeholder}
1819
+ autocomplete=${this.autocomplete}
1820
+ .value=${this.value}
1821
+ ?tabindex=${this.tabindex}
1822
+ ?readonly=${this.readonly}
1823
+ ?required=${this.required}
1824
+ ?disabled=${this.disabled}
1825
+ @input=${this.__handleInput}
1826
+ @change=${this.__redispatchEvent}
1827
+ @focus=${this.__handleFocusChange}
1828
+ @blur=${this.__handleFocusChange}
1829
+ ${spread(this.configAria)}
1830
+ />
1831
+
1832
+ <slot name="end" slot="field-end"></slot>
1833
+
1834
+ <icon-button
1835
+ slot="field-end"
1836
+ color="secondary"
1837
+ variant="text"
1838
+ name="calendar_today"
1839
+ ?disabled=${this.disabled}
1840
+ @click=${() => {
1841
+ setTimeout(() => {
1842
+ // @ts-ignore
1843
+ this.inputElement.showPicker();
1844
+ });
1845
+ }}
1846
+ >
1847
+ </icon-button>
1848
+ </base-field>
1849
+ `;
1850
+ }
1851
+ }
1852
+ DatePicker.styles = [css_248z$3];
1853
+ __decorate([
1854
+ n({ type: String })
1855
+ ], DatePicker.prototype, "value", void 0);
1856
+ __decorate([
1857
+ n({ type: String })
1858
+ ], DatePicker.prototype, "name", void 0);
1859
+ __decorate([
1860
+ n({ type: String })
1861
+ ], DatePicker.prototype, "placeholder", void 0);
1862
+ __decorate([
1863
+ n({ type: String })
1864
+ ], DatePicker.prototype, "label", void 0);
1865
+ __decorate([
1866
+ n({ type: Boolean, reflect: true })
1867
+ ], DatePicker.prototype, "inline", void 0);
1868
+ __decorate([
1869
+ n({ type: String, reflect: true })
1870
+ ], DatePicker.prototype, "size", void 0);
1871
+ __decorate([
1872
+ n({ type: String })
1873
+ ], DatePicker.prototype, "autocomplete", void 0);
1874
+ __decorate([
1875
+ n({ type: Object })
1876
+ ], DatePicker.prototype, "configAria", void 0);
1877
+ __decorate([
1878
+ n({ type: String })
1879
+ ], DatePicker.prototype, "variant", void 0);
1880
+ __decorate([
1881
+ n({ type: String, attribute: 'helper-text' })
1882
+ ], DatePicker.prototype, "helperText", void 0);
1883
+ __decorate([
1884
+ n({ type: Boolean })
1885
+ ], DatePicker.prototype, "error", void 0);
1886
+ __decorate([
1887
+ n({ type: String, attribute: 'error-text' })
1888
+ ], DatePicker.prototype, "errorText", void 0);
1889
+ __decorate([
1890
+ n({ type: Boolean })
1891
+ ], DatePicker.prototype, "warning", void 0);
1892
+ __decorate([
1893
+ n({ type: String, attribute: 'warning-text' })
1894
+ ], DatePicker.prototype, "warningText", void 0);
1895
+ __decorate([
1896
+ r()
1897
+ ], DatePicker.prototype, "focused", void 0);
1898
+ __decorate([
1899
+ r()
1900
+ ], DatePicker.prototype, "passwordVisible", void 0);
1901
+ __decorate([
1902
+ r()
1903
+ ], DatePicker.prototype, "dirty", void 0);
1904
+ __decorate([
1905
+ e$1('.input-element')
1906
+ ], DatePicker.prototype, "inputElement", void 0);
1907
+
1908
+ var css_248z$2 = i`* {
1909
+ box-sizing: border-box;
1910
+ }
1911
+
1912
+ .screen-reader-only {
1913
+ display: none !important;
1914
+ }
1915
+
1916
+ :host {
1917
+ display: block;
1918
+ width: 100%;
1919
+ }
1920
+
1921
+ .input-element {
1922
+ border: none;
1923
+ outline: none;
1924
+ margin: 0;
1925
+ padding: 0;
1926
+ }
1927
+
1928
+ .input-wrapper .input {
1929
+ flex: 1;
1930
+ width: 100%;
1931
+ background: none;
1932
+ cursor: inherit;
1933
+ }
1934
+ .input-wrapper .input::-webkit-inner-spin-button,
1935
+ .input-wrapper .input::-webkit-calendar-picker-indicator {
1936
+ display: none;
1937
+ -webkit-appearance: none;
1938
+ }`;
1939
+
1940
+ /**
1941
+ * @label Time Picker
1942
+ * @tag time-picker
1943
+ * @rawTag time-picker
1944
+ *
1945
+ * @summary The Time Picker component is used to capture time user input.
1946
+ *
1947
+ * @example
1948
+ * ```html
1949
+ * <time-picker label="Name" required placeholder="Enter your name"></time-picker>
1950
+ * ```
1951
+ */
1952
+ class TimePicker extends BaseInput {
1953
+ constructor() {
1954
+ super(...arguments);
1955
+ this.value = '';
1956
+ this.name = '';
1957
+ this.placeholder = '';
1958
+ this.label = '';
1959
+ this.inline = false;
1960
+ this.size = 'md';
1961
+ this.autocomplete = 'off';
1962
+ this.configAria = {};
1963
+ this.variant = 'default';
1964
+ /**
1965
+ * Helper text to display below the input.
1966
+ */
1967
+ this.helperText = '';
1968
+ this.error = false;
1969
+ this.errorText = '';
1970
+ this.warning = false;
1971
+ this.warningText = '';
1972
+ this.focused = false;
1973
+ this.passwordVisible = false;
1974
+ /**
1975
+ * Returns true when the text field has been interacted with. Native
1976
+ * validation errors only display in response to user interactions.
1977
+ */
1978
+ this.dirty = false;
1979
+ }
1980
+ connectedCallback() {
1981
+ super.connectedCallback();
1982
+ this.handleInitialAttributes();
1983
+ }
1984
+ handleInitialAttributes() {
1985
+ if (this.hasAttribute('tabindex')) {
1986
+ this.tabindex = this.getAttribute('tabindex') || undefined;
1987
+ this.removeAttribute('tabindex');
1988
+ }
1989
+ Array.from(this.attributes).forEach(attr => {
1990
+ if (attr.name.startsWith('aria-')) {
1991
+ this.configAria[attr.name] = attr.value;
1992
+ this.removeAttribute(attr.name);
1993
+ }
1994
+ });
1995
+ }
1996
+ __handleInput(event) {
1997
+ this.dirty = true;
1998
+ this.value = event.target.value;
1999
+ }
2000
+ focus() {
2001
+ this.inputElement?.focus();
2002
+ }
2003
+ blur() {
2004
+ this.inputElement?.blur();
2005
+ }
2006
+ __handleFocusChange() {
2007
+ // When calling focus() or reportValidity() during change, it's possible
2008
+ // for blur to be called after the new focus event. Rather than set
2009
+ // `this.focused` to true/false on focus/blur, we always set it to whether
2010
+ // or not the input itself is focused.
2011
+ this.focused = this.inputElement?.matches(':focus') ?? false;
2012
+ }
2013
+ __redispatchEvent(event) {
2014
+ redispatchEvent(this, event);
2015
+ }
2016
+ render() {
2017
+ return b `
2018
+ <base-field
2019
+ ?required=${this.required}
2020
+ ?disabled=${this.disabled}
2021
+ ?readonly=${this.readonly}
2022
+ ?skeleton=${this.skeleton}
2023
+ helper-text=${this.helperText}
2024
+ ?error=${this.error}
2025
+ error-text=${this.errorText}
2026
+ ?warning=${this.warning}
2027
+ variant=${this.variant}
2028
+ ?populated=${!!this.value}
2029
+ warning-text=${this.warningText}
2030
+ label=${this.label}
2031
+ ?focused=${this.focused}
2032
+ .host=${this}
2033
+ class="input-wrapper"
2034
+ >
2035
+ <slot name="start" slot="field-start"></slot>
2036
+
2037
+ <input
2038
+ class="input input-element"
2039
+ name=${this.name}
2040
+ type="time"
2041
+ placeholder=${this.placeholder}
2042
+ autocomplete=${this.autocomplete}
2043
+ .value=${this.value}
2044
+ ?tabindex=${this.tabindex}
2045
+ ?readonly=${this.readonly}
2046
+ ?required=${this.required}
2047
+ ?disabled=${this.disabled}
2048
+ @input=${this.__handleInput}
2049
+ @change=${this.__redispatchEvent}
2050
+ @focus=${this.__handleFocusChange}
2051
+ @blur=${this.__handleFocusChange}
2052
+ ${spread(this.configAria)}
2053
+ />
2054
+
2055
+ <slot name="end" slot="field-end"></slot>
2056
+
2057
+ <icon-button
2058
+ slot="field-end"
2059
+ color="secondary"
2060
+ variant="text"
2061
+ name="calendar_today"
2062
+ ?disabled=${this.disabled}
2063
+ @click=${() => {
2064
+ setTimeout(() => {
2065
+ // @ts-ignore
2066
+ this.inputElement.showPicker();
2067
+ });
2068
+ }}
2069
+ >
2070
+ </icon-button>
2071
+ </base-field>
2072
+ `;
2073
+ }
2074
+ }
2075
+ TimePicker.styles = [css_248z$2];
2076
+ __decorate([
2077
+ n({ type: String })
2078
+ ], TimePicker.prototype, "value", void 0);
2079
+ __decorate([
2080
+ n({ type: String })
2081
+ ], TimePicker.prototype, "name", void 0);
2082
+ __decorate([
2083
+ n({ type: String })
2084
+ ], TimePicker.prototype, "placeholder", void 0);
2085
+ __decorate([
2086
+ n({ type: String })
2087
+ ], TimePicker.prototype, "label", void 0);
2088
+ __decorate([
2089
+ n({ type: Boolean, reflect: true })
2090
+ ], TimePicker.prototype, "inline", void 0);
2091
+ __decorate([
2092
+ n({ type: String, reflect: true })
2093
+ ], TimePicker.prototype, "size", void 0);
2094
+ __decorate([
2095
+ n({ type: String })
2096
+ ], TimePicker.prototype, "autocomplete", void 0);
2097
+ __decorate([
2098
+ n({ type: Object })
2099
+ ], TimePicker.prototype, "configAria", void 0);
2100
+ __decorate([
2101
+ n({ type: String })
2102
+ ], TimePicker.prototype, "variant", void 0);
2103
+ __decorate([
2104
+ n({ type: String, attribute: 'helper-text' })
2105
+ ], TimePicker.prototype, "helperText", void 0);
2106
+ __decorate([
2107
+ n({ type: Boolean })
2108
+ ], TimePicker.prototype, "error", void 0);
2109
+ __decorate([
2110
+ n({ type: String, attribute: 'error-text' })
2111
+ ], TimePicker.prototype, "errorText", void 0);
2112
+ __decorate([
2113
+ n({ type: Boolean })
2114
+ ], TimePicker.prototype, "warning", void 0);
2115
+ __decorate([
2116
+ n({ type: String, attribute: 'warning-text' })
2117
+ ], TimePicker.prototype, "warningText", void 0);
2118
+ __decorate([
2119
+ r()
2120
+ ], TimePicker.prototype, "focused", void 0);
2121
+ __decorate([
2122
+ r()
2123
+ ], TimePicker.prototype, "passwordVisible", void 0);
2124
+ __decorate([
2125
+ r()
2126
+ ], TimePicker.prototype, "dirty", void 0);
2127
+ __decorate([
2128
+ e$1('.input-element')
2129
+ ], TimePicker.prototype, "inputElement", void 0);
2130
+
2131
+ var css_248z$1 = i`* {
2132
+ box-sizing: border-box;
2133
+ }
2134
+
2135
+ .screen-reader-only {
2136
+ display: none !important;
2137
+ }
2138
+
2139
+ :host {
2140
+ display: block;
2141
+ width: 100%;
2142
+ }
2143
+
2144
+ .input-element {
2145
+ border: none;
2146
+ outline: none;
2147
+ margin: 0;
2148
+ padding: 0;
2149
+ }
2150
+
2151
+ .input-wrapper .input {
2152
+ flex: 1;
2153
+ width: 100%;
2154
+ background: none;
2155
+ cursor: inherit;
2156
+ }
2157
+
2158
+ .textarea {
2159
+ height: 100%;
2160
+ position: relative;
2161
+ align-items: flex-start;
2162
+ --field-height: auto;
2163
+ --field-padding-block: var(--spacing-100);
2164
+ }
2165
+ .textarea .input {
2166
+ height: 100%;
2167
+ resize: vertical;
2168
+ }`;
2169
+
2170
+ /**
2171
+ * @label Textarea
2172
+ * @tag textarea-field
2173
+ * @rawTag textarea
2174
+ *
2175
+ * @summary The Textarea component is used to capture user input.
2176
+ *
2177
+ * @example
2178
+ * ```html
2179
+ * <textarea-field label="Name" required placeholder="Enter your name"></textarea-field>
2180
+ * ```
2181
+ */
2182
+ class Textarea extends BaseInput {
2183
+ constructor() {
2184
+ super(...arguments);
2185
+ this.value = '';
2186
+ this.name = '';
2187
+ this.placeholder = '';
2188
+ this.label = '';
2189
+ this.inline = false;
2190
+ this.size = 'md';
2191
+ this.autocomplete = 'off';
2192
+ this.configAria = {};
2193
+ this.variant = 'default';
2194
+ /**
2195
+ * Helper text to display below the input.
2196
+ */
2197
+ this.helperText = '';
2198
+ this.error = false;
2199
+ this.errorText = '';
2200
+ this.warning = false;
2201
+ this.warningText = '';
2202
+ this.rows = '3';
2203
+ this.focused = false;
2204
+ this.passwordVisible = false;
2205
+ /**
2206
+ * Returns true when the text field has been interacted with. Native
2207
+ * validation errors only display in response to user interactions.
2208
+ */
2209
+ this.dirty = false;
2210
+ }
2211
+ connectedCallback() {
2212
+ super.connectedCallback();
2213
+ this.handleInitialAttributes();
2214
+ }
2215
+ handleInitialAttributes() {
2216
+ if (this.hasAttribute('tabindex')) {
2217
+ this.tabindex = this.getAttribute('tabindex') || undefined;
2218
+ this.removeAttribute('tabindex');
2219
+ }
2220
+ Array.from(this.attributes).forEach(attr => {
2221
+ if (attr.name.startsWith('aria-')) {
2222
+ this.configAria[attr.name] = attr.value;
2223
+ this.removeAttribute(attr.name);
2224
+ }
2225
+ });
2226
+ }
2227
+ __handleInput(event) {
2228
+ this.dirty = true;
2229
+ this.value = event.target.value;
2230
+ }
2231
+ focus() {
2232
+ this.inputElement?.focus();
2233
+ }
2234
+ blur() {
2235
+ this.inputElement?.blur();
2236
+ }
2237
+ __handleFocusChange() {
2238
+ // When calling focus() or reportValidity() during change, it's possible
2239
+ // for blur to be called after the new focus event. Rather than set
2240
+ // `this.focused` to true/false on focus/blur, we always set it to whether
2241
+ // or not the input itself is focused.
2242
+ this.focused = this.inputElement?.matches(':focus') ?? false;
2243
+ }
2244
+ __redispatchEvent(event) {
2245
+ redispatchEvent(this, event);
2246
+ }
2247
+ render() {
2248
+ return b `
2249
+ <base-field
2250
+ ?required=${this.required}
2251
+ ?disabled=${this.disabled}
2252
+ ?readonly=${this.readonly}
2253
+ ?skeleton=${this.skeleton}
2254
+ helper-text=${this.helperText}
2255
+ ?error=${this.error}
2256
+ error-text=${this.errorText}
2257
+ ?warning=${this.warning}
2258
+ variant=${this.variant}
2259
+ ?populated=${!!this.value}
2260
+ warning-text=${this.warningText}
2261
+ label=${this.label}
2262
+ ?focused=${this.focused}
2263
+ .host=${this}
2264
+ class="input-wrapper textarea"
2265
+ >
2266
+ <slot name="start" slot="field-start"></slot>
2267
+
2268
+ <textarea
2269
+ class="input input-element"
2270
+ rows=${this.rows}
2271
+ name=${this.name}
2272
+ placeholder=${this.placeholder}
2273
+ autocomplete=${this.autocomplete}
2274
+ .value=${this.value}
2275
+ ?tabindex=${this.tabindex}
2276
+ ?readonly=${this.readonly}
2277
+ ?required=${this.required}
2278
+ ?disabled=${this.disabled}
2279
+ @input=${this.__handleInput}
2280
+ @change=${this.__redispatchEvent}
2281
+ @focus=${this.__handleFocusChange}
2282
+ @blur=${this.__handleFocusChange}
2283
+ ${spread(this.configAria)}
2284
+ ></textarea>
2285
+
2286
+ <slot name="end" slot="field-end"></slot>
2287
+ </base-field>
2288
+ `;
2289
+ }
2290
+ }
2291
+ Textarea.styles = [css_248z$1];
2292
+ __decorate([
2293
+ n({ type: String })
2294
+ ], Textarea.prototype, "value", void 0);
2295
+ __decorate([
2296
+ n({ type: String })
2297
+ ], Textarea.prototype, "name", void 0);
2298
+ __decorate([
2299
+ n({ type: String })
2300
+ ], Textarea.prototype, "placeholder", void 0);
2301
+ __decorate([
2302
+ n({ type: String })
2303
+ ], Textarea.prototype, "label", void 0);
2304
+ __decorate([
2305
+ n({ type: Boolean, reflect: true })
2306
+ ], Textarea.prototype, "inline", void 0);
2307
+ __decorate([
2308
+ n({ type: String, reflect: true })
2309
+ ], Textarea.prototype, "size", void 0);
2310
+ __decorate([
2311
+ n({ type: String })
2312
+ ], Textarea.prototype, "autocomplete", void 0);
2313
+ __decorate([
2314
+ n({ type: Object })
2315
+ ], Textarea.prototype, "configAria", void 0);
2316
+ __decorate([
2317
+ n({ type: String })
2318
+ ], Textarea.prototype, "variant", void 0);
2319
+ __decorate([
2320
+ n({ type: String, attribute: 'helper-text' })
2321
+ ], Textarea.prototype, "helperText", void 0);
2322
+ __decorate([
2323
+ n({ type: Boolean })
2324
+ ], Textarea.prototype, "error", void 0);
2325
+ __decorate([
2326
+ n({ type: String, attribute: 'error-text' })
2327
+ ], Textarea.prototype, "errorText", void 0);
2328
+ __decorate([
2329
+ n({ type: Boolean })
2330
+ ], Textarea.prototype, "warning", void 0);
2331
+ __decorate([
2332
+ n({ type: String, attribute: 'warning-text' })
2333
+ ], Textarea.prototype, "warningText", void 0);
2334
+ __decorate([
2335
+ n({ type: String })
2336
+ ], Textarea.prototype, "rows", void 0);
2337
+ __decorate([
2338
+ r()
2339
+ ], Textarea.prototype, "focused", void 0);
2340
+ __decorate([
2341
+ r()
2342
+ ], Textarea.prototype, "passwordVisible", void 0);
2343
+ __decorate([
2344
+ r()
2345
+ ], Textarea.prototype, "dirty", void 0);
2346
+ __decorate([
2347
+ e$1('.input-element')
2348
+ ], Textarea.prototype, "inputElement", void 0);
2349
+
2350
+ var css_248z = i`* {
2351
+ box-sizing: border-box;
2352
+ }
2353
+
2354
+ .screen-reader-only {
2355
+ display: none !important;
2356
+ }
2357
+
2358
+ :host {
2359
+ display: inline-block;
2360
+ --switch-track-color: var(--color-primary);
2361
+ --switch-track-off-color: var(--color-surface-container-highest);
2362
+ }
2363
+
2364
+ .switch {
2365
+ position: relative;
2366
+ display: flex;
2367
+ align-items: center;
2368
+ }
2369
+ .switch .input-native {
2370
+ position: absolute;
2371
+ width: 1px;
2372
+ height: 1px;
2373
+ padding: 0;
2374
+ margin: -1px;
2375
+ overflow: hidden;
2376
+ clip: rect(0, 0, 0, 0);
2377
+ border: 0;
2378
+ }
2379
+ .switch .label {
2380
+ font-family: var(--typography-label-medium-font-family) !important;
2381
+ font-size: var(--typography-label-medium-font-size) !important;
2382
+ font-weight: var(--typography-label-medium-font-weight) !important;
2383
+ line-height: var(--typography-label-medium-line-height) !important;
2384
+ letter-spacing: var(--typography-label-medium-letter-spacing) !important;
2385
+ }
2386
+ .switch.has-content {
2387
+ gap: var(--spacing-150);
2388
+ }
2389
+ .switch .track {
2390
+ position: relative;
2391
+ background: var(--switch-track-off-color);
2392
+ border: 2px solid var(--color-outline);
2393
+ border-radius: var(--shape-corner-full);
2394
+ cursor: pointer;
2395
+ display: flex;
2396
+ transition: background-color var(--duration-short2) var(--easing-standard);
2397
+ align-items: center;
2398
+ width: var(--_container-width);
2399
+ height: var(--_container-height);
2400
+ padding: 0 4px;
2401
+ }
2402
+ .switch .track .handle {
2403
+ display: flex;
2404
+ align-items: center;
2405
+ justify-content: center;
2406
+ border-radius: var(--shape-corner-full);
2407
+ transition: all var(--duration-short2) var(--easing-standard);
2408
+ background: white;
2409
+ height: var(--switch-handle-radius);
2410
+ width: var(--switch-handle-radius);
2411
+ background: var(--switch-handle-color);
2412
+ }
2413
+ .switch .track .handle .icon {
2414
+ --icon-size: .75rem;
2415
+ --icon-color: var(--switch-track-off-color);
2416
+ }
2417
+ .switch.has-focus:not(.active) .track {
2418
+ outline: 3px solid var(--color-primary);
2419
+ outline-offset: 2px;
2420
+ border-color: var(--color-white);
2421
+ }
2422
+ .switch.has-focus:not(.active):not(.state-checked) .handle {
2423
+ border-color: var(--icon-01);
2424
+ }
2425
+
2426
+ .toggle.state-checked .track {
2427
+ background: var(--switch-track-color);
2428
+ border-color: transparent;
2429
+ }
2430
+ .toggle.state-checked .handle {
2431
+ margin-inline-start: calc(100% - var(--switch-handle-radius));
2432
+ }
2433
+ .toggle.state-checked .handle .icon {
2434
+ --icon-size: 1rem;
2435
+ --icon-color: var(--switch-track-color);
2436
+ }
2437
+ .toggle.state-checked.active .track {
2438
+ border-color: var(--switch-track-color);
2439
+ }
2440
+ .toggle.state-checked.has-focus:not(.active) .track {
2441
+ outline: 3px solid var(--color-primary);
2442
+ outline-offset: 2px;
2443
+ border-color: var(--color-white);
2444
+ }
2445
+
2446
+ .toggle {
2447
+ --_container-width: 3.25rem;
2448
+ --_container-height: 2rem;
2449
+ --switch-handle-radius: 16px;
2450
+ --switch-handle-color: var(--color-outline);
2451
+ }
2452
+ .toggle.state-checked {
2453
+ --switch-handle-radius: 22px;
2454
+ --switch-handle-color: var(--color-surface-container-lowest);
2455
+ }
2456
+
2457
+ .toggle.readonly {
2458
+ cursor: default;
2459
+ }
2460
+ .toggle.readonly .track {
2461
+ border-color: var(--color-outline);
2462
+ background: var(--switch-track-off-color);
2463
+ opacity: 0.38;
2464
+ }
2465
+ .toggle.readonly .track .handle {
2466
+ background: var(--color-outline) !important;
2467
+ }
2468
+
2469
+ .toggle.disabled {
2470
+ cursor: not-allowed;
2471
+ }
2472
+ .toggle.disabled .track {
2473
+ border-color: var(--color-on-surface);
2474
+ background: var(--switch-track-off-color);
2475
+ opacity: 0.38;
2476
+ }
2477
+ .toggle.disabled .track .handle {
2478
+ background: var(--color-on-surface) !important;
2479
+ }`;
2480
+
2481
+ /**
2482
+ * @label Switch
2483
+ * @tag base-switch
2484
+ * @rawTag switch
2485
+ *
2486
+ * @summary Captures boolean input with an on/off switch interaction.
2487
+ * @overview
2488
+ * <p>Toggles are used to enable or disable a single option. They provide immediate feedback about whether an option is active or inactive.</p>
2489
+ *
2490
+ * @cssprop --switch-track-color: Color of the switch track when checked.
2491
+ * @cssprop --switch-track-off-color: Color of the switch track when unchecked.
2492
+ * @cssprop --switch-width: Width of the switch track.
2493
+ * @cssprop --switch-height: Height of the switch track.
2494
+ * @cssprop --switch-handle-radius: Size of the switch handle.
2495
+ * @cssprop --switch-handle-color: Color of the switch handle.
2496
+ *
2497
+ * @fires {CustomEvent} change - Dispatched when the switch value changes.
2498
+ * @fires {CustomEvent} blur - Dispatched when the switch loses focus.
2499
+ * @fires {CustomEvent} focus - Dispatched when the switch receives focus.
2500
+ *
2501
+ * @example
2502
+ * ```html
2503
+ * <base-switch value="true"></base-switch>
2504
+ * ```
2505
+ * @tags input, form
2506
+ */
2507
+ class Switch extends BaseInput {
2508
+ constructor() {
2509
+ super(...arguments);
2510
+ this.value = false;
2511
+ /**
2512
+ * The input field name.
2513
+ */
2514
+ this.name = '';
2515
+ /**
2516
+ * The switch label.
2517
+ */
2518
+ this.label = '';
2519
+ /**
2520
+ * If true, the toggle has rounded corners. Defaults to `true`.
2521
+ */
2522
+ this.rounded = true;
2523
+ /**
2524
+ * If true, required icon is shown. Defaults to `false`.
2525
+ */
2526
+ this.required = false;
2527
+ /**
2528
+ * If true, the toggle is readonly. Defaults to `false`.
2529
+ */
2530
+ this.readonly = false;
2531
+ /**
2532
+ * If true, the user cannot interact with the toggle. Defaults to `false`.
2533
+ */
2534
+ this.disabled = false;
2535
+ this.withIcon = false;
2536
+ /**
2537
+ * Configuration object for aria attributes.
2538
+ */
2539
+ this.configAria = {};
2540
+ this.hasFocus = false;
2541
+ this.isActive = false;
2542
+ this.slotHasContent = false;
2543
+ this.windowMouseUp = () => {
2544
+ if (this.isActive) {
2545
+ this.isActive = false;
2546
+ }
2547
+ };
2548
+ this.windowKeyUp = (evt) => {
2549
+ if (this.isActive && evt.key === ' ') {
2550
+ this.isActive = false;
2551
+ }
2552
+ };
2553
+ this.mouseDownHandler = () => {
2554
+ this.isActive = true;
2555
+ };
2556
+ this.keyDownHandler = (evt) => {
2557
+ if (evt.key === ' ') {
2558
+ evt.preventDefault();
2559
+ this.isActive = true;
2560
+ this.clickHandler(evt);
2561
+ }
2562
+ };
2563
+ this.clickHandler = (ev) => {
2564
+ if (!this.disabled && !this.readonly) {
2565
+ this.value = !this.value;
2566
+ this.dispatchEvent(new CustomEvent('change', {
2567
+ detail: { value: this.value, originalEvent: ev },
2568
+ bubbles: true,
2569
+ composed: true,
2570
+ }));
2571
+ this.trackElement?.focus();
2572
+ }
2573
+ };
2574
+ this.blurHandler = (ev) => {
2575
+ this.hasFocus = false;
2576
+ this.dispatchEvent(new CustomEvent('blur', {
2577
+ detail: ev,
2578
+ bubbles: true,
2579
+ composed: true,
2580
+ }));
2581
+ };
2582
+ this.focusHandler = (ev) => {
2583
+ this.hasFocus = true;
2584
+ this.dispatchEvent(new CustomEvent('focus', {
2585
+ detail: ev,
2586
+ bubbles: true,
2587
+ composed: true,
2588
+ }));
2589
+ };
2590
+ this.handleKeyUp = (evt) => {
2591
+ if (evt.key === 'Enter') {
2592
+ this.clickHandler(evt);
2593
+ }
2594
+ };
2595
+ }
2596
+ connectedCallback() {
2597
+ super.connectedCallback();
2598
+ this.handleInitialAttributes();
2599
+ window.addEventListener('mouseup', this.windowMouseUp);
2600
+ window.addEventListener('keyup', this.windowKeyUp);
2601
+ }
2602
+ disconnectedCallback() {
2603
+ super.disconnectedCallback();
2604
+ window.removeEventListener('mouseup', this.windowMouseUp);
2605
+ window.removeEventListener('keyup', this.windowKeyUp);
2606
+ }
2607
+ firstUpdated() {
2608
+ this.slotHasContent = this.hasChildNodes();
2609
+ }
2610
+ handleInitialAttributes() {
2611
+ if (this.hasAttribute('tabindex')) {
2612
+ this.tabindex = this.getAttribute('tabindex') || undefined;
2613
+ this.removeAttribute('tabindex');
2614
+ }
2615
+ Array.from(this.attributes).forEach(attr => {
2616
+ if (attr.name.startsWith('aria-')) {
2617
+ this.configAria[attr.name] = attr.value;
2618
+ this.removeAttribute(attr.name);
2619
+ }
2620
+ });
2621
+ }
2622
+ /**
2623
+ * Sets focus on the toggle.
2624
+ */
2625
+ focus() {
2626
+ this.trackElement?.focus();
2627
+ }
2628
+ /**
2629
+ * Removes focus from the toggle.
2630
+ */
2631
+ blur() {
2632
+ this.trackElement?.blur();
2633
+ }
2634
+ __renderIcon() {
2635
+ if (this.withIcon) {
2636
+ if (this.value)
2637
+ return b `<base-icon name="check" class="icon"></base-icon>`;
2638
+ return b `<base-icon name="close" class="icon"></base-icon>`;
2639
+ }
2640
+ return A;
2641
+ }
2642
+ render() {
2643
+ const cssClasses = {
2644
+ switch: true,
2645
+ 'state-checked': this.value,
2646
+ 'has-focus': this.hasFocus,
2647
+ active: this.isActive,
2648
+ disabled: this.disabled,
2649
+ readonly: this.readonly,
2650
+ required: this.required,
2651
+ rounded: this.rounded,
2652
+ 'has-content': this.slotHasContent,
2653
+ };
2654
+ return b `
2655
+ <label class=${e(cssClasses)}>
2656
+ <div
2657
+ class="track"
2658
+ tabindex=${this.tabindex || 0}
2659
+ @keyup=${this.handleKeyUp}
2660
+ @mousedown=${this.mouseDownHandler}
2661
+ @keydown=${this.keyDownHandler}
2662
+ @blur=${this.blurHandler}
2663
+ @focus=${this.focusHandler}
2664
+ role="checkbox"
2665
+ aria-disabled=${this.disabled}
2666
+ aria-required=${this.required}
2667
+ aria-checked=${this.value}
2668
+ ${spread(this.configAria)}
2669
+ >
2670
+ <div class="handle">${this.__renderIcon()}</div>
2671
+ </div>
2672
+
2673
+ <input
2674
+ type="checkbox"
2675
+ class="input-native"
2676
+ name=${this.name}
2677
+ .checked=${this.value}
2678
+ aria-hidden="true"
2679
+ ?required=${this.required}
2680
+ tabindex="-1"
2681
+ @click=${this.clickHandler}
2682
+ />
2683
+
2684
+ ${this.label
2685
+ ? b `<div class="label">${this.label}</div>`
2686
+ : b `<div class="slot-container"><slot></slot></div>`}
2687
+ </label>
2688
+ `;
2689
+ }
2690
+ }
2691
+ Switch.styles = [css_248z];
2692
+ __decorate([
2693
+ n({ type: Boolean })
2694
+ ], Switch.prototype, "value", void 0);
2695
+ __decorate([
2696
+ n({ type: String })
2697
+ ], Switch.prototype, "name", void 0);
2698
+ __decorate([
2699
+ n({ type: String })
2700
+ ], Switch.prototype, "label", void 0);
2701
+ __decorate([
2702
+ n({ type: Boolean })
2703
+ ], Switch.prototype, "rounded", void 0);
2704
+ __decorate([
2705
+ n({ type: Boolean, reflect: true })
2706
+ ], Switch.prototype, "required", void 0);
2707
+ __decorate([
2708
+ n({ type: Boolean, reflect: true })
2709
+ ], Switch.prototype, "readonly", void 0);
2710
+ __decorate([
2711
+ n({ type: Boolean, reflect: true })
2712
+ ], Switch.prototype, "disabled", void 0);
2713
+ __decorate([
2714
+ n({ type: Boolean, reflect: true, attribute: 'with-icon' })
2715
+ ], Switch.prototype, "withIcon", void 0);
2716
+ __decorate([
2717
+ n({ type: Object })
2718
+ ], Switch.prototype, "configAria", void 0);
2719
+ __decorate([
2720
+ r()
2721
+ ], Switch.prototype, "hasFocus", void 0);
2722
+ __decorate([
2723
+ r()
2724
+ ], Switch.prototype, "isActive", void 0);
2725
+ __decorate([
2726
+ r()
2727
+ ], Switch.prototype, "slotHasContent", void 0);
2728
+ __decorate([
2729
+ e$1('.track')
2730
+ ], Switch.prototype, "trackElement", void 0);
2731
+ __decorate([
2732
+ e$1('.input-native')
2733
+ ], Switch.prototype, "nativeElement", void 0);
2734
+
2735
+ export { Button as B, CircularProgress as C, DatePicker as D, IconButton as I, LinearProgress as L, NumberField as N, Switch as S, TimePicker as T, Input as a, Textarea as b };
2736
+ //# sourceMappingURL=switch-BCbVyXJW.js.map