@ariakit/react-core 0.1.2 → 0.1.4

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 (69) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/cjs/__chunks/{WPKIYKH6.cjs → 44M2NZSK.cjs} +6 -3
  3. package/cjs/__chunks/{CMHDB7LY.cjs → CP6M4POZ.cjs} +2 -2
  4. package/cjs/__chunks/{GEJXRZB4.cjs → FHUZG4VD.cjs} +48 -23
  5. package/cjs/__chunks/{XKBGBOWQ.cjs → MWKUZW4E.cjs} +2 -0
  6. package/cjs/__chunks/OKPDB2ZM.cjs +44 -0
  7. package/cjs/__chunks/{YAJKVIK2.cjs → TGXF67NL.cjs} +2 -2
  8. package/cjs/__chunks/{OSVJV44D.cjs → WLSIWMKQ.cjs} +2 -0
  9. package/cjs/__chunks/{KWHAB2F2.cjs → ZDO3DQPW.cjs} +1 -2
  10. package/cjs/combobox/combobox-popover.cjs +7 -8
  11. package/cjs/combobox/combobox.cjs +20 -8
  12. package/cjs/composite/composite-overflow.cjs +7 -8
  13. package/cjs/dialog/dialog.cjs +6 -7
  14. package/cjs/dialog/utils/disable-tree-outside.cjs +7 -0
  15. package/cjs/dialog/utils/disable-tree-outside.d.ts +3 -0
  16. package/cjs/dialog/utils/use-champion-dialog.cjs +2 -2
  17. package/cjs/dialog/utils/use-hide-on-interact-outside.cjs +2 -2
  18. package/cjs/dialog/utils/use-prevent-body-scroll.cjs +3 -3
  19. package/cjs/form/form-checkbox.cjs +2 -2
  20. package/cjs/hovercard/hovercard-anchor.cjs +2 -2
  21. package/cjs/hovercard/hovercard.cjs +8 -9
  22. package/cjs/menu/menu-button.cjs +2 -2
  23. package/cjs/menu/menu-item-checkbox.cjs +2 -2
  24. package/cjs/menu/menu.cjs +8 -9
  25. package/cjs/popover/popover.cjs +7 -8
  26. package/cjs/select/select-popover.cjs +7 -8
  27. package/cjs/tsconfig.build.tsbuildinfo +1 -1
  28. package/dialog/utils/disable-tree-outside/package.json +7 -0
  29. package/esm/__chunks/{4IVDKH63.js → 2WA5HZXQ.js} +2 -0
  30. package/esm/__chunks/{HLAXMBLL.js → ARIIJA3Z.js} +3 -1
  31. package/esm/__chunks/{ZVCQYVEV.js → FD7UP2TJ.js} +3 -4
  32. package/esm/__chunks/{JUUV3EHC.js → GEOALYS4.js} +1 -1
  33. package/esm/__chunks/{LFCJQX2O.js → GWYHKM6Q.js} +1 -1
  34. package/esm/__chunks/{Z3UAG7AM.js → IW7LFTQE.js} +5 -2
  35. package/esm/__chunks/{NO5K4U2Q.js → WWZPDI2E.js} +46 -21
  36. package/esm/__chunks/X3J57OQT.js +44 -0
  37. package/esm/combobox/combobox-popover.js +6 -7
  38. package/esm/combobox/combobox.js +20 -8
  39. package/esm/composite/composite-overflow.js +6 -7
  40. package/esm/dialog/dialog.js +5 -6
  41. package/esm/dialog/utils/disable-tree-outside.d.ts +3 -0
  42. package/esm/dialog/utils/disable-tree-outside.js +7 -0
  43. package/esm/dialog/utils/use-champion-dialog.js +1 -1
  44. package/esm/dialog/utils/use-hide-on-interact-outside.js +1 -1
  45. package/esm/dialog/utils/use-prevent-body-scroll.js +2 -2
  46. package/esm/form/form-checkbox.js +3 -3
  47. package/esm/hovercard/hovercard-anchor.js +1 -1
  48. package/esm/hovercard/hovercard.js +7 -8
  49. package/esm/menu/menu-button.js +1 -1
  50. package/esm/menu/menu-item-checkbox.js +3 -3
  51. package/esm/menu/menu.js +7 -8
  52. package/esm/popover/popover.js +6 -7
  53. package/esm/select/select-popover.js +6 -7
  54. package/esm/tsconfig.build.tsbuildinfo +1 -1
  55. package/package.json +5 -9
  56. package/cjs/__chunks/ORRE4SVW.cjs +0 -31
  57. package/cjs/__chunks/RDNP4FTV.cjs +0 -30
  58. package/cjs/dialog/utils/disable-pointer-events-outside.cjs +0 -7
  59. package/cjs/dialog/utils/disable-pointer-events-outside.d.ts +0 -3
  60. package/cjs/dialog/utils/use-focus-on-child-unmount.cjs +0 -6
  61. package/cjs/dialog/utils/use-focus-on-child-unmount.d.ts +0 -6
  62. package/dialog/utils/disable-pointer-events-outside/package.json +0 -7
  63. package/dialog/utils/use-focus-on-child-unmount/package.json +0 -7
  64. package/esm/__chunks/547F7FFZ.js +0 -30
  65. package/esm/__chunks/WO2RXMKK.js +0 -31
  66. package/esm/dialog/utils/disable-pointer-events-outside.d.ts +0 -3
  67. package/esm/dialog/utils/disable-pointer-events-outside.js +0 -7
  68. package/esm/dialog/utils/use-focus-on-child-unmount.d.ts +0 -6
  69. package/esm/dialog/utils/use-focus-on-child-unmount.js +0 -6
