@ariakit/core 0.4.7 → 0.4.8

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 (89) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/cjs/__chunks/{M2NNCFIJ.cjs → 3QF3ODTR.cjs} +31 -50
  3. package/cjs/__chunks/{LPDHSEHU.cjs → 7CES7GVE.cjs} +4 -8
  4. package/cjs/__chunks/{Q2WCPTYS.cjs → 7WYII4AN.cjs} +6 -12
  5. package/cjs/__chunks/{EEDWPDM2.cjs → BTUHABP4.cjs} +16 -30
  6. package/cjs/__chunks/{3COGJMN3.cjs → CCI5VM7E.cjs} +24 -30
  7. package/cjs/__chunks/{MB5TLEVH.cjs → H6ZQSQQL.cjs} +16 -16
  8. package/cjs/__chunks/{D7M2PCAQ.cjs → KCEXELK7.cjs} +6 -7
  9. package/cjs/__chunks/{DIYYVJDK.cjs → N667HVED.cjs} +2 -2
  10. package/cjs/__chunks/{LBFF2BBK.cjs → PW36G76L.cjs} +25 -29
  11. package/cjs/__chunks/{LAYUSNGM.cjs → QLWAGBAQ.cjs} +20 -22
  12. package/cjs/__chunks/{5BQ2XS3R.cjs → VJAE2Y4T.cjs} +10 -10
  13. package/cjs/__chunks/XIZWLBI2.cjs +42 -0
  14. package/cjs/checkbox/checkbox-store.cjs +7 -7
  15. package/cjs/collection/collection-store.cjs +6 -6
  16. package/cjs/combobox/combobox-store.cjs +50 -56
  17. package/cjs/composite/composite-overflow-store.cjs +7 -7
  18. package/cjs/composite/composite-store.cjs +7 -7
  19. package/cjs/dialog/dialog-store.cjs +6 -6
  20. package/cjs/disclosure/disclosure-store.cjs +5 -5
  21. package/cjs/form/form-store.cjs +32 -36
  22. package/cjs/hovercard/hovercard-store.cjs +8 -8
  23. package/cjs/index.cjs +1 -1
  24. package/cjs/menu/menu-bar-store.cjs +8 -8
  25. package/cjs/menu/menu-store.cjs +37 -42
  26. package/cjs/menubar/menubar-store.cjs +8 -8
  27. package/cjs/popover/popover-store.cjs +7 -7
  28. package/cjs/radio/radio-store.cjs +13 -13
  29. package/cjs/select/select-store.cjs +49 -62
  30. package/cjs/tab/tab-store.cjs +49 -61
  31. package/cjs/tag/tag-store.cjs +23 -27
  32. package/cjs/toolbar/toolbar-store.cjs +9 -9
  33. package/cjs/tooltip/tooltip-store.cjs +15 -15
  34. package/cjs/utils/array.cjs +1 -1
  35. package/cjs/utils/dom.cjs +3 -3
  36. package/cjs/utils/events.cjs +22 -36
  37. package/cjs/utils/focus.cjs +34 -58
  38. package/cjs/utils/misc.cjs +3 -3
  39. package/cjs/utils/misc.d.cts +1 -1
  40. package/cjs/utils/misc.d.ts +1 -1
  41. package/cjs/utils/platform.cjs +4 -4
  42. package/cjs/utils/store.cjs +4 -4
  43. package/cjs/utils/undo.cjs +3 -3
  44. package/esm/__chunks/{SAZZJI72.js → 3UYWTADI.js} +4 -4
  45. package/esm/__chunks/{I2WJ7JBQ.js → 6DHTHWXD.js} +10 -16
  46. package/esm/__chunks/{KDSZSVV5.js → 6E4KKOSB.js} +5 -7
  47. package/esm/__chunks/{EKIWAN6A.js → 7LM4Q2XB.js} +4 -8
  48. package/esm/__chunks/{VH2P7HEP.js → D7EIQZAU.js} +8 -12
  49. package/esm/__chunks/{E4HA32QI.js → EACLTACN.js} +4 -4
  50. package/esm/__chunks/{KLPDXTDE.js → EQQLU3CG.js} +21 -40
  51. package/esm/__chunks/{I2NJJ3XW.js → HWOIWM4O.js} +6 -12
  52. package/esm/__chunks/{22HHDS5F.js → PBFD2E7P.js} +15 -29
  53. package/esm/__chunks/{RCLYDUHE.js → PIWLWQMB.js} +4 -4
  54. package/esm/__chunks/{CLSHHUGK.js → US4USQPI.js} +2 -3
  55. package/esm/__chunks/{NWACXGIN.js → YOHCVXJB.js} +1 -1
  56. package/esm/checkbox/checkbox-store.js +3 -3
  57. package/esm/collection/collection-store.js +5 -5
  58. package/esm/combobox/combobox-store.js +16 -22
  59. package/esm/composite/composite-overflow-store.js +6 -6
  60. package/esm/composite/composite-store.js +6 -6
  61. package/esm/dialog/dialog-store.js +5 -5
  62. package/esm/disclosure/disclosure-store.js +4 -4
  63. package/esm/form/form-store.js +9 -13
  64. package/esm/hovercard/hovercard-store.js +7 -7
  65. package/esm/index.js +1 -1
  66. package/esm/menu/menu-bar-store.js +7 -7
  67. package/esm/menu/menu-store.js +15 -20
  68. package/esm/menubar/menubar-store.js +7 -7
  69. package/esm/popover/popover-store.js +6 -6
  70. package/esm/radio/radio-store.js +6 -6
  71. package/esm/select/select-store.js +22 -35
  72. package/esm/tab/tab-store.js +18 -30
  73. package/esm/tag/tag-store.js +11 -15
  74. package/esm/toolbar/toolbar-store.js +6 -6
  75. package/esm/tooltip/tooltip-store.js +7 -7
  76. package/esm/utils/array.js +1 -1
  77. package/esm/utils/dom.js +2 -2
  78. package/esm/utils/events.js +17 -31
  79. package/esm/utils/focus.js +26 -50
  80. package/esm/utils/misc.d.ts +1 -1
  81. package/esm/utils/misc.js +2 -2
  82. package/esm/utils/platform.js +3 -3
  83. package/esm/utils/store.js +3 -3
  84. package/esm/utils/undo.js +2 -2
  85. package/package.json +1 -1
  86. package/readme.md +18 -0
  87. package/cjs/__chunks/XVL5HZ27.cjs +0 -42
  88. /package/cjs/__chunks/{AV6KTKLE.cjs → 3IVNQNIV.cjs} +0 -0
  89. /package/esm/__chunks/{4R3V3JGP.js → 3YLGPPWQ.js} +0 -0
