@vonage/vivid 4.5.0 → 4.6.0

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 (170) hide show
  1. package/custom-elements.json +1091 -187
  2. package/elevation/index.cjs +1 -1
  3. package/elevation/index.js +1 -1
  4. package/index.cjs +62 -56
  5. package/index.js +20 -19
  6. package/lib/components.d.ts +1 -0
  7. package/lib/menu/menu.d.ts +2 -1
  8. package/lib/number-field/number-field.d.ts +3 -1
  9. package/lib/searchable-select/definition.d.ts +4 -0
  10. package/lib/searchable-select/locale.d.ts +6 -0
  11. package/lib/searchable-select/option-tag.d.ts +14 -0
  12. package/lib/searchable-select/option-tag.template.d.ts +4 -0
  13. package/lib/searchable-select/searchable-select.d.ts +29 -0
  14. package/lib/searchable-select/searchable-select.form-associated.d.ts +10 -0
  15. package/lib/searchable-select/searchable-select.template.d.ts +4 -0
  16. package/lib/select/select.d.ts +3 -1
  17. package/lib/tab/locale.d.ts +3 -0
  18. package/lib/tab/tab.d.ts +5 -1
  19. package/lib/tag/definition.d.ts +1 -0
  20. package/lib/text-field/text-field.d.ts +3 -1
  21. package/locales/de-DE.cjs +12 -0
  22. package/locales/de-DE.js +12 -0
  23. package/locales/en-GB.cjs +12 -0
  24. package/locales/en-GB.js +12 -0
  25. package/locales/en-US.cjs +12 -0
  26. package/locales/en-US.js +12 -0
  27. package/locales/ja-JP.cjs +12 -0
  28. package/locales/ja-JP.js +12 -0
  29. package/locales/zh-CN.cjs +12 -0
  30. package/locales/zh-CN.js +12 -0
  31. package/package.json +1 -1
  32. package/popup/index.cjs +1 -1
  33. package/popup/index.js +1 -1
  34. package/searchable-select/index.cjs +5 -0
  35. package/searchable-select/index.js +3 -0
  36. package/select/index.cjs +1 -1
  37. package/select/index.js +1 -1
  38. package/selectable-box/index.cjs +1 -1
  39. package/selectable-box/index.js +1 -1
  40. package/shared/definition11.cjs +1 -1
  41. package/shared/definition11.js +1 -1
  42. package/shared/definition14.cjs +1 -1
  43. package/shared/definition14.js +1 -1
  44. package/shared/definition16.cjs +1 -1
  45. package/shared/definition16.js +1 -1
  46. package/shared/definition18.cjs +2 -2
  47. package/shared/definition18.js +2 -2
  48. package/shared/definition19.cjs +2 -2
  49. package/shared/definition19.js +2 -2
  50. package/shared/definition20.cjs +14 -34
  51. package/shared/definition20.js +14 -34
  52. package/shared/definition21.cjs +1 -1
  53. package/shared/definition21.js +1 -1
  54. package/shared/definition26.cjs +1 -1
  55. package/shared/definition26.js +1 -1
  56. package/shared/definition29.cjs +4 -0
  57. package/shared/definition29.js +4 -0
  58. package/shared/definition30.cjs +2 -1
  59. package/shared/definition30.js +2 -1
  60. package/shared/definition35.cjs +12 -7
  61. package/shared/definition35.js +12 -7
  62. package/shared/definition36.cjs +50 -207
  63. package/shared/definition36.js +51 -207
  64. package/shared/definition4.cjs +1 -1
  65. package/shared/definition4.js +1 -1
  66. package/shared/definition42.cjs +1 -1
  67. package/shared/definition42.js +1 -1
  68. package/shared/definition43.cjs +993 -645
  69. package/shared/definition43.js +989 -642
  70. package/shared/definition44.cjs +723 -112
  71. package/shared/definition44.js +722 -111
  72. package/shared/definition45.cjs +121 -80
  73. package/shared/definition45.js +119 -78
  74. package/shared/definition46.cjs +81 -614
  75. package/shared/definition46.js +80 -612
  76. package/shared/definition47.cjs +608 -114
  77. package/shared/definition47.js +606 -113
  78. package/shared/definition48.cjs +116 -134
  79. package/shared/definition48.js +115 -133
  80. package/shared/definition49.cjs +149 -19
  81. package/shared/definition49.js +148 -18
  82. package/shared/definition5.cjs +1 -1
  83. package/shared/definition5.js +1 -1
  84. package/shared/definition50.cjs +21 -82
  85. package/shared/definition50.js +20 -81
  86. package/shared/definition51.cjs +77 -539
  87. package/shared/definition51.js +76 -538
  88. package/shared/definition52.cjs +568 -28
  89. package/shared/definition52.js +567 -27
  90. package/shared/definition53.cjs +28 -123
  91. package/shared/definition53.js +26 -122
  92. package/shared/definition54.cjs +115 -295
  93. package/shared/definition54.js +114 -294
  94. package/shared/definition55.cjs +251 -311
  95. package/shared/definition55.js +251 -311
  96. package/shared/definition56.cjs +299 -780
  97. package/shared/definition56.js +298 -779
  98. package/shared/definition57.cjs +800 -102
  99. package/shared/definition57.js +799 -101
  100. package/shared/definition58.cjs +92 -63
  101. package/shared/definition58.js +91 -62
  102. package/shared/definition59.cjs +117 -75
  103. package/shared/definition59.js +116 -74
  104. package/shared/definition60.cjs +70 -285
  105. package/shared/definition60.js +71 -286
  106. package/shared/definition61.cjs +274 -66146
  107. package/shared/definition61.js +273 -66145
  108. package/shared/definition62.cjs +66160 -27
  109. package/shared/definition62.js +66158 -25
  110. package/shared/definition63.cjs +24 -1952
  111. package/shared/definition63.js +23 -1950
  112. package/shared/definition64.cjs +1976 -0
  113. package/shared/definition64.js +1971 -0
  114. package/shared/listbox-option.cjs +204 -0
  115. package/shared/listbox-option.js +201 -0
  116. package/shared/listbox.cjs +3 -3
  117. package/shared/listbox.js +1 -1
  118. package/shared/localization/Locale.d.ts +4 -0
  119. package/shared/presentationDate.cjs +2 -2
  120. package/shared/presentationDate.js +2 -2
  121. package/shared/scrollIntoView.cjs +51 -0
  122. package/shared/scrollIntoView.js +49 -0
  123. package/shared/slider.template.cjs +1 -1
  124. package/shared/slider.template.js +1 -1
  125. package/shared/text-field.cjs +1 -1
  126. package/shared/text-field.js +1 -1
  127. package/shared/utils/scrollIntoView.d.ts +1 -0
  128. package/side-drawer/index.cjs +1 -1
  129. package/side-drawer/index.js +1 -1
  130. package/slider/index.cjs +1 -1
  131. package/slider/index.js +1 -1
  132. package/split-button/index.cjs +1 -1
  133. package/split-button/index.js +1 -1
  134. package/styles/core/all.css +1 -1
  135. package/styles/core/theme.css +1 -1
  136. package/styles/core/typography.css +1 -1
  137. package/styles/tokens/theme-dark.css +4 -4
  138. package/styles/tokens/theme-light.css +4 -4
  139. package/styles/tokens/vivid-2-compat.css +1 -1
  140. package/switch/index.cjs +1 -1
  141. package/switch/index.js +1 -1
  142. package/tab/index.cjs +1 -1
  143. package/tab/index.js +1 -1
  144. package/tab-panel/index.cjs +1 -1
  145. package/tab-panel/index.js +1 -1
  146. package/tabs/index.cjs +1 -1
  147. package/tabs/index.js +1 -1
  148. package/tag/index.cjs +1 -1
  149. package/tag/index.js +1 -1
  150. package/tag-group/index.cjs +1 -1
  151. package/tag-group/index.js +1 -1
  152. package/text-area/index.cjs +1 -1
  153. package/text-area/index.js +1 -1
  154. package/text-field/index.cjs +1 -1
  155. package/text-field/index.js +1 -1
  156. package/time-picker/index.cjs +1 -1
  157. package/time-picker/index.js +1 -1
  158. package/toggletip/index.cjs +1 -1
  159. package/toggletip/index.js +1 -1
  160. package/tooltip/index.cjs +1 -1
  161. package/tooltip/index.js +1 -1
  162. package/tree-item/index.cjs +1 -1
  163. package/tree-item/index.js +1 -1
  164. package/tree-view/index.cjs +1 -1
  165. package/tree-view/index.js +1 -1
  166. package/video-player/index.cjs +1 -1
  167. package/video-player/index.js +1 -1
  168. package/vivid.api.json +295 -0
  169. package/api-extractor.json +0 -25
  170. package/tsdoc-metadata.json +0 -11
