@vonage/vivid 3.0.0-next.134 → 3.0.0-next.136

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 (91) hide show
  1. package/combobox/index.js +3 -1
  2. package/custom-elements.json +455 -0
  3. package/index.js +12 -6
  4. package/lib/components.d.ts +4 -0
  5. package/lib/menu-item/menu-item.d.ts +1 -0
  6. package/lib/number-field/number-field.d.ts +2 -2
  7. package/lib/select/definition.d.ts +3 -0
  8. package/lib/select/index.d.ts +1 -0
  9. package/lib/select/select.d.ts +17 -0
  10. package/lib/select/select.template.d.ts +4 -0
  11. package/lib/tab/definition.d.ts +3 -0
  12. package/lib/tab/index.d.ts +1 -0
  13. package/lib/tab/tab.d.ts +9 -0
  14. package/lib/tab/tab.template.d.ts +3 -0
  15. package/lib/tab-panel/definition.d.ts +3 -0
  16. package/lib/tab-panel/index.d.ts +1 -0
  17. package/lib/tab-panel/tab-panel.d.ts +3 -0
  18. package/lib/tab-panel/tab-panel.template.d.ts +2 -0
  19. package/lib/tabs/definition.d.ts +3 -0
  20. package/lib/tabs/index.d.ts +1 -0
  21. package/lib/tabs/tabs.d.ts +10 -0
  22. package/lib/tabs/tabs.template.d.ts +2 -0
  23. package/lib/text-area/text-area.d.ts +2 -2
  24. package/lib/text-field/text-field.d.ts +2 -2
  25. package/listbox/index.js +2 -0
  26. package/note/index.js +1 -0
  27. package/number-field/index.js +3 -3
  28. package/option/index.js +1 -0
  29. package/package.json +1 -1
  30. package/select/index.js +34 -0
  31. package/shared/definition.js +1 -1
  32. package/shared/definition11.js +1 -1
  33. package/shared/definition12.js +1 -1
  34. package/shared/definition13.js +1 -1
  35. package/shared/definition14.js +1 -1
  36. package/shared/definition16.js +1 -1
  37. package/shared/definition17.js +4 -11
  38. package/shared/definition19.js +2 -2
  39. package/shared/definition2.js +1 -1
  40. package/shared/definition20.js +1 -1
  41. package/shared/definition21.js +1 -1
  42. package/shared/definition22.js +1 -1
  43. package/shared/definition23.js +1 -1
  44. package/shared/definition25.js +2 -2
  45. package/shared/definition27.js +20 -8
  46. package/shared/definition29.js +1 -1
  47. package/shared/definition30.js +1 -1
  48. package/shared/definition31.js +3 -2
  49. package/shared/definition32.js +1 -1
  50. package/shared/definition33.js +1 -1
  51. package/shared/definition34.js +1 -1
  52. package/shared/definition35.js +1 -1
  53. package/shared/definition36.js +618 -70
  54. package/shared/definition37.js +66 -572
  55. package/shared/definition38.js +526 -81
  56. package/shared/definition39.js +85 -218
  57. package/shared/definition4.js +1 -1
  58. package/shared/definition40.js +51 -103
  59. package/shared/definition41.js +23 -68
  60. package/shared/definition42.js +440 -0
  61. package/shared/definition43.js +281 -0
  62. package/shared/definition44.js +119 -0
  63. package/shared/definition45.js +77 -0
  64. package/shared/definition5.js +1 -1
  65. package/shared/definition6.js +1 -1
  66. package/shared/definition7.js +1 -1
  67. package/shared/definition8.js +1 -1
  68. package/shared/definition9.js +1 -1
  69. package/shared/form-elements.js +19 -13
  70. package/shared/listbox.js +2 -9
  71. package/shared/numbers.js +10 -1
  72. package/shared/patterns/focus.d.ts +1 -1
  73. package/shared/patterns/form-elements/form-elements.d.ts +20 -8
  74. package/shared/select.options.js +10 -0
  75. package/shared/strings.js +9 -0
  76. package/shared/text-field.js +1 -1
  77. package/side-drawer/index.js +1 -1
  78. package/slider/index.js +1 -1
  79. package/styles/core/all.css +1 -1
  80. package/styles/core/theme.css +1 -1
  81. package/styles/core/typography.css +1 -1
  82. package/styles/tokens/theme-dark.css +4 -4
  83. package/styles/tokens/theme-light.css +4 -4
  84. package/switch/index.js +2 -1
  85. package/tab/index.js +16 -0
  86. package/tab-panel/index.js +4 -0
  87. package/tabs/index.js +24 -0
  88. package/text-area/index.js +1 -1
  89. package/text-field/index.js +1 -1
  90. package/tooltip/index.js +1 -1
  91. package/vivid.api.json +420 -0
@@ -1,22 +1,36 @@
1
- import { F as FoundationElement, _ as __decorate, a as attr, N as observable, b as __metadata, h as html, r as registerFactory } from './index.js';
2
- import { i as iconRegistries } from './definition3.js';
1
+ import { F as FoundationElement, _ as __decorate, a as attr, N as observable, Z as nullableNumberConverter, g as global$1, j as fails$1, i as functionUncurryThis, B as _export, b as __metadata, h as html, r as registerFactory } from './index.js';
3
2
  import { f as focusRegistries } from './definition4.js';
