@patternfly/pfe-core 3.0.0 → 4.0.1
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/controllers/activedescendant-controller.d.ts +99 -0
- package/controllers/activedescendant-controller.js +230 -0
- package/controllers/activedescendant-controller.js.map +1 -0
- package/controllers/at-focus-controller.d.ts +56 -0
- package/controllers/at-focus-controller.js +168 -0
- package/controllers/at-focus-controller.js.map +1 -0
- package/controllers/cascade-controller.d.ts +7 -2
- package/controllers/cascade-controller.js +6 -1
- package/controllers/cascade-controller.js.map +1 -1
- package/controllers/combobox-controller.d.ts +117 -0
- package/controllers/combobox-controller.js +611 -0
- package/controllers/combobox-controller.js.map +1 -0
- package/controllers/css-variable-controller.js +1 -1
- package/controllers/css-variable-controller.js.map +1 -1
- package/controllers/floating-dom-controller.d.ts +8 -1
- package/controllers/floating-dom-controller.js +12 -5
- package/controllers/floating-dom-controller.js.map +1 -1
- package/controllers/internals-controller.d.ts +26 -9
- package/controllers/internals-controller.js +45 -13
- package/controllers/internals-controller.js.map +1 -1
- package/controllers/light-dom-controller.js +2 -2
- package/controllers/light-dom-controller.js.map +1 -1
- package/controllers/listbox-controller.d.ts +118 -33
- package/controllers/listbox-controller.js +347 -154
- package/controllers/listbox-controller.js.map +1 -1
- package/controllers/logger.d.ts +13 -10
- package/controllers/logger.js +15 -11
- package/controllers/logger.js.map +1 -1
- package/controllers/overflow-controller.js +10 -6
- package/controllers/overflow-controller.js.map +1 -1
- package/controllers/perf-controller.js.map +1 -1
- package/controllers/property-observer-controller.d.ts +13 -16
- package/controllers/property-observer-controller.js +54 -25
- package/controllers/property-observer-controller.js.map +1 -1
- package/controllers/roving-tabindex-controller.d.ts +12 -61
- package/controllers/roving-tabindex-controller.js +57 -203
- package/controllers/roving-tabindex-controller.js.map +1 -1
- package/controllers/scroll-spy-controller.d.ts +4 -1
- package/controllers/scroll-spy-controller.js +9 -6
- package/controllers/scroll-spy-controller.js.map +1 -1
- package/controllers/slot-controller.d.ts +12 -16
- package/controllers/slot-controller.js +17 -20
- package/controllers/slot-controller.js.map +1 -1
- package/controllers/style-controller.js +3 -1
- package/controllers/style-controller.js.map +1 -1
- package/controllers/tabs-aria-controller.d.ts +2 -0
- package/controllers/tabs-aria-controller.js +2 -0
- package/controllers/tabs-aria-controller.js.map +1 -1
- package/controllers/test/combobox-controller.spec.d.ts +1 -0
- package/controllers/test/combobox-controller.spec.js +282 -0
- package/controllers/test/combobox-controller.spec.js.map +1 -0
- package/controllers/timestamp-controller.js +7 -2
- package/controllers/timestamp-controller.js.map +1 -1
- package/core.d.ts +0 -23
- package/core.js +1 -38
- package/core.js.map +1 -1
- package/custom-elements.json +3862 -1369
- package/decorators/bound.d.ts +3 -1
- package/decorators/bound.js +3 -1
- package/decorators/bound.js.map +1 -1
- package/decorators/cascades.d.ts +2 -1
- package/decorators/cascades.js +2 -1
- package/decorators/cascades.js.map +1 -1
- package/decorators/deprecation.d.ts +6 -5
- package/decorators/deprecation.js +6 -5
- package/decorators/deprecation.js.map +1 -1
- package/decorators/initializer.js.map +1 -1
- package/decorators/listen.d.ts +8 -0
- package/decorators/listen.js +22 -0
- package/decorators/listen.js.map +1 -0
- package/decorators/observed.d.ts +12 -16
- package/decorators/observed.js +39 -44
- package/decorators/observed.js.map +1 -1
- package/decorators/observes.d.ts +15 -0
- package/decorators/observes.js +30 -0
- package/decorators/observes.js.map +1 -0
- package/decorators/time.d.ts +1 -0
- package/decorators/time.js +6 -9
- package/decorators/time.js.map +1 -1
- package/decorators/trace.d.ts +4 -1
- package/decorators/trace.js +4 -1
- package/decorators/trace.js.map +1 -1
- package/decorators.d.ts +2 -0
- package/decorators.js +2 -0
- package/decorators.js.map +1 -1
- package/functions/arraysAreEquivalent.d.ts +9 -0
- package/functions/arraysAreEquivalent.js +28 -0
- package/functions/arraysAreEquivalent.js.map +1 -0
- package/functions/containsDeep.d.ts +2 -0
- package/functions/containsDeep.js +2 -0
- package/functions/containsDeep.js.map +1 -1
- package/functions/context.d.ts +3 -4
- package/functions/context.js +6 -2
- package/functions/context.js.map +1 -1
- package/functions/debounce.js.map +1 -1
- package/functions/isElementInView.d.ts +4 -6
- package/functions/isElementInView.js +9 -11
- package/functions/isElementInView.js.map +1 -1
- package/package.json +12 -4
- package/ssr-shims.d.ts +17 -0
- package/ssr-shims.js +55 -0
- package/ssr-shims.js.map +1 -0
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
var _ComboboxController_instances, _a, _ComboboxController_alert, _ComboboxController_alertTemplate, _ComboboxController_lb, _ComboboxController_fc, _ComboboxController_preventListboxGainingFocus, _ComboboxController_input, _ComboboxController_button, _ComboboxController_listbox, _ComboboxController_buttonInitialRole, _ComboboxController_mo, _ComboboxController_microcopy, _ComboboxController_hasTextInput_get, _ComboboxController_focusedItem_get, _ComboboxController_element_get, _ComboboxController_init, _ComboboxController_initListbox, _ComboboxController_initButton, _ComboboxController_initInput, _ComboboxController_initLabels, _ComboboxController_initController, _ComboboxController_initItems, _ComboboxController_show, _ComboboxController_hide, _ComboboxController_toggle, _ComboboxController_translate, _ComboboxController_announce, _ComboboxController_filterItems, _ComboboxController_onClickButton, _ComboboxController_onClickListbox, _ComboboxController_onKeydownInput, _ComboboxController_onKeyupInput, _ComboboxController_onKeydownButton, _ComboboxController_onKeydownListbox, _ComboboxController_onFocusoutListbox, _ComboboxController_onKeydownToggleButton;
|
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
|
+
import { nothing } from 'lit';
|
|
4
|
+
import { ListboxController, isItem, isItemDisabled } from './listbox-controller.js';
|
|
5
|
+
import { RovingTabindexController } from './roving-tabindex-controller.js';
|
|
6
|
+
import { ActivedescendantController } from './activedescendant-controller.js';
|
|
7
|
+
import { InternalsController } from './internals-controller.js';
|
|
8
|
+
import { getRandomId } from '../functions/random.js';
|
|
9
|
+
function deepClosest(element, selector) {
|
|
10
|
+
let closest = element?.closest(selector);
|
|
11
|
+
let root = element?.getRootNode();
|
|
12
|
+
let count = 0;
|
|
13
|
+
while (count < 500 && !closest && element) {
|
|
14
|
+
count++;
|
|
15
|
+
root = element.getRootNode();
|
|
16
|
+
if (root instanceof ShadowRoot) {
|
|
17
|
+
element = root.host;
|
|
18
|
+
}
|
|
19
|
+
else if (root instanceof Document) {
|
|
20
|
+
element = document.documentElement;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
closest = element.closest(selector);
|
|
26
|
+
}
|
|
27
|
+
return closest;
|
|
28
|
+
}
|
|
29
|
+
function getItemValue(item) {
|
|
30
|
+
if ('value' in item && typeof item.value === 'string') {
|
|
31
|
+
return item.value;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return '';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function isItemFiltered(item, value) {
|
|
38
|
+
return !getItemValue(item)
|
|
39
|
+
.toLowerCase()
|
|
40
|
+
.startsWith(value.toLowerCase());
|
|
41
|
+
}
|
|
42
|
+
function setItemHidden(item, hidden) {
|
|
43
|
+
item.hidden = hidden;
|
|
44
|
+
}
|
|
45
|
+
function setComboboxValue(item, value) {
|
|
46
|
+
if (!('value' in item)) {
|
|
47
|
+
// eslint-disable-next-line no-console
|
|
48
|
+
return console.warn(`Cannot set value on combobox element ${item.localName}`);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
item.value = value;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function getComboboxValue(combobox) {
|
|
55
|
+
if ('value' in combobox && typeof combobox.value === 'string') {
|
|
56
|
+
return combobox.value;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// eslint-disable-next-line no-console
|
|
60
|
+
return console.warn(`Cannot get value from combobox element ${combobox.localName}`), '';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @summary Implements the WAI-ARIA pattern [Editable Combobox with Both List and Inline Autocomplete].
|
|
65
|
+
*
|
|
66
|
+
* Combobox with keyboard and pointer navigation, using the aria-activedescendant pattern.
|
|
67
|
+
*
|
|
68
|
+
* WARNING: Safari VoiceOver does not support aria-activedescendant, so Safari users
|
|
69
|
+
* rely on the combobox input value being announced when navigating the listbox with the keyboard.
|
|
70
|
+
* We have erred on the side that it may be less-broken to avoid announcing disabled items in that
|
|
71
|
+
* case, rather than announcing the disabled items value without indicating that it is disabled.
|
|
72
|
+
* @see (https://bugs.webkit.org/show_bug.cgi?id=269026)
|
|
73
|
+
*
|
|
74
|
+
* [pattern]: https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-both/
|
|
75
|
+
*/
|
|
76
|
+
export class ComboboxController {
|
|
77
|
+
static of(host, options) {
|
|
78
|
+
return new _a(host, options);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Whether the `ariaActiveDescendantElement` IDL attribute is supported for cross-root ARIA.
|
|
82
|
+
*/
|
|
83
|
+
static get supportsCrossRootActiveDescendant() {
|
|
84
|
+
return ActivedescendantController.supportsCrossRootActiveDescendant;
|
|
85
|
+
}
|
|
86
|
+
/** All items */
|
|
87
|
+
get items() {
|
|
88
|
+
return __classPrivateFieldGet(this, _ComboboxController_lb, "f").items;
|
|
89
|
+
}
|
|
90
|
+
set items(value) {
|
|
91
|
+
__classPrivateFieldGet(this, _ComboboxController_lb, "f").items = value;
|
|
92
|
+
}
|
|
93
|
+
/** Whether the combobox is disabled */
|
|
94
|
+
get disabled() {
|
|
95
|
+
return __classPrivateFieldGet(this, _ComboboxController_lb, "f").disabled;
|
|
96
|
+
}
|
|
97
|
+
set disabled(value) {
|
|
98
|
+
__classPrivateFieldGet(this, _ComboboxController_lb, "f").disabled = value;
|
|
99
|
+
}
|
|
100
|
+
/** Whether multiselect is enabled */
|
|
101
|
+
get multi() {
|
|
102
|
+
return __classPrivateFieldGet(this, _ComboboxController_lb, "f").multi;
|
|
103
|
+
}
|
|
104
|
+
set multi(value) {
|
|
105
|
+
__classPrivateFieldGet(this, _ComboboxController_lb, "f").multi = value;
|
|
106
|
+
}
|
|
107
|
+
/** The current selection: a list of items */
|
|
108
|
+
get selected() {
|
|
109
|
+
return __classPrivateFieldGet(this, _ComboboxController_lb, "f").selected;
|
|
110
|
+
}
|
|
111
|
+
set selected(value) {
|
|
112
|
+
__classPrivateFieldGet(this, _ComboboxController_lb, "f").selected = value;
|
|
113
|
+
}
|
|
114
|
+
constructor(host, options) {
|
|
115
|
+
_ComboboxController_instances.add(this);
|
|
116
|
+
this.host = host;
|
|
117
|
+
_ComboboxController_lb.set(this, void 0);
|
|
118
|
+
_ComboboxController_fc.set(this, void 0);
|
|
119
|
+
_ComboboxController_preventListboxGainingFocus.set(this, false);
|
|
120
|
+
_ComboboxController_input.set(this, null);
|
|
121
|
+
_ComboboxController_button.set(this, null);
|
|
122
|
+
_ComboboxController_listbox.set(this, null);
|
|
123
|
+
_ComboboxController_buttonInitialRole.set(this, null);
|
|
124
|
+
_ComboboxController_mo.set(this, new MutationObserver(() => __classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_initItems).call(this)));
|
|
125
|
+
_ComboboxController_microcopy.set(this, new Map(Object.entries({
|
|
126
|
+
dimmed: {
|
|
127
|
+
en: 'dimmed',
|
|
128
|
+
es: 'atenuada',
|
|
129
|
+
de: 'gedimmt',
|
|
130
|
+
it: 'oscurato',
|
|
131
|
+
fr: 'atténué',
|
|
132
|
+
ja: '暗くなった',
|
|
133
|
+
zh: '变暗',
|
|
134
|
+
},
|
|
135
|
+
selected: {
|
|
136
|
+
en: 'selected',
|
|
137
|
+
es: 'seleccionado',
|
|
138
|
+
de: 'ausgewählt',
|
|
139
|
+
fr: 'choisie',
|
|
140
|
+
it: 'selezionato',
|
|
141
|
+
ja: '選ばれた',
|
|
142
|
+
zh: '选',
|
|
143
|
+
},
|
|
144
|
+
of: {
|
|
145
|
+
en: 'of',
|
|
146
|
+
es: 'de',
|
|
147
|
+
de: 'von',
|
|
148
|
+
fr: 'sur',
|
|
149
|
+
it: 'di',
|
|
150
|
+
ja: '件目',
|
|
151
|
+
zh: '的',
|
|
152
|
+
},
|
|
153
|
+
})));
|
|
154
|
+
_ComboboxController_onClickButton.set(this, () => {
|
|
155
|
+
if (!this.options.isExpanded()) {
|
|
156
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_show).call(this);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_hide).call(this);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
_ComboboxController_onClickListbox.set(this, (event) => {
|
|
163
|
+
if (!this.multi && event.composedPath().some(this.options.isItem)) {
|
|
164
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_hide).call(this);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
/**
|
|
168
|
+
* Handle keypresses on the input
|
|
169
|
+
* ## `Down Arrow`
|
|
170
|
+
* - If the textbox is not empty and the listbox is displayed,
|
|
171
|
+
* moves visual focus to the first suggested value.
|
|
172
|
+
* - If the textbox is empty and the listbox is not displayed,
|
|
173
|
+
* opens the listbox and moves visual focus to the first option.
|
|
174
|
+
* - In both cases DOM focus remains on the textbox.
|
|
175
|
+
*
|
|
176
|
+
* ## `Alt + Down Arrow`
|
|
177
|
+
* Opens the listbox without moving focus or changing selection.
|
|
178
|
+
*
|
|
179
|
+
* ## `Up Arrow`
|
|
180
|
+
* - If the textbox is not empty and the listbox is displayed,
|
|
181
|
+
* moves visual focus to the last suggested value.
|
|
182
|
+
* - If the textbox is empty, first opens the listbox if it is not already displayed
|
|
183
|
+
* and then moves visual focus to the last option.
|
|
184
|
+
* - In both cases DOM focus remains on the textbox.
|
|
185
|
+
*
|
|
186
|
+
* ## `Enter`
|
|
187
|
+
* Closes the listbox if it is displayed.
|
|
188
|
+
*
|
|
189
|
+
* ## `Escape`
|
|
190
|
+
* - If the listbox is displayed, closes it.
|
|
191
|
+
* - If the listbox is not displayed, clears the textbox.
|
|
192
|
+
*
|
|
193
|
+
* ## Standard single line text editing keys
|
|
194
|
+
* - Keys used for cursor movement and text manipulation,
|
|
195
|
+
* such as `Delete` and `Shift + Right Arrow`.
|
|
196
|
+
* - An HTML `input` with `type="text"` is used for the textbox so the browser will provide
|
|
197
|
+
* platform-specific editing keys.
|
|
198
|
+
*
|
|
199
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-list
|
|
200
|
+
* @param event keydown event
|
|
201
|
+
*/
|
|
202
|
+
_ComboboxController_onKeydownInput.set(this, (event) => {
|
|
203
|
+
if (event.ctrlKey || event.shiftKey || !__classPrivateFieldGet(this, _ComboboxController_input, "f")) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
switch (event.key) {
|
|
207
|
+
case 'ArrowDown':
|
|
208
|
+
case 'ArrowUp':
|
|
209
|
+
if (!this.options.isExpanded()) {
|
|
210
|
+
__classPrivateFieldSet(this, _ComboboxController_preventListboxGainingFocus, event.altKey, "f");
|
|
211
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_show).call(this);
|
|
212
|
+
}
|
|
213
|
+
break;
|
|
214
|
+
case 'Enter':
|
|
215
|
+
if (!this.multi) {
|
|
216
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_hide).call(this);
|
|
217
|
+
}
|
|
218
|
+
break;
|
|
219
|
+
case 'Escape':
|
|
220
|
+
if (!this.options.isExpanded()) {
|
|
221
|
+
this.options.setComboboxValue(__classPrivateFieldGet(this, _ComboboxController_input, "f"), '');
|
|
222
|
+
this.host.requestUpdate();
|
|
223
|
+
}
|
|
224
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_hide).call(this);
|
|
225
|
+
break;
|
|
226
|
+
case 'Alt':
|
|
227
|
+
case 'AltGraph':
|
|
228
|
+
case 'Shift':
|
|
229
|
+
case 'Control':
|
|
230
|
+
case 'Fn':
|
|
231
|
+
case 'Symbol':
|
|
232
|
+
case 'Hyper':
|
|
233
|
+
case 'Super':
|
|
234
|
+
case 'Meta':
|
|
235
|
+
case 'CapsLock':
|
|
236
|
+
case 'FnLock':
|
|
237
|
+
case 'NumLock':
|
|
238
|
+
case 'Tab':
|
|
239
|
+
case 'ScrollLock':
|
|
240
|
+
case 'SymbolLock':
|
|
241
|
+
case ' ':
|
|
242
|
+
break;
|
|
243
|
+
default:
|
|
244
|
+
if (!this.options.isExpanded()) {
|
|
245
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_show).call(this);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
/**
|
|
250
|
+
* Populates the combobox input with the focused value when navigating the listbox,
|
|
251
|
+
* and filters the items when typing.
|
|
252
|
+
* @param event keyup event
|
|
253
|
+
*/
|
|
254
|
+
_ComboboxController_onKeyupInput.set(this, (event) => {
|
|
255
|
+
if (!__classPrivateFieldGet(this, _ComboboxController_input, "f")) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
switch (event.key) {
|
|
259
|
+
case 'ArrowUp':
|
|
260
|
+
case 'ArrowDown':
|
|
261
|
+
/**
|
|
262
|
+
* Safari VoiceOver does not support aria-activedescendant, so we must.
|
|
263
|
+
* approximate the correct behaviour by constructing a visually-hidden alert role
|
|
264
|
+
* @see (https://bugs.webkit.org/show_bug.cgi?id=269026)
|
|
265
|
+
*/
|
|
266
|
+
if (__classPrivateFieldGet(this, _ComboboxController_instances, "a", _ComboboxController_focusedItem_get)
|
|
267
|
+
&& this.options.getComboboxInput()
|
|
268
|
+
&& InternalsController.isSafari) {
|
|
269
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_announce).call(this, __classPrivateFieldGet(this, _ComboboxController_instances, "a", _ComboboxController_focusedItem_get));
|
|
270
|
+
}
|
|
271
|
+
break;
|
|
272
|
+
default:
|
|
273
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_filterItems).call(this);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
_ComboboxController_onKeydownButton.set(this, (event) => {
|
|
277
|
+
if (__classPrivateFieldGet(this, _ComboboxController_instances, "a", _ComboboxController_hasTextInput_get)) {
|
|
278
|
+
return __classPrivateFieldGet(this, _ComboboxController_onKeydownInput, "f").call(this, event);
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
return __classPrivateFieldGet(this, _ComboboxController_onKeydownToggleButton, "f").call(this, event);
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
_ComboboxController_onKeydownListbox.set(this, (event) => {
|
|
285
|
+
if (!__classPrivateFieldGet(this, _ComboboxController_instances, "a", _ComboboxController_hasTextInput_get)) {
|
|
286
|
+
switch (event.key) {
|
|
287
|
+
case 'Home':
|
|
288
|
+
case 'End':
|
|
289
|
+
__classPrivateFieldGet(this, _ComboboxController_onKeydownToggleButton, "f").call(this, event);
|
|
290
|
+
break;
|
|
291
|
+
case 'Escape':
|
|
292
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_hide).call(this);
|
|
293
|
+
__classPrivateFieldGet(this, _ComboboxController_button, "f")?.focus();
|
|
294
|
+
break;
|
|
295
|
+
case 'Enter':
|
|
296
|
+
case ' ': {
|
|
297
|
+
const eventItem = event.composedPath().find(this.options.isItem);
|
|
298
|
+
if (eventItem
|
|
299
|
+
&& !this.multi
|
|
300
|
+
&& this.options.isExpanded()
|
|
301
|
+
&& !this.options.isItemDisabled(eventItem)) {
|
|
302
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_hide).call(this);
|
|
303
|
+
__classPrivateFieldGet(this, _ComboboxController_button, "f")?.focus();
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
_ComboboxController_onFocusoutListbox.set(this, (event) => {
|
|
310
|
+
if (!__classPrivateFieldGet(this, _ComboboxController_instances, "a", _ComboboxController_hasTextInput_get) && this.options.isExpanded()) {
|
|
311
|
+
const root = __classPrivateFieldGet(this, _ComboboxController_instances, "a", _ComboboxController_element_get)?.getRootNode();
|
|
312
|
+
if ((root instanceof ShadowRoot || root instanceof Document)
|
|
313
|
+
&& !this.items.includes(event.relatedTarget)) {
|
|
314
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_hide).call(this);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
_ComboboxController_onKeydownToggleButton.set(this, async (event) => {
|
|
319
|
+
switch (event.key) {
|
|
320
|
+
case 'ArrowDown':
|
|
321
|
+
case 'ArrowUp':
|
|
322
|
+
if (!this.options.isExpanded()) {
|
|
323
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_show).call(this);
|
|
324
|
+
}
|
|
325
|
+
break;
|
|
326
|
+
case 'Home':
|
|
327
|
+
if (!this.options.isExpanded()) {
|
|
328
|
+
await __classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_show).call(this);
|
|
329
|
+
}
|
|
330
|
+
if (__classPrivateFieldGet(this, _ComboboxController_fc, "f")) {
|
|
331
|
+
__classPrivateFieldGet(this, _ComboboxController_fc, "f").atFocusedItemIndex = 0;
|
|
332
|
+
}
|
|
333
|
+
break;
|
|
334
|
+
case 'End':
|
|
335
|
+
if (!this.options.isExpanded()) {
|
|
336
|
+
await __classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_show).call(this);
|
|
337
|
+
}
|
|
338
|
+
if (__classPrivateFieldGet(this, _ComboboxController_fc, "f")) {
|
|
339
|
+
__classPrivateFieldGet(this, _ComboboxController_fc, "f").atFocusedItemIndex = this.items.length - 1;
|
|
340
|
+
}
|
|
341
|
+
break;
|
|
342
|
+
case ' ':
|
|
343
|
+
case 'Enter':
|
|
344
|
+
// prevent scroll
|
|
345
|
+
event.preventDefault();
|
|
346
|
+
await __classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_toggle).call(this);
|
|
347
|
+
await this.host.updateComplete;
|
|
348
|
+
if (!this.options.isExpanded()) {
|
|
349
|
+
__classPrivateFieldGet(this, _ComboboxController_button, "f")?.focus();
|
|
350
|
+
}
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
host.addController(this);
|
|
355
|
+
this.options = {
|
|
356
|
+
isItem,
|
|
357
|
+
getItemValue,
|
|
358
|
+
isItemFiltered,
|
|
359
|
+
isItemDisabled,
|
|
360
|
+
getComboboxValue,
|
|
361
|
+
setComboboxValue,
|
|
362
|
+
setItemHidden,
|
|
363
|
+
getOrientation: () => 'vertical',
|
|
364
|
+
...options,
|
|
365
|
+
};
|
|
366
|
+
__classPrivateFieldSet(this, _ComboboxController_lb, ListboxController.of(host, {
|
|
367
|
+
isItem: this.options.isItem,
|
|
368
|
+
getItemsContainer: this.options.getListboxElement,
|
|
369
|
+
getControlsElements: () => [
|
|
370
|
+
this.options.getToggleButton(),
|
|
371
|
+
this.options.getComboboxInput(),
|
|
372
|
+
].filter(x => !!x),
|
|
373
|
+
getATFocusedItem: () => this.items[__classPrivateFieldGet(this, _ComboboxController_fc, "f")?.atFocusedItemIndex ?? -1] ?? null,
|
|
374
|
+
isItemDisabled: this.options.isItemDisabled,
|
|
375
|
+
setItemSelected: this.options.setItemSelected,
|
|
376
|
+
}), "f");
|
|
377
|
+
}
|
|
378
|
+
async hostConnected() {
|
|
379
|
+
await this.host.updateComplete;
|
|
380
|
+
this.hostUpdated();
|
|
381
|
+
}
|
|
382
|
+
hostUpdated() {
|
|
383
|
+
if (!__classPrivateFieldGet(this, _ComboboxController_fc, "f")) {
|
|
384
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_init).call(this);
|
|
385
|
+
}
|
|
386
|
+
const expanded = this.options.isExpanded();
|
|
387
|
+
__classPrivateFieldGet(this, _ComboboxController_button, "f")?.setAttribute('aria-expanded', String(expanded));
|
|
388
|
+
__classPrivateFieldGet(this, _ComboboxController_input, "f")?.setAttribute('aria-expanded', String(expanded));
|
|
389
|
+
if (__classPrivateFieldGet(this, _ComboboxController_instances, "a", _ComboboxController_hasTextInput_get)) {
|
|
390
|
+
__classPrivateFieldGet(this, _ComboboxController_button, "f")?.setAttribute('tabindex', '-1');
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
__classPrivateFieldGet(this, _ComboboxController_button, "f")?.removeAttribute('tabindex');
|
|
394
|
+
}
|
|
395
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_initLabels).call(this);
|
|
396
|
+
}
|
|
397
|
+
hostDisconnected() {
|
|
398
|
+
__classPrivateFieldGet(this, _ComboboxController_fc, "f")?.hostDisconnected();
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* For Browsers which do not support `ariaActiveDescendantElement`, we must clone
|
|
402
|
+
* the listbox items into the same root as the combobox input
|
|
403
|
+
* Call this method to return either an array of (cloned) list box items, to be placed in your
|
|
404
|
+
* shadow template, or nothing in the case the browser supports cross-root aria.
|
|
405
|
+
*/
|
|
406
|
+
renderItemsToShadowRoot() {
|
|
407
|
+
if (__classPrivateFieldGet(this, _ComboboxController_fc, "f") instanceof ActivedescendantController) {
|
|
408
|
+
return __classPrivateFieldGet(this, _ComboboxController_fc, "f").renderItemsToShadowRoot();
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
return nothing;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
_a = ComboboxController, _ComboboxController_lb = new WeakMap(), _ComboboxController_fc = new WeakMap(), _ComboboxController_preventListboxGainingFocus = new WeakMap(), _ComboboxController_input = new WeakMap(), _ComboboxController_button = new WeakMap(), _ComboboxController_listbox = new WeakMap(), _ComboboxController_buttonInitialRole = new WeakMap(), _ComboboxController_mo = new WeakMap(), _ComboboxController_microcopy = new WeakMap(), _ComboboxController_onClickButton = new WeakMap(), _ComboboxController_onClickListbox = new WeakMap(), _ComboboxController_onKeydownInput = new WeakMap(), _ComboboxController_onKeyupInput = new WeakMap(), _ComboboxController_onKeydownButton = new WeakMap(), _ComboboxController_onKeydownListbox = new WeakMap(), _ComboboxController_onFocusoutListbox = new WeakMap(), _ComboboxController_onKeydownToggleButton = new WeakMap(), _ComboboxController_instances = new WeakSet(), _ComboboxController_hasTextInput_get = function _ComboboxController_hasTextInput_get() {
|
|
416
|
+
return this.options.getComboboxInput();
|
|
417
|
+
}, _ComboboxController_focusedItem_get = function _ComboboxController_focusedItem_get() {
|
|
418
|
+
return __classPrivateFieldGet(this, _ComboboxController_fc, "f")?.items.at(Math.max(__classPrivateFieldGet(this, _ComboboxController_fc, "f")?.atFocusedItemIndex ?? -1, 0)) ?? null;
|
|
419
|
+
}, _ComboboxController_element_get = function _ComboboxController_element_get() {
|
|
420
|
+
if (this.host instanceof HTMLElement) {
|
|
421
|
+
return this.host;
|
|
422
|
+
}
|
|
423
|
+
else if (this.options.getListboxElement() instanceof HTMLElement) {
|
|
424
|
+
return this.options.getListboxElement();
|
|
425
|
+
}
|
|
426
|
+
}, _ComboboxController_init =
|
|
427
|
+
/**
|
|
428
|
+
* Order of operations is important
|
|
429
|
+
*/
|
|
430
|
+
async function _ComboboxController_init() {
|
|
431
|
+
await this.host.updateComplete;
|
|
432
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_initListbox).call(this);
|
|
433
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_initItems).call(this);
|
|
434
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_initButton).call(this);
|
|
435
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_initInput).call(this);
|
|
436
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_initLabels).call(this);
|
|
437
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_initController).call(this);
|
|
438
|
+
}, _ComboboxController_initListbox = function _ComboboxController_initListbox() {
|
|
439
|
+
var _b;
|
|
440
|
+
__classPrivateFieldGet(this, _ComboboxController_mo, "f").disconnect();
|
|
441
|
+
__classPrivateFieldGet(this, _ComboboxController_listbox, "f")?.removeEventListener('focusout', __classPrivateFieldGet(this, _ComboboxController_onFocusoutListbox, "f"));
|
|
442
|
+
__classPrivateFieldGet(this, _ComboboxController_listbox, "f")?.removeEventListener('keydown', __classPrivateFieldGet(this, _ComboboxController_onKeydownListbox, "f"));
|
|
443
|
+
__classPrivateFieldGet(this, _ComboboxController_listbox, "f")?.removeEventListener('click', __classPrivateFieldGet(this, _ComboboxController_onClickListbox, "f"));
|
|
444
|
+
__classPrivateFieldSet(this, _ComboboxController_listbox, this.options.getListboxElement(), "f");
|
|
445
|
+
if (!__classPrivateFieldGet(this, _ComboboxController_listbox, "f")) {
|
|
446
|
+
throw new Error('ComboboxController getListboxElement() option must return an element');
|
|
447
|
+
}
|
|
448
|
+
__classPrivateFieldGet(this, _ComboboxController_listbox, "f").addEventListener('focusout', __classPrivateFieldGet(this, _ComboboxController_onFocusoutListbox, "f"));
|
|
449
|
+
__classPrivateFieldGet(this, _ComboboxController_listbox, "f").addEventListener('keydown', __classPrivateFieldGet(this, _ComboboxController_onKeydownListbox, "f"));
|
|
450
|
+
__classPrivateFieldGet(this, _ComboboxController_listbox, "f").addEventListener('click', __classPrivateFieldGet(this, _ComboboxController_onClickListbox, "f"));
|
|
451
|
+
(_b = __classPrivateFieldGet(this, _ComboboxController_listbox, "f")).id ?? (_b.id = getRandomId());
|
|
452
|
+
__classPrivateFieldGet(this, _ComboboxController_mo, "f").observe(__classPrivateFieldGet(this, _ComboboxController_listbox, "f"), { childList: true });
|
|
453
|
+
}, _ComboboxController_initButton = function _ComboboxController_initButton() {
|
|
454
|
+
__classPrivateFieldGet(this, _ComboboxController_button, "f")?.removeEventListener('click', __classPrivateFieldGet(this, _ComboboxController_onClickButton, "f"));
|
|
455
|
+
__classPrivateFieldGet(this, _ComboboxController_button, "f")?.removeEventListener('keydown', __classPrivateFieldGet(this, _ComboboxController_onKeydownButton, "f"));
|
|
456
|
+
__classPrivateFieldSet(this, _ComboboxController_button, this.options.getToggleButton(), "f");
|
|
457
|
+
if (!__classPrivateFieldGet(this, _ComboboxController_button, "f")) {
|
|
458
|
+
throw new Error('ComboboxController getToggleButton() option must return an element');
|
|
459
|
+
}
|
|
460
|
+
__classPrivateFieldSet(this, _ComboboxController_buttonInitialRole, __classPrivateFieldGet(this, _ComboboxController_button, "f").role, "f");
|
|
461
|
+
__classPrivateFieldGet(this, _ComboboxController_button, "f").role = 'combobox';
|
|
462
|
+
__classPrivateFieldGet(this, _ComboboxController_button, "f").setAttribute('aria-controls', __classPrivateFieldGet(this, _ComboboxController_listbox, "f")?.id ?? '');
|
|
463
|
+
__classPrivateFieldGet(this, _ComboboxController_button, "f").addEventListener('click', __classPrivateFieldGet(this, _ComboboxController_onClickButton, "f"));
|
|
464
|
+
__classPrivateFieldGet(this, _ComboboxController_button, "f").addEventListener('keydown', __classPrivateFieldGet(this, _ComboboxController_onKeydownButton, "f"));
|
|
465
|
+
}, _ComboboxController_initInput = function _ComboboxController_initInput() {
|
|
466
|
+
__classPrivateFieldGet(this, _ComboboxController_input, "f")?.removeEventListener('click', __classPrivateFieldGet(this, _ComboboxController_onClickButton, "f"));
|
|
467
|
+
__classPrivateFieldGet(this, _ComboboxController_input, "f")?.removeEventListener('keyup', __classPrivateFieldGet(this, _ComboboxController_onKeyupInput, "f"));
|
|
468
|
+
__classPrivateFieldGet(this, _ComboboxController_input, "f")?.removeEventListener('keydown', __classPrivateFieldGet(this, _ComboboxController_onKeydownInput, "f"));
|
|
469
|
+
__classPrivateFieldSet(this, _ComboboxController_input, this.options.getComboboxInput(), "f");
|
|
470
|
+
if (__classPrivateFieldGet(this, _ComboboxController_input, "f") && !('value' in __classPrivateFieldGet(this, _ComboboxController_input, "f"))) {
|
|
471
|
+
throw new Error(`ComboboxController getToggleInput() option must return an element with a value property`);
|
|
472
|
+
}
|
|
473
|
+
else if (__classPrivateFieldGet(this, _ComboboxController_input, "f")) {
|
|
474
|
+
__classPrivateFieldGet(this, _ComboboxController_input, "f").role = 'combobox';
|
|
475
|
+
__classPrivateFieldGet(this, _ComboboxController_button, "f").role = __classPrivateFieldGet(this, _ComboboxController_buttonInitialRole, "f");
|
|
476
|
+
__classPrivateFieldGet(this, _ComboboxController_input, "f").setAttribute('aria-autocomplete', 'both');
|
|
477
|
+
__classPrivateFieldGet(this, _ComboboxController_input, "f").setAttribute('aria-controls', __classPrivateFieldGet(this, _ComboboxController_listbox, "f")?.id ?? '');
|
|
478
|
+
__classPrivateFieldGet(this, _ComboboxController_input, "f").addEventListener('click', __classPrivateFieldGet(this, _ComboboxController_onClickButton, "f"));
|
|
479
|
+
__classPrivateFieldGet(this, _ComboboxController_input, "f").addEventListener('keyup', __classPrivateFieldGet(this, _ComboboxController_onKeyupInput, "f"));
|
|
480
|
+
__classPrivateFieldGet(this, _ComboboxController_input, "f").addEventListener('keydown', __classPrivateFieldGet(this, _ComboboxController_onKeydownInput, "f"));
|
|
481
|
+
}
|
|
482
|
+
}, _ComboboxController_initLabels = function _ComboboxController_initLabels() {
|
|
483
|
+
const labels = InternalsController.getLabels(this.host)
|
|
484
|
+
?? __classPrivateFieldGet(this, _ComboboxController_instances, "a", _ComboboxController_element_get)?.ariaLabelledByElements
|
|
485
|
+
?? [];
|
|
486
|
+
const label = this.options.getFallbackLabel()
|
|
487
|
+
|| __classPrivateFieldGet(this, _ComboboxController_instances, "a", _ComboboxController_element_get)?.ariaLabelledByElements?.map(x => x.textContent).join('')
|
|
488
|
+
|| null;
|
|
489
|
+
for (const element of [__classPrivateFieldGet(this, _ComboboxController_button, "f"), __classPrivateFieldGet(this, _ComboboxController_listbox, "f"), __classPrivateFieldGet(this, _ComboboxController_input, "f")].filter(x => !!x)) {
|
|
490
|
+
if ('ariaLabelledByElements' in HTMLElement.prototype && labels.filter(x => !!x).length) {
|
|
491
|
+
element.ariaLabelledByElements = [...labels ?? []];
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
element.ariaLabel = label;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}, _ComboboxController_initController = function _ComboboxController_initController() {
|
|
498
|
+
__classPrivateFieldGet(this, _ComboboxController_fc, "f")?.hostDisconnected();
|
|
499
|
+
const { getOrientation } = this.options;
|
|
500
|
+
const getItems = () => this.items;
|
|
501
|
+
const getItemsContainer = () => __classPrivateFieldGet(this, _ComboboxController_listbox, "f");
|
|
502
|
+
if (__classPrivateFieldGet(this, _ComboboxController_instances, "a", _ComboboxController_hasTextInput_get)) {
|
|
503
|
+
__classPrivateFieldSet(this, _ComboboxController_fc, ActivedescendantController.of(this.host, {
|
|
504
|
+
getItems, getItemsContainer, getOrientation,
|
|
505
|
+
getActiveDescendantContainer: () => __classPrivateFieldGet(this, _ComboboxController_input, "f"),
|
|
506
|
+
getControlsElements: () => [
|
|
507
|
+
this.options.getToggleButton(),
|
|
508
|
+
this.options.getComboboxInput(),
|
|
509
|
+
].filter(x => !!x),
|
|
510
|
+
setItemActive: this.options.setItemActive,
|
|
511
|
+
}), "f");
|
|
512
|
+
}
|
|
513
|
+
else {
|
|
514
|
+
__classPrivateFieldSet(this, _ComboboxController_fc, RovingTabindexController.of(this.host, {
|
|
515
|
+
getItems, getItemsContainer, getOrientation,
|
|
516
|
+
getControlsElements: () => [
|
|
517
|
+
this.options.getToggleButton(),
|
|
518
|
+
].filter(x => !!x),
|
|
519
|
+
}), "f");
|
|
520
|
+
}
|
|
521
|
+
}, _ComboboxController_initItems = function _ComboboxController_initItems() {
|
|
522
|
+
if (__classPrivateFieldGet(this, _ComboboxController_listbox, "f")) {
|
|
523
|
+
this.items = this.options.getItems();
|
|
524
|
+
}
|
|
525
|
+
}, _ComboboxController_show = async function _ComboboxController_show() {
|
|
526
|
+
const success = await this.options.requestShowListbox();
|
|
527
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_filterItems).call(this);
|
|
528
|
+
if (success !== false && !__classPrivateFieldGet(this, _ComboboxController_instances, "a", _ComboboxController_hasTextInput_get)) {
|
|
529
|
+
if (!__classPrivateFieldGet(this, _ComboboxController_preventListboxGainingFocus, "f")) {
|
|
530
|
+
(__classPrivateFieldGet(this, _ComboboxController_instances, "a", _ComboboxController_focusedItem_get) ?? __classPrivateFieldGet(this, _ComboboxController_fc, "f")?.items.at(0))?.focus();
|
|
531
|
+
__classPrivateFieldSet(this, _ComboboxController_preventListboxGainingFocus, false, "f");
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}, _ComboboxController_hide = async function _ComboboxController_hide() {
|
|
535
|
+
await this.options.requestHideListbox();
|
|
536
|
+
}, _ComboboxController_toggle = async function _ComboboxController_toggle() {
|
|
537
|
+
if (this.options.isExpanded()) {
|
|
538
|
+
return __classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_hide).call(this);
|
|
539
|
+
}
|
|
540
|
+
else {
|
|
541
|
+
return __classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_show).call(this);
|
|
542
|
+
}
|
|
543
|
+
}, _ComboboxController_translate = function _ComboboxController_translate(key, lang) {
|
|
544
|
+
const strings = __classPrivateFieldGet(this, _ComboboxController_microcopy, "f").get(key);
|
|
545
|
+
return strings?.[lang] ?? key;
|
|
546
|
+
}, _ComboboxController_announce = function _ComboboxController_announce(item) {
|
|
547
|
+
const value = this.options.getItemValue(item);
|
|
548
|
+
__classPrivateFieldGet(_a, _a, "f", _ComboboxController_alert)?.remove();
|
|
549
|
+
const fragment = __classPrivateFieldGet(_a, _a, "f", _ComboboxController_alertTemplate).content.cloneNode(true);
|
|
550
|
+
__classPrivateFieldSet(_a, _a, fragment.firstElementChild, "f", _ComboboxController_alert);
|
|
551
|
+
let text = value;
|
|
552
|
+
const lang = deepClosest(__classPrivateFieldGet(this, _ComboboxController_listbox, "f"), '[lang]')?.getAttribute('lang') ?? 'en';
|
|
553
|
+
const langKey = lang?.match(_a.langsRE)?.at(0) ?? 'en';
|
|
554
|
+
if (this.options.isItemDisabled(item)) {
|
|
555
|
+
text += ` (${__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_translate).call(this, 'dimmed', langKey)})`;
|
|
556
|
+
}
|
|
557
|
+
if (__classPrivateFieldGet(this, _ComboboxController_lb, "f").isSelected(item)) {
|
|
558
|
+
text += `, (${__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_translate).call(this, 'selected', langKey)})`;
|
|
559
|
+
}
|
|
560
|
+
if (item.hasAttribute('aria-setsize') && item.hasAttribute('aria-posinset')) {
|
|
561
|
+
if (langKey === 'ja') {
|
|
562
|
+
text += `, (${item.getAttribute('aria-setsize')} 件中 ${item.getAttribute('aria-posinset')} 件目)`;
|
|
563
|
+
}
|
|
564
|
+
else {
|
|
565
|
+
text += `, (${item.getAttribute('aria-posinset')} ${__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_translate).call(this, 'of', langKey)} ${item.getAttribute('aria-setsize')})`;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
__classPrivateFieldGet(_a, _a, "f", _ComboboxController_alert).lang = lang;
|
|
569
|
+
__classPrivateFieldGet(_a, _a, "f", _ComboboxController_alert).innerText = text;
|
|
570
|
+
document.body.append(__classPrivateFieldGet(_a, _a, "f", _ComboboxController_alert));
|
|
571
|
+
}, _ComboboxController_filterItems = function _ComboboxController_filterItems() {
|
|
572
|
+
if (__classPrivateFieldGet(this, _ComboboxController_input, "f")) {
|
|
573
|
+
let value;
|
|
574
|
+
for (const item of this.items) {
|
|
575
|
+
const hidden = !!this.options.isExpanded()
|
|
576
|
+
&& !!(value = this.options.getComboboxValue(__classPrivateFieldGet(this, _ComboboxController_input, "f")))
|
|
577
|
+
&& this.options.isItemFiltered?.(item, value)
|
|
578
|
+
|| false;
|
|
579
|
+
this.options.setItemHidden(item, hidden);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
_ComboboxController_alert = { value: void 0 };
|
|
584
|
+
_ComboboxController_alertTemplate = { value: document.createElement('template') };
|
|
585
|
+
ComboboxController.langs = [
|
|
586
|
+
'en',
|
|
587
|
+
'es',
|
|
588
|
+
'de',
|
|
589
|
+
'fr',
|
|
590
|
+
'it',
|
|
591
|
+
'ja',
|
|
592
|
+
'zh',
|
|
593
|
+
];
|
|
594
|
+
ComboboxController.langsRE = new RegExp(_a.langs.join('|'));
|
|
595
|
+
(() => {
|
|
596
|
+
// apply visually-hidden styles
|
|
597
|
+
__classPrivateFieldGet(_a, _a, "f", _ComboboxController_alertTemplate).innerHTML = `
|
|
598
|
+
<div role="alert" style="
|
|
599
|
+
border: 0;
|
|
600
|
+
clip: rect(0, 0, 0, 0);
|
|
601
|
+
block-size: 1px;
|
|
602
|
+
margin: -1px;
|
|
603
|
+
overflow: hidden;
|
|
604
|
+
padding: 0;
|
|
605
|
+
position: absolute;
|
|
606
|
+
white-space: nowrap;
|
|
607
|
+
inline-size: 1px;
|
|
608
|
+
"></div>
|
|
609
|
+
`;
|
|
610
|
+
})();
|
|
611
|
+
//# sourceMappingURL=combobox-controller.js.map
|