@@ -1,638 +1,106 @@
1
- import { F as FoundationElement, _ as __decorate, a as attr, o as observable, n as nullableNumberConverter, v as volatile, r as registerFactory } from './index.js';
2
- import { p as popupRegistries } from './definition63.js';
3
- import { D as Direction, g as getDirection } from './direction.js';
4
- import { l as limit } from './numbers.js';
5
- import { F as FormAssociated } from './form-associated.js';
6
- import { O as Orientation } from './aria2.js';
7
- import { g as keyHome, d as keyEnd, f as keyArrowDown, i as keyArrowLeft, e as keyArrowUp, h as keyArrowRight } from './key-codes.js';
8
- import { l as limit$1, S as SliderTemplate } from './slider.template.js';
9
- import { a as applyMixins } from './apply-mixins.js';
10
- import { L as Localized } from './localized.js';
11
-
12
- /**
13
- * Converts a pixel coordinate on the track to a percent of the track's range
14
- */
15
- function convertPixelToPercent(pixelPos, minPosition, maxPosition, direction) {
16
- let pct = limit(0, 1, (pixelPos - minPosition) / (maxPosition - minPosition));
17
- if (direction === Direction.rtl) {
18
- pct = 1 - pct;
19
- }
20
- return pct;
21
- }
22
-
23
- class _Slider extends FoundationElement {
24
- }
25
- /**
26
- * A form-associated base class for the {@link @microsoft/fast-foundation#(Slider:class)} component.
27
- *
28
- * @internal
29
- */
30
- class FormAssociatedSlider extends FormAssociated(_Slider) {
31
- constructor() {
32
- super(...arguments);
33
- this.proxy = document.createElement("input");
34
- }
35
- }
36
-
37
- /**
38
- * The selection modes of a {@link @microsoft/fast-foundation#(Slider:class)}.
39
- * @public
40
- */
41
- const SliderMode = {
42
- singleValue: "single-value",
43
- };
44
- /**
45
- * A Slider Custom HTML Element.
46
- * Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#slider | ARIA slider }.
47
- *
48
- * @slot track - The track of the slider
49
- * @slot track-start - The track-start visual indicator
50
- * @slot thumb - The slider thumb
51
- * @slot - The default slot for labels
52
- * @csspart positioning-region - The region used to position the elements of the slider
53
- * @csspart track-container - The region containing the track elements
54
- * @csspart track-start - The element wrapping the track start slot
55
- * @csspart thumb-container - The thumb container element which is programatically positioned
56
- * @fires change - Fires a custom 'change' event when the slider value changes
57
- *
58
- * @public
59
- */
60
- let Slider$1 = class Slider extends FormAssociatedSlider {
61
- constructor() {
62
- super(...arguments);
63
- /**
64
- * @internal
65
- */
66
- this.direction = Direction.ltr;
67
- /**
68
- * @internal
69
- */
70
- this.isDragging = false;
71
- /**
72
- * @internal
73
- */
74
- this.trackWidth = 0;
75
- /**
76
- * @internal
77
- */
78
- this.trackMinWidth = 0;
79
- /**
80
- * @internal
81
- */
82
- this.trackHeight = 0;
83
- /**
84
- * @internal
85
- */
86
- this.trackLeft = 0;
87
- /**
88
- * @internal
89
- */
90
- this.trackMinHeight = 0;
91
- /**
92
- * Custom function that generates a string for the component's "aria-valuetext" attribute based on the current value.
93
- *
94
- * @public
95
- */
96
- this.valueTextFormatter = () => null;
97
- /**
98
- * The minimum allowed value.
99
- *
100
- * @defaultValue - 0
101
- * @public
102
- * @remarks
103
- * HTML Attribute: min
104
- */
105
- this.min = 0; // Map to proxy element.
106
- /**
107
- * The maximum allowed value.
108
- *
109
- * @defaultValue - 10
110
- * @public
111
- * @remarks
112
- * HTML Attribute: max
113
- */
114
- this.max = 10; // Map to proxy element.
115
- /**
116
- * Value to increment or decrement via arrow keys, mouse click or drag.
117
- *
118
- * @public
119
- * @remarks
120
- * HTML Attribute: step
121
- */
122
- this.step = 1; // Map to proxy element.
123
- /**
124
- * The orientation of the slider.
125
- *
126
- * @public
127
- * @remarks
128
- * HTML Attribute: orientation
129
- */
130
- this.orientation = Orientation.horizontal;
131
- /**
132
- * The selection mode.
133
- *
134
- * @public
135
- * @remarks
136
- * HTML Attribute: mode
137
- */
138
- this.mode = SliderMode.singleValue;
139
- this.keypressHandler = (e) => {
140
- if (this.readOnly) {
141
- return;
142
- }
143
- if (e.key === keyHome) {
144
- e.preventDefault();
145
- this.value = `${this.min}`;
146
- }
147
- else if (e.key === keyEnd) {
148
- e.preventDefault();
149
- this.value = `${this.max}`;
150
- }
151
- else if (!e.shiftKey) {
152
- switch (e.key) {
153
- case keyArrowRight:
154
- case keyArrowUp:
155
- e.preventDefault();
156
- this.increment();
157
- break;
158
- case keyArrowLeft:
159
- case keyArrowDown:
160
- e.preventDefault();
161
- this.decrement();
162
- break;
163
- }
164
- }
165
- };
166
- this.setupTrackConstraints = () => {
167
- const clientRect = this.track.getBoundingClientRect();
168
- this.trackWidth = this.track.clientWidth;
169
- this.trackMinWidth = this.track.clientLeft;
170
- this.trackHeight = clientRect.bottom;
171
- this.trackMinHeight = clientRect.top;
172
- this.trackLeft = this.getBoundingClientRect().left;
173
- if (this.trackWidth === 0) {
174
- this.trackWidth = 1;
175
- }
176
- };
177
- this.setupListeners = (remove = false) => {
178
- const eventAction = `${remove ? "remove" : "add"}EventListener`;
179
- this[eventAction]("keydown", this.keypressHandler);
180
- this[eventAction]("mousedown", this.handleMouseDown);
181
- this.thumb[eventAction]("mousedown", this.handleThumbMouseDown, {
182
- passive: true,
183
- });
184
- this.thumb[eventAction]("touchstart", this.handleThumbMouseDown, {
185
- passive: true,
186
- });
187
- // removes handlers attached by mousedown handlers
188
- if (remove) {
189
- this.handleMouseDown(null);
190
- this.handleThumbMouseDown(null);
191
- }
192
- };
193
- /**
194
- * @internal
195
- */
196
- this.initialValue = "";
197
- /**
198
- * Handle mouse moves during a thumb drag operation
199
- * If the event handler is null it removes the events
200
- */
201
- this.handleThumbMouseDown = (event) => {
202
- if (event) {
203
- if (this.readOnly || this.disabled || event.defaultPrevented) {
204
- return;
205
- }
206
- event.target.focus();
207
- }
208
- const eventAction = `${event !== null ? "add" : "remove"}EventListener`;
209
- window[eventAction]("mouseup", this.handleWindowMouseUp);
210
- window[eventAction]("mousemove", this.handleMouseMove, { passive: true });
211
- window[eventAction]("touchmove", this.handleMouseMove, { passive: true });
212
- window[eventAction]("touchend", this.handleWindowMouseUp);
213
- this.isDragging = event !== null;
214
- };
215
- /**
216
- * Handle mouse moves during a thumb drag operation
217
- */
218
- this.handleMouseMove = (e) => {
219
- if (this.readOnly || this.disabled || e.defaultPrevented) {
220
- return;
221
- }
222
- // update the value based on current position
223
- const sourceEvent = window.TouchEvent && e instanceof TouchEvent
224
- ? e.touches[0]
225
- : e;
226
- const eventValue = this.orientation === Orientation.horizontal
227
- ? sourceEvent.pageX - document.documentElement.scrollLeft - this.trackLeft
228
- : sourceEvent.pageY - document.documentElement.scrollTop;
229
- this.value = `${this.calculateNewValue(eventValue)}`;
230
- };
231
- this.calculateNewValue = (rawValue) => {
232
- // update the value based on current position
233
- const newPosition = convertPixelToPercent(rawValue, this.orientation === Orientation.horizontal
234
- ? this.trackMinWidth
235
- : this.trackMinHeight, this.orientation === Orientation.horizontal
236
- ? this.trackWidth
237
- : this.trackHeight, this.direction);
238
- const newValue = (this.max - this.min) * newPosition + this.min;
239
- return this.convertToConstrainedValue(newValue);
240
- };
241
- /**
242
- * Handle a window mouse up during a drag operation
243
- */
244
- this.handleWindowMouseUp = (event) => {
245
- this.stopDragging();
246
- };
247
- this.stopDragging = () => {
248
- this.isDragging = false;
249
- this.handleMouseDown(null);
250
- this.handleThumbMouseDown(null);
251
- };
252
- /**
253
- *
254
- * @param e - MouseEvent or null. If there is no event handler it will remove the events
255
- */
256
- this.handleMouseDown = (e) => {
257
- const eventAction = `${e !== null ? "add" : "remove"}EventListener`;
258
- if (e === null || (!this.disabled && !this.readOnly)) {
259
- window[eventAction]("mouseup", this.handleWindowMouseUp);
260
- window.document[eventAction]("mouseleave", this.handleWindowMouseUp);
261
- window[eventAction]("mousemove", this.handleMouseMove);
262
- if (e) {
263
- e.preventDefault();
264
- this.setupTrackConstraints();
265
- e.target.focus();
266
- const controlValue = this.orientation === Orientation.horizontal
267
- ? e.pageX - document.documentElement.scrollLeft - this.trackLeft
268
- : e.pageY - document.documentElement.scrollTop;
269
- this.value = `${this.calculateNewValue(controlValue)}`;
270
- }
271
- }
272
- };
273
- this.convertToConstrainedValue = (value) => {
274
- if (isNaN(value)) {
275
- value = this.min;
276
- }
277
- /**
278
- * The following logic intends to overcome the issue with math in JavaScript with regards to floating point numbers.
279
- * 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
280
- * and is converted to an integer by determining the number of decimal places it represent, multiplying it until it is an
281
- * integer and then dividing it to get back to the correct number.
282
- */
283
- let constrainedValue = value - this.min;
284
- const roundedConstrainedValue = Math.round(constrainedValue / this.step);
285
- const remainderValue = constrainedValue -
286
- (roundedConstrainedValue * (this.stepMultiplier * this.step)) /
287
- this.stepMultiplier;
288
- constrainedValue =
289
- remainderValue >= Number(this.step) / 2
290
- ? constrainedValue - remainderValue + Number(this.step)
291
- : constrainedValue - remainderValue;
292
- return constrainedValue + this.min;
293
- };
294
- }
295
- readOnlyChanged() {
296
- if (this.proxy instanceof HTMLInputElement) {
297
- this.proxy.readOnly = this.readOnly;
298
- }
299
- }
300
- /**
301
- * The value property, typed as a number.
302
- *
303
- * @public
304
- */
305
- get valueAsNumber() {
306
- return parseFloat(super.value);
307
- }
308
- set valueAsNumber(next) {
309
- this.value = next.toString();
310
- }
311
- /**
312
- * @internal
313
- */
314
- valueChanged(previous, next) {
315
- super.valueChanged(previous, next);
316
- if (this.$fastController.isConnected) {
317
- this.setThumbPositionForOrientation(this.direction);
318
- }
319
- this.$emit("change");
320
- }
321
- minChanged() {
322
- if (this.proxy instanceof HTMLInputElement) {
323
- this.proxy.min = `${this.min}`;
324
- }
325
- this.validate();
326
- }
327
- maxChanged() {
328
- if (this.proxy instanceof HTMLInputElement) {
329
- this.proxy.max = `${this.max}`;
330
- }
331
- this.validate();
332
- }
333
- stepChanged() {
334
- if (this.proxy instanceof HTMLInputElement) {
335
- this.proxy.step = `${this.step}`;
336
- }
337
- this.updateStepMultiplier();
338
- this.validate();
339
- }
340
- orientationChanged() {
341
- if (this.$fastController.isConnected) {
342
- this.setThumbPositionForOrientation(this.direction);
343
- }
344
- }
345
- /**
346
- * @internal
347
- */
348
- connectedCallback() {
349
- super.connectedCallback();
350
- this.proxy.setAttribute("type", "range");
351
- this.direction = getDirection(this);
352
- this.updateStepMultiplier();
353
- this.setupTrackConstraints();
354
- this.setupListeners();
355
- this.setupDefaultValue();
356
- this.setThumbPositionForOrientation(this.direction);
357
- }
358
- /**
359
- * @internal
360
- */
361
- disconnectedCallback() {
362
- this.setupListeners(true);
363
- }
364
- /**
365
- * Increment the value by the step
366
- *
367
- * @public
368
- */
369
- increment() {
370
- const newVal = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical
371
- ? Number(this.value) + Number(this.step)
372
- : Number(this.value) - Number(this.step);
373
- const incrementedVal = this.convertToConstrainedValue(newVal);
374
- const incrementedValString = incrementedVal < Number(this.max) ? `${incrementedVal}` : `${this.max}`;
375
- this.value = incrementedValString;
376
- }
377
- /**
378
- * Decrement the value by the step
379
- *
380
- * @public
381
- */
382
- decrement() {
383
- const newVal = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical
384
- ? Number(this.value) - Number(this.step)
385
- : Number(this.value) + Number(this.step);
386
- const decrementedVal = this.convertToConstrainedValue(newVal);
387
- const decrementedValString = decrementedVal > Number(this.min) ? `${decrementedVal}` : `${this.min}`;
388
- this.value = decrementedValString;
389
- }
390
- /**
391
- * Places the thumb based on the current value
392
- *
393
- * @public
394
- * @param direction - writing mode
395
- */
396
- setThumbPositionForOrientation(direction) {
397
- const newPct = convertPixelToPercent(Number(this.value), Number(this.min), Number(this.max), direction);
398
- const percentage = (1 - newPct) * 100;
399
- if (this.orientation === Orientation.horizontal) {
400
- this.position = this.isDragging
401
- ? `right: ${percentage}%; transition: none;`
402
- : `right: ${percentage}%; transition: all 0.2s ease;`;
403
- }
404
- else {
405
- this.position = this.isDragging
406
- ? `bottom: ${percentage}%; transition: none;`
407
- : `bottom: ${percentage}%; transition: all 0.2s ease;`;
408
- }
409
- }
410
- /**
411
- * Update the step multiplier used to ensure rounding errors from steps that
412
- * are not whole numbers
413
- */
414
- updateStepMultiplier() {
415
- const stepString = this.step + "";
416
- const decimalPlacesOfStep = !!(this.step % 1)
417
- ? stepString.length - stepString.indexOf(".") - 1
418
- : 0;
419
- this.stepMultiplier = Math.pow(10, decimalPlacesOfStep);
420
- }
421
- get midpoint() {
422
- return `${this.convertToConstrainedValue((this.max + this.min) / 2)}`;
423
- }
424
- setupDefaultValue() {
425
- if (typeof this.value === "string") {
426
- if (this.value.length === 0) {
427
- this.initialValue = this.midpoint;
428
- }
429
- else {
430
- const value = parseFloat(this.value);
431
- if (!Number.isNaN(value) && (value < this.min || value > this.max)) {
432
- this.value = this.midpoint;
433
- }
434
- }
435
- }
436
- }
437
- };
438
- __decorate([
439
- attr({ attribute: "readonly", mode: "boolean" })
440
- ], Slider$1.prototype, "readOnly", void 0);
441
- __decorate([
442
- observable
443
- ], Slider$1.prototype, "direction", void 0);
444
- __decorate([
445
- observable
446
- ], Slider$1.prototype, "isDragging", void 0);
447
- __decorate([
448
- observable
449
- ], Slider$1.prototype, "position", void 0);
450
- __decorate([
451
- observable
452
- ], Slider$1.prototype, "trackWidth", void 0);
453
- __decorate([
454
- observable
455
- ], Slider$1.prototype, "trackMinWidth", void 0);
456
- __decorate([
457
- observable
458
- ], Slider$1.prototype, "trackHeight", void 0);
459
- __decorate([
460
- observable
461
- ], Slider$1.prototype, "trackLeft", void 0);
462
- __decorate([
463
- observable
464
- ], Slider$1.prototype, "trackMinHeight", void 0);
465
- __decorate([
466
- observable
467
- ], Slider$1.prototype, "valueTextFormatter", void 0);
468
- __decorate([
469
- attr({ converter: nullableNumberConverter })
470
- ], Slider$1.prototype, "min", void 0);
471
- __decorate([
472
- attr({ converter: nullableNumberConverter })
473
- ], Slider$1.prototype, "max", void 0);
474
- __decorate([
475
- attr({ converter: nullableNumberConverter })
476
- ], Slider$1.prototype, "step", void 0);
477
- __decorate([
478
- attr
479
- ], Slider$1.prototype, "orientation", void 0);
480
- __decorate([
481
- attr
482
- ], Slider$1.prototype, "mode", void 0);
483
-
484
- const styles = ":host{display:inline-block}:host(:not([orientation=vertical])){inline-size:100%}:host([orientation=vertical]){block-size:100%;min-block-size:calc(var(--_thumb-interaction-indicator-size) * 5)}:host([disabled]){cursor:not-allowed}.control.connotation-cta{--_connotation-color-primary: var(--vvd-slider-cta-primary, var(--vvd-color-cta-500))}.control:not(.connotation-cta){--_connotation-color-primary: var(--vvd-slider-accent-primary, var(--vvd-color-canvas-text))}.control{--_appearance-color-text: var(--_connotation-color-primary-text);--_appearance-color-fill: var(--_connotation-color-primary);--_appearance-color-outline: transparent}.control{--_thumb-size: 12px;--_thumb-interaction-indicator-size: 36px;--_track-start-inset-inline-start: 0;--_track-start-inset-block-start: 0;cursor:pointer;outline:none;user-select:none}.control .positioning-region{position:relative}.control .track{position:absolute;border-radius:4px;background:var(--_track-background-color)}.control .track-start{position:absolute;border-radius:inherit;background:var(--_track-start-background-color);block-size:100%;inset-inline-start:var(--_track-start-inset-inline-start)}.control.horizontal{block-size:var(--_thumb-interaction-indicator-size);inline-size:calc(100% - var(--_thumb-size));margin-inline-start:calc(var(--_thumb-size) / 2);min-inline-size:var(--_thumb-size)}.control.horizontal .track{top:calc((var(--_thumb-interaction-indicator-size) - 2px) / 2);right:0;left:0;block-size:2px}:host([markers]) .control.horizontal .track-start{--_track-start-inset-inline-start: 1px;border-bottom-left-radius:0;border-top-left-radius:0}.control.horizontal .track .mark{position:absolute;block-size:6px;inline-size:100%;inset-block-start:-2px;inset-inline-start:0}.control.vertical{margin-top:calc(var(--_thumb-interaction-indicator-size) / 2);block-size:calc(100% - var(--_thumb-interaction-indicator-size));inline-size:var(--_thumb-interaction-indicator-size);min-block-size:var(--_thumb-interaction-indicator-size)}.control.vertical .positioning-region{block-size:100%}.control.vertical .track{left:calc((var(--_thumb-interaction-indicator-size) - 2px) / 2);block-size:100%;inline-size:2px}.control.vertical .track .mark{position:absolute;block-size:100%;inline-size:6px;inset-block-start:0;inset-inline-start:-2px}.control.vertical .track-start{block-size:auto;inline-size:100%;inset-block-start:var(--_track-start-inset-block-start)}:host([markers]) .control.vertical .track-start{--_track-start-inset-block-start: 1px;border-radius:0}.control.disabled{--_track-background-color: var(--vvd-color-neutral-100);--_track-start-background-color: var(--vvd-color-neutral-300);pointer-events:none}.control:not(.disabled){--_track-background-color: var(--vvd-color-neutral-300);--_track-start-background-color: var(--_appearance-color-fill)}.control:not(.disabled) .mark{color:var(--vvd-color-neutral-950)}.control.disabled .mark{color:var(--_track-start-background-color)}.thumb-container{position:absolute;border-radius:50%;block-size:var(--_thumb-interaction-indicator-size);cursor:inherit;inline-size:var(--_thumb-interaction-indicator-size);outline:none;touch-action:none}.thumb-container.focus-visible{box-shadow:inset 0 0 0 3px var(--focus-stroke-gap-color, currentColor);outline:2px solid var(--focus-stroke-color, var(--vvd-color-canvas-text));outline-offset:calc(-2px - var(--focus-inset, 0px));--focus-stroke-gap-color: transparent;--_thumb-interaction-indicator-alpha: .05;border-radius:50%}.control.horizontal .thumb-container{transform:translate(calc(var(--_thumb-interaction-indicator-size) / 2))}.control.vertical .thumb-container{transform:translateY(calc(var(--_thumb-interaction-indicator-size) / 2))}.control:not(.disabled) .thumb-container:hover{--_thumb-interaction-indicator-alpha: .12}.control:not(.disabled) .thumb-container:active{--_thumb-interaction-indicator-alpha: .25}.thumb-container:before{position:absolute;display:block;border-radius:inherit;background-color:var(--_track-start-background-color);block-size:var(--_thumb-interaction-indicator-size);content:\"\";inline-size:var(--_thumb-interaction-indicator-size);opacity:var(--_thumb-interaction-indicator-alpha, 0);transition:opacity .2s ease-out 0s}.thumb-container:after{position:absolute;display:block;border-radius:inherit;background-color:var(--_track-start-background-color);block-size:var(--_thumb-size);content:\"\";inline-size:var(--_thumb-size);inset:calc((var(--_thumb-interaction-indicator-size) - var(--_thumb-size)) / 2)}.popup{pointer-events:none}.tooltip{width:auto;padding:8px 12px;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold)}";
1
+ import { F as FoundationElement, a as attr, h as html, r as registerFactory } from './index.js';
2
+ import { h as handleEscapeKeyAndStopPropogation } from './index2.js';
3
+ import { w as when } from './when.js';
4
+ import { c as classNames } from './class-names.js';
485
5
 
