@vonage/vivid 3.32.0 → 3.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/accordion/index.js +5 -5
- package/accordion-item/index.js +4 -4
- package/action-group/index.js +1 -1
- package/alert/index.js +6 -6
- package/avatar/index.js +2 -2
- package/badge/index.js +2 -2
- package/banner/index.js +5 -5
- package/breadcrumb/index.js +1 -1
- package/breadcrumb-item/index.js +3 -3
- package/button/index.js +4 -4
- package/calendar/index.js +1 -1
- package/calendar-event/index.js +1 -1
- package/card/index.js +3 -3
- package/checkbox/index.js +5 -3
- package/combobox/index.js +8 -8
- package/custom-elements.json +246 -16
- package/data-grid/index.js +2 -2
- package/date-picker/index.js +9 -9
- package/dialog/index.js +6 -6
- package/divider/index.js +1 -1
- package/elevation/index.js +1 -1
- package/empty-state/index.js +2 -2
- package/fab/index.js +4 -4
- package/file-picker/index.js +5 -5
- package/focus/index.js +1 -1
- package/header/index.js +2 -2
- package/icon/index.js +1 -1
- package/index.js +59 -59
- package/layout/index.js +1 -1
- package/lib/calendar/calendar.d.ts +1 -1
- package/lib/date-picker/calendar/dateStr.d.ts +1 -0
- package/lib/date-picker/calendar/month.d.ts +1 -0
- package/lib/date-picker/calendar/year.d.ts +2 -0
- package/lib/date-picker/date-picker.d.ts +2 -0
- package/lib/icon/icon.d.ts +0 -1
- package/lib/listbox/listbox.d.ts +9 -1
- package/lib/text-field/text-field.d.ts +1 -0
- package/listbox/index.js +20 -16
- package/locales/en-GB.js +48 -14
- package/locales/en-US.js +48 -14
- package/locales/ja-JP.js +48 -14
- package/locales/zh-CN.js +48 -14
- package/menu/index.js +8 -8
- package/menu-item/index.js +4 -4
- package/nav/index.js +1 -1
- package/nav-disclosure/index.js +3 -3
- package/nav-item/index.js +3 -3
- package/note/index.js +2 -3
- package/number-field/index.js +6 -6
- package/option/index.js +3 -3
- package/package.json +2 -16
- package/pagination/index.js +5 -5
- package/popup/index.js +6 -6
- package/progress/index.js +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/index.js +2 -2
- package/radio-group/index.js +1 -1
- package/select/index.js +8 -8
- package/shared/affix.js +25 -9
- package/shared/apply-mixins.js +1 -1
- package/shared/breadcrumb-item.js +5 -5
- package/shared/button.js +13 -13
- package/shared/calendar-event.js +36 -16
- package/shared/definition.js +133 -194
- package/shared/definition10.js +225 -40
- package/shared/definition11.js +36 -32
- package/shared/definition12.js +763 -98
- package/shared/definition13.js +125 -89
- package/shared/definition14.js +207 -27
- package/shared/definition15.js +710 -731
- package/shared/definition16.js +1289 -47
- package/shared/definition17.js +6113 -93
- package/shared/definition18.js +242 -164
- package/shared/definition19.js +47 -692
- package/shared/definition2.js +199 -117
- package/shared/definition20.js +59 -1671
- package/shared/definition21.js +95 -255
- package/shared/definition22.js +2218 -1167
- package/shared/definition23.js +61 -5784
- package/shared/definition24.js +28 -117
- package/shared/definition25.js +52 -66
- package/shared/definition26.js +391 -214
- package/shared/definition27.js +441 -34
- package/shared/definition28.js +85 -73
- package/shared/definition29.js +21 -2283
- package/shared/definition3.js +61 -24
- package/shared/definition30.js +13 -49
- package/shared/definition31.js +54 -39
- package/shared/definition32.js +413 -375
- package/shared/definition33.js +223 -304
- package/shared/definition34.js +197 -13
- package/shared/definition35.js +88 -73
- package/shared/definition36.js +75 -25
- package/shared/definition37.js +434 -34
- package/shared/definition38.js +32 -432
- package/shared/definition39.js +677 -187
- package/shared/definition4.js +157 -12
- package/shared/definition40.js +95 -48
- package/shared/definition41.js +577 -31
- package/shared/definition42.js +126 -424
- package/shared/definition43.js +114 -618
- package/shared/definition44.js +24 -80
- package/shared/definition45.js +71 -543
- package/shared/definition46.js +499 -92
- package/shared/definition47.js +19 -133
- package/shared/definition48.js +129 -52
- package/shared/definition49.js +281 -17
- package/shared/definition5.js +71 -36
- package/shared/definition50.js +153 -484
- package/shared/definition51.js +131 -98
- package/shared/definition52.js +131 -16
- package/shared/definition53.js +80 -264
- package/shared/definition54.js +293 -118
- package/shared/definition55.js +12 -117
- package/shared/definition56.js +39 -68
- package/shared/definition57.js +166 -288
- package/shared/definition6.js +56 -111
- package/shared/definition7.js +120 -195
- package/shared/definition8.js +58 -23
- package/shared/definition9.js +92 -66
- package/shared/focus.js +2 -1
- package/shared/focus2.js +1 -1
- package/shared/form-associated.js +2 -2
- package/shared/icon.js +48 -27
- package/shared/index.js +7 -27
- package/shared/index2.js +108 -80
- package/shared/key-codes.js +1 -1
- package/shared/listbox.js +88 -11
- package/shared/patterns/form-elements/form-elements.d.ts +4 -4
- package/shared/radio.js +23 -7
- package/shared/repeat.js +1 -1
- package/shared/text-anchor.js +21 -4
- package/shared/text-anchor.template.js +37 -40
- package/shared/text-field.js +2 -2
- package/shared/text-field2.js +15 -15
- package/shared/tree-item.js +12 -12
- package/side-drawer/index.js +1 -1
- package/slider/index.js +2 -2
- package/split-button/index.js +3 -3
- package/style.css +6097 -0
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/index.js +3 -3
- package/tab/index.js +3 -3
- package/tab-panel/index.js +1 -1
- package/tabs/index.js +5 -5
- package/tag/index.js +3 -3
- package/tag-group/index.js +1 -1
- package/text-anchor/index.js +1 -1
- package/text-area/index.js +3 -3
- package/text-field/index.js +3 -3
- package/toggletip/index.js +7 -7
- package/tooltip/index.js +7 -7
- package/tree-item/index.js +3 -3
- package/tree-view/index.js +1 -1
- package/lib/accordion/index.d.ts +0 -1
- package/lib/accordion-item/index.d.ts +0 -1
- package/lib/action-group/index.d.ts +0 -1
- package/lib/alert/index.d.ts +0 -1
- package/lib/avatar/index.d.ts +0 -1
- package/lib/badge/index.d.ts +0 -1
- package/lib/banner/index.d.ts +0 -1
- package/lib/breadcrumb/index.d.ts +0 -1
- package/lib/breadcrumb-item/index.d.ts +0 -1
- package/lib/button/index.d.ts +0 -1
- package/lib/calendar/index.d.ts +0 -1
- package/lib/calendar-event/index.d.ts +0 -1
- package/lib/card/index.d.ts +0 -1
- package/lib/checkbox/index.d.ts +0 -1
- package/lib/combobox/index.d.ts +0 -1
- package/lib/data-grid/index.d.ts +0 -1
- package/lib/date-picker/index.d.ts +0 -1
- package/lib/dialog/index.d.ts +0 -1
- package/lib/divider/index.d.ts +0 -1
- package/lib/elevation/index.d.ts +0 -1
- package/lib/empty-state/index.d.ts +0 -1
- package/lib/fab/index.d.ts +0 -1
- package/lib/file-picker/index.d.ts +0 -1
- package/lib/focus/index.d.ts +0 -1
- package/lib/header/index.d.ts +0 -1
- package/lib/icon/index.d.ts +0 -1
- package/lib/layout/index.d.ts +0 -1
- package/lib/listbox/index.d.ts +0 -1
- package/lib/menu/index.d.ts +0 -1
- package/lib/menu-item/index.d.ts +0 -1
- package/lib/nav/index.d.ts +0 -1
- package/lib/nav-disclosure/index.d.ts +0 -1
- package/lib/nav-item/index.d.ts +0 -1
- package/lib/note/index.d.ts +0 -1
- package/lib/number-field/index.d.ts +0 -1
- package/lib/option/index.d.ts +0 -1
- package/lib/pagination/index.d.ts +0 -1
- package/lib/popup/index.d.ts +0 -1
- package/lib/progress/index.d.ts +0 -1
- package/lib/progress-ring/index.d.ts +0 -1
- package/lib/radio/index.d.ts +0 -1
- package/lib/radio-group/index.d.ts +0 -1
- package/lib/select/index.d.ts +0 -1
- package/lib/side-drawer/index.d.ts +0 -1
- package/lib/slider/index.d.ts +0 -1
- package/lib/split-button/index.d.ts +0 -1
- package/lib/switch/index.d.ts +0 -1
- package/lib/tab/index.d.ts +0 -1
- package/lib/tab-panel/index.d.ts +0 -1
- package/lib/tabs/index.d.ts +0 -1
- package/lib/tag/index.d.ts +0 -1
- package/lib/tag-group/index.d.ts +0 -1
- package/lib/text-anchor/index.d.ts +0 -1
- package/lib/text-area/index.d.ts +0 -1
- package/lib/text-field/index.d.ts +0 -1
- package/lib/toggletip/index.d.ts +0 -1
- package/lib/tooltip/index.d.ts +0 -1
- package/lib/tree-item/index.d.ts +0 -1
- package/lib/tree-view/index.d.ts +0 -1
package/shared/definition43.js
CHANGED
|
@@ -1,671 +1,167 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import './focus.js';
|
|
8
|
-
import { e as errorText, f as formElements, F as FormElementSuccessText, a as FormElementHelperText, g as getFeedbackTemplate } from './index2.js';
|
|
9
|
-
import { b as ListboxElement, L as Listbox, D as DelegatesARIAListbox, a as Listbox$1 } from './listbox.js';
|
|
10
|
-
import { S as StartEnd } from './start-end.js';
|
|
11
|
-
import { a as applyMixins } from './apply-mixins.js';
|
|
12
|
-
import { F as FormAssociated } from './form-associated.js';
|
|
13
|
-
import { S as SelectPosition } from './select.options.js';
|
|
14
|
-
import { u as uniqueId } from './strings.js';
|
|
15
|
-
import { g as keyTab, f as keyEscape, d as keyEnter, k as keyEnd, a as keyHome, e as keySpace, b as keyArrowDown, c as keyArrowUp } from './key-codes.js';
|
|
1
|
+
import { F as FoundationElement, _ as __decorate, a as attr, o as observable, h as html, r as registerFactory } from './index.js';
|
|
2
|
+
import { a as iconRegistries } from './definition24.js';
|
|
3
|
+
import { f as focusRegistries } from './definition55.js';
|
|
4
|
+
import { C as CheckableFormAssociated } from './form-associated.js';
|
|
5
|
+
import { a as keySpace, k as keyEnter } from './key-codes.js';
|
|
6
|
+
import './affix.js';
|
|
16
7
|
import { f as focusTemplateFactory } from './focus2.js';
|
|
8
|
+
import './index2.js';
|
|
17
9
|
import { w as when } from './when.js';
|
|
18
|
-
import { r as ref } from './ref.js';
|
|
19
|
-
import { s as slotted } from './slotted.js';
|
|
20
10
|
import { c as classNames } from './class-names.js';
|
|
21
11
|
|
|
22
|
-
class
|
|
12
|
+
class _Switch extends FoundationElement {
|
|
23
13
|
}
|
|
24
14
|
/**
|
|
25
|
-
* A form-associated base class for the {@link @microsoft/fast-foundation#(
|
|
15
|
+
* A form-associated base class for the {@link @microsoft/fast-foundation#(Switch:class)} component.
|
|
26
16
|
*
|
|
27
17
|
* @internal
|
|
28
18
|
*/
|
|
29
|
-
class
|
|
19
|
+
class FormAssociatedSwitch extends CheckableFormAssociated(_Switch) {
|
|
30
20
|
constructor() {
|
|
31
21
|
super(...arguments);
|
|
32
|
-
this.proxy = document.createElement("
|
|
22
|
+
this.proxy = document.createElement("input");
|
|
33
23
|
}
|
|
34
24
|
}
|
|
35
25
|
|
|
36
26
|
/**
|
|
37
|
-
* A
|
|
38
|
-
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#
|
|
27
|
+
* A Switch Custom HTML Element.
|
|
28
|
+
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#switch | ARIA switch }.
|
|
39
29
|
*
|
|
40
|
-
* @slot
|
|
41
|
-
* @slot
|
|
42
|
-
* @slot
|
|
43
|
-
* @
|
|
44
|
-
* @
|
|
45
|
-
* @
|
|
46
|
-
* @csspart
|
|
47
|
-
* @csspart
|
|
48
|
-
* @
|
|
49
|
-
* @csspart listbox - The listbox element
|
|
50
|
-
* @fires input - Fires a custom 'input' event when the value updates
|
|
51
|
-
* @fires change - Fires a custom 'change' event when the value updates
|
|
30
|
+
* @slot - The deafult slot for the label
|
|
31
|
+
* @slot checked-message - The message when in a checked state
|
|
32
|
+
* @slot unchecked-message - The message when in an unchecked state
|
|
33
|
+
* @csspart label - The label
|
|
34
|
+
* @csspart switch - The element representing the switch, which wraps the indicator
|
|
35
|
+
* @csspart status-message - The wrapper for the status messages
|
|
36
|
+
* @csspart checked-message - The checked message
|
|
37
|
+
* @csspart unchecked-message - The unchecked message
|
|
38
|
+
* @fires change - Emits a custom change event when the checked state changes
|
|
52
39
|
*
|
|
53
40
|
* @public
|
|
54
41
|
*/
|
|
55
|
-
|
|
42
|
+
let Switch$1 = class Switch extends FormAssociatedSwitch {
|
|
56
43
|
constructor() {
|
|
57
|
-
super(
|
|
58
|
-
/**
|
|
59
|
-
* The open attribute.
|
|
60
|
-
*
|
|
61
|
-
* @public
|
|
62
|
-
* @remarks
|
|
63
|
-
* HTML Attribute: open
|
|
64
|
-
*/
|
|
65
|
-
this.open = false;
|
|
66
|
-
/**
|
|
67
|
-
* Indicates the initial state of the position attribute.
|
|
68
|
-
*
|
|
69
|
-
* @internal
|
|
70
|
-
*/
|
|
71
|
-
this.forcedPosition = false;
|
|
44
|
+
super();
|
|
72
45
|
/**
|
|
73
|
-
* The
|
|
46
|
+
* The element's value to be included in form submission when checked.
|
|
47
|
+
* Default to "on" to reach parity with input[type="checkbox"]
|
|
74
48
|
*
|
|
75
49
|
* @internal
|
|
76
50
|
*/
|
|
77
|
-
this.
|
|
51
|
+
this.initialValue = "on";
|
|
78
52
|
/**
|
|
79
|
-
* The max height for the listbox when opened.
|
|
80
|
-
*
|
|
81
53
|
* @internal
|
|
82
54
|
*/
|
|
83
|
-
this.
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Sets focus and synchronizes ARIA attributes when the open property changes.
|
|
87
|
-
*
|
|
88
|
-
* @param prev - the previous open value
|
|
89
|
-
* @param next - the current open value
|
|
90
|
-
*
|
|
91
|
-
* @internal
|
|
92
|
-
*/
|
|
93
|
-
openChanged(prev, next) {
|
|
94
|
-
if (!this.collapsible) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
if (this.open) {
|
|
98
|
-
this.ariaControls = this.listboxId;
|
|
99
|
-
this.ariaExpanded = "true";
|
|
100
|
-
this.setPositioning();
|
|
101
|
-
this.focusAndScrollOptionIntoView();
|
|
102
|
-
this.indexWhenOpened = this.selectedIndex;
|
|
103
|
-
// focus is directed to the element when `open` is changed programmatically
|
|
104
|
-
DOM.queueUpdate(() => this.focus());
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
this.ariaControls = "";
|
|
108
|
-
this.ariaExpanded = "false";
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* The component is collapsible when in single-selection mode with no size attribute.
|
|
112
|
-
*
|
|
113
|
-
* @internal
|
|
114
|
-
*/
|
|
115
|
-
get collapsible() {
|
|
116
|
-
return !(this.multiple || typeof this.size === "number");
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* The value property.
|
|
120
|
-
*
|
|
121
|
-
* @public
|
|
122
|
-
*/
|
|
123
|
-
get value() {
|
|
124
|
-
Observable.track(this, "value");
|
|
125
|
-
return this._value;
|
|
126
|
-
}
|
|
127
|
-
set value(next) {
|
|
128
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
129
|
-
const prev = `${this._value}`;
|
|
130
|
-
if ((_a = this._options) === null || _a === void 0 ? void 0 : _a.length) {
|
|
131
|
-
const selectedIndex = this._options.findIndex(el => el.value === next);
|
|
132
|
-
const prevSelectedValue = (_c = (_b = this._options[this.selectedIndex]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : null;
|
|
133
|
-
const nextSelectedValue = (_e = (_d = this._options[selectedIndex]) === null || _d === void 0 ? void 0 : _d.value) !== null && _e !== void 0 ? _e : null;
|
|
134
|
-
if (selectedIndex === -1 || prevSelectedValue !== nextSelectedValue) {
|
|
135
|
-
next = "";
|
|
136
|
-
this.selectedIndex = selectedIndex;
|
|
137
|
-
}
|
|
138
|
-
next = (_g = (_f = this.firstSelectedOption) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : next;
|
|
139
|
-
}
|
|
140
|
-
if (prev !== next) {
|
|
141
|
-
this._value = next;
|
|
142
|
-
super.valueChanged(prev, next);
|
|
143
|
-
Observable.notify(this, "value");
|
|
144
|
-
this.updateDisplayValue();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Sets the value and display value to match the first selected option.
|
|
149
|
-
*
|
|
150
|
-
* @param shouldEmit - if true, the input and change events will be emitted
|
|
151
|
-
*
|
|
152
|
-
* @internal
|
|
153
|
-
*/
|
|
154
|
-
updateValue(shouldEmit) {
|
|
155
|
-
var _a, _b;
|
|
156
|
-
if (this.$fastController.isConnected) {
|
|
157
|
-
this.value = (_b = (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
|
|
158
|
-
}
|
|
159
|
-
if (shouldEmit) {
|
|
160
|
-
this.$emit("input");
|
|
161
|
-
this.$emit("change", this, {
|
|
162
|
-
bubbles: true,
|
|
163
|
-
composed: undefined,
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Updates the proxy value when the selected index changes.
|
|
169
|
-
*
|
|
170
|
-
* @param prev - the previous selected index
|
|
171
|
-
* @param next - the next selected index
|
|
172
|
-
*
|
|
173
|
-
* @internal
|
|
174
|
-
*/
|
|
175
|
-
selectedIndexChanged(prev, next) {
|
|
176
|
-
super.selectedIndexChanged(prev, next);
|
|
177
|
-
this.updateValue();
|
|
178
|
-
}
|
|
179
|
-
positionChanged(prev, next) {
|
|
180
|
-
this.positionAttribute = next;
|
|
181
|
-
this.setPositioning();
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Calculate and apply listbox positioning based on available viewport space.
|
|
185
|
-
*
|
|
186
|
-
* @public
|
|
187
|
-
*/
|
|
188
|
-
setPositioning() {
|
|
189
|
-
const currentBox = this.getBoundingClientRect();
|
|
190
|
-
const viewportHeight = window.innerHeight;
|
|
191
|
-
const availableBottom = viewportHeight - currentBox.bottom;
|
|
192
|
-
this.position = this.forcedPosition
|
|
193
|
-
? this.positionAttribute
|
|
194
|
-
: currentBox.top > availableBottom
|
|
195
|
-
? SelectPosition.above
|
|
196
|
-
: SelectPosition.below;
|
|
197
|
-
this.positionAttribute = this.forcedPosition
|
|
198
|
-
? this.positionAttribute
|
|
199
|
-
: this.position;
|
|
200
|
-
this.maxHeight =
|
|
201
|
-
this.position === SelectPosition.above ? ~~currentBox.top : ~~availableBottom;
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* The value displayed on the button.
|
|
205
|
-
*
|
|
206
|
-
* @public
|
|
207
|
-
*/
|
|
208
|
-
get displayValue() {
|
|
209
|
-
var _a, _b;
|
|
210
|
-
Observable.track(this, "displayValue");
|
|
211
|
-
return (_b = (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text) !== null && _b !== void 0 ? _b : "";
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Synchronize the `aria-disabled` property when the `disabled` property changes.
|
|
215
|
-
*
|
|
216
|
-
* @param prev - The previous disabled value
|
|
217
|
-
* @param next - The next disabled value
|
|
218
|
-
*
|
|
219
|
-
* @internal
|
|
220
|
-
*/
|
|
221
|
-
disabledChanged(prev, next) {
|
|
222
|
-
if (super.disabledChanged) {
|
|
223
|
-
super.disabledChanged(prev, next);
|
|
224
|
-
}
|
|
225
|
-
this.ariaDisabled = this.disabled ? "true" : "false";
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Reset the element to its first selectable option when its parent form is reset.
|
|
229
|
-
*
|
|
230
|
-
* @internal
|
|
231
|
-
*/
|
|
232
|
-
formResetCallback() {
|
|
233
|
-
this.setProxyOptions();
|
|
234
|
-
// Call the base class's implementation setDefaultSelectedOption instead of the select's
|
|
235
|
-
// override, in order to reset the selectedIndex without using the value property.
|
|
236
|
-
super.setDefaultSelectedOption();
|
|
237
|
-
if (this.selectedIndex === -1) {
|
|
238
|
-
this.selectedIndex = 0;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Handle opening and closing the listbox when the select is clicked.
|
|
243
|
-
*
|
|
244
|
-
* @param e - the mouse event
|
|
245
|
-
* @internal
|
|
246
|
-
*/
|
|
247
|
-
clickHandler(e) {
|
|
248
|
-
// do nothing if the select is disabled
|
|
249
|
-
if (this.disabled) {
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
if (this.open) {
|
|
253
|
-
const captured = e.target.closest(`option,[role=option]`);
|
|
254
|
-
if (captured && captured.disabled) {
|
|
55
|
+
this.keypressHandler = (e) => {
|
|
56
|
+
if (this.readOnly) {
|
|
255
57
|
return;
|
|
256
58
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
return true;
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Handles focus state when the element or its children lose focus.
|
|
267
|
-
*
|
|
268
|
-
* @param e - The focus event
|
|
269
|
-
* @internal
|
|
270
|
-
*/
|
|
271
|
-
focusoutHandler(e) {
|
|
272
|
-
var _a;
|
|
273
|
-
super.focusoutHandler(e);
|
|
274
|
-
if (!this.open) {
|
|
275
|
-
return true;
|
|
276
|
-
}
|
|
277
|
-
const focusTarget = e.relatedTarget;
|
|
278
|
-
if (this.isSameNode(focusTarget)) {
|
|
279
|
-
this.focus();
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
if (!((_a = this.options) === null || _a === void 0 ? void 0 : _a.includes(focusTarget))) {
|
|
283
|
-
this.open = false;
|
|
284
|
-
if (this.indexWhenOpened !== this.selectedIndex) {
|
|
285
|
-
this.updateValue(true);
|
|
59
|
+
switch (e.key) {
|
|
60
|
+
case keyEnter:
|
|
61
|
+
case keySpace:
|
|
62
|
+
this.checked = !this.checked;
|
|
63
|
+
break;
|
|
286
64
|
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
*
|
|
295
|
-
* @internal
|
|
296
|
-
* @override
|
|
297
|
-
*/
|
|
298
|
-
handleChange(source, propertyName) {
|
|
299
|
-
super.handleChange(source, propertyName);
|
|
300
|
-
if (propertyName === "value") {
|
|
301
|
-
this.updateValue();
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Synchronize the form-associated proxy and updates the value property of the element.
|
|
306
|
-
*
|
|
307
|
-
* @param prev - the previous collection of slotted option elements
|
|
308
|
-
* @param next - the next collection of slotted option elements
|
|
309
|
-
*
|
|
310
|
-
* @internal
|
|
311
|
-
*/
|
|
312
|
-
slottedOptionsChanged(prev, next) {
|
|
313
|
-
this.options.forEach(o => {
|
|
314
|
-
const notifier = Observable.getNotifier(o);
|
|
315
|
-
notifier.unsubscribe(this, "value");
|
|
316
|
-
});
|
|
317
|
-
super.slottedOptionsChanged(prev, next);
|
|
318
|
-
this.options.forEach(o => {
|
|
319
|
-
const notifier = Observable.getNotifier(o);
|
|
320
|
-
notifier.subscribe(this, "value");
|
|
321
|
-
});
|
|
322
|
-
this.setProxyOptions();
|
|
323
|
-
this.updateValue();
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* Prevents focus when size is set and a scrollbar is clicked.
|
|
327
|
-
*
|
|
328
|
-
* @param e - the mouse event object
|
|
329
|
-
*
|
|
330
|
-
* @override
|
|
331
|
-
* @internal
|
|
332
|
-
*/
|
|
333
|
-
mousedownHandler(e) {
|
|
334
|
-
var _a;
|
|
335
|
-
if (e.offsetX >= 0 && e.offsetX <= ((_a = this.listbox) === null || _a === void 0 ? void 0 : _a.scrollWidth)) {
|
|
336
|
-
return super.mousedownHandler(e);
|
|
337
|
-
}
|
|
338
|
-
return this.collapsible;
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* Sets the multiple property on the proxy element.
|
|
342
|
-
*
|
|
343
|
-
* @param prev - the previous multiple value
|
|
344
|
-
* @param next - the current multiple value
|
|
345
|
-
*/
|
|
346
|
-
multipleChanged(prev, next) {
|
|
347
|
-
super.multipleChanged(prev, next);
|
|
348
|
-
if (this.proxy) {
|
|
349
|
-
this.proxy.multiple = next;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* Updates the selectedness of each option when the list of selected options changes.
|
|
354
|
-
*
|
|
355
|
-
* @param prev - the previous list of selected options
|
|
356
|
-
* @param next - the current list of selected options
|
|
357
|
-
*
|
|
358
|
-
* @override
|
|
359
|
-
* @internal
|
|
360
|
-
*/
|
|
361
|
-
selectedOptionsChanged(prev, next) {
|
|
362
|
-
var _a;
|
|
363
|
-
super.selectedOptionsChanged(prev, next);
|
|
364
|
-
(_a = this.options) === null || _a === void 0 ? void 0 : _a.forEach((o, i) => {
|
|
365
|
-
var _a;
|
|
366
|
-
const proxyOption = (_a = this.proxy) === null || _a === void 0 ? void 0 : _a.options.item(i);
|
|
367
|
-
if (proxyOption) {
|
|
368
|
-
proxyOption.selected = o.selected;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
this.clickHandler = (e) => {
|
|
70
|
+
if (!this.disabled && !this.readOnly) {
|
|
71
|
+
this.checked = !this.checked;
|
|
369
72
|
}
|
|
370
|
-
}
|
|
73
|
+
};
|
|
74
|
+
this.proxy.setAttribute("type", "checkbox");
|
|
371
75
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
*
|
|
376
|
-
* @override
|
|
377
|
-
* @internal
|
|
378
|
-
*/
|
|
379
|
-
setDefaultSelectedOption() {
|
|
380
|
-
var _a;
|
|
381
|
-
const options = (_a = this.options) !== null && _a !== void 0 ? _a : Array.from(this.children).filter(Listbox.slottedOptionFilter);
|
|
382
|
-
const selectedIndex = options === null || options === void 0 ? void 0 : options.findIndex(el => el.hasAttribute("selected") || el.selected || el.value === this.value);
|
|
383
|
-
if (selectedIndex !== -1) {
|
|
384
|
-
this.selectedIndex = selectedIndex;
|
|
385
|
-
return;
|
|
76
|
+
readOnlyChanged() {
|
|
77
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
78
|
+
this.proxy.readOnly = this.readOnly;
|
|
386
79
|
}
|
|
387
|
-
this.
|
|
80
|
+
this.readOnly
|
|
81
|
+
? this.classList.add("readonly")
|
|
82
|
+
: this.classList.remove("readonly");
|
|
388
83
|
}
|
|
389
84
|
/**
|
|
390
|
-
* Resets and fills the proxy to match the component's options.
|
|
391
|
-
*
|
|
392
85
|
* @internal
|
|
393
86
|
*/
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
if (proxyOption) {
|
|
401
|
-
this.proxy.options.add(proxyOption);
|
|
402
|
-
}
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
/**
|
|
407
|
-
* Handle keyboard interaction for the select.
|
|
408
|
-
*
|
|
409
|
-
* @param e - the keyboard event
|
|
410
|
-
* @internal
|
|
411
|
-
*/
|
|
412
|
-
keydownHandler(e) {
|
|
413
|
-
super.keydownHandler(e);
|
|
414
|
-
const key = e.key || e.key.charCodeAt(0);
|
|
415
|
-
switch (key) {
|
|
416
|
-
case keySpace: {
|
|
417
|
-
e.preventDefault();
|
|
418
|
-
if (this.collapsible && this.typeAheadExpired) {
|
|
419
|
-
this.open = !this.open;
|
|
420
|
-
}
|
|
421
|
-
break;
|
|
422
|
-
}
|
|
423
|
-
case keyHome:
|
|
424
|
-
case keyEnd: {
|
|
425
|
-
e.preventDefault();
|
|
426
|
-
break;
|
|
427
|
-
}
|
|
428
|
-
case keyEnter: {
|
|
429
|
-
e.preventDefault();
|
|
430
|
-
this.open = !this.open;
|
|
431
|
-
break;
|
|
432
|
-
}
|
|
433
|
-
case keyEscape: {
|
|
434
|
-
if (this.collapsible && this.open) {
|
|
435
|
-
e.preventDefault();
|
|
436
|
-
this.open = false;
|
|
437
|
-
}
|
|
438
|
-
break;
|
|
439
|
-
}
|
|
440
|
-
case keyTab: {
|
|
441
|
-
if (this.collapsible && this.open) {
|
|
442
|
-
e.preventDefault();
|
|
443
|
-
this.open = false;
|
|
444
|
-
}
|
|
445
|
-
return true;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
if (!this.open && this.indexWhenOpened !== this.selectedIndex) {
|
|
449
|
-
this.updateValue(true);
|
|
450
|
-
this.indexWhenOpened = this.selectedIndex;
|
|
451
|
-
}
|
|
452
|
-
return !(key === keyArrowDown || key === keyArrowUp);
|
|
453
|
-
}
|
|
454
|
-
connectedCallback() {
|
|
455
|
-
super.connectedCallback();
|
|
456
|
-
this.forcedPosition = !!this.positionAttribute;
|
|
457
|
-
this.addEventListener("contentchange", this.updateDisplayValue);
|
|
458
|
-
}
|
|
459
|
-
disconnectedCallback() {
|
|
460
|
-
this.removeEventListener("contentchange", this.updateDisplayValue);
|
|
461
|
-
super.disconnectedCallback();
|
|
462
|
-
}
|
|
463
|
-
/**
|
|
464
|
-
* Updates the proxy's size property when the size attribute changes.
|
|
465
|
-
*
|
|
466
|
-
* @param prev - the previous size
|
|
467
|
-
* @param next - the current size
|
|
468
|
-
*
|
|
469
|
-
* @override
|
|
470
|
-
* @internal
|
|
471
|
-
*/
|
|
472
|
-
sizeChanged(prev, next) {
|
|
473
|
-
super.sizeChanged(prev, next);
|
|
474
|
-
if (this.proxy) {
|
|
475
|
-
this.proxy.size = next;
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
/**
|
|
479
|
-
*
|
|
480
|
-
* @internal
|
|
481
|
-
*/
|
|
482
|
-
updateDisplayValue() {
|
|
483
|
-
if (this.collapsible) {
|
|
484
|
-
Observable.notify(this, "displayValue");
|
|
485
|
-
}
|
|
87
|
+
checkedChanged(prev, next) {
|
|
88
|
+
super.checkedChanged(prev, next);
|
|
89
|
+
/**
|
|
90
|
+
* @deprecated - this behavior already exists in the template and should not exist in the class.
|
|
91
|
+
*/
|
|
92
|
+
this.checked ? this.classList.add("checked") : this.classList.remove("checked");
|
|
486
93
|
}
|
|
487
|
-
}
|
|
488
|
-
__decorate([
|
|
489
|
-
attr({ attribute: "open", mode: "boolean" })
|
|
490
|
-
], Select$1.prototype, "open", void 0);
|
|
491
|
-
__decorate([
|
|
492
|
-
volatile
|
|
493
|
-
], Select$1.prototype, "collapsible", null);
|
|
494
|
-
__decorate([
|
|
495
|
-
observable
|
|
496
|
-
], Select$1.prototype, "control", void 0);
|
|
497
|
-
__decorate([
|
|
498
|
-
attr({ attribute: "position" })
|
|
499
|
-
], Select$1.prototype, "positionAttribute", void 0);
|
|
500
|
-
__decorate([
|
|
501
|
-
observable
|
|
502
|
-
], Select$1.prototype, "position", void 0);
|
|
94
|
+
};
|
|
503
95
|
__decorate([
|
|
504
|
-
|
|
505
|
-
],
|
|
506
|
-
/**
|
|
507
|
-
* Includes ARIA states and properties relating to the ARIA select role.
|
|
508
|
-
*
|
|
509
|
-
* @public
|
|
510
|
-
*/
|
|
511
|
-
class DelegatesARIASelect {
|
|
512
|
-
}
|
|
96
|
+
attr({ attribute: "readonly", mode: "boolean" })
|
|
97
|
+
], Switch$1.prototype, "readOnly", void 0);
|
|
513
98
|
__decorate([
|
|
514
99
|
observable
|
|
515
|
-
],
|
|
516
|
-
applyMixins(DelegatesARIASelect, DelegatesARIAListbox);
|
|
517
|
-
applyMixins(Select$1, StartEnd, DelegatesARIASelect);
|
|
100
|
+
], Switch$1.prototype, "defaultSlottedNodes", void 0);
|
|
518
101
|
|
|
519
|
-
|
|
102
|
+
const styles = "/**\n * Do not edit directly\n * Generated on Mon, 04 Sep 2023 12:44:18 GMT\n */\n.control {\n display: inline-flex;\n gap: 8px;\n}\n.control.connotation-cta {\n /* @cssprop [--vvd-switch-cta-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-cta-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-cta-primary=var(--vvd-color-cta-500)] */\n --_connotation-color-primary: var(--vvd-switch-cta-primary, var(--vvd-color-cta-500));\n /* @cssprop [--vvd-switch-cta-primary-increment=var(--vvd-color-cta-600)] */\n --_connotation-color-primary-increment: var(--vvd-switch-cta-primary-increment, var(--vvd-color-cta-600));\n /* @cssprop [--vvd-switch-cta-backdrop=var(--vvd-color-cta-50)] */\n --_connotation-color-backdrop: var(--vvd-switch-cta-backdrop, var(--vvd-color-cta-50));\n /* @cssprop [--vvd-switch-cta-firm=var(--vvd-color-cta-600)] */\n --_connotation-color-firm: var(--vvd-switch-cta-firm, var(--vvd-color-cta-600));\n /* @cssprop [--vvd-switch-cta-intermediate=var(--vvd-color-cta-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-cta-intermediate, var(--vvd-color-cta-500));\n}\n.control.connotation-alert {\n /* @cssprop [--vvd-switch-alert-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-alert-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-alert-primary=var(--vvd-color-alert-500)] */\n --_connotation-color-primary: var(--vvd-switch-alert-primary, var(--vvd-color-alert-500));\n /* @cssprop [--vvd-switch-alert-primary-increment=var(--vvd-color-alert-600)] */\n --_connotation-color-primary-increment: var(--vvd-switch-alert-primary-increment, var(--vvd-color-alert-600));\n /* @cssprop [--vvd-switch-alert-backdrop=var(--vvd-color-alert-50)] */\n --_connotation-color-backdrop: var(--vvd-switch-alert-backdrop, var(--vvd-color-alert-50));\n /* @cssprop [--vvd-switch-alert-firm=var(--vvd-color-alert-600)] */\n --_connotation-color-firm: var(--vvd-switch-alert-firm, var(--vvd-color-alert-600));\n /* @cssprop [--vvd-switch-alert-intermediate=var(--vvd-color-alert-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-alert-intermediate, var(--vvd-color-alert-500));\n}\n.control.connotation-success {\n /* @cssprop [--vvd-switch-success-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-success-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-success-primary=var(--vvd-color-success-500)] */\n --_connotation-color-primary: var(--vvd-switch-success-primary, var(--vvd-color-success-500));\n /* @cssprop [--vvd-switch-success-primary-increment=var(--vvd-color-success-600)] */\n --_connotation-color-primary-increment: var(--vvd-switch-success-primary-increment, var(--vvd-color-success-600));\n /* @cssprop [--vvd-switch-success-backdrop=var(--vvd-color-success-50)] */\n --_connotation-color-backdrop: var(--vvd-switch-success-backdrop, var(--vvd-color-success-50));\n /* @cssprop [--vvd-switch-success-firm=var(--vvd-color-success-600)] */\n --_connotation-color-firm: var(--vvd-switch-success-firm, var(--vvd-color-success-600));\n /* @cssprop [--vvd-switch-success-intermediate=var(--vvd-color-success-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-success-intermediate, var(--vvd-color-success-500));\n}\n.control:not(.connotation-cta, .connotation-alert, .connotation-success) {\n /* @cssprop [--vvd-switch-accent-primary-text=var(--vvd-color-canvas)] */\n --_connotation-color-primary-text: var(--vvd-switch-accent-primary-text, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-accent-primary=var(--vvd-color-canvas-text)] */\n --_connotation-color-primary: var(--vvd-switch-accent-primary, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-switch-accent-primary-increment=var(--vvd-color-neutral-800)] */\n --_connotation-color-primary-increment: var(--vvd-switch-accent-primary-increment, var(--vvd-color-neutral-800));\n /* @cssprop [--vvd-switch-accent-backdrop=var(--vvd-color-canvas)] */\n --_connotation-color-backdrop: var(--vvd-switch-accent-backdrop, var(--vvd-color-canvas));\n /* @cssprop [--vvd-switch-accent-firm=var(--vvd-color-canvas-text)] */\n --_connotation-color-firm: var(--vvd-switch-accent-firm, var(--vvd-color-canvas-text));\n /* @cssprop [--vvd-switch-accent-intermediate=var(--vvd-color-neutral-500)] */\n --_connotation-color-intermediate: var(--vvd-switch-accent-intermediate, var(--vvd-color-neutral-500));\n}\n.control {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-intermediate);\n}\n.control.appearance-filled {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: transparent;\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--_connotation-color-backdrop);\n --_appearance-color-outline: var(--_connotation-color-firm);\n}\n.control:where(:hover, .hover):where(:not(:disabled, .disabled, .readonly)).appearance-filled {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary-increment);\n --_appearance-color-outline: transparent;\n}\n.control:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: var(--vvd-color-neutral-300);\n}\n.control:where(:disabled, .disabled).appearance-filled {\n --_appearance-color-text: var(--vvd-color-neutral-300);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: transparent;\n}\n.control:where(.readonly):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.control:where(.readonly):where(:not(:disabled, .disabled)).appearance-filled {\n --_appearance-color-text: var(--vvd-color-neutral-800);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: transparent;\n}\n@supports selector(:focus-visible) {\n .control:focus-visible {\n outline: none;\n }\n}\n@supports (user-select: none) {\n .control {\n user-select: none;\n }\n}\n.control:not(.disabled) {\n cursor: pointer;\n}\n.control.disabled {\n cursor: not-allowed;\n pointer-events: none;\n}\n\n.switch {\n --_switch-inline-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) * 1.8);\n position: relative;\n display: flex;\n box-sizing: border-box;\n align-items: center;\n background-color: var(--_appearance-color-fill);\n block-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20));\n border-radius: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) / .5);\n box-shadow: inset 0 0 0 1px var(--_appearance-color-outline);\n inline-size: var(--_switch-inline-size);\n transition: all 0.2s ease-in-out 0s;\n}\n\n.checked-indicator {\n --_switch-checked-indicator-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) / 1.6667);\n --_switch-gutter: calc(var(--_switch-checked-indicator-size) / 3);\n block-size: var(--_switch-checked-indicator-size);\n border-radius: inherit;\n inline-size: var(--_switch-checked-indicator-size);\n margin-inline-start: auto;\n transition: all 0.2s ease-in-out 0s;\n}\n.control.appearance-filled .checked-indicator {\n background-color: var(--vvd-color-neutral-100);\n}\n.control:not(.appearance-filled) .checked-indicator {\n background-color: var(--_appearance-color-outline);\n}\n.control:not(.checked) .checked-indicator {\n transform: translateX(calc(-1 * var(--_switch-inline-size) + var(--_switch-checked-indicator-size) + var(--_switch-gutter)));\n}\n.control.checked .checked-indicator {\n transform: translateX(calc(-1 * var(--_switch-gutter)));\n}\n\n.label {\n color: var(--vvd-color-canvas-text);\n cursor: pointer;\n font: var(--vvd-typography-base);\n}\n\n.focus-indicator {\n --focus-inset: -4px;\n --focus-stroke-gap-color: transparent;\n border-radius: 14px;\n}\n.control:not(:focus-visible) .focus-indicator {\n display: none;\n}";
|
|
520
103
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
get displayValue() {
|
|
532
|
-
var _a, _b, _c, _d, _e;
|
|
533
|
-
Observable.track(this, 'displayValue');
|
|
534
|
-
return (_e = (_d = (_b = (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.getAttribute('label')) !== null && _b !== void 0 ? _b : (_c = this.firstSelectedOption) === null || _c === void 0 ? void 0 : _c.text) !== null && _d !== void 0 ? _d : this.placeholder) !== null && _e !== void 0 ? _e : '';
|
|
535
|
-
}
|
|
536
|
-
setDefaultSelectedOption() {
|
|
537
|
-
const options = Array.from(this.children).filter(Listbox$1.slottedOptionFilter);
|
|
538
|
-
const selectedIndex = options.findIndex(el => el.hasAttribute('selected') || el.selected || el.value === this.value);
|
|
539
|
-
if (selectedIndex === -1 && !this.placeholderOption) {
|
|
540
|
-
this.selectedIndex = 0;
|
|
541
|
-
return;
|
|
542
|
-
}
|
|
543
|
-
if (selectedIndex !== -1 || this.placeholder !== '') {
|
|
544
|
-
this.selectedIndex = selectedIndex;
|
|
545
|
-
return;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
104
|
+
var __defProp = Object.defineProperty;
|
|
105
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
106
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
107
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
108
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
109
|
+
if (decorator = decorators[i])
|
|
110
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
111
|
+
if (kind && result)
|
|
112
|
+
__defProp(target, key, result);
|
|
113
|
+
return result;
|
|
548
114
|
};
|
|
549
|
-
|
|
550
|
-
__decorate([attr, __metadata("design:type", String)], Select.prototype, "shape", void 0);
|
|
551
|
-
__decorate([attr({
|
|
552
|
-
mode: 'boolean',
|
|
553
|
-
attribute: 'fixed-dropdown'
|
|
554
|
-
}), __metadata("design:type", Object)], Select.prototype, "fixedDropdown", void 0);
|
|
555
|
-
__decorate([attr, __metadata("design:type", Object)], Select.prototype, "placeholder", void 0);
|
|
556
|
-
__decorate([observable, __metadata("design:type", Object)], Select.prototype, "placeholderOption", void 0);
|
|
557
|
-
__decorate([observable, __metadata("design:type", Array)], Select.prototype, "metaSlottedContent", void 0);
|
|
558
|
-
Select = __decorate([errorText, formElements], Select);
|
|
559
|
-
applyMixins(Select, AffixIconWithTrailing, FormElementHelperText, FormElementSuccessText);
|
|
560
|
-
|
|
561
|
-
const getStateClasses = ({
|
|
562
|
-
shape,
|
|
563
|
-
disabled,
|
|
564
|
-
appearance,
|
|
565
|
-
metaSlottedContent,
|
|
566
|
-
errorValidationMessage,
|
|
567
|
-
successText
|
|
568
|
-
}) => classNames(['disabled', disabled], [`appearance-${appearance}`, Boolean(appearance)], [`shape-${shape}`, Boolean(shape)], ['has-meta', Boolean(metaSlottedContent === null || metaSlottedContent === void 0 ? void 0 : metaSlottedContent.length)], ['error connotation-alert', Boolean(errorValidationMessage)], ['success connotation-success', !!successText], ['has-meta', Boolean(metaSlottedContent === null || metaSlottedContent === void 0 ? void 0 : metaSlottedContent.length)]);
|
|
569
|
-
function renderLabel() {
|
|
570
|
-
return html`
|
|
571
|
-
<label for="control" class="label">
|
|
572
|
-
${x => x.label}
|
|
573
|
-
</label>`;
|
|
574
|
-
}
|
|
575
|
-
function renderPlaceholder(context) {
|
|
576
|
-
const optionTag = context.tagFor(ListboxOption);
|
|
577
|
-
return html`
|
|
578
|
-
<${optionTag} ${ref('placeholderOption')}
|
|
579
|
-
text="${x => x.placeholder}" hidden disabled>
|
|
580
|
-
</${optionTag}>`;
|
|
115
|
+
class Switch extends Switch$1 {
|
|
581
116
|
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
}
|
|
599
|
-
function setFixedDropdownVarWidth(x) {
|
|
600
|
-
return x.open && x.fixedDropdown ? `--_select-fixed-width: ${Math.round(x.getBoundingClientRect().width)}px` : null;
|
|
601
|
-
}
|
|
602
|
-
function renderControl(context) {
|
|
117
|
+
__decorateClass([
|
|
118
|
+
attr
|
|
119
|
+
], Switch.prototype, "label", 2);
|
|
120
|
+
__decorateClass([
|
|
121
|
+
attr
|
|
122
|
+
], Switch.prototype, "connotation", 2);
|
|
123
|
+
|
|
124
|
+
const getClasses = (_) => classNames(
|
|
125
|
+
"control",
|
|
126
|
+
["appearance-filled", _.checked && !_.disabled && !_.readOnly],
|
|
127
|
+
["checked", _.checked],
|
|
128
|
+
["disabled", _.disabled],
|
|
129
|
+
["readonly", _.readOnly],
|
|
130
|
+
[`connotation-${_.connotation}`, Boolean(_.checked) && Boolean(_.connotation)]
|
|
131
|
+
);
|
|
132
|
+
const SwitchTemplate = (context) => {
|
|
603
133
|
const focusTemplate = focusTemplateFactory(context);
|
|
604
|
-
const popupTag = context.tagFor(Popup);
|
|
605
134
|
return html`
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
?hidden="${x => x.collapsible ? !x.open : false}"
|
|
620
|
-
${ref('listbox')}>
|
|
621
|
-
${when(x => x.placeholder, renderPlaceholder(context))}
|
|
622
|
-
${when(x => x.multiple, focusTemplate)}
|
|
623
|
-
<slot
|
|
624
|
-
${slotted({
|
|
625
|
-
filter: Listbox$1.slottedOptionFilter,
|
|
626
|
-
flatten: true,
|
|
627
|
-
property: 'slottedOptions'
|
|
628
|
-
})}>
|
|
629
|
-
</slot>
|
|
630
|
-
</div>
|
|
631
|
-
</${popupTag}>
|
|
135
|
+
<div
|
|
136
|
+
class="${getClasses}"
|
|
137
|
+
role="switch"
|
|
138
|
+
aria-checked="${(x) => x.checked}"
|
|
139
|
+
aria-disabled="${(x) => x.disabled}"
|
|
140
|
+
aria-readonly="${(x) => x.readOnly}"
|
|
141
|
+
tabindex="${(x) => x.disabled ? null : 0}"
|
|
142
|
+
@keypress="${(x, c) => x.keypressHandler(c.event)}"
|
|
143
|
+
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
144
|
+
>
|
|
145
|
+
<div class="switch">
|
|
146
|
+
<span class="checked-indicator"></span>
|
|
147
|
+
${() => focusTemplate}
|
|
632
148
|
</div>
|
|
633
|
-
${when(x =>
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
${when(x => !x.successText && x.errorValidationMessage, getFeedbackTemplate('error', context))}
|
|
638
|
-
${when(x => x.successText, getFeedbackTemplate('success', context))}
|
|
149
|
+
${when((x) => x.label, html`<div class="label">
|
|
150
|
+
${(x) => x.label}
|
|
151
|
+
</div>`)}
|
|
152
|
+
</div>
|
|
639
153
|
`;
|
|
640
|
-
}
|
|
641
|
-
const SelectTemplate = context => {
|
|
642
|
-
return html`
|
|
643
|
-
<template class="base"
|
|
644
|
-
aria-label="${x => x.ariaLabel ? x.ariaLabel : x.label}"
|
|
645
|
-
aria-activedescendant="${x => x.ariaActiveDescendant}"
|
|
646
|
-
aria-controls="${x => x.ariaControls}"
|
|
647
|
-
aria-disabled="${x => x.ariaDisabled}"
|
|
648
|
-
aria-expanded="${x => x.ariaExpanded}"
|
|
649
|
-
aria-haspopup="${x => x.collapsible ? 'listbox' : null}"
|
|
650
|
-
aria-multiselectable="${x => x.ariaMultiSelectable}"
|
|
651
|
-
?open="${x => x.open}"
|
|
652
|
-
role="combobox"
|
|
653
|
-
tabindex="${x => !x.disabled ? '0' : null}"
|
|
654
|
-
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
655
|
-
@focusin="${(x, c) => x.focusinHandler(c.event)}"
|
|
656
|
-
@focusout="${(x, c) => x.focusoutHandler(c.event)}"
|
|
657
|
-
@keydown="${(x, c) => x.keydownHandler(c.event)}"
|
|
658
|
-
@mousedown="${(x, c) => x.mousedownHandler(c.event)}">
|
|
659
|
-
${renderControl(context)}
|
|
660
|
-
</template>`;
|
|
661
154
|
};
|
|
662
155
|
|
|
663
|
-
const
|
|
664
|
-
baseName:
|
|
665
|
-
template:
|
|
666
|
-
styles
|
|
156
|
+
const switchDefinition = Switch.compose({
|
|
157
|
+
baseName: "switch",
|
|
158
|
+
template: SwitchTemplate,
|
|
159
|
+
styles,
|
|
160
|
+
shadowOptions: {
|
|
161
|
+
delegatesFocus: true
|
|
162
|
+
}
|
|
667
163
|
});
|
|
668
|
-
const
|
|
669
|
-
const
|
|
164
|
+
const switchRegistries = [switchDefinition(), ...iconRegistries, ...focusRegistries];
|
|
165
|
+
const registerSwitch = registerFactory(switchRegistries);
|
|
670
166
|
|
|
671
|
-
export {
|
|
167
|
+
export { switchRegistries as a, registerSwitch as r, switchDefinition as s };
|