@ariakit/core 0.4.5 → 0.4.7

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 (146) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/cjs/__chunks/{QD2A4YF6.cjs → 3COGJMN3.cjs} +11 -11
  3. package/cjs/__chunks/{MHZQJPY3.cjs → 5BQ2XS3R.cjs} +4 -4
  4. package/cjs/__chunks/{2D5LEVE7.cjs → D7M2PCAQ.cjs} +6 -6
  5. package/cjs/__chunks/{LTLFSC4X.cjs → DIYYVJDK.cjs} +2 -2
  6. package/cjs/__chunks/{AETQC2AR.cjs → LAYUSNGM.cjs} +11 -11
  7. package/cjs/__chunks/{KL74MAHB.cjs → LBFF2BBK.cjs} +6 -6
  8. package/cjs/__chunks/{B4LYZ4EM.cjs → M2NNCFIJ.cjs} +13 -11
  9. package/cjs/__chunks/{5JEQEZFR.cjs → MB5TLEVH.cjs} +7 -7
  10. package/cjs/__chunks/{IMYW2UAC.cjs → Q2WCPTYS.cjs} +4 -22
  11. package/cjs/__chunks/{UEZLSKZ4.cjs → XVL5HZ27.cjs} +4 -4
  12. package/cjs/checkbox/checkbox-store.cjs +3 -3
  13. package/cjs/checkbox/checkbox-store.d.cts +2 -2
  14. package/cjs/checkbox/checkbox-store.d.ts +2 -2
  15. package/cjs/collection/collection-store.cjs +4 -4
  16. package/cjs/collection/collection-store.d.cts +2 -2
  17. package/cjs/collection/collection-store.d.ts +2 -2
  18. package/cjs/combobox/combobox-store.cjs +35 -26
  19. package/cjs/combobox/combobox-store.d.cts +7 -5
  20. package/cjs/combobox/combobox-store.d.ts +7 -5
  21. package/cjs/composite/composite-overflow-store.cjs +5 -5
  22. package/cjs/composite/composite-overflow-store.d.cts +2 -2
  23. package/cjs/composite/composite-overflow-store.d.ts +2 -2
  24. package/cjs/composite/composite-store.cjs +5 -5
  25. package/cjs/composite/composite-store.d.cts +8 -4
  26. package/cjs/composite/composite-store.d.ts +8 -4
  27. package/cjs/dialog/dialog-store.cjs +4 -4
  28. package/cjs/dialog/dialog-store.d.cts +2 -2
  29. package/cjs/dialog/dialog-store.d.ts +2 -2
  30. package/cjs/disclosure/disclosure-store.cjs +3 -3
  31. package/cjs/disclosure/disclosure-store.d.cts +2 -2
  32. package/cjs/disclosure/disclosure-store.d.ts +2 -2
  33. package/cjs/form/form-store.cjs +8 -8
  34. package/cjs/form/form-store.d.cts +4 -4
  35. package/cjs/form/form-store.d.ts +4 -4
  36. package/cjs/form/types.d.cts +3 -3
  37. package/cjs/form/types.d.ts +3 -3
  38. package/cjs/hovercard/hovercard-store.cjs +6 -6
  39. package/cjs/hovercard/hovercard-store.d.cts +3 -3
  40. package/cjs/hovercard/hovercard-store.d.ts +3 -3
  41. package/cjs/menu/menu-bar-store.cjs +6 -6
  42. package/cjs/menu/menu-bar-store.d.cts +2 -2
  43. package/cjs/menu/menu-bar-store.d.ts +2 -2
  44. package/cjs/menu/menu-store.cjs +19 -19
  45. package/cjs/menu/menu-store.d.cts +6 -6
  46. package/cjs/menu/menu-store.d.ts +6 -6
  47. package/cjs/menubar/menubar-store.cjs +6 -6
  48. package/cjs/menubar/menubar-store.d.cts +2 -2
  49. package/cjs/menubar/menubar-store.d.ts +2 -2
  50. package/cjs/popover/popover-store.cjs +5 -5
  51. package/cjs/popover/popover-store.d.cts +3 -3
  52. package/cjs/popover/popover-store.d.ts +3 -3
  53. package/cjs/radio/radio-store.cjs +6 -6
  54. package/cjs/radio/radio-store.d.cts +3 -3
  55. package/cjs/radio/radio-store.d.ts +3 -3
  56. package/cjs/select/select-store.cjs +31 -21
  57. package/cjs/select/select-store.d.cts +19 -9
  58. package/cjs/select/select-store.d.ts +19 -9
  59. package/cjs/tab/tab-store.cjs +58 -25
  60. package/cjs/tab/tab-store.d.cts +17 -10
  61. package/cjs/tab/tab-store.d.ts +17 -10
  62. package/cjs/tag/tag-store.cjs +8 -8
  63. package/cjs/tag/tag-store.d.cts +3 -3
  64. package/cjs/tag/tag-store.d.ts +3 -3
  65. package/cjs/toolbar/toolbar-store.cjs +5 -5
  66. package/cjs/toolbar/toolbar-store.d.cts +2 -2
  67. package/cjs/toolbar/toolbar-store.d.ts +2 -2
  68. package/cjs/tooltip/tooltip-store.cjs +7 -7
  69. package/cjs/tooltip/tooltip-store.d.cts +2 -2
  70. package/cjs/tooltip/tooltip-store.d.ts +2 -2
  71. package/cjs/utils/dom.cjs +2 -6
  72. package/cjs/utils/dom.d.cts +1 -17
  73. package/cjs/utils/dom.d.ts +1 -17
  74. package/cjs/utils/events.cjs +23 -16
  75. package/cjs/utils/events.d.cts +1 -1
  76. package/cjs/utils/events.d.ts +1 -1
  77. package/cjs/utils/focus.cjs +20 -18
  78. package/cjs/utils/focus.d.cts +1 -1
  79. package/cjs/utils/focus.d.ts +1 -1
  80. package/cjs/utils/misc.d.cts +1 -1
  81. package/cjs/utils/misc.d.ts +1 -1
  82. package/cjs/utils/platform.cjs +3 -3
  83. package/cjs/utils/store.cjs +2 -2
  84. package/cjs/utils/store.d.cts +3 -3
  85. package/cjs/utils/store.d.ts +3 -3
  86. package/esm/__chunks/{QAI5BPCY.js → CLSHHUGK.js} +1 -1
  87. package/esm/__chunks/{BRS7GKWU.js → E4HA32QI.js} +2 -2
  88. package/esm/__chunks/{IUORCTET.js → I2NJJ3XW.js} +3 -21
  89. package/esm/__chunks/{ABMC67JW.js → I2WJ7JBQ.js} +2 -2
  90. package/esm/__chunks/{WCKXDMU7.js → KDSZSVV5.js} +1 -1
  91. package/esm/__chunks/{R676XYVY.js → KLPDXTDE.js} +13 -11
  92. package/esm/__chunks/{5RJNXXU2.js → NWACXGIN.js} +1 -1
  93. package/esm/__chunks/{K7A7LTR3.js → RCLYDUHE.js} +2 -2
  94. package/esm/__chunks/{MFZZDIHG.js → SAZZJI72.js} +2 -2
  95. package/esm/__chunks/{YVUNPQHS.js → VH2P7HEP.js} +2 -2
  96. package/esm/checkbox/checkbox-store.d.ts +2 -2
  97. package/esm/checkbox/checkbox-store.js +1 -1
  98. package/esm/collection/collection-store.d.ts +2 -2
  99. package/esm/collection/collection-store.js +3 -3
  100. package/esm/combobox/combobox-store.d.ts +7 -5
  101. package/esm/combobox/combobox-store.js +20 -11
  102. package/esm/composite/composite-overflow-store.d.ts +2 -2
  103. package/esm/composite/composite-overflow-store.js +4 -4
  104. package/esm/composite/composite-store.d.ts +8 -4
  105. package/esm/composite/composite-store.js +4 -4
  106. package/esm/dialog/dialog-store.d.ts +2 -2
  107. package/esm/dialog/dialog-store.js +3 -3
  108. package/esm/disclosure/disclosure-store.d.ts +2 -2
  109. package/esm/disclosure/disclosure-store.js +2 -2
  110. package/esm/form/form-store.d.ts +4 -4
  111. package/esm/form/form-store.js +3 -3
  112. package/esm/form/types.d.ts +3 -3
  113. package/esm/hovercard/hovercard-store.d.ts +3 -3
  114. package/esm/hovercard/hovercard-store.js +5 -5
  115. package/esm/menu/menu-bar-store.d.ts +2 -2
  116. package/esm/menu/menu-bar-store.js +5 -5
  117. package/esm/menu/menu-store.d.ts +6 -6
  118. package/esm/menu/menu-store.js +8 -8
  119. package/esm/menubar/menubar-store.d.ts +2 -2
  120. package/esm/menubar/menubar-store.js +5 -5
  121. package/esm/popover/popover-store.d.ts +3 -3
  122. package/esm/popover/popover-store.js +4 -4
  123. package/esm/radio/radio-store.d.ts +3 -3
  124. package/esm/radio/radio-store.js +4 -4
  125. package/esm/select/select-store.d.ts +19 -9
  126. package/esm/select/select-store.js +19 -9
  127. package/esm/tab/tab-store.d.ts +17 -10
  128. package/esm/tab/tab-store.js +44 -11
  129. package/esm/tag/tag-store.d.ts +3 -3
  130. package/esm/tag/tag-store.js +4 -4
  131. package/esm/toolbar/toolbar-store.d.ts +2 -2
  132. package/esm/toolbar/toolbar-store.js +4 -4
  133. package/esm/tooltip/tooltip-store.d.ts +2 -2
  134. package/esm/tooltip/tooltip-store.js +5 -5
  135. package/esm/utils/dom.d.ts +1 -17
  136. package/esm/utils/dom.js +1 -5
  137. package/esm/utils/events.d.ts +1 -1
  138. package/esm/utils/events.js +20 -13
  139. package/esm/utils/focus.d.ts +1 -1
  140. package/esm/utils/focus.js +12 -10
  141. package/esm/utils/misc.d.ts +1 -1
  142. package/esm/utils/platform.js +2 -2
  143. package/esm/utils/store.d.ts +3 -3
  144. package/esm/utils/store.js +1 -1
  145. package/package.json +2 -2
  146. package/.eslintignore +0 -6
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "../__chunks/YVUNPQHS.js";
4
+ } from "../__chunks/VH2P7HEP.js";
5
5
  import {
6
6
  createCollectionStore
7
- } from "../__chunks/ABMC67JW.js";
7
+ } from "../__chunks/I2WJ7JBQ.js";
8
8
  import "../__chunks/7PRQYBBV.js";