486
6
  var __defProp = Object.defineProperty;
487
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
488
7
  var __decorateClass = (decorators, target, key, kind) => {
489
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
8
+ var result = void 0 ;
490
9
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
491
10
  if (decorator = decorators[i])
492
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
493
- if (kind && result) __defProp(target, key, result);
11
+ result = (decorator(target, key, result) ) || result;
12
+ if (result) __defProp(target, key, result);
494
13
  return result;
495
14
  };
496
- class Slider extends Slider$1 {
15
+ class SideDrawer extends FoundationElement {
497
16
  constructor() {
498
- super();
499
- this.ariaLabel = null;
500
- this.ariaValuetext = null;
501
- this.markers = false;
502
- this.pin = false;
503
- this.valueTextFormatter = (value) => parseFloat(value).toLocaleString(this.locale.lang);
504
- this._focusVisible = false;
505
- this._hoveringOnThumb = false;
506
- this.#isNonVisibleFocus = false;
507
- /**
508
- * @internal
509
- */
510
- this._onFocusIn = () => {
511
- if (!this.#isNonVisibleFocus) {
512
- this._focusVisible = true;
513
- }
514
- };
515
- /**
516
- * @internal
517
- */
518
- this._onFocusOut = () => {
519
- this._focusVisible = false;
520
- };
521
- this.#onMouseOver = () => {
522
- this._hoveringOnThumb = true;
523
- };
524
- this.#onMouseOut = () => {
525
- this._hoveringOnThumb = false;
526
- };
527
- const fastSliderInternals = this;
528
- const originalHandleMouseDown = fastSliderInternals.handleMouseDown;
529
- fastSliderInternals.handleMouseDown = (e) => {
530
- this.#isNonVisibleFocus = true;
531
- originalHandleMouseDown(e);
532
- this.#isNonVisibleFocus = false;
533
- if (e && !this.disabled && !this.readOnly) {
534
- this.isDragging = true;
535
- }
536
- };
537
- const originalHandleThumbMouseDown = fastSliderInternals.handleThumbMouseDown;
538
- fastSliderInternals.handleThumbMouseDown = (e) => {
539
- this.#isNonVisibleFocus = true;
540
- originalHandleThumbMouseDown(e);
541
- this.#isNonVisibleFocus = false;
542
- };
543
- const originalKeypressHandler = fastSliderInternals.keypressHandler;
544
- fastSliderInternals.keypressHandler = (e) => {
545
- this._focusVisible = true;
546
- originalKeypressHandler(e);
547
- };
17
+ super(...arguments);
18
+ this.alternate = false;
19
+ this.modal = false;
20
+ this.open = false;
21
+ this.trailing = false;
548
22
  }
