@ariakit/core 0.4.5 → 0.4.6

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 (119) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/cjs/__chunks/{KL74MAHB.cjs → 3HYNC3XA.cjs} +2 -2
  3. package/cjs/__chunks/{QD2A4YF6.cjs → 4W3OYRR3.cjs} +2 -2
  4. package/cjs/__chunks/{MHZQJPY3.cjs → B4AKUC4S.cjs} +2 -2
  5. package/cjs/__chunks/{2D5LEVE7.cjs → D7M2PCAQ.cjs} +6 -6
  6. package/cjs/__chunks/{IMYW2UAC.cjs → Q2WCPTYS.cjs} +4 -22
  7. package/cjs/checkbox/checkbox-store.d.cts +2 -2
  8. package/cjs/checkbox/checkbox-store.d.ts +2 -2
  9. package/cjs/collection/collection-store.cjs +3 -3
  10. package/cjs/collection/collection-store.d.cts +2 -2
  11. package/cjs/collection/collection-store.d.ts +2 -2
  12. package/cjs/combobox/combobox-store.cjs +16 -7
  13. package/cjs/combobox/combobox-store.d.cts +5 -5
  14. package/cjs/combobox/combobox-store.d.ts +5 -5
  15. package/cjs/composite/composite-overflow-store.d.cts +2 -2
  16. package/cjs/composite/composite-overflow-store.d.ts +2 -2
  17. package/cjs/composite/composite-store.cjs +4 -4
  18. package/cjs/composite/composite-store.d.cts +3 -3
  19. package/cjs/composite/composite-store.d.ts +3 -3
  20. package/cjs/dialog/dialog-store.d.cts +2 -2
  21. package/cjs/dialog/dialog-store.d.ts +2 -2
  22. package/cjs/disclosure/disclosure-store.d.cts +2 -2
  23. package/cjs/disclosure/disclosure-store.d.ts +2 -2
  24. package/cjs/form/form-store.cjs +3 -3
  25. package/cjs/form/form-store.d.cts +4 -4
  26. package/cjs/form/form-store.d.ts +4 -4
  27. package/cjs/form/types.d.cts +3 -3
  28. package/cjs/form/types.d.ts +3 -3
  29. package/cjs/hovercard/hovercard-store.d.cts +3 -3
  30. package/cjs/hovercard/hovercard-store.d.ts +3 -3
  31. package/cjs/menu/menu-bar-store.cjs +5 -5
  32. package/cjs/menu/menu-bar-store.d.cts +2 -2
  33. package/cjs/menu/menu-bar-store.d.ts +2 -2
  34. package/cjs/menu/menu-store.cjs +4 -4
  35. package/cjs/menu/menu-store.d.cts +6 -6
  36. package/cjs/menu/menu-store.d.ts +6 -6
  37. package/cjs/menubar/menubar-store.cjs +5 -5
  38. package/cjs/menubar/menubar-store.d.cts +2 -2
  39. package/cjs/menubar/menubar-store.d.ts +2 -2
  40. package/cjs/popover/popover-store.d.cts +3 -3
  41. package/cjs/popover/popover-store.d.ts +3 -3
  42. package/cjs/radio/radio-store.cjs +4 -4
  43. package/cjs/radio/radio-store.d.cts +3 -3
  44. package/cjs/radio/radio-store.d.ts +3 -3
  45. package/cjs/select/select-store.cjs +16 -6
  46. package/cjs/select/select-store.d.cts +17 -9
  47. package/cjs/select/select-store.d.ts +17 -9
  48. package/cjs/tab/tab-store.cjs +45 -12
  49. package/cjs/tab/tab-store.d.cts +7 -6
  50. package/cjs/tab/tab-store.d.ts +7 -6
  51. package/cjs/tag/tag-store.cjs +4 -4
  52. package/cjs/tag/tag-store.d.cts +3 -3
  53. package/cjs/tag/tag-store.d.ts +3 -3
  54. package/cjs/toolbar/toolbar-store.cjs +4 -4
  55. package/cjs/toolbar/toolbar-store.d.cts +2 -2
  56. package/cjs/toolbar/toolbar-store.d.ts +2 -2
  57. package/cjs/tooltip/tooltip-store.d.cts +2 -2
  58. package/cjs/tooltip/tooltip-store.d.ts +2 -2
  59. package/cjs/utils/dom.cjs +2 -6
  60. package/cjs/utils/dom.d.cts +1 -17
  61. package/cjs/utils/dom.d.ts +1 -17
  62. package/cjs/utils/events.cjs +20 -15
  63. package/cjs/utils/events.d.cts +1 -1
  64. package/cjs/utils/events.d.ts +1 -1
  65. package/cjs/utils/focus.cjs +13 -15
  66. package/cjs/utils/focus.d.cts +1 -1
  67. package/cjs/utils/focus.d.ts +1 -1
  68. package/cjs/utils/misc.d.cts +1 -1
  69. package/cjs/utils/misc.d.ts +1 -1
  70. package/cjs/utils/platform.cjs +3 -3
  71. package/cjs/utils/store.d.cts +3 -3
  72. package/cjs/utils/store.d.ts +3 -3
  73. package/esm/__chunks/{QAI5BPCY.js → CLSHHUGK.js} +1 -1
  74. package/esm/__chunks/{ABMC67JW.js → EQPTKGFA.js} +1 -1
  75. package/esm/__chunks/{IUORCTET.js → I2NJJ3XW.js} +3 -21
  76. package/esm/__chunks/{K7A7LTR3.js → P3MTNH46.js} +1 -1
  77. package/esm/__chunks/{YVUNPQHS.js → PBSSD2DM.js} +1 -1
  78. package/esm/checkbox/checkbox-store.d.ts +2 -2
  79. package/esm/collection/collection-store.d.ts +2 -2
  80. package/esm/collection/collection-store.js +2 -2
  81. package/esm/combobox/combobox-store.d.ts +5 -5
  82. package/esm/combobox/combobox-store.js +16 -7
  83. package/esm/composite/composite-overflow-store.d.ts +2 -2
  84. package/esm/composite/composite-store.d.ts +3 -3
  85. package/esm/composite/composite-store.js +3 -3
  86. package/esm/dialog/dialog-store.d.ts +2 -2
  87. package/esm/disclosure/disclosure-store.d.ts +2 -2
  88. package/esm/form/form-store.d.ts +4 -4
  89. package/esm/form/form-store.js +2 -2
  90. package/esm/form/types.d.ts +3 -3
  91. package/esm/hovercard/hovercard-store.d.ts +3 -3
  92. package/esm/menu/menu-bar-store.d.ts +2 -2
  93. package/esm/menu/menu-bar-store.js +4 -4
  94. package/esm/menu/menu-store.d.ts +6 -6
  95. package/esm/menu/menu-store.js +3 -3
  96. package/esm/menubar/menubar-store.d.ts +2 -2
  97. package/esm/menubar/menubar-store.js +4 -4
  98. package/esm/popover/popover-store.d.ts +3 -3
  99. package/esm/radio/radio-store.d.ts +3 -3
  100. package/esm/radio/radio-store.js +3 -3
  101. package/esm/select/select-store.d.ts +17 -9
  102. package/esm/select/select-store.js +15 -5
  103. package/esm/tab/tab-store.d.ts +7 -6
  104. package/esm/tab/tab-store.js +43 -10
  105. package/esm/tag/tag-store.d.ts +3 -3
  106. package/esm/tag/tag-store.js +3 -3
  107. package/esm/toolbar/toolbar-store.d.ts +2 -2
  108. package/esm/toolbar/toolbar-store.js +3 -3
  109. package/esm/tooltip/tooltip-store.d.ts +2 -2
  110. package/esm/utils/dom.d.ts +1 -17
  111. package/esm/utils/dom.js +1 -5
  112. package/esm/utils/events.d.ts +1 -1
  113. package/esm/utils/events.js +17 -12
  114. package/esm/utils/focus.d.ts +1 -1
  115. package/esm/utils/focus.js +5 -7
  116. package/esm/utils/misc.d.ts +1 -1
  117. package/esm/utils/platform.js +2 -2
  118. package/esm/utils/store.d.ts +3 -3
  119. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import type { AriaHasPopup, AriaRole } from "./types.js";
