@oscarpalmer/oui 0.39.0 → 0.40.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 (182) hide show
  1. package/README.md +1 -1
  2. package/dist/js/color-picker/color-picker.constants.d.mts +2 -0
  3. package/dist/js/color-picker/{constants.color-picker.mjs → color-picker.constants.mjs} +5 -4
  4. package/dist/js/color-picker/{dom.color-picker.d.mts → color-picker.dom.d.mts} +2 -2
  5. package/dist/js/color-picker/{dom.color-picker.mjs → color-picker.dom.mjs} +3 -3
  6. package/dist/js/color-picker/{event.color-picker.d.mts → color-picker.event.d.mts} +2 -2
  7. package/dist/js/color-picker/{event.color-picker.mjs → color-picker.event.mjs} +1 -1
  8. package/dist/js/color-picker/{form.color-picker.d.mts → color-picker.form.d.mts} +2 -2
  9. package/dist/js/color-picker/{form.color-picker.mjs → color-picker.form.mjs} +9 -6
  10. package/dist/js/color-picker/color-picker.misc.d.mts +2 -0
  11. package/dist/js/color-picker/{misc.color-picker.mjs → color-picker.misc.mjs} +1 -1
  12. package/dist/js/color-picker/color-picker.model.d.mts +2 -0
  13. package/dist/js/color-picker/{models.color-picker.mjs → color-picker.model.mjs} +1 -1
  14. package/dist/js/color-picker/{output.color-picker.d.mts → color-picker.output.d.mts} +2 -2
  15. package/dist/js/color-picker/{output.color-picker.mjs → color-picker.output.mjs} +13 -11
  16. package/dist/js/color-picker/color-picker.state.d.mts +8 -0
  17. package/dist/js/color-picker/color-picker.state.mjs +2 -0
  18. package/dist/js/color-picker/index.d.mts +180 -2
  19. package/dist/js/color-picker/index.mjs +59 -57
  20. package/dist/js/color-picker.constants-D1mxw_Le.d.mts +179 -0
  21. package/dist/js/{event.color-picker-BEpq0Adu.mjs → color-picker.event-Cksj5TvS.mjs} +105 -90
  22. package/dist/js/color-picker.misc-CtsXGrOe.d.mts +27 -0
  23. package/dist/js/combobox/combobox.constants.d.mts +2 -0
  24. package/dist/js/combobox/{constants.combobox.mjs → combobox.constants.mjs} +21 -21
  25. package/dist/js/combobox/{dom.combobox.d.mts → combobox.dom.d.mts} +3 -3
  26. package/dist/js/combobox/{dom.combobox.mjs → combobox.dom.mjs} +40 -36
  27. package/dist/js/combobox/{event.combobox.d.mts → combobox.event.d.mts} +3 -3
  28. package/dist/js/combobox/{event.combobox.mjs → combobox.event.mjs} +1 -1
  29. package/dist/js/combobox/combobox.misc.d.mts +2 -0
  30. package/dist/js/combobox/{misc.combobox.mjs → combobox.misc.mjs} +1 -1
  31. package/dist/js/combobox/combobox.model.d.mts +2 -0
  32. package/dist/js/combobox/combobox.state.d.mts +10 -0
  33. package/dist/js/combobox/combobox.state.mjs +2 -0
  34. package/dist/js/combobox/index.d.mts +163 -2
  35. package/dist/js/combobox/index.mjs +53 -52
  36. package/dist/js/combobox.constants-DZVkMP5g.d.mts +19 -0
  37. package/dist/js/combobox.misc-C1tPZZDi.d.mts +22 -0
  38. package/dist/js/combobox.model-oDV06XCN.d.mts +44 -0
  39. package/dist/js/{state.combobox-BWDFHwoi.mjs → combobox.state-BfJ3Hxg8.mjs} +94 -80
  40. package/dist/js/constants.listbox-C5Ap6Ag_.d.mts +9 -0
  41. package/dist/js/dialog/dialog.model.d.mts +2 -0
  42. package/dist/js/dialog/dialog.model.mjs +11 -0
  43. package/dist/js/dialog/index.d.mts +12 -0
  44. package/dist/js/dialog/index.mjs +123 -0
  45. package/dist/js/dialog.model-DX2mndMh.d.mts +45 -0
  46. package/dist/js/floatable/floatable.embedded.d.mts +2 -2
  47. package/dist/js/floatable/floatable.embedded.mjs +64 -92
  48. package/dist/js/floatable/floatable.model.d.mts +2 -0
  49. package/dist/js/floatable/floatable.model.mjs +23 -0
  50. package/dist/js/floatable/floatable.standalone.d.mts +2 -1
  51. package/dist/js/floatable.embedded-MeTyXjFn.d.mts +17 -0
  52. package/dist/js/{floatable.embedded-DQYkXt8X.d.mts → floatable.model-DXsQgoU7.d.mts} +13 -20
  53. package/dist/js/focus-trap/focus-trap.embedded.d.mts +2 -2
  54. package/dist/js/focus-trap/focus-trap.embedded.mjs +113 -135
  55. package/dist/js/focus-trap/focus-trap.model.d.mts +2 -0
  56. package/dist/js/focus-trap/focus-trap.model.mjs +15 -0
  57. package/dist/js/focus-trap/focus-trap.standalone.d.mts +2 -1
  58. package/dist/js/focus-trap.embedded-DIU05m1z.d.mts +13 -0
  59. package/dist/js/{focus-trap.embedded-CjyFQYow.d.mts → focus-trap.model-BeX6UYlw.d.mts} +16 -18
  60. package/dist/js/index.d.mts +26 -14
  61. package/dist/js/index.mjs +18 -17
  62. package/dist/js/internal/attributable.mjs +3 -2
  63. package/dist/js/internal/draggable/draggable.model.d.mts +2 -0
  64. package/dist/js/internal/draggable/draggable.model.mjs +37 -0
  65. package/dist/js/internal/draggable/index.d.mts +13 -0
  66. package/dist/js/internal/{draggable.mjs → draggable/index.mjs} +82 -113
  67. package/dist/js/internal/listbox/listbox.constants.d.mts +1 -1
  68. package/dist/js/internal/listbox/listbox.data.d.mts +1 -1
  69. package/dist/js/internal/listbox/listbox.data.mjs +1 -1
  70. package/dist/js/internal/listbox/listbox.dom.d.mts +1 -1
  71. package/dist/js/internal/listbox/listbox.dom.mjs +1 -1
  72. package/dist/js/internal/listbox/listbox.event.d.mts +1 -1
  73. package/dist/js/internal/listbox/listbox.event.mjs +20 -17
  74. package/dist/js/internal/listbox/listbox.form.d.mts +1 -1
  75. package/dist/js/internal/listbox/listbox.form.mjs +15 -12
  76. package/dist/js/internal/listbox/listbox.misc.d.mts +1 -1
  77. package/dist/js/internal/listbox/listbox.misc.mjs +1 -1
  78. package/dist/js/internal/listbox/listbox.model.d.mts +2 -2
  79. package/dist/js/internal/listbox/listbox.state.d.mts +4 -4
  80. package/dist/js/internal/listbox/listbox.state.mjs +19 -20
  81. package/dist/js/internal/misc.d.mts +1 -0
  82. package/dist/js/internal/misc.mjs +4 -6
  83. package/dist/js/internal/navigable/index.d.mts +6 -0
  84. package/dist/js/internal/navigable/index.mjs +125 -0
  85. package/dist/js/internal/navigable/navigable.model.d.mts +2 -0
  86. package/dist/js/internal/navigable/navigable.model.mjs +18 -0
  87. package/dist/js/l10n/index.d.mts +9 -0
  88. package/dist/js/{l10n.mjs → l10n/index.mjs} +50 -23
  89. package/dist/js/l10n/l10n.model.d.mts +2 -0
  90. package/dist/js/l10n/l10n.model.mjs +9 -0
  91. package/dist/js/l10n.model-D6a9frgl.d.mts +26 -0
  92. package/dist/js/listbox/constants.listbox.d.mts +2 -2
  93. package/dist/js/listbox/constants.listbox.mjs +10 -14
  94. package/dist/js/listbox/event.listbox.d.mts +1 -1
  95. package/dist/js/listbox/event.listbox.mjs +47 -1
  96. package/dist/js/listbox/index.d.mts +6 -4
  97. package/dist/js/listbox/index.mjs +47 -49
  98. package/dist/js/listbox/misc.listbox.d.mts +1 -1
  99. package/dist/js/listbox/misc.listbox.mjs +1 -1
  100. package/dist/js/listbox/state.listbox.d.mts +4 -5
  101. package/dist/js/listbox/state.listbox.mjs +2 -2
  102. package/dist/js/{listbox.data-DQ7-x2uY.mjs → listbox.data-BQyZGKgr.mjs} +87 -70
  103. package/dist/js/{listbox.model-BHPA7GM4.d.mts → listbox.model-CuBOj4qe.d.mts} +12 -8
  104. package/dist/js/menu/index.mjs +167 -0
  105. package/dist/js/menu/menu.model.d.mts +33 -0
  106. package/dist/js/menu/menu.model.mjs +15 -0
  107. package/dist/js/{misc.listbox-DKB-j0UK.mjs → misc.listbox-CjfBUbHD.mjs} +25 -67
  108. package/dist/js/{misc.listbox-mZMuYOxg.d.mts → misc.listbox-CtoGvXQo.d.mts} +2 -2
  109. package/dist/js/movable/movable.embedded.d.mts +2 -2
  110. package/dist/js/movable/movable.embedded.mjs +60 -72
  111. package/dist/js/movable/movable.model.d.mts +2 -0
  112. package/dist/js/movable/movable.model.mjs +12 -0
  113. package/dist/js/movable/movable.standalone.d.mts +2 -1
  114. package/dist/js/movable.embedded-DoyXLegc.d.mts +11 -0
  115. package/dist/js/{draggable-B5-70SZm.d.mts → movable.model-BHaK_mKw.d.mts} +81 -50
  116. package/dist/js/navigable.model-BPOM8DZk.d.mts +44 -0
  117. package/dist/js/popover/index.d.mts +12 -0
  118. package/dist/js/{popover.mjs → popover/index.mjs} +41 -51
  119. package/dist/js/popover/popover.model.d.mts +2 -0
  120. package/dist/js/popover/popover.model.mjs +12 -0
  121. package/dist/js/popover.model-ubKNG612.d.mts +38 -0
  122. package/dist/js/resizable/resizable.embedded.d.mts +2 -2
  123. package/dist/js/resizable/resizable.embedded.mjs +43 -58
  124. package/dist/js/resizable/resizable.model.d.mts +2 -0
  125. package/dist/js/resizable/resizable.model.mjs +21 -0
  126. package/dist/js/resizable/resizable.standalone.d.mts +2 -1
  127. package/dist/js/resizable.embedded-Bf1qBUdt.d.mts +11 -0
  128. package/dist/js/resizable.model-BwzJcTVJ.d.mts +46 -0
  129. package/dist/js/sortable/sortable.embedded.d.mts +2 -2
  130. package/dist/js/sortable/sortable.embedded.mjs +69 -82
  131. package/dist/js/sortable/sortable.model.d.mts +2 -0
  132. package/dist/js/sortable/sortable.model.mjs +24 -0
  133. package/dist/js/sortable/sortable.standalone.d.mts +2 -1
  134. package/dist/js/sortable.embedded-DzBKAwSG.d.mts +11 -0
  135. package/dist/js/{splitter.d.mts → splitter/index.d.mts} +6 -4
  136. package/dist/js/{splitter.mjs → splitter/index.mjs} +90 -128
  137. package/dist/js/splitter/splitter.model.d.mts +2 -0
  138. package/dist/js/splitter/splitter.model.mjs +37 -0
  139. package/dist/js/splitter.model-DOLNjLVS.d.mts +57 -0
  140. package/dist/js/{tabs.d.mts → tabs/index.d.mts} +7 -7
  141. package/dist/js/{tabs.mjs → tabs/index.mjs} +58 -58
  142. package/dist/js/tabs/tabs.model.d.mts +2 -0
  143. package/dist/js/tabs/tabs.model.mjs +18 -0
  144. package/dist/js/tabs.model-DRBX_JtI.d.mts +40 -0
  145. package/dist/js/toolbar/index.mjs +27 -0
  146. package/dist/js/toolbar/toolbar.model.d.mts +11 -0
  147. package/dist/js/toolbar/toolbar.model.mjs +7 -0
  148. package/dist/js/tooltip/index.d.mts +19 -0
  149. package/dist/js/{tooltip.mjs → tooltip/index.mjs} +61 -86
  150. package/dist/js/tooltip/tooltip.model.d.mts +2 -0
  151. package/dist/js/tooltip/tooltip.model.mjs +15 -0
  152. package/dist/js/tooltip.model-DRkY_BsL.d.mts +37 -0
  153. package/package.json +30 -24
  154. package/dist/js/color-picker/constants.color-picker.d.mts +0 -2
  155. package/dist/js/color-picker/misc.color-picker.d.mts +0 -2
  156. package/dist/js/color-picker/models.color-picker.d.mts +0 -2
  157. package/dist/js/color-picker/state.color-picker.d.mts +0 -8
  158. package/dist/js/color-picker/state.color-picker.mjs +0 -2
  159. package/dist/js/combobox/constants.combobox.d.mts +0 -2
  160. package/dist/js/combobox/misc.combobox.d.mts +0 -2
  161. package/dist/js/combobox/models.combobox.d.mts +0 -43
  162. package/dist/js/combobox/state.combobox.d.mts +0 -11
  163. package/dist/js/combobox/state.combobox.mjs +0 -2
  164. package/dist/js/constants.color-picker-B-gFjL8m.d.mts +0 -364
  165. package/dist/js/constants.combobox-8EMRmv09.d.mts +0 -18
  166. package/dist/js/constants.listbox-DGnX32kv.d.mts +0 -8
  167. package/dist/js/dialog.d.mts +0 -47
  168. package/dist/js/dialog.mjs +0 -131
  169. package/dist/js/index-C5D3-oiI.d.mts +0 -177
  170. package/dist/js/internal/draggable.d.mts +0 -2
  171. package/dist/js/internal/navigable.d.mts +0 -36
  172. package/dist/js/internal/navigable.mjs +0 -135
  173. package/dist/js/l10n-Bn-7RcwR.d.mts +0 -20
  174. package/dist/js/l10n.d.mts +0 -2
  175. package/dist/js/menu.mjs +0 -172
  176. package/dist/js/popover.d.mts +0 -38
  177. package/dist/js/resizable.embedded-dvhdfQgt.d.mts +0 -34
  178. package/dist/js/toolbar.mjs +0 -31
  179. package/dist/js/tooltip.d.mts +0 -45
  180. /package/dist/js/combobox/{models.combobox.mjs → combobox.model.mjs} +0 -0
  181. /package/dist/js/{menu.d.mts → menu/index.d.mts} +0 -0
  182. /package/dist/js/{toolbar.d.mts → toolbar/index.d.mts} +0 -0
