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