@bigbinary/neeto-atoms 1.0.136 → 1.0.137-beta1

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 (45) hide show
  1. package/dist/{Combobox-CUcCC9-A.js → Combobox-CrcrQlgz.js} +2 -2
  2. package/dist/{Combobox-CUcCC9-A.js.map → Combobox-CrcrQlgz.js.map} +1 -1
  3. package/dist/{Select-CD5chrpw.js → Select-XgpTYRqO.js} +2 -2
  4. package/dist/{Select-CD5chrpw.js.map → Select-XgpTYRqO.js.map} +1 -1
  5. package/dist/cjs/{Combobox-ChtPjQlO.js → Combobox-B3KzI_J_.js} +2 -2
  6. package/dist/cjs/{Combobox-ChtPjQlO.js.map → Combobox-B3KzI_J_.js.map} +1 -1
  7. package/dist/cjs/{Select-C56LAdEy.js → Select-CdugYSdp.js} +2 -2
  8. package/dist/cjs/{Select-C56LAdEy.js.map → Select-CdugYSdp.js.map} +1 -1
  9. package/dist/cjs/components/Alert.js +1 -1
  10. package/dist/cjs/components/Dialog.js +1 -1
  11. package/dist/cjs/components/Select.js +3 -3
  12. package/dist/cjs/components/Sheet.js +1 -1
  13. package/dist/cjs/components/index.js +3 -3
  14. package/dist/cjs/formik/BlockNavigation.js +1 -1
  15. package/dist/cjs/formik/Select.js +3 -3
  16. package/dist/cjs/formik/index.js +3 -3
  17. package/dist/cjs/index.js +3 -3
  18. package/dist/cjs/primitives/AlertDialog.js +1 -1
  19. package/dist/cjs/primitives/Combobox.js +2 -2
  20. package/dist/cjs/primitives/Dialog.js +1 -1
  21. package/dist/cjs/primitives/Sheet.js +1 -1
  22. package/dist/cjs/primitives/index.js +2 -2
  23. package/dist/cjs/{useAriaHiddenCleanup-CT0To2AH.js → useAriaHiddenCleanup-8OeXq1T4.js} +9 -7
  24. package/dist/cjs/useAriaHiddenCleanup-8OeXq1T4.js.map +1 -0
  25. package/dist/components/Alert.js +1 -1
  26. package/dist/components/Dialog.js +1 -1
  27. package/dist/components/Select.js +3 -3
  28. package/dist/components/Sheet.js +1 -1
  29. package/dist/components/index.js +3 -3
  30. package/dist/formik/BlockNavigation.js +1 -1
  31. package/dist/formik/Select.js +3 -3
  32. package/dist/formik/index.js +3 -3
  33. package/dist/hooks/useAriaHiddenCleanup.d.ts +5 -0
  34. package/dist/index.js +3 -3
  35. package/dist/primitives/AlertDialog.js +1 -1
  36. package/dist/primitives/Combobox.js +2 -2
  37. package/dist/primitives/Dialog.js +1 -1
  38. package/dist/primitives/Sheet.js +1 -1
  39. package/dist/primitives/index.js +2 -2
  40. package/dist/{useAriaHiddenCleanup-BIUbPJ6V.js → useAriaHiddenCleanup-Qc0GmbER.js} +9 -7
  41. package/dist/useAriaHiddenCleanup-Qc0GmbER.js.map +1 -0
  42. package/package.json +2 -2
  43. package/CHANGELOG.md +0 -3
  44. package/dist/cjs/useAriaHiddenCleanup-CT0To2AH.js.map +0 -1
  45. package/dist/useAriaHiddenCleanup-BIUbPJ6V.js.map +0 -1
@@ -21,7 +21,7 @@ var Pagination = require('../Pagination-WyQlBpvK.js');
21
21
  var Popover = require('../Popover-5BUgIW60.js');
22
22
  var Progress = require('../Progress-n_VwK9_E.js');
23
23
  var RadioGroup = require('../RadioGroup-B-u8rdbf.js');
24
- var Select = require('../Select-C56LAdEy.js');
24
+ var Select = require('../Select-CdugYSdp.js');
25
25
  var Sheet = require('../Sheet-D-NWMprq.js');
26
26
  var Slider = require('../Slider-DIUSlx_m.js');
27
27
  var Spinner = require('../Spinner-DRoghJA8.js');
@@ -80,7 +80,7 @@ require('../primitives/Accordion.js');
80
80
  require('../chevron-up-BpwpBnZU.js');
81
81
  require('../index-BiGm7NEA.js');
82
82
  require('../primitives/Dialog.js');
83
- require('../useAriaHiddenCleanup-CT0To2AH.js');
83
+ require('../useAriaHiddenCleanup-8OeXq1T4.js');
84
84
  require('../dialog-Bnk4GUFC.js');
85
85
  require('../x-Brw3FJst.js');
86
86
  require('../DialogTrigger-B0Q6yIrx.js');
@@ -127,7 +127,7 @@ require('../primitives/Label.js');
127
127
  require('../primitives/HoverCard.js');
128
128
  require('../primitives/Progress.js');
129
129
  require('../primitives/RadioGroup.js');
130
- require('../Combobox-ChtPjQlO.js');
130
+ require('../Combobox-B3KzI_J_.js');
131
131
  require('../SelectFieldWrapper-CIh_atln.js');
132
132
  require('../primitives/Sheet.js');
133
133
  require('../sheet-CQ82jJkC.js');
@@ -13,7 +13,7 @@ require('../button-CDZTqJzs.js');
13
13
  require('../index-vioSzJOw.js');
14
14
  require('../index-DuNgWCXZ.js');
15
15
  require('../index-D-iDn9RI.js');
16
- require('../useAriaHiddenCleanup-CT0To2AH.js');
16
+ require('../useAriaHiddenCleanup-8OeXq1T4.js');
17
17
  require('../dialog-Bnk4GUFC.js');
18
18
  require('../x-Brw3FJst.js');
19
19
  require('../createLucideIcon-D0tRgV6l.js');
@@ -4,16 +4,16 @@ var jsxRuntime = require('react/jsx-runtime');
4
4
  var React = require('react');
5
5
  var formik = require('formik');
6
6
  var ramda = require('ramda');
7
- var Select = require('../Select-C56LAdEy.js');
7
+ var Select = require('../Select-CdugYSdp.js');
8
8
  require('../fieldIds-DiVU6GVS.js');
9
9
  require('../hyphenize-BTrVNVv3.js');
10
- require('../Combobox-ChtPjQlO.js');
10
+ require('../Combobox-B3KzI_J_.js');
11
11
  require('../utils-BhM0B89p.js');
12
12
  require('../button-CDZTqJzs.js');
13
13
  require('../index-vioSzJOw.js');
14
14
  require('../index-DuNgWCXZ.js');
15
15
  require('../index-D-iDn9RI.js');
16
- require('../useAriaHiddenCleanup-CT0To2AH.js');
16
+ require('../useAriaHiddenCleanup-8OeXq1T4.js');
17
17
  require('../input-group-BU6uw1MA.js');
18
18
  require('../input-CgaZr1ov.js');
19
19
  require('../textarea-DW3Fg4w6.js');
@@ -65,9 +65,9 @@ require('../hyphenize-BTrVNVv3.js');
65
65
  require('../withIconSize-C6LP0R7o.js');
66
66
  require('../Textarea-bxleSw86.js');
67
67
  require('../primitives/Textarea.js');
68
- require('../Select-C56LAdEy.js');
69
- require('../Combobox-ChtPjQlO.js');
70
- require('../useAriaHiddenCleanup-CT0To2AH.js');
68
+ require('../Select-CdugYSdp.js');
69
+ require('../Combobox-B3KzI_J_.js');
70
+ require('../useAriaHiddenCleanup-8OeXq1T4.js');
71
71
  require('../chevron-down-CPsWSS51.js');
72
72
  require('../x-Brw3FJst.js');
73
73
  require('../check-BQgcDXys.js');
package/dist/cjs/index.js CHANGED
@@ -26,7 +26,7 @@ var Pagination = require('./Pagination-WyQlBpvK.js');
26
26
  var Popover = require('./Popover-5BUgIW60.js');
27
27
  var Progress = require('./Progress-n_VwK9_E.js');
28
28
  var RadioGroup = require('./RadioGroup-B-u8rdbf.js');
29
- var Select = require('./Select-C56LAdEy.js');
29
+ var Select = require('./Select-CdugYSdp.js');
30
30
  var Sheet = require('./Sheet-D-NWMprq.js');