549
- /**
550
- * TO BE REMOVED WHEN UPGRADING TO FAST-FOUNDATION 3
551
- *
552
- * @internal
553
- */
554
- valueChanged(previous, next) {
555
- if (this.$fastController.isConnected) {
556
- const nextAsNumber = parseFloat(next);
557
- const value = limit$1(
558
- this.min,
559
- this.max,
560
- this["convertToConstrainedValue"](nextAsNumber)
561
- ).toString();
562
- if (value !== next) {
563
- this.value = value;
564
- return;
23
+ attributeChangedCallback(name, oldValue, newValue) {
24
+ super.attributeChangedCallback(name, oldValue, newValue);
25
+ switch (name) {
26
+ case "open": {
27
+ this.open ? this.#open() : this.#close();
565
28
  }
566
- super.valueChanged(previous, value);
567
29
  }
568
30
  }
569
- get _isThumbPopupOpen() {
570
- return this._focusVisible || this._hoveringOnThumb || this.isDragging;
571
- }
572
- #isNonVisibleFocus;
573
- connectedCallback() {
574
- super.connectedCallback();
575
- this.#registerThumbListeners();
576
- }
577
- disconnectedCallback() {
578
- super.disconnectedCallback();
579
- this.#unregisterThumbListeners();
580
- }
581
- #registerThumbListeners() {
582
- this.thumb.addEventListener("mouseover", this.#onMouseOver, {
583
- passive: true
584
- });
585
- this.thumb.addEventListener("mouseout", this.#onMouseOut, {
586
- passive: true
587
- });
31
+ #close() {
32
+ this.$emit("close", void 0, { bubbles: false });
588
33
  }