1
+ import type { AriaHasPopup, AriaRole } from "./types.ts";
2
2
  /**
3
3
  * It's `true` if it is running in a browser environment or `false` if it is not
4
4
  * (SSR).
@@ -45,26 +45,10 @@ export declare function isButton(element: {
45
45
  tagName: string;
46
46
  type?: string;
47
47
  }): boolean;
48
- /**
49
- * Ponyfill for `Element.prototype.matches`
50
- *
51
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
52
- */
53
- export declare function matches(element: Element, selectors: string): boolean;
54
48
  /**
55
49
  * Checks if the element is visible or not.
56
50
  */
57
51
  export declare function isVisible(element: Element): boolean;
58
- /**
59
- * Ponyfill for `Element.prototype.closest`
60
- * @example
61
- * closest(document.getElementById("id"), "div");
62
- * // same as
63
- * document.getElementById("id").closest("div");
64
- */
65
- export declare function closest<K extends keyof HTMLElementTagNameMap>(element: Element, selectors: K): HTMLElementTagNameMap[K];
66
- export declare function closest<K extends keyof SVGElementTagNameMap>(element: Element, selectors: K): SVGElementTagNameMap[K];
67
- export declare function closest<T extends Element = Element>(element: Element, selectors: string): T | null;
68
52
  /**
69
53
  * Check whether the given element is a text field, where text field is defined
70
54
  * by the ability to select within the input.
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
2
 
3
3
 
4
- var _2D5LEVE7cjs = require('../__chunks/2D5LEVE7.cjs');
4
+ var _D7M2PCAQcjs = require('../__chunks/D7M2PCAQ.cjs');
5
5
 
6
6
 
7
- var _IMYW2UACcjs = require('../__chunks/IMYW2UAC.cjs');
7
+ var _Q2WCPTYScjs = require('../__chunks/Q2WCPTYS.cjs');
8
8
 
9
9
 
10
10
 
@@ -13,7 +13,7 @@ var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
13
13
  // src/utils/events.ts
14
14
  function isPortalEvent(event) {
15
15
  return Boolean(
16
- event.currentTarget && !_IMYW2UACcjs.contains.call(void 0, event.currentTarget, event.target)
16
+ event.currentTarget && !_Q2WCPTYScjs.contains.call(void 0, event.currentTarget, event.target)
17
17
  );
18
18
  }
19
19
  function isSelfTarget(event) {
@@ -23,7 +23,7 @@ function isOpeningInNewTab(event) {
23
23
  const element = event.currentTarget;
24
24
  if (!element)
25
25
  return false;
26
- const isAppleDevice = _2D5LEVE7cjs.isApple.call(void 0, );
26
+ const isAppleDevice = _D7M2PCAQcjs.isApple.call(void 0, );
27
27
  if (isAppleDevice && !event.metaKey)
28
28
  return false;
29
29
  if (!isAppleDevice && !event.ctrlKey)
@@ -81,7 +81,7 @@ function fireClickEvent(element, eventInit) {
81
81
  function isFocusEventOutside(event, container) {
82
82
  const containerElement = container || event.currentTarget;
83
83
  const relatedTarget = event.relatedTarget;
84
- return !relatedTarget || !_IMYW2UACcjs.contains.call(void 0, containerElement, relatedTarget);
84
+ return !relatedTarget || !_Q2WCPTYScjs.contains.call(void 0, containerElement, relatedTarget);
85
85
  }
86
86
  function getInputType(event) {
87
87
  const nativeEvent = "nativeEvent" in event ? event.nativeEvent : event;
@@ -93,20 +93,25 @@ function getInputType(event) {
93
93
  return;
94
94
  return nativeEvent.inputType;
95
95
  }
96
- function queueBeforeEvent(element, type, callback) {
97
- const raf = requestAnimationFrame(() => {
98
- element.removeEventListener(type, callImmediately, true);
96
+ function queueBeforeEvent(element, type, callback, timeout) {
97
+ const createTimer = (callback2) => {
98
+ if (timeout) {
99
+ const timerId2 = setTimeout(callback2, timeout);
100
+ return () => clearTimeout(timerId2);
101
+ }
102
+ const timerId = requestAnimationFrame(callback2);
103
+ return () => cancelAnimationFrame(timerId);
104
+ };
105
+ const cancelTimer = createTimer(() => {
106
+ element.removeEventListener(type, callSync, true);
99
107
  callback();
100
108
  });
101
- const callImmediately = () => {
102
- cancelAnimationFrame(raf);
109
+ const callSync = () => {
110
+ cancelTimer();
103
111
  callback();
104
112
  };
105
- element.addEventListener(type, callImmediately, {
106
- once: true,
107
- capture: true
108
- });
109
- return raf;
113
+ element.addEventListener(type, callSync, { once: true, capture: true });
114
+ return cancelTimer;
110
115
  }
111
116
  function addGlobalEventListener(type, listener, options, scope = window) {
112
117
  const children = [];
@@ -71,6 +71,6 @@ export declare function getInputType(event: Event | {
71
71
  /**
72
72
  * Runs a callback on the next animation frame, but before a certain event.
73
73
  */
