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