@@ -4,10 +4,10 @@ import {
4
4
  getActiveElement,
5
5
  isFrame,
6
6
  isVisible
7
- } from "../__chunks/I2NJJ3XW.js";
7
+ } from "../__chunks/HWOIWM4O.js";
8
8
  import {
9
9
  __spreadValues
10
- } from "../__chunks/4R3V3JGP.js";
10
+ } from "../__chunks/3YLGPPWQ.js";
11
11
 
12
12
  // src/utils/focus.ts
13
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,43 +16,27 @@ function hasNegativeTabIndex(element) {
16
16
  return tabIndex < 0;
17
17
  }
18
18
  function isFocusable(element) {
19
- if (!element.matches(selector))
20
- return false;
21
- if (!isVisible(element))
22
- return false;
23
- if (element.closest("[inert]"))
24
- return false;
19
+ if (!element.matches(selector)) return false;
20
+ if (!isVisible(element)) return false;
21
+ if (element.closest("[inert]")) return false;
25
22
  return true;
26
23
  }
27
24
  function isTabbable(element) {
28
- if (!isFocusable(element))
29
- return false;
30
- if (hasNegativeTabIndex(element))
31
- return false;
32
- if (!("form" in element))
33
- return true;
34
- if (!element.form)
35
- return true;
36
- if (element.checked)
37
- return true;
38
- if (element.type !== "radio")
39
- return true;
25
+ if (!isFocusable(element)) return false;
26
+ if (hasNegativeTabIndex(element)) return false;
27
+ if (!("form" in element)) return true;
28
+ if (!element.form) return true;
29
+ if (element.checked) return true;
30
+ if (element.type !== "radio") return true;
40
31
  const radioGroup = element.form.elements.namedItem(element.name);
41
- if (!radioGroup)
42
- return true;
43
- if (!("length" in radioGroup))
44
- return true;
32
+ if (!radioGroup) return true;
33
+ if (!("length" in radioGroup)) return true;
45
34
  const activeElement = getActiveElement(element);
46
- if (!activeElement)
47
- return true;
48
- if (activeElement === element)
49
- return true;
50
- if (!("form" in activeElement))
51
- return true;
52
- if (activeElement.form !== element.form)
53
- return true;
54
- if (activeElement.name !== element.name)
55
- return true;
35
+ if (!activeElement) return true;
36
+ if (activeElement === element) return true;
37
+ if (!("form" in activeElement)) return true;
38
+ if (activeElement.form !== element.form) return true;
39
+ if (activeElement.name !== element.name) return true;
56
40
  return false;
57
41
  }