74
- export declare function queueBeforeEvent(element: Element, type: string, callback: () => void): number;
74
+ export declare function queueBeforeEvent(element: Element, type: string, callback: () => void, timeout?: number): () => void;
75
75
  export declare function addGlobalEventListener<K extends keyof DocumentEventMap>(type: K, listener: (event: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions, scope?: Window): () => void;
76
76
  export declare function addGlobalEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions, scope?: Window): () => void;
@@ -71,6 +71,6 @@ export declare function getInputType(event: Event | {
71
71
  /**
72
72
  * Runs a callback on the next animation frame, but before a certain event.
73
73
  */
74
- export declare function queueBeforeEvent(element: Element, type: string, callback: () => void): number;
74
+ export declare function queueBeforeEvent(element: Element, type: string, callback: () => void, timeout?: number): () => void;
75
75
  export declare function addGlobalEventListener<K extends keyof DocumentEventMap>(type: K, listener: (event: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions, scope?: Window): () => void;
76
76
  export declare function addGlobalEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions, scope?: Window): () => void;
@@ -4,9 +4,7 @@
4
4
 
5
5
 
6
6
 
7
-
8
-
9
- var _IMYW2UACcjs = require('../__chunks/IMYW2UAC.cjs');
7
+ var _Q2WCPTYScjs = require('../__chunks/Q2WCPTYS.cjs');
10
8
 
11
9
 
12
10
  var _AV6KTKLEcjs = require('../__chunks/AV6KTKLE.cjs');
@@ -18,11 +16,11 @@ function hasNegativeTabIndex(element) {
18
16
  return tabIndex < 0;
19
17
  }
20
18
  function isFocusable(element) {
21
- if (!_IMYW2UACcjs.matches.call(void 0, element, selector))
19
+ if (!element.matches(selector))
22
20
  return false;
23
- if (!_IMYW2UACcjs.isVisible.call(void 0, element))
21
+ if (!_Q2WCPTYScjs.isVisible.call(void 0, element))
24
22
  return false;
25
- if (_IMYW2UACcjs.closest.call(void 0, element, "[inert]"))
23
+ if (element.closest("[inert]"))
26
24
  return false;
27
25
  return true;
28
26
  }
@@ -44,7 +42,7 @@ function isTabbable(element) {
44
42
  return true;
45
43
  if (!("length" in radioGroup))
46
44
  return true;
47
- const activeElement = _IMYW2UACcjs.getActiveElement.call(void 0, element);
45
+ const activeElement = _Q2WCPTYScjs.getActiveElement.call(void 0, element);
48
46
  if (!activeElement)
49
47
  return true;
50
48
  if (activeElement === element)
@@ -66,7 +64,7 @@ function getAllFocusableIn(container, includeContainer) {
66
64
  }
67
65
  const focusableElements = elements.filter(isFocusable);
68
66
  focusableElements.forEach((element, i) => {
69
- if (_IMYW2UACcjs.isFrame.call(void 0, element) && element.contentDocument) {
67
+ if (_Q2WCPTYScjs.isFrame.call(void 0, element) && element.contentDocument) {
70
68
  const frameBody = element.contentDocument.body;
71
69
  focusableElements.splice(i, 1, ...getAllFocusableIn(frameBody));
72
70
  }
@@ -92,7 +90,7 @@ function getAllTabbableIn(container, includeContainer, fallbackToFocusable) {
92
90
  tabbableElements.unshift(container);
93
91
  }
94
92
  tabbableElements.forEach((element, i) => {
95
- if (_IMYW2UACcjs.isFrame.call(void 0, element) && element.contentDocument) {
93
+ if (_Q2WCPTYScjs.isFrame.call(void 0, element) && element.contentDocument) {
96
94
  const frameBody = element.contentDocument.body;
97
95
  const allFrameTabbable = getAllTabbableIn(
98
96
  frameBody,
@@ -133,7 +131,7 @@ function getLastTabbable(fallbackToFocusable) {
133
131
  return getLastTabbableIn(document.body, false, fallbackToFocusable);
134
132
  }
135
133
  function getNextTabbableIn(container, includeContainer, fallbackToFirst, fallbackToFocusable) {
136
- const activeElement = _IMYW2UACcjs.getActiveElement.call(void 0, container);
134
+ const activeElement = _Q2WCPTYScjs.getActiveElement.call(void 0, container);
137
135
  const allFocusable = getAllFocusableIn(container, includeContainer);
138
136
  const activeIndex = allFocusable.indexOf(activeElement);
139
137
  const nextFocusableElements = allFocusable.slice(activeIndex + 1);
@@ -148,7 +146,7 @@ function getNextTabbable(fallbackToFirst, fallbackToFocusable) {
148
146
  );
149
147
  }
150
148
  function getPreviousTabbableIn(container, includeContainer, fallbackToLast, fallbackToFocusable) {
151
- const activeElement = _IMYW2UACcjs.getActiveElement.call(void 0, container);
149
+ const activeElement = _Q2WCPTYScjs.getActiveElement.call(void 0, container);
152
150
  const allFocusable = getAllFocusableIn(container, includeContainer).reverse();
153
151
  const activeIndex = allFocusable.indexOf(activeElement);
154
152
  const previousFocusableElements = allFocusable.slice(activeIndex + 1);
@@ -164,12 +162,12 @@ function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) {
164
162
  }
165
163
  function getClosestFocusable(element) {
166
164
  while (element && !isFocusable(element)) {
167
- element = _IMYW2UACcjs.closest.call(void 0, element, selector);
165
+ element = element.closest(selector);
168
166
  }
169
167
  return element || null;
170
168
  }
171
169
  function hasFocus(element) {
172
- const activeElement = _IMYW2UACcjs.getActiveElement.call(void 0, element);
170
+ const activeElement = _Q2WCPTYScjs.getActiveElement.call(void 0, element);
173
171
  if (!activeElement)
174
172
  return false;
175
173
  if (activeElement === element)
@@ -180,10 +178,10 @@ function hasFocus(element) {
180
178
  return activeDescendant === element.id;
181
179
  }
182
180
  function hasFocusWithin(element) {
183
- const activeElement = _IMYW2UACcjs.getActiveElement.call(void 0, element);
181
+ const activeElement = _Q2WCPTYScjs.getActiveElement.call(void 0, element);
184
182
  if (!activeElement)
185
183
  return false;
186
- if (_IMYW2UACcjs.contains.call(void 0, element, activeElement))
184
+ if (_Q2WCPTYScjs.contains.call(void 0, element, activeElement))
187
185
  return true;
188
186
  const activeDescendant = activeElement.getAttribute("aria-activedescendant");
189
187
  if (!activeDescendant)
@@ -6,7 +6,7 @@
6
6
  * isFocusable(document.querySelector("input[hidden]")); // false
7
7
  * isFocusable(document.querySelector("input:disabled")); // false
8
8
  */
9
- export declare function isFocusable(element: Element): element is HTMLElement;
9
+ export declare function isFocusable(element: Element): boolean;
10
10
  /**
11
11
  * Checks whether `element` is tabbable or not.
12
12
  * @example
@@ -6,7 +6,7 @@
6
6
  * isFocusable(document.querySelector("input[hidden]")); // false
7
7
  * isFocusable(document.querySelector("input:disabled")); // false
8
8
  */
9
- export declare function isFocusable(element: Element): element is HTMLElement;
9
+ export declare function isFocusable(element: Element): boolean;
10
10
  /**
11
11
  * Checks whether `element` is tabbable or not.
12
12
  * @example
@@ -1,4 +1,4 @@
1
- import type { AnyFunction, AnyObject, SetStateAction } from "./types.js";
1
+ import type { AnyFunction, AnyObject, SetStateAction } from "./types.ts";
2
2
  /**
3
3
  * Empty function.
4
4
  */
@@ -1,4 +1,4 @@
1
- import type { AnyFunction, AnyObject, SetStateAction } from "./types.js";
1
+ import type { AnyFunction, AnyObject, SetStateAction } from "./types.ts";
2
2
  /**
3
3
  * Empty function.
4
4
  */
@@ -5,8 +5,8 @@
5
5
 
6
6
 
7
7
 
8
- var _2D5LEVE7cjs = require('../__chunks/2D5LEVE7.cjs');
9
- require('../__chunks/IMYW2UAC.cjs');
8
+ var _D7M2PCAQcjs = require('../__chunks/D7M2PCAQ.cjs');
9
+ require('../__chunks/Q2WCPTYS.cjs');
10
10
  require('../__chunks/AV6KTKLE.cjs');
11
11
 
12
12
 
@@ -14,4 +14,4 @@ require('../__chunks/AV6KTKLE.cjs');
14
14
 
15
15
 
16
16
 
17
- exports.isApple = _2D5LEVE7cjs.isApple; exports.isFirefox = _2D5LEVE7cjs.isFirefox; exports.isMac = _2D5LEVE7cjs.isMac; exports.isSafari = _2D5LEVE7cjs.isSafari; exports.isTouchDevice = _2D5LEVE7cjs.isTouchDevice;
17
+ exports.isApple = _D7M2PCAQcjs.isApple; exports.isFirefox = _D7M2PCAQcjs.isFirefox; exports.isMac = _D7M2PCAQcjs.isMac; exports.isSafari = _D7M2PCAQcjs.isSafari; exports.isTouchDevice = _D7M2PCAQcjs.isTouchDevice;
@@ -1,4 +1,4 @@
1
- import type { AnyObject, SetStateAction } from "./types.js";
1
+ import type { AnyObject, SetStateAction } from "./types.ts";
2
2
  type Listener<S> = (state: S, prevState: S) => void | (() => void);
3
3
  type Sync<S, K extends keyof S> = (keys: K[] | null, listener: Listener<Pick<S, K>>) => () => void;
4
4
  type StoreSetup = (callback: () => void | (() => void)) => () => void;
@@ -43,7 +43,7 @@ export type StoreOptions<S extends State, K extends keyof S> = Partial<Pick<S, K
43
43
  * Props that can be passed to a store creator function.
44
44
  * @template S State type.
45
45
  */
46
- export type StoreProps<S extends State = State> = {
46
+ export interface StoreProps<S extends State = State> {
47
47
  /**
48
48
  * Another store object that will be kept in sync with the original store.
49
49
  *
@@ -51,7 +51,7 @@ export type StoreProps<S extends State = State> = {
51
51
  * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
52
52
  */
53
53
  store?: Store<Partial<S>>;
54
- };
54
+ }
55
55
  /**
56
56
  * Extracts the state type from a store type.
57
57
  * @template T Store type.
@@ -1,4 +1,4 @@
1
- import type { AnyObject, SetStateAction } from "./types.js";
1
+ import type { AnyObject, SetStateAction } from "./types.ts";
2
2
  type Listener<S> = (state: S, prevState: S) => void | (() => void);
3
3
  type Sync<S, K extends keyof S> = (keys: K[] | null, listener: Listener<Pick<S, K>>) => () => void;
4
4
  type StoreSetup = (callback: () => void | (() => void)) => () => void;
@@ -43,7 +43,7 @@ export type StoreOptions<S extends State, K extends keyof S> = Partial<Pick<S, K
43
43
  * Props that can be passed to a store creator function.
44
44
  * @template S State type.
45
45
  */
46
- export type StoreProps<S extends State = State> = {
46
+ export interface StoreProps<S extends State = State> {
47
47
  /**
48
48
  * Another store object that will be kept in sync with the original store.
49
49
  *
@@ -51,7 +51,7 @@ export type StoreProps<S extends State = State> = {
51
51
  * - [Navigation Menubar](https://ariakit.org/examples/menubar-navigation)
52
52
  */
53
53
  store?: Store<Partial<S>>;
54
- };
54
+ }
55
55
  /**
56
56
  * Extracts the state type from a store type.
57
57
  * @template T Store type.
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  canUseDOM
4
- } from "./IUORCTET.js";
4
+ } from "./I2NJJ3XW.js";
5
5
 
6
6
  // src/utils/platform.ts
7
7
  function isTouchDevice() {
@@ -12,7 +12,7 @@ import {
12
12
  } from "./22HHDS5F.js";
13
13
  import {
14
14
  getDocument
15
- } from "./IUORCTET.js";
15
+ } from "./I2NJJ3XW.js";
16
16
  import {
17
17
  __spreadProps,
18
18
  __spreadValues
@@ -57,29 +57,13 @@ var buttonInputTypes = [
57
57
  "reset",
58
58
  "submit"
59
59
  ];
60
- function matches(element, selectors) {
61
- if ("matches" in element) {
62
- return element.matches(selectors);
63
- }
64
- if ("msMatchesSelector" in element) {
65
- return element.msMatchesSelector(selectors);
66
- }
67
- return element.webkitMatchesSelector(selectors);
68
- }
69
60
  function isVisible(element) {
61
+ if (typeof element.checkVisibility === "function") {
62
+ return element.checkVisibility();
63
+ }
70
64
  const htmlElement = element;
71
65
  return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0;
72
66
  }
73
- function closest(element, selectors) {
74
- if ("closest" in element)
75
- return element.closest(selectors);
76
- do {
77
- if (matches(element, selectors))
78
- return element;
79
- element = element.parentElement || element.parentNode;
80
- } while (element !== null && element.nodeType === 1);
81
- return null;
82
- }
83
67
  function isTextField(element) {
84
68
  try {
85
69
  const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null;
@@ -196,9 +180,7 @@ export {
196
180
  contains,
197
181
  isFrame,
198
182
  isButton,
199
- matches,
200
183
  isVisible,
201
- closest,
202
184
  isTextField,
203
185
  isTextbox,
204
186
  getTextboxValue,
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "./YVUNPQHS.js";
4
+ } from "./PBSSD2DM.js";
5
5
  import {
6
6
  createStore
7
7
  } from "./R676XYVY.js";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  createCollectionStore
4
- } from "./ABMC67JW.js";
4
+ } from "./EQPTKGFA.js";
5
5
  import {
6
6
  flatten2DArray,
7
7
  reverseArray
@@ -1,5 +1,5 @@
1
- import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
2
- import type { PickRequired, SetState, ToPrimitive } from "../utils/types.js";
1
+ import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
2
+ import type { PickRequired, SetState, ToPrimitive } from "../utils/types.ts";
3
3
  /**
4
4
  * Creates a checkbox store.
5
5
  */
@@ -1,5 +1,5 @@
1
- import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
2
- import type { BivariantCallback } from "../utils/types.js";
1
+ import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
2
+ import type { BivariantCallback } from "../utils/types.ts";
3
3
  /**
4
4
  * Creates a collection store.
5
5
  */
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  createCollectionStore
4
- } from "../__chunks/ABMC67JW.js";
4
+ } from "../__chunks/EQPTKGFA.js";
5
5
  import "../__chunks/R676XYVY.js";
6
6
  import "../__chunks/22HHDS5F.js";
7
- import "../__chunks/IUORCTET.js";
7
+ import "../__chunks/I2NJJ3XW.js";
8
8
  import "../__chunks/4R3V3JGP.js";
9
9
  export {
10
10
  createCollectionStore
@@ -1,8 +1,8 @@
1
- import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
2
- import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
3
- import type { TagStore } from "../tag/tag-store.js";
4
- import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
5
- import type { PickRequired, SetState } from "../utils/types.js";
1
+ import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.ts";
2
+ import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.ts";
3
+ import type { TagStore } from "../tag/tag-store.ts";
4
+ import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
5
+ import type { PickRequired, SetState } from "../utils/types.ts";
6
6
  type MutableValue<T extends ComboboxStoreSelectedValue = ComboboxStoreSelectedValue> = T extends string ? string : T;
7
7
  /**
8
8
  * Creates a combobox store.
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "../__chunks/YVUNPQHS.js";
5
- import "../__chunks/ABMC67JW.js";
4
+ } from "../__chunks/PBSSD2DM.js";
5
+ import "../__chunks/EQPTKGFA.js";
6
6
  import "../__chunks/7PRQYBBV.js";
7
7
  import {
8
8
  createPopoverStore
@@ -23,9 +23,10 @@ import {
23
23
  defaultValue
24
24
  } from "../__chunks/22HHDS5F.js";
25
25
  import {
26
- isSafari
27
- } from "../__chunks/QAI5BPCY.js";
28
- import "../__chunks/IUORCTET.js";
26
+ isSafari,
27
+ isTouchDevice
28
+ } from "../__chunks/CLSHHUGK.js";
29
+ import "../__chunks/I2NJJ3XW.js";
29
30
  import {
30
31
  __objRest,
31
32
  __spreadProps,
@@ -33,7 +34,7 @@ import {
33
34
  } from "../__chunks/4R3V3JGP.js";
34
35
 
35
36
  // src/combobox/combobox-store.ts
36
- var isSafariOnMobile = isSafari() && matchMedia("(hover:none)").matches;
37
+ var isTouchSafari = isSafari() && isTouchDevice();
37
38
  function createComboboxStore(_a = {}) {
38
39
  var _b = _a, {
39
40
  tag
@@ -67,7 +68,7 @@ function createComboboxStore(_a = {}) {
67
68
  virtualFocus: defaultValue(
68
69
  props.virtualFocus,
69
70
  syncState == null ? void 0 : syncState.virtualFocus,
70
- !isSafariOnMobile
71
+ true
71
72
  )
72
73
  }));
73
74
  const popover = createPopoverStore(__spreadProps(__spreadValues({}, props), {
@@ -107,6 +108,14 @@ function createComboboxStore(_a = {}) {
107
108
  activeValue: syncState == null ? void 0 : syncState.activeValue
108
109
  });
109
110
  const combobox = createStore(initialState, composite, popover, store);
111
+ if (isTouchSafari) {
112
+ setup(
113
+ combobox,
114
+ () => sync(combobox, ["virtualFocus"], () => {
115
+ combobox.setState("virtualFocus", false);
116
+ })
117
+ );
118
+ }
110
119
  setup(combobox, () => {
111
120
  if (!tag)
112
121
  return;
@@ -1,5 +1,5 @@
1
- import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
2
- import type { Store, StoreProps } from "../utils/store.js";
1
+ import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.ts";
2
+ import type { Store, StoreProps } from "../utils/store.ts";
3
3
  /**
4
4
  * Creates a compositeOverflow store.
5
5
  */
@@ -1,6 +1,6 @@
1
- import type { CollectionStoreFunctions, CollectionStoreItem, CollectionStoreOptions, CollectionStoreState } from "../collection/collection-store.js";
2
- import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
3
- import type { SetState } from "../utils/types.js";
1
+ import type { CollectionStoreFunctions, CollectionStoreItem, CollectionStoreOptions, CollectionStoreState } from "../collection/collection-store.ts";
2
+ import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
3
+ import type { SetState } from "../utils/types.ts";
4
4
  type Orientation = "horizontal" | "vertical" | "both";
5
5
  /**
6
6
  * Creates a composite store.
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "../__chunks/YVUNPQHS.js";
5
- import "../__chunks/ABMC67JW.js";
4
+ } from "../__chunks/PBSSD2DM.js";
5
+ import "../__chunks/EQPTKGFA.js";
6
6
  import "../__chunks/7PRQYBBV.js";
7
7
  import "../__chunks/R676XYVY.js";
8
8
  import "../__chunks/22HHDS5F.js";
9
- import "../__chunks/IUORCTET.js";
9
+ import "../__chunks/I2NJJ3XW.js";
10
10
  import "../__chunks/4R3V3JGP.js";
11
11
  export {
12
12
  createCompositeStore
@@ -1,5 +1,5 @@
1
- import type { DisclosureStoreFunctions, DisclosureStoreOptions, DisclosureStoreState } from "../disclosure/disclosure-store.js";
2
- import type { Store, StoreProps } from "../utils/store.js";
1
+ import type { DisclosureStoreFunctions, DisclosureStoreOptions, DisclosureStoreState } from "../disclosure/disclosure-store.ts";
2
+ import type { Store, StoreProps } from "../utils/store.ts";
3
3
  /**
4
4
  * Creates a dialog store.
5
5
  */
@@ -1,5 +1,5 @@
1
- import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
2
- import type { SetState } from "../utils/types.js";
1
+ import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
2
+ import type { SetState } from "../utils/types.ts";
3
3
  /**
4
4
  * Creates a disclosure store.
5
5
  */
@@ -1,7 +1,7 @@
1
- import type { CollectionStoreFunctions, CollectionStoreItem, CollectionStoreOptions, CollectionStoreState } from "../collection/collection-store.js";
2
- import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
3
- import type { AnyObject, PickRequired, SetState, SetStateAction } from "../utils/types.js";
4
- import type { DeepMap, DeepPartial, Names, StringLike } from "./types.js";
1
+ import type { CollectionStoreFunctions, CollectionStoreItem, CollectionStoreOptions, CollectionStoreState } from "../collection/collection-store.ts";
2
+ import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
3
+ import type { AnyObject, PickRequired, SetState, SetStateAction } from "../utils/types.ts";
4
+ import type { DeepMap, DeepPartial, Names, StringLike } from "./types.ts";
5
5
  type ErrorMessage = string | undefined | null;
6
6
  export declare function hasMessages(object: FormStoreValues): boolean;
7
7
  export declare function get<T>(values: FormStoreValues, path: StringLike | string[], defaultValue?: T): T;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  createCollectionStore
4
- } from "../__chunks/ABMC67JW.js";
4
+ } from "../__chunks/EQPTKGFA.js";
5
5
  import {
6
6
  createStore,
7
7
  init,
@@ -14,7 +14,7 @@ import {
14
14
  isInteger,
15
15
  isObject
16
16
  } from "../__chunks/22HHDS5F.js";
17
- import "../__chunks/IUORCTET.js";
17
+ import "../__chunks/I2NJJ3XW.js";
18
18
  import {
19
19
  __spreadProps,
20
20
  __spreadValues
@@ -1,11 +1,11 @@
1
- import type { AnyObject } from "../utils/types.js";
1
+ import type { AnyObject } from "../utils/types.ts";
2
2
  /**
3
3
  * An object or primitive value that can be converted to a string.
4
4
  */
5
- export type StringLike = {
5
+ export interface StringLike {
6
6
  toString: () => string;
7
7
  valueOf: () => string;
8
- };
8
+ }
9
9
  /**
10
10
  * Maps through an object `T` or array and defines the leaf values to the given
11
11
  * type `V`.
@@ -1,6 +1,6 @@
1
- import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.js";
2
- import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
3
- import type { SetState } from "../utils/types.js";
1
+ import type { PopoverStoreFunctions, PopoverStoreOptions, PopoverStoreState } from "../popover/popover-store.ts";
2
+ import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
3
+ import type { SetState } from "../utils/types.ts";
4
4
  /**
5
5
  * Creates a hovercard store.
6
6
  */
@@ -1,5 +1,5 @@
1
- import type { MenubarStoreFunctions, MenubarStoreOptions, MenubarStoreState } from "../menubar/menubar-store.js";
2
- import type { Store, StoreProps } from "../utils/store.js";
1
+ import type { MenubarStoreFunctions, MenubarStoreOptions, MenubarStoreState } from "../menubar/menubar-store.ts";
2
+ import type { Store, StoreProps } from "../utils/store.ts";
3
3
  /**
4
4
  * Creates a menu bar store.
5
5
  */