@vonage/vivid 3.5.0 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -14
- package/banner/index.js +2 -0
- package/breadcrumb/index.js +1 -1
- package/breadcrumb-item/index.js +1 -1
- package/button/index.js +2 -0
- package/calendar/index.js +1 -1
- package/calendar-event/index.js +1 -1
- package/card/index.js +2 -2
- package/checkbox/index.js +1 -1
- package/combobox/index.js +6 -4
- package/custom-elements.json +302 -0
- package/data-grid/index.js +1 -1
- package/dialog/index.js +4 -2
- package/divider/index.js +1 -1
- package/elevation/index.js +1 -1
- package/fab/index.js +1 -1
- package/header/index.js +2 -2
- package/index.js +26 -26
- package/layout/index.js +1 -1
- package/lib/accordion-item/accordion-item.d.ts +3 -0
- package/lib/action-group/action-group.d.ts +2 -0
- package/lib/button/button.d.ts +1 -0
- package/lib/button/button.template.d.ts +1 -1
- package/lib/select/select.d.ts +2 -3
- package/listbox/index.js +2 -2
- package/menu/index.js +6 -4
- package/menu-item/index.js +1 -1
- package/nav/index.js +1 -1
- package/nav-disclosure/index.js +1 -1
- package/nav-item/index.js +1 -1
- package/note/index.js +1 -1
- package/number-field/index.js +4 -2
- package/option/index.js +1 -1
- package/package.json +1 -1
- package/popup/index.js +4 -2
- package/progress/index.js +1 -1
- package/progress-ring/index.js +1 -1
- package/select/index.js +5 -3
- package/shared/definition.js +1 -1
- package/shared/definition10.js +69 -91
- package/shared/definition11.js +91 -40
- package/shared/definition12.js +31 -755
- package/shared/definition13.js +754 -93
- package/shared/definition14.js +100 -103
- package/shared/definition15.js +106 -24
- package/shared/definition16.js +24 -164
- package/shared/definition17.js +108 -663
- package/shared/definition18.js +667 -1533
- package/shared/definition19.js +1545 -223
- package/shared/definition2.js +8 -7
- package/shared/definition20.js +183 -964
- package/shared/definition21.js +1037 -222
- package/shared/definition22.js +226 -67
- package/shared/definition23.js +68 -77
- package/shared/definition24.js +76 -47
- package/shared/definition25.js +46 -32
- package/shared/definition26.js +35 -49
- package/shared/definition27.js +48 -344
- package/shared/definition28.js +273 -282
- package/shared/definition29.js +356 -14
- package/shared/definition30.js +13 -67
- package/shared/definition31.js +65 -21
- package/shared/definition32.js +21 -39
- package/shared/definition33.js +31 -432
- package/shared/definition34.js +432 -76
- package/shared/definition35.js +76 -59
- package/shared/definition36.js +3 -3
- package/shared/definition37.js +1 -1
- package/shared/definition38.js +7 -6
- package/shared/definition39.js +1 -1
- package/shared/definition4.js +1 -1
- package/shared/definition41.js +1 -1
- package/shared/definition42.js +1 -1
- package/shared/definition44.js +1 -1
- package/shared/definition45.js +1 -1
- package/shared/definition47.js +2 -2
- package/shared/definition48.js +1 -1
- package/shared/definition5.js +10 -3
- package/shared/definition6.js +1 -1
- package/shared/definition7.js +1 -1
- package/shared/definition8.js +1 -1
- package/shared/definition9.js +14 -4
- package/shared/form-elements.js +1 -1
- package/shared/icon.js +1 -1
- package/shared/listbox.js +1 -1
- package/shared/patterns/form-elements/form-elements.d.ts +2 -2
- package/shared/text-field.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/tooltip/index.js +4 -2
package/shared/definition17.js
CHANGED
|
@@ -1,33 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as FoundationElement, _ as __decorate, a as attr, o as observable, b as __metadata, h as html, r as registerFactory } from './index.js';
|
|
2
2
|
import { i as iconRegistries } from './definition3.js';
|
|
3
|
-
import { P as Popup, p as popupRegistries } from './definition18.js';
|
|
4
3
|
import { f as focusRegistries } from './definition4.js';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { b as AffixIcon, a as affixIconTemplateFactory } from './affix.js';
|
|
8
|
-
import './focus.js';
|
|
9
|
-
import { f as formElements } from './form-elements.js';
|
|
10
|
-
import { L as Listbox, D as DelegatesARIAListbox, a as Listbox$1 } from './listbox.js';
|
|
11
|
-
import { S as StartEnd } from './start-end.js';
|
|
12
|
-
import { S as SelectPosition } from './select.options.js';
|
|
13
|
-
import { a as applyMixins } from './apply-mixins.js';
|
|
14
|
-
import { F as FormAssociated } from './form-associated.js';
|
|
15
|
-
import { l as limit } from './numbers.js';
|
|
16
|
-
import { u as uniqueId } from './strings.js';
|
|
4
|
+
import { C as CheckableFormAssociated } from './form-associated.js';
|
|
5
|
+
import { e as keySpace$1 } from './key-codes.js';
|
|
17
6
|
import { f as focusTemplateFactory } from './focus2.js';
|
|
18
|
-
import {
|
|
19
|
-
import { r as ref } from './ref.js';
|
|
7
|
+
import { I as Icon } from './icon.js';
|
|
20
8
|
import { w as when } from './when.js';
|
|
21
9
|
import { c as classNames } from './class-names.js';
|
|
22
10
|
|
|
23
|
-
class
|
|
11
|
+
class _Checkbox extends FoundationElement {
|
|
24
12
|
}
|
|
25
13
|
/**
|
|
26
|
-
* A form-associated base class for the {@link (
|
|
14
|
+
* A form-associated base class for the {@link @microsoft/fast-foundation#(Checkbox:class)} component.
|
|
27
15
|
*
|
|
28
16
|
* @internal
|
|
29
17
|
*/
|
|
30
|
-
class
|
|
18
|
+
class FormAssociatedCheckbox extends CheckableFormAssociated(_Checkbox) {
|
|
31
19
|
constructor() {
|
|
32
20
|
super(...arguments);
|
|
33
21
|
this.proxy = document.createElement("input");
|
|
@@ -35,693 +23,150 @@ class FormAssociatedCombobox extends FormAssociated(_Combobox) {
|
|
|
35
23
|
}
|
|
36
24
|
|
|
37
25
|
/**
|
|
38
|
-
*
|
|
39
|
-
* @
|
|
40
|
-
*/
|
|
41
|
-
const ComboboxAutocomplete = {
|
|
42
|
-
inline: "inline",
|
|
43
|
-
list: "list",
|
|
44
|
-
both: "both",
|
|
45
|
-
none: "none",
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* A Combobox Custom HTML Element.
|
|
50
|
-
* Implements the {@link https://w3c.github.io/aria-practices/#combobox | ARIA combobox }.
|
|
26
|
+
* A Checkbox Custom HTML Element.
|
|
27
|
+
* Implements the {@link https://www.w3.org/TR/wai-aria-1.1/#checkbox | ARIA checkbox }.
|
|
51
28
|
*
|
|
52
|
-
* @slot
|
|
53
|
-
* @slot
|
|
54
|
-
* @slot
|
|
55
|
-
* @
|
|
56
|
-
* @
|
|
57
|
-
* @
|
|
58
|
-
* @csspart selected-value - The input element representing the selected value
|
|
59
|
-
* @csspart indicator - The element wrapping the indicator slot
|
|
60
|
-
* @csspart listbox - The wrapper for the listbox slotted options
|
|
61
|
-
* @fires change - Fires a custom 'change' event when the value updates
|
|
29
|
+
* @slot checked-indicator - The checked indicator
|
|
30
|
+
* @slot indeterminate-indicator - The indeterminate indicator
|
|
31
|
+
* @slot - The default slot for the label
|
|
32
|
+
* @csspart control - The element representing the visual checkbox control
|
|
33
|
+
* @csspart label - The label
|
|
34
|
+
* @fires change - Emits a custom change event when the checked state changes
|
|
62
35
|
*
|
|
63
36
|
* @public
|
|
64
37
|
*/
|
|
65
|
-
class
|
|
38
|
+
class Checkbox$1 extends FormAssociatedCheckbox {
|
|
66
39
|
constructor() {
|
|
67
|
-
super(
|
|
68
|
-
/**
|
|
69
|
-
* The internal value property.
|
|
70
|
-
*
|
|
71
|
-
* @internal
|
|
72
|
-
*/
|
|
73
|
-
this._value = "";
|
|
74
|
-
/**
|
|
75
|
-
* The collection of currently filtered options.
|
|
76
|
-
*
|
|
77
|
-
* @public
|
|
78
|
-
*/
|
|
79
|
-
this.filteredOptions = [];
|
|
40
|
+
super();
|
|
80
41
|
/**
|
|
81
|
-
* The
|
|
42
|
+
* The element's value to be included in form submission when checked.
|
|
43
|
+
* Default to "on" to reach parity with input[type="checkbox"]
|
|
82
44
|
*
|
|
83
45
|
* @internal
|
|
84
46
|
*/
|
|
85
|
-
this.
|
|
47
|
+
this.initialValue = "on";
|
|
86
48
|
/**
|
|
87
|
-
* The
|
|
88
|
-
*
|
|
89
|
-
* @internal
|
|
49
|
+
* The indeterminate state of the control
|
|
90
50
|
*/
|
|
91
|
-
this.
|
|
51
|
+
this.indeterminate = false;
|
|
92
52
|
/**
|
|
93
|
-
* The unique id for the internal listbox element.
|
|
94
|
-
*
|
|
95
53
|
* @internal
|
|
96
54
|
*/
|
|
97
|
-
this.
|
|
98
|
-
|
|
99
|
-
* The max height for the listbox when opened.
|
|
100
|
-
*
|
|
101
|
-
* @internal
|
|
102
|
-
*/
|
|
103
|
-
this.maxHeight = 0;
|
|
104
|
-
/**
|
|
105
|
-
* The open attribute.
|
|
106
|
-
*
|
|
107
|
-
* @public
|
|
108
|
-
* @remarks
|
|
109
|
-
* HTML Attribute: open
|
|
110
|
-
*/
|
|
111
|
-
this.open = false;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Reset the element to its first selectable option when its parent form is reset.
|
|
115
|
-
*
|
|
116
|
-
* @internal
|
|
117
|
-
*/
|
|
118
|
-
formResetCallback() {
|
|
119
|
-
super.formResetCallback();
|
|
120
|
-
this.setDefaultSelectedOption();
|
|
121
|
-
this.updateValue();
|
|
122
|
-
}
|
|
123
|
-
/** {@inheritDoc (FormAssociated:interface).validate} */
|
|
124
|
-
validate() {
|
|
125
|
-
super.validate(this.control);
|
|
126
|
-
}
|
|
127
|
-
get isAutocompleteInline() {
|
|
128
|
-
return (this.autocomplete === ComboboxAutocomplete.inline || this.isAutocompleteBoth);
|
|
129
|
-
}
|
|
130
|
-
get isAutocompleteList() {
|
|
131
|
-
return this.autocomplete === ComboboxAutocomplete.list || this.isAutocompleteBoth;
|
|
132
|
-
}
|
|
133
|
-
get isAutocompleteBoth() {
|
|
134
|
-
return this.autocomplete === ComboboxAutocomplete.both;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Sets focus and synchronize ARIA attributes when the open property changes.
|
|
138
|
-
*
|
|
139
|
-
* @param prev - the previous open value
|
|
140
|
-
* @param next - the current open value
|
|
141
|
-
*
|
|
142
|
-
* @internal
|
|
143
|
-
*/
|
|
144
|
-
openChanged() {
|
|
145
|
-
if (this.open) {
|
|
146
|
-
this.ariaControls = this.listboxId;
|
|
147
|
-
this.ariaExpanded = "true";
|
|
148
|
-
this.setPositioning();
|
|
149
|
-
this.focusAndScrollOptionIntoView();
|
|
150
|
-
// focus is directed to the element when `open` is changed programmatically
|
|
151
|
-
DOM.queueUpdate(() => this.focus());
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
this.ariaControls = "";
|
|
155
|
-
this.ariaExpanded = "false";
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* The list of options.
|
|
159
|
-
*
|
|
160
|
-
* @public
|
|
161
|
-
* @remarks
|
|
162
|
-
* Overrides `Listbox.options`.
|
|
163
|
-
*/
|
|
164
|
-
get options() {
|
|
165
|
-
Observable.track(this, "options");
|
|
166
|
-
return this.filteredOptions.length ? this.filteredOptions : this._options;
|
|
167
|
-
}
|
|
168
|
-
set options(value) {
|
|
169
|
-
this._options = value;
|
|
170
|
-
Observable.notify(this, "options");
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Updates the placeholder on the proxy element.
|
|
174
|
-
* @internal
|
|
175
|
-
*/
|
|
176
|
-
placeholderChanged() {
|
|
177
|
-
if (this.proxy instanceof HTMLInputElement) {
|
|
178
|
-
this.proxy.placeholder = this.placeholder;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
positionChanged(prev, next) {
|
|
182
|
-
this.positionAttribute = next;
|
|
183
|
-
this.setPositioning();
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* The value property.
|
|
187
|
-
*
|
|
188
|
-
* @public
|
|
189
|
-
*/
|
|
190
|
-
get value() {
|
|
191
|
-
Observable.track(this, "value");
|
|
192
|
-
return this._value;
|
|
193
|
-
}
|
|
194
|
-
set value(next) {
|
|
195
|
-
var _a, _b, _c;
|
|
196
|
-
const prev = `${this._value}`;
|
|
197
|
-
if (this.$fastController.isConnected && this.options) {
|
|
198
|
-
const selectedIndex = this.options.findIndex(el => el.text.toLowerCase() === next.toLowerCase());
|
|
199
|
-
const prevSelectedValue = (_a = this.options[this.selectedIndex]) === null || _a === void 0 ? void 0 : _a.text;
|
|
200
|
-
const nextSelectedValue = (_b = this.options[selectedIndex]) === null || _b === void 0 ? void 0 : _b.text;
|
|
201
|
-
this.selectedIndex =
|
|
202
|
-
prevSelectedValue !== nextSelectedValue
|
|
203
|
-
? selectedIndex
|
|
204
|
-
: this.selectedIndex;
|
|
205
|
-
next = ((_c = this.firstSelectedOption) === null || _c === void 0 ? void 0 : _c.text) || next;
|
|
206
|
-
}
|
|
207
|
-
if (prev !== next) {
|
|
208
|
-
this._value = next;
|
|
209
|
-
super.valueChanged(prev, next);
|
|
210
|
-
Observable.notify(this, "value");
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Handle opening and closing the listbox when the combobox is clicked.
|
|
215
|
-
*
|
|
216
|
-
* @param e - the mouse event
|
|
217
|
-
* @internal
|
|
218
|
-
*/
|
|
219
|
-
clickHandler(e) {
|
|
220
|
-
if (this.disabled) {
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
if (this.open) {
|
|
224
|
-
const captured = e.target.closest(`option,[role=option]`);
|
|
225
|
-
if (!captured || captured.disabled) {
|
|
55
|
+
this.keypressHandler = (e) => {
|
|
56
|
+
if (this.readOnly) {
|
|
226
57
|
return;
|
|
227
58
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
if (this.open) {
|
|
235
|
-
this.control.focus();
|
|
236
|
-
}
|
|
237
|
-
return true;
|
|
238
|
-
}
|
|
239
|
-
connectedCallback() {
|
|
240
|
-
super.connectedCallback();
|
|
241
|
-
this.forcedPosition = !!this.positionAttribute;
|
|
242
|
-
if (this.value) {
|
|
243
|
-
this.initialValue = this.value;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Synchronize the `aria-disabled` property when the `disabled` property changes.
|
|
248
|
-
*
|
|
249
|
-
* @param prev - The previous disabled value
|
|
250
|
-
* @param next - The next disabled value
|
|
251
|
-
*
|
|
252
|
-
* @internal
|
|
253
|
-
*/
|
|
254
|
-
disabledChanged(prev, next) {
|
|
255
|
-
if (super.disabledChanged) {
|
|
256
|
-
super.disabledChanged(prev, next);
|
|
257
|
-
}
|
|
258
|
-
this.ariaDisabled = this.disabled ? "true" : "false";
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* Filter available options by text value.
|
|
262
|
-
*
|
|
263
|
-
* @public
|
|
264
|
-
*/
|
|
265
|
-
filterOptions() {
|
|
266
|
-
if (!this.autocomplete || this.autocomplete === ComboboxAutocomplete.none) {
|
|
267
|
-
this.filter = "";
|
|
268
|
-
}
|
|
269
|
-
const filter = this.filter.toLowerCase();
|
|
270
|
-
this.filteredOptions = this._options.filter(o => o.text.toLowerCase().startsWith(this.filter.toLowerCase()));
|
|
271
|
-
if (this.isAutocompleteList) {
|
|
272
|
-
if (!this.filteredOptions.length && !filter) {
|
|
273
|
-
this.filteredOptions = this._options;
|
|
274
|
-
}
|
|
275
|
-
this._options.forEach(o => {
|
|
276
|
-
o.hidden = !this.filteredOptions.includes(o);
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Focus the control and scroll the first selected option into view.
|
|
282
|
-
*
|
|
283
|
-
* @internal
|
|
284
|
-
* @remarks
|
|
285
|
-
* Overrides: `Listbox.focusAndScrollOptionIntoView`
|
|
286
|
-
*/
|
|
287
|
-
focusAndScrollOptionIntoView() {
|
|
288
|
-
if (this.contains(document.activeElement)) {
|
|
289
|
-
this.control.focus();
|
|
290
|
-
if (this.firstSelectedOption) {
|
|
291
|
-
requestAnimationFrame(() => {
|
|
292
|
-
var _a;
|
|
293
|
-
(_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ block: "nearest" });
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Handle focus state when the element or its children lose focus.
|
|
300
|
-
*
|
|
301
|
-
* @param e - The focus event
|
|
302
|
-
* @internal
|
|
303
|
-
*/
|
|
304
|
-
focusoutHandler(e) {
|
|
305
|
-
this.syncValue();
|
|
306
|
-
if (!this.open) {
|
|
307
|
-
return true;
|
|
308
|
-
}
|
|
309
|
-
const focusTarget = e.relatedTarget;
|
|
310
|
-
if (this.isSameNode(focusTarget)) {
|
|
311
|
-
this.focus();
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
if (!this.options || !this.options.includes(focusTarget)) {
|
|
315
|
-
this.open = false;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Handle content changes on the control input.
|
|
320
|
-
*
|
|
321
|
-
* @param e - the input event
|
|
322
|
-
* @internal
|
|
323
|
-
*/
|
|
324
|
-
inputHandler(e) {
|
|
325
|
-
this.filter = this.control.value;
|
|
326
|
-
this.filterOptions();
|
|
327
|
-
if (!this.isAutocompleteInline) {
|
|
328
|
-
this.selectedIndex = this.options
|
|
329
|
-
.map(option => option.text)
|
|
330
|
-
.indexOf(this.control.value);
|
|
331
|
-
}
|
|
332
|
-
if (e.inputType.includes("deleteContent") || !this.filter.length) {
|
|
333
|
-
return true;
|
|
334
|
-
}
|
|
335
|
-
if (this.isAutocompleteList && !this.open) {
|
|
336
|
-
this.open = true;
|
|
337
|
-
}
|
|
338
|
-
if (this.isAutocompleteInline) {
|
|
339
|
-
if (this.filteredOptions.length) {
|
|
340
|
-
this.selectedOptions = [this.filteredOptions[0]];
|
|
341
|
-
this.selectedIndex = this.options.indexOf(this.firstSelectedOption);
|
|
342
|
-
this.setInlineSelection();
|
|
343
|
-
}
|
|
344
|
-
else {
|
|
345
|
-
this.selectedIndex = -1;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* Handle keydown actions for listbox navigation.
|
|
352
|
-
*
|
|
353
|
-
* @param e - the keyboard event
|
|
354
|
-
* @internal
|
|
355
|
-
*/
|
|
356
|
-
keydownHandler(e) {
|
|
357
|
-
const key = e.key;
|
|
358
|
-
if (e.ctrlKey || e.shiftKey) {
|
|
359
|
-
return true;
|
|
360
|
-
}
|
|
361
|
-
switch (key) {
|
|
362
|
-
case "Enter": {
|
|
363
|
-
this.syncValue();
|
|
364
|
-
if (this.isAutocompleteInline) {
|
|
365
|
-
this.filter = this.value;
|
|
366
|
-
}
|
|
367
|
-
this.open = false;
|
|
368
|
-
this.clearSelectionRange();
|
|
369
|
-
break;
|
|
370
|
-
}
|
|
371
|
-
case "Escape": {
|
|
372
|
-
if (!this.isAutocompleteInline) {
|
|
373
|
-
this.selectedIndex = -1;
|
|
374
|
-
}
|
|
375
|
-
if (this.open) {
|
|
376
|
-
this.open = false;
|
|
59
|
+
switch (e.key) {
|
|
60
|
+
case keySpace$1:
|
|
61
|
+
if (this.indeterminate) {
|
|
62
|
+
this.indeterminate = false;
|
|
63
|
+
}
|
|
64
|
+
this.checked = !this.checked;
|
|
377
65
|
break;
|
|
378
|
-
}
|
|
379
|
-
this.value = "";
|
|
380
|
-
this.control.value = "";
|
|
381
|
-
this.filter = "";
|
|
382
|
-
this.filterOptions();
|
|
383
|
-
break;
|
|
384
|
-
}
|
|
385
|
-
case "Tab": {
|
|
386
|
-
this.setInputToSelection();
|
|
387
|
-
if (!this.open) {
|
|
388
|
-
return true;
|
|
389
|
-
}
|
|
390
|
-
e.preventDefault();
|
|
391
|
-
this.open = false;
|
|
392
|
-
break;
|
|
393
66
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
super.keydownHandler(e);
|
|
403
|
-
}
|
|
404
|
-
if (this.isAutocompleteInline) {
|
|
405
|
-
this.setInlineSelection();
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
this.clickHandler = (e) => {
|
|
72
|
+
if (!this.disabled && !this.readOnly) {
|
|
73
|
+
if (this.indeterminate) {
|
|
74
|
+
this.indeterminate = false;
|
|
406
75
|
}
|
|
407
|
-
|
|
408
|
-
}
|
|
409
|
-
default: {
|
|
410
|
-
return true;
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Handle keyup actions for value input and text field manipulations.
|
|
416
|
-
*
|
|
417
|
-
* @param e - the keyboard event
|
|
418
|
-
* @internal
|
|
419
|
-
*/
|
|
420
|
-
keyupHandler(e) {
|
|
421
|
-
const key = e.key;
|
|
422
|
-
switch (key) {
|
|
423
|
-
case "ArrowLeft":
|
|
424
|
-
case "ArrowRight":
|
|
425
|
-
case "Backspace":
|
|
426
|
-
case "Delete":
|
|
427
|
-
case "Home":
|
|
428
|
-
case "End": {
|
|
429
|
-
this.filter = this.control.value;
|
|
430
|
-
this.selectedIndex = -1;
|
|
431
|
-
this.filterOptions();
|
|
432
|
-
break;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* Ensure that the selectedIndex is within the current allowable filtered range.
|
|
438
|
-
*
|
|
439
|
-
* @param prev - the previous selected index value
|
|
440
|
-
* @param next - the current selected index value
|
|
441
|
-
*
|
|
442
|
-
* @internal
|
|
443
|
-
*/
|
|
444
|
-
selectedIndexChanged(prev, next) {
|
|
445
|
-
if (this.$fastController.isConnected) {
|
|
446
|
-
next = limit(-1, this.options.length - 1, next);
|
|
447
|
-
// we only want to call the super method when the selectedIndex is in range
|
|
448
|
-
if (next !== this.selectedIndex) {
|
|
449
|
-
this.selectedIndex = next;
|
|
450
|
-
return;
|
|
451
|
-
}
|
|
452
|
-
super.selectedIndexChanged(prev, next);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Move focus to the previous selectable option.
|
|
457
|
-
*
|
|
458
|
-
* @internal
|
|
459
|
-
* @remarks
|
|
460
|
-
* Overrides `Listbox.selectPreviousOption`
|
|
461
|
-
*/
|
|
462
|
-
selectPreviousOption() {
|
|
463
|
-
if (!this.disabled && this.selectedIndex >= 0) {
|
|
464
|
-
this.selectedIndex = this.selectedIndex - 1;
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
/**
|
|
468
|
-
* Set the default selected options at initialization or reset.
|
|
469
|
-
*
|
|
470
|
-
* @internal
|
|
471
|
-
* @remarks
|
|
472
|
-
* Overrides `Listbox.setDefaultSelectedOption`
|
|
473
|
-
*/
|
|
474
|
-
setDefaultSelectedOption() {
|
|
475
|
-
if (this.$fastController.isConnected && this.options) {
|
|
476
|
-
const selectedIndex = this.options.findIndex(el => el.getAttribute("selected") !== null || el.selected);
|
|
477
|
-
this.selectedIndex = selectedIndex;
|
|
478
|
-
if (!this.dirtyValue && this.firstSelectedOption) {
|
|
479
|
-
this.value = this.firstSelectedOption.text;
|
|
76
|
+
this.checked = !this.checked;
|
|
480
77
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
}
|
|
484
|
-
/**
|
|
485
|
-
* Focus and set the content of the control based on the first selected option.
|
|
486
|
-
*
|
|
487
|
-
* @internal
|
|
488
|
-
*/
|
|
489
|
-
setInputToSelection() {
|
|
490
|
-
if (this.firstSelectedOption) {
|
|
491
|
-
this.control.value = this.firstSelectedOption.text;
|
|
492
|
-
this.control.focus();
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
/**
|
|
496
|
-
* Focus, set and select the content of the control based on the first selected option.
|
|
497
|
-
*
|
|
498
|
-
* @internal
|
|
499
|
-
*/
|
|
500
|
-
setInlineSelection() {
|
|
501
|
-
if (this.firstSelectedOption) {
|
|
502
|
-
this.setInputToSelection();
|
|
503
|
-
this.control.setSelectionRange(this.filter.length, this.control.value.length, "backward");
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
/**
|
|
507
|
-
* Determines if a value update should involve emitting a change event, then updates the value.
|
|
508
|
-
*
|
|
509
|
-
* @internal
|
|
510
|
-
*/
|
|
511
|
-
syncValue() {
|
|
512
|
-
var _a;
|
|
513
|
-
const newValue = this.selectedIndex > -1 ? (_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text : this.control.value;
|
|
514
|
-
this.updateValue(this.value !== newValue);
|
|
515
|
-
}
|
|
516
|
-
/**
|
|
517
|
-
* Calculate and apply listbox positioning based on available viewport space.
|
|
518
|
-
*
|
|
519
|
-
* @param force - direction to force the listbox to display
|
|
520
|
-
* @public
|
|
521
|
-
*/
|
|
522
|
-
setPositioning() {
|
|
523
|
-
const currentBox = this.getBoundingClientRect();
|
|
524
|
-
const viewportHeight = window.innerHeight;
|
|
525
|
-
const availableBottom = viewportHeight - currentBox.bottom;
|
|
526
|
-
this.position = this.forcedPosition
|
|
527
|
-
? this.positionAttribute
|
|
528
|
-
: currentBox.top > availableBottom
|
|
529
|
-
? SelectPosition.above
|
|
530
|
-
: SelectPosition.below;
|
|
531
|
-
this.positionAttribute = this.forcedPosition
|
|
532
|
-
? this.positionAttribute
|
|
533
|
-
: this.position;
|
|
534
|
-
this.maxHeight =
|
|
535
|
-
this.position === SelectPosition.above ? ~~currentBox.top : ~~availableBottom;
|
|
536
|
-
}
|
|
537
|
-
/**
|
|
538
|
-
* Ensure that the entire list of options is used when setting the selected property.
|
|
539
|
-
*
|
|
540
|
-
* @param prev - the previous list of selected options
|
|
541
|
-
* @param next - the current list of selected options
|
|
542
|
-
*
|
|
543
|
-
* @internal
|
|
544
|
-
* @remarks
|
|
545
|
-
* Overrides: `Listbox.selectedOptionsChanged`
|
|
546
|
-
*/
|
|
547
|
-
selectedOptionsChanged(prev, next) {
|
|
548
|
-
if (this.$fastController.isConnected) {
|
|
549
|
-
this._options.forEach(o => {
|
|
550
|
-
o.selected = next.includes(o);
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
/**
|
|
555
|
-
* Synchronize the form-associated proxy and update the value property of the element.
|
|
556
|
-
*
|
|
557
|
-
* @param prev - the previous collection of slotted option elements
|
|
558
|
-
* @param next - the next collection of slotted option elements
|
|
559
|
-
*
|
|
560
|
-
* @internal
|
|
561
|
-
*/
|
|
562
|
-
slottedOptionsChanged(prev, next) {
|
|
563
|
-
super.slottedOptionsChanged(prev, next);
|
|
564
|
-
this.updateValue();
|
|
78
|
+
};
|
|
79
|
+
this.proxy.setAttribute("type", "checkbox");
|
|
565
80
|
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
* @param shouldEmit - if true, the change event will be emitted
|
|
570
|
-
*
|
|
571
|
-
* @internal
|
|
572
|
-
*/
|
|
573
|
-
updateValue(shouldEmit) {
|
|
574
|
-
var _a;
|
|
575
|
-
if (this.$fastController.isConnected) {
|
|
576
|
-
this.value = ((_a = this.firstSelectedOption) === null || _a === void 0 ? void 0 : _a.text) || this.control.value;
|
|
577
|
-
this.control.value = this.value;
|
|
578
|
-
}
|
|
579
|
-
if (shouldEmit) {
|
|
580
|
-
this.$emit("change");
|
|
81
|
+
readOnlyChanged() {
|
|
82
|
+
if (this.proxy instanceof HTMLInputElement) {
|
|
83
|
+
this.proxy.readOnly = this.readOnly;
|
|
581
84
|
}
|
|
582
85
|
}
|
|
583
|
-
/**
|
|
584
|
-
* @internal
|
|
585
|
-
*/
|
|
586
|
-
clearSelectionRange() {
|
|
587
|
-
const controlValueLength = this.control.value.length;
|
|
588
|
-
this.control.setSelectionRange(controlValueLength, controlValueLength);
|
|
589
|
-
}
|
|
590
86
|
}
|
|
591
87
|
__decorate([
|
|
592
|
-
attr({ attribute: "
|
|
593
|
-
],
|
|
88
|
+
attr({ attribute: "readonly", mode: "boolean" })
|
|
89
|
+
], Checkbox$1.prototype, "readOnly", void 0);
|
|
594
90
|
__decorate([
|
|
595
91
|
observable
|
|
596
|
-
],
|
|
597
|
-
__decorate([
|
|
598
|
-
attr({ attribute: "open", mode: "boolean" })
|
|
599
|
-
], Combobox$1.prototype, "open", void 0);
|
|
600
|
-
__decorate([
|
|
601
|
-
attr
|
|
602
|
-
], Combobox$1.prototype, "placeholder", void 0);
|
|
603
|
-
__decorate([
|
|
604
|
-
attr({ attribute: "position" })
|
|
605
|
-
], Combobox$1.prototype, "positionAttribute", void 0);
|
|
92
|
+
], Checkbox$1.prototype, "defaultSlottedNodes", void 0);
|
|
606
93
|
__decorate([
|
|
607
94
|
observable
|
|
608
|
-
],
|
|
609
|
-
/**
|
|
610
|
-
* Includes ARIA states and properties relating to the ARIA combobox role.
|
|
611
|
-
*
|
|
612
|
-
* @public
|
|
613
|
-
*/
|
|
614
|
-
class DelegatesARIACombobox {
|
|
615
|
-
}
|
|
616
|
-
__decorate([
|
|
617
|
-
observable
|
|
618
|
-
], DelegatesARIACombobox.prototype, "ariaAutoComplete", void 0);
|
|
619
|
-
__decorate([
|
|
620
|
-
observable
|
|
621
|
-
], DelegatesARIACombobox.prototype, "ariaControls", void 0);
|
|
622
|
-
applyMixins(DelegatesARIACombobox, DelegatesARIAListbox);
|
|
623
|
-
applyMixins(Combobox$1, StartEnd, DelegatesARIACombobox);
|
|
95
|
+
], Checkbox$1.prototype, "indeterminate", void 0);
|
|
624
96
|
|
|
625
|
-
var css_248z = "/**\n * Do not edit directly\n * Generated on Mon,
|
|
97
|
+
var css_248z = "/**\n * Do not edit directly\n * Generated on Mon, 03 Apr 2023 14:02:24 GMT\n */\n.base {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n vertical-align: middle;\n}\n.base {\n --_connotation-color-primary: var(--vvd-color-canvas-text);\n --_connotation-color-primary-text: var(--vvd-color-canvas);\n --_connotation-color-primary-increment: var(--vvd-color-neutral-800);\n --_connotation-color-intermediate: var(--vvd-color-neutral-500);\n --_connotation-color-backdrop: var(--vvd-color-canvas);\n --_connotation-color-firm: var(--vvd-color-canvas-text);\n}\n.base {\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.base: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.base:where(:checked, .checked):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--_connotation-color-primary-text);\n --_appearance-color-fill: var(--_connotation-color-primary);\n --_appearance-color-outline: var(--_connotation-color-primary);\n}\n.base:where(:checked, .checked):where(:hover, .hover) {\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.base:where(:disabled, .disabled) {\n --_appearance-color-text: var(--vvd-color-neutral-400);\n --_appearance-color-fill: var(--vvd-color-neutral-200);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n.base:where(.readonly):where(:not(:disabled, .disabled)) {\n --_appearance-color-text: var(--vvd-color-canvas-text);\n --_appearance-color-fill: var(--vvd-color-neutral-100);\n --_appearance-color-outline: var(--vvd-color-neutral-400);\n}\n@supports selector(:focus-visible) {\n .base:focus {\n outline: none;\n }\n}\n@supports (user-select: none) {\n .base {\n user-select: none;\n }\n}\n.base:not(.disabled) {\n cursor: pointer;\n}\n.base.disabled {\n cursor: not-allowed;\n pointer-events: none;\n}\n\n.control {\n position: relative;\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: 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: 3px;\n box-shadow: inset 0 0 0 2px var(--_appearance-color-outline);\n color: var(--_appearance-color-text);\n inline-size: calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20));\n}\n\n.indicator {\n font-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) - 4px);\n}\n.base:not(.checked) .indicator.checkmark {\n display: none;\n}\n\n.base:not(.indeterminate) .indicator.minus, .base.checked .indicator.minus {\n display: none;\n}\n\nlabel {\n color: var(--vvd-color-canvas-text);\n cursor: pointer;\n font: var(--vvd-typography-base);\n}\n\n.focus-indicator {\n --focus-inset: -3px;\n --focus-stroke-gap-color: transparent;\n border-radius: 6px;\n}\n.base:not(:focus-visible) .focus-indicator {\n display: none;\n}\n\n.icon {\n font-size: calc(calc(1px * (40 + 4 * clamp(-1, var(--vvd-size-density, 0), 2) - 20)) * 0.7);\n line-height: 1;\n}";
|
|
626
98
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
99
|
+
const keySpace = ' ';
|
|
100
|
+
class Checkbox extends Checkbox$1 {
|
|
101
|
+
constructor() {
|
|
102
|
+
super(...arguments);
|
|
103
|
+
this.keypressHandler = e => {
|
|
104
|
+
switch (e.key) {
|
|
105
|
+
case keySpace:
|
|
106
|
+
if (this.indeterminate) {
|
|
107
|
+
this.indeterminate = false;
|
|
108
|
+
}
|
|
109
|
+
this.checked = !this.checked;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
this.clickHandler = () => {
|
|
114
|
+
if (!this.disabled && !this.readOnly) {
|
|
115
|
+
if (this.indeterminate) {
|
|
116
|
+
this.indeterminate = false;
|
|
117
|
+
}
|
|
118
|
+
this.checked = !this.checked;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
631
121
|
}
|
|
632
|
-
}
|
|
633
|
-
__decorate([attr, __metadata("design:type", String)],
|
|
634
|
-
Combobox = __decorate([formElements], Combobox);
|
|
635
|
-
applyMixins(Combobox, AffixIcon);
|
|
122
|
+
}
|
|
123
|
+
__decorate([attr, __metadata("design:type", String)], Checkbox.prototype, "label", void 0);
|
|
636
124
|
|
|
637
125
|
let _ = t => t,
|
|
638
126
|
_t,
|
|
639
127
|
_t2,
|
|
640
|
-
_t3
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
</label>`), x => x.label);
|
|
646
|
-
}
|
|
647
|
-
const getStateClasses = ({
|
|
128
|
+
_t3,
|
|
129
|
+
_t4;
|
|
130
|
+
const getClasses = ({
|
|
131
|
+
readOnly,
|
|
132
|
+
checked,
|
|
648
133
|
disabled,
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
function renderInput(context) {
|
|
653
|
-
const affixIconTemplate = affixIconTemplateFactory(context);
|
|
134
|
+
indeterminate
|
|
135
|
+
}) => classNames('base', ['readonly', Boolean(readOnly)], ['checked', Boolean(checked) || Boolean(indeterminate)], ['disabled', Boolean(disabled)]);
|
|
136
|
+
const CheckboxTemplate = context => {
|
|
654
137
|
const focusTemplate = focusTemplateFactory(context);
|
|
655
|
-
|
|
656
|
-
|
|
138
|
+
const iconTag = context.tagFor(Icon);
|
|
139
|
+
return html(_t || (_t = _`<div
|
|
140
|
+
role="checkbox"
|
|
141
|
+
aria-checked="${0}"
|
|
142
|
+
aria-required="${0}"
|
|
143
|
+
aria-disabled="${0}"
|
|
144
|
+
aria-readonly="${0}"
|
|
145
|
+
tabindex="${0}"
|
|
146
|
+
@keypress="${0}"
|
|
147
|
+
@click="${0}"
|
|
148
|
+
class="${0}"
|
|
149
|
+
>
|
|
150
|
+
<div class="control">
|
|
657
151
|
${0}
|
|
658
|
-
<div class="fieldset">
|
|
659
|
-
<input
|
|
660
|
-
id="control"
|
|
661
|
-
class="control"
|
|
662
|
-
aria-activedescendant="${0}"
|
|
663
|
-
aria-autocomplete="${0}"
|
|
664
|
-
aria-controls="${0}"
|
|
665
|
-
aria-disabled="${0}"
|
|
666
|
-
aria-expanded="${0}"
|
|
667
|
-
aria-haspopup="listbox"
|
|
668
|
-
placeholder="${0}"
|
|
669
|
-
role="combobox"
|
|
670
|
-
type="text"
|
|
671
|
-
?disabled="${0}"
|
|
672
|
-
:value="${0}"
|
|
673
|
-
@input="${0}"
|
|
674
|
-
@keyup="${0}"
|
|
675
|
-
${0}
|
|
676
|
-
/>
|
|
677
|
-
${0}
|
|
678
|
-
${0}
|
|
679
|
-
</div>
|
|
680
|
-
</div>`), getStateClasses, ref('_anchor'), when(x => x.label, renderLabel()), x => x.open ? x.ariaActiveDescendant : null, x => x.ariaAutoComplete, x => x.ariaControls, x => x.ariaDisabled, x => x.ariaExpanded, x => x.placeholder, x => x.disabled, x => x.value, (x, c) => x.inputHandler(c.event), (x, c) => x.keyupHandler(c.event), ref('control'), () => affixIconTemplate('chevron-down-line'), () => focusTemplate);
|
|
681
|
-
}
|
|
682
|
-
const comboboxTemplate = context => {
|
|
683
|
-
const popupTag = context.tagFor(Popup);
|
|
684
|
-
return html(_t3 || (_t3 = _`
|
|
685
|
-
<template
|
|
686
|
-
aria-disabled="${0}"
|
|
687
|
-
autocomplete="${0}"
|
|
688
|
-
tabindex="${0}"
|
|
689
|
-
@click="${0}"
|
|
690
|
-
@focusout="${0}"
|
|
691
|
-
@keydown="${0}"
|
|
692
|
-
>
|
|
693
152
|
${0}
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
class="listbox"
|
|
701
|
-
role="listbox"
|
|
702
|
-
?disabled="${0}"
|
|
703
|
-
${0}>
|
|
704
|
-
<slot ${0}>
|
|
705
|
-
</slot>
|
|
706
|
-
</div>
|
|
707
|
-
</${0}>
|
|
708
|
-
</template>
|
|
709
|
-
`), x => x.ariaDisabled, x => x.autocomplete, x => !x.disabled ? '0' : null, (x, c) => x.clickHandler(c.event), (x, c) => x.focusoutHandler(c.event), (x, c) => x.keydownHandler(c.event), () => renderInput(context), popupTag, x => x.open, x => x.placement, ref('_popup'), x => x.listboxId, x => x.disabled, ref('listbox'), slotted({
|
|
710
|
-
filter: Listbox$1.slottedOptionFilter,
|
|
711
|
-
flatten: true,
|
|
712
|
-
property: 'slottedOptions'
|
|
713
|
-
}), popupTag);
|
|
153
|
+
${0}
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
|
+
${0}
|
|
157
|
+
|
|
158
|
+
</div>`), x => x.checked, x => x.required, x => x.disabled, x => x.readOnly, x => x.disabled ? null : 0, (x, c) => x.keypressHandler(c.event), x => x.clickHandler(), getClasses, when(x => x.checked, html(_t2 || (_t2 = _`<${0} name="check-solid" class="icon"></${0}>`), iconTag, iconTag)), when(x => x.indeterminate, html(_t3 || (_t3 = _`<${0} name="minus-solid" class="icon"></${0}>`), iconTag, iconTag)), () => focusTemplate, when(x => x.label, html(_t4 || (_t4 = _`<label>${0}</label>`), x => x.label)));
|
|
714
159
|
};
|
|
715
160
|
|
|
716
|
-
const
|
|
717
|
-
baseName: '
|
|
718
|
-
template:
|
|
719
|
-
styles:
|
|
161
|
+
const checkboxDefinition = Checkbox.compose({
|
|
162
|
+
baseName: 'checkbox',
|
|
163
|
+
template: CheckboxTemplate,
|
|
164
|
+
styles: css_248z,
|
|
720
165
|
shadowOptions: {
|
|
721
166
|
delegatesFocus: true
|
|
722
167
|
}
|
|
723
|
-
})
|
|
724
|
-
const
|
|
725
|
-
const
|
|
168
|
+
});
|
|
169
|
+
const checkboxRegistries = [checkboxDefinition(), ...iconRegistries, ...focusRegistries];
|
|
170
|
+
const registerCheckbox = registerFactory(checkboxRegistries);
|
|
726
171
|
|
|
727
|
-
export {
|
|
172
|
+
export { checkboxRegistries as a, checkboxDefinition as c, registerCheckbox as r };
|