9
9
  import {
10
10
  batch,
@@ -13,11 +13,12 @@ import {
13
13
  omit,
14
14
  setup,
15
15
  sync
16
- } from "../__chunks/R676XYVY.js";
16
+ } from "../__chunks/KLPDXTDE.js";
17
17
  import {
18
+ chain,
18
19
  defaultValue
19
20
  } from "../__chunks/22HHDS5F.js";
20
- import "../__chunks/IUORCTET.js";
21
+ import "../__chunks/I2NJJ3XW.js";
21
22
  import {
22
23
  __objRest,
23
24
  __spreadProps,
@@ -38,6 +39,8 @@ function createTabStore(_a = {}) {
38
39
  "renderedItems",
39
40
  "moves",
40
41
  "orientation",
42
+ "virtualFocus",
43
+ "includesBaseElement",
41
44
  "baseElement",
42
45
  "focusLoop",
43
46
  "focusShift",
@@ -50,6 +53,16 @@ function createTabStore(_a = {}) {
50
53
  );
51
54
  const syncState = store == null ? void 0 : store.getState();
52
55
  const composite = createCompositeStore(__spreadProps(__spreadValues({}, props), {
56
+ store,
57
+ // We need to explicitly set the default value of `includesBaseElement` to
58
+ // `false` since we don't want the composite store to default it to `true`
59
+ // when the activeId state is null, which could be the case when rendering
60
+ // combobox with tab.
61
+ includesBaseElement: defaultValue(
62
+ props.includesBaseElement,
63
+ syncState == null ? void 0 : syncState.includesBaseElement,
64
+ false
65
+ ),
53
66
  orientation: defaultValue(
54
67
  props.orientation,
55
68
  syncState == null ? void 0 : syncState.orientation,
@@ -62,8 +75,7 @@ function createTabStore(_a = {}) {
62
75
  selectedId: defaultValue(
63
76
  props.selectedId,
64
77
  syncState == null ? void 0 : syncState.selectedId,
65
- props.defaultSelectedId,
66
- void 0
78
+ props.defaultSelectedId
67
79
  ),
68
80
  selectOnMove: defaultValue(
69
81
  props.selectOnMove,
@@ -92,11 +104,11 @@ function createTabStore(_a = {}) {
92
104
  );
93
105
  setup(
94
106
  tab,
95
- () => batch(
96
- tab,
97
- ["selectedId"],
98
- (state) => tab.setState("activeId", state.selectedId)
99
- )
107
+ () => batch(tab, ["selectedId"], (state, prev) => {
108
+ if (parentComposite && state.selectedId === prev.selectedId)
109
+ return;
110
+ tab.setState("activeId", state.selectedId);
111
+ })
100
112
  );
101
113
  setup(
102
114
  tab,
@@ -137,6 +149,27 @@ function createTabStore(_a = {}) {
137
149
  });
138
150
  })
139
151
  );
152
+ let selectedIdFromSelectedValue = null;
153
+ setup(tab, () => {
154
+ const backupSelectedId = () => {
155
+ selectedIdFromSelectedValue = tab.getState().selectedId;
156
+ };
157
+ const restoreSelectedId = () => {
158
+ tab.setState("selectedId", selectedIdFromSelectedValue);
159
+ };
160
+ if (parentComposite && "setSelectElement" in parentComposite) {
161
+ return chain(
162
+ sync(parentComposite, ["value"], backupSelectedId),
163
+ sync(parentComposite, ["open"], restoreSelectedId)
164
+ );
165
+ }
166
+ if (!combobox)
167
+ return;
168
+ return chain(
169
+ sync(combobox, ["selectedValue"], backupSelectedId),
170
+ sync(combobox, ["open"], restoreSelectedId)
171
+ );
172
+ });
140
173
  return __spreadProps(__spreadValues(__spreadValues({}, composite), tab), {
141
174
  panels,
142
175
  setSelectedId: (id) => tab.setState("selectedId", id),
@@ -1,6 +1,6 @@
1
- import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
2
- import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
3
- import type { SetState } from "../utils/types.js";
1
+ import type { CompositeStoreFunctions, CompositeStoreItem, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-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 tag store.
6
6
  */
@@ -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/VH2P7HEP.js";
5
+ import "../__chunks/I2WJ7JBQ.js";
6
6
  import "../__chunks/7PRQYBBV.js";
7
7
  import {
8
8
  UndoManager
@@ -11,12 +11,12 @@ import {
11
11
  createStore,
12
12
  setup,
13
13
  sync
14
- } from "../__chunks/R676XYVY.js";
14
+ } from "../__chunks/KLPDXTDE.js";
15
15
  import {
16
16
  applyState,
17
17
  defaultValue
18
18
  } from "../__chunks/22HHDS5F.js";
19
- import "../__chunks/IUORCTET.js";
19
+ import "../__chunks/I2NJJ3XW.js";
20
20
  import {
21
21
  __spreadProps,
22
22
  __spreadValues
@@ -1,5 +1,5 @@
1
- import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.js";
2
- import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
1
+ import type { CompositeStoreFunctions, CompositeStoreOptions, CompositeStoreState } from "../composite/composite-store.ts";
2
+ import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
3
3
  /**
4
4
  * Creates a toolbar store.
5
5
  */
@@ -1,14 +1,14 @@
1
1
  "use client";
2
2
  import {
3
3
  createCompositeStore
4
- } from "../__chunks/YVUNPQHS.js";
5
- import "../__chunks/ABMC67JW.js";
4
+ } from "../__chunks/VH2P7HEP.js";
5
+ import "../__chunks/I2WJ7JBQ.js";
6
6
  import "../__chunks/7PRQYBBV.js";
7
- import "../__chunks/R676XYVY.js";
7
+ import "../__chunks/KLPDXTDE.js";
8
8
  import {
9
9
  defaultValue
10
10
  } from "../__chunks/22HHDS5F.js";
11
- import "../__chunks/IUORCTET.js";
11
+ import "../__chunks/I2NJJ3XW.js";
12
12
  import {
13
13
  __spreadProps,
14
14
  __spreadValues
@@ -1,5 +1,5 @@
1
- import type { HovercardStoreFunctions, HovercardStoreOptions, HovercardStoreState } from "../hovercard/hovercard-store.js";
2
- import type { Store, StoreOptions, StoreProps } from "../utils/store.js";
1
+ import type { HovercardStoreFunctions, HovercardStoreOptions, HovercardStoreState } from "../hovercard/hovercard-store.ts";
2
+ import type { Store, StoreOptions, StoreProps } from "../utils/store.ts";
3
3
  /**
4
4
  * Creates a tooltip store.
5
5
  */
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import {
3
3
  createHovercardStore
4
- } from "../__chunks/BRS7GKWU.js";
5
- import "../__chunks/MFZZDIHG.js";
6
- import "../__chunks/5RJNXXU2.js";
7
- import "../__chunks/WCKXDMU7.js";
4
+ } from "../__chunks/E4HA32QI.js";
5
+ import "../__chunks/SAZZJI72.js";
6
+ import "../__chunks/NWACXGIN.js";
7
+ import "../__chunks/KDSZSVV5.js";
8
8
  import {
9
9
  createStore
10
- } from "../__chunks/R676XYVY.js";
10
+ } from "../__chunks/KLPDXTDE.js";
11
11
  import {
12
12
  defaultValue
13
13
  } from "../__chunks/22HHDS5F.js";
@@ -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.
package/esm/utils/dom.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use client";
2
2
  import {
3
3
  canUseDOM,
4
- closest,
5
4
  contains,
6
5
  getActiveElement,
7
6
  getDocument,
@@ -17,14 +16,12 @@ import {
17
16
  isTextField,
18
17
  isTextbox,
19
18
  isVisible,
20
- matches,
21
19
  scrollIntoViewIfNeeded,
22
20
  setSelectionRange
23
- } from "../__chunks/IUORCTET.js";
21
+ } from "../__chunks/I2NJJ3XW.js";
24
22
  import "../__chunks/4R3V3JGP.js";
25
23
  export {
26
24
  canUseDOM,
27
- closest,
28
25
  contains,
29
26
  getActiveElement,
30
27
  getDocument,
@@ -40,7 +37,6 @@ export {
40
37
  isTextField,
41
38
  isTextbox,
42
39
  isVisible,
43
- matches,
44
40
  scrollIntoViewIfNeeded,
45
41
  setSelectionRange
46
42
  };
@@ -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;
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  isApple
4
- } from "../__chunks/QAI5BPCY.js";
4
+ } from "../__chunks/CLSHHUGK.js";
5
5
  import {
6
6
  contains
7
- } from "../__chunks/IUORCTET.js";
7
+ } from "../__chunks/I2NJJ3XW.js";
8
8
  import {
9
9
  __spreadProps,
10
10
  __spreadValues
@@ -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 = [];
@@ -122,7 +127,9 @@ function addGlobalEventListener(type, listener, options, scope = window) {
122
127
  scope.document.removeEventListener(type, listener, options);
123
128
  } catch (e) {
124
129
  }
125
- children.forEach((remove) => remove());
130
+ for (const remove of children) {
131
+ remove();
132
+ }
126
133
  };
127
134
  return removeEventListener;
128
135
  }
@@ -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,12 +1,10 @@
1
1
  "use client";
2
2
  import {
3
- closest,
4
3
  contains,
5
4
  getActiveElement,
6
5
  isFrame,
7
- isVisible,
8
- matches
9
- } from "../__chunks/IUORCTET.js";
6
+ isVisible
7
+ } from "../__chunks/I2NJJ3XW.js";
10
8
  import {
11
9
  __spreadValues
12
10
  } from "../__chunks/4R3V3JGP.js";
@@ -14,15 +12,15 @@ import {
14
12
  // src/utils/focus.ts
15
13
  var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])";
16
14
  function hasNegativeTabIndex(element) {
17
- const tabIndex = parseInt(element.getAttribute("tabindex") || "0", 10);
15
+ const tabIndex = Number.parseInt(element.getAttribute("tabindex") || "0", 10);
18
16
  return tabIndex < 0;
19
17
  }
20
18
  function isFocusable(element) {
21
- if (!matches(element, selector))
19
+ if (!element.matches(selector))
22
20
  return false;
23
21
  if (!isVisible(element))
24
22
  return false;
25
- if (closest(element, "[inert]"))
23
+ if (element.closest("[inert]"))
26
24
  return false;
27
25
  return true;
28
26
  }
@@ -164,7 +162,7 @@ function getPreviousTabbable(fallbackToFirst, fallbackToFocusable) {
164
162
  }
165
163
  function getClosestFocusable(element) {
166
164
  while (element && !isFocusable(element)) {
167
- element = closest(element, selector);
165
+ element = element.closest(selector);
168
166
  }
169
167
  return element || null;
170
168
  }
@@ -207,7 +205,9 @@ function disableFocus(element) {
207
205
  }
208
206
  function disableFocusIn(container, includeContainer) {
209
207
  const tabbableElements = getAllTabbableIn(container, includeContainer);
210
- tabbableElements.forEach(disableFocus);
208
+ for (const element of tabbableElements) {
209
+ disableFocus(element);
210
+ }
211
211
  }
212
212
  function restoreFocusIn(container) {
213
213
  const elements = container.querySelectorAll("[data-tabindex]");
@@ -223,7 +223,9 @@ function restoreFocusIn(container) {
223
223
  if (container.hasAttribute("data-tabindex")) {
224
224
  restoreTabIndex(container);
225
225
  }
226
- elements.forEach(restoreTabIndex);
226
+ for (const element of elements) {
227
+ restoreTabIndex(element);
228
+ }
227
229
  }
228
230
  function focusIntoView(element, options) {
229
231
  if (!("scrollIntoView" in element)) {
@@ -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 @@ import {
5
5
  isMac,
6
6
  isSafari,
7
7
  isTouchDevice
8
- } from "../__chunks/QAI5BPCY.js";
9
- import "../__chunks/IUORCTET.js";
8
+ } from "../__chunks/CLSHHUGK.js";
9
+ import "../__chunks/I2NJJ3XW.js";
10
10
  import "../__chunks/4R3V3JGP.js";
11
11
  export {
12
12
  isApple,
@@ -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.
@@ -10,7 +10,7 @@ import {
10
10
  subscribe,
11
11
  sync,
12
12
  throwOnConflictingProps
13
- } from "../__chunks/R676XYVY.js";
13
+ } from "../__chunks/KLPDXTDE.js";
14
14
  import "../__chunks/22HHDS5F.js";
15
15
  import "../__chunks/4R3V3JGP.js";
16
16
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ariakit/core",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "description": "Ariakit core",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -20,7 +20,7 @@
20
20
  "url": "https://github.com/diegohaz"
21
21
  },
22
22
  "scripts": {
23
- "lint": "eslint . --ext js,ts,tsx",
23
+ "lint": "biome check .",
24
24
  "build": "node ../../scripts/build/build.js",
25
25
  "clean": "node ../../scripts/build/clean.js"
26
26
  },
package/.eslintignore DELETED
@@ -1,6 +0,0 @@
1
- cjs
2
- esm
3
- ts
4
- umd
5
- coverage
6
- node_modules