@oscarpalmer/oui 0.33.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/js/combobox/constants.combobox.d.mts +2 -0
  2. package/dist/js/combobox/constants.combobox.mjs +46 -0
  3. package/dist/js/combobox/data.combobox.d.mts +18 -0
  4. package/dist/js/combobox/data.combobox.mjs +2 -0
  5. package/dist/js/combobox/dom.combobox.d.mts +110 -0
  6. package/dist/js/combobox/dom.combobox.mjs +2 -0
  7. package/dist/js/combobox/event.combobox.d.mts +17 -0
  8. package/dist/js/combobox/event.combobox.mjs +2 -0
  9. package/dist/js/combobox/form.combobox.d.mts +6 -0
  10. package/dist/js/combobox/form.combobox.mjs +2 -0
  11. package/dist/js/combobox/i18n.combobox.d.mts +2 -0
  12. package/dist/js/combobox/i18n.combobox.mjs +2 -0
  13. package/dist/js/combobox/index.d.mts +2 -0
  14. package/dist/js/combobox/index.mjs +194 -0
  15. package/dist/js/combobox/misc.combobox.d.mts +14 -0
  16. package/dist/js/combobox/misc.combobox.mjs +2 -0
  17. package/dist/js/combobox/models.combobox.d.mts +2 -0
  18. package/dist/js/combobox/models.combobox.mjs +1 -0
  19. package/dist/js/combobox/state.combobox.d.mts +11 -0
  20. package/dist/js/combobox/state.combobox.mjs +2 -0
  21. package/dist/js/constants.combobox-DqNUGBLS.d.mts +243 -0
  22. package/dist/js/data.combobox-8RwBv5ey.mjs +1077 -0
  23. package/dist/js/dialog.mjs +3 -2
  24. package/dist/js/floatable/floatable.embedded.mjs +4 -4
  25. package/dist/js/focus-trap/focus-trap.embedded.mjs +3 -3
  26. package/dist/js/index.d.mts +14 -643
  27. package/dist/js/index.mjs +19 -4875
  28. package/dist/js/internal/draggable.mjs +6 -6
  29. package/dist/js/internal/navigable.mjs +3 -3
  30. package/dist/js/menu.d.mts +1 -1
  31. package/dist/js/menu.mjs +3 -2
  32. package/dist/js/movable/movable.embedded.mjs +3 -3
  33. package/dist/js/popover.mjs +1 -1
  34. package/dist/js/resizable/resizable.embedded.mjs +7 -7
  35. package/dist/js/sortable/sortable.embedded.mjs +7 -6
  36. package/dist/js/splitter.mjs +7 -13
  37. package/dist/js/toolbar.d.mts +1 -1
  38. package/dist/js/tooltip.mjs +3 -3
  39. package/package.json +4 -4
  40. package/src/js/combobox/constants.combobox.ts +62 -0
  41. package/src/js/combobox/data.combobox.ts +236 -0
  42. package/src/js/combobox/dom.combobox.ts +794 -0
  43. package/src/js/combobox/event.combobox.ts +454 -0
  44. package/src/js/combobox/form.combobox.ts +115 -0
  45. package/src/js/combobox/i18n.combobox.ts +179 -0
  46. package/src/js/combobox/index.ts +307 -0
  47. package/src/js/combobox/misc.combobox.ts +138 -0
  48. package/src/js/combobox/models.combobox.ts +94 -0
  49. package/src/js/combobox/state.combobox.ts +235 -0
  50. package/src/js/index.ts +1 -1
  51. package/src/js/internal/draggable.ts +3 -3
  52. package/src/js/movable/movable.embedded.ts +2 -2
  53. package/src/js/resizable/resizable.embedded.ts +3 -3
  54. package/src/js/sortable/sortable.embedded.ts +2 -2
  55. package/src/js/splitter.ts +2 -2
  56. package/dist/js/combobox.d.mts +0 -91
  57. package/dist/js/combobox.mjs +0 -797
  58. package/src/js/combobox.ts +0 -2410
