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