58
42
  function getAllFocusableIn(container, includeContainer) {
@@ -168,28 +152,20 @@ function getClosestFocusable(element) {
168
152
  }
169
153
  function hasFocus(element) {
170
154
  const activeElement = getActiveElement(element);
171
- if (!activeElement)
172
- return false;
173
- if (activeElement === element)
174
- return true;
155
+ if (!activeElement) return false;
156
+ if (activeElement === element) return true;
175
157
  const activeDescendant = activeElement.getAttribute("aria-activedescendant");
176
- if (!activeDescendant)
177
- return false;
158
+ if (!activeDescendant) return false;
178
159
  return activeDescendant === element.id;
179
160
  }
180
161
  function hasFocusWithin(element) {
181
162
  const activeElement = getActiveElement(element);
182
- if (!activeElement)
183
- return false;
184
- if (contains(element, activeElement))
185
- return true;
163
+ if (!activeElement) return false;
164
+ if (contains(element, activeElement)) return true;
186
165
  const activeDescendant = activeElement.getAttribute("aria-activedescendant");
187
- if (!activeDescendant)
188
- return false;
189
- if (!("id" in element))
190
- return false;
191
- if (activeDescendant === element.id)
192
- return true;
166
+ if (!activeDescendant) return false;
167
+ if (!("id" in element)) return false;
168
+ if (activeDescendant === element.id) return true;
193
169
  return !!element.querySelector(`#${CSS.escape(activeDescendant)}`);
194
170
  }
195
171
  function focusIfNeeded(element) {
@@ -99,7 +99,7 @@ export declare function invariant(condition: any, message?: string | boolean): a
99
99
  /**
100
100
  * Similar to `Object.keys` but returns a type-safe array of keys.
101
101
  */
102
- export declare function getKeys<T extends object>(obj: T): (keyof T)[];
102
+ export declare function getKeys<T extends object>(obj: T): Array<keyof T>;
103
103
  /**
104
104
  * Checks whether a boolean event prop (e.g., hideOnInteractOutside) was
105
105
  * intentionally set to false, either with a boolean value or a callback that
package/esm/utils/misc.js CHANGED
@@ -21,8 +21,8 @@ import {
21
21
  pick,
22
22
  removeUndefinedValues,
23
23
  shallowEqual
24
- } from "../__chunks/22HHDS5F.js";
25
- import "../__chunks/4R3V3JGP.js";
24
+ } from "../__chunks/PBFD2E7P.js";
25
+ import "../__chunks/3YLGPPWQ.js";
26
26
  export {
27
27
  afterPaint,
28
28
  applyState,
@@ -5,9 +5,9 @@ import {
5
5
  isMac,
6
6
  isSafari,
7
7
  isTouchDevice
8
- } from "../__chunks/CLSHHUGK.js";
9
- import "../__chunks/I2NJJ3XW.js";
10
- import "../__chunks/4R3V3JGP.js";
8
+ } from "../__chunks/US4USQPI.js";
9
+ import "../__chunks/HWOIWM4O.js";
10
+ import "../__chunks/3YLGPPWQ.js";
11
11
  export {
12
12
  isApple,
13
13
  isFirefox,
@@ -10,9 +10,9 @@ import {
10
10
  subscribe,
11
11
  sync,
12
12
  throwOnConflictingProps
13
- } from "../__chunks/KLPDXTDE.js";
14
- import "../__chunks/22HHDS5F.js";
15
- import "../__chunks/4R3V3JGP.js";
13
+ } from "../__chunks/EQQLU3CG.js";
14
+ import "../__chunks/PBFD2E7P.js";
15
+ import "../__chunks/3YLGPPWQ.js";
16
16
  export {
17
17
  batch,
18
18
  createStore,
package/esm/utils/undo.js CHANGED
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  UndoManager,
4
4
  createUndoManager
5
- } from "../__chunks/EKIWAN6A.js";
6
- import "../__chunks/4R3V3JGP.js";
5
+ } from "../__chunks/7LM4Q2XB.js";
6
+ import "../__chunks/3YLGPPWQ.js";
7
7
  export {
8
8
  UndoManager,
9
9
  createUndoManager
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ariakit/core",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
4
  "description": "Ariakit core",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
package/readme.md ADDED
@@ -0,0 +1,18 @@
1
+ # Ariakit Core
2
+
3
+ **Important:** This package is an internal dependency of Ariakit and does not follow semantic versioning, meaning breaking changes may occur in patch and minor versions. You probably want to use [`@ariakit/react`](https://npmjs.org/package/@ariakit/react) instead.
4
+
5
+ ## Installation
6
+
7
+ ```
8
+ npm i @ariakit/core
9
+ ```
10
+
11
+ ## Core Team
12
+
13
+ - [Diego Haz](https://x.com/diegohaz)
14
+ - [Ben Rodri](https://x.com/benrodrs)
15
+
16
+ ## Contributing
17
+
18
+ Follow the instructions on the [contributing guide](https://github.com/ariakit/ariakit/blob/main/contributing.md).
@@ -1,42 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
-
3
-
4
- var _MB5TLEVHcjs = require('./MB5TLEVH.cjs');
5
-
6
-
7
- var _M2NNCFIJcjs = require('./M2NNCFIJ.cjs');
8
-
9
-
10
- var _EEDWPDM2cjs = require('./EEDWPDM2.cjs');
11
-
12
-
13
-
14
- var _AV6KTKLEcjs = require('./AV6KTKLE.cjs');
15
-
16
- // src/hovercard/hovercard-store.ts
17
- function createHovercardStore(props = {}) {
18
- var _a;
19
- const syncState = (_a = props.store) == null ? void 0 : _a.getState();
20
- const popover = _MB5TLEVHcjs.createPopoverStore.call(void 0, _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, props), {
21
- placement: _EEDWPDM2cjs.defaultValue.call(void 0,
22
- props.placement,
23
- syncState == null ? void 0 : syncState.placement,
24
- "bottom"
25
- )
26
- }));
27
- const timeout = _EEDWPDM2cjs.defaultValue.call(void 0, props.timeout, syncState == null ? void 0 : syncState.timeout, 500);
28
- const initialState = _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, popover.getState()), {
29
- timeout,
30
- showTimeout: _EEDWPDM2cjs.defaultValue.call(void 0, props.showTimeout, syncState == null ? void 0 : syncState.showTimeout),
31
- hideTimeout: _EEDWPDM2cjs.defaultValue.call(void 0, props.hideTimeout, syncState == null ? void 0 : syncState.hideTimeout),
32
- autoFocusOnShow: _EEDWPDM2cjs.defaultValue.call(void 0, syncState == null ? void 0 : syncState.autoFocusOnShow, false)
33
- });
34
- const hovercard = _M2NNCFIJcjs.createStore.call(void 0, initialState, popover, props.store);
35
- return _AV6KTKLEcjs.__spreadProps.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, _AV6KTKLEcjs.__spreadValues.call(void 0, {}, popover), hovercard), {
36
- setAutoFocusOnShow: (value) => hovercard.setState("autoFocusOnShow", value)
37
- });
38
- }
39
-
40
-
41
-
42
- exports.createHovercardStore = createHovercardStore;
File without changes
File without changes