@@ -0,0 +1,2 @@
1
+ import { C as COMBOBOX_TYPES, S as COMBOBOX_TAGNAME, _ as COMBOBOX_MESSAGE_LABEL, a as COMBOBOX_ATTRIBUTE_HEADER, b as COMBOBOX_SELECTOR_OPTION, c as COMBOBOX_ATTRIBUTE_MESSAGE, d as COMBOBOX_ATTRIBUTE_SELECTION, f as COMBOBOX_ATTRIBUTE_SELECTION_ITEM, g as COMBOBOX_KEYS_SELECTION, h as COMBOBOX_KEYS_NAVIGATION, i as COMBOBOX_ATTRIBUTE_FILTER_INPUT, l as COMBOBOX_ATTRIBUTE_OPTION, m as COMBOBOX_KEYS_ACTIVATION, n as COMBOBOX_ATTRIBUTE_CONTENT, o as COMBOBOX_ATTRIBUTE_HIDDEN, p as COMBOBOX_AUTOCOMPLETES, r as COMBOBOX_ATTRIBUTE_FILTER, s as COMBOBOX_ATTRIBUTE_LIST, t as COMBOBOX_ATTRIBUTE_ANCHOR, u as COMBOBOX_ATTRIBUTE_OPTION_ACTIVE, v as COMBOBOX_MESSAGE_SELECT, w as comboboxScrollOptions, x as COMBOBOX_SELECTOR_SELECTION_ITEM, y as COMBOBOX_SELECTOR_ANCHOR } from "../constants.combobox-DqNUGBLS.mjs";
2
+ export { COMBOBOX_ATTRIBUTE_ANCHOR, COMBOBOX_ATTRIBUTE_CONTENT, COMBOBOX_ATTRIBUTE_FILTER, COMBOBOX_ATTRIBUTE_FILTER_INPUT, COMBOBOX_ATTRIBUTE_HEADER, COMBOBOX_ATTRIBUTE_HIDDEN, COMBOBOX_ATTRIBUTE_LIST, COMBOBOX_ATTRIBUTE_MESSAGE, COMBOBOX_ATTRIBUTE_OPTION, COMBOBOX_ATTRIBUTE_OPTION_ACTIVE, COMBOBOX_ATTRIBUTE_SELECTION, COMBOBOX_ATTRIBUTE_SELECTION_ITEM, COMBOBOX_AUTOCOMPLETES, COMBOBOX_KEYS_ACTIVATION, COMBOBOX_KEYS_NAVIGATION, COMBOBOX_KEYS_SELECTION, COMBOBOX_MESSAGE_LABEL, COMBOBOX_MESSAGE_SELECT, COMBOBOX_SELECTOR_ANCHOR, COMBOBOX_SELECTOR_OPTION, COMBOBOX_SELECTOR_SELECTION_ITEM, COMBOBOX_TAGNAME, COMBOBOX_TYPES, comboboxScrollOptions };
@@ -0,0 +1,46 @@
1
+ //#region src/js/combobox/constants.combobox.ts
2
+ const COMBOBOX_TAGNAME = "oui-combobox";
3
+ const COMBOBOX_ATTRIBUTE_ANCHOR = `${COMBOBOX_TAGNAME}-anchor`;
4
+ const COMBOBOX_ATTRIBUTE_CONTENT = `${COMBOBOX_TAGNAME}-content`;
5
+ const COMBOBOX_ATTRIBUTE_FILTER = `${COMBOBOX_TAGNAME}-filter`;
6
+ const COMBOBOX_ATTRIBUTE_FILTER_INPUT = `${COMBOBOX_ATTRIBUTE_FILTER}-input`;
7
+ const COMBOBOX_ATTRIBUTE_HEADER = `${COMBOBOX_TAGNAME}-header`;
8
+ const COMBOBOX_ATTRIBUTE_HIDDEN = `${COMBOBOX_TAGNAME}-hidden`;
9
+ const COMBOBOX_ATTRIBUTE_LIST = `${COMBOBOX_TAGNAME}-list`;
10
+ const COMBOBOX_ATTRIBUTE_MESSAGE = `${COMBOBOX_TAGNAME}-message`;
11
+ const COMBOBOX_ATTRIBUTE_OPTION = `${COMBOBOX_TAGNAME}-option`;
12
+ const COMBOBOX_ATTRIBUTE_OPTION_ACTIVE = `${COMBOBOX_TAGNAME}-option-active`;
13
+ const COMBOBOX_ATTRIBUTE_SELECTION = `${COMBOBOX_TAGNAME}-selection`;
14
+ const COMBOBOX_ATTRIBUTE_SELECTION_ITEM = `${COMBOBOX_TAGNAME}-selection-item`;
15
+ const COMBOBOX_AUTOCOMPLETES = /* @__PURE__ */ new Set([
16
+ "both",
17
+ "inline",
18
+ "list",
19
+ "none"
20
+ ]);
21
+ const COMBOBOX_KEYS_ACTIVATION = /* @__PURE__ */ new Set([
22
+ " ",
23
+ "Backspace",
24
+ "Delete",
25
+ "Enter"
26
+ ]);
27
+ const COMBOBOX_KEYS_NAVIGATION = /* @__PURE__ */ new Set([
28
+ "ArrowDown",
29
+ "ArrowUp",
30
+ "PageDown",
31
+ "PageUp"
32
+ ]);
33
+ const COMBOBOX_KEYS_SELECTION = /* @__PURE__ */ new Set(["ArrowRight", "End"]);
34
+ const COMBOBOX_MESSAGE_LABEL = `<${COMBOBOX_TAGNAME}> must contain a <label> element for the <select> element`;
35
+ const COMBOBOX_MESSAGE_SELECT = `<${COMBOBOX_TAGNAME}> must contain a valid <select> element`;
36
+ const COMBOBOX_SELECTOR_ANCHOR = `[${COMBOBOX_ATTRIBUTE_ANCHOR}]`;
37
+ const COMBOBOX_SELECTOR_SELECTION_ITEM = `[${COMBOBOX_ATTRIBUTE_SELECTION_ITEM}]`;
38
+ const COMBOBOX_SELECTOR_OPTION = `[${COMBOBOX_ATTRIBUTE_OPTION}]`;
39
+ const COMBOBOX_TYPES = /* @__PURE__ */ new Set(["autocomplete", "select"]);
40
+ const comboboxScrollOptions = {
41
+ behavior: "auto",
42
+ block: "nearest",
43
+ inline: "nearest"
44
+ };
45
+ //#endregion
46
+ export { COMBOBOX_ATTRIBUTE_ANCHOR, COMBOBOX_ATTRIBUTE_CONTENT, COMBOBOX_ATTRIBUTE_FILTER, COMBOBOX_ATTRIBUTE_FILTER_INPUT, COMBOBOX_ATTRIBUTE_HEADER, COMBOBOX_ATTRIBUTE_HIDDEN, COMBOBOX_ATTRIBUTE_LIST, COMBOBOX_ATTRIBUTE_MESSAGE, COMBOBOX_ATTRIBUTE_OPTION, COMBOBOX_ATTRIBUTE_OPTION_ACTIVE, COMBOBOX_ATTRIBUTE_SELECTION, COMBOBOX_ATTRIBUTE_SELECTION_ITEM, COMBOBOX_AUTOCOMPLETES, COMBOBOX_KEYS_ACTIVATION, COMBOBOX_KEYS_NAVIGATION, COMBOBOX_KEYS_SELECTION, COMBOBOX_MESSAGE_LABEL, COMBOBOX_MESSAGE_SELECT, COMBOBOX_SELECTOR_ANCHOR, COMBOBOX_SELECTOR_OPTION, COMBOBOX_SELECTOR_SELECTION_ITEM, COMBOBOX_TAGNAME, COMBOBOX_TYPES, comboboxScrollOptions };
@@ -0,0 +1,18 @@
1
+ import { I as OuiComboboxState } from "../constants.combobox-DqNUGBLS.mjs";
2
+ //#region src/js/combobox/data.combobox.d.ts
3
+ type ApplySelectionParameters = {
4
+ added: boolean;
5
+ emit?: boolean;
6
+ option?: HTMLElement;
7
+ selected?: HTMLElement[];
8
+ state: OuiComboboxState;
9
+ values?: string[];
10
+ };
11
+ declare function applyComboboxSelection(parameters: ApplySelectionParameters): void;
12
+ declare function filterComboboxOption(state: OuiComboboxState, value: unknown, textContent?: boolean): HTMLElement | undefined;
13
+ declare function filterComboboxOptions(state: OuiComboboxState): HTMLElement | undefined;
14
+ declare function setComboboxValue(state: OuiComboboxState, value: unknown, emit?: boolean): void;
15
+ declare function setComboboxValues(state: OuiComboboxState, value: unknown, emit?: boolean): void;
16
+ declare function toggleComboboxOption(state: OuiComboboxState, option?: HTMLElement): void;
17
+ //#endregion
18
+ export { applyComboboxSelection, filterComboboxOption, filterComboboxOptions, setComboboxValue, setComboboxValues, toggleComboboxOption };
@@ -0,0 +1,2 @@
1
+ import { a as setComboboxValues, i as setComboboxValue, n as filterComboboxOption, o as toggleComboboxOption, r as filterComboboxOptions, t as applyComboboxSelection } from "../data.combobox-8RwBv5ey.mjs";
2
+ export { applyComboboxSelection, filterComboboxOption, filterComboboxOptions, setComboboxValue, setComboboxValues, toggleComboboxOption };
@@ -0,0 +1,110 @@
1
+ import { D as OuiComboboxAutoCompleteType, E as OuiComboboxAutoComplete, F as OuiComboboxSelectionItem, I as OuiComboboxState, L as OuiComboboxType, N as OuiComboboxPreview, P as OuiComboboxSelection, k as OuiComboboxGroup } from "../constants.combobox-DqNUGBLS.mjs";
2
+ //#region src/js/combobox/dom.combobox.d.ts
3
+ type CreateAnchor = {
4
+ container?: HTMLElement;
5
+ element: HTMLElement;
6
+ selection?: OuiComboboxSelection;
7
+ };
8
+ type CreatAnchorParameters = {
9
+ autocomplete: OuiComboboxAutoComplete;
10
+ id: string;
11
+ label: HTMLLabelElement;
12
+ multiple: boolean;
13
+ select: HTMLSelectElement;
14
+ type: OuiComboboxType;
15
+ };
16
+ type CreateContent = {
17
+ element: HTMLElement;
18
+ filter?: CreateFilter;
19
+ list: CreateList;
20
+ message: HTMLElement;
21
+ };
22
+ type CreateContentParameters = {
23
+ autocomplete: OuiComboboxAutoComplete;
24
+ id: string;
25
+ label: HTMLLabelElement;
26
+ multiple: boolean;
27
+ select: HTMLSelectElement;
28
+ type: OuiComboboxType;
29
+ };
30
+ type CreateFilter = {
31
+ container: HTMLElement;
32
+ element: HTMLInputElement;
33
+ };
34
+ type CreateFilterParameters = {
35
+ autocomplete: OuiComboboxAutoCompleteType;
36
+ id: string;
37
+ label: HTMLLabelElement;
38
+ type: OuiComboboxType;
39
+ };
40
+ type CreateGroupParameters = {
41
+ autocomplete: OuiComboboxAutoComplete;
42
+ group: HTMLOptGroupElement;
43
+ groupOptions: HTMLOptionElement[];
44
+ selected: HTMLElement[];
45
+ };
46
+ type CreateInputParameters = {
47
+ autocomplete: OuiComboboxAutoCompleteType;
48
+ id: string;
49
+ label: HTMLLabelElement;
50
+ type: OuiComboboxType;
51
+ value: string;
52
+ };
53
+ type CreateList = {
54
+ element: HTMLElement;
55
+ groups?: OuiComboboxGroup[];
56
+ options: HTMLElement[];
57
+ selected: HTMLElement[];
58
+ };
59
+ type CreateListParameters = {
60
+ autocomplete: OuiComboboxAutoComplete;
61
+ id: string;
62
+ label: HTMLLabelElement;
63
+ multiple: boolean;
64
+ select: HTMLSelectElement;
65
+ };
66
+ type CreateOptionParameters = {
67
+ autocomplete: OuiComboboxAutoComplete;
68
+ group?: string;
69
+ index: number;
70
+ option: HTMLOptionElement;
71
+ };
72
+ type CreateOptionsParameters = {
73
+ autocomplete: OuiComboboxAutoComplete;
74
+ group?: string;
75
+ list: HTMLElement;
76
+ options: HTMLOptionElement[];
77
+ selected: HTMLElement[];
78
+ };
79
+ type CreateSelectionItemsParameters = {
80
+ container: HTMLElement;
81
+ items: OuiComboboxSelectionItem[];
82
+ options: HTMLElement[];
83
+ state?: OuiComboboxState;
84
+ };
85
+ declare function createComboboxAnchor(parameters: CreatAnchorParameters): CreateAnchor;
86
+ declare function createComboboxButton(parameters: CreatAnchorParameters): CreateAnchor;
87
+ declare function createComboboxContent(parameters: CreateContentParameters): CreateContent;
88
+ declare function createComboboxFilter(parameters: CreateFilterParameters): CreateFilter | undefined;
89
+ declare function createComboboxGroup(parameters: CreateGroupParameters): OuiComboboxGroup;
90
+ declare function createComboboxHeader(group: HTMLOptGroupElement): HTMLElement;
91
+ declare function createComboboxInput(parameters: CreateInputParameters): HTMLInputElement;
92
+ declare function createComboboxList(parameters: CreateListParameters): CreateList;
93
+ declare function createComboboxMessage(): HTMLElement;
94
+ declare function createComboboxOption(parameters: CreateOptionParameters): HTMLElement;
95
+ declare function createComboboxOptions(parameters: CreateOptionsParameters): HTMLElement[];
96
+ declare function createComboboxSelection(id: string, select: HTMLSelectElement): OuiComboboxSelection;
97
+ declare function createComboboxSelectionItem(option: HTMLElement, state?: OuiComboboxState): OuiComboboxSelectionItem;
98
+ declare function createComboboxSelectionItems(parameters: CreateSelectionItemsParameters): void;
99
+ declare function setComboboxDisabled(state: OuiComboboxState, value: boolean): void;
100
+ declare function setComboboxReadonly(state: OuiComboboxState, value: boolean): void;
101
+ declare function setComboboxRequired(state: OuiComboboxState, value: boolean): void;
102
+ declare function updateComboboxTabindices(state: OuiComboboxState, active?: HTMLElement): void;
103
+ declare function updateComboboxAnchor(state: OuiComboboxState): void;
104
+ declare function updateComboboxAutocomplete(preview: OuiComboboxPreview, state: OuiComboboxState, active?: HTMLElement): void;
105
+ declare function updateComboboxMessage(state: OuiComboboxState, visible: number): void;
106
+ declare function updateComboboxPreview(preview: OuiComboboxPreview, state: OuiComboboxState, active?: HTMLElement): void;
107
+ declare function updateComboboxSelection(state: OuiComboboxState, active: HTMLElement | undefined, added: boolean, selected?: HTMLElement[]): void;
108
+ declare function updateComboboxSelectionItems(state: OuiComboboxState): void;
109
+ //#endregion
110
+ export { createComboboxAnchor, createComboboxButton, createComboboxContent, createComboboxFilter, createComboboxGroup, createComboboxHeader, createComboboxInput, createComboboxList, createComboboxMessage, createComboboxOption, createComboboxOptions, createComboboxSelection, createComboboxSelectionItem, createComboboxSelectionItems, setComboboxDisabled, setComboboxReadonly, setComboboxRequired, updateComboboxAnchor, updateComboboxAutocomplete, updateComboboxMessage, updateComboboxPreview, updateComboboxSelection, updateComboboxSelectionItems, updateComboboxTabindices };
@@ -0,0 +1,2 @@
1
+ import { A as updateComboboxTabindices, C as setComboboxRequired, D as updateComboboxPreview, E as updateComboboxMessage, O as updateComboboxSelection, S as setComboboxReadonly, T as updateComboboxAutocomplete, _ as createComboboxOptions, b as createComboboxSelectionItems, c as createComboboxButton, d as createComboboxGroup, f as createComboboxHeader, g as createComboboxOption, h as createComboboxMessage, k as updateComboboxSelectionItems, l as createComboboxContent, m as createComboboxList, p as createComboboxInput, s as createComboboxAnchor, u as createComboboxFilter, v as createComboboxSelection, w as updateComboboxAnchor, x as setComboboxDisabled, y as createComboboxSelectionItem } from "../data.combobox-8RwBv5ey.mjs";
2
+ export { createComboboxAnchor, createComboboxButton, createComboboxContent, createComboboxFilter, createComboboxGroup, createComboboxHeader, createComboboxInput, createComboboxList, createComboboxMessage, createComboboxOption, createComboboxOptions, createComboboxSelection, createComboboxSelectionItem, createComboboxSelectionItems, setComboboxDisabled, setComboboxReadonly, setComboboxRequired, updateComboboxAnchor, updateComboboxAutocomplete, updateComboboxMessage, updateComboboxPreview, updateComboboxSelection, updateComboboxSelectionItems, updateComboboxTabindices };
@@ -0,0 +1,17 @@
1
+ import { I as OuiComboboxState } from "../constants.combobox-DqNUGBLS.mjs";
2
+ //#region src/js/combobox/event.combobox.d.ts
3
+ declare function onComboboxClickContent(event: PointerEvent, content: HTMLElement): void;
4
+ declare function onComboboxClickDocument(event: PointerEvent): void;
5
+ declare function onComboboxEnter(state: OuiComboboxState): void;
6
+ declare function onComboboxEscape(state: OuiComboboxState): void;
7
+ declare function onComboboxFilter(type: InputEvent['inputType'], state: OuiComboboxState, manual?: boolean, emit?: boolean): void;
8
+ declare function onComboboxFocusout(state: OuiComboboxState): void;
9
+ declare function onComboboxInput(event: InputEvent): void;
10
+ declare function onComboboxKeydown(event: KeyboardEvent): void;
11
+ declare function onComboboxKeydownSelection(event: KeyboardEvent, state: OuiComboboxState, item: HTMLElement): void;
12
+ declare function onComboboxNavigation(event: KeyboardEvent, state: OuiComboboxState): void;
13
+ declare function onComboboxRemoveSelection(state: OuiComboboxState, item: HTMLElement): void;
14
+ declare function onComboboxSelection(state: OuiComboboxState): void;
15
+ declare function onComboboxTab(state: OuiComboboxState): void;
16
+ //#endregion
17
+ export { onComboboxClickContent, onComboboxClickDocument, onComboboxEnter, onComboboxEscape, onComboboxFilter, onComboboxFocusout, onComboboxInput, onComboboxKeydown, onComboboxKeydownSelection, onComboboxNavigation, onComboboxRemoveSelection, onComboboxSelection, onComboboxTab };
@@ -0,0 +1,2 @@
1
+ import { $ as onComboboxKeydown, J as onComboboxEnter, K as onComboboxClickContent, Q as onComboboxInput, X as onComboboxFilter, Y as onComboboxEscape, Z as onComboboxFocusout, et as onComboboxKeydownSelection, it as onComboboxTab, nt as onComboboxRemoveSelection, q as onComboboxClickDocument, rt as onComboboxSelection, tt as onComboboxNavigation } from "../data.combobox-8RwBv5ey.mjs";
2
+ export { onComboboxClickContent, onComboboxClickDocument, onComboboxEnter, onComboboxEscape, onComboboxFilter, onComboboxFocusout, onComboboxInput, onComboboxKeydown, onComboboxKeydownSelection, onComboboxNavigation, onComboboxRemoveSelection, onComboboxSelection, onComboboxTab };
@@ -0,0 +1,6 @@
1
+ import { I as OuiComboboxState } from "../constants.combobox-DqNUGBLS.mjs";
2
+ //#region src/js/combobox/form.combobox.d.ts
3
+ declare function updateComboboxForm(state: OuiComboboxState, values: string[], emit?: boolean): void;
4
+ declare function updateComboboxValidity(state: OuiComboboxState): void;
5
+ //#endregion
6
+ export { updateComboboxForm, updateComboboxValidity };
@@ -0,0 +1,2 @@
1
+ import { M as updateComboboxValidity, j as updateComboboxForm } from "../data.combobox-8RwBv5ey.mjs";
2
+ export { updateComboboxForm, updateComboboxValidity };
@@ -0,0 +1,2 @@
1
+ import { B as getComboboxLanguage, H as setComboboxLocalizations, U as updateComboboxLocalizations, V as getComboboxLocalization } from "../constants.combobox-DqNUGBLS.mjs";
2
+ export { getComboboxLanguage, getComboboxLocalization, setComboboxLocalizations, updateComboboxLocalizations };
@@ -0,0 +1,2 @@
1
+ import { F as setComboboxLocalizations, I as updateComboboxLocalizations, N as getComboboxLanguage, P as getComboboxLocalization } from "../data.combobox-8RwBv5ey.mjs";
2
+ export { getComboboxLanguage, getComboboxLocalization, setComboboxLocalizations, updateComboboxLocalizations };
@@ -0,0 +1,2 @@
1
+ import { H as setComboboxLocalizations, z as OuiComboboxElement } from "../constants.combobox-DqNUGBLS.mjs";
2
+ export { OuiComboboxElement, setComboboxLocalizations };
@@ -0,0 +1,194 @@
1
+ import { COMBOBOX_TAGNAME } from "./constants.combobox.mjs";
2
+ import { C as setComboboxRequired, F as setComboboxLocalizations, G as setComboboxLimit, I as updateComboboxLocalizations, S as setComboboxReadonly, W as setComboboxFilter, a as setComboboxValues, at as attachCombobox, ct as detachCombobox, i as setComboboxValue, st as createComboboxState, x as setComboboxDisabled } from "../data.combobox-8RwBv5ey.mjs";
3
+ import { getAttribute } from "@oscarpalmer/toretto/attribute";
4
+ import { parse } from "@oscarpalmer/atoms/string";
5
+ //#region src/js/combobox/index.ts
6
+ var OuiComboboxElement = class extends HTMLElement {
7
+ static formAssociated = true;
8
+ static observedAttributes = [
9
+ "max",
10
+ "min",
11
+ "required",
12
+ "value"
13
+ ];
14
+ #internals;
15
+ #restored;
16
+ #state;
17
+ /**
18
+ * Is the combobox disabled?
19
+ */
20
+ get disabled() {
21
+ return this.#state?.disabled ?? false;
22
+ }
23
+ /**
24
+ * Should the combobox be disabled?
25
+ */
26
+ set disabled(value) {
27
+ if (typeof value === "boolean" && value !== this.disabled) setComboboxDisabled(this.#state, value);
28
+ }
29
+ /**
30
+ * Current filter value
31
+ */
32
+ get filter() {
33
+ return this.#state.filter.element.value;
34
+ }
35
+ /**
36
+ * Set the filter value
37
+ */
38
+ set filter(value) {
39
+ setComboboxFilter(this.#state, value);
40
+ }
41
+ /**
42
+ * Maximum number of selected options
43
+ */
44
+ get max() {
45
+ return this.#state?.max;
46
+ }
47
+ /**
48
+ * Set the maximum number of selected options
49
+ */
50
+ set max(value) {
51
+ setComboboxLimit("max", this.#state, value);
52
+ }
53
+ /**
54
+ * Minimum number of selected options
55
+ */
56
+ get min() {
57
+ return this.#state?.min;
58
+ }
59
+ /**
60
+ * Set the minimum number of selected options
61
+ */
62
+ set min(value) {
63
+ setComboboxLimit("min", this.#state, value);
64
+ }
65
+ /**
66
+ * Does the combobox allow multiple values?
67
+ */
68
+ get multiple() {
69
+ return this.hasAttribute("multiple");
70
+ }
71
+ /**
72
+ * Name of the combobox
73
+ */
74
+ get name() {
75
+ return getAttribute(this, "name") ?? "";
76
+ }
77
+ /**
78
+ * Is the combobox readonly?
79
+ */
80
+ get readonly() {
81
+ return this.#state?.readonly ?? false;
82
+ }
83
+ /**
84
+ * Should the combobox be readonly?
85
+ */
86
+ set readonly(value) {
87
+ if (typeof value === "boolean" && value !== this.readonly) setComboboxReadonly(this.#state, value);
88
+ }
89
+ /**
90
+ * Is the combobox required?
91
+ */
92
+ get required() {
93
+ return this.#state?.required ?? false;
94
+ }
95
+ /**
96
+ * Should the combobox be required?
97
+ */
98
+ set required(value) {
99
+ if (typeof value === "boolean" && value !== this.required) setComboboxRequired(this.#state, value);
100
+ }
101
+ /**
102
+ * Selected options
103
+ */
104
+ get selected() {
105
+ return this.#state.options.selected.slice();
106
+ }
107
+ /**
108
+ * Type of combobox
109
+ */
110
+ get type() {
111
+ return this.#state.type;
112
+ }
113
+ /**
114
+ * Current value
115
+ */
116
+ get value() {
117
+ return this.#state.values.current[0];
118
+ }
119
+ /**
120
+ * Set the value
121
+ */
122
+ set value(value) {
123
+ setComboboxValue(this.#state, value);
124
+ }
125
+ /**
126
+ * Current values
127
+ */
128
+ get values() {
129
+ return this.#state.values.current.slice();
130
+ }
131
+ /**
132
+ * Set the values
133
+ */
134
+ set values(value) {
135
+ setComboboxValues(this.#state, value);
136
+ }
137
+ constructor() {
138
+ super();
139
+ this.#internals = this.attachInternals();
140
+ }
141
+ attributeChangedCallback(name, _, value) {
142
+ if (this.#state == null) return;
143
+ switch (name) {
144
+ case "required":
145
+ this[name] = this.hasAttribute(name);
146
+ break;
147
+ case "max":
148
+ case "min":
149
+ setComboboxLimit(name, this.#state, value);
150
+ break;
151
+ case "value": this.value = value ?? "";
152
+ }
153
+ }
154
+ /**
155
+ * Clear all selected options
156
+ */
157
+ clear() {
158
+ setComboboxValues(this.#state, []);
159
+ }
160
+ connectedCallback() {
161
+ if (this.#state == null) this.#initialize();
162
+ else attachCombobox(this.#state);
163
+ }
164
+ disconnectedCallback() {
165
+ if (this.#state != null) detachCombobox(this.#state);
166
+ }
167
+ formDisabledCallback(disabled) {
168
+ this.disabled = disabled;
169
+ }
170
+ formResetCallback() {
171
+ setComboboxValues(this.#state, this.#state.values.initial, false);
172
+ }
173
+ formStateRestoreCallback(state, reason) {
174
+ if (reason !== "restore") return;
175
+ const parsed = typeof state === "string" ? parse(state) : void 0;
176
+ if (!Array.isArray(parsed)) return;
177
+ if (this.#state == null) this.#restored = parsed;
178
+ else setComboboxValues(this.#state, parsed);
179
+ }
180
+ setLocalizations(first, second) {
181
+ updateComboboxLocalizations(typeof first === "string" ? { [first]: second } : first, this.#state.localizations);
182
+ }
183
+ #initialize() {
184
+ this.tabIndex = -1;
185
+ this.#state = createComboboxState(this, this.#internals);
186
+ if (this.#restored != null) {
187
+ setComboboxValues(this.#state, this.#restored, false);
188
+ this.#restored = void 0;
189
+ }
190
+ }
191
+ };
192
+ customElements.define(COMBOBOX_TAGNAME, OuiComboboxElement);
193
+ //#endregion
194
+ export { OuiComboboxElement, setComboboxLocalizations };
@@ -0,0 +1,14 @@
1
+ import { E as OuiComboboxAutoComplete, I as OuiComboboxState, z as OuiComboboxElement } from "../constants.combobox-DqNUGBLS.mjs";
2
+ import { AnyAriaBooleanAttribute } from "@oscarpalmer/toretto/models";
3
+ //#region src/js/combobox/misc.combobox.d.ts
4
+ declare function generateComboboxIds(prefix: string, select: HTMLSelectElement): void;
5
+ declare function getComboboxAttributeValue<Value>(element: HTMLElement, attribute: string, possible: Set<Value>, defaultValue: Value): Value;
6
+ declare function getComboboxAutoComplete(element: OuiComboboxElement, select: boolean): OuiComboboxAutoComplete;
7
+ declare function getComboboxBooleanAria(element: HTMLElement, attribute: AnyAriaBooleanAttribute): boolean;
8
+ declare function getComboboxId(): string;
9
+ declare function getComboboxVisibleOptions(state: OuiComboboxState): HTMLElement[];
10
+ declare function hasTextSelection(element: HTMLElement): element is HTMLInputElement;
11
+ declare function setComboboxFilter(state: OuiComboboxState, value: unknown): void;
12
+ declare function setComboboxLimit(type: 'max' | 'min', state: OuiComboboxState, value?: unknown): void;
13
+ //#endregion
14
+ export { generateComboboxIds, getComboboxAttributeValue, getComboboxAutoComplete, getComboboxBooleanAria, getComboboxId, getComboboxVisibleOptions, hasTextSelection, setComboboxFilter, setComboboxLimit };
@@ -0,0 +1,2 @@
1
+ import { B as getComboboxBooleanAria, G as setComboboxLimit, H as getComboboxVisibleOptions, L as generateComboboxIds, R as getComboboxAttributeValue, U as hasTextSelection, V as getComboboxId, W as setComboboxFilter, z as getComboboxAutoComplete } from "../data.combobox-8RwBv5ey.mjs";
2
+ export { generateComboboxIds, getComboboxAttributeValue, getComboboxAutoComplete, getComboboxBooleanAria, getComboboxId, getComboboxVisibleOptions, hasTextSelection, setComboboxFilter, setComboboxLimit };
@@ -0,0 +1,2 @@
1
+ import { A as OuiComboboxLabel, D as OuiComboboxAutoCompleteType, E as OuiComboboxAutoComplete, F as OuiComboboxSelectionItem, I as OuiComboboxState, L as OuiComboboxType, M as OuiComboboxOptions, N as OuiComboboxPreview, O as OuiComboboxFilter, P as OuiComboboxSelection, R as OuiComboboxValues, T as OuiComboboxAnchor, j as OuiComboboxLocalizations, k as OuiComboboxGroup } from "../constants.combobox-DqNUGBLS.mjs";
2
+ export { OuiComboboxAnchor, OuiComboboxAutoComplete, OuiComboboxAutoCompleteType, OuiComboboxFilter, OuiComboboxGroup, OuiComboboxLabel, OuiComboboxLocalizations, OuiComboboxOptions, OuiComboboxPreview, OuiComboboxSelection, OuiComboboxSelectionItem, OuiComboboxState, OuiComboboxType, OuiComboboxValues };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { I as OuiComboboxState, z as OuiComboboxElement } from "../constants.combobox-DqNUGBLS.mjs";
2
+ //#region src/js/combobox/state.combobox.d.ts
3
+ declare function attachCombobox(state: OuiComboboxState): void;
4
+ declare function createComboboxState(element: OuiComboboxElement, internals: ElementInternals): OuiComboboxState;
5
+ declare function detachCombobox(state: OuiComboboxState): void;
6
+ declare const comboboxStates: {
7
+ map: WeakMap<HTMLElement, OuiComboboxState>;
8
+ set: Set<OuiComboboxState>;
9
+ };
10
+ //#endregion
11
+ export { attachCombobox, comboboxStates, createComboboxState, detachCombobox };
@@ -0,0 +1,2 @@
1
+ import { at as attachCombobox, ct as detachCombobox, ot as comboboxStates, st as createComboboxState } from "../data.combobox-8RwBv5ey.mjs";
2
+ export { attachCombobox, comboboxStates, createComboboxState, detachCombobox };