31
31
  var Slider = require('./Slider-DIUSlx_m.js');
32
32
  var Spinner = require('./Spinner-DRoghJA8.js');
@@ -82,7 +82,7 @@ require('./primitives/Accordion.js');
82
82
  require('./chevron-up-BpwpBnZU.js');
83
83
  require('./index-BiGm7NEA.js');
84
84
  require('./primitives/Dialog.js');
85
- require('./useAriaHiddenCleanup-CT0To2AH.js');
85
+ require('./useAriaHiddenCleanup-8OeXq1T4.js');
86
86
  require('./dialog-Bnk4GUFC.js');
87
87
  require('./x-Brw3FJst.js');
88
88
  require('./DialogTrigger-B0Q6yIrx.js');
@@ -131,7 +131,7 @@ require('./primitives/Label.js');
131
131
  require('./primitives/HoverCard.js');
132
132
  require('./primitives/Progress.js');
133
133
  require('./primitives/RadioGroup.js');
134
- require('./Combobox-ChtPjQlO.js');
134
+ require('./Combobox-B3KzI_J_.js');
135
135
  require('./SelectFieldWrapper-CIh_atln.js');
136
136
  require('./primitives/Sheet.js');
137
137
  require('./sheet-CQ82jJkC.js');
@@ -6,7 +6,7 @@ var React = require('react');
6
6
  var DialogTrigger = require('../DialogTrigger-B0Q6yIrx.js');
7
7
  var useOpenInteractionType = require('../useOpenInteractionType-D4z6FTrA.js');
8
8
  var button = require('../button-CDZTqJzs.js');
9
- var useAriaHiddenCleanup = require('../useAriaHiddenCleanup-CT0To2AH.js');
9
+ var useAriaHiddenCleanup = require('../useAriaHiddenCleanup-8OeXq1T4.js');
10
10
  require('react-dom');
11
11
  require('../floating-ui.utils.dom-BGEmL7pd.js');
12
12
  require('../index-DnKJmaCq.js');
@@ -3,12 +3,12 @@
3
3
  require('react/jsx-runtime');
4
4
  require('react');
5
5
  require('../utils-BhM0B89p.js');
6
- var primitives_Combobox = require('../Combobox-ChtPjQlO.js');
6
+ var primitives_Combobox = require('../Combobox-B3KzI_J_.js');
7
7
  require('../button-CDZTqJzs.js');
8
8
  require('../index-vioSzJOw.js');
9
9
  require('../index-DuNgWCXZ.js');
10
10
  require('../index-D-iDn9RI.js');
11
- require('../useAriaHiddenCleanup-CT0To2AH.js');
11
+ require('../useAriaHiddenCleanup-8OeXq1T4.js');
12
12
  require('../input-group-BU6uw1MA.js');
13
13
  require('../input-CgaZr1ov.js');
14
14
  require('../textarea-DW3Fg4w6.js');
@@ -4,7 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
4
4
  var reactI18next = require('react-i18next');
5
5
  var utils = require('../utils-BhM0B89p.js');
6
6
  var button = require('../button-CDZTqJzs.js');
7
- var useAriaHiddenCleanup = require('../useAriaHiddenCleanup-CT0To2AH.js');
7
+ var useAriaHiddenCleanup = require('../useAriaHiddenCleanup-8OeXq1T4.js');
8
8
  var dialog = require('../dialog-Bnk4GUFC.js');
9
9
  var x = require('../x-Brw3FJst.js');
10
10
  var DialogTrigger$1 = require('../DialogTrigger-B0Q6yIrx.js');
@@ -4,7 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
4
4
  var reactI18next = require('react-i18next');
5
5
  var utils = require('../utils-BhM0B89p.js');
6
6
  var button = require('../button-CDZTqJzs.js');
7
- var useAriaHiddenCleanup = require('../useAriaHiddenCleanup-CT0To2AH.js');
7
+ var useAriaHiddenCleanup = require('../useAriaHiddenCleanup-8OeXq1T4.js');
8
8
  var sheet = require('../sheet-CQ82jJkC.js');
9
9
  var x = require('../x-Brw3FJst.js');
10
10
  var DialogTrigger = require('../DialogTrigger-B0Q6yIrx.js');
@@ -15,7 +15,7 @@ var primitives_Carousel = require('./Carousel.js');
15
15
  var primitives_Chart = require('./Chart.js');
16
16
  var primitives_Checkbox = require('./Checkbox.js');
17
17
  var primitives_Collapsible = require('./Collapsible.js');
18
- var primitives_Combobox = require('../Combobox-ChtPjQlO.js');
18
+ var primitives_Combobox = require('../Combobox-B3KzI_J_.js');
19
19
  var primitives_Command = require('./Command.js');
20
20
  var primitives_ContextMenu = require('./ContextMenu.js');
21
21
  var primitives_Dialog = require('./Dialog.js');
@@ -81,7 +81,7 @@ require('../floating-ui.utils.dom-BGEmL7pd.js');
81
81
  require('../index-DnKJmaCq.js');
82
82
  require('../index-BrpkRQoS.js');
83
83
  require('../with-selector-DeKHbQY7.js');
84
- require('../useAriaHiddenCleanup-CT0To2AH.js');
84
+ require('../useAriaHiddenCleanup-8OeXq1T4.js');
85
85
  require('../index-lWVw05cs.js');
86
86
  require('../index-DuNgWCXZ.js');
87
87
  require('react-i18next');
@@ -5,20 +5,22 @@ var React = require('react');
5
5
  const BASE_UI_MARKER = "data-base-ui-inert";
6
6
  const RADIX_MARKER = "data-aria-hidden";
7
7
  const LOCK_MARKERS = `[${BASE_UI_MARKER}],[${RADIX_MARKER}]`;
8
- const isLockOwned = (element) => element.matches(LOCK_MARKERS);
8
+ const isLockOwned = (element) => !!element.closest(LOCK_MARKERS);
9
9
  const isHidden = (element) => element.getAttribute("aria-hidden") === "true";
10
- const getTopLevelElements = () => Array.from(document.body.children);
11
10
  const useIsoLayoutEffect = typeof document === "undefined" ? React.useEffect : React.useLayoutEffect;
