@oscarpalmer/oui 0.32.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 (59) hide show
  1. package/dist/css/combobox.css +93 -42
  2. package/dist/js/combobox/constants.combobox.d.mts +2 -0
  3. package/dist/js/combobox/constants.combobox.mjs +46 -0
  4. package/dist/js/combobox/data.combobox.d.mts +18 -0
  5. package/dist/js/combobox/data.combobox.mjs +2 -0
  6. package/dist/js/combobox/dom.combobox.d.mts +110 -0
  7. package/dist/js/combobox/dom.combobox.mjs +2 -0
  8. package/dist/js/combobox/event.combobox.d.mts +17 -0
  9. package/dist/js/combobox/event.combobox.mjs +2 -0
  10. package/dist/js/combobox/form.combobox.d.mts +6 -0
  11. package/dist/js/combobox/form.combobox.mjs +2 -0
  12. package/dist/js/combobox/i18n.combobox.d.mts +2 -0
  13. package/dist/js/combobox/i18n.combobox.mjs +2 -0
  14. package/dist/js/combobox/index.d.mts +2 -0
  15. package/dist/js/combobox/index.mjs +194 -0
  16. package/dist/js/combobox/misc.combobox.d.mts +14 -0
  17. package/dist/js/combobox/misc.combobox.mjs +2 -0
  18. package/dist/js/combobox/models.combobox.d.mts +2 -0
  19. package/dist/js/combobox/models.combobox.mjs +1 -0
  20. package/dist/js/combobox/state.combobox.d.mts +11 -0
  21. package/dist/js/combobox/state.combobox.mjs +2 -0
  22. package/dist/js/constants.combobox-DqNUGBLS.d.mts +243 -0
  23. package/dist/js/data.combobox-8RwBv5ey.mjs +1077 -0
  24. package/dist/js/dialog.mjs +3 -2
  25. package/dist/js/floatable/floatable.embedded.mjs +4 -4
  26. package/dist/js/focus-trap/focus-trap.embedded.mjs +3 -3
  27. package/dist/js/index.d.mts +3 -3
  28. package/dist/js/index.mjs +3 -2
  29. package/dist/js/internal/draggable.mjs +6 -6
  30. package/dist/js/internal/navigable.mjs +3 -3
  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/tooltip.mjs +3 -3
  38. package/package.json +6 -6
  39. package/src/css/combobox.scss +98 -31
  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/internal/navigable.ts +10 -3
  53. package/src/js/movable/movable.embedded.ts +2 -2
  54. package/src/js/resizable/resizable.embedded.ts +3 -3
  55. package/src/js/sortable/sortable.embedded.ts +2 -2
  56. package/src/js/splitter.ts +2 -2
  57. package/dist/js/combobox.d.mts +0 -91
  58. package/dist/js/combobox.mjs +0 -855
  59. package/src/js/combobox.ts +0 -1634
@@ -4,8 +4,8 @@ import { ATTRIBUTE_MOVABLE_HANDLE, createMovable } from "./movable/movable.embed
4
4
  import "./movable/movable.standalone.mjs";
5
5
  import { RESIZABLE_ATTRIBUTE_HANDLE, createResizable } from "./resizable/resizable.embedded.mjs";
6
6
  import { getAria, setAria } from "@oscarpalmer/toretto/aria";
7
- import { getAttribute, setAttribute } from "@oscarpalmer/toretto/attribute";
8
7
  import { on } from "@oscarpalmer/toretto/event";
8
+ import { getAttribute, setAttribute } from "@oscarpalmer/toretto/attribute";
9
9
  import { setStyles } from "@oscarpalmer/toretto/style";
10
10
  //#region src/js/dialog.ts