589
- #unregisterThumbListeners() {
590
- this.thumb.removeEventListener("mouseover", this.#onMouseOver);
591
- this.thumb.removeEventListener("mouseout", this.#onMouseOut);
34
+ #open() {
35
+ this.$emit("open", void 0, { bubbles: false });
592
36
  }
593
- #onMouseOver;
594
- #onMouseOut;
595
37
  }
596
- __decorateClass([
597
- attr({ attribute: "aria-label" })
598
- ], Slider.prototype, "ariaLabel", 2);
599
- __decorateClass([
600
- attr({ attribute: "aria-valuetext" })
601
- ], Slider.prototype, "ariaValuetext", 2);
602
38
  __decorateClass([
603
39
  attr({
604
40
  mode: "boolean"
605
41
  })
606
- ], Slider.prototype, "markers", 2);
607
- __decorateClass([
608
- attr({ mode: "boolean" })
609
- ], Slider.prototype, "pin", 2);
42
+ ], SideDrawer.prototype, "alternate");
610
43
  __decorateClass([
611
- attr
612
- ], Slider.prototype, "connotation", 2);
613
- __decorateClass([
614
- observable
615
- ], Slider.prototype, "valueTextFormatter", 2);
616
- __decorateClass([
617
- observable
618
- ], Slider.prototype, "_focusVisible", 2);
44
+ attr({
45
+ mode: "boolean"
46
+ })
47
+ ], SideDrawer.prototype, "modal");
619
48
  __decorateClass([
620
- observable
621
- ], Slider.prototype, "_hoveringOnThumb", 2);
49
+ attr({
50
+ mode: "boolean"
51
+ })
52
+ ], SideDrawer.prototype, "open");
622
53
  __decorateClass([
623
- volatile
624
- ], Slider.prototype, "_isThumbPopupOpen", 1);
625
- applyMixins(Slider, Localized);
54
+ attr({
55
+ mode: "boolean"
56
+ })
57
+ ], SideDrawer.prototype, "trailing");
58
+
59
+ const styles = ":host{display:block}.side-drawer-app-content{block-size:100%}.control{position:fixed;z-index:1;background-color:var(--vvd-color-canvas);color:var(--vvd-color-canvas-text);inline-size:280px;inset-block:0;overflow-y:auto}.control[part~=vvd-theme-alternate]{background-color:var(--vvd-color-canvas);color:var(--vvd-color-canvas-text);color-scheme:var(--vvd-color-scheme)}.control.trailing{inset-inline-end:0}.control:not(.open).trailing{transform:translate(100%)}.control:not(.open):not(.trailing){transform:translate(-100%)}.control.open:not(.modal).trailing+.side-drawer-app-content{margin-inline-end:var(--side-drawer-app-content-offset, 280px)}.control.open:not(.modal):not(.trailing)+.side-drawer-app-content{margin-inline-start:var(--side-drawer-app-content-offset, 280px)}@media (prefers-reduced-motion: no-preference){.control{transition:transform .2s cubic-bezier(.4,0,.2,1)}}.scrim{background-color:var(--vvd-color-canvas-text, currentColor);opacity:.5;position:fixed;inset:0}.scrim:not(.open){display:none}";
60
+
61
+ const getClasses = ({ modal, open, trailing }) => classNames(
62
+ "control",
63
+ ["modal", modal],
64
+ ["open", open],
65
+ ["trailing", trailing]
66
+ );
67
+ const getScrimClasses = ({ open }) => classNames("scrim", ["open", open]);
68
+ const sideDrawerTemplate = () => html`
69
+ <div
70
+ class="${getClasses}"
71
+ ?inert="${(x) => !x.open}"
72
+ part="base ${(x) => x.alternate ? "vvd-theme-alternate" : ""}"
73
+ @keydown="${(x, c) => handleKeydown(x, c.event)}"
74
+ >
75
+ <slot></slot>
76
+ </div>
626
77
 
627
- const sliderDefinition = Slider.compose({
628
- baseName: "slider",
629
- template: SliderTemplate,
630
- styles,
631
- shadowOptions: {
632
- delegatesFocus: true
78
+ <div class="side-drawer-app-content" ?inert="${(x) => x.open && x.modal}">
79
+ <slot name="app-content"></slot>
80
+ </div>
81
+
82
+ ${when(
83
+ (x) => x.modal,
84
+ html`<div
85
+ class="${getScrimClasses}"
86
+ @click="${(x) => x.open = false}"
87
+ ></div>`
88
+ )}
89
+ `;
90
+ const handleKeydown = (x, event) => {
91
+ if (handleEscapeKeyAndStopPropogation(event)) {
92
+ x.open = false;
93
+ } else {
94
+ return true;
633
95
  }
96
+ };
97
+
98
+ const sideDrawerDefinition = SideDrawer.compose({
99
+ baseName: "side-drawer",
100
+ template: sideDrawerTemplate,
101
+ styles
634
102
  });
635
- const sliderRegistries = [...popupRegistries, sliderDefinition()];
636
- const registerSlider = registerFactory(sliderRegistries);
103
+ const sideDrawerRegistries = [sideDrawerDefinition()];
104
+ const registerSideDrawer = registerFactory(sideDrawerRegistries);
637
105
 
638
- export { Slider as S, sliderRegistries as a, registerSlider as r, sliderDefinition as s };
106
+ export { sideDrawerRegistries as a, registerSideDrawer as r, sideDrawerDefinition as s };