12
11
  const useAriaHiddenCleanup = () => {
13
12
  useIsoLayoutEffect(() => {
14
13
  const hiddenByLock = /* @__PURE__ */ new Set();
15
- const sweep = () => getTopLevelElements().filter(
16
- (element) => hiddenByLock.has(element) && isHidden(element) && !isLockOwned(element)
17
- ).forEach((element) => element.removeAttribute("aria-hidden"));
14
+ const sweep = () => hiddenByLock.forEach((element) => {
15
+ if (element.isConnected && isHidden(element)) {
16
+ if (isLockOwned(element)) return;
17
+ element.removeAttribute("aria-hidden");
18
+ }
19
+ hiddenByLock.delete(element);
20
+ });
18
21
  const observer = new MutationObserver((records) => {
19
22
  records.forEach(({ target, attributeName, oldValue }) => {
20
23
  const element = target;
21
- if (element.parentElement !== document.body) return;
22
24
  const wasApplied = attributeName === "aria-hidden" && oldValue !== "true";
23
25
  if (wasApplied && isHidden(element) && isLockOwned(element)) {
24
26
  hiddenByLock.add(element);
@@ -44,4 +46,4 @@ const AriaHiddenCleanup = () => {
44
46
  };
45
47
 
46
48
  exports.AriaHiddenCleanup = AriaHiddenCleanup;
47
- //# sourceMappingURL=useAriaHiddenCleanup-CT0To2AH.js.map
49
+ //# sourceMappingURL=useAriaHiddenCleanup-8OeXq1T4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAriaHiddenCleanup-8OeXq1T4.js","sources":["../../src/hooks/useAriaHiddenCleanup.ts"],"sourcesContent":["import { useEffect, useLayoutEffect } from \"react\";\n\n/**\n * Elements hidden by a modal surface are stamped by whichever library owns the\n * lock: Base UI stamps `data-base-ui-inert`, the `aria-hidden` package behind\n * the Radix based primitives stamps `data-aria-hidden`. Both are marker\n * attributes; neither library applies the `inert` attribute to the page.\n */\nconst BASE_UI_MARKER = \"data-base-ui-inert\";\nconst RADIX_MARKER = \"data-aria-hidden\";\nconst LOCK_MARKERS = `[${BASE_UI_MARKER}],[${RADIX_MARKER}]`;\n\n/**\n * Radix stamps its marker on every element it hides. Base UI stamps its marker\n * only on top level elements, even when its `aria-hidden` lands deeper, which\n * happens whenever a live region inside the page makes the lock keep the path to\n * it in view. A lock holding a nested element therefore shows on an ancestor.\n */\nconst isLockOwned = (element: Element) => !!element.closest(LOCK_MARKERS);\n\nconst isHidden = (element: Element) =>\n element.getAttribute(\"aria-hidden\") === \"true\";\n\n/**\n * Effects do not run on the server at all, so the fallback never fires; it only\n * keeps React from warning about the layout variant during SSR.\n */\nconst useIsoLayoutEffect =\n typeof document === \"undefined\" ? useEffect : useLayoutEffect;\n\n/**\n * neeto-atoms ships two independent `aria-hidden` lock systems: Base UI's\n * `markOthers` (Dialog, Sheet, Combobox) and the `aria-hidden` package pulled in\n * by the Radix based primitives (Popover, Menu, Drawer, …). Each keeps its own\n * reference counts, so when a Radix popup hides the page first and Base UI opens\n * on top of it, Base UI records the page as \"hidden by someone else\" and skips\n * removing `aria-hidden` when its own last popup closes. The page then stays out\n * of the accessibility tree with nothing open.\n *\n * Mount this alongside a Base UI popup. It watches for `aria-hidden` being\n * applied by a lock and clears those, and only those, once every lock has let go\n * — an `aria-hidden` the page put there itself is never observed being applied\n * and so is never touched.\n *\n * This only patches over the two systems coexisting; a single one keeps its own\n * counts straight. Once every primitive here is built on Base UI and the\n * `aria-hidden` package is gone from the bundle, delete this hook along with the\n * `AriaHiddenCleanup` mounted in Dialog, Sheet, AlertDialog and Combobox.\n */\nexport const useAriaHiddenCleanup = () => {\n useIsoLayoutEffect(() => {\n /**\n * Elements watched as a lock hid them. Ownership cannot be read off the DOM\n * afterwards: a lock stamps its marker on elements the page had already\n * hidden, so a marker means \"a lock is holding this\", not \"a lock hid this\".\n */\n const hiddenByLock = new Set<Element>();\n\n const sweep = () =>\n hiddenByLock.forEach(element => {\n if (element.isConnected && isHidden(element)) {\n if (isLockOwned(element)) return;\n\n element.removeAttribute(\"aria-hidden\");\n }\n // Applying `aria-hidden` again is observed afresh, so there is no need\n // to hold on to anything no lock is hiding right now.\n hiddenByLock.delete(element);\n });\n\n const observer = new MutationObserver(records => {\n records.forEach(({ target, attributeName, oldValue }) => {\n const element = target as Element;\n const wasApplied =\n attributeName === \"aria-hidden\" && oldValue !== \"true\";\n\n // A lock applies its marker in the same batch, so it is readable here.\n if (wasApplied && isHidden(element) && isLockOwned(element)) {\n hiddenByLock.add(element);\n }\n });\n\n sweep();\n });\n\n // `keepMounted` keeps this mounted while the popup closes, so unmounting is\n // not a reliable signal on its own. Watch the locks instead — the sweep does\n // nothing until the last of them lets go.\n observer.observe(document.body, {\n subtree: true,\n attributes: true,\n attributeOldValue: true,\n attributeFilter: [\"aria-hidden\", BASE_UI_MARKER, RADIX_MARKER],\n });\n\n return () => {\n observer.disconnect();\n // Locks are released from effect cleanups too, so let those run first.\n setTimeout(sweep);\n };\n }, []);\n};\n\n/**\n * Renders nothing; mount it inside the portal so the cleanup is scoped to the\n * lifetime of the popup rather than to the component that declares it.\n */\nexport const AriaHiddenCleanup = () => {\n useAriaHiddenCleanup();\n\n return null;\n};\n"],"names":["useEffect","useLayoutEffect"],"mappings":";;;;AAQA,MAAM,cAAA,GAAiB,oBAAA;AACvB,MAAM,YAAA,GAAe,kBAAA;AACrB,MAAM,YAAA,GAAe,CAAA,CAAA,EAAI,cAAc,CAAA,GAAA,EAAM,YAAY,CAAA,CAAA,CAAA;AAQzD,MAAM,cAAc,CAAC,OAAA,KAAqB,CAAC,CAAC,OAAA,CAAQ,QAAQ,YAAY,CAAA;AAExE,MAAM,WAAW,CAAC,OAAA,KAChB,OAAA,CAAQ,YAAA,CAAa,aAAa,CAAA,KAAM,MAAA;AAM1C,MAAM,kBAAA,GACJ,OAAO,QAAA,KAAa,WAAA,GAAcA,eAAA,GAAYC,qBAAA;AAqBzC,MAAM,uBAAuB,MAAM;AACxC,EAAA,kBAAA,CAAmB,MAAM;AAMvB,IAAA,MAAM,YAAA,uBAAmB,GAAA,EAAa;AAEtC,IAAA,MAAM,KAAA,GAAQ,MACZ,YAAA,CAAa,OAAA,CAAQ,CAAA,OAAA,KAAW;AAC9B,MAAA,IAAI,OAAA,CAAQ,WAAA,IAAe,QAAA,CAAS,OAAO,CAAA,EAAG;AAC5C,QAAA,IAAI,WAAA,CAAY,OAAO,CAAA,EAAG;AAE1B,QAAA,OAAA,CAAQ,gBAAgB,aAAa,CAAA;AAAA,MACvC;AAGA,MAAA,YAAA,CAAa,OAAO,OAAO,CAAA;AAAA,IAC7B,CAAC,CAAA;AAEH,IAAA,MAAM,QAAA,GAAW,IAAI,gBAAA,CAAiB,CAAA,OAAA,KAAW;AAC/C,MAAA,OAAA,CAAQ,QAAQ,CAAC,EAAE,MAAA,EAAQ,aAAA,EAAe,UAAS,KAAM;AACvD,QAAA,MAAM,OAAA,GAAU,MAAA;AAChB,QAAA,MAAM,UAAA,GACJ,aAAA,KAAkB,aAAA,IAAiB,QAAA,KAAa,MAAA;AAGlD,QAAA,IAAI,cAAc,QAAA,CAAS,OAAO,CAAA,IAAK,WAAA,CAAY,OAAO,CAAA,EAAG;AAC3D,UAAA,YAAA,CAAa,IAAI,OAAO,CAAA;AAAA,QAC1B;AAAA,MACF,CAAC,CAAA;AAED,MAAA,KAAA,EAAM;AAAA,IACR,CAAC,CAAA;AAKD,IAAA,QAAA,CAAS,OAAA,CAAQ,SAAS,IAAA,EAAM;AAAA,MAC9B,OAAA,EAAS,IAAA;AAAA,MACT,UAAA,EAAY,IAAA;AAAA,MACZ,iBAAA,EAAmB,IAAA;AAAA,MACnB,eAAA,EAAiB,CAAC,aAAA,EAAe,cAAA,EAAgB,YAAY;AAAA,KAC9D,CAAA;AAED,IAAA,OAAO,MAAM;AACX,MAAA,QAAA,CAAS,UAAA,EAAW;AAEpB,MAAA,UAAA,CAAW,KAAK,CAAA;AAAA,IAClB,CAAA;AAAA,EACF,CAAA,EAAG,EAAE,CAAA;AACP,CAAA;AAMO,MAAM,oBAAoB,MAAM;AACrC,EAAA,oBAAA,EAAqB;AAErB,EAAA,OAAO,IAAA;AACT;;;;"}
@@ -8,7 +8,7 @@ import '../button-DTkEk06V.js';
8
8
  import '../index-Bo3AAQJp.js';
9
9
  import '../index-CfriMyrd.js';
10
10
  import '../index-BtkPdosV.js';
11
- import '../useAriaHiddenCleanup-BIUbPJ6V.js';
11
+ import '../useAriaHiddenCleanup-Qc0GmbER.js';
12
12
  import '../dialog-BG8Tjl78.js';
13
13
  import '../x-_o2T3n6D.js';
14
14
  import '../createLucideIcon-C8ycilSN.js';
@@ -8,7 +8,7 @@ import '../button-DTkEk06V.js';
8
8
  import '../index-Bo3AAQJp.js';
9
9
  import '../index-CfriMyrd.js';
10
10
  import '../index-BtkPdosV.js';
11
- import '../useAriaHiddenCleanup-BIUbPJ6V.js';
11
+ import '../useAriaHiddenCleanup-Qc0GmbER.js';
12
12
  import '../dialog-BG8Tjl78.js';
13
13
  import '../x-_o2T3n6D.js';
14
14
  import '../createLucideIcon-C8ycilSN.js';
@@ -1,15 +1,15 @@
1
- export { S as Select } from '../Select-CD5chrpw.js';
1
+ export { S as Select } from '../Select-XgpTYRqO.js';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
4
4
  import '../fieldIds-VpluAAMl.js';
5
5
  import '../hyphenize-TRhMI0tl.js';
6
- import '../Combobox-CUcCC9-A.js';
6
+ import '../Combobox-CrcrQlgz.js';
7
7
  import '../utils-BJnb9o5c.js';
8
8
  import '../button-DTkEk06V.js';
9
9
  import '../index-Bo3AAQJp.js';
10
10
  import '../index-CfriMyrd.js';
11
11
  import '../index-BtkPdosV.js';
12
- import '../useAriaHiddenCleanup-BIUbPJ6V.js';
12
+ import '../useAriaHiddenCleanup-Qc0GmbER.js';
13
13
  import '../input-group-CFQrWXbU.js';
14
14
  import '../input-BNPBqcmC.js';
15
15
  import '../textarea-ByEw7FT-.js';
@@ -8,7 +8,7 @@ import '../button-DTkEk06V.js';
8
8
  import '../index-Bo3AAQJp.js';
9
9
  import '../index-CfriMyrd.js';
10
10
  import '../index-BtkPdosV.js';
11
- import '../useAriaHiddenCleanup-BIUbPJ6V.js';
11
+ import '../useAriaHiddenCleanup-Qc0GmbER.js';
12
12
  import '../sheet-BD8c3_Va.js';
13
13
  import '../x-_o2T3n6D.js';
14
14
  import '../createLucideIcon-C8ycilSN.js';
@@ -19,7 +19,7 @@ export { P as Pagination } from '../Pagination-yjG8uCpV.js';
19
19
  export { P as Popover } from '../Popover-BHGvcdV2.js';
20
20
  export { P as Progress } from '../Progress-DbtLbWf8.js';
21
21
  export { R as RadioGroup } from '../RadioGroup-CBXByAMW.js';
22
- export { S as Select } from '../Select-CD5chrpw.js';
22
+ export { S as Select } from '../Select-XgpTYRqO.js';
23
23
  export { S as Sheet } from '../Sheet-D1MWtg1q.js';
24
24
  export { S as Slider } from '../Slider-CxQdlyHZ.js';
25
25
  export { S as Spinner } from '../Spinner-vfggfvEp.js';
@@ -78,7 +78,7 @@ import '../primitives/Accordion.js';
78
78
  import '../chevron-up-Bf2G3AAU.js';
79
79
  import '../index-0o2E3Cnw.js';
80
80
  import '../primitives/Dialog.js';
81
- import '../useAriaHiddenCleanup-BIUbPJ6V.js';
81
+ import '../useAriaHiddenCleanup-Qc0GmbER.js';
82
82
  import '../dialog-BG8Tjl78.js';
83
83
  import '../x-_o2T3n6D.js';
84
84
  import '../DialogTrigger-a3diAOif.js';
@@ -125,7 +125,7 @@ import '../primitives/Label.js';
125
125
  import '../primitives/HoverCard.js';
126
126
  import '../primitives/Progress.js';
127
127
  import '../primitives/RadioGroup.js';
128
- import '../Combobox-CUcCC9-A.js';
128
+ import '../Combobox-CrcrQlgz.js';
129
129
  import '../SelectFieldWrapper-D370CD4o.js';
130
130
  import '../primitives/Sheet.js';
131
131
  import '../sheet-BD8c3_Va.js';
@@ -11,7 +11,7 @@ import '../button-DTkEk06V.js';
11
11
  import '../index-Bo3AAQJp.js';
12
12
  import '../index-CfriMyrd.js';
13
13
  import '../index-BtkPdosV.js';
14
- import '../useAriaHiddenCleanup-BIUbPJ6V.js';
14
+ import '../useAriaHiddenCleanup-Qc0GmbER.js';
15
15
  import '../dialog-BG8Tjl78.js';
16
16
  import '../x-_o2T3n6D.js';
17
17
  import '../createLucideIcon-C8ycilSN.js';
@@ -2,16 +2,16 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import { forwardRef } from 'react';
3
3
  import { useField, useFormikContext, getIn } from 'formik';
4
4
  import { dissoc } from 'ramda';
5
- import { S as Select } from '../Select-CD5chrpw.js';
5
+ import { S as Select } from '../Select-XgpTYRqO.js';
6
6
  import '../fieldIds-VpluAAMl.js';
7
7
  import '../hyphenize-TRhMI0tl.js';
8
- import '../Combobox-CUcCC9-A.js';
8
+ import '../Combobox-CrcrQlgz.js';
9
9
  import '../utils-BJnb9o5c.js';
10
10
  import '../button-DTkEk06V.js';
11
11
  import '../index-Bo3AAQJp.js';
12
12
  import '../index-CfriMyrd.js';
13
13
  import '../index-BtkPdosV.js';
14
- import '../useAriaHiddenCleanup-BIUbPJ6V.js';
14
+ import '../useAriaHiddenCleanup-Qc0GmbER.js';
15
15
  import '../input-group-CFQrWXbU.js';
16
16
  import '../input-BNPBqcmC.js';
17
17
  import '../textarea-ByEw7FT-.js';
@@ -63,9 +63,9 @@ import '../hyphenize-TRhMI0tl.js';
63
63
  import '../withIconSize-BonoFXeH.js';
64
64
  import '../Textarea-CUe09-sr.js';
65
65
  import '../primitives/Textarea.js';
66
- import '../Select-CD5chrpw.js';
67
- import '../Combobox-CUcCC9-A.js';
68
- import '../useAriaHiddenCleanup-BIUbPJ6V.js';
66
+ import '../Select-XgpTYRqO.js';
67
+ import '../Combobox-CrcrQlgz.js';
68
+ import '../useAriaHiddenCleanup-Qc0GmbER.js';
69
69
  import '../chevron-down-BNi0ntys.js';
70
70
  import '../x-_o2T3n6D.js';
71
71
  import '../check-Cpkv29p1.js';
@@ -11,6 +11,11 @@
11
11
  * applied by a lock and clears those, and only those, once every lock has let go
12
12
  * — an `aria-hidden` the page put there itself is never observed being applied
13
13
  * and so is never touched.
14
+ *
15
+ * This only patches over the two systems coexisting; a single one keeps its own
16
+ * counts straight. Once every primitive here is built on Base UI and the
17
+ * `aria-hidden` package is gone from the bundle, delete this hook along with the
18
+ * `AriaHiddenCleanup` mounted in Dialog, Sheet, AlertDialog and Combobox.
14
19
  */
15
20
  export declare const useAriaHiddenCleanup: () => void;
16
21
  /**
package/dist/index.js CHANGED
@@ -25,7 +25,7 @@ export { P as Pagination } from './Pagination-yjG8uCpV.js';
25
25
  export { P as Popover } from './Popover-BHGvcdV2.js';
26
26
  export { P as Progress } from './Progress-DbtLbWf8.js';
27
27
  export { R as RadioGroup } from './RadioGroup-CBXByAMW.js';
28
- export { S as Select } from './Select-CD5chrpw.js';
28
+ export { S as Select } from './Select-XgpTYRqO.js';
29
29
  export { S as Sheet } from './Sheet-D1MWtg1q.js';
30
30
  export { S as Slider } from './Slider-CxQdlyHZ.js';
31
31
  export { S as Spinner } from './Spinner-vfggfvEp.js';
@@ -81,7 +81,7 @@ import './primitives/Accordion.js';
81
81
  import './chevron-up-Bf2G3AAU.js';
82
82
  import './index-0o2E3Cnw.js';
83
83
  import './primitives/Dialog.js';
84
- import './useAriaHiddenCleanup-BIUbPJ6V.js';
84
+ import './useAriaHiddenCleanup-Qc0GmbER.js';
85
85
  import './dialog-BG8Tjl78.js';
86
86
  import './x-_o2T3n6D.js';
87
87
  import './DialogTrigger-a3diAOif.js';
@@ -130,7 +130,7 @@ import './primitives/Label.js';
130
130
  import './primitives/HoverCard.js';
131
131
  import './primitives/Progress.js';
132
132
  import './primitives/RadioGroup.js';
133
- import './Combobox-CUcCC9-A.js';
133
+ import './Combobox-CrcrQlgz.js';
134
134
  import './SelectFieldWrapper-D370CD4o.js';
135
135
  import './primitives/Sheet.js';
136
136
  import './sheet-BD8c3_Va.js';
@@ -4,7 +4,7 @@ import * as React from 'react';
4
4
  import { u as useDialogRootContext, h as DialogStore, i as useDialogRoot, I as IsDrawerContext, j as DialogRootContext, a as DialogClose, D as DialogPopup, f as DialogDescription, c as DialogBackdrop, b as DialogPortal, e as DialogTitle, g as DialogTrigger } from '../DialogTrigger-a3diAOif.js';
5
5
  import { C as CommonPopupDataAttributes, t as transitionStatusMapping, p as popupStateMapping } from '../useOpenInteractionType-CVfxIsuz.js';
6
6
  import { B as Button } from '../button-DTkEk06V.js';
7
- import { A as AriaHiddenCleanup } from '../useAriaHiddenCleanup-BIUbPJ6V.js';
7
+ import { A as AriaHiddenCleanup } from '../useAriaHiddenCleanup-Qc0GmbER.js';
8
8
  import 'react-dom';
9
9
  import '../floating-ui.utils.dom-Bw_Rc4bg.js';
10
10
  import '../index-DZXbzIgC.js';
@@ -1,12 +1,12 @@
1
1
  import 'react/jsx-runtime';
2
2
  import 'react';
3
3
  import '../utils-BJnb9o5c.js';
4
- export { C as Combobox, a as ComboboxChip, b as ComboboxChips, c as ComboboxChipsInput, d as ComboboxCollection, e as ComboboxContent, f as ComboboxEmpty, g as ComboboxGroup, h as ComboboxInput, i as ComboboxItem, j as ComboboxLabel, k as ComboboxList, l as ComboboxSeparator, m as ComboboxTrigger, n as ComboboxValue, u as useComboboxAnchor } from '../Combobox-CUcCC9-A.js';
4
+ export { C as Combobox, a as ComboboxChip, b as ComboboxChips, c as ComboboxChipsInput, d as ComboboxCollection, e as ComboboxContent, f as ComboboxEmpty, g as ComboboxGroup, h as ComboboxInput, i as ComboboxItem, j as ComboboxLabel, k as ComboboxList, l as ComboboxSeparator, m as ComboboxTrigger, n as ComboboxValue, u as useComboboxAnchor } from '../Combobox-CrcrQlgz.js';
5
5
  import '../button-DTkEk06V.js';
6
6
  import '../index-Bo3AAQJp.js';
7
7
  import '../index-CfriMyrd.js';
8
8
  import '../index-BtkPdosV.js';
9
- import '../useAriaHiddenCleanup-BIUbPJ6V.js';
9
+ import '../useAriaHiddenCleanup-Qc0GmbER.js';
10
10
  import '../input-group-CFQrWXbU.js';
11
11
  import '../input-BNPBqcmC.js';
12
12
  import '../textarea-ByEw7FT-.js';
@@ -2,7 +2,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import { c as cn } from '../utils-BJnb9o5c.js';
4
4
  import { B as Button } from '../button-DTkEk06V.js';
5
- import { A as AriaHiddenCleanup } from '../useAriaHiddenCleanup-BIUbPJ6V.js';
5
+ import { A as AriaHiddenCleanup } from '../useAriaHiddenCleanup-Qc0GmbER.js';
6
6
  import { D as Dialog$1, a as DialogPortal$1, b as DialogHeader$1, c as DialogTitle$1, d as DialogDescription$1, e as DialogFooter$1, f as DialogOverlay$1, g as DialogClose$2, h as DialogTrigger$1 } from '../dialog-BG8Tjl78.js';
7
7
  import { X } from '../x-_o2T3n6D.js';
8
8
  import { D as DialogPopup, a as DialogClose$1 } from '../DialogTrigger-a3diAOif.js';
@@ -2,7 +2,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import { c as cn } from '../utils-BJnb9o5c.js';
4
4
  import { B as Button } from '../button-DTkEk06V.js';
5
- import { A as AriaHiddenCleanup } from '../useAriaHiddenCleanup-BIUbPJ6V.js';
5
+ import { A as AriaHiddenCleanup } from '../useAriaHiddenCleanup-Qc0GmbER.js';
6
6
  import { S as SheetHeader$1, a as SheetFooter$1, b as SheetTitle$1, c as SheetDescription$1, d as Sheet$1, e as SheetClose$1, f as SheetTrigger$1 } from '../sheet-BD8c3_Va.js';
7
7
  import { X } from '../x-_o2T3n6D.js';
8
8
  import { b as DialogPortal, c as DialogBackdrop, D as DialogPopup, a as DialogClose } from '../DialogTrigger-a3diAOif.js';
@@ -13,7 +13,7 @@ export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious
13
13
  export { ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent } from './Chart.js';
14
14
  export { Checkbox } from './Checkbox.js';
15
15
  export { Collapsible, CollapsibleContent, CollapsibleTrigger } from './Collapsible.js';
16
- export { C as Combobox, a as ComboboxChip, b as ComboboxChips, c as ComboboxChipsInput, d as ComboboxCollection, e as ComboboxContent, f as ComboboxEmpty, g as ComboboxGroup, h as ComboboxInput, i as ComboboxItem, j as ComboboxLabel, k as ComboboxList, l as ComboboxSeparator, m as ComboboxTrigger, n as ComboboxValue, u as useComboboxAnchor } from '../Combobox-CUcCC9-A.js';
16
+ export { C as Combobox, a as ComboboxChip, b as ComboboxChips, c as ComboboxChipsInput, d as ComboboxCollection, e as ComboboxContent, f as ComboboxEmpty, g as ComboboxGroup, h as ComboboxInput, i as ComboboxItem, j as ComboboxLabel, k as ComboboxList, l as ComboboxSeparator, m as ComboboxTrigger, n as ComboboxValue, u as useComboboxAnchor } from '../Combobox-CrcrQlgz.js';
17
17
  export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut } from './Command.js';
18
18
  export { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger } from './ContextMenu.js';
19
19
  export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from './Dialog.js';
@@ -79,7 +79,7 @@ import '../floating-ui.utils.dom-Bw_Rc4bg.js';
79
79
  import '../index-DZXbzIgC.js';
80
80
  import '../index-CSMSzzKM.js';
81
81
  import '../with-selector-Dv0G_V_o.js';
82
- import '../useAriaHiddenCleanup-BIUbPJ6V.js';
82
+ import '../useAriaHiddenCleanup-Qc0GmbER.js';
83
83
  import '../index-CSUSJzOJ.js';
84
84
  import '../index-CfriMyrd.js';
85
85
  import 'react-i18next';
@@ -3,20 +3,22 @@ import { useEffect, useLayoutEffect } from 'react';
3
3
  const BASE_UI_MARKER = "data-base-ui-inert";
4
4
  const RADIX_MARKER = "data-aria-hidden";
5
5
  const LOCK_MARKERS = `[${BASE_UI_MARKER}],[${RADIX_MARKER}]`;
6
- const isLockOwned = (element) => element.matches(LOCK_MARKERS);
6
+ const isLockOwned = (element) => !!element.closest(LOCK_MARKERS);
7
7
  const isHidden = (element) => element.getAttribute("aria-hidden") === "true";
8
- const getTopLevelElements = () => Array.from(document.body.children);
9
8
  const useIsoLayoutEffect = typeof document === "undefined" ? useEffect : useLayoutEffect;
10
9
  const useAriaHiddenCleanup = () => {
11
10
  useIsoLayoutEffect(() => {
12
11
  const hiddenByLock = /* @__PURE__ */ new Set();
13
- const sweep = () => getTopLevelElements().filter(
14
- (element) => hiddenByLock.has(element) && isHidden(element) && !isLockOwned(element)
15
- ).forEach((element) => element.removeAttribute("aria-hidden"));
12
+ const sweep = () => hiddenByLock.forEach((element) => {
13
+ if (element.isConnected && isHidden(element)) {
14
+ if (isLockOwned(element)) return;
15
+ element.removeAttribute("aria-hidden");
16
+ }
17
+ hiddenByLock.delete(element);
18
+ });
16
19
  const observer = new MutationObserver((records) => {
17
20
  records.forEach(({ target, attributeName, oldValue }) => {
18
21
  const element = target;
19
- if (element.parentElement !== document.body) return;
20
22
  const wasApplied = attributeName === "aria-hidden" && oldValue !== "true";
21
23
  if (wasApplied && isHidden(element) && isLockOwned(element)) {
22
24
  hiddenByLock.add(element);
@@ -42,4 +44,4 @@ const AriaHiddenCleanup = () => {
42
44
  };
43
45
 
44
46
  export { AriaHiddenCleanup as A };
45
- //# sourceMappingURL=useAriaHiddenCleanup-BIUbPJ6V.js.map
47
+ //# sourceMappingURL=useAriaHiddenCleanup-Qc0GmbER.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAriaHiddenCleanup-Qc0GmbER.js","sources":["../src/hooks/useAriaHiddenCleanup.ts"],"sourcesContent":["import { useEffect, useLayoutEffect } from \"react\";\n\n/**\n * Elements hidden by a modal surface are stamped by whichever library owns the\n * lock: Base UI stamps `data-base-ui-inert`, the `aria-hidden` package behind\n * the Radix based primitives stamps `data-aria-hidden`. Both are marker\n * attributes; neither library applies the `inert` attribute to the page.\n */\nconst BASE_UI_MARKER = \"data-base-ui-inert\";\nconst RADIX_MARKER = \"data-aria-hidden\";\nconst LOCK_MARKERS = `[${BASE_UI_MARKER}],[${RADIX_MARKER}]`;\n\n/**\n * Radix stamps its marker on every element it hides. Base UI stamps its marker\n * only on top level elements, even when its `aria-hidden` lands deeper, which\n * happens whenever a live region inside the page makes the lock keep the path to\n * it in view. A lock holding a nested element therefore shows on an ancestor.\n */\nconst isLockOwned = (element: Element) => !!element.closest(LOCK_MARKERS);\n\nconst isHidden = (element: Element) =>\n element.getAttribute(\"aria-hidden\") === \"true\";\n\n/**\n * Effects do not run on the server at all, so the fallback never fires; it only\n * keeps React from warning about the layout variant during SSR.\n */\nconst useIsoLayoutEffect =\n typeof document === \"undefined\" ? useEffect : useLayoutEffect;\n\n/**\n * neeto-atoms ships two independent `aria-hidden` lock systems: Base UI's\n * `markOthers` (Dialog, Sheet, Combobox) and the `aria-hidden` package pulled in\n * by the Radix based primitives (Popover, Menu, Drawer, …). Each keeps its own\n * reference counts, so when a Radix popup hides the page first and Base UI opens\n * on top of it, Base UI records the page as \"hidden by someone else\" and skips\n * removing `aria-hidden` when its own last popup closes. The page then stays out\n * of the accessibility tree with nothing open.\n *\n * Mount this alongside a Base UI popup. It watches for `aria-hidden` being\n * applied by a lock and clears those, and only those, once every lock has let go\n * — an `aria-hidden` the page put there itself is never observed being applied\n * and so is never touched.\n *\n * This only patches over the two systems coexisting; a single one keeps its own\n * counts straight. Once every primitive here is built on Base UI and the\n * `aria-hidden` package is gone from the bundle, delete this hook along with the\n * `AriaHiddenCleanup` mounted in Dialog, Sheet, AlertDialog and Combobox.\n */\nexport const useAriaHiddenCleanup = () => {\n useIsoLayoutEffect(() => {\n /**\n * Elements watched as a lock hid them. Ownership cannot be read off the DOM\n * afterwards: a lock stamps its marker on elements the page had already\n * hidden, so a marker means \"a lock is holding this\", not \"a lock hid this\".\n */\n const hiddenByLock = new Set<Element>();\n\n const sweep = () =>\n hiddenByLock.forEach(element => {\n if (element.isConnected && isHidden(element)) {\n if (isLockOwned(element)) return;\n\n element.removeAttribute(\"aria-hidden\");\n }\n // Applying `aria-hidden` again is observed afresh, so there is no need\n // to hold on to anything no lock is hiding right now.\n hiddenByLock.delete(element);\n });\n\n const observer = new MutationObserver(records => {\n records.forEach(({ target, attributeName, oldValue }) => {\n const element = target as Element;\n const wasApplied =\n attributeName === \"aria-hidden\" && oldValue !== \"true\";\n\n // A lock applies its marker in the same batch, so it is readable here.\n if (wasApplied && isHidden(element) && isLockOwned(element)) {\n hiddenByLock.add(element);\n }\n });\n\n sweep();\n });\n\n // `keepMounted` keeps this mounted while the popup closes, so unmounting is\n // not a reliable signal on its own. Watch the locks instead — the sweep does\n // nothing until the last of them lets go.\n observer.observe(document.body, {\n subtree: true,\n attributes: true,\n attributeOldValue: true,\n attributeFilter: [\"aria-hidden\", BASE_UI_MARKER, RADIX_MARKER],\n });\n\n return () => {\n observer.disconnect();\n // Locks are released from effect cleanups too, so let those run first.\n setTimeout(sweep);\n };\n }, []);\n};\n\n/**\n * Renders nothing; mount it inside the portal so the cleanup is scoped to the\n * lifetime of the popup rather than to the component that declares it.\n */\nexport const AriaHiddenCleanup = () => {\n useAriaHiddenCleanup();\n\n return null;\n};\n"],"names":[],"mappings":";;AAQA,MAAM,cAAA,GAAiB,oBAAA;AACvB,MAAM,YAAA,GAAe,kBAAA;AACrB,MAAM,YAAA,GAAe,CAAA,CAAA,EAAI,cAAc,CAAA,GAAA,EAAM,YAAY,CAAA,CAAA,CAAA;AAQzD,MAAM,cAAc,CAAC,OAAA,KAAqB,CAAC,CAAC,OAAA,CAAQ,QAAQ,YAAY,CAAA;AAExE,MAAM,WAAW,CAAC,OAAA,KAChB,OAAA,CAAQ,YAAA,CAAa,aAAa,CAAA,KAAM,MAAA;AAM1C,MAAM,kBAAA,GACJ,OAAO,QAAA,KAAa,WAAA,GAAc,SAAA,GAAY,eAAA;AAqBzC,MAAM,uBAAuB,MAAM;AACxC,EAAA,kBAAA,CAAmB,MAAM;AAMvB,IAAA,MAAM,YAAA,uBAAmB,GAAA,EAAa;AAEtC,IAAA,MAAM,KAAA,GAAQ,MACZ,YAAA,CAAa,OAAA,CAAQ,CAAA,OAAA,KAAW;AAC9B,MAAA,IAAI,OAAA,CAAQ,WAAA,IAAe,QAAA,CAAS,OAAO,CAAA,EAAG;AAC5C,QAAA,IAAI,WAAA,CAAY,OAAO,CAAA,EAAG;AAE1B,QAAA,OAAA,CAAQ,gBAAgB,aAAa,CAAA;AAAA,MACvC;AAGA,MAAA,YAAA,CAAa,OAAO,OAAO,CAAA;AAAA,IAC7B,CAAC,CAAA;AAEH,IAAA,MAAM,QAAA,GAAW,IAAI,gBAAA,CAAiB,CAAA,OAAA,KAAW;AAC/C,MAAA,OAAA,CAAQ,QAAQ,CAAC,EAAE,MAAA,EAAQ,aAAA,EAAe,UAAS,KAAM;AACvD,QAAA,MAAM,OAAA,GAAU,MAAA;AAChB,QAAA,MAAM,UAAA,GACJ,aAAA,KAAkB,aAAA,IAAiB,QAAA,KAAa,MAAA;AAGlD,QAAA,IAAI,cAAc,QAAA,CAAS,OAAO,CAAA,IAAK,WAAA,CAAY,OAAO,CAAA,EAAG;AAC3D,UAAA,YAAA,CAAa,IAAI,OAAO,CAAA;AAAA,QAC1B;AAAA,MACF,CAAC,CAAA;AAED,MAAA,KAAA,EAAM;AAAA,IACR,CAAC,CAAA;AAKD,IAAA,QAAA,CAAS,OAAA,CAAQ,SAAS,IAAA,EAAM;AAAA,MAC9B,OAAA,EAAS,IAAA;AAAA,MACT,UAAA,EAAY,IAAA;AAAA,MACZ,iBAAA,EAAmB,IAAA;AAAA,MACnB,eAAA,EAAiB,CAAC,aAAA,EAAe,cAAA,EAAgB,YAAY;AAAA,KAC9D,CAAA;AAED,IAAA,OAAO,MAAM;AACX,MAAA,QAAA,CAAS,UAAA,EAAW;AAEpB,MAAA,UAAA,CAAW,KAAK,CAAA;AAAA,IAClB,CAAA;AAAA,EACF,CAAA,EAAG,EAAE,CAAA;AACP,CAAA;AAMO,MAAM,oBAAoB,MAAM;AACrC,EAAA,oBAAA,EAAqB;AAErB,EAAA,OAAO,IAAA;AACT;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-atoms",
3
- "version": "1.0.136",
3
+ "version": "1.0.137-beta1",
4
4
  "author": "BigBinary",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -209,4 +209,4 @@
209
209
  "react-router-dom": "^5.3.3"
210
210
  },
211
211
  "packageManager": "yarn@4.9.2"
212
- }
212
+ }
package/CHANGELOG.md DELETED
@@ -1,3 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
@@ -1 +0,0 @@
1
- {"version":3,"file":"useAriaHiddenCleanup-CT0To2AH.js","sources":["../../src/hooks/useAriaHiddenCleanup.ts"],"sourcesContent":["import { useEffect, useLayoutEffect } from \"react\";\n\n/**\n * Elements hidden by a modal surface are stamped by whichever library owns the\n * lock: Base UI stamps `data-base-ui-inert`, the `aria-hidden` package behind\n * the Radix based primitives stamps `data-aria-hidden`. Both are marker\n * attributes; neither library applies the `inert` attribute to the page.\n */\nconst BASE_UI_MARKER = \"data-base-ui-inert\";\nconst RADIX_MARKER = \"data-aria-hidden\";\nconst LOCK_MARKERS = `[${BASE_UI_MARKER}],[${RADIX_MARKER}]`;\n\nconst isLockOwned = (element: Element) => element.matches(LOCK_MARKERS);\n\nconst isHidden = (element: Element) =>\n element.getAttribute(\"aria-hidden\") === \"true\";\n\nconst getTopLevelElements = () => Array.from(document.body.children);\n\n/**\n * Effects do not run on the server at all, so the fallback never fires; it only\n * keeps React from warning about the layout variant during SSR.\n */\nconst useIsoLayoutEffect =\n typeof document === \"undefined\" ? useEffect : useLayoutEffect;\n\n/**\n * neeto-atoms ships two independent `aria-hidden` lock systems: Base UI's\n * `markOthers` (Dialog, Sheet, Combobox) and the `aria-hidden` package pulled in\n * by the Radix based primitives (Popover, Menu, Drawer, …). Each keeps its own\n * reference counts, so when a Radix popup hides the page first and Base UI opens\n * on top of it, Base UI records the page as \"hidden by someone else\" and skips\n * removing `aria-hidden` when its own last popup closes. The page then stays out\n * of the accessibility tree with nothing open.\n *\n * Mount this alongside a Base UI popup. It watches for `aria-hidden` being\n * applied by a lock and clears those, and only those, once every lock has let go\n * — an `aria-hidden` the page put there itself is never observed being applied\n * and so is never touched.\n */\nexport const useAriaHiddenCleanup = () => {\n useIsoLayoutEffect(() => {\n /**\n * Elements watched as a lock hid them. Ownership cannot be read off the DOM\n * afterwards: a lock stamps its marker on elements the page had already\n * hidden, so a marker means \"a lock is holding this\", not \"a lock hid this\".\n */\n const hiddenByLock = new Set<Element>();\n\n const sweep = () =>\n getTopLevelElements()\n .filter(\n element =>\n hiddenByLock.has(element) &&\n isHidden(element) &&\n !isLockOwned(element)\n )\n .forEach(element => element.removeAttribute(\"aria-hidden\"));\n\n const observer = new MutationObserver(records => {\n records.forEach(({ target, attributeName, oldValue }) => {\n const element = target as Element;\n // Only top level elements are ever swept, so tracking anything deeper\n // would just retain detached nodes for as long as the popup lives.\n if (element.parentElement !== document.body) return;\n\n const wasApplied =\n attributeName === \"aria-hidden\" && oldValue !== \"true\";\n\n // A lock applies its marker in the same batch, so it is readable here.\n if (wasApplied && isHidden(element) && isLockOwned(element)) {\n hiddenByLock.add(element);\n }\n });\n\n sweep();\n });\n\n // `keepMounted` keeps this mounted while the popup closes, so unmounting is\n // not a reliable signal on its own. Watch the locks instead — the sweep does\n // nothing until the last of them lets go.\n observer.observe(document.body, {\n subtree: true,\n attributes: true,\n attributeOldValue: true,\n attributeFilter: [\"aria-hidden\", BASE_UI_MARKER, RADIX_MARKER],\n });\n\n return () => {\n observer.disconnect();\n // Locks are released from effect cleanups too, so let those run first.\n setTimeout(sweep);\n };\n }, []);\n};\n\n/**\n * Renders nothing; mount it inside the portal so the cleanup is scoped to the\n * lifetime of the popup rather than to the component that declares it.\n */\nexport const AriaHiddenCleanup = () => {\n useAriaHiddenCleanup();\n\n return null;\n};\n"],"names":["useEffect","useLayoutEffect"],"mappings":";;;;AAQA,MAAM,cAAA,GAAiB,oBAAA;AACvB,MAAM,YAAA,GAAe,kBAAA;AACrB,MAAM,YAAA,GAAe,CAAA,CAAA,EAAI,cAAc,CAAA,GAAA,EAAM,YAAY,CAAA,CAAA,CAAA;AAEzD,MAAM,WAAA,GAAc,CAAC,OAAA,KAAqB,OAAA,CAAQ,QAAQ,YAAY,CAAA;AAEtE,MAAM,WAAW,CAAC,OAAA,KAChB,OAAA,CAAQ,YAAA,CAAa,aAAa,CAAA,KAAM,MAAA;AAE1C,MAAM,sBAAsB,MAAM,KAAA,CAAM,IAAA,CAAK,QAAA,CAAS,KAAK,QAAQ,CAAA;AAMnE,MAAM,kBAAA,GACJ,OAAO,QAAA,KAAa,WAAA,GAAcA,eAAA,GAAYC,qBAAA;AAgBzC,MAAM,uBAAuB,MAAM;AACxC,EAAA,kBAAA,CAAmB,MAAM;AAMvB,IAAA,MAAM,YAAA,uBAAmB,GAAA,EAAa;AAEtC,IAAA,MAAM,KAAA,GAAQ,MACZ,mBAAA,EAAoB,CACjB,MAAA;AAAA,MACC,CAAA,OAAA,KACE,YAAA,CAAa,GAAA,CAAI,OAAO,CAAA,IACxB,SAAS,OAAO,CAAA,IAChB,CAAC,WAAA,CAAY,OAAO;AAAA,MAEvB,OAAA,CAAQ,CAAA,OAAA,KAAW,OAAA,CAAQ,eAAA,CAAgB,aAAa,CAAC,CAAA;AAE9D,IAAA,MAAM,QAAA,GAAW,IAAI,gBAAA,CAAiB,CAAA,OAAA,KAAW;AAC/C,MAAA,OAAA,CAAQ,QAAQ,CAAC,EAAE,MAAA,EAAQ,aAAA,EAAe,UAAS,KAAM;AACvD,QAAA,MAAM,OAAA,GAAU,MAAA;AAGhB,QAAA,IAAI,OAAA,CAAQ,aAAA,KAAkB,QAAA,CAAS,IAAA,EAAM;AAE7C,QAAA,MAAM,UAAA,GACJ,aAAA,KAAkB,aAAA,IAAiB,QAAA,KAAa,MAAA;AAGlD,QAAA,IAAI,cAAc,QAAA,CAAS,OAAO,CAAA,IAAK,WAAA,CAAY,OAAO,CAAA,EAAG;AAC3D,UAAA,YAAA,CAAa,IAAI,OAAO,CAAA;AAAA,QAC1B;AAAA,MACF,CAAC,CAAA;AAED,MAAA,KAAA,EAAM;AAAA,IACR,CAAC,CAAA;AAKD,IAAA,QAAA,CAAS,OAAA,CAAQ,SAAS,IAAA,EAAM;AAAA,MAC9B,OAAA,EAAS,IAAA;AAAA,MACT,UAAA,EAAY,IAAA;AAAA,MACZ,iBAAA,EAAmB,IAAA;AAAA,MACnB,eAAA,EAAiB,CAAC,aAAA,EAAe,cAAA,EAAgB,YAAY;AAAA,KAC9D,CAAA;AAED,IAAA,OAAO,MAAM;AACX,MAAA,QAAA,CAAS,UAAA,EAAW;AAEpB,MAAA,UAAA,CAAW,KAAK,CAAA;AAAA,IAClB,CAAA;AAAA,EACF,CAAA,EAAG,EAAE,CAAA;AACP,CAAA;AAMO,MAAM,oBAAoB,MAAM;AACrC,EAAA,oBAAA,EAAqB;AAErB,EAAA,OAAO,IAAA;AACT;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useAriaHiddenCleanup-BIUbPJ6V.js","sources":["../src/hooks/useAriaHiddenCleanup.ts"],"sourcesContent":["import { useEffect, useLayoutEffect } from \"react\";\n\n/**\n * Elements hidden by a modal surface are stamped by whichever library owns the\n * lock: Base UI stamps `data-base-ui-inert`, the `aria-hidden` package behind\n * the Radix based primitives stamps `data-aria-hidden`. Both are marker\n * attributes; neither library applies the `inert` attribute to the page.\n */\nconst BASE_UI_MARKER = \"data-base-ui-inert\";\nconst RADIX_MARKER = \"data-aria-hidden\";\nconst LOCK_MARKERS = `[${BASE_UI_MARKER}],[${RADIX_MARKER}]`;\n\nconst isLockOwned = (element: Element) => element.matches(LOCK_MARKERS);\n\nconst isHidden = (element: Element) =>\n element.getAttribute(\"aria-hidden\") === \"true\";\n\nconst getTopLevelElements = () => Array.from(document.body.children);\n\n/**\n * Effects do not run on the server at all, so the fallback never fires; it only\n * keeps React from warning about the layout variant during SSR.\n */\nconst useIsoLayoutEffect =\n typeof document === \"undefined\" ? useEffect : useLayoutEffect;\n\n/**\n * neeto-atoms ships two independent `aria-hidden` lock systems: Base UI's\n * `markOthers` (Dialog, Sheet, Combobox) and the `aria-hidden` package pulled in\n * by the Radix based primitives (Popover, Menu, Drawer, …). Each keeps its own\n * reference counts, so when a Radix popup hides the page first and Base UI opens\n * on top of it, Base UI records the page as \"hidden by someone else\" and skips\n * removing `aria-hidden` when its own last popup closes. The page then stays out\n * of the accessibility tree with nothing open.\n *\n * Mount this alongside a Base UI popup. It watches for `aria-hidden` being\n * applied by a lock and clears those, and only those, once every lock has let go\n * — an `aria-hidden` the page put there itself is never observed being applied\n * and so is never touched.\n */\nexport const useAriaHiddenCleanup = () => {\n useIsoLayoutEffect(() => {\n /**\n * Elements watched as a lock hid them. Ownership cannot be read off the DOM\n * afterwards: a lock stamps its marker on elements the page had already\n * hidden, so a marker means \"a lock is holding this\", not \"a lock hid this\".\n */\n const hiddenByLock = new Set<Element>();\n\n const sweep = () =>\n getTopLevelElements()\n .filter(\n element =>\n hiddenByLock.has(element) &&\n isHidden(element) &&\n !isLockOwned(element)\n )\n .forEach(element => element.removeAttribute(\"aria-hidden\"));\n\n const observer = new MutationObserver(records => {\n records.forEach(({ target, attributeName, oldValue }) => {\n const element = target as Element;\n // Only top level elements are ever swept, so tracking anything deeper\n // would just retain detached nodes for as long as the popup lives.\n if (element.parentElement !== document.body) return;\n\n const wasApplied =\n attributeName === \"aria-hidden\" && oldValue !== \"true\";\n\n // A lock applies its marker in the same batch, so it is readable here.\n if (wasApplied && isHidden(element) && isLockOwned(element)) {\n hiddenByLock.add(element);\n }\n });\n\n sweep();\n });\n\n // `keepMounted` keeps this mounted while the popup closes, so unmounting is\n // not a reliable signal on its own. Watch the locks instead — the sweep does\n // nothing until the last of them lets go.\n observer.observe(document.body, {\n subtree: true,\n attributes: true,\n attributeOldValue: true,\n attributeFilter: [\"aria-hidden\", BASE_UI_MARKER, RADIX_MARKER],\n });\n\n return () => {\n observer.disconnect();\n // Locks are released from effect cleanups too, so let those run first.\n setTimeout(sweep);\n };\n }, []);\n};\n\n/**\n * Renders nothing; mount it inside the portal so the cleanup is scoped to the\n * lifetime of the popup rather than to the component that declares it.\n */\nexport const AriaHiddenCleanup = () => {\n useAriaHiddenCleanup();\n\n return null;\n};\n"],"names":[],"mappings":";;AAQA,MAAM,cAAA,GAAiB,oBAAA;AACvB,MAAM,YAAA,GAAe,kBAAA;AACrB,MAAM,YAAA,GAAe,CAAA,CAAA,EAAI,cAAc,CAAA,GAAA,EAAM,YAAY,CAAA,CAAA,CAAA;AAEzD,MAAM,WAAA,GAAc,CAAC,OAAA,KAAqB,OAAA,CAAQ,QAAQ,YAAY,CAAA;AAEtE,MAAM,WAAW,CAAC,OAAA,KAChB,OAAA,CAAQ,YAAA,CAAa,aAAa,CAAA,KAAM,MAAA;AAE1C,MAAM,sBAAsB,MAAM,KAAA,CAAM,IAAA,CAAK,QAAA,CAAS,KAAK,QAAQ,CAAA;AAMnE,MAAM,kBAAA,GACJ,OAAO,QAAA,KAAa,WAAA,GAAc,SAAA,GAAY,eAAA;AAgBzC,MAAM,uBAAuB,MAAM;AACxC,EAAA,kBAAA,CAAmB,MAAM;AAMvB,IAAA,MAAM,YAAA,uBAAmB,GAAA,EAAa;AAEtC,IAAA,MAAM,KAAA,GAAQ,MACZ,mBAAA,EAAoB,CACjB,MAAA;AAAA,MACC,CAAA,OAAA,KACE,YAAA,CAAa,GAAA,CAAI,OAAO,CAAA,IACxB,SAAS,OAAO,CAAA,IAChB,CAAC,WAAA,CAAY,OAAO;AAAA,MAEvB,OAAA,CAAQ,CAAA,OAAA,KAAW,OAAA,CAAQ,eAAA,CAAgB,aAAa,CAAC,CAAA;AAE9D,IAAA,MAAM,QAAA,GAAW,IAAI,gBAAA,CAAiB,CAAA,OAAA,KAAW;AAC/C,MAAA,OAAA,CAAQ,QAAQ,CAAC,EAAE,MAAA,EAAQ,aAAA,EAAe,UAAS,KAAM;AACvD,QAAA,MAAM,OAAA,GAAU,MAAA;AAGhB,QAAA,IAAI,OAAA,CAAQ,aAAA,KAAkB,QAAA,CAAS,IAAA,EAAM;AAE7C,QAAA,MAAM,UAAA,GACJ,aAAA,KAAkB,aAAA,IAAiB,QAAA,KAAa,MAAA;AAGlD,QAAA,IAAI,cAAc,QAAA,CAAS,OAAO,CAAA,IAAK,WAAA,CAAY,OAAO,CAAA,EAAG;AAC3D,UAAA,YAAA,CAAa,IAAI,OAAO,CAAA;AAAA,QAC1B;AAAA,MACF,CAAC,CAAA;AAED,MAAA,KAAA,EAAM;AAAA,IACR,CAAC,CAAA;AAKD,IAAA,QAAA,CAAS,OAAA,CAAQ,SAAS,IAAA,EAAM;AAAA,MAC9B,OAAA,EAAS,IAAA;AAAA,MACT,UAAA,EAAY,IAAA;AAAA,MACZ,iBAAA,EAAmB,IAAA;AAAA,MACnB,eAAA,EAAiB,CAAC,aAAA,EAAe,cAAA,EAAgB,YAAY;AAAA,KAC9D,CAAA;AAED,IAAA,OAAO,MAAM;AACX,MAAA,QAAA,CAAS,UAAA,EAAW;AAEpB,MAAA,UAAA,CAAW,KAAK,CAAA;AAAA,IAClB,CAAA;AAAA,EACF,CAAA,EAAG,EAAE,CAAA;AACP,CAAA;AAMO,MAAM,oBAAoB,MAAM;AACrC,EAAA,oBAAA,EAAqB;AAErB,EAAA,OAAO,IAAA;AACT;;;;"}