@vonage/vivid 3.37.0 → 3.39.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/accordion/index.js +2 -2
- package/accordion-item/index.js +2 -2
- package/alert/index.js +4 -4
- package/avatar/index.js +1 -1
- package/badge/index.js +1 -1
- package/banner/index.js +3 -3
- package/breadcrumb-item/index.js +2 -2
- package/button/index.js +3 -3
- package/card/index.js +2 -2
- package/checkbox/index.js +2 -2
- package/combobox/index.js +6 -6
- package/custom-elements.json +4199 -3875
- package/data-grid/index.js +1 -1
- package/date-picker/index.js +9 -7
- package/date-range-picker/index.js +36 -0
- package/dialog/index.js +5 -5
- package/divider/index.js +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.js +2 -2
- package/fab/index.js +3 -3
- package/file-picker/index.js +5 -4
- package/focus/index.js +1 -1
- package/header/index.js +2 -2
- package/icon/index.js +1 -1
- package/index.js +43 -40
- package/layout/index.js +1 -1
- package/lib/components.d.ts +1 -0
- package/lib/date-picker/date-picker.d.ts +4 -14
- package/lib/date-range-picker/date-range-picker.d.ts +15 -0
- package/lib/date-range-picker/definition.d.ts +3 -0
- package/lib/file-picker/file-picker.d.ts +8 -5
- package/lib/file-picker/file-picker.form-associated.d.ts +10 -0
- package/lib/file-picker/locale.d.ts +6 -0
- package/lib/menu-item/menu-item.d.ts +6 -0
- package/lib/tag-group/tag-group.d.ts +1 -0
- package/listbox/index.js +4 -4
- package/locales/en-GB.js +27 -3
- package/locales/en-US.js +27 -3
- package/locales/ja-JP.js +25 -1
- package/locales/zh-CN.js +25 -1
- package/menu/index.js +7 -7
- package/menu-item/index.js +3 -3
- package/nav/index.js +1 -1
- package/nav-disclosure/index.js +3 -3
- package/nav-item/index.js +3 -3
- package/note/index.js +2 -2
- package/number-field/index.js +5 -5
- package/option/index.js +3 -3
- package/package.json +1 -1
- package/pagination/index.js +4 -4
- package/popup/index.js +5 -5
- package/progress/index.js +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.js +2 -2
- package/radio-group/index.js +1 -1
- package/select/index.js +7 -7
- package/shared/date-picker/calendar/dateRange.d.ts +5 -0
- package/shared/date-picker/calendar/presentationDateRange.d.ts +5 -0
- package/shared/date-picker/date-picker-base.d.ts +19 -0
- package/shared/date-picker/date-picker-base.form-associated.d.ts +10 -0
- package/shared/date-picker/date-picker-base.template.d.ts +4 -0
- package/{lib → shared}/date-picker/locale.d.ts +6 -0
- package/shared/definition.js +4 -4
- package/shared/definition10.js +9 -14
- package/shared/definition11.js +1 -1
- package/shared/definition12.js +1 -1
- package/shared/definition13.js +3 -3
- package/shared/definition14.js +3 -3
- package/shared/definition15.js +5 -5
- package/shared/definition16.js +3 -3
- package/shared/definition17.js +44 -6055
- package/shared/definition18.js +353 -213
- package/shared/definition19.js +251 -67
- package/shared/definition2.js +1 -1
- package/shared/definition20.js +66 -58
- package/shared/definition21.js +43 -84
- package/shared/definition22.js +75 -2298
- package/shared/definition23.js +2361 -45
- package/shared/definition24.js +63 -27
- package/shared/definition25.js +24 -51
- package/shared/definition26.js +36 -805
- package/shared/definition27.js +828 -49
- package/shared/definition28.js +52 -89
- package/shared/definition29.js +88 -24
- package/shared/definition3.js +1 -1
- package/shared/definition30.js +25 -12
- package/shared/definition31.js +12 -53
- package/shared/definition32.js +28 -487
- package/shared/definition33.js +427 -197
- package/shared/definition34.js +260 -174
- package/shared/definition35.js +187 -69
- package/shared/definition36.js +68 -55
- package/shared/definition37.js +61 -421
- package/shared/definition38.js +435 -35
- package/shared/definition39.js +30 -679
- package/shared/definition4.js +3 -3
- package/shared/definition40.js +661 -77
- package/shared/definition41.js +77 -557
- package/shared/definition42.js +559 -106
- package/shared/definition43.js +105 -136
- package/shared/definition44.js +153 -17
- package/shared/definition45.js +16 -79
- package/shared/definition46.js +53 -475
- package/shared/definition47.js +506 -20
- package/shared/definition48.js +22 -121
- package/shared/definition49.js +115 -262
- package/shared/definition5.js +2 -2
- package/shared/definition50.js +248 -120
- package/shared/definition51.js +139 -123
- package/shared/definition52.js +84 -74
- package/shared/definition53.js +114 -69
- package/shared/definition54.js +81 -292
- package/shared/definition55.js +302 -13
- package/shared/definition56.js +11 -41
- package/shared/definition57.js +20 -154
- package/shared/definition58.js +181 -0
- package/shared/definition6.js +2 -2
- package/shared/definition7.js +2 -2
- package/shared/definition8.js +3 -3
- package/shared/index2.js +1 -1
- package/shared/listbox.js +1 -1
- package/shared/localization/Locale.d.ts +3 -1
- package/shared/localized.js +9 -0
- package/shared/presentationDate.js +6133 -0
- package/shared/text-anchor.template.js +4 -4
- package/shared/text-field.js +1 -1
- package/side-drawer/index.js +1 -1
- package/slider/index.js +2 -2
- package/split-button/index.js +3 -3
- package/style.css +246 -183
- 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.js +3 -3
- package/tab/index.js +3 -3
- package/tab-panel/index.js +1 -1
- package/tabs/index.js +5 -5
- package/tag/index.js +3 -3
- package/tag-group/index.js +1 -1
- package/text-area/index.js +3 -3
- package/text-field/index.js +3 -3
- package/toggletip/index.js +6 -6
- package/tooltip/index.js +6 -6
- package/tree-item/index.js +3 -3
- package/tree-view/index.js +1 -1
- package/vivid.api.json +105 -0
- package/lib/date-picker/date-picker.form-associated.d.ts +0 -11
- package/lib/date-picker/date-picker.template.d.ts +0 -4
- /package/{lib → shared}/date-picker/calendar/calendarGrid.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/dateStr.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/month.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/monthPickerGrid.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/presentationDate.d.ts +0 -0
- /package/{lib → shared}/date-picker/calendar/year.d.ts +0 -0
package/shared/definition42.js
CHANGED
|
@@ -1,12 +1,502 @@
|
|
|
1
|
-
import { a as attr,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { F as FoundationElement, _ as __decorate, a as attr, o as observable, n as nullableNumberConverter, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { f as focusRegistries } from './definition56.js';
|
|
3
|
+
import { D as Direction, g as getDirection } from './direction.js';
|
|
4
|
+
import { l as limit$1 } from './numbers.js';
|
|
5
|
+
import { F as FormAssociated } from './form-associated.js';
|
|
6
|
+
import { O as Orientation } from './aria.js';
|
|
7
|
+
import { c as keyHome, b as keyEnd, d as keyArrowDown, i as keyArrowLeft, e as keyArrowUp, h as keyArrowRight } from './key-codes.js';
|
|
6
8
|
import { f as focusTemplateFactory } from './focus2.js';
|
|
7
9
|
import { r as ref } from './ref.js';
|
|
10
|
+
import { O as Orientation$1 } from './aria2.js';
|
|
8
11
|
import { c as classNames } from './class-names.js';
|
|
9
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Converts a pixel coordinate on the track to a percent of the track's range
|
|
15
|
+
*/
|
|
16
|
+
function convertPixelToPercent(pixelPos, minPosition, maxPosition, direction) {
|
|
17
|
+
let pct = limit$1(0, 1, (pixelPos - minPosition) / (maxPosition - minPosition));
|
|
18
|
+
if (direction === Direction.rtl) {
|
|
19
|
+
pct = 1 - pct;
|
|
20
|
+
}
|
|
21
|
+
return pct;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
class _Slider extends FoundationElement {
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A form-associated base class for the {@link @microsoft/fast-foundation#(Slider:class)} component.
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
class FormAssociatedSlider extends FormAssociated(_Slider) {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
this.proxy = document.createElement("input");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The selection modes of a {@link @microsoft/fast-foundation#(Slider:class)}.
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
const SliderMode = {
|
|
43
|
+
singleValue: "single-value",
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* A Slider Custom HTML Element.
|
|
47
|
+
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#slider | ARIA slider }.
|
|
48
|
+
*
|
|
49
|
+
* @slot track - The track of the slider
|
|
50
|
+
* @slot track-start - The track-start visual indicator
|
|
51
|
+
* @slot thumb - The slider thumb
|
|
52
|
+
* @slot - The default slot for labels
|
|
53
|
+
* @csspart positioning-region - The region used to position the elements of the slider
|
|
54
|
+
* @csspart track-container - The region containing the track elements
|
|
55
|
+
* @csspart track-start - The element wrapping the track start slot
|
|
56
|
+
* @csspart thumb-container - The thumb container element which is programatically positioned
|
|
57
|
+
* @fires change - Fires a custom 'change' event when the slider value changes
|
|
58
|
+
*
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
let Slider$1 = class Slider extends FormAssociatedSlider {
|
|
62
|
+
constructor() {
|
|
63
|
+
super(...arguments);
|
|
64
|
+
/**
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
this.direction = Direction.ltr;
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
this.isDragging = false;
|
|
72
|
+
/**
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
this.trackWidth = 0;
|
|
76
|
+
/**
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
this.trackMinWidth = 0;
|
|
80
|
+
/**
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
this.trackHeight = 0;
|
|
84
|
+
/**
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
this.trackLeft = 0;
|
|
88
|
+
/**
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
this.trackMinHeight = 0;
|
|
92
|
+
/**
|
|
93
|
+
* Custom function that generates a string for the component's "aria-valuetext" attribute based on the current value.
|
|
94
|
+
*
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
this.valueTextFormatter = () => null;
|
|
98
|
+
/**
|
|
99
|
+
* The minimum allowed value.
|
|
100
|
+
*
|
|
101
|
+
* @defaultValue - 0
|
|
102
|
+
* @public
|
|
103
|
+
* @remarks
|
|
104
|
+
* HTML Attribute: min
|
|
105
|
+
*/
|
|
106
|
+
this.min = 0; // Map to proxy element.
|
|
107
|
+
/**
|
|
108
|
+
* The maximum allowed value.
|
|
109
|
+
*
|
|
110
|
+
* @defaultValue - 10
|
|
111
|
+
* @public
|
|
112
|
+
* @remarks
|
|
113
|
+
* HTML Attribute: max
|
|
114
|
+
*/
|
|
115
|
+
this.max = 10; // Map to proxy element.
|
|
116
|
+
/**
|
|
117
|
+
* Value to increment or decrement via arrow keys, mouse click or drag.
|
|
118
|
+
*
|
|
119
|
+
* @public
|
|
120
|
+
* @remarks
|
|
121
|
+
* HTML Attribute: step
|
|
122
|
+
*/
|
|
123
|
+
this.step = 1; // Map to proxy element.
|
|
124
|
+
/**
|
|
125
|
+
* The orientation of the slider.
|
|
126
|
+
*
|
|
127
|
+
* @public
|
|
128
|
+
* @remarks
|
|
129
|
+
* HTML Attribute: orientation
|
|
130
|
+
*/
|
|
131
|
+
this.orientation = Orientation.horizontal;
|
|
132
|
+
/**
|
|
133
|
+
* The selection mode.
|
|
134
|
+
*
|
|
135
|
+
* @public
|
|
136
|
+
* @remarks
|
|
137
|
+
* HTML Attribute: mode
|
|
138
|
+
*/
|
|
139
|
+
this.mode = SliderMode.singleValue;
|
|
140
|
+
this.keypressHandler = (e) => {
|
|
141
|
+
if (this.readOnly) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (e.key === keyHome) {
|
|
145
|
+
e.preventDefault();
|
|
146
|
+
this.value = `${this.min}`;
|
|
147
|
+
}
|
|
148
|
+
else if (e.key === keyEnd) {
|
|
149
|
+
e.preventDefault();
|
|
150
|
+
this.value = `${this.max}`;
|
|
151
|
+
}
|
|
152
|
+
else if (!e.shiftKey) {
|
|
153
|
+
switch (e.key) {
|
|
154
|
+
case keyArrowRight:
|
|
155
|
+
case keyArrowUp:
|
|
156
|
+
e.preventDefault();
|
|
157
|
+
this.increment();
|
|
158
|
+
break;
|
|
159
|
+
case keyArrowLeft:
|
|
160
|
+
case keyArrowDown:
|
|
161
|
+
e.preventDefault();
|
|
162
|
+
this.decrement();
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
this.setupTrackConstraints = () => {
|
|
168
|
+
const clientRect = this.track.getBoundingClientRect();
|
|
169
|
+
this.trackWidth = this.track.clientWidth;
|
|
170
|
+
this.trackMinWidth = this.track.clientLeft;
|
|
171
|
+
this.trackHeight = clientRect.bottom;
|
|
172
|
+
this.trackMinHeight = clientRect.top;
|
|
173
|
+
this.trackLeft = this.getBoundingClientRect().left;
|
|
174
|
+
if (this.trackWidth === 0) {
|
|
175
|
+
this.trackWidth = 1;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
this.setupListeners = (remove = false) => {
|
|
179
|
+
const eventAction = `${remove ? "remove" : "add"}EventListener`;
|
|
180
|
+
this[eventAction]("keydown", this.keypressHandler);
|
|
181
|
+
this[eventAction]("mousedown", this.handleMouseDown);
|
|
182
|
+
this.thumb[eventAction]("mousedown", this.handleThumbMouseDown, {
|
|
183
|
+
passive: true,
|
|
184
|
+
});
|
|
185
|
+
this.thumb[eventAction]("touchstart", this.handleThumbMouseDown, {
|
|
186
|
+
passive: true,
|
|
187
|
+
});
|
|
188
|
+
// removes handlers attached by mousedown handlers
|
|
189
|
+
if (remove) {
|
|
190
|
+
this.handleMouseDown(null);
|
|
191
|
+
this.handleThumbMouseDown(null);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* @internal
|
|
196
|
+
*/
|
|
197
|
+
this.initialValue = "";
|
|
198
|
+
/**
|
|
199
|
+
* Handle mouse moves during a thumb drag operation
|
|
200
|
+
* If the event handler is null it removes the events
|
|
201
|
+
*/
|
|
202
|
+
this.handleThumbMouseDown = (event) => {
|
|
203
|
+
if (event) {
|
|
204
|
+
if (this.readOnly || this.disabled || event.defaultPrevented) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
event.target.focus();
|
|
208
|
+
}
|
|
209
|
+
const eventAction = `${event !== null ? "add" : "remove"}EventListener`;
|
|
210
|
+
window[eventAction]("mouseup", this.handleWindowMouseUp);
|
|
211
|
+
window[eventAction]("mousemove", this.handleMouseMove, { passive: true });
|
|
212
|
+
window[eventAction]("touchmove", this.handleMouseMove, { passive: true });
|
|
213
|
+
window[eventAction]("touchend", this.handleWindowMouseUp);
|
|
214
|
+
this.isDragging = event !== null;
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* Handle mouse moves during a thumb drag operation
|
|
218
|
+
*/
|
|
219
|
+
this.handleMouseMove = (e) => {
|
|
220
|
+
if (this.readOnly || this.disabled || e.defaultPrevented) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
// update the value based on current position
|
|
224
|
+
const sourceEvent = window.TouchEvent && e instanceof TouchEvent
|
|
225
|
+
? e.touches[0]
|
|
226
|
+
: e;
|
|
227
|
+
const eventValue = this.orientation === Orientation.horizontal
|
|
228
|
+
? sourceEvent.pageX - document.documentElement.scrollLeft - this.trackLeft
|
|
229
|
+
: sourceEvent.pageY - document.documentElement.scrollTop;
|
|
230
|
+
this.value = `${this.calculateNewValue(eventValue)}`;
|
|
231
|
+
};
|
|
232
|
+
this.calculateNewValue = (rawValue) => {
|
|
233
|
+
// update the value based on current position
|
|
234
|
+
const newPosition = convertPixelToPercent(rawValue, this.orientation === Orientation.horizontal
|
|
235
|
+
? this.trackMinWidth
|
|
236
|
+
: this.trackMinHeight, this.orientation === Orientation.horizontal
|
|
237
|
+
? this.trackWidth
|
|
238
|
+
: this.trackHeight, this.direction);
|
|
239
|
+
const newValue = (this.max - this.min) * newPosition + this.min;
|
|
240
|
+
return this.convertToConstrainedValue(newValue);
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* Handle a window mouse up during a drag operation
|
|
244
|
+
*/
|
|
245
|
+
this.handleWindowMouseUp = (event) => {
|
|
246
|
+
this.stopDragging();
|
|
247
|
+
};
|
|
248
|
+
this.stopDragging = () => {
|
|
249
|
+
this.isDragging = false;
|
|
250
|
+
this.handleMouseDown(null);
|
|
251
|
+
this.handleThumbMouseDown(null);
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
*
|
|
255
|
+
* @param e - MouseEvent or null. If there is no event handler it will remove the events
|
|
256
|
+
*/
|
|
257
|
+
this.handleMouseDown = (e) => {
|
|
258
|
+
const eventAction = `${e !== null ? "add" : "remove"}EventListener`;
|
|
259
|
+
if (e === null || (!this.disabled && !this.readOnly)) {
|
|
260
|
+
window[eventAction]("mouseup", this.handleWindowMouseUp);
|
|
261
|
+
window.document[eventAction]("mouseleave", this.handleWindowMouseUp);
|
|
262
|
+
window[eventAction]("mousemove", this.handleMouseMove);
|
|
263
|
+
if (e) {
|
|
264
|
+
e.preventDefault();
|
|
265
|
+
this.setupTrackConstraints();
|
|
266
|
+
e.target.focus();
|
|
267
|
+
const controlValue = this.orientation === Orientation.horizontal
|
|
268
|
+
? e.pageX - document.documentElement.scrollLeft - this.trackLeft
|
|
269
|
+
: e.pageY - document.documentElement.scrollTop;
|
|
270
|
+
this.value = `${this.calculateNewValue(controlValue)}`;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
this.convertToConstrainedValue = (value) => {
|
|
275
|
+
if (isNaN(value)) {
|
|
276
|
+
value = this.min;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* The following logic intends to overcome the issue with math in JavaScript with regards to floating point numbers.
|
|
280
|
+
* 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
|
|
281
|
+
* and is converted to an integer by determining the number of decimal places it represent, multiplying it until it is an
|
|
282
|
+
* integer and then dividing it to get back to the correct number.
|
|
283
|
+
*/
|
|
284
|
+
let constrainedValue = value - this.min;
|
|
285
|
+
const roundedConstrainedValue = Math.round(constrainedValue / this.step);
|
|
286
|
+
const remainderValue = constrainedValue -
|
|
287
|
+
(roundedConstrainedValue * (this.stepMultiplier * this.step)) /
|
|
288
|
+
this.stepMultiplier;
|
|
289
|
+
constrainedValue =
|
|
290
|
+
remainderValue >= Number(this.step) / 2
|
|
291
|
+
? constrainedValue - remainderValue + Number(this.step)
|
|
292
|
+
: constrainedValue - remainderValue;
|
|
293
|
+
return constrainedValue + this.min;
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
readOnlyChanged() {
|
|
297
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
298
|
+
this.proxy.readOnly = this.readOnly;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* The value property, typed as a number.
|
|
303
|
+
*
|
|
304
|
+
* @public
|
|
305
|
+
*/
|
|
306
|
+
get valueAsNumber() {
|
|
307
|
+
return parseFloat(super.value);
|
|
308
|
+
}
|
|
309
|
+
set valueAsNumber(next) {
|
|
310
|
+
this.value = next.toString();
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* @internal
|
|
314
|
+
*/
|
|
315
|
+
valueChanged(previous, next) {
|
|
316
|
+
super.valueChanged(previous, next);
|
|
317
|
+
if (this.$fastController.isConnected) {
|
|
318
|
+
this.setThumbPositionForOrientation(this.direction);
|
|
319
|
+
}
|
|
320
|
+
this.$emit("change");
|
|
321
|
+
}
|
|
322
|
+
minChanged() {
|
|
323
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
324
|
+
this.proxy.min = `${this.min}`;
|
|
325
|
+
}
|
|
326
|
+
this.validate();
|
|
327
|
+
}
|
|
328
|
+
maxChanged() {
|
|
329
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
330
|
+
this.proxy.max = `${this.max}`;
|
|
331
|
+
}
|
|
332
|
+
this.validate();
|
|
333
|
+
}
|
|
334
|
+
stepChanged() {
|
|
335
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
336
|
+
this.proxy.step = `${this.step}`;
|
|
337
|
+
}
|
|
338
|
+
this.updateStepMultiplier();
|
|
339
|
+
this.validate();
|
|
340
|
+
}
|
|
341
|
+
orientationChanged() {
|
|
342
|
+
if (this.$fastController.isConnected) {
|
|
343
|
+
this.setThumbPositionForOrientation(this.direction);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* @internal
|
|
348
|
+
*/
|
|
349
|
+
connectedCallback() {
|
|
350
|
+
super.connectedCallback();
|
|
351
|
+
this.proxy.setAttribute("type", "range");
|
|
352
|
+
this.direction = getDirection(this);
|
|
353
|
+
this.updateStepMultiplier();
|
|
354
|
+
this.setupTrackConstraints();
|
|
355
|
+
this.setupListeners();
|
|
356
|
+
this.setupDefaultValue();
|
|
357
|
+
this.setThumbPositionForOrientation(this.direction);
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* @internal
|
|
361
|
+
*/
|
|
362
|
+
disconnectedCallback() {
|
|
363
|
+
this.setupListeners(true);
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Increment the value by the step
|
|
367
|
+
*
|
|
368
|
+
* @public
|
|
369
|
+
*/
|
|
370
|
+
increment() {
|
|
371
|
+
const newVal = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical
|
|
372
|
+
? Number(this.value) + Number(this.step)
|
|
373
|
+
: Number(this.value) - Number(this.step);
|
|
374
|
+
const incrementedVal = this.convertToConstrainedValue(newVal);
|
|
375
|
+
const incrementedValString = incrementedVal < Number(this.max) ? `${incrementedVal}` : `${this.max}`;
|
|
376
|
+
this.value = incrementedValString;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Decrement the value by the step
|
|
380
|
+
*
|
|
381
|
+
* @public
|
|
382
|
+
*/
|
|
383
|
+
decrement() {
|
|
384
|
+
const newVal = this.direction !== Direction.rtl && this.orientation !== Orientation.vertical
|
|
385
|
+
? Number(this.value) - Number(this.step)
|
|
386
|
+
: Number(this.value) + Number(this.step);
|
|
387
|
+
const decrementedVal = this.convertToConstrainedValue(newVal);
|
|
388
|
+
const decrementedValString = decrementedVal > Number(this.min) ? `${decrementedVal}` : `${this.min}`;
|
|
389
|
+
this.value = decrementedValString;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Places the thumb based on the current value
|
|
393
|
+
*
|
|
394
|
+
* @public
|
|
395
|
+
* @param direction - writing mode
|
|
396
|
+
*/
|
|
397
|
+
setThumbPositionForOrientation(direction) {
|
|
398
|
+
const newPct = convertPixelToPercent(Number(this.value), Number(this.min), Number(this.max), direction);
|
|
399
|
+
const percentage = (1 - newPct) * 100;
|
|
400
|
+
if (this.orientation === Orientation.horizontal) {
|
|
401
|
+
this.position = this.isDragging
|
|
402
|
+
? `right: ${percentage}%; transition: none;`
|
|
403
|
+
: `right: ${percentage}%; transition: all 0.2s ease;`;
|
|
404
|
+
}
|
|
405
|
+
else {
|
|
406
|
+
this.position = this.isDragging
|
|
407
|
+
? `bottom: ${percentage}%; transition: none;`
|
|
408
|
+
: `bottom: ${percentage}%; transition: all 0.2s ease;`;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Update the step multiplier used to ensure rounding errors from steps that
|
|
413
|
+
* are not whole numbers
|
|
414
|
+
*/
|
|
415
|
+
updateStepMultiplier() {
|
|
416
|
+
const stepString = this.step + "";
|
|
417
|
+
const decimalPlacesOfStep = !!(this.step % 1)
|
|
418
|
+
? stepString.length - stepString.indexOf(".") - 1
|
|
419
|
+
: 0;
|
|
420
|
+
this.stepMultiplier = Math.pow(10, decimalPlacesOfStep);
|
|
421
|
+
}
|
|
422
|
+
get midpoint() {
|
|
423
|
+
return `${this.convertToConstrainedValue((this.max + this.min) / 2)}`;
|
|
424
|
+
}
|
|
425
|
+
setupDefaultValue() {
|
|
426
|
+
if (typeof this.value === "string") {
|
|
427
|
+
if (this.value.length === 0) {
|
|
428
|
+
this.initialValue = this.midpoint;
|
|
429
|
+
}
|
|
430
|
+
else {
|
|
431
|
+
const value = parseFloat(this.value);
|
|
432
|
+
if (!Number.isNaN(value) && (value < this.min || value > this.max)) {
|
|
433
|
+
this.value = this.midpoint;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
__decorate([
|
|
440
|
+
attr({ attribute: "readonly", mode: "boolean" })
|
|
441
|
+
], Slider$1.prototype, "readOnly", void 0);
|
|
442
|
+
__decorate([
|
|
443
|
+
observable
|
|
444
|
+
], Slider$1.prototype, "direction", void 0);
|
|
445
|
+
__decorate([
|
|
446
|
+
observable
|
|
447
|
+
], Slider$1.prototype, "isDragging", void 0);
|
|
448
|
+
__decorate([
|
|
449
|
+
observable
|
|
450
|
+
], Slider$1.prototype, "position", void 0);
|
|
451
|
+
__decorate([
|
|
452
|
+
observable
|
|
453
|
+
], Slider$1.prototype, "trackWidth", void 0);
|
|
454
|
+
__decorate([
|
|
455
|
+
observable
|
|
456
|
+
], Slider$1.prototype, "trackMinWidth", void 0);
|
|
457
|
+
__decorate([
|
|
458
|
+
observable
|
|
459
|
+
], Slider$1.prototype, "trackHeight", void 0);
|
|
460
|
+
__decorate([
|
|
461
|
+
observable
|
|
462
|
+
], Slider$1.prototype, "trackLeft", void 0);
|
|
463
|
+
__decorate([
|
|
464
|
+
observable
|
|
465
|
+
], Slider$1.prototype, "trackMinHeight", void 0);
|
|
466
|
+
__decorate([
|
|
467
|
+
observable
|
|
468
|
+
], Slider$1.prototype, "valueTextFormatter", void 0);
|
|
469
|
+
__decorate([
|
|
470
|
+
attr({ converter: nullableNumberConverter })
|
|
471
|
+
], Slider$1.prototype, "min", void 0);
|
|
472
|
+
__decorate([
|
|
473
|
+
attr({ converter: nullableNumberConverter })
|
|
474
|
+
], Slider$1.prototype, "max", void 0);
|
|
475
|
+
__decorate([
|
|
476
|
+
attr({ converter: nullableNumberConverter })
|
|
477
|
+
], Slider$1.prototype, "step", void 0);
|
|
478
|
+
__decorate([
|
|
479
|
+
attr
|
|
480
|
+
], Slider$1.prototype, "orientation", void 0);
|
|
481
|
+
__decorate([
|
|
482
|
+
attr
|
|
483
|
+
], Slider$1.prototype, "mode", void 0);
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* This method keeps a given value within the bounds of a min and max value. If the value
|
|
487
|
+
* is larger than the max, the minimum value will be returned. If the value is smaller than the minimum,
|
|
488
|
+
* the maximum will be returned. Otherwise, the value is returned un-changed.
|
|
489
|
+
*/
|
|
490
|
+
/**
|
|
491
|
+
* Ensures that a value is between a min and max value. If value is lower than min, min will be returned.
|
|
492
|
+
* If value is greater than max, max will be returned.
|
|
493
|
+
*/
|
|
494
|
+
function limit(min, max, value) {
|
|
495
|
+
return Math.min(Math.max(value, min), max);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
const styles = ":host {\n display: inline-block;\n width: 100%;\n}\n\n:host([orientation=vertical]) {\n height: 100%;\n min-height: calc(var(--_thumb-interaction-indicator-size) * 5);\n}\n\n:host([disabled]) {\n cursor: not-allowed;\n}\n\n.control {\n --_thumb-size: 12px;\n --_thumb-interaction-indicator-size: 36px;\n height: var(--_thumb-interaction-indicator-size);\n cursor: pointer;\n outline: none;\n user-select: none;\n}\n@supports selector(:focus-visible) {\n .control:focus-visible {\n outline: none;\n }\n}\n.control .positioning-region {\n position: relative;\n}\n.control .track {\n position: absolute;\n background: var(--_track-background-color);\n border-radius: 4px;\n}\n.control .track .track-start {\n position: absolute;\n left: 0;\n height: 100%;\n background: var(--_track-start-background-color);\n border-radius: 4px;\n}\n.control .thumb-container {\n position: absolute;\n width: var(--_thumb-interaction-indicator-size);\n height: var(--_thumb-interaction-indicator-size);\n cursor: inherit;\n touch-action: none;\n}\n.control .thumb-container::before {\n position: absolute;\n display: block;\n width: var(--_thumb-interaction-indicator-size);\n height: var(--_thumb-interaction-indicator-size);\n background-color: var(--_track-start-background-color);\n border-radius: 50%;\n content: \"\";\n opacity: var(--_thumb-interaction-indicator-alpha, 0);\n transition: opacity 0.2s ease-out 0s;\n}\n.control .thumb-container::after {\n position: absolute;\n display: block;\n width: var(--_thumb-size);\n height: var(--_thumb-size);\n background-color: var(--_track-start-background-color);\n border-radius: 50%;\n content: \"\";\n inset: calc((var(--_thumb-interaction-indicator-size) - var(--_thumb-size)) / 2);\n}\n.control[aria-orientation=horizontal] {\n width: calc(100% - var(--_thumb-size));\n min-width: var(--_thumb-size);\n margin-left: calc(var(--_thumb-size) / 2);\n}\n.control[aria-orientation=horizontal] .track {\n top: calc((var(--_thumb-interaction-indicator-size) - 2px) / 2);\n right: 0;\n left: 0;\n height: 2px;\n}\n.control[aria-orientation=horizontal] .track .mark {\n width: 100%;\n height: 4px;\n}\n.control[aria-orientation=horizontal] .thumb-container {\n transform: translateX(calc(var(--_thumb-interaction-indicator-size) / 2));\n}\n.control[aria-orientation=vertical] {\n height: calc(100% - var(--_thumb-interaction-indicator-size));\n min-height: var(--_thumb-interaction-indicator-size);\n margin-top: calc(var(--_thumb-interaction-indicator-size) / 2);\n}\n.control[aria-orientation=vertical] .positioning-region {\n height: 100%;\n}\n.control[aria-orientation=vertical] .track {\n left: calc((var(--_thumb-interaction-indicator-size) - 2px) / 2);\n width: 2px;\n height: 100%;\n}\n.control[aria-orientation=vertical] .track .mark {\n width: 4px;\n height: 100%;\n}\n.control[aria-orientation=vertical] .track-start {\n top: 0;\n width: 100%;\n height: auto;\n}\n.control[aria-orientation=vertical] .thumb-container {\n transform: translateY(calc(var(--_thumb-interaction-indicator-size) / 2));\n}\n.control.disabled {\n --_track-background-color: var(--vvd-color-neutral-100);\n --_track-start-background-color: var(--vvd-color-neutral-500);\n pointer-events: none;\n}\n.control:not(.disabled) {\n --_track-background-color: var(--vvd-color-neutral-300);\n --_track-start-background-color: var(--vvd-color-canvas-text);\n}\n.control:not(.disabled) .thumb-container:hover {\n --_thumb-interaction-indicator-alpha: 0.12;\n}\n.control:not(.disabled) .thumb-container:active {\n --_thumb-interaction-indicator-alpha: 0.25;\n}\n\n.focus-indicator {\n --focus-inset: -3px;\n --focus-stroke-gap-color: transparent;\n border-radius: 50%;\n}\n.control:not(:focus-visible) .focus-indicator {\n display: none;\n}";
|
|
499
|
+
|
|
10
500
|
var __defProp = Object.defineProperty;
|
|
11
501
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
502
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -18,119 +508,82 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
18
508
|
__defProp(target, key, result);
|
|
19
509
|
return result;
|
|
20
510
|
};
|
|
21
|
-
class
|
|
511
|
+
class Slider extends Slider$1 {
|
|
22
512
|
constructor() {
|
|
23
513
|
super(...arguments);
|
|
24
|
-
this.
|
|
25
|
-
this.disabled = false;
|
|
26
|
-
this.ariaLabel = null;
|
|
27
|
-
this.ariaExpanded = null;
|
|
514
|
+
this.markers = false;
|
|
28
515
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
516
|
+
/**
|
|
517
|
+
* TO BE REMOVED WHEN UPGRADING TO FAST-FOUNDATION 3
|
|
518
|
+
*
|
|
519
|
+
* @internal
|
|
520
|
+
*/
|
|
521
|
+
valueChanged(previous, next) {
|
|
522
|
+
if (this.$fastController.isConnected) {
|
|
523
|
+
const nextAsNumber = parseFloat(next);
|
|
524
|
+
const value = limit(
|
|
525
|
+
this.min,
|
|
526
|
+
this.max,
|
|
527
|
+
this["convertToConstrainedValue"](nextAsNumber)
|
|
528
|
+
).toString();
|
|
529
|
+
if (value !== next) {
|
|
530
|
+
this.value = value;
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
super.valueChanged(previous, value);
|
|
534
|
+
}
|
|
34
535
|
}
|
|
35
536
|
}
|
|
36
537
|
__decorateClass([
|
|
37
|
-
attr
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
], SplitButton.prototype, "shape", 2);
|
|
42
|
-
__decorateClass([
|
|
43
|
-
attr
|
|
44
|
-
], SplitButton.prototype, "appearance", 2);
|
|
45
|
-
__decorateClass([
|
|
46
|
-
attr
|
|
47
|
-
], SplitButton.prototype, "size", 2);
|
|
48
|
-
__decorateClass([
|
|
49
|
-
attr
|
|
50
|
-
], SplitButton.prototype, "label", 2);
|
|
51
|
-
__decorateClass([
|
|
52
|
-
attr
|
|
53
|
-
], SplitButton.prototype, "icon", 2);
|
|
54
|
-
__decorateClass([
|
|
55
|
-
attr({ attribute: "split-indicator", mode: "fromView" })
|
|
56
|
-
], SplitButton.prototype, "splitIndicator", 2);
|
|
57
|
-
__decorateClass([
|
|
58
|
-
attr({ attribute: "disabled", mode: "boolean" })
|
|
59
|
-
], SplitButton.prototype, "disabled", 2);
|
|
60
|
-
__decorateClass([
|
|
61
|
-
attr({ attribute: "aria-label" })
|
|
62
|
-
], SplitButton.prototype, "ariaLabel", 2);
|
|
63
|
-
__decorateClass([
|
|
64
|
-
attr({ attribute: "aria-expanded" })
|
|
65
|
-
], SplitButton.prototype, "ariaExpanded", 2);
|
|
66
|
-
applyMixins(SplitButton, AffixIcon);
|
|
538
|
+
attr({
|
|
539
|
+
mode: "boolean"
|
|
540
|
+
})
|
|
541
|
+
], Slider.prototype, "markers", 2);
|
|
67
542
|
|
|
68
|
-
const styles = "/**\n * Do not edit directly\n * Generated on Tue, 26 Sep 2023 13:00:58 GMT\n */\n:host {\n display: inline-block;\n}\n\n.base {\n display: inline-flex;\n justify-content: flex-start;\n inline-size: inherit;\n}\n\n.control,\n.indicator {\n position: relative;\n display: inline-flex;\n box-sizing: border-box;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n padding: 0;\n border: 1px solid var(--_appearance-color-outline);\n margin: 0;\n background-color: var(--_appearance-color-fill);\n block-size: var(--_split-button-block-size);\n color: var(--_appearance-color-text);\n vertical-align: middle;\n}\n.control.connotation-cta,\n.indicator.connotation-cta {\n /* @cssprop [--vvd-split-button-cta-primary=var(--vvd-color-cta-500)] */\n --_connotation-color-primary: var(--vvd-split-button-cta-primary, var(--vvd-color-cta-500));\n /* @cssprop [--vvd-split-button-cta-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-split-button-cta-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-split-button-cta-primary-increment=var(--vvd-color-cta-600)] */\n --_connotation-color-primary-increment: var(--vvd-split-button-cta-primary-increment, var(--vvd-color-cta-600));\n /* @cssprop [--vvd-split-button-cta-contrast=var(--vvd-color-cta-800)] */\n --_connotation-color-contrast: var(--vvd-split-button-cta-contrast, var(--vvd-color-cta-800));\n /* @cssprop [--vvd-split-button-cta-fierce=var(--vvd-color-cta-700)] */\n --_connotation-color-fierce: var(--vvd-split-button-cta-fierce, var(--vvd-color-cta-700));\n /* @cssprop [--vvd-split-button-cta-firm=var(--vvd-color-cta-600)] */\n --_connotation-color-firm: var(--vvd-split-button-cta-firm, var(--vvd-color-cta-600));\n /* @cssprop [--vvd-split-button-cta-soft=var(--vvd-color-cta-100)] */\n --_connotation-color-soft: var(--vvd-split-button-cta-soft, var(--vvd-color-cta-100));\n /* @cssprop [--vvd-split-button-cta-faint=var(--vvd-color-cta-50)] */\n --_connotation-color-faint: var(--vvd-split-button-cta-faint, var(--vvd-color-cta-50));\n}\n.control:not(.connotation-cta),\n.indicator:not(.connotation-cta) {\n /* @cssprop [--vvd-split-button-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-split-button-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-split-button-accent-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-split-button-accent-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-split-button-accent-primary-increment=var(--vvd-color-neutral-800)] */\n --_connotation-color-primary-increment: var(--vvd-split-button-accent-primary-increment, var(--vvd-color-neutral-800));\n /* @cssprop [--vvd-split-button-accent-contrast=var(--vvd-color-neutral-800)] */\n --_connotation-color-contrast: var(--vvd-split-button-accent-contrast, var(--vvd-color-neutral-800));\n /* @cssprop [--vvd-split-button-accent-fierce=var(--vvd-color-neutral-700)] */\n --_connotation-color-fierce: var(--vvd-split-button-accent-fierce, var(--vvd-color-neutral-700));\n /* @cssprop [--vvd-split-button-accent-firm=var(--vvd-color-canvas-text)] */\n --_connotation-color-firm: var(--vvd-split-button-accent-firm, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-split-button-accent-soft=var(--vvd-color-neutral-100)] */\n --_connotation-color-soft: var(--vvd-split-button-accent-soft, var(--vvd-color-neutral-100));\n /* @cssprop [--vvd-split-button-accent-faint=var(--vvd-color-neutral-50)] */\n --_connotation-color-faint: var(--vvd-split-button-accent-faint, var(--vvd-color-neutral-50));\n}\n.control.appearance-filled,\n.indicator.appearance-filled {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: transparent;\n}\n.control.appearance-outlined,\n.indicator.appearance-outlined {\n --_appearance-color-text: var(--_connotation-color-firm);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.control,\n.indicator {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-filled,\n.indicator:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-filled {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary-increment);\n --_appearance-color-outline: transparent;\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-outlined,\n.indicator:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-outlined {\n --_appearance-color-text: var(--_connotation-color-firm);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)),\n.indicator:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-faint);\n --_appearance-color-outline: transparent;\n}\n.control:where(:disabled, .disabled).appearance-filled,\n.indicator:where(:disabled, .disabled).appearance-filled {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: transparent;\n}\n.control:where(:disabled, .disabled).appearance-outlined,\n.indicator:where(:disabled, .disabled).appearance-outlined {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: var(--vvd-color-neutral-300);\n}\n.control:where(:disabled, .disabled),\n.indicator:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: transparent;\n --_appearance-color-outline: transparent;\n}\n.control:where(:active, .active):where(:not(:disabled, .disabled)).appearance-filled,\n.indicator:where(:active, .active):where(:not(:disabled, .disabled)).appearance-filled {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-fierce);\n --_appearance-color-outline: transparent;\n}\n.control:where(:active, .active):where(:not(:disabled, .disabled)).appearance-outlined,\n.indicator:where(:active, .active):where(:not(:disabled, .disabled)).appearance-outlined {\n --_appearance-color-text: var(--_connotation-color-firm);\n --_appearance-color-fill: var(--_connotation-color-soft);\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.control:where(:active, .active):where(:not(:disabled, .disabled)),\n.indicator:where(:active, .active):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--_connotation-color-primary);\n --_appearance-color-fill: var(--_connotation-color-soft);\n --_appearance-color-outline: transparent;\n}\n@supports (user-select: none) {\n .control,\n .indicator {\n user-select: none;\n }\n}\n\n.control {\n border-inline-end: 0;\n gap: var(--_split-button-icon-gap);\n isolation: isolate;\n /* Disabled */\n /* shape */\n /* size */\n}\n.control:focus-visible {\n outline: none;\n}\n.control:not(:disabled) {\n cursor: pointer;\n}\n.control:disabled {\n cursor: not-allowed;\n}\n.control.icon-only {\n contain: size;\n place-content: center;\n}\n@supports (aspect-ratio: 1) {\n .control.icon-only {\n aspect-ratio: 1;\n }\n}\n@supports not (aspect-ratio: 1) {\n .control.icon-only {\n inline-size: var(--_split-button-block-size);\n }\n}\n.control:not(.icon-only) {\n flex-grow: 1;\n inline-size: inherit;\n}\n.control:not(.shape-pill) {\n border-radius: 6px 0 0 6px;\n}\n.control.shape-pill {\n border-radius: 24px 0 0 24px;\n}\n.control.size-super-condensed {\n --_split-button-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16));\n font: var(--vvd-typography-base-condensed-bold);\n}\n.control.size-super-condensed:not(.icon-only) {\n --_split-button-icon-gap: 4px;\n padding-inline: 8px;\n}\n.control.size-condensed {\n --_split-button-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8));\n font: var(--vvd-typography-base-condensed-bold);\n}\n.control.size-condensed:not(.icon-only) {\n --_split-button-icon-gap: 8px;\n padding-inline: 12px;\n}\n.control.size-expanded {\n --_split-button-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 8));\n font: var(--vvd-typography-base-extended-bold);\n}\n.control.size-expanded:not(.icon-only) {\n --_split-button-icon-gap: 10px;\n padding-inline: 20px;\n}\n.control:not(.size-condensed, .size-expanded, .size-super-condensed) {\n --_split-button-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n font: var(--vvd-typography-base-bold);\n}\n.control:not(.size-condensed, .size-expanded, .size-super-condensed):not(.icon-only) {\n --_split-button-icon-gap: 8px;\n padding-inline: 16px;\n}\n.control .text {\n overflow: hidden;\n max-inline-size: 100%;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.indicator {\n border-inline-start: 0;\n inline-size: var(--_split-button-inline-size);\n /* Disabled */\n /* Shape */\n /* size */\n}\n.indicator:focus-visible {\n outline: none;\n}\n.indicator:not(:disabled) {\n cursor: pointer;\n}\n.indicator:disabled {\n cursor: not-allowed;\n}\n.indicator:not(.shape-pill) {\n border-radius: 0 6px 6px 0;\n}\n.indicator.shape-pill {\n border-radius: 0 24px 24px 0;\n}\n.indicator::before {\n position: absolute;\n background-color: var(--_appearance-color-text);\n content: \"\";\n inline-size: 1px;\n inset-inline-start: 0;\n opacity: 0.35;\n}\n.indicator:not(.appearance-filled, .appearance-outlined)::before {\n block-size: 50%;\n}\n.indicator:is(.appearance-filled, .appearance-outlined)::before {\n block-size: 100%;\n}\n.indicator.size-super-condensed {\n --_split-button-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16));\n --_split-button-inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 16));\n font: var(--vvd-typography-base-condensed);\n}\n.indicator.size-condensed {\n --_split-button-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8));\n --_split-button-inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 12));\n font: var(--vvd-typography-base-condensed);\n}\n.indicator.size-expanded {\n --_split-button-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) + 8));\n --_split-button-inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n font: var(--vvd-typography-base-extended);\n}\n.indicator:not(.size-condensed, .size-expanded, .size-super-condensed) {\n --_split-button-block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2)));\n --_split-button-inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 8));\n font: var(--vvd-typography-base-extended);\n}\n\n/* Icon */\n.icon {\n line-height: 1;\n}\n.icon-trailing .icon {\n order: 1;\n}\n.control > .icon {\n font-size: calc(var(--_split-button-block-size) / 2);\n}\n\n/* Focus */\n:not(:focus-visible) > .focus-indicator {\n display: none;\n}\n.control:not(.appearance-filled) .focus-indicator, .indicator:not(.appearance-filled) .focus-indicator {\n --focus-stroke-gap-color: transparent;\n}\n.control.appearance-outlined .focus-indicator, .indicator.appearance-outlined .focus-indicator {\n --focus-inset: -1px;\n}";
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
connotation,
|
|
72
|
-
appearance,
|
|
73
|
-
shape,
|
|
74
|
-
disabled,
|
|
75
|
-
size
|
|
76
|
-
}) => classNames(
|
|
77
|
-
[`connotation-${connotation}`, Boolean(connotation)],
|
|
78
|
-
["disabled", disabled],
|
|
79
|
-
[`shape-${shape}`, Boolean(shape)],
|
|
80
|
-
[`appearance-${appearance}`, Boolean(appearance)],
|
|
81
|
-
[`size-${size}`, Boolean(size)]
|
|
543
|
+
const getClasses = ({ disabled }) => classNames(
|
|
544
|
+
"control",
|
|
545
|
+
["disabled", Boolean(disabled)]
|
|
82
546
|
);
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
const focusTemplate = focusTemplateFactory(context);
|
|
547
|
+
const getMarkersTemplate = (isHorizontal, numMarkers) => {
|
|
548
|
+
const placeholder = isHorizontal ? ["right", "center", "", "100% repeat-x"] : ["bottom", "top", "100%", "repeat-y"];
|
|
86
549
|
return html`
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
${() => focusTemplate}
|
|
94
|
-
${(x) => affixIconTemplate(x.icon)}
|
|
95
|
-
<span class="text">${(x) => x.label}</span>
|
|
96
|
-
</button>
|
|
97
|
-
`;
|
|
98
|
-
}
|
|
99
|
-
function indicatorButton(context) {
|
|
100
|
-
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
550
|
+
<div class="mark" style="
|
|
551
|
+
background: linear-gradient(to ${placeholder[0]}, currentcolor 3px, transparent 0px)
|
|
552
|
+
0px ${placeholder[1]} / ${placeholder[2]} calc((100% - 3px) / ${numMarkers}) ${placeholder[3]}
|
|
553
|
+
"></div>`;
|
|
554
|
+
};
|
|
555
|
+
const SliderTemplate = (context) => {
|
|
101
556
|
const focusTemplate = focusTemplateFactory(context);
|
|
102
557
|
return html`
|
|
103
|
-
<
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
aria-
|
|
108
|
-
aria-
|
|
109
|
-
aria-
|
|
110
|
-
aria-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
${
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
</div
|
|
558
|
+
<div
|
|
559
|
+
role="slider"
|
|
560
|
+
tabindex="${(x) => x.disabled ? null : 0}"
|
|
561
|
+
aria-valuetext="${(x) => x.valueTextFormatter(x.value)}"
|
|
562
|
+
aria-valuenow="${(x) => x.value}"
|
|
563
|
+
aria-valuemin="${(x) => x.min}"
|
|
564
|
+
aria-valuemax="${(x) => x.max}"
|
|
565
|
+
aria-disabled="${(x) => x.disabled ? true : void 0}"
|
|
566
|
+
aria-orientation="${(x) => x.orientation}"
|
|
567
|
+
class="${getClasses} ${(x) => x.orientation}"
|
|
568
|
+
>
|
|
569
|
+
<div class="positioning-region">
|
|
570
|
+
<div ${ref("track")} class="track">
|
|
571
|
+
<div class="track-start" style="${(x) => x.position}"></div>
|
|
572
|
+
${(x) => x.markers ? getMarkersTemplate(x.orientation === Orientation$1.horizontal, Math.floor((x.max - x.min) / x.step)) : void 0}
|
|
573
|
+
</div>
|
|
574
|
+
<div ${ref("thumb")} class="thumb-container" style="${(x) => x.position}">
|
|
575
|
+
${() => focusTemplate}
|
|
576
|
+
</div>
|
|
577
|
+
</div>
|
|
578
|
+
</div>`;
|
|
123
579
|
};
|
|
124
580
|
|
|
125
|
-
const
|
|
126
|
-
baseName: "
|
|
127
|
-
template:
|
|
128
|
-
styles
|
|
129
|
-
shadowOptions: {
|
|
130
|
-
delegatesFocus: true
|
|
131
|
-
}
|
|
581
|
+
const sliderDefinition = Slider.compose({
|
|
582
|
+
baseName: "slider",
|
|
583
|
+
template: SliderTemplate,
|
|
584
|
+
styles
|
|
132
585
|
});
|
|
133
|
-
const
|
|
134
|
-
const
|
|
586
|
+
const sliderRegistries = [sliderDefinition(), ...focusRegistries];
|
|
587
|
+
const registerSlider = registerFactory(sliderRegistries);
|
|
135
588
|
|
|
136
|
-
export {
|
|
589
|
+
export { sliderRegistries as a, registerSlider as r, sliderDefinition as s };
|