@@ -1,11 +1,11 @@
1
- import { getLocalization, localize } from "../l10n.mjs";
2
- import { _ as createListboxValueLabel, f as createListboxInput, l as createListboxFilter, m as createListboxMessage, p as createListboxList } from "../listbox.data-DQ7-x2uY.mjs";
3
- import { COMBOBOX_ATTRIBUTE_ANCHOR, COMBOBOX_ATTRIBUTE_SELECTION, COMBOBOX_ATTRIBUTE_SELECTION_ITEM } from "./constants.combobox.mjs";
1
+ import { getLocalization, localize } from "../l10n/index.mjs";
2
+ import { _ as createListboxValueLabel, f as createListboxInput, l as createListboxFilter, m as createListboxMessage, p as createListboxList } from "../listbox.data-BQyZGKgr.mjs";
3
+ import { COMBOBOX_ATTRIBUTE_ANCHOR, COMBOBOX_ATTRIBUTE_SELECTION, COMBOBOX_ATTRIBUTE_SELECTION_ITEM } from "./combobox.constants.mjs";
4
4
  import { setAria } from "@oscarpalmer/toretto/aria";
5
5
  import { setAttribute } from "@oscarpalmer/toretto/attribute";
6
6
  import { createElement } from "@oscarpalmer/toretto/create";
