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