11
11
  var OuiDialog = class {
@@ -88,7 +88,8 @@ function getState(element) {
88
88
  listeners: [getOnBeforeToggleListener(element), on(element, "toggle", (event) => {
89
89
  const { source } = event;
90
90
  if (element.open) {
91
- setAria(element, "modal", source instanceof HTMLButtonElement && source.command === "show-modal" || element.matches(":modal"));
91
+ const modal = source instanceof HTMLButtonElement && source.command === "show-modal" || element.matches(":modal");
92
+ setAria(element, "modal", modal);
92
93
  setAttribute(element, ATTRIBUTE_OPEN, "");
93
94
  element.focus();
94
95
  setTimeout(() => {
@@ -1,9 +1,9 @@
1
1
  import { getAria } from "@oscarpalmer/toretto/aria";
2
- import { getAttribute, setAttribute } from "@oscarpalmer/toretto/attribute";
3
2
  import { on } from "@oscarpalmer/toretto/event";
4
- import { setStyle, setStyles } from "@oscarpalmer/toretto/style";
5
3
  import { isPlainObject } from "@oscarpalmer/atoms/is";
4
+ import { getAttribute, setAttribute } from "@oscarpalmer/toretto/attribute";
6
5
  import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
6
+ import { setStyle, setStyles } from "@oscarpalmer/toretto/style";
7
7
  //#region src/js/floatable/floatable.embedded.ts
8
8
  var OuiFloatable = class {
9
9
  #destroyed = false;
@@ -111,7 +111,7 @@ function getOptions(input) {
111
111
  position: object.position != null && object.position in AREAS ? object.position : "below"
112
112
  };
113
113
  }
114
- function getPosition$1(state, override) {
114
+ function getPosition(state, override) {
115
115
  if (override != null && override in AREAS) return override;
116
116
  const { anchor, options } = state;
117
117
  if (options.attribute == null) return options.position;
@@ -131,7 +131,7 @@ function removeFloatable(content) {
131
131
  instances.delete(content);
132
132
  }
133
133
  function setPosition(state, override) {
134
- const position = getPosition$1(state, override);
134
+ const position = getPosition(state, override);
135
135
  const area = AREAS[position];
136
136
  setAttribute(state.content, ATTRIBUTE_POSITION, POSITIONS[area]);
137
137
  setStyles(state.content, {
@@ -1,10 +1,10 @@
1
1
  import { attributable } from "../internal/attributable.mjs";
2
- import { clamp } from "@oscarpalmer/atoms/number";
3
- import { setAttribute } from "@oscarpalmer/toretto/attribute";
4
2
  import { dispatch, on } from "@oscarpalmer/toretto/event";
5
- import { findAncestor } from "@oscarpalmer/toretto/find";
6
3
  import { isPlainObject } from "@oscarpalmer/atoms/is";
4
+ import { setAttribute } from "@oscarpalmer/toretto/attribute";
7
5
  import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
6
+ import { clamp } from "@oscarpalmer/atoms/number";
7
+ import { findAncestor } from "@oscarpalmer/toretto/find";
8
8
  import { getFocusable } from "@oscarpalmer/toretto/focusable";
9
9
  //#region src/js/focus-trap/focus-trap.embedded.ts
10
10
  var OuiFocusTrap = class {
@@ -1,14 +1,14 @@
1
- import { OuiComboboxElement } from "./combobox.mjs";
1
+ import { a as OuiFloatablePosition, n as CreateOuiFloatableOptions, r as OuiFloatable, s as createFloatable } from "./floatable.embedded-Bct4U5Dm.mjs";
2
+ import { H as setComboboxLocalizations, z as OuiComboboxElement } from "./constants.combobox-DqNUGBLS.mjs";
2
3
  import { d as OuiSortable, f as createSortable, g as createMovable, h as OuiMovable, t as CreateOuiDraggableOptions } from "./draggable-a6w0J1OD.mjs";
3
4
  import "./movable/movable.standalone.mjs";
4
5
  import { a as createResizable, n as OuiResizable, t as CreateOuiResizableOptions } from "./resizable.embedded-3qoR0Bjm.mjs";
5
6
  import "./resizable/resizable.standalone.mjs";
6
7
  import { OuiDialog, getDialog } from "./dialog.mjs";
7
- import { a as OuiFloatablePosition, n as CreateOuiFloatableOptions, r as OuiFloatable, s as createFloatable } from "./floatable.embedded-Bct4U5Dm.mjs";
8
8
  import "./floatable/floatable.standalone.mjs";
9
9
  import { a as OuiFocusTrapOptions, i as OuiFocusTrap, o as createFocusTrap } from "./focus-trap.embedded-DR8NpZfr.mjs";
10
10
  import { OuiPopover, getPopover } from "./popover.mjs";
11
11
  import "./sortable/sortable.standalone.mjs";
12
12
  import { OuiSplitterElement } from "./splitter.mjs";
13
13
  import { OuiTooltip, getTooltip, setTooltipDelay } from "./tooltip.mjs";
14
- export { type CreateOuiFloatableOptions, type CreateOuiDraggableOptions as CreateOuiMovableOptions, type CreateOuiDraggableOptions as CreateOuiSortableOptions, type CreateOuiResizableOptions, OuiComboboxElement, type OuiDialog, type OuiFloatable, type OuiFloatablePosition, type OuiFocusTrap, type OuiFocusTrapOptions, type OuiMovable, type OuiPopover, type OuiResizable, type OuiSortable, OuiSplitterElement, type OuiTooltip, createFloatable, createFocusTrap, createMovable, createResizable as createOuiResizable, createSortable, getDialog, getPopover, getTooltip, setTooltipDelay };
14
+ export { type CreateOuiFloatableOptions, type CreateOuiDraggableOptions as CreateOuiMovableOptions, type CreateOuiDraggableOptions as CreateOuiSortableOptions, type CreateOuiResizableOptions, OuiComboboxElement, type OuiDialog, type OuiFloatable, type OuiFloatablePosition, type OuiFocusTrap, type OuiFocusTrapOptions, type OuiMovable, type OuiPopover, type OuiResizable, type OuiSortable, OuiSplitterElement, type OuiTooltip, createFloatable, createFocusTrap, createMovable, createResizable as createOuiResizable, createSortable, getDialog, getPopover, getTooltip, setComboboxLocalizations, setTooltipDelay };
package/dist/js/index.mjs CHANGED
@@ -1,11 +1,12 @@
1
1
  import { createFloatable } from "./floatable/floatable.embedded.mjs";
2
- import { OuiComboboxElement } from "./combobox.mjs";
3
2
  import { createMovable } from "./movable/movable.embedded.mjs";
4
3
  import "./movable/movable.standalone.mjs";
5
4
  import { createResizable } from "./resizable/resizable.embedded.mjs";
6
5
  import { getDialog } from "./dialog.mjs";
7
6
  import "./menu.mjs";
8
7
  import "./toolbar.mjs";
8
+ import { F as setComboboxLocalizations } from "./data.combobox-8RwBv5ey.mjs";
9
+ import { OuiComboboxElement } from "./combobox/index.mjs";
9
10
  import "./floatable/floatable.standalone.mjs";
10
11
  import { createFocusTrap } from "./focus-trap/focus-trap.embedded.mjs";
11
12
  import "./focus-trap/focus-trap.standalone.mjs";
@@ -15,4 +16,4 @@ import { createSortable } from "./sortable/sortable.embedded.mjs";
15
16
  import "./sortable/sortable.standalone.mjs";
16
17
  import { OuiSplitterElement } from "./splitter.mjs";
17
18
  import { getTooltip, setTooltipDelay } from "./tooltip.mjs";
18
- export { OuiComboboxElement, OuiSplitterElement, createFloatable, createFocusTrap, createMovable, createResizable as createOuiResizable, createSortable, getDialog, getPopover, getTooltip, setTooltipDelay };
19
+ export { OuiComboboxElement, OuiSplitterElement, createFloatable, createFocusTrap, createMovable, createResizable as createOuiResizable, createSortable, getDialog, getPopover, getTooltip, setComboboxLocalizations, setTooltipDelay };
@@ -1,9 +1,9 @@
1
- import { clamp } from "@oscarpalmer/atoms/number";
1
+ import { dispatch, getEventPosition, on } from "@oscarpalmer/toretto/event";
2
2
  import { getAttribute, setAttribute } from "@oscarpalmer/toretto/attribute";
3
- import { dispatch, getPosition, on } from "@oscarpalmer/toretto/event";
4
- import { findAncestor } from "@oscarpalmer/toretto/find";
5
- import { setStyle, setStyles, toggleStyles } from "@oscarpalmer/toretto/style";
6
3
  import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
4
+ import { setStyle, setStyles, toggleStyles } from "@oscarpalmer/toretto/style";
5
+ import { clamp } from "@oscarpalmer/atoms/number";
6
+ import { findAncestor } from "@oscarpalmer/toretto/find";
7
7
  import supportsTouch from "@oscarpalmer/toretto/touch";
8
8
  //#region src/js/internal/draggable.ts
9
9
  var OuiDraggable = class {
@@ -118,7 +118,7 @@ function onPointerdown(event) {
118
118
  if (handle == null) return;
119
119
  const dragged = item.state.options.getDragged();
120
120
  const rectangle = dragged.getBoundingClientRect();
121
- const position = getPosition(event) ?? {
121
+ const position = getEventPosition(event) ?? {
122
122
  x: 0,
123
123
  y: 0
124
124
  };
@@ -153,7 +153,7 @@ function onPointerdown(event) {
153
153
  }
154
154
  function onPointermove(event) {
155
155
  if (current == null) return;
156
- const position = getPosition(event);
156
+ const position = getEventPosition(event);
157
157
  if (position == null) return;
158
158
  const next = getNextPosition(current, position);
159
159
  if (globals.element != null) setStyle(globals.element.node, "inset", `${next.y}px auto auto ${next.x}px`);
@@ -1,8 +1,8 @@
1
- import { clamp } from "@oscarpalmer/atoms/number";
2
1
  import { getAria, setRole } from "@oscarpalmer/toretto/aria";
3
2
  import { dispatch, on } from "@oscarpalmer/toretto/event";
4
- import { findAncestor } from "@oscarpalmer/toretto/find";
5
3
  import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
4
+ import { clamp } from "@oscarpalmer/atoms/number";
5
+ import { findAncestor } from "@oscarpalmer/toretto/find";
6
6
  //#region src/js/internal/navigable.ts
7
7
  var OuiNavigable = class {
8
8
  active = { index: 0 };
@@ -17,7 +17,7 @@ var OuiNavigable = class {
17
17
  onFocusin(this, event);
18
18
  }), on(element, "keydown", (event) => {
19
19
  onKeydown(this, event);
20
- })];
20
+ }, { passive: false })];
21
21
  this.orientation = getOrientation(element, options);
22
22
  if (options.role != null) setRole(element, options.role);
23
23
  }
package/dist/js/menu.mjs CHANGED
@@ -2,8 +2,8 @@ import { createEmbeddedFloatable, getOnBeforeToggleListener } from "./floatable/
2
2
  import { attributable } from "./internal/attributable.mjs";
3
3
  import { NAVIGABLE_KEYS_HORIZONTAL, NAVIGABLE_KEYS_VERTICAL, getNavigable, updateNavigableFocus } from "./internal/navigable.mjs";
4
4
  import { setAria, setRole } from "@oscarpalmer/toretto/aria";
5
- import { setAttribute, setAttributes } from "@oscarpalmer/toretto/attribute";
6
5
  import { on } from "@oscarpalmer/toretto/event";
6
+ import { setAttribute, setAttributes } from "@oscarpalmer/toretto/attribute";
7
7
  import { findAncestor } from "@oscarpalmer/toretto/find";
8
8
  //#region src/js/menu.ts
9
9
  var OuiMenu = class {
@@ -120,7 +120,8 @@ function onDeactivate(_, navigable) {
120
120
  if (instance != null) updateNavigableFocus(instance.navigable, true);
121
121
  }
122
122
  function onPreventNavigation(_, navigable) {
123
- return findAncestor((menubars.get(navigable.element) ?? menus.get(navigable.element))?.element.parentElement, SELECTORS) != null;
123
+ const instance = menubars.get(navigable.element) ?? menus.get(navigable.element);
124
+ return findAncestor(instance?.element.parentElement, SELECTORS) != null;
124
125
  }
125
126
  function onShouldActivate(event, navigable) {
126
127
  let activate = false;
@@ -1,9 +1,9 @@
1
1
  import { attributable } from "../internal/attributable.mjs";
2
2
  import { OuiDraggable, addDraggable, getDraggableStates, removeDraggable } from "../internal/draggable.mjs";
3
+ import { dispatch, getEventPosition, on } from "@oscarpalmer/toretto/event";
3
4
  import { setAttribute } from "@oscarpalmer/toretto/attribute";
4
- import { dispatch, getPosition, on } from "@oscarpalmer/toretto/event";
5
- import { getStyles, setStyle, setStyles } from "@oscarpalmer/toretto/style";
6
5
  import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
6
+ import { getStyles, setStyle, setStyles } from "@oscarpalmer/toretto/style";
7
7
  //#region src/js/movable/movable.embedded.ts
8
8
  var OuiMovable = class extends OuiDraggable {
9
9
  #element;
@@ -112,7 +112,7 @@ function onEnd(event, globals, item, reset) {
112
112
  if (container != null) setOffset(state, container);
113
113
  const dispatched = dispatch(state.element, "movable:end", { detail: {
114
114
  from: { ...globals.original },
115
- to: getPosition(event)
115
+ to: getEventPosition(event)
116
116
  } });
117
117
  setTimeout(() => {
118
118
  if (dispatched.defaultPrevented) onCancel(globals, item);
@@ -2,8 +2,8 @@ import { createEmbeddedFloatable, getOnBeforeToggleListener } from "./floatable/
2
2
  import { attributable } from "./internal/attributable.mjs";
3
3
  import { createFocusTrap } from "./focus-trap/focus-trap.embedded.mjs";
4
4
  import { getAria, setAria } from "@oscarpalmer/toretto/aria";
5
- import { setAttribute } from "@oscarpalmer/toretto/attribute";
6
5
  import { on } from "@oscarpalmer/toretto/event";
6
+ import { setAttribute } from "@oscarpalmer/toretto/attribute";
7
7
  import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
8
8
  //#region src/js/popover.ts
9
9
  var OuiPopover = class {
@@ -1,11 +1,11 @@
1
1
  import { attributable } from "../internal/attributable.mjs";
2
- import { getNumber } from "@oscarpalmer/atoms/number";
3
- import { getAttribute, setAttribute } from "@oscarpalmer/toretto/attribute";
4
- import { dispatch, getPosition, on } from "@oscarpalmer/toretto/event";
5
- import { findAncestor } from "@oscarpalmer/toretto/find";
6
- import { setStyles, toggleStyles } from "@oscarpalmer/toretto/style";
2
+ import { dispatch, getEventPosition, on } from "@oscarpalmer/toretto/event";
7
3
  import { isPlainObject } from "@oscarpalmer/atoms/is";
4
+ import { getAttribute, setAttribute } from "@oscarpalmer/toretto/attribute";
8
5
  import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
6
+ import { setStyles, toggleStyles } from "@oscarpalmer/toretto/style";
7
+ import { getNumber } from "@oscarpalmer/atoms/number";
8
+ import { findAncestor } from "@oscarpalmer/toretto/find";
9
9
  import supportsTouch from "@oscarpalmer/toretto/touch";
10
10
  //#region src/js/resizable/resizable.embedded.ts
11
11
  var OuiResizable = class {
@@ -127,7 +127,7 @@ function onPointerdown(event) {
127
127
  const handle = findAncestor(event, SELECTOR_HANDLE);
128
128
  const element = handle && findAncestor(handle, SELECTOR);
129
129
  const stored = element && items.get(element);
130
- const position = getPosition(event);
130
+ const position = getEventPosition(event);
131
131
  if (stored == null || position == null) return;
132
132
  if (supportsTouch.value) event.preventDefault();
133
133
  const dispatched = dispatch(element, "resizable:begin");
@@ -141,7 +141,7 @@ function onPointerdown(event) {
141
141
  }
142
142
  function onPointermove(event) {
143
143
  if (current == null) return;
144
- const { x, y } = getPosition(event) ?? {};
144
+ const { x, y } = getEventPosition(event) ?? {};
145
145
  if (x == null || y == null) return;
146
146
  const width = current.state.width + (x - (start?.x ?? 0));
147
147
  const height = current.state.height + (y - (start?.y ?? 0));
@@ -1,11 +1,11 @@
1
1
  import { attributable } from "../internal/attributable.mjs";
2
2
  import { OuiDraggable, addDraggable, getDraggableStates, removeDraggable } from "../internal/draggable.mjs";
3
+ import { dispatch, getEventPosition } from "@oscarpalmer/toretto/event";
3
4
  import { getAttribute, setAttribute, setAttributes } from "@oscarpalmer/toretto/attribute";
4
- import { createElement } from "@oscarpalmer/toretto/create";
5
- import { dispatch, getPosition } from "@oscarpalmer/toretto/event";
6
- import { findAncestor, getElementFromPosition } from "@oscarpalmer/toretto/find";
7
- import { setStyle } from "@oscarpalmer/toretto/style";
8
5
  import { isHTMLOrSVGElement } from "@oscarpalmer/toretto/is";
6
+ import { setStyle } from "@oscarpalmer/toretto/style";
7
+ import { findAncestor, getElementFromPosition } from "@oscarpalmer/toretto/find";
8
+ import { createElement } from "@oscarpalmer/toretto/create";
9
9
  //#region src/js/sortable/sortable.embedded.ts
10
10
  var OuiSortable = class extends OuiDraggable {
11
11
  constructor(element, options) {
@@ -92,7 +92,7 @@ function onCancel(_, item) {
92
92
  }
93
93
  function onEnd(event, globals, item, reset) {
94
94
  const { origin } = item.state;
95
- const position = getPosition(event) ?? {
95
+ const position = getEventPosition(event) ?? {
96
96
  x: 0,
97
97
  y: 0
98
98
  };
@@ -258,6 +258,7 @@ const placeholder = {
258
258
  position: void 0
259
259
  };
260
260
  const addSortable = addDraggable.bind(bound);
261
- attributable(ATTRIBUTE, addSortable, removeDraggable.bind(bound));
261
+ const removeSortable = removeDraggable.bind(bound);
262
+ attributable(ATTRIBUTE, addSortable, removeSortable);
262
263
  //#endregion
263
264
  export { OuiSortable, createSortable };
@@ -1,10 +1,10 @@
1
- import { clamp } from "@oscarpalmer/atoms/number";
2
1
  import { setAria } from "@oscarpalmer/toretto/aria";
2
+ import { getEventPosition, on } from "@oscarpalmer/toretto/event";
3
+ import { isNullableOrWhitespace } from "@oscarpalmer/atoms/is";
3
4
  import { getAttribute, setAttribute } from "@oscarpalmer/toretto/attribute";
4
- import { getPosition, on } from "@oscarpalmer/toretto/event";
5
- import { findAncestor } from "@oscarpalmer/toretto/find";
6
5
  import { setStyle, toggleStyles } from "@oscarpalmer/toretto/style";
7
- import { isNullableOrWhitespace } from "@oscarpalmer/atoms/is";
6
+ import { clamp } from "@oscarpalmer/atoms/number";
7
+ import { findAncestor } from "@oscarpalmer/toretto/find";
8
8
  import supportsTouch from "@oscarpalmer/toretto/touch";
9
9
  import { round } from "@oscarpalmer/atoms/math";
10
10
  //#region src/js/splitter.ts
@@ -130,10 +130,7 @@ var OuiSplitterElement = class extends HTMLElement {
130
130
  case ATTRIBUTE_SIZE:
131
131
  this.#splitter.updateValues();
132
132
  break;
133
- case ATTRIBUTE_TYPE:
134
- this.#splitter.updateOrientation();
135
- break;
136
- default: break;
133
+ case ATTRIBUTE_TYPE: this.#splitter.updateOrientation();
137
134
  }
138
135
  }
139
136
  };
@@ -213,10 +210,7 @@ function onKeydown(event) {
213
210
  case KEYS_ALL.has(event.key):
214
211
  onNavigate(event);
215
212
  break;
216
- case event.key === "Escape":
217
- onEnd(true);
218
- break;
219
- default: break;
213
+ case event.key === "Escape": onEnd(true);
220
214
  }
221
215
  }
222
216
  function onNavigate(event) {
@@ -256,7 +250,7 @@ function onPointerdown(event) {
256
250
  }
257
251
  function onPointermove(event) {
258
252
  if (splitter == null) return;
259
- const position = getPosition(event);
253
+ const position = getEventPosition(event);
260
254
  if (position != null) {
261
255
  splitter.values.now.current = getSize(splitter, splitter.types.horizontal ? position.y : position.x);
262
256
  setSize(splitter, splitter.values.now.current);
@@ -1,11 +1,11 @@
1
1
  import { createEmbeddedFloatable } from "./floatable/floatable.embedded.mjs";
2
2
  import { attributable } from "./internal/attributable.mjs";
3
3
  import { getAria } from "@oscarpalmer/toretto/aria";
4
- import { setAttribute } from "@oscarpalmer/toretto/attribute";
5
- import { createElement } from "@oscarpalmer/toretto/create";
6
4
  import { on } from "@oscarpalmer/toretto/event";
7
- import { findAncestor } from "@oscarpalmer/toretto/find";
8
5
  import { isNullableOrWhitespace } from "@oscarpalmer/atoms/is";
6
+ import { setAttribute } from "@oscarpalmer/toretto/attribute";
7
+ import { findAncestor } from "@oscarpalmer/toretto/find";
8
+ import { createElement } from "@oscarpalmer/toretto/create";
9
9
  //#region src/js/tooltip.ts
10
10
  var OuiTooltip = class {
11
11
  #state;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oscarpalmer/oui",
3
- "version": "0.32.0",
3
+ "version": "0.34.0",
4
4
  "description": "Styles, components, and utilities for building websites and applications.",
5
5
  "keywords": [
6
6
  "css",
@@ -34,8 +34,8 @@
34
34
  "default": "./dist/js/index.mjs"
35
35
  },
36
36
  "./combobox": {
37
- "types": "./dist/js/combobox.d.mts",
38
- "default": "./dist/js/combobox.mjs"
37
+ "types": "./dist/js/combobox/index.d.mts",
38
+ "default": "./dist/js/combobox/index.mjs"
39
39
  },
40
40
  "./dialog": {
41
41
  "types": "./dist/js/dialog.d.mts",
@@ -95,14 +95,14 @@
95
95
  },
96
96
  "dependencies": {
97
97
  "@oscarpalmer/atoms": "^0.188.1",
98
- "@oscarpalmer/toretto": "^0.48.0"
98
+ "@oscarpalmer/toretto": "^0.50.1"
99
99
  },
100
100
  "devDependencies": {
101
- "@oxlint/plugins": "^1.75",
101
+ "@oxlint/plugins": "^1.77",
102
102
  "@vitest/coverage-istanbul": "^4.1",
103
103
  "autoprefixer": "^10.5",
104
104
  "concurrently": "^10",
105
- "jsdom": "^29.1",
105
+ "jsdom": "^30",
106
106
  "postcss-cli": "^11",
107
107
  "postcss-input-range": "^6",
108
108
  "postcss-scss": "^4",
@@ -14,9 +14,11 @@
14
14
  background-position: right 0.5em center;
15
15
  background-repeat: no-repeat;
16
16
  background-size: 1em;
17
+ position: relative;
17
18
  }
18
19
 
19
20
  :where(&:not([disabled], [readonly], [aria-disabled='true' i]):focus),
21
+ :where(&:not([disabled], [readonly], [aria-disabled='true' i]):focus-within),
20
22
  :where(
21
23
  &:not([disabled], [readonly], [aria-disabled='true' i]):has(
22
24
  + [oui-combobox-content]:focus-within
@@ -26,24 +28,37 @@
26
28
  }
27
29
 
28
30
  @media (hover: hover) {
29
- :where(&:not([disabled], [readonly], [aria-disabled='true' i]):hover) {
31
+ :where(
32
+ &:not([disabled], [readonly], [aria-disabled='true' i], [aria-readonly='true' i]):hover
33
+ ) {
30
34
  @include mixins.input-hover;
31
35
  }
32
36
  }
33
37
 
34
- :where(&:is([disabled], [readonly], [aria-disabled='true' i])) {
38
+ :where(&:is([disabled], [readonly], [aria-disabled='true' i], [aria-readonly='true' i])) {
35
39
  --oui-foreground-percentage: 25%;
36
40
 
37
41
  font-style: italic;
38
42
  }
39
43
 
40
- :where(&:is([disabled], [readonly], [aria-disabled='true' i]):focus) {
44
+ :where(&:is([disabled], [readonly], [aria-disabled='true' i], [aria-readonly='true' i]):focus) {
41
45
  --oui-outline-percentage: 75%;
42
46
  }
43
47
 
44
48
  :where(&:is([disabled], [aria-disabled='true' i])) {
45
49
  --oui-background-percentage: 50%;
46
50
  }
51
+
52
+ :where(& > button) {
53
+ border: none;
54
+ position: absolute;
55
+ inset: 0;
56
+ z-index: 1;
57
+ }
58
+
59
+ :where(& > button:focus) {
60
+ outline: none;
61
+ }
47
62
  }
48
63
 
49
64
  :where([oui-combobox-content]) {
@@ -54,7 +69,7 @@
54
69
  height: fit-content;
55
70
  max-width: max(25vw, 32rem);
56
71
  max-height: max(25vh, 32rem);
57
- min-width: var(--oui-combobox-width, auto);
72
+ min-width: anchor-size(width);
58
73
  flex-flow: column nowrap;
59
74
  border-radius: 0.25em;
60
75
 
@@ -63,12 +78,6 @@
63
78
  }
64
79
  }
65
80
 
66
- :where([oui-combobox-empty]) {
67
- padding: 1em;
68
- text-align: center;
69
- font-style: italic;
70
- }
71
-
72
81
  :where([oui-combobox-filter], [oui-combobox-header]) {
73
82
  &::after {
74
83
  content: '';
@@ -101,23 +110,23 @@
101
110
  border-radius: 0.25em;
102
111
  font-size: 0.875rem;
103
112
 
104
- :where(&:not([disabled], [readonly], [aria-disabled='true' i]):focus) {
113
+ :where(&:focus) {
105
114
  @include mixins.input-focus;
106
115
  }
107
116
 
108
117
  @media (hover: hover) {
109
- :where(&:not([disabled], [readonly], [aria-disabled='true' i]):hover) {
118
+ :where(&:hover) {
110
119
  @include mixins.input-hover;
111
120
  }
112
121
  }
113
122
 
114
- :where(&:is([disabled], [readonly], [aria-disabled='true' i])) {
123
+ :where(&:is([disabled], [readonly], [aria-disabled='true' i], [aria-readonly='true' i])) {
115
124
  --oui-foreground-percentage: 25%;
116
125
 
117
126
  font-style: italic;
118
127
  }
119
128
 
120
- :where(&:is([disabled], [readonly], [aria-disabled='true' i]):focus) {
129
+ :where(&:is([disabled], [readonly], [aria-disabled='true' i], [aria-readonly='true' i]):focus) {
121
130
  --oui-outline-percentage: 75%;
122
131
  }
123
132
 
@@ -126,13 +135,6 @@
126
135
  }
127
136
  }
128
137
 
129
- :where([oui-combobox-filter-label]) {
130
- @include mixins.visually-hidden;
131
-
132
- display: inline-flex;
133
- position: absolute;
134
- }
135
-
136
138
  :where([oui-combobox-header]) {
137
139
  padding: 0.5em calc(0.75em / 0.75);
138
140
  background-color: var(--oui-gray-0);
@@ -143,11 +145,23 @@
143
145
  z-index: 1;
144
146
  }
145
147
 
148
+ :where([oui-combobox-hidden]) {
149
+ @include mixins.visually-hidden;
150
+
151
+ position: absolute;
152
+ }
153
+
146
154
  :where([oui-combobox-list]) {
147
155
  overflow: auto;
148
156
  position: relative;
149
157
  }
150
158
 
159
+ :where([oui-combobox-message]) {
160
+ padding: 1em;
161
+ text-align: center;
162
+ font-style: italic;
163
+ }
164
+
151
165
  [oui-combobox-option] {
152
166
  :where(&) {
153
167
  padding: 0.5em 0.75em;
@@ -168,7 +182,9 @@
168
182
  margin: 0 0.75em 0 0;
169
183
  }
170
184
 
171
- :where(oui-combobox:not([disabled], [readonly], [aria-disabled='true' i]) &) {
185
+ :where(
186
+ oui-combobox:not([disabled], [readonly], [aria-disabled='true' i], [aria-readonly='true' i]) &
187
+ ) {
172
188
  @media (hover: hover) {
173
189
  :where(&:hover) {
174
190
  background-color: var(--oui-blue-1);
@@ -193,24 +209,75 @@
193
209
  gap: 0.5em;
194
210
  overflow: auto;
195
211
  list-style: none;
212
+ position: relative;
213
+ z-index: 2;
196
214
  }
197
215
 
198
216
  [oui-combobox-selection-item] {
199
217
  :where(&) {
200
- @include mixins.badge;
218
+ @include mixins.button;
219
+
220
+ --oui-background-value: var(--oui-blue-1);
221
+ --oui-foreground-percentage: 12.5%;
222
+ --oui-foreground-value: var(--oui-blue-8);
223
+ --oui-shadow-percentage: 90%;
201
224
 
202
- border-radius: 3em;
203
225
  padding: 0.5em 1em;
204
- gap: 0.75em;
205
- font-size: 0.875em;
206
- transition: 0.125s ease-in-out;
226
+ flex-wrap: nowrap;
227
+ border-radius: 5em;
228
+ font-size: 0.75em;
229
+ white-space: nowrap;
230
+ }
231
+
232
+ :where(
233
+ oui-combobox:is([disabled], [readonly], [aria-disabled='true' i], [aria-readonly='true' i])
234
+ &:focus-visible
235
+ ) {
236
+ --oui-outline-percentage: 87.5%;
237
+ --oui-outline-value: var(--oui-blue-6);
238
+ }
239
+
240
+ :where(
241
+ oui-combobox:not([disabled], [readonly], [aria-disabled='true' i], [aria-readonly='true' i])
242
+ &:focus-visible
243
+ ) {
244
+ --oui-background-value: var(--oui-red-1);
245
+ --oui-foreground-value: var(--oui-red-8);
246
+ --oui-outline-percentage: 75%;
247
+ --oui-outline-value: var(--oui-red-6);
207
248
  }
208
249
 
209
250
  @media (hover: hover) {
210
- :where(oui-combobox:not([disabled], [readonly], [aria-disabled='true' i]) &:hover) {
211
- --oui-background: var(--oui-red-0);
212
- --oui-foreground: var(--oui-red-8);
213
- --oui-shadow: var(--oui-red-6);
251
+ :where(
252
+ oui-combobox:not([disabled], [readonly], [aria-disabled='true' i], [aria-readonly='true' i])
253
+ &:hover
254
+ ) {
255
+ --oui-background-value: var(--oui-red-1);
256
+ --oui-foreground-value: var(--oui-red-8);
257
+ --oui-outline-value: var(--oui-red-6);
258
+
259
+ --oui-background-percentage: 50%;
260
+ --oui-foreground-percentage: 25%;
214
261
  }
215
262
  }
263
+
264
+ :where(
265
+ oui-combobox:not([disabled], [readonly], [aria-disabled='true' i], [aria-readonly='true' i])
266
+ &:active
267
+ ) {
268
+ box-shadow:
269
+ 0 0 0 1px var(--oui-shadow-value),
270
+ inset 0 1px 2px 0 var(--oui-shadow-value),
271
+ inset 0 2px 4px 0 var(--oui-shadow-value);
272
+ }
273
+
274
+ :where(
275
+ oui-combobox:is([disabled], [readonly], [aria-disabled='true' i], [aria-readonly='true' i]) &
276
+ ) {
277
+ --oui-background-percentage: 80%;
278
+ --oui-foreground-percentage: 20%;
279
+ --oui-shadow-percentage: 95%;
280
+
281
+ font-style: italic;
282
+ }
216
283
  }