4
- import { C as CheckableFormAssociated } from './form-associated.js';
5
- import { a as keySpace, k as keyEnter } from './key-codes.js';
6
- import './affix.js';
3
+ import { t as toString$1 } from './to-string.js';
4
+ import { w as whitespaces$1, s as stringTrim } from './string-trim.js';
5
+ import './es.regexp.to-string.js';
6
+ import { D as Direction, g as getDirection } from './direction.js';
7
+ import { l as limit } from './numbers.js';
8
+ import { F as FormAssociated } from './form-associated.js';
9
+ import { O as Orientation } from './aria.js';
10
+ import { g as keyHome, d as keyEnd, f as keyArrowDown, h as keyArrowLeft, e as keyArrowUp, i as keyArrowRight } from './key-codes.js';
7
11
  import { f as focusTemplateFactory } from './focus2.js';
8
- import './icon.js';
9
- import { w as when } from './when.js';
12
+ import { r as ref } from './ref.js';
10
13
  import { c as classNames } from './class-names.js';
11
14
 
12
- class _Switch extends FoundationElement {
15
+ /**
16
+ * Converts a pixel coordinate on the track to a percent of the track's range
17
+ */
18
+ function convertPixelToPercent(pixelPos, minPosition, maxPosition, direction) {
19
+ let pct = limit(0, 1, (pixelPos - minPosition) / (maxPosition - minPosition));
20
+ if (direction === Direction.rtl) {
21
+ pct = 1 - pct;
22
+ }
23
+ return pct;
24
+ }
25
+
26
+ class _Slider extends FoundationElement {
13
27
  }
14
28
  /**
15
- * A form-associated base class for the {@link @microsoft/fast-foundation#(Switch:class)} component.
29
+ * A form-associated base class for the {@link @microsoft/fast-foundation#(Slider:class)} component.
16
30
  *
17
31
  * @internal
18
32
  */
19
- class FormAssociatedSwitch extends CheckableFormAssociated(_Switch) {
33
+ class FormAssociatedSlider extends FormAssociated(_Slider) {
20
34
  constructor() {
21
35
  super(...arguments);
22
36
  this.proxy = document.createElement("input");
@@ -24,124 +38,555 @@ class FormAssociatedSwitch extends CheckableFormAssociated(_Switch) {
24
38
  }
25
39
 
26
40
  /**
27
- * A Switch Custom HTML Element.
28
- * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#switch | ARIA switch }.
41
+ * The selection modes of a {@link @microsoft/fast-foundation#(Slider:class)}.
42
+ * @public
43
+ */
44
+ const SliderMode = {
45
+ singleValue: "single-value",
46
+ };
47
+ /**
48
+ * A Slider Custom HTML Element.
49
+ * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#slider | ARIA slider }.
29
50
  *
30
- * @slot - The deafult slot for the label
31
- * @slot checked-message - The message when in a checked state
32
- * @slot unchecked-message - The message when in an unchecked state
33
- * @csspart label - The label
34
- * @csspart switch - The element representing the switch, which wraps the indicator
35
- * @csspart status-message - The wrapper for the status messages
36
- * @csspart checked-message - The checked message
37
- * @csspart unchecked-message - The unchecked message
38
- * @fires change - Emits a custom change event when the checked state changes
51
+ * @slot track - The track of the slider
52
+ * @slot track-start - The track-start visual indicator
53
+ * @slot thumb - The slider thumb
54
+ * @slot - The default slot for labels
55
+ * @csspart positioning-region - The region used to position the elements of the slider
56
+ * @csspart track-container - The region containing the track elements
57
+ * @csspart track-start - The element wrapping the track start slot
58
+ * @csspart thumb-container - The thumb container element which is programatically positioned
59
+ * @fires change - Fires a custom 'change' event when the slider value changes
39
60
  *
40
61
  * @public
41
62
  */
42
- class Switch$1 extends FormAssociatedSwitch {
63
+ class Slider$1 extends FormAssociatedSlider {
43
64
  constructor() {
44
- super();
65
+ super(...arguments);
66
+ /**
67
+ * @internal
68
+ */
69
+ this.direction = Direction.ltr;
70
+ /**
71
+ * @internal
72
+ */
73
+ this.isDragging = false;
74
+ /**
75
+ * @internal
76
+ */
77
+ this.trackWidth = 0;
78
+ /**
79
+ * @internal
80
+ */
81
+ this.trackMinWidth = 0;
82
+ /**
83
+ * @internal
84
+ */
85
+ this.trackHeight = 0;
45
86
  /**
46
- * The element's value to be included in form submission when checked.
47
- * Default to "on" to reach parity with input[type="checkbox"]
48
- *
49
87
  * @internal
50
88
  */
51
- this.initialValue = "on";
89
+ this.trackLeft = 0;
52
90
  /**
53
91
  * @internal
54
92
  */
93
+ this.trackMinHeight = 0;
94
+ /**
95
+ * Custom function that generates a string for the component's "aria-valuetext" attribute based on the current value.
96
+ *
97
+ * @public
98
+ */
99
+ this.valueTextFormatter = () => null;
100
+ /**
101
+ * The minimum allowed value.
102
+ *
103
+ * @defaultValue - 0
104
+ * @public
105
+ * @remarks
106
+ * HTML Attribute: min
107
+ */
108
+ this.min = 0; // Map to proxy element.
109
+ /**
110
+ * The maximum allowed value.
111
+ *
112
+ * @defaultValue - 10
113
+ * @public
114
+ * @remarks
115
+ * HTML Attribute: max
116
+ */
117
+ this.max = 10; // Map to proxy element.
118
+ /**
119
+ * Value to increment or decrement via arrow keys, mouse click or drag.
120
+ *
121
+ * @public
122
+ * @remarks
123
+ * HTML Attribute: step
124
+ */
125
+ this.step = 1; // Map to proxy element.
126
+ /**
127
+ * The orientation of the slider.
128
+ *
129
+ * @public
130
+ * @remarks
131
+ * HTML Attribute: orientation
132
+ */
133
+ this.orientation = Orientation.horizontal;
134
+ /**
135
+ * The selection mode.
136
+ *
137
+ * @public
138
+ * @remarks
139
+ * HTML Attribute: mode
140
+ */
141
+ this.mode = SliderMode.singleValue;
55
142
  this.keypressHandler = (e) => {
56
143
  if (this.readOnly) {
57
144
  return;
58
145
  }
59
- switch (e.key) {
60
- case keyEnter:
61
- case keySpace:
62
- this.checked = !this.checked;
63
- break;
146
+ if (e.key === keyHome) {
147
+ e.preventDefault();
148
+ this.value = `${this.min}`;
149
+ }
150
+ else if (e.key === keyEnd) {
151
+ e.preventDefault();
152
+ this.value = `${this.max}`;
153
+ }
154
+ else if (!e.shiftKey) {
155
+ switch (e.key) {
156
+ case keyArrowRight:
157
+ case keyArrowUp:
158
+ e.preventDefault();
159
+ this.increment();
160
+ break;
161
+ case keyArrowLeft:
162
+ case keyArrowDown:
163
+ e.preventDefault();
164
+ this.decrement();
165
+ break;
166
+ }
167
+ }
168
+ };
169
+ this.setupTrackConstraints = () => {
170
+ const clientRect = this.track.getBoundingClientRect();
171
+ this.trackWidth = this.track.clientWidth;
172
+ this.trackMinWidth = this.track.clientLeft;
173
+ this.trackHeight = clientRect.bottom;
174
+ this.trackMinHeight = clientRect.top;
175
+ this.trackLeft = this.getBoundingClientRect().left;
176
+ if (this.trackWidth === 0) {
177
+ this.trackWidth = 1;
178
+ }
179
+ };
180
+ this.setupListeners = (remove = false) => {
181
+ const eventAction = `${remove ? "remove" : "add"}EventListener`;
182
+ this[eventAction]("keydown", this.keypressHandler);
183
+ this[eventAction]("mousedown", this.handleMouseDown);
184
+ this.thumb[eventAction]("mousedown", this.handleThumbMouseDown, {
185
+ passive: true,
186
+ });
187
+ this.thumb[eventAction]("touchstart", this.handleThumbMouseDown, {
188
+ passive: true,
189
+ });
190
+ // removes handlers attached by mousedown handlers
191
+ if (remove) {
192
+ this.handleMouseDown(null);
193
+ this.handleThumbMouseDown(null);
64
194
  }
65
195
  };
66
196
  /**
67
197
  * @internal
68
198
  */
69
- this.clickHandler = (e) => {
70
- if (!this.disabled && !this.readOnly) {
71
- this.checked = !this.checked;
199
+ this.initialValue = "";
200
+ /**
201
+ * Handle mouse moves during a thumb drag operation
202
+ * If the event handler is null it removes the events
203
+ */
204
+ this.handleThumbMouseDown = (event) => {
205
+ if (event) {
206
+ if (this.readOnly || this.disabled || event.defaultPrevented) {
207
+ return;
208
+ }
209
+ event.target.focus();
210
+ }
211
+ const eventAction = `${event !== null ? "add" : "remove"}EventListener`;
212
+ window[eventAction]("mouseup", this.handleWindowMouseUp);
213
+ window[eventAction]("mousemove", this.handleMouseMove, { passive: true });
214
+ window[eventAction]("touchmove", this.handleMouseMove, { passive: true });
215
+ window[eventAction]("touchend", this.handleWindowMouseUp);
216
+ this.isDragging = event !== null;
217
+ };
218
+ /**
219
+ * Handle mouse moves during a thumb drag operation
220
+ */
221
+ this.handleMouseMove = (e) => {
222
+ if (this.readOnly || this.disabled || e.defaultPrevented) {
223
+ return;
72
224
  }
225
+ // update the value based on current position
226
+ const sourceEvent = window.TouchEvent && e instanceof TouchEvent
227
+ ? e.touches[0]
228
+ : e;
229
+ const eventValue = this.orientation === Orientation.horizontal
230
+ ? sourceEvent.pageX - document.documentElement.scrollLeft - this.trackLeft
231
+ : sourceEvent.pageY - document.documentElement.scrollTop;
232
+ this.value = `${this.calculateNewValue(eventValue)}`;
233
+ };
234
+ this.calculateNewValue = (rawValue) => {
235
+ // update the value based on current position
236
+ const newPosition = convertPixelToPercent(rawValue, this.orientation === Orientation.horizontal
237
+ ? this.trackMinWidth
238
+ : this.trackMinHeight, this.orientation === Orientation.horizontal
239
+ ? this.trackWidth
240
+ : this.trackHeight, this.direction);
241
+ const newValue = (this.max - this.min) * newPosition + this.min;
242
+ return this.convertToConstrainedValue(newValue);
243
+ };
244
+ /**
245
+ * Handle a window mouse up during a drag operation
246
+ */
247
+ this.handleWindowMouseUp = (event) => {
248
+ this.stopDragging();
249
+ };
250
+ this.stopDragging = () => {
251
+ this.isDragging = false;
252
+ this.handleMouseDown(null);
253
+ this.handleThumbMouseDown(null);
254
+ };
255
+ /**
256
+ *
257
+ * @param e - MouseEvent or null. If there is no event handler it will remove the events
258
+ */
259
+ this.handleMouseDown = (e) => {
260
+ const eventAction = `${e !== null ? "add" : "remove"}EventListener`;
261
+ if (e === null || (!this.disabled && !this.readOnly)) {
262
+ window[eventAction]("mouseup", this.handleWindowMouseUp);
263
+ window.document[eventAction]("mouseleave", this.handleWindowMouseUp);
264
+ window[eventAction]("mousemove", this.handleMouseMove);
265
+ if (e) {
266
+ e.preventDefault();
267
+ this.setupTrackConstraints();
268
+ e.target.focus();
269
+ const controlValue = this.orientation === Orientation.horizontal
270
+ ? e.pageX - document.documentElement.scrollLeft - this.trackLeft
271
+ : e.pageY - document.documentElement.scrollTop;
272
+ this.value = `${this.calculateNewValue(controlValue)}`;
273
+ }
274
+ }
275
+ };
276
+ this.convertToConstrainedValue = (value) => {
277
+ if (isNaN(value)) {
278
+ value = this.min;
279
+ }
280
+ /**
281
+ * The following logic intends to overcome the issue with math in JavaScript with regards to floating point numbers.
282
+ * This is needed as the `step` may be an integer but could also be a float. To accomplish this the step is assumed to be a float
283
+ * and is converted to an integer by determining the number of decimal places it represent, multiplying it until it is an
284
+ * integer and then dividing it to get back to the correct number.
285
+ */
286
+ let constrainedValue = value - this.min;
287
+ const roundedConstrainedValue = Math.round(constrainedValue / this.step);
288
+ const remainderValue = constrainedValue -
289
+ (roundedConstrainedValue * (this.stepMultiplier * this.step)) /
290
+ this.stepMultiplier;
291
+ constrainedValue =
292
+ remainderValue >= Number(this.step) / 2
293
+ ? constrainedValue - remainderValue + Number(this.step)
294
+ : constrainedValue - remainderValue;
295
+ return constrainedValue + this.min;
73
296
  };
74
- this.proxy.setAttribute("type", "checkbox");
75
297
  }
76
298
  readOnlyChanged() {
77
299
  if (this.proxy instanceof HTMLInputElement) {
78
300
  this.proxy.readOnly = this.readOnly;
79
301
  }
80
- this.readOnly
81
- ? this.classList.add("readonly")
82
- : this.classList.remove("readonly");
302
+ }
303
+ /**
304
+ * The value property, typed as a number.
305
+ *
306
+ * @public
307
+ */
308
+ get valueAsNumber() {
309
+ return parseFloat(super.value);
310
+ }
311
+ set valueAsNumber(next) {
312
+ this.value = next.toString();
83
313
  }
84
314
  /**
85
315
  * @internal
86
316
  */
87
- checkedChanged(prev, next) {
88
- super.checkedChanged(prev, next);
89
- /**
90
- * @deprecated - this behavior already exists in the template and should not exist in the class.
91
- */
92
- this.checked ? this.classList.add("checked") : this.classList.remove("checked");
317
+ valueChanged(previous, next) {
318
+ super.valueChanged(previous, next);
319
+ if (this.$fastController.isConnected) {
320
+ this.setThumbPositionForOrientation(this.direction);
321
+ }
322
+ this.$emit("change");
323
+ }
324
+ minChanged() {
325
+ if (this.proxy instanceof HTMLInputElement) {
326
+ this.proxy.min = `${this.min}`;
327
+ }
328
+ this.validate();
329
+ }
330
+ maxChanged() {
331
+ if (this.proxy instanceof HTMLInputElement) {
332
+ this.proxy.max = `${this.max}`;
333
+ }
334
+ this.validate();
335
+ }
336
+ stepChanged() {
337
+ if (this.proxy instanceof HTMLInputElement) {
338
+ this.proxy.step = `${this.step}`;
339
+ }
340
+ this.updateStepMultiplier();
341
+ this.validate();
342
+ }
343
+ orientationChanged() {
344
+ if (this.$fastController.isConnected) {
345
+ this.setThumbPositionForOrientation(this.direction);
346
+ }
347
+ }
348
+ /**
349
+ * @internal
350
+ */
351
+ connectedCallback() {
352
+ super.connectedCallback();
353
+ this.proxy.setAttribute("type", "range");
354
+ this.direction = getDirection(this);
355
+ this.updateStepMultiplier();
356
+ this.setupTrackConstraints();
357
+ this.setupListeners();
358
+ this.setupDefaultValue();
359
+ this.setThumbPositionForOrientation(this.direction);
360
+ }
361
+ /**
362
+ * @internal
363
+ */
364
+ disconnectedCallback() {
365
+ this.setupListeners(true);
366
+ }
367
+ /**
368
+ * Increment the value by the step
369
+ *
370
+ * @public
371
+ */
372
+ increment() {
373
+ const newVal = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical
374
+ ? Number(this.value) + Number(this.step)
375
+ : Number(this.value) - Number(this.step);
376
+ const incrementedVal = this.convertToConstrainedValue(newVal);
377
+ const incrementedValString = incrementedVal < Number(this.max) ? `${incrementedVal}` : `${this.max}`;
378
+ this.value = incrementedValString;
379
+ }
380
+ /**
381
+ * Decrement the value by the step
382
+ *
383
+ * @public
384
+ */
385
+ decrement() {
386
+ const newVal = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical
387
+ ? Number(this.value) - Number(this.step)
388
+ : Number(this.value) + Number(this.step);
389
+ const decrementedVal = this.convertToConstrainedValue(newVal);
390
+ const decrementedValString = decrementedVal > Number(this.min) ? `${decrementedVal}` : `${this.min}`;
391
+ this.value = decrementedValString;
392
+ }
393
+ /**
394
+ * Places the thumb based on the current value
395
+ *
396
+ * @public
397
+ * @param direction - writing mode
398
+ */
399
+ setThumbPositionForOrientation(direction) {
400
+ const newPct = convertPixelToPercent(Number(this.value), Number(this.min), Number(this.max), direction);
401
+ const percentage = (1 - newPct) * 100;
402
+ if (this.orientation === Orientation.horizontal) {
403
+ this.position = this.isDragging
404
+ ? `right: ${percentage}%; transition: none;`
405
+ : `right: ${percentage}%; transition: all 0.2s ease;`;
406
+ }
407
+ else {
408
+ this.position = this.isDragging
409
+ ? `bottom: ${percentage}%; transition: none;`
410
+ : `bottom: ${percentage}%; transition: all 0.2s ease;`;
411
+ }
412
+ }
413
+ /**
414
+ * Update the step multiplier used to ensure rounding errors from steps that
415
+ * are not whole numbers
416
+ */
417
+ updateStepMultiplier() {
418
+ const stepString = this.step + "";
419
+ const decimalPlacesOfStep = !!(this.step % 1)
420
+ ? stepString.length - stepString.indexOf(".") - 1
421
+ : 0;
422
+ this.stepMultiplier = Math.pow(10, decimalPlacesOfStep);
423
+ }
424
+ get midpoint() {
425
+ return `${this.convertToConstrainedValue((this.max + this.min) / 2)}`;
426
+ }
427
+ setupDefaultValue() {
428
+ if (typeof this.value === "string") {
429
+ if (this.value.length === 0) {
430
+ this.initialValue = this.midpoint;
431
+ }
432
+ else {
433
+ const value = parseFloat(this.value);
434
+ if (!Number.isNaN(value) && (value < this.min || value > this.max)) {
435
+ this.value = this.midpoint;
436
+ }
437
+ }
438
+ }
93
439
  }
94
440
  }
95
441
  __decorate([
96
442
  attr({ attribute: "readonly", mode: "boolean" })
97
- ], Switch$1.prototype, "readOnly", void 0);
443
+ ], Slider$1.prototype, "readOnly", void 0);
444
+ __decorate([
445
+ observable
446
+ ], Slider$1.prototype, "direction", void 0);
447
+ __decorate([
448
+ observable
449
+ ], Slider$1.prototype, "isDragging", void 0);
98
450
  __decorate([
99
451
  observable
100
- ], Switch$1.prototype, "defaultSlottedNodes", void 0);
452
+ ], Slider$1.prototype, "position", void 0);
453
+ __decorate([
454
+ observable
455
+ ], Slider$1.prototype, "trackWidth", void 0);
456
+ __decorate([
457
+ observable
458
+ ], Slider$1.prototype, "trackMinWidth", void 0);
459
+ __decorate([
460
+ observable
461
+ ], Slider$1.prototype, "trackHeight", void 0);
462
+ __decorate([
463
+ observable
464
+ ], Slider$1.prototype, "trackLeft", void 0);
465
+ __decorate([
466
+ observable
467
+ ], Slider$1.prototype, "trackMinHeight", void 0);
468
+ __decorate([
469
+ observable
470
+ ], Slider$1.prototype, "valueTextFormatter", void 0);
471
+ __decorate([
472
+ attr({ converter: nullableNumberConverter })
473
+ ], Slider$1.prototype, "min", void 0);
474
+ __decorate([
475
+ attr({ converter: nullableNumberConverter })
476
+ ], Slider$1.prototype, "max", void 0);
477
+ __decorate([
478
+ attr({ converter: nullableNumberConverter })
479
+ ], Slider$1.prototype, "step", void 0);
480
+ __decorate([
481
+ attr
482
+ ], Slider$1.prototype, "orientation", void 0);
483
+ __decorate([
484
+ attr
485
+ ], Slider$1.prototype, "mode", void 0);
486
+
487
+ var css_248z = ":host {\n display: inline-block;\n width: 100%;\n}\n\n:host([orientation=vertical]) {\n height: 100%;\n min-height: calc(var(--_thumb-interaction-indicator-size) * 5);\n}\n\n.control {\n --_thumb-size: 12px;\n --_thumb-interaction-indicator-size: 36px;\n height: var(--_thumb-interaction-indicator-size);\n cursor: pointer;\n outline: none;\n user-select: none;\n}\n@supports selector(:focus-visible) {\n .control:focus {\n outline: none;\n }\n}\n.control .positioning-region {\n position: relative;\n}\n.control .track {\n position: absolute;\n background: var(--_track-background-color);\n border-radius: 4px;\n}\n.control .track .track-start {\n position: absolute;\n left: 0;\n height: 100%;\n background: var(--_track-start-background-color);\n border-radius: 4px;\n}\n.control .thumb-container {\n position: absolute;\n width: var(--_thumb-interaction-indicator-size);\n height: var(--_thumb-interaction-indicator-size);\n cursor: inherit;\n touch-action: none;\n}\n.control .thumb-container::before {\n position: absolute;\n display: block;\n width: var(--_thumb-interaction-indicator-size);\n height: var(--_thumb-interaction-indicator-size);\n background-color: var(--_track-start-background-color);\n border-radius: 50%;\n content: \"\";\n opacity: var(--_thumb-interaction-indicator-alpha, 0);\n transition: opacity 0.2s ease-out 0s;\n}\n.control .thumb-container::after {\n position: absolute;\n display: block;\n width: var(--_thumb-size);\n height: var(--_thumb-size);\n background-color: var(--_track-start-background-color);\n border-radius: 50%;\n content: \"\";\n inset: calc((var(--_thumb-interaction-indicator-size) - var(--_thumb-size)) / 2);\n}\n.control[aria-orientation=horizontal] {\n width: calc(100% - var(--_thumb-size));\n min-width: var(--_thumb-size);\n margin-left: calc(var(--_thumb-size) / 2);\n}\n.control[aria-orientation=horizontal] .track {\n top: calc((var(--_thumb-interaction-indicator-size) - 2px) / 2);\n right: 0;\n left: 0;\n height: 2px;\n}\n.control[aria-orientation=horizontal] .track .mark {\n width: 100%;\n height: 4px;\n}\n.control[aria-orientation=horizontal] .thumb-container {\n transform: translateX(calc(var(--_thumb-interaction-indicator-size) / 2));\n}\n.control[aria-orientation=vertical] {\n height: calc(100% - var(--_thumb-interaction-indicator-size));\n min-height: var(--_thumb-interaction-indicator-size);\n margin-top: calc(var(--_thumb-interaction-indicator-size) / 2);\n}\n.control[aria-orientation=vertical] .positioning-region {\n height: 100%;\n}\n.control[aria-orientation=vertical] .track {\n left: calc((var(--_thumb-interaction-indicator-size) - 2px) / 2);\n width: 2px;\n height: 100%;\n}\n.control[aria-orientation=vertical] .track .mark {\n width: 4px;\n height: 100%;\n}\n.control[aria-orientation=vertical] .track-start {\n top: 0;\n width: 100%;\n height: auto;\n}\n.control[aria-orientation=vertical] .thumb-container {\n transform: translateY(calc(var(--_thumb-interaction-indicator-size) / 2));\n}\n.control.disabled {\n --_track-background-color: var(--vvd-color-neutral-100);\n --_track-start-background-color: var(--vvd-color-neutral-500);\n cursor: not-allowed;\n}\n.control:not(.disabled) {\n --_track-background-color: var(--vvd-color-neutral-300);\n --_track-start-background-color: var(--vvd-color-canvas-text);\n}\n.control:not(.disabled) .thumb-container:hover {\n --_thumb-interaction-indicator-alpha: 0.12;\n}\n.control:not(.disabled) .thumb-container:active {\n --_thumb-interaction-indicator-alpha: 0.25;\n}\n\n.focus-indicator {\n --focus-inset: -3px;\n --focus-stroke-gap-color: transparent;\n border-radius: 50%;\n}\n.control:not(:focus-visible) .focus-indicator {\n display: none;\n}";
488
+
489
+ var global = global$1;
490
+ var fails = fails$1;
491
+ var uncurryThis = functionUncurryThis;
492
+ var toString = toString$1;
493
+ var trim = stringTrim.trim;
494
+ var whitespaces = whitespaces$1;
101
495
 
102
- var css_248z = "/**\n * Do not edit directly\n * Generated on Thu, 12 Jan 2023 07:26:42 GMT\n */\n.control {\n display: inline-flex;\n gap: 8px;\n}\n.control.connotation-cta {\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-primary: var(--vvd-color-cta-500);\n --_connotation-color-primary-increment: var(--vvd-color-cta-600);\n --_connotation-color-backdrop: var(--vvd-color-cta-50);\n --_connotation-color-firm: var(--vvd-color-cta-600);\n --_connotation-color-intermediate: var(--vvd-color-cta-500);\n}\n.control.connotation-alert {\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-primary: var(--vvd-color-alert-500);\n --_connotation-color-primary-increment: var(--vvd-color-alert-600);\n --_connotation-color-backdrop: var(--vvd-color-alert-50);\n --_connotation-color-firm: var(--vvd-color-alert-600);\n --_connotation-color-intermediate: var(--vvd-color-alert-500);\n}\n.control.connotation-success {\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-primary: var(--vvd-color-success-500);\n --_connotation-color-primary-increment: var(--vvd-color-success-600);\n --_connotation-color-backdrop: var(--vvd-color-success-50);\n --_connotation-color-firm: var(--vvd-color-success-600);\n --_connotation-color-intermediate: var(--vvd-color-success-500);\n}\n.control:not(.connotation-cta, .connotation-alert, .connotation-success) {\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-primary-increment: var(--vvd-color-neutral-800);\n --_connotation-color-backdrop: var(--vvd-color-canvas);\n --_connotation-color-firm: var(--vvd-color-canvas-text);\n --_connotation-color-intermediate: var(--vvd-color-neutral-500);\n}\n.control {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-intermediate);\n}\n.control.appearance-filled {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: transparent;\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-filled {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary-increment);\n --_appearance-color-outline: transparent;\n}\n.control:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.control:where(:disabled, .disabled).appearance-filled {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: transparent;\n}\n.control:where(.readonly):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.control:where(.readonly):where(:not(:disabled, .disabled)).appearance-filled {\n --_appearance-color-text: var(--vvd-color-neutral-800);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: transparent;\n}\n@supports selector(:focus-visible) {\n .control:focus {\n outline: none;\n }\n}\n@supports (user-select: none) {\n .control {\n user-select: none;\n }\n}\n.control:not(.disabled) {\n cursor: pointer;\n}\n.control.disabled {\n cursor: not-allowed;\n}\n\n.switch {\n --_switch-inline-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) * 1.8);\n position: relative;\n display: flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20));\n border-radius: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) / .5);\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n inline-size: var(--_switch-inline-size);\n transition: all 0.2s ease-in-out 0s;\n}\n\n.checked-indicator {\n --_switch-checked-indicator-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) / 1.6667);\n --_switch-gutter: calc(var(--_switch-checked-indicator-size) / 3);\n block-size: var(--_switch-checked-indicator-size);\n border-radius: inherit;\n inline-size: var(--_switch-checked-indicator-size);\n margin-inline-start: auto;\n transition: all 0.2s ease-in-out 0s;\n}\n.control.appearance-filled .checked-indicator {\n background-color: var(--vvd-color-neutral-100);\n}\n.control:not(.appearance-filled) .checked-indicator {\n background-color: var(--_appearance-color-outline);\n}\n.control:not(.checked) .checked-indicator {\n transform: translateX(calc(-1 * var(--_switch-inline-size) + var(--_switch-checked-indicator-size) + var(--_switch-gutter)));\n}\n.control.checked .checked-indicator {\n transform: translateX(calc(-1 * var(--_switch-gutter)));\n}\n\n.label {\n color: var(--vvd-color-canvas-text);\n cursor: pointer;\n font: var(--vvd-typography-base);\n}\n\n.focus-indicator {\n --focus-inset: -4px;\n --focus-stroke-gap-color: transparent;\n border-radius: 14px;\n}\n.control:not(:focus-visible) .focus-indicator {\n display: none;\n}";
496
+ var charAt = uncurryThis(''.charAt);
497
+ var $parseFloat$1 = global.parseFloat;
498
+ var Symbol = global.Symbol;
499
+ var ITERATOR = Symbol && Symbol.iterator;
500
+ var FORCED = 1 / $parseFloat$1(whitespaces + '-0') !== -Infinity
501
+ // MS Edge 18- broken with boxed symbols
502
+ || (ITERATOR && !fails(function () { $parseFloat$1(Object(ITERATOR)); }));
503
+
504
+ // `parseFloat` method
505
+ // https://tc39.es/ecma262/#sec-parsefloat-string
506
+ var numberParseFloat = FORCED ? function parseFloat(string) {
507
+ var trimmedString = trim(toString(string));
508
+ var result = $parseFloat$1(trimmedString);
509
+ return result === 0 && charAt(trimmedString, 0) == '-' ? -0 : result;
510
+ } : $parseFloat$1;
511
+
512
+ var $ = _export;
513
+ var $parseFloat = numberParseFloat;
514
+
515
+ // `parseFloat` method
516
+ // https://tc39.es/ecma262/#sec-parsefloat-string
517
+ $({ global: true, forced: parseFloat != $parseFloat }, {
518
+ parseFloat: $parseFloat
519
+ });
103
520
 
104
- class Switch extends Switch$1 {}
105
- __decorate([attr, __metadata("design:type", String)], Switch.prototype, "label", void 0);
106
- __decorate([attr, __metadata("design:type", String)], Switch.prototype, "connotation", void 0);
521
+ class Slider extends Slider$1 {
522
+ constructor() {
523
+ super(...arguments);
524
+ this.markers = false;
525
+ }
526
+ valueChanged(previous, next) {
527
+ if (this.$fastController.isConnected) {
528
+ const nextAsNumber = parseFloat(next);
529
+ const value = Math.min(Math.max(this['convertToConstrainedValue'](nextAsNumber), this.min), this.max).toString();
530
+ if (value !== next) {
531
+ this.value = value;
532
+ return;
533
+ }
534
+ super.valueChanged(previous, next);
535
+ this['setThumbPositionForOrientation'](this.direction);
536
+ this.$emit('change');
537
+ }
538
+ }
539
+ }
540
+ __decorate([attr({
541
+ mode: 'boolean'
542
+ }), __metadata("design:type", Object)], Slider.prototype, "markers", void 0);
107
543
 
108
- let _2 = t => t,
544
+ let _ = t => t,
109
545
  _t,
110
546
  _t2;
111
- const getClasses = _ => classNames('control', ['appearance-filled', _.checked && !_.disabled && !_.readOnly], ['checked', _.checked], ['disabled', _.disabled], ['readonly', _.readOnly], [`connotation-${_.connotation}`, Boolean(_.checked) && Boolean(_.connotation)]);
112
- const SwitchTemplate = context => {
547
+ const getClasses = ({
548
+ disabled
549
+ }) => classNames('control', ['disabled', Boolean(disabled)]);
550
+ const getMarkersTemplate = (isHorizontal, numMarkers) => {
551
+ const placeholder = isHorizontal ? ['right', 'center', '', '100% repeat-x'] : ['bottom', 'top', '100%', 'repeat-y'];
552
+ return html(_t || (_t = _`
553
+ <div class="mark" style="
554
+ background: linear-gradient(to ${0}, currentcolor 3px, transparent 0px)
555
+ 0px ${0} / ${0} calc((100% - 3px) / ${0}) ${0}
556
+ "></div>`), placeholder[0], placeholder[1], placeholder[2], numMarkers, placeholder[3]);
557
+ };
558
+ const SliderTemplate = context => {
113
559
  const focusTemplate = focusTemplateFactory(context);
114
- return html(_t || (_t = _2`
115
- <div
116
- class="${0}"
117
- role="switch"
118
- aria-checked="${0}"
119
- aria-disabled="${0}"
120
- aria-readonly="${0}"
121
- tabindex="${0}"
122
- @keypress="${0}"
123
- @click="${0}"
124
- >
125
- <div class="switch">
126
- <span class="checked-indicator"></span>
560
+ return html(_t2 || (_t2 = _`
561
+ <div
562
+ role="slider"
563
+ tabindex="${0}"
564
+ aria-valuetext="${0}"
565
+ aria-valuenow="${0}"
566
+ aria-valuemin="${0}"
567
+ aria-valuemax="${0}"
568
+ aria-disabled="${0}"
569
+ aria-orientation="${0}"
570
+ class="${0} ${0}"
571
+ >
572
+ <div class="positioning-region">
573
+ <div ${0} class="track">
574
+ <div class="track-start" style="${0}"></div>
127
575
  ${0}
128
576
  </div>
129
- ${0}
130
- </div>
131
- `), getClasses, x => x.checked, x => x.disabled, x => x.readOnly, x => x.disabled ? null : 0, (x, c) => x.keypressHandler(c.event), (x, c) => x.clickHandler(c.event), () => focusTemplate, when(x => x.label, html(_t2 || (_t2 = _2`<div class="label">
577
+ <div ${0} class="thumb-container" style="${0}">
132
578
  ${0}
133
- </div>`), x => x.label)));
579
+ </div>
580
+ </div>
581
+ </div>`), x => x.disabled ? null : 0, x => x.valueTextFormatter(x.value), x => x.value, x => x.min, x => x.max, x => x.disabled ? true : void 0, x => x.orientation, getClasses, x => x.orientation, ref('track'), x => x.position, x => x.markers ? getMarkersTemplate(x.orientation === Orientation.horizontal, Math.floor((x.max - x.min) / x.step)) : void 0, ref('thumb'), x => x.position, () => focusTemplate);
134
582
  };
135
583
 
136
- const switchDefinition = Switch.compose({
137
- baseName: 'switch',
138
- template: SwitchTemplate,
139
- styles: css_248z,
140
- shadowOptions: {
141
- delegatesFocus: true
142
- }
584
+ const sliderDefinition = Slider.compose({
585
+ baseName: 'slider',
586
+ template: SliderTemplate,
587
+ styles: css_248z
143
588
  });
144
- const switchRegistries = [switchDefinition(), ...iconRegistries, ...focusRegistries];
145
- const registerSwitch = registerFactory(switchRegistries);
589
+ const sliderRegistries = [sliderDefinition(), ...focusRegistries];
590
+ const registerSlider = registerFactory(sliderRegistries);
146
591
 
147
- export { switchRegistries as a, registerSwitch as r, switchDefinition as s };
592
+ export { sliderRegistries as a, registerSlider as r, sliderDefinition as s };