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