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