@@ -1,30 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
-
3
- var _YHG3KGFWcjs = require('./YHG3KGFW.cjs');
4
-
5
- // src/dialog/utils/disable-pointer-events-outside.ts
6
- var _misc = require('@ariakit/core/utils/misc');
7
- function disableElement(element) {
8
- if (!("style" in element))
9
- return _misc.noop;
10
- const previousPointerEvents = element.style.pointerEvents;
11
- element.style.pointerEvents = "none";
12
- const enableElement = () => {
13
- element.style.pointerEvents = _nullishCoalesce(previousPointerEvents, () => ( ""));
14
- };
15
- return enableElement;
16
- }
17
- function disablePointerEventsOutside(...elements) {
18
- const cleanups = [];
19
- _YHG3KGFWcjs.walkTreeOutside.call(void 0, elements, (element) => {
20
- cleanups.unshift(disableElement(element));
21
- });
22
- const restorePointerEvents = () => {
23
- cleanups.forEach((fn) => fn());
24
- };
25
- return restorePointerEvents;
26
- }
27
-
28
-
29
-
30
- exports.disablePointerEventsOutside = disablePointerEventsOutside;
@@ -1,7 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _RDNP4FTVcjs = require('../../__chunks/RDNP4FTV.cjs');
4
- require('../../__chunks/YHG3KGFW.cjs');
5
-
6
-
7
- exports.disablePointerEventsOutside = _RDNP4FTVcjs.disablePointerEventsOutside;
@@ -1,3 +0,0 @@
1
- type Elements = Array<Element | null>;
2
- export declare function disablePointerEventsOutside(...elements: Elements): () => void;
3
- export {};
@@ -1,6 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _ORRE4SVWcjs = require('../../__chunks/ORRE4SVW.cjs');
4
-
5
-
6
- exports.useFocusOnChildUnmount = _ORRE4SVWcjs.useFocusOnChildUnmount;
@@ -1,6 +0,0 @@
1
- import type { DialogStore } from "../dialog-store.js";
2
- /**
3
- * When the focused child gets removed from the DOM, we make sure to move focus
4
- * to the dialog.
5
- */
6
- export declare function useFocusOnChildUnmount(store: DialogStore): void;
@@ -1,7 +0,0 @@
1
- {
2
- "name": "@ariakit/react-core/dialog/utils/disable-pointer-events-outside",
3
- "private": true,
4
- "sideEffects": false,
5
- "main": "../../../cjs/dialog/utils/disable-pointer-events-outside",
6
- "module": "../../../esm/dialog/utils/disable-pointer-events-outside"
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "name": "@ariakit/react-core/dialog/utils/use-focus-on-child-unmount",
3
- "private": true,
4
- "sideEffects": false,
5
- "main": "../../../cjs/dialog/utils/use-focus-on-child-unmount",
6
- "module": "../../../esm/dialog/utils/use-focus-on-child-unmount"
7
- }
@@ -1,30 +0,0 @@
1
- import {
2
- walkTreeOutside
3
- } from "./HVXLVRRR.js";
4
-
5
- // src/dialog/utils/disable-pointer-events-outside.ts
6
- import { noop } from "@ariakit/core/utils/misc";
7
- function disableElement(element) {
8
- if (!("style" in element))
9
- return noop;
10
- const previousPointerEvents = element.style.pointerEvents;
11
- element.style.pointerEvents = "none";
12
- const enableElement = () => {
13
- element.style.pointerEvents = previousPointerEvents ?? "";
14
- };
15
- return enableElement;
16
- }
17
- function disablePointerEventsOutside(...elements) {
18
- const cleanups = [];
19
- walkTreeOutside(elements, (element) => {
20
- cleanups.unshift(disableElement(element));
21
- });
22
- const restorePointerEvents = () => {
23
- cleanups.forEach((fn) => fn());
24
- };
25
- return restorePointerEvents;
26
- }
27
-
28
- export {
29
- disablePointerEventsOutside
30
- };
@@ -1,31 +0,0 @@
1
- // src/dialog/utils/use-focus-on-child-unmount.ts
2
- import { useEffect } from "react";
3
- import { getActiveElement, getDocument } from "@ariakit/core/utils/dom";
4
- function useFocusOnChildUnmount(store) {
5
- const open = store.useState("open");
6
- const contentElement = store.useState("contentElement");
7
- useEffect(() => {
8
- if (!open)
9
- return;
10
- const dialog = contentElement;
11
- if (!dialog)
12
- return;
13
- const observer = new MutationObserver(([mutation]) => {
14
- if (!mutation)
15
- return;
16
- if (mutation.target !== dialog)
17
- return;
18
- const document = getDocument(dialog);
19
- const activeElement = getActiveElement(dialog);
20
- if (activeElement === document.body) {
21
- dialog.focus();
22
- }
23
- });
24
- observer.observe(dialog, { childList: true, subtree: true });
25
- return () => observer.disconnect();
26
- }, [open, contentElement]);
27
- }
28
-
29
- export {
30
- useFocusOnChildUnmount
31
- };
@@ -1,3 +0,0 @@
1
- type Elements = Array<Element | null>;
2
- export declare function disablePointerEventsOutside(...elements: Elements): () => void;
3
- export {};
@@ -1,7 +0,0 @@
1
- import {
2
- disablePointerEventsOutside
3
- } from "../../__chunks/547F7FFZ.js";
4
- import "../../__chunks/HVXLVRRR.js";
5
- export {
6
- disablePointerEventsOutside
7
- };
@@ -1,6 +0,0 @@
1
- import type { DialogStore } from "../dialog-store.js";
2
- /**
3
- * When the focused child gets removed from the DOM, we make sure to move focus
4
- * to the dialog.
5
- */
6
- export declare function useFocusOnChildUnmount(store: DialogStore): void;
@@ -1,6 +0,0 @@
1
- import {
2
- useFocusOnChildUnmount
3
- } from "../../__chunks/WO2RXMKK.js";
4
- export {
5
- useFocusOnChildUnmount
6
- };