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