@patternfly/pfe-core 5.0.3 → 5.0.5
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/combobox-controller.d.ts +4 -0
- package/controllers/combobox-controller.js +35 -7
- package/controllers/combobox-controller.js.map +1 -1
- package/controllers/floating-dom-controller.d.ts +31 -4
- package/controllers/floating-dom-controller.js +1385 -10
- package/controllers/floating-dom-controller.js.map +1 -1
- package/controllers/test/combobox-controller.spec.js +8 -8
- package/controllers/test/combobox-controller.spec.js.map +1 -1
- package/custom-elements.json +423 -42
- package/package.json +3 -4
|
@@ -89,6 +89,8 @@ export declare class ComboboxController<Item extends HTMLElement> implements Rea
|
|
|
89
89
|
static get supportsCrossRootActiveDescendant(): boolean;
|
|
90
90
|
private static langs;
|
|
91
91
|
private static langsRE;
|
|
92
|
+
private static instances;
|
|
93
|
+
private static hosts;
|
|
92
94
|
private options;
|
|
93
95
|
/** All items */
|
|
94
96
|
get items(): Item[];
|
|
@@ -106,6 +108,8 @@ export declare class ComboboxController<Item extends HTMLElement> implements Rea
|
|
|
106
108
|
hostConnected(): Promise<void>;
|
|
107
109
|
hostUpdated(): void;
|
|
108
110
|
hostDisconnected(): void;
|
|
111
|
+
disconnect(): void;
|
|
112
|
+
_onFocusoutElement(): Promise<void>;
|
|
109
113
|
/**
|
|
110
114
|
* For Browsers which do not support `ariaActiveDescendantElement`, we must clone
|
|
111
115
|
* the listbox items into the same root as the combobox input
|
|
@@ -1,6 +1,6 @@
|
|
|
1
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
2
|
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
|
-
import { nothing } from 'lit';
|
|
3
|
+
import { isServer, nothing } from 'lit';
|
|
4
4
|
import { ListboxController, isItem, isItemDisabled } from './listbox-controller.js';
|
|
5
5
|
import { RovingTabindexController } from './roving-tabindex-controller.js';
|
|
6
6
|
import { ActivedescendantController } from './activedescendant-controller.js';
|
|
@@ -374,6 +374,8 @@ export class ComboboxController {
|
|
|
374
374
|
isItemDisabled: this.options.isItemDisabled,
|
|
375
375
|
setItemSelected: this.options.setItemSelected,
|
|
376
376
|
}), "f");
|
|
377
|
+
_a.instances.set(host, this);
|
|
378
|
+
_a.hosts.add(host);
|
|
377
379
|
}
|
|
378
380
|
async hostConnected() {
|
|
379
381
|
await this.host.updateComplete;
|
|
@@ -386,17 +388,27 @@ export class ComboboxController {
|
|
|
386
388
|
const expanded = this.options.isExpanded();
|
|
387
389
|
__classPrivateFieldGet(this, _ComboboxController_button, "f")?.setAttribute('aria-expanded', String(expanded));
|
|
388
390
|
__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
391
|
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_initLabels).call(this);
|
|
396
392
|
}
|
|
397
393
|
hostDisconnected() {
|
|
398
394
|
__classPrivateFieldGet(this, _ComboboxController_fc, "f")?.hostDisconnected();
|
|
399
395
|
}
|
|
396
|
+
disconnect() {
|
|
397
|
+
_a.instances.delete(this.host);
|
|
398
|
+
_a.hosts.delete(this.host);
|
|
399
|
+
}
|
|
400
|
+
async _onFocusoutElement() {
|
|
401
|
+
if (__classPrivateFieldGet(this, _ComboboxController_instances, "a", _ComboboxController_hasTextInput_get) && this.options.isExpanded()) {
|
|
402
|
+
const root = __classPrivateFieldGet(this, _ComboboxController_instances, "a", _ComboboxController_element_get)?.getRootNode();
|
|
403
|
+
await new Promise(requestAnimationFrame);
|
|
404
|
+
if (root instanceof ShadowRoot || root instanceof Document) {
|
|
405
|
+
const { activeElement } = root;
|
|
406
|
+
if (!__classPrivateFieldGet(this, _ComboboxController_instances, "a", _ComboboxController_element_get)?.contains(activeElement)) {
|
|
407
|
+
__classPrivateFieldGet(this, _ComboboxController_instances, "m", _ComboboxController_hide).call(this);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
400
412
|
/**
|
|
401
413
|
* For Browsers which do not support `ariaActiveDescendantElement`, we must clone
|
|
402
414
|
* the listbox items into the same root as the combobox input
|
|
@@ -592,6 +604,8 @@ ComboboxController.langs = [
|
|
|
592
604
|
'zh',
|
|
593
605
|
];
|
|
594
606
|
ComboboxController.langsRE = new RegExp(_a.langs.join('|'));
|
|
607
|
+
ComboboxController.instances = new WeakMap();
|
|
608
|
+
ComboboxController.hosts = new Set();
|
|
595
609
|
(() => {
|
|
596
610
|
// apply visually-hidden styles
|
|
597
611
|
__classPrivateFieldGet(_a, _a, "f", _ComboboxController_alertTemplate).innerHTML = `
|
|
@@ -608,4 +622,18 @@ ComboboxController.langsRE = new RegExp(_a.langs.join('|'));
|
|
|
608
622
|
"></div>
|
|
609
623
|
`;
|
|
610
624
|
})();
|
|
625
|
+
// Hide listbox on focusout
|
|
626
|
+
(() => {
|
|
627
|
+
if (!isServer) {
|
|
628
|
+
document.addEventListener('focusout', event => {
|
|
629
|
+
const target = event.target;
|
|
630
|
+
for (const host of _a.hosts) {
|
|
631
|
+
if (host instanceof Node && host.contains(target)) {
|
|
632
|
+
const instance = _a.instances.get(host);
|
|
633
|
+
instance?._onFocusoutElement();
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
})();
|
|
611
639
|
//# sourceMappingURL=combobox-controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox-controller.js","sourceRoot":"","sources":["combobox-controller.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,OAAO,EAAwD,MAAM,KAAK,CAAC;AAMpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAUrD,SAAS,WAAW,CAAC,OAAuB,EAAE,QAAgB;IAC5D,IAAI,OAAO,GAAG,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzC,IAAI,IAAI,GAAG,OAAO,EAAE,WAAW,EAAE,CAAC;IAClC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,OAAO,KAAK,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,OAAO,EAAE,CAAC;QAC1C,KAAK,EAAE,CAAC;QACR,IAAI,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;QAC7B,IAAI,IAAI,YAAY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,UAAU,EAAE;mBACtB,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,uBAAA,IAAI,iCAAO,CAAC,CAAC;mBACtD,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC;mBAC1C,KAAK,CAAC;YACb,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;AACH,CAAC;AA5WM,6CAAM,CAAe;AAErB,6CAAiB,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,EAArC,CAAsC;AAE5C,wBAAK,GAAG;IACrB,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;CACI,AARU,CAQT;AAEI,0BAAO,GAAG,IAAI,MAAM,CAAC,EAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,AAAjD,CAAkD;AAExE;IACE,+BAA+B;IAC/B,sEAAmB,CAAC,SAAS,GAAG;;;;;;;;;;;;OAY7B,CAAC;AACN,CAAC,GAAA,CAAA","sourcesContent":["import { nothing, type ReactiveController, type ReactiveControllerHost } from 'lit';\nimport type { ActivedescendantControllerOptions } from './activedescendant-controller.js';\nimport type { RovingTabindexControllerOptions } from './roving-tabindex-controller.js';\nimport type { ATFocusController } from './at-focus-controller';\nimport type { ListboxControllerOptions } from './listbox-controller.js';\n\nimport { ListboxController, isItem, isItemDisabled } from './listbox-controller.js';\nimport { RovingTabindexController } from './roving-tabindex-controller.js';\nimport { ActivedescendantController } from './activedescendant-controller.js';\nimport { InternalsController } from './internals-controller.js';\nimport { getRandomId } from '../functions/random.js';\nimport type { RequireProps } from '../core.js';\n\ntype AllOptions<Item extends HTMLElement> =\n ActivedescendantControllerOptions<Item>\n & ListboxControllerOptions<Item>\n & RovingTabindexControllerOptions<Item>;\n\ntype Lang = typeof ComboboxController['langs'][number];\n\nfunction deepClosest(element: Element | null, selector: string) {\n let closest = element?.closest(selector);\n let root = element?.getRootNode();\n let count = 0;\n while (count < 500 && !closest && element) {\n count++;\n root = element.getRootNode();\n if (root instanceof ShadowRoot) {\n element = root.host;\n } else if (root instanceof Document) {\n element = document.documentElement;\n } else {\n return null;\n }\n closest = element.closest(selector);\n }\n return closest;\n}\n\nfunction getItemValue<Item extends HTMLElement>(item: Item): string {\n if ('value' in item && typeof item.value === 'string') {\n return item.value;\n } else {\n return '';\n }\n}\n\nfunction isItemFiltered<Item extends HTMLElement>(item: Item, value: string): boolean {\n return !getItemValue(item)\n .toLowerCase()\n .startsWith(value.toLowerCase());\n}\n\nfunction setItemHidden(item: HTMLElement, hidden: boolean) {\n item.hidden = hidden;\n}\n\nfunction setComboboxValue(item: HTMLElement, value: string): void {\n if (!('value' in item)) {\n // eslint-disable-next-line no-console\n return console.warn(`Cannot set value on combobox element ${item.localName}`);\n } else {\n item.value = value;\n }\n}\n\nfunction getComboboxValue(combobox: HTMLElement): string {\n if ('value' in combobox && typeof combobox.value === 'string') {\n return combobox.value;\n } else {\n // eslint-disable-next-line no-console\n return console.warn(`Cannot get value from combobox element ${combobox.localName}`), '';\n }\n}\n\nexport interface ComboboxControllerOptions<Item extends HTMLElement> extends\n Omit<AllOptions<Item>,\n | 'getATFocusedItem'\n | 'getControlsElements'\n | 'getActiveDescendantContainer'\n | 'getItemsContainer'> {\n /**\n * Predicate which establishes whether the listbox is expanded\n * e.g. `isExpanded: () => this.expanded`, if the host's `expanded` property\n * should correspond to the listbox expanded state.\n */\n isExpanded(): boolean;\n /**\n * Callback which the host must implement to change the expanded state to true.\n * Return or resolve false to prevent the change.\n */\n requestShowListbox(): void | boolean | Promise<boolean> | Promise<void>;\n /**\n * Callback which the host must implement to change the expanded to false.\n * Return or resolve false to prevent the default.\n */\n requestHideListbox(): void | boolean | Promise<boolean> | Promise<void>;\n /**\n * Returns the listbox container element\n */\n getListboxElement(): HTMLElement | null;\n /**\n * Returns the toggle button, if it exists\n */\n getToggleButton(): HTMLElement | null;\n /**\n * Returns the combobox input, if it exists\n */\n getComboboxInput(): HTMLElement | null;\n /**\n * Returns the label for the toggle button, combobox input, and listbox.\n * when `ariaLabelledByElements` is supported, the label elements associated with\n * the host element are used instead, and this value is ignored.\n */\n getFallbackLabel(): string;\n /**\n * Called on an item to retrieve it's value string. By default, returns the `value` property\n * of the item, as if it implemented the `<option>` element's interface.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement\n */\n getItemValue?(item: Item): string;\n /**\n * Optional callback, called on the combobox input element to set its value.\n * by default, returns the element's `value` DOM property.\n */\n getComboboxValue?(combobox: HTMLElement): string;\n /**\n * Optional callback, called on the combobox input element to set its value.\n * by default, sets the element's `value` DOM property.\n */\n setComboboxValue?(item: HTMLElement, value: string): void;\n /**\n * Called on each item, with the combobox input, to determine if the item should be shown in the\n * listbox or filtered out. Return false to hide the item. By default, checks whether the item's\n * value starts with the input value (when both are lowercased).\n */\n isItemFiltered?(item: Item, value: string): boolean;\n /**\n * Called on each item when the filter changes.\n * By default, toggles the `hidden` attribute on the item\n */\n setItemHidden?(item: Item, hidden: boolean): void;\n}\n\n/**\n * @summary Implements the WAI-ARIA pattern [Editable Combobox with Both List and Inline Autocomplete].\n *\n * Combobox with keyboard and pointer navigation, using the aria-activedescendant pattern.\n *\n * WARNING: Safari VoiceOver does not support aria-activedescendant, so Safari users\n * rely on the combobox input value being announced when navigating the listbox with the keyboard.\n * We have erred on the side that it may be less-broken to avoid announcing disabled items in that\n * case, rather than announcing the disabled items value without indicating that it is disabled.\n * @see (https://bugs.webkit.org/show_bug.cgi?id=269026)\n *\n * [pattern]: https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-both/\n */\nexport class ComboboxController<\n Item extends HTMLElement\n> implements ReactiveController {\n public static of<T extends HTMLElement>(\n host: ReactiveControllerHost,\n options: ComboboxControllerOptions<T>,\n ): ComboboxController<T> {\n return new ComboboxController(host, options);\n }\n\n /**\n * Whether the `ariaActiveDescendantElement` IDL attribute is supported for cross-root ARIA.\n */\n public static get supportsCrossRootActiveDescendant(): boolean {\n return ActivedescendantController.supportsCrossRootActiveDescendant;\n }\n\n static #alert?: HTMLElement;\n\n static #alertTemplate = document.createElement('template');\n\n private static langs = [\n 'en',\n 'es',\n 'de',\n 'fr',\n 'it',\n 'ja',\n 'zh',\n ] as const;\n\n private static langsRE = new RegExp(ComboboxController.langs.join('|'));\n\n static {\n // apply visually-hidden styles\n this.#alertTemplate.innerHTML = `\n <div role=\"alert\" style=\"\n border: 0;\n clip: rect(0, 0, 0, 0);\n block-size: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n white-space: nowrap;\n inline-size: 1px;\n \"></div>\n `;\n }\n\n private options: RequireProps<ComboboxControllerOptions<Item>,\n | 'isItemDisabled'\n | 'isItem'\n | 'isItemFiltered'\n | 'getItemValue'\n | 'getOrientation'\n | 'getComboboxValue'\n | 'setComboboxValue'\n | 'setItemHidden'\n >;\n\n #lb: ListboxController<Item>;\n #fc?: ATFocusController<Item>;\n #preventListboxGainingFocus = false;\n #input: HTMLElement | null = null;\n #button: HTMLElement | null = null;\n #listbox: HTMLElement | null = null;\n #buttonInitialRole: string | null = null;\n #mo = new MutationObserver(() => this.#initItems());\n #microcopy = new Map<string, Record<Lang, string>>(Object.entries({\n dimmed: {\n en: 'dimmed',\n es: 'atenuada',\n de: 'gedimmt',\n it: 'oscurato',\n fr: 'atténué',\n ja: '暗くなった',\n zh: '变暗',\n },\n selected: {\n en: 'selected',\n es: 'seleccionado',\n de: 'ausgewählt',\n fr: 'choisie',\n it: 'selezionato',\n ja: '選ばれた',\n zh: '选',\n },\n of: {\n en: 'of',\n es: 'de',\n de: 'von',\n fr: 'sur',\n it: 'di',\n ja: '件目',\n zh: '的',\n },\n }));\n\n /** All items */\n get items(): Item[] {\n return this.#lb.items;\n }\n\n set items(value: Item[]) {\n this.#lb.items = value;\n }\n\n /** Whether the combobox is disabled */\n get disabled() {\n return this.#lb.disabled;\n }\n\n set disabled(value: boolean) {\n this.#lb.disabled = value;\n }\n\n /** Whether multiselect is enabled */\n get multi() {\n return this.#lb.multi;\n }\n\n set multi(value: boolean) {\n this.#lb.multi = value;\n }\n\n /** The current selection: a list of items */\n get selected() {\n return this.#lb.selected;\n }\n\n set selected(value: Item[]) {\n this.#lb.selected = value;\n }\n\n get #hasTextInput() {\n return this.options.getComboboxInput();\n }\n\n get #focusedItem() {\n return this.#fc?.items.at(Math.max(this.#fc?.atFocusedItemIndex ?? -1, 0)) ?? null;\n }\n\n get #element() {\n if (this.host instanceof HTMLElement) {\n return this.host;\n } else if (this.options.getListboxElement() instanceof HTMLElement) {\n return this.options.getListboxElement();\n }\n }\n\n private constructor(\n public host: ReactiveControllerHost,\n options: ComboboxControllerOptions<Item>,\n ) {\n host.addController(this);\n this.options = {\n isItem,\n getItemValue,\n isItemFiltered,\n isItemDisabled,\n getComboboxValue,\n setComboboxValue,\n setItemHidden,\n getOrientation: () => 'vertical',\n ...options,\n };\n this.#lb = ListboxController.of(host, {\n isItem: this.options.isItem,\n getItemsContainer: this.options.getListboxElement,\n getControlsElements: () => [\n this.options.getToggleButton(),\n this.options.getComboboxInput(),\n ].filter(x => !!x),\n getATFocusedItem: () => this.items[this.#fc?.atFocusedItemIndex ?? -1] ?? null,\n isItemDisabled: this.options.isItemDisabled,\n setItemSelected: this.options.setItemSelected,\n });\n }\n\n async hostConnected(): Promise<void> {\n await this.host.updateComplete;\n this.hostUpdated();\n }\n\n hostUpdated(): void {\n if (!this.#fc) {\n this.#init();\n }\n const expanded = this.options.isExpanded();\n this.#button?.setAttribute('aria-expanded', String(expanded));\n this.#input?.setAttribute('aria-expanded', String(expanded));\n if (this.#hasTextInput) {\n this.#button?.setAttribute('tabindex', '-1');\n } else {\n this.#button?.removeAttribute('tabindex');\n }\n this.#initLabels();\n }\n\n hostDisconnected(): void {\n this.#fc?.hostDisconnected();\n }\n\n /**\n * Order of operations is important\n */\n async #init() {\n await this.host.updateComplete;\n this.#initListbox();\n this.#initItems();\n this.#initButton();\n this.#initInput();\n this.#initLabels();\n this.#initController();\n }\n\n #initListbox() {\n this.#mo.disconnect();\n this.#listbox?.removeEventListener('focusout', this.#onFocusoutListbox);\n this.#listbox?.removeEventListener('keydown', this.#onKeydownListbox);\n this.#listbox?.removeEventListener('click', this.#onClickListbox);\n this.#listbox = this.options.getListboxElement();\n if (!this.#listbox) {\n throw new Error('ComboboxController getListboxElement() option must return an element');\n }\n this.#listbox.addEventListener('focusout', this.#onFocusoutListbox);\n this.#listbox.addEventListener('keydown', this.#onKeydownListbox);\n this.#listbox.addEventListener('click', this.#onClickListbox);\n this.#listbox.id ??= getRandomId();\n this.#mo.observe(this.#listbox, { childList: true });\n }\n\n #initButton() {\n this.#button?.removeEventListener('click', this.#onClickButton);\n this.#button?.removeEventListener('keydown', this.#onKeydownButton);\n this.#button = this.options.getToggleButton();\n if (!this.#button) {\n throw new Error('ComboboxController getToggleButton() option must return an element');\n }\n this.#buttonInitialRole = this.#button.role;\n this.#button.role = 'combobox';\n this.#button.setAttribute('aria-controls', this.#listbox?.id ?? '');\n this.#button.addEventListener('click', this.#onClickButton);\n this.#button.addEventListener('keydown', this.#onKeydownButton);\n }\n\n #initInput() {\n this.#input?.removeEventListener('click', this.#onClickButton);\n this.#input?.removeEventListener('keyup', this.#onKeyupInput);\n this.#input?.removeEventListener('keydown', this.#onKeydownInput);\n\n this.#input = this.options.getComboboxInput();\n if (this.#input && !('value' in this.#input)) {\n throw new Error(`ComboboxController getToggleInput() option must return an element with a value property`);\n } else if (this.#input) {\n this.#input.role = 'combobox';\n this.#button!.role = this.#buttonInitialRole;\n this.#input.setAttribute('aria-autocomplete', 'both');\n this.#input.setAttribute('aria-controls', this.#listbox?.id ?? '');\n this.#input.addEventListener('click', this.#onClickButton);\n this.#input.addEventListener('keyup', this.#onKeyupInput);\n this.#input.addEventListener('keydown', this.#onKeydownInput);\n }\n }\n\n #initLabels() {\n const labels = InternalsController.getLabels(this.host)\n ?? this.#element?.ariaLabelledByElements\n ?? [];\n const label = this.options.getFallbackLabel()\n || this.#element?.ariaLabelledByElements?.map(x => x.textContent).join('')\n || null;\n\n for (const element of [this.#button, this.#listbox, this.#input].filter(x => !!x)) {\n if ('ariaLabelledByElements' in HTMLElement.prototype && labels.filter(x => !!x).length) {\n element.ariaLabelledByElements = [...labels ?? []];\n } else {\n element.ariaLabel = label;\n }\n }\n }\n\n #initController() {\n this.#fc?.hostDisconnected();\n const { getOrientation } = this.options;\n const getItems = () => this.items;\n const getItemsContainer = () => this.#listbox;\n if (this.#hasTextInput) {\n this.#fc = ActivedescendantController.of(this.host, {\n getItems, getItemsContainer, getOrientation,\n getActiveDescendantContainer: () => this.#input,\n getControlsElements: () => [\n this.options.getToggleButton(),\n this.options.getComboboxInput(),\n ].filter(x => !!x),\n setItemActive: this.options.setItemActive,\n });\n } else {\n this.#fc = RovingTabindexController.of(this.host, {\n getItems, getItemsContainer, getOrientation,\n getControlsElements: () => [\n this.options.getToggleButton(),\n ].filter(x => !!x),\n });\n }\n }\n\n #initItems() {\n if (this.#listbox) {\n this.items = this.options.getItems();\n }\n }\n\n async #show(): Promise<void> {\n const success = await this.options.requestShowListbox();\n this.#filterItems();\n if (success !== false && !this.#hasTextInput) {\n if (!this.#preventListboxGainingFocus) {\n (this.#focusedItem ?? this.#fc?.items.at(0))?.focus();\n this.#preventListboxGainingFocus = false;\n }\n }\n }\n\n async #hide(): Promise<void> {\n await this.options.requestHideListbox();\n }\n\n async #toggle() {\n if (this.options.isExpanded()) {\n return this.#hide();\n } else {\n return this.#show();\n }\n }\n\n #translate(key: string, lang: Lang) {\n const strings = this.#microcopy.get(key);\n return strings?.[lang] ?? key;\n }\n\n // TODO(bennypowers): perhaps move this to ActivedescendantController\n #announce(item: Item) {\n const value = this.options.getItemValue(item);\n ComboboxController.#alert?.remove();\n const fragment = ComboboxController.#alertTemplate.content.cloneNode(true) as DocumentFragment;\n ComboboxController.#alert = fragment.firstElementChild as HTMLElement;\n let text = value;\n const lang = deepClosest(this.#listbox, '[lang]')?.getAttribute('lang') ?? 'en';\n const langKey = lang?.match(ComboboxController.langsRE)?.at(0) as Lang ?? 'en';\n if (this.options.isItemDisabled(item)) {\n text += ` (${this.#translate('dimmed', langKey)})`;\n }\n if (this.#lb.isSelected(item)) {\n text += `, (${this.#translate('selected', langKey)})`;\n }\n if (item.hasAttribute('aria-setsize') && item.hasAttribute('aria-posinset')) {\n if (langKey === 'ja') {\n text += `, (${item.getAttribute('aria-setsize')} 件中 ${item.getAttribute('aria-posinset')} 件目)`;\n } else {\n text += `, (${item.getAttribute('aria-posinset')} ${this.#translate('of', langKey)} ${item.getAttribute('aria-setsize')})`;\n }\n }\n ComboboxController.#alert.lang = lang;\n ComboboxController.#alert.innerText = text;\n document.body.append(ComboboxController.#alert);\n }\n\n #filterItems() {\n if (this.#input) {\n let value: string;\n for (const item of this.items) {\n const hidden =\n !!this.options.isExpanded()\n && !!(value = this.options.getComboboxValue(this.#input))\n && this.options.isItemFiltered?.(item, value)\n || false;\n this.options.setItemHidden(item, hidden);\n }\n }\n }\n\n #onClickButton = () => {\n if (!this.options.isExpanded()) {\n this.#show();\n } else {\n this.#hide();\n }\n };\n\n #onClickListbox = (event: MouseEvent) => {\n if (!this.multi && event.composedPath().some(this.options.isItem)) {\n this.#hide();\n }\n };\n\n /**\n * Handle keypresses on the input\n * ## `Down Arrow`\n * - If the textbox is not empty and the listbox is displayed,\n * moves visual focus to the first suggested value.\n * - If the textbox is empty and the listbox is not displayed,\n * opens the listbox and moves visual focus to the first option.\n * - In both cases DOM focus remains on the textbox.\n *\n * ## `Alt + Down Arrow`\n * Opens the listbox without moving focus or changing selection.\n *\n * ## `Up Arrow`\n * - If the textbox is not empty and the listbox is displayed,\n * moves visual focus to the last suggested value.\n * - If the textbox is empty, first opens the listbox if it is not already displayed\n * and then moves visual focus to the last option.\n * - In both cases DOM focus remains on the textbox.\n *\n * ## `Enter`\n * Closes the listbox if it is displayed.\n *\n * ## `Escape`\n * - If the listbox is displayed, closes it.\n * - If the listbox is not displayed, clears the textbox.\n *\n * ## Standard single line text editing keys\n * - Keys used for cursor movement and text manipulation,\n * such as `Delete` and `Shift + Right Arrow`.\n * - An HTML `input` with `type=\"text\"` is used for the textbox so the browser will provide\n * platform-specific editing keys.\n *\n * @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-list\n * @param event keydown event\n */\n #onKeydownInput = (event: KeyboardEvent) => {\n if (event.ctrlKey || event.shiftKey || !this.#input) {\n return;\n }\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n if (!this.options.isExpanded()) {\n this.#preventListboxGainingFocus = event.altKey;\n this.#show();\n }\n break;\n case 'Enter':\n if (!this.multi) {\n this.#hide();\n }\n break;\n case 'Escape':\n if (!this.options.isExpanded()) {\n this.options.setComboboxValue(this.#input, '');\n this.host.requestUpdate();\n }\n this.#hide();\n break;\n case 'Alt':\n case 'AltGraph':\n case 'Shift':\n case 'Control':\n case 'Fn':\n case 'Symbol':\n case 'Hyper':\n case 'Super':\n case 'Meta':\n case 'CapsLock':\n case 'FnLock':\n case 'NumLock':\n case 'Tab':\n case 'ScrollLock':\n case 'SymbolLock':\n case ' ':\n break;\n default:\n if (!this.options.isExpanded()) {\n this.#show();\n }\n }\n };\n\n /**\n * Populates the combobox input with the focused value when navigating the listbox,\n * and filters the items when typing.\n * @param event keyup event\n */\n #onKeyupInput = (event: KeyboardEvent) => {\n if (!this.#input) {\n return;\n }\n switch (event.key) {\n case 'ArrowUp':\n case 'ArrowDown':\n /**\n * Safari VoiceOver does not support aria-activedescendant, so we must.\n * approximate the correct behaviour by constructing a visually-hidden alert role\n * @see (https://bugs.webkit.org/show_bug.cgi?id=269026)\n */\n if (this.#focusedItem\n && this.options.getComboboxInput()\n && InternalsController.isSafari) {\n this.#announce(this.#focusedItem);\n }\n break;\n default:\n this.#filterItems();\n }\n };\n\n #onKeydownButton = (event: KeyboardEvent) => {\n if (this.#hasTextInput) {\n return this.#onKeydownInput(event);\n } else {\n return this.#onKeydownToggleButton(event);\n }\n };\n\n #onKeydownListbox = (event: KeyboardEvent) => {\n if (!this.#hasTextInput) {\n switch (event.key) {\n case 'Home':\n case 'End':\n this.#onKeydownToggleButton(event);\n break;\n case 'Escape':\n this.#hide();\n this.#button?.focus();\n break;\n case 'Enter':\n case ' ': {\n const eventItem = event.composedPath().find(this.options.isItem);\n if (eventItem\n && !this.multi\n && this.options.isExpanded()\n && !this.options.isItemDisabled(eventItem)\n ) {\n this.#hide();\n this.#button?.focus();\n }\n }\n }\n }\n };\n\n #onFocusoutListbox = (event: FocusEvent) => {\n if (!this.#hasTextInput && this.options.isExpanded()) {\n const root = this.#element?.getRootNode();\n if ((root instanceof ShadowRoot || root instanceof Document)\n && !this.items.includes(event.relatedTarget as Item)\n ) {\n this.#hide();\n }\n }\n };\n\n #onKeydownToggleButton = async (event: KeyboardEvent) => {\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n if (!this.options.isExpanded()) {\n this.#show();\n }\n break;\n case 'Home':\n if (!this.options.isExpanded()) {\n await this.#show();\n }\n if (this.#fc) {\n this.#fc.atFocusedItemIndex = 0;\n }\n break;\n case 'End':\n if (!this.options.isExpanded()) {\n await this.#show();\n }\n if (this.#fc) {\n this.#fc.atFocusedItemIndex = this.items.length - 1;\n }\n break;\n case ' ':\n case 'Enter':\n // prevent scroll\n event.preventDefault();\n await this.#toggle();\n await this.host.updateComplete;\n if (!this.options.isExpanded()) {\n this.#button?.focus();\n }\n break;\n }\n };\n\n /**\n * For Browsers which do not support `ariaActiveDescendantElement`, we must clone\n * the listbox items into the same root as the combobox input\n * Call this method to return either an array of (cloned) list box items, to be placed in your\n * shadow template, or nothing in the case the browser supports cross-root aria.\n */\n public renderItemsToShadowRoot(): Node[] | typeof nothing {\n if (this.#fc instanceof ActivedescendantController) {\n return this.#fc.renderItemsToShadowRoot();\n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;YAC3C,KAAK,MAAM,IAAI,IAAI,EAAkB,CAAC,KAAK,EAAE,CAAC;gBAC5C,IAAI,IAAI,YAAY,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;oBAClD,MAAM,QAAQ,GAAG,EAAkB,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBACxD,QAAQ,EAAE,kBAAkB,EAAE,CAAC;gBACjC,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,GAAA,CAAA","sourcesContent":["import { isServer, nothing, type ReactiveController, type ReactiveControllerHost } from 'lit';\nimport type { ActivedescendantControllerOptions } from './activedescendant-controller.js';\nimport type { RovingTabindexControllerOptions } from './roving-tabindex-controller.js';\nimport type { ATFocusController } from './at-focus-controller';\nimport type { ListboxControllerOptions } from './listbox-controller.js';\n\nimport { ListboxController, isItem, isItemDisabled } from './listbox-controller.js';\nimport { RovingTabindexController } from './roving-tabindex-controller.js';\nimport { ActivedescendantController } from './activedescendant-controller.js';\nimport { InternalsController } from './internals-controller.js';\nimport { getRandomId } from '../functions/random.js';\nimport type { RequireProps } from '../core.js';\n\ntype AllOptions<Item extends HTMLElement> =\n ActivedescendantControllerOptions<Item>\n & ListboxControllerOptions<Item>\n & RovingTabindexControllerOptions<Item>;\n\ntype Lang = typeof ComboboxController['langs'][number];\n\nfunction deepClosest(element: Element | null, selector: string) {\n let closest = element?.closest(selector);\n let root = element?.getRootNode();\n let count = 0;\n while (count < 500 && !closest && element) {\n count++;\n root = element.getRootNode();\n if (root instanceof ShadowRoot) {\n element = root.host;\n } else if (root instanceof Document) {\n element = document.documentElement;\n } else {\n return null;\n }\n closest = element.closest(selector);\n }\n return closest;\n}\n\nfunction getItemValue<Item extends HTMLElement>(item: Item): string {\n if ('value' in item && typeof item.value === 'string') {\n return item.value;\n } else {\n return '';\n }\n}\n\nfunction isItemFiltered<Item extends HTMLElement>(item: Item, value: string): boolean {\n return !getItemValue(item)\n .toLowerCase()\n .startsWith(value.toLowerCase());\n}\n\nfunction setItemHidden(item: HTMLElement, hidden: boolean) {\n item.hidden = hidden;\n}\n\nfunction setComboboxValue(item: HTMLElement, value: string): void {\n if (!('value' in item)) {\n // eslint-disable-next-line no-console\n return console.warn(`Cannot set value on combobox element ${item.localName}`);\n } else {\n item.value = value;\n }\n}\n\nfunction getComboboxValue(combobox: HTMLElement): string {\n if ('value' in combobox && typeof combobox.value === 'string') {\n return combobox.value;\n } else {\n // eslint-disable-next-line no-console\n return console.warn(`Cannot get value from combobox element ${combobox.localName}`), '';\n }\n}\n\nexport interface ComboboxControllerOptions<Item extends HTMLElement> extends\n Omit<AllOptions<Item>,\n | 'getATFocusedItem'\n | 'getControlsElements'\n | 'getActiveDescendantContainer'\n | 'getItemsContainer'> {\n /**\n * Predicate which establishes whether the listbox is expanded\n * e.g. `isExpanded: () => this.expanded`, if the host's `expanded` property\n * should correspond to the listbox expanded state.\n */\n isExpanded(): boolean;\n /**\n * Callback which the host must implement to change the expanded state to true.\n * Return or resolve false to prevent the change.\n */\n requestShowListbox(): void | boolean | Promise<boolean> | Promise<void>;\n /**\n * Callback which the host must implement to change the expanded to false.\n * Return or resolve false to prevent the default.\n */\n requestHideListbox(): void | boolean | Promise<boolean> | Promise<void>;\n /**\n * Returns the listbox container element\n */\n getListboxElement(): HTMLElement | null;\n /**\n * Returns the toggle button, if it exists\n */\n getToggleButton(): HTMLElement | null;\n /**\n * Returns the combobox input, if it exists\n */\n getComboboxInput(): HTMLElement | null;\n /**\n * Returns the label for the toggle button, combobox input, and listbox.\n * when `ariaLabelledByElements` is supported, the label elements associated with\n * the host element are used instead, and this value is ignored.\n */\n getFallbackLabel(): string;\n /**\n * Called on an item to retrieve it's value string. By default, returns the `value` property\n * of the item, as if it implemented the `<option>` element's interface.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionElement\n */\n getItemValue?(item: Item): string;\n /**\n * Optional callback, called on the combobox input element to set its value.\n * by default, returns the element's `value` DOM property.\n */\n getComboboxValue?(combobox: HTMLElement): string;\n /**\n * Optional callback, called on the combobox input element to set its value.\n * by default, sets the element's `value` DOM property.\n */\n setComboboxValue?(item: HTMLElement, value: string): void;\n /**\n * Called on each item, with the combobox input, to determine if the item should be shown in the\n * listbox or filtered out. Return false to hide the item. By default, checks whether the item's\n * value starts with the input value (when both are lowercased).\n */\n isItemFiltered?(item: Item, value: string): boolean;\n /**\n * Called on each item when the filter changes.\n * By default, toggles the `hidden` attribute on the item\n */\n setItemHidden?(item: Item, hidden: boolean): void;\n}\n\n/**\n * @summary Implements the WAI-ARIA pattern [Editable Combobox with Both List and Inline Autocomplete].\n *\n * Combobox with keyboard and pointer navigation, using the aria-activedescendant pattern.\n *\n * WARNING: Safari VoiceOver does not support aria-activedescendant, so Safari users\n * rely on the combobox input value being announced when navigating the listbox with the keyboard.\n * We have erred on the side that it may be less-broken to avoid announcing disabled items in that\n * case, rather than announcing the disabled items value without indicating that it is disabled.\n * @see (https://bugs.webkit.org/show_bug.cgi?id=269026)\n *\n * [pattern]: https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-both/\n */\nexport class ComboboxController<\n Item extends HTMLElement\n> implements ReactiveController {\n public static of<T extends HTMLElement>(\n host: ReactiveControllerHost,\n options: ComboboxControllerOptions<T>,\n ): ComboboxController<T> {\n return new ComboboxController(host, options);\n }\n\n /**\n * Whether the `ariaActiveDescendantElement` IDL attribute is supported for cross-root ARIA.\n */\n public static get supportsCrossRootActiveDescendant(): boolean {\n return ActivedescendantController.supportsCrossRootActiveDescendant;\n }\n\n static #alert?: HTMLElement;\n\n static #alertTemplate = document.createElement('template');\n\n private static langs = [\n 'en',\n 'es',\n 'de',\n 'fr',\n 'it',\n 'ja',\n 'zh',\n ] as const;\n\n private static langsRE = new RegExp(ComboboxController.langs.join('|'));\n\n private static instances = new WeakMap<ReactiveControllerHost, ComboboxController<HTMLElement>>();\n\n private static hosts = new Set<ReactiveControllerHost>();\n\n static {\n // apply visually-hidden styles\n this.#alertTemplate.innerHTML = `\n <div role=\"alert\" style=\"\n border: 0;\n clip: rect(0, 0, 0, 0);\n block-size: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n white-space: nowrap;\n inline-size: 1px;\n \"></div>\n `;\n }\n\n // Hide listbox on focusout\n static {\n if (!isServer) {\n document.addEventListener('focusout', event => {\n const target = event.target as HTMLElement;\n for (const host of ComboboxController.hosts) {\n if (host instanceof Node && host.contains(target)) {\n const instance = ComboboxController.instances.get(host);\n instance?._onFocusoutElement();\n }\n }\n });\n }\n }\n\n private options: RequireProps<ComboboxControllerOptions<Item>,\n | 'isItemDisabled'\n | 'isItem'\n | 'isItemFiltered'\n | 'getItemValue'\n | 'getOrientation'\n | 'getComboboxValue'\n | 'setComboboxValue'\n | 'setItemHidden'\n >;\n\n #lb: ListboxController<Item>;\n #fc?: ATFocusController<Item>;\n #preventListboxGainingFocus = false;\n #input: HTMLElement | null = null;\n #button: HTMLElement | null = null;\n #listbox: HTMLElement | null = null;\n #buttonInitialRole: string | null = null;\n #mo = new MutationObserver(() => this.#initItems());\n #microcopy = new Map<string, Record<Lang, string>>(Object.entries({\n dimmed: {\n en: 'dimmed',\n es: 'atenuada',\n de: 'gedimmt',\n it: 'oscurato',\n fr: 'atténué',\n ja: '暗くなった',\n zh: '变暗',\n },\n selected: {\n en: 'selected',\n es: 'seleccionado',\n de: 'ausgewählt',\n fr: 'choisie',\n it: 'selezionato',\n ja: '選ばれた',\n zh: '选',\n },\n of: {\n en: 'of',\n es: 'de',\n de: 'von',\n fr: 'sur',\n it: 'di',\n ja: '件目',\n zh: '的',\n },\n }));\n\n /** All items */\n get items(): Item[] {\n return this.#lb.items;\n }\n\n set items(value: Item[]) {\n this.#lb.items = value;\n }\n\n /** Whether the combobox is disabled */\n get disabled() {\n return this.#lb.disabled;\n }\n\n set disabled(value: boolean) {\n this.#lb.disabled = value;\n }\n\n /** Whether multiselect is enabled */\n get multi() {\n return this.#lb.multi;\n }\n\n set multi(value: boolean) {\n this.#lb.multi = value;\n }\n\n /** The current selection: a list of items */\n get selected() {\n return this.#lb.selected;\n }\n\n set selected(value: Item[]) {\n this.#lb.selected = value;\n }\n\n get #hasTextInput() {\n return this.options.getComboboxInput();\n }\n\n get #focusedItem() {\n return this.#fc?.items.at(Math.max(this.#fc?.atFocusedItemIndex ?? -1, 0)) ?? null;\n }\n\n get #element() {\n if (this.host instanceof HTMLElement) {\n return this.host;\n } else if (this.options.getListboxElement() instanceof HTMLElement) {\n return this.options.getListboxElement();\n }\n }\n\n private constructor(\n public host: ReactiveControllerHost,\n options: ComboboxControllerOptions<Item>,\n ) {\n host.addController(this);\n this.options = {\n isItem,\n getItemValue,\n isItemFiltered,\n isItemDisabled,\n getComboboxValue,\n setComboboxValue,\n setItemHidden,\n getOrientation: () => 'vertical',\n ...options,\n };\n this.#lb = ListboxController.of(host, {\n isItem: this.options.isItem,\n getItemsContainer: this.options.getListboxElement,\n getControlsElements: () => [\n this.options.getToggleButton(),\n this.options.getComboboxInput(),\n ].filter(x => !!x),\n getATFocusedItem: () => this.items[this.#fc?.atFocusedItemIndex ?? -1] ?? null,\n isItemDisabled: this.options.isItemDisabled,\n setItemSelected: this.options.setItemSelected,\n });\n ComboboxController.instances.set(host, this);\n ComboboxController.hosts.add(host);\n }\n\n async hostConnected(): Promise<void> {\n await this.host.updateComplete;\n this.hostUpdated();\n }\n\n hostUpdated(): void {\n if (!this.#fc) {\n this.#init();\n }\n const expanded = this.options.isExpanded();\n this.#button?.setAttribute('aria-expanded', String(expanded));\n this.#input?.setAttribute('aria-expanded', String(expanded));\n this.#initLabels();\n }\n\n hostDisconnected(): void {\n this.#fc?.hostDisconnected();\n }\n\n disconnect(): void {\n ComboboxController.instances.delete(this.host);\n ComboboxController.hosts.delete(this.host);\n }\n\n async _onFocusoutElement(): Promise<void> {\n if (this.#hasTextInput && this.options.isExpanded()) {\n const root = this.#element?.getRootNode();\n await new Promise(requestAnimationFrame);\n if (root instanceof ShadowRoot || root instanceof Document) {\n const { activeElement } = root;\n if (!this.#element?.contains(activeElement)) {\n this.#hide();\n }\n }\n }\n }\n\n /**\n * Order of operations is important\n */\n async #init() {\n await this.host.updateComplete;\n this.#initListbox();\n this.#initItems();\n this.#initButton();\n this.#initInput();\n this.#initLabels();\n this.#initController();\n }\n\n #initListbox() {\n this.#mo.disconnect();\n this.#listbox?.removeEventListener('focusout', this.#onFocusoutListbox);\n this.#listbox?.removeEventListener('keydown', this.#onKeydownListbox);\n this.#listbox?.removeEventListener('click', this.#onClickListbox);\n this.#listbox = this.options.getListboxElement();\n if (!this.#listbox) {\n throw new Error('ComboboxController getListboxElement() option must return an element');\n }\n this.#listbox.addEventListener('focusout', this.#onFocusoutListbox);\n this.#listbox.addEventListener('keydown', this.#onKeydownListbox);\n this.#listbox.addEventListener('click', this.#onClickListbox);\n this.#listbox.id ??= getRandomId();\n this.#mo.observe(this.#listbox, { childList: true });\n }\n\n #initButton() {\n this.#button?.removeEventListener('click', this.#onClickButton);\n this.#button?.removeEventListener('keydown', this.#onKeydownButton);\n this.#button = this.options.getToggleButton();\n if (!this.#button) {\n throw new Error('ComboboxController getToggleButton() option must return an element');\n }\n this.#buttonInitialRole = this.#button.role;\n this.#button.role = 'combobox';\n this.#button.setAttribute('aria-controls', this.#listbox?.id ?? '');\n this.#button.addEventListener('click', this.#onClickButton);\n this.#button.addEventListener('keydown', this.#onKeydownButton);\n }\n\n #initInput() {\n this.#input?.removeEventListener('click', this.#onClickButton);\n this.#input?.removeEventListener('keyup', this.#onKeyupInput);\n this.#input?.removeEventListener('keydown', this.#onKeydownInput);\n\n this.#input = this.options.getComboboxInput();\n if (this.#input && !('value' in this.#input)) {\n throw new Error(`ComboboxController getToggleInput() option must return an element with a value property`);\n } else if (this.#input) {\n this.#input.role = 'combobox';\n this.#button!.role = this.#buttonInitialRole;\n this.#input.setAttribute('aria-autocomplete', 'both');\n this.#input.setAttribute('aria-controls', this.#listbox?.id ?? '');\n this.#input.addEventListener('click', this.#onClickButton);\n this.#input.addEventListener('keyup', this.#onKeyupInput);\n this.#input.addEventListener('keydown', this.#onKeydownInput);\n }\n }\n\n #initLabels() {\n const labels = InternalsController.getLabels(this.host)\n ?? this.#element?.ariaLabelledByElements\n ?? [];\n const label = this.options.getFallbackLabel()\n || this.#element?.ariaLabelledByElements?.map(x => x.textContent).join('')\n || null;\n\n for (const element of [this.#button, this.#listbox, this.#input].filter(x => !!x)) {\n if ('ariaLabelledByElements' in HTMLElement.prototype && labels.filter(x => !!x).length) {\n element.ariaLabelledByElements = [...labels ?? []];\n } else {\n element.ariaLabel = label;\n }\n }\n }\n\n #initController() {\n this.#fc?.hostDisconnected();\n const { getOrientation } = this.options;\n const getItems = () => this.items;\n const getItemsContainer = () => this.#listbox;\n if (this.#hasTextInput) {\n this.#fc = ActivedescendantController.of(this.host, {\n getItems, getItemsContainer, getOrientation,\n getActiveDescendantContainer: () => this.#input,\n getControlsElements: () => [\n this.options.getToggleButton(),\n this.options.getComboboxInput(),\n ].filter(x => !!x),\n setItemActive: this.options.setItemActive,\n });\n } else {\n this.#fc = RovingTabindexController.of(this.host, {\n getItems, getItemsContainer, getOrientation,\n getControlsElements: () => [\n this.options.getToggleButton(),\n ].filter(x => !!x),\n });\n }\n }\n\n #initItems() {\n if (this.#listbox) {\n this.items = this.options.getItems();\n }\n }\n\n async #show(): Promise<void> {\n const success = await this.options.requestShowListbox();\n this.#filterItems();\n if (success !== false && !this.#hasTextInput) {\n if (!this.#preventListboxGainingFocus) {\n (this.#focusedItem ?? this.#fc?.items.at(0))?.focus();\n this.#preventListboxGainingFocus = false;\n }\n }\n }\n\n async #hide(): Promise<void> {\n await this.options.requestHideListbox();\n }\n\n async #toggle() {\n if (this.options.isExpanded()) {\n return this.#hide();\n } else {\n return this.#show();\n }\n }\n\n #translate(key: string, lang: Lang) {\n const strings = this.#microcopy.get(key);\n return strings?.[lang] ?? key;\n }\n\n // TODO(bennypowers): perhaps move this to ActivedescendantController\n #announce(item: Item) {\n const value = this.options.getItemValue(item);\n ComboboxController.#alert?.remove();\n const fragment = ComboboxController.#alertTemplate.content.cloneNode(true) as DocumentFragment;\n ComboboxController.#alert = fragment.firstElementChild as HTMLElement;\n let text = value;\n const lang = deepClosest(this.#listbox, '[lang]')?.getAttribute('lang') ?? 'en';\n const langKey = lang?.match(ComboboxController.langsRE)?.at(0) as Lang ?? 'en';\n if (this.options.isItemDisabled(item)) {\n text += ` (${this.#translate('dimmed', langKey)})`;\n }\n if (this.#lb.isSelected(item)) {\n text += `, (${this.#translate('selected', langKey)})`;\n }\n if (item.hasAttribute('aria-setsize') && item.hasAttribute('aria-posinset')) {\n if (langKey === 'ja') {\n text += `, (${item.getAttribute('aria-setsize')} 件中 ${item.getAttribute('aria-posinset')} 件目)`;\n } else {\n text += `, (${item.getAttribute('aria-posinset')} ${this.#translate('of', langKey)} ${item.getAttribute('aria-setsize')})`;\n }\n }\n ComboboxController.#alert.lang = lang;\n ComboboxController.#alert.innerText = text;\n document.body.append(ComboboxController.#alert);\n }\n\n #filterItems() {\n if (this.#input) {\n let value: string;\n for (const item of this.items) {\n const hidden =\n !!this.options.isExpanded()\n && !!(value = this.options.getComboboxValue(this.#input))\n && this.options.isItemFiltered?.(item, value)\n || false;\n this.options.setItemHidden(item, hidden);\n }\n }\n }\n\n #onClickButton = () => {\n if (!this.options.isExpanded()) {\n this.#show();\n } else {\n this.#hide();\n }\n };\n\n #onClickListbox = (event: MouseEvent) => {\n if (!this.multi && event.composedPath().some(this.options.isItem)) {\n this.#hide();\n }\n };\n\n /**\n * Handle keypresses on the input\n * ## `Down Arrow`\n * - If the textbox is not empty and the listbox is displayed,\n * moves visual focus to the first suggested value.\n * - If the textbox is empty and the listbox is not displayed,\n * opens the listbox and moves visual focus to the first option.\n * - In both cases DOM focus remains on the textbox.\n *\n * ## `Alt + Down Arrow`\n * Opens the listbox without moving focus or changing selection.\n *\n * ## `Up Arrow`\n * - If the textbox is not empty and the listbox is displayed,\n * moves visual focus to the last suggested value.\n * - If the textbox is empty, first opens the listbox if it is not already displayed\n * and then moves visual focus to the last option.\n * - In both cases DOM focus remains on the textbox.\n *\n * ## `Enter`\n * Closes the listbox if it is displayed.\n *\n * ## `Escape`\n * - If the listbox is displayed, closes it.\n * - If the listbox is not displayed, clears the textbox.\n *\n * ## Standard single line text editing keys\n * - Keys used for cursor movement and text manipulation,\n * such as `Delete` and `Shift + Right Arrow`.\n * - An HTML `input` with `type=\"text\"` is used for the textbox so the browser will provide\n * platform-specific editing keys.\n *\n * @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-autocomplete-list\n * @param event keydown event\n */\n #onKeydownInput = (event: KeyboardEvent) => {\n if (event.ctrlKey || event.shiftKey || !this.#input) {\n return;\n }\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n if (!this.options.isExpanded()) {\n this.#preventListboxGainingFocus = event.altKey;\n this.#show();\n }\n break;\n case 'Enter':\n if (!this.multi) {\n this.#hide();\n }\n break;\n case 'Escape':\n if (!this.options.isExpanded()) {\n this.options.setComboboxValue(this.#input, '');\n this.host.requestUpdate();\n }\n this.#hide();\n break;\n case 'Alt':\n case 'AltGraph':\n case 'Shift':\n case 'Control':\n case 'Fn':\n case 'Symbol':\n case 'Hyper':\n case 'Super':\n case 'Meta':\n case 'CapsLock':\n case 'FnLock':\n case 'NumLock':\n case 'Tab':\n case 'ScrollLock':\n case 'SymbolLock':\n case ' ':\n break;\n default:\n if (!this.options.isExpanded()) {\n this.#show();\n }\n }\n };\n\n /**\n * Populates the combobox input with the focused value when navigating the listbox,\n * and filters the items when typing.\n * @param event keyup event\n */\n #onKeyupInput = (event: KeyboardEvent) => {\n if (!this.#input) {\n return;\n }\n switch (event.key) {\n case 'ArrowUp':\n case 'ArrowDown':\n /**\n * Safari VoiceOver does not support aria-activedescendant, so we must.\n * approximate the correct behaviour by constructing a visually-hidden alert role\n * @see (https://bugs.webkit.org/show_bug.cgi?id=269026)\n */\n if (this.#focusedItem\n && this.options.getComboboxInput()\n && InternalsController.isSafari) {\n this.#announce(this.#focusedItem);\n }\n break;\n default:\n this.#filterItems();\n }\n };\n\n #onKeydownButton = (event: KeyboardEvent) => {\n if (this.#hasTextInput) {\n return this.#onKeydownInput(event);\n } else {\n return this.#onKeydownToggleButton(event);\n }\n };\n\n #onKeydownListbox = (event: KeyboardEvent) => {\n if (!this.#hasTextInput) {\n switch (event.key) {\n case 'Home':\n case 'End':\n this.#onKeydownToggleButton(event);\n break;\n case 'Escape':\n this.#hide();\n this.#button?.focus();\n break;\n case 'Enter':\n case ' ': {\n const eventItem = event.composedPath().find(this.options.isItem);\n if (eventItem\n && !this.multi\n && this.options.isExpanded()\n && !this.options.isItemDisabled(eventItem)\n ) {\n this.#hide();\n this.#button?.focus();\n }\n }\n }\n }\n };\n\n #onFocusoutListbox = (event: FocusEvent) => {\n if (!this.#hasTextInput && this.options.isExpanded()) {\n const root = this.#element?.getRootNode();\n if ((root instanceof ShadowRoot || root instanceof Document)\n && !this.items.includes(event.relatedTarget as Item)\n ) {\n this.#hide();\n }\n }\n };\n\n #onKeydownToggleButton = async (event: KeyboardEvent) => {\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowUp':\n if (!this.options.isExpanded()) {\n this.#show();\n }\n break;\n case 'Home':\n if (!this.options.isExpanded()) {\n await this.#show();\n }\n if (this.#fc) {\n this.#fc.atFocusedItemIndex = 0;\n }\n break;\n case 'End':\n if (!this.options.isExpanded()) {\n await this.#show();\n }\n if (this.#fc) {\n this.#fc.atFocusedItemIndex = this.items.length - 1;\n }\n break;\n case ' ':\n case 'Enter':\n // prevent scroll\n event.preventDefault();\n await this.#toggle();\n await this.host.updateComplete;\n if (!this.options.isExpanded()) {\n this.#button?.focus();\n }\n break;\n }\n };\n\n /**\n * For Browsers which do not support `ariaActiveDescendantElement`, we must clone\n * the listbox items into the same root as the combobox input\n * Call this method to return either an array of (cloned) list box items, to be placed in your\n * shadow template, or nothing in the case the browser supports cross-root aria.\n */\n public renderItemsToShadowRoot(): Node[] | typeof nothing {\n if (this.#fc instanceof ActivedescendantController) {\n return this.#fc.renderItemsToShadowRoot();\n } else {\n return nothing;\n }\n }\n}\n"]}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type { Placement } from '@floating-ui/dom';
|
|
2
1
|
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
3
2
|
import type { StyleInfo } from 'lit/directives/style-map.js';
|
|
4
|
-
import type { OffsetOptions as Offset } from '@floating-ui/core';
|
|
5
|
-
export type { Placement };
|
|
6
3
|
type Lazy<T> = T | (() => T | null | undefined);
|
|
7
4
|
interface FloatingDOMControllerOptions {
|
|
8
5
|
content: Lazy<HTMLElement>;
|
|
@@ -13,7 +10,7 @@ interface FloatingDOMControllerOptions {
|
|
|
13
10
|
fallbackPlacements?: Placement[];
|
|
14
11
|
}
|
|
15
12
|
interface ShowOptions {
|
|
16
|
-
offset?:
|
|
13
|
+
offset?: OffsetValue;
|
|
17
14
|
placement?: Placement;
|
|
18
15
|
flip?: boolean;
|
|
19
16
|
fallbackPlacements?: Placement[];
|
|
@@ -56,3 +53,33 @@ export declare class FloatingDOMController implements ReactiveController {
|
|
|
56
53
|
/** Hide the floating DOM */
|
|
57
54
|
hide(): Promise<void>;
|
|
58
55
|
}
|
|
56
|
+
type Side = 'top' | 'right' | 'bottom' | 'left';
|
|
57
|
+
type AlignedPlacement = `${Side}-${'start' | 'end'}`;
|
|
58
|
+
export type Placement = Side | AlignedPlacement;
|
|
59
|
+
type OffsetValue = number | {
|
|
60
|
+
/**
|
|
61
|
+
* The axis that runs along the side of the floating element. Represents
|
|
62
|
+
* the distance (gutter or margin) between the reference and floating
|
|
63
|
+
* element.
|
|
64
|
+
* @default 0
|
|
65
|
+
*/
|
|
66
|
+
mainAxis?: number;
|
|
67
|
+
/**
|
|
68
|
+
* The axis that runs along the alignment of the floating element.
|
|
69
|
+
* Represents the skidding between the reference and floating element.
|
|
70
|
+
* @default 0
|
|
71
|
+
*/
|
|
72
|
+
crossAxis?: number;
|
|
73
|
+
/**
|
|
74
|
+
* The same axis as `crossAxis` but applies only to aligned placements
|
|
75
|
+
* and inverts the `end` alignment. When set to a number, it overrides the
|
|
76
|
+
* `crossAxis` value.
|
|
77
|
+
*
|
|
78
|
+
* A positive number will move the floating element in the direction of
|
|
79
|
+
* the opposite edge to the one that is aligned, while a negative number
|
|
80
|
+
* the reverse.
|
|
81
|
+
* @default null
|
|
82
|
+
*/
|
|
83
|
+
alignmentAxis?: number | null;
|
|
84
|
+
};
|
|
85
|
+
export {};
|