7
7
  import { getData } from "@oscarpalmer/toretto/data";
8
- //#region src/js/combobox/dom.combobox.ts
8
+ //#region src/js/combobox/combobox.dom.ts
9
9
  function createComboboxAnchor(parameters) {
10
10
  const { select } = parameters;
11
11
  let container;
@@ -94,7 +94,7 @@ function createComboboxSelectionItem(option, state) {
94
94
  const optionLabel = option.textContent;
95
95
  const optionValue = getData(option, "value", false) ?? "";
96
96
  const element = createElement("li");
97
- const localization = state == null ? option.textContent : getLocalization(state.localizations.global, state.host, "remove", state.localizations.component);
97
+ const localization = state == null ? option.textContent : getLocalization(state.component.localizations.global, state.component.host, "remove", state.component.localizations.component);
98
98
  const button = createElement("button", {
99
99
  aria: { label: localize(localization, {
100
100
  label: optionLabel,
@@ -133,71 +133,75 @@ function createComboboxSelectionItems(parameters) {
133
133
  }
134
134
  }
135
135
  function updateComboboxTabindices(state, active) {
136
- if (active == null || state.selection == null) return;
137
- const next = state.selection.items.find((item) => getData(item.button, "option", false) === active.id);
136
+ const { selection } = state.component;
137
+ if (active == null || selection == null) return;
138
+ const next = selection.items.find((item) => getData(item.button, "option", false) === active.id);
138
139
  if (next == null) return;
139
- const { length } = state.selection.items;
140
+ const { length } = selection.items;
140
141
  for (let index = 0; index < length; index += 1) {
141
- const item = state.selection.items[index];
142
+ const item = selection.items[index];
142
143
  item.button.tabIndex = item === next ? 0 : -1;
143
144
  }
144
145
  next.button.focus();
145
146
  }
146
147
  function updateComboboxAutocomplete(preview, state, active) {
147
- if (state.multiple) return;
148
- const content = active?.textContent ?? state.filter.element.value;
149
- if (preview === "typed" && !content.toLocaleLowerCase().startsWith(state.filter.element.value.toLocaleLowerCase())) return;
150
- if (state.anchor.element instanceof HTMLInputElement) {
148
+ const { anchor, filter, multiple } = state.component;
149
+ if (multiple) return;
150
+ const content = active?.textContent ?? filter.element.value;
151
+ if (preview === "typed" && !content.toLocaleLowerCase().startsWith(filter.element.value.toLocaleLowerCase())) return;
152
+ if (anchor.element instanceof HTMLInputElement) {
151
153
  const contentLength = content.length;
152
- const filterLength = state.filter.element.value.length;
154
+ const filterLength = filter.element.value.length;
153
155
  if (preview === "set" || preview === "typed") {
154
- state.anchor.element.value = content;
155
- state.anchor.element.setSelectionRange(preview === "typed" ? filterLength : contentLength, contentLength);
156
+ anchor.element.value = content;
157
+ anchor.element.setSelectionRange(preview === "typed" ? filterLength : contentLength, contentLength);
156
158
  }
157
- } else state.anchor.element.textContent = content;
159
+ } else anchor.element.textContent = content;
158
160
  }
159
161
  function updateComboboxSelection(state, active, added, selected) {
160
- if (state.selection == null) return;
162
+ const { anchor, selection } = state.component;
163
+ if (selection == null) return;
161
164
  let options = active == null ? [] : [active];
162
165
  if (added && selected != null) {
163
166
  options = selected;
164
- const { length } = state.selection.items;
165
- for (let index = 0; index < length; index += 1) state.selection.items[index].element.remove();
166
- state.selection.items.splice(0);
167
+ const { length } = selection.items;
168
+ for (let index = 0; index < length; index += 1) selection.items[index].element.remove();
169
+ selection.items.splice(0);
167
170
  }
168
171
  if (added) {
169
172
  createComboboxSelectionItems({
170
173
  options,
171
174
  state,
172
- container: state.selection.container,
173
- items: state.selection.items
175
+ container: selection.container,
176
+ items: selection.items
174
177
  });
175
178
  return;
176
179
  }
177
- let current = state.selection.items.findIndex((item) => getData(item.button, "option", false) === active?.id);
180
+ let current = selection.items.findIndex((item) => getData(item.button, "option", false) === active?.id);
178
181
  if (current === -1) return;
179
- state.selection.items[current].element.remove();
180
- state.selection.items.splice(current, 1);
181
- if (state.selection.items.length === 0) {
182
- state.anchor.element.focus();
182
+ selection.items[current].element.remove();
183
+ selection.items.splice(current, 1);
184
+ if (selection.items.length === 0) {
185
+ anchor.element.focus();
183
186
  return;
184
187
  }
185
- const { length } = state.selection.items;
188
+ const { length } = selection.items;
186
189
  if (current < 0) current = 0;
187
190
  else if (current >= length) current = length - 1;
188
191
  for (let index = 0; index < length; index += 1) {
189
- const { button } = state.selection.items[index];
192
+ const { button } = selection.items[index];
190
193
  button.tabIndex = index === current ? 0 : -1;
191
194
  }
192
- state.selection.items[current].button.focus();
195
+ selection.items[current].button.focus();
193
196
  }
194
197
  function updateComboboxSelectionItems(state) {
195
- if (state.selection == null) return;
196
- const localization = getLocalization(state.localizations.global, state.host, "remove", state.localizations.component);
197
- const { length } = state.selection.items;
198
+ const { host, localizations, options, selection } = state.component;
199
+ if (selection == null) return;
200
+ const localization = getLocalization(localizations.global, host, "remove", localizations.component);
201
+ const { length } = selection.items;
198
202
  for (let index = 0; index < length; index += 1) {
199
- const item = state.selection.items[index];
200
- const option = state.options.selected.find((option) => option.id === getData(item.button, "option", false));
203
+ const item = selection.items[index];
204
+ const option = options.selected.find((option) => option.id === getData(item.button, "option", false));
201
205
  if (option == null) continue;
202
206
  const optionLabel = option.textContent;
203
207
  const optionValue = getData(option, "value", false) ?? "";
@@ -1,6 +1,6 @@
1
- import { c as OuiListboxPreview } from "../listbox.model-BHPA7GM4.mjs";
2
- import { OuiComboboxState } from "./models.combobox.mjs";
3
- //#region src/js/combobox/event.combobox.d.ts
1
+ import { c as OuiListboxPreview } from "../listbox.model-CuBOj4qe.mjs";
2
+ import { c as OuiComboboxState } from "../combobox.model-oDV06XCN.mjs";
3
+ //#region src/js/combobox/combobox.event.d.ts
4
4
  export declare function onComboboxActivation(state: OuiComboboxState): void;
5
5
  export declare function onComboboxApply(state: OuiComboboxState, option: HTMLElement | undefined, _: string[], added: boolean, selected?: HTMLElement[]): void;
6
6
  export declare function onComboboxClickContent(event: PointerEvent, state: OuiComboboxState): void;
@@ -1,2 +1,2 @@
1
- import { C as skipComboboxNavigation, S as preventComboboxActivation, _ as onComboboxPreview, b as onComboboxTab, c as onComboboxClickContent, d as onComboboxFilter, f as onComboboxFocusout, g as onComboboxNavigation, h as onComboboxKeydownSelection, l as onComboboxEnter, m as onComboboxKeydown, o as onComboboxActivation, p as onComboboxInput, s as onComboboxApply, u as onComboboxEscape, v as onComboboxRemoveSelection, x as onComboboxToggle, y as onComboboxSelection } from "../state.combobox-BWDFHwoi.mjs";
1
+ import { C as skipComboboxNavigation, S as preventComboboxActivation, _ as onComboboxPreview, b as onComboboxTab, c as onComboboxClickContent, d as onComboboxFilter, f as onComboboxFocusout, g as onComboboxNavigation, h as onComboboxKeydownSelection, l as onComboboxEnter, m as onComboboxKeydown, o as onComboboxActivation, p as onComboboxInput, s as onComboboxApply, u as onComboboxEscape, v as onComboboxRemoveSelection, x as onComboboxToggle, y as onComboboxSelection } from "../combobox.state-BfJ3Hxg8.mjs";
2
2
  export { onComboboxActivation, onComboboxApply, onComboboxClickContent, onComboboxEnter, onComboboxEscape, onComboboxFilter, onComboboxFocusout, onComboboxInput, onComboboxKeydown, onComboboxKeydownSelection, onComboboxNavigation, onComboboxPreview, onComboboxRemoveSelection, onComboboxSelection, onComboboxTab, onComboboxToggle, preventComboboxActivation, skipComboboxNavigation };
@@ -0,0 +1,2 @@
1
+ import { a as updateComboboxLocalizations, i as setComboboxLocalizations, n as getComboboxId, r as hasTextSelection, t as getComboboxAutoComplete } from "../combobox.misc-C1tPZZDi.mjs";
2
+ export { getComboboxAutoComplete, getComboboxId, hasTextSelection, setComboboxLocalizations, updateComboboxLocalizations };
@@ -1,2 +1,2 @@
1
- import { D as setComboboxLocalizations, E as hasTextSelection, O as updateComboboxLocalizations, T as getComboboxId, w as getComboboxAutoComplete } from "../state.combobox-BWDFHwoi.mjs";
1
+ import { D as setComboboxLocalizations, E as hasTextSelection, O as updateComboboxLocalizations, T as getComboboxId, w as getComboboxAutoComplete } from "../combobox.state-BfJ3Hxg8.mjs";
2
2
  export { getComboboxAutoComplete, getComboboxId, hasTextSelection, setComboboxLocalizations, updateComboboxLocalizations };
@@ -0,0 +1,2 @@
1
+ import { a as OuiComboboxOptions, c as OuiComboboxState, i as OuiComboboxLabel, l as OuiComboboxValues, n as OuiComboboxFilter, o as OuiComboboxSelection, r as OuiComboboxGroup, s as OuiComboboxSelectionItem, t as OuiComboboxAnchor } from "../combobox.model-oDV06XCN.mjs";
2
+ export { OuiComboboxAnchor, OuiComboboxFilter, OuiComboboxGroup, OuiComboboxLabel, OuiComboboxOptions, OuiComboboxSelection, OuiComboboxSelectionItem, OuiComboboxState, OuiComboboxValues };
@@ -0,0 +1,10 @@
1
+ import { c as OuiLocalizations } from "../l10n.model-D6a9frgl.mjs";
2
+ import { o as OuiListboxLocalizations } from "../listbox.model-CuBOj4qe.mjs";
3
+ import { c as OuiComboboxState } from "../combobox.model-oDV06XCN.mjs";
4
+ //#region src/js/combobox/combobox.state.d.ts
5
+ export declare function initializeCombobox(element: HTMLElement, state: OuiComboboxState): void;
6
+ export declare function onAttachCombobox(state: OuiComboboxState): void;
7
+ export declare function onDetachCombobox(state: OuiComboboxState): void;
8
+ export declare const comboboxLocalizations: OuiLocalizations<OuiListboxLocalizations>;
9
+ export declare const comboboxes: Set<OuiComboboxState>;
10
+ //#endregion
@@ -0,0 +1,2 @@
1
+ import { a as onDetachCombobox, i as onAttachCombobox, n as comboboxes, r as initializeCombobox, t as comboboxLocalizations } from "../combobox.state-BfJ3Hxg8.mjs";
2
+ export { comboboxLocalizations, comboboxes, initializeCombobox, onAttachCombobox, onDetachCombobox };
@@ -1,2 +1,163 @@
1
- import { a as setComboboxLocalizations, t as OuiComboboxElement } from "../index-C5D3-oiI.mjs";
2
- export { OuiComboboxElement, setComboboxLocalizations };
1
+ import { f as OuiListboxType, o as OuiListboxLocalizations } from "../listbox.model-CuBOj4qe.mjs";
2
+ import { a as COMBOBOX_SYMBOL, o as COMBOBOX_TAGNAME } from "../combobox.constants-DZVkMP5g.mjs";
3
+ import { c as OuiComboboxState } from "../combobox.model-oDV06XCN.mjs";
4
+ import { i as setComboboxLocalizations } from "../combobox.misc-C1tPZZDi.mjs";
5
+ //#region src/js/combobox/index.d.ts
6
+ declare global {
7
+ interface HTMLElementTagNameMap {
8
+ [COMBOBOX_TAGNAME]: OuiComboboxElement & {
9
+ [COMBOBOX_SYMBOL]: OuiComboboxState;
10
+ };
11
+ }
12
+ }
13
+ export interface OuiComboboxElement {
14
+ [COMBOBOX_SYMBOL]: OuiComboboxState;
15
+ }
16
+ export declare class OuiComboboxElement extends HTMLElement {
17
+ static formAssociated: boolean;
18
+ static observedAttributes: string[];
19
+ /**
20
+ * Is the combobox disabled?
21
+ */
22
+ get disabled(): boolean;
23
+ /**
24
+ * Should the combobox be disabled?
25
+ */
26
+ set disabled(value: boolean);
27
+ /**
28
+ * Current filter value
29
+ */
30
+ get filter(): string;
31
+ /**
32
+ * Set the filter value
33
+ */
34
+ set filter(value: string);
35
+ /**
36
+ * Form element associated with the combobox
37
+ */
38
+ get form(): HTMLFormElement | null;
39
+ /**
40
+ * Label elements associated with the combobox
41
+ */
42
+ get labels(): NodeList;
43
+ /**
44
+ * Maximum number of selected options
45
+ */
46
+ get max(): number | undefined;
47
+ /**
48
+ * Set the maximum number of selected options
49
+ */
50
+ set max(value: number);
51
+ /**
52
+ * Minimum number of selected options
53
+ */
54
+ get min(): number | undefined;
55
+ /**
56
+ * Set the minimum number of selected options
57
+ */
58
+ set min(value: number);
59
+ /**
60
+ * Does the combobox allow multiple values?
61
+ */
62
+ get multiple(): boolean;
63
+ /**
64
+ * Name of the combobox
65
+ */
66
+ get name(): string;
67
+ /**
68
+ * Is the combobox readonly?
69
+ */
70
+ get readonly(): boolean;
71
+ /**
72
+ * Should the combobox be readonly?
73
+ */
74
+ set readonly(value: boolean);
75
+ /**
76
+ * Is the combobox required?
77
+ */
78
+ get required(): boolean;
79
+ /**
80
+ * Should the combobox be required?
81
+ */
82
+ set required(value: boolean);
83
+ /**
84
+ * Selected options
85
+ */
86
+ get selected(): HTMLElement[];
87
+ /**
88
+ * Type of combobox
89
+ */
90
+ get type(): OuiListboxType;
91
+ /**
92
+ * Validation message for the combobox
93
+ */
94
+ get validationMessage(): string;
95
+ /**
96
+ * Validity state for the combobox
97
+ */
98
+ get validity(): ValidityState;
99
+ /**
100
+ * Current value
101
+ */
102
+ get value(): string;
103
+ /**
104
+ * Set the value
105
+ */
106
+ set value(value: unknown);
107
+ /**
108
+ * Current values
109
+ */
110
+ get values(): string[];
111
+ /**
112
+ * Set the values
113
+ */
114
+ set values(values: unknown[]);
115
+ /**
116
+ * Can the combobox be validated?
117
+ */
118
+ get willValidate(): boolean;
119
+ constructor();
120
+ attributeChangedCallback(name: string, _: string | null, value: string | null): void;
121
+ /**
122
+ * Check if the combobox is valid
123
+ *
124
+ * @returns `true` if the combobox is valid, otherwise `false`
125
+ */
126
+ checkValidity(): boolean;
127
+ /**
128
+ * Clear all selected options
129
+ */
130
+ clear(): void;
131
+ connectedCallback(): void;
132
+ disconnectedCallback(): void;
133
+ formDisabledCallback(disabled: boolean): void;
134
+ formResetCallback(): void;
135
+ formStateRestoreCallback(state: unknown, reason: unknown): void;
136
+ /**
137
+ * Check if the combobox is valid and report any validation errors
138
+ *
139
+ * @returns `true` if the combobox is valid, otherwise `false`
140
+ */
141
+ reportValidity(): boolean;
142
+ /**
143
+ * Set a custom validation message for the combobox
144
+ *
145
+ * @param message Validation message
146
+ */
147
+ setCustomValidity(message: string): void;
148
+ /**
149
+ * Set combobox localizations for a specific language
150
+ *
151
+ * @param language Language code
152
+ * @param localizations Localizations for language
153
+ */
154
+ setLocalizations(language: string, localizations: Partial<OuiListboxLocalizations>): void;
155
+ /**
156
+ * Set combobox localizations for one or more languages
157
+ *
158
+ * @param localizations Localizations for one or more languages
159
+ */
160
+ setLocalizations(localizations: Record<string, Partial<OuiListboxLocalizations>>): void;
161
+ }
162
+ //#endregion
163
+ export { setComboboxLocalizations };
@@ -1,8 +1,8 @@
1
- import { updateLocalizations } from "../l10n.mjs";
2
- import { C as setListboxDisabled, D as setListboxReadonly, O as setListboxRequired, T as setListboxLimit, a as setListboxValue, o as setListboxValues, w as setListboxFilter } from "../listbox.data-DQ7-x2uY.mjs";
1
+ import { updateLocalizations } from "../l10n/index.mjs";
2
+ import { C as setListboxDisabled, D as setListboxReadonly, O as setListboxRequired, T as setListboxLimit, a as setListboxValue, o as setListboxValues, w as setListboxFilter } from "../listbox.data-BQyZGKgr.mjs";
3
3
  import { attachListbox, detachListbox } from "../internal/listbox/listbox.state.mjs";
4
- import { COMBOBOX_TAGNAME } from "./constants.combobox.mjs";
5
- import { D as setComboboxLocalizations, a as onDetachCombobox, i as onAttachCombobox, n as comboboxStates, r as createComboboxState } from "../state.combobox-BWDFHwoi.mjs";
4
+ import { COMBOBOX_SYMBOL, COMBOBOX_TAGNAME } from "./combobox.constants.mjs";
5
+ import { D as setComboboxLocalizations, a as onDetachCombobox, i as onAttachCombobox, n as comboboxes, r as initializeCombobox } from "../combobox.state-BfJ3Hxg8.mjs";
6
6
  import { getAttribute } from "@oscarpalmer/toretto/attribute";
7
7
  import { parse } from "@oscarpalmer/atoms/string";
8
8
  //#region src/js/combobox/index.ts
@@ -14,68 +14,65 @@ var OuiComboboxElement = class extends HTMLElement {
14
14
  "required",
15
15
  "value"
16
16
  ];
17
- #internals;
18
- #restored;
19
- #state;
20
17
  /**
21
18
  * Is the combobox disabled?
22
19
  */
23
20
  get disabled() {
24
- return this.#state?.disabled ?? false;
21
+ return this[COMBOBOX_SYMBOL].component?.disabled ?? false;
25
22
  }
26
23
  /**
27
24
  * Should the combobox be disabled?
28
25
  */
29
26
  set disabled(value) {
30
- if (typeof value === "boolean" && value !== this.disabled) setListboxDisabled(this.#state, value);
27
+ if (typeof value === "boolean" && value !== this.disabled) setListboxDisabled(this[COMBOBOX_SYMBOL], value);
31
28
  }
32
29
  /**
33
30
  * Current filter value
34
31
  */
35
32
  get filter() {
36
- return this.#state.filter.element.value;
33
+ return this[COMBOBOX_SYMBOL].component?.filter.element.value ?? "";
37
34
  }
38
35
  /**
39
36
  * Set the filter value
40
37
  */
41
38
  set filter(value) {
42
- setListboxFilter(this.#state, value);
39
+ setListboxFilter(this[COMBOBOX_SYMBOL], value);
43
40
  }
44
41
  /**
45
42
  * Form element associated with the combobox
46
43
  */
47
44
  get form() {
48
- return this.#internals.form;
45
+ return this[COMBOBOX_SYMBOL].form.internals.form;
49
46
  }
50
47
  /**
51
48
  * Label elements associated with the combobox
52
49
  */
53
50
  get labels() {
54
- return this.#internals.labels;
51
+ return this[COMBOBOX_SYMBOL].form.internals.labels;
55
52
  }
56
53
  /**
57
54
  * Maximum number of selected options
58
55
  */
59
56
  get max() {
60
- return this.#state?.max;
57
+ return this[COMBOBOX_SYMBOL].component?.max;
61
58
  }
62
59
  /**
63
60
  * Set the maximum number of selected options
64
61
  */
65
62
  set max(value) {
66
- setListboxLimit("max", this.#state, value);
63
+ setListboxLimit("max", this[COMBOBOX_SYMBOL], value);
67
64
  }
68
65
  /**
69
66
  * Minimum number of selected options
70
67
  */
71
68
  get min() {
72
- return this.#state?.min;
69
+ return this[COMBOBOX_SYMBOL].component?.min;
73
70
  }
74
71
  /**
75
72
  * Set the minimum number of selected options
76
73
  */
77
74
  set min(value) {
78
- setListboxLimit("min", this.#state, value);
75
+ setListboxLimit("min", this[COMBOBOX_SYMBOL], value);
79
76
  }
80
77
  /**
81
78
  * Does the combobox allow multiple values?
@@ -93,93 +90,97 @@ var OuiComboboxElement = class extends HTMLElement {
93
90
  * Is the combobox readonly?
94
91
  */
95
92
  get readonly() {
96
- return this.#state?.readonly ?? false;
93
+ return this[COMBOBOX_SYMBOL].component?.readonly ?? false;
97
94
  }
98
95
  /**
99
96
  * Should the combobox be readonly?
100
97
  */
101
98
  set readonly(value) {
102
- if (typeof value === "boolean" && value !== this.readonly) setListboxReadonly(this.#state, value);
99
+ if (typeof value === "boolean" && value !== this.readonly) setListboxReadonly(this[COMBOBOX_SYMBOL], value);
103
100
  }
104
101
  /**
105
102
  * Is the combobox required?
106
103
  */
107
104
  get required() {
108
- return this.#state?.required ?? false;
105
+ return this[COMBOBOX_SYMBOL].component?.required ?? false;
109
106
  }
110
107
  /**
111
108
  * Should the combobox be required?
112
109
  */
113
110
  set required(value) {
114
- if (typeof value === "boolean" && value !== this.required) setListboxRequired(this.#state, value);
111
+ if (typeof value === "boolean" && value !== this.required) setListboxRequired(this[COMBOBOX_SYMBOL], value);
115
112
  }
116
113
  /**
117
114
  * Selected options
118
115
  */
119
116
  get selected() {
120
- return this.#state.options.selected.slice();
117
+ return this[COMBOBOX_SYMBOL].component?.options.selected.slice() ?? [];
121
118
  }
122
119
  /**
123
120
  * Type of combobox
124
121
  */
125
122
  get type() {
126
- return this.#state.type;
123
+ return this[COMBOBOX_SYMBOL].component?.type;
127
124
  }
128
125
  /**
129
126
  * Validation message for the combobox
130
127
  */
131
128
  get validationMessage() {
132
- return this.#internals.validationMessage;
129
+ return this[COMBOBOX_SYMBOL].form.internals.validationMessage;
133
130
  }
134
131
  /**
135
132
  * Validity state for the combobox
136
133
  */
137
134
  get validity() {
138
- return this.#internals.validity;
135
+ return this[COMBOBOX_SYMBOL].form.internals.validity;
139
136
  }
140
137
  /**
141
138
  * Current value
142
139
  */
143
140
  get value() {
144
- return this.#state.values.current[0];
141
+ return this[COMBOBOX_SYMBOL].component?.values.current[0] ?? "";
145
142
  }
146
143
  /**
147
144
  * Set the value
148
145
  */
149
146
  set value(value) {
150
- setListboxValue(this.#state, value);
147
+ setListboxValue(this[COMBOBOX_SYMBOL], value);
151
148
  }
152
149
  /**
153
150
  * Current values
154
151
  */
155
152
  get values() {
156
- return this.#state.values.current.slice();
153
+ return this[COMBOBOX_SYMBOL].component?.values.current.slice() ?? [];
157
154
  }
158
155
  /**
159
156
  * Set the values
160
157
  */
161
158
  set values(values) {
162
- setListboxValues(this.#state, values);
159
+ setListboxValues(this[COMBOBOX_SYMBOL], values);
163
160
  }
164
161
  /**
165
162
  * Can the combobox be validated?
166
163
  */
167
164
  get willValidate() {
168
- return this.#internals.willValidate;
165
+ return this[COMBOBOX_SYMBOL].form.internals.willValidate;
169
166
  }
170
167
  constructor() {
171
168
  super();
172
- this.#internals = this.attachInternals();
169
+ this[COMBOBOX_SYMBOL] = {
170
+ component: null,
171
+ form: { internals: this.attachInternals() }
172
+ };
173
173
  }
174
174
  attributeChangedCallback(name, _, value) {
175
- if (this.#state == null) return;
175
+ const state = this[COMBOBOX_SYMBOL];
176
+ if (state == null) return;
176
177
  switch (name) {
177
178
  case "required":
178
179
  this[name] = this.hasAttribute(name);
179
180
  break;
180
181
  case "max":
181
182
  case "min":
182
- setListboxLimit(name, this.#state, value);
183
+ setListboxLimit(name, state, value);
183
184
  break;
184
185
  case "value": this.value = value ?? "";
185
186
  }
@@ -190,33 +191,40 @@ var OuiComboboxElement = class extends HTMLElement {
190
191
  * @returns `true` if the combobox is valid, otherwise `false`
191
192
  */
192
193
  checkValidity() {
193
- return this.#internals.checkValidity();
194
+ return this[COMBOBOX_SYMBOL].form.internals.checkValidity();
194
195
  }
195
196
  /**
196
197
  * Clear all selected options
197
198
  */
198
199
  clear() {
199
- setListboxValues(this.#state, []);
200
+ setListboxValues(this[COMBOBOX_SYMBOL], []);
200
201
  }
201
202
  connectedCallback() {
202
- if (this.#state == null) this.#initialize();
203
- else attachListbox(this.#state, comboboxStates, onAttachCombobox);
203
+ const state = this[COMBOBOX_SYMBOL];
204
+ if (state.component == null) initializeCombobox(this, state);
205
+ else attachListbox(state, comboboxes, onAttachCombobox);
204
206
  }
205
207
  disconnectedCallback() {
206
- if (this.#state != null) detachListbox(this.#state, comboboxStates, onDetachCombobox);
208
+ const state = this[COMBOBOX_SYMBOL];
209
+ if (state.component != null) detachListbox(state, comboboxes, onDetachCombobox);
207
210
  }
208
211
  formDisabledCallback(disabled) {
209
212
  this.disabled = disabled;
210
213
  }
211
214
  formResetCallback() {
212
- setListboxValues(this.#state, this.#state.values.initial);
215
+ const state = this[COMBOBOX_SYMBOL];
216
+ if (state.component != null) setListboxValues(state, state.component.values.initial);
213
217
  }
214
218
  formStateRestoreCallback(state, reason) {
215
219
  if (reason !== "restore") return;
216
220
  const parsed = typeof state === "string" ? parse(state) : void 0;
217
221
  if (!Array.isArray(parsed)) return;
218
- if (this.#state == null) this.#restored = parsed;
219
- else setListboxValues(this.#state, parsed);
222
+ const { component, form } = this[COMBOBOX_SYMBOL];
223
+ if (component == null) form.restored = parsed;
224
+ else setListboxValues({
225
+ component,
226
+ form
227
+ }, parsed);
220
228
  }
221
229
  /**
222
230
  * Check if the combobox is valid and report any validation errors
@@ -224,7 +232,7 @@ var OuiComboboxElement = class extends HTMLElement {
224
232
  * @returns `true` if the combobox is valid, otherwise `false`
225
233
  */
226
234
  reportValidity() {
227
- return this.#internals.reportValidity();
235
+ return this[COMBOBOX_SYMBOL].form.internals.reportValidity();
228
236
  }
229
237
  /**
230
238
  * Set a custom validation message for the combobox
@@ -232,18 +240,11 @@ var OuiComboboxElement = class extends HTMLElement {
232
240
  * @param message Validation message
233
241
  */
234
242
  setCustomValidity(message) {
235
- this.#internals.setValidity({ customError: message !== "" }, message, this);
243
+ this[COMBOBOX_SYMBOL].form.internals.setValidity({ customError: message !== "" }, message, this);
236
244
  }
237
245
  setLocalizations(first, second) {
238
- updateLocalizations(this.#state.localizations.global, typeof first === "string" ? { [first]: second } : first, this.#state.localizations.component);
239
- }
240
- #initialize() {
241
- this.tabIndex = -1;
242
- this.#state = createComboboxState(this, this.#internals);
243
- if (this.#restored != null) {
244
- setListboxValues(this.#state, this.#restored);
245
- this.#restored = void 0;
246
- }
246
+ const { localizations } = this[COMBOBOX_SYMBOL].component;
247
+ updateLocalizations(localizations.global, typeof first === "string" ? { [first]: second } : first, localizations.component);
247
248
  }
248
249
  };
249
250
  customElements.define(COMBOBOX_TAGNAME, OuiComboboxElement);
@@ -0,0 +1,19 @@
1
+ import { r as OuiListboxAutoCompleteType, t as OuiListboxAttributes } from "./listbox.model-CuBOj4qe.mjs";
2
+ //#region src/js/combobox/combobox.constants.d.ts
3
+ declare const COMBOBOX_TAGNAME = "oui-combobox";
4
+ declare const COMBOBOX_ATTRIBUTE_ANCHOR: string;
5
+ declare const COMBOBOX_ATTRIBUTE_SELECTION: string;
6
+ declare const COMBOBOX_ATTRIBUTE_SELECTION_ITEM: string;
7
+ declare const COMBOBOX_AUTOCOMPLETES: Set<OuiListboxAutoCompleteType>;
8
+ declare const COMBOBOX_SYMBOL: unique symbol;
9
+ declare const comboboxAttributes: OuiListboxAttributes;
10
+ declare const messageLabel: string;
11
+ declare const messageSelect: string;
12
+ declare const comboboxMessages: Record<string, string>;
13
+ declare const selectorAnchor: string;
14
+ declare const selectorContent: string;
15
+ declare const selectorOption: string;
16
+ declare const selectorSelectionItem: string;
17
+ declare const comboboxSelectors: Record<string, string>;
18
+ //#endregion
19
+ export { COMBOBOX_SYMBOL as a, comboboxMessages as c, messageSelect as d, selectorAnchor as f, selectorSelectionItem as h, COMBOBOX_AUTOCOMPLETES as i, comboboxSelectors as l, selectorOption as m, COMBOBOX_ATTRIBUTE_SELECTION as n, COMBOBOX_TAGNAME as o, selectorContent as p, COMBOBOX_ATTRIBUTE_SELECTION_ITEM as r, comboboxAttributes as s, COMBOBOX_ATTRIBUTE_ANCHOR as t, messageLabel as u };