@zag-js/aria-hidden 0.82.1 → 1.0.0

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.
package/dist/index.js CHANGED
@@ -22,7 +22,7 @@ var isIgnoredNode = (node) => {
22
22
  return node.matches("[data-live-announcer]");
23
23
  };
24
24
  var walkTreeOutside = (originalTarget, props) => {
25
- const { parentNode, markerName, controlAttribute } = props;
25
+ const { parentNode, markerName, controlAttribute, explicitBooleanValue } = props;
26
26
  const targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
27
27
  markerMap[markerName] || (markerMap[markerName] = /* @__PURE__ */ new WeakMap());
28
28
  const markerCounter = markerMap[markerName];
@@ -46,7 +46,7 @@ var walkTreeOutside = (originalTarget, props) => {
46
46
  try {
47
47
  if (isIgnoredNode(node)) return;
48
48
  const attr = node.getAttribute(controlAttribute);
49
- const alreadyHidden = attr !== null && attr !== "false";
49
+ const alreadyHidden = explicitBooleanValue ? attr === "true" : attr !== null && attr !== "false";
50
50
  const counterValue = (counterMap.get(node) || 0) + 1;
51
51
  const markerValue = (markerCounter.get(node) || 0) + 1;
52
52
  counterMap.set(node, counterValue);
@@ -59,7 +59,7 @@ var walkTreeOutside = (originalTarget, props) => {
59
59
  node.setAttribute(markerName, "");
60
60
  }
61
61
  if (!alreadyHidden) {
62
- node.setAttribute(controlAttribute, "");
62
+ node.setAttribute(controlAttribute, explicitBooleanValue ? "true" : "");
63
63
  }
64
64
  } catch (e) {
65
65
  console.error("[zag-js > ariaHidden] cannot operate on ", node, e);
@@ -106,7 +106,8 @@ var hideOthers = (originalTarget, parentNode = getParentNode(originalTarget), ma
106
106
  return walkTreeOutside(originalTarget, {
107
107
  parentNode,
108
108
  markerName,
109
- controlAttribute: "aria-hidden"
109
+ controlAttribute: "aria-hidden",
110
+ explicitBooleanValue: true
110
111
  });
111
112
  };
112
113
 
package/dist/index.mjs CHANGED
@@ -20,7 +20,7 @@ var isIgnoredNode = (node) => {
20
20
  return node.matches("[data-live-announcer]");
21
21
  };
22
22
  var walkTreeOutside = (originalTarget, props) => {
23
- const { parentNode, markerName, controlAttribute } = props;
23
+ const { parentNode, markerName, controlAttribute, explicitBooleanValue } = props;
24
24
  const targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
25
25
  markerMap[markerName] || (markerMap[markerName] = /* @__PURE__ */ new WeakMap());
26
26
  const markerCounter = markerMap[markerName];
@@ -44,7 +44,7 @@ var walkTreeOutside = (originalTarget, props) => {
44
44
  try {
45
45
  if (isIgnoredNode(node)) return;
46
46
  const attr = node.getAttribute(controlAttribute);
47
- const alreadyHidden = attr !== null && attr !== "false";
47
+ const alreadyHidden = explicitBooleanValue ? attr === "true" : attr !== null && attr !== "false";
48
48
  const counterValue = (counterMap.get(node) || 0) + 1;
49
49
  const markerValue = (markerCounter.get(node) || 0) + 1;
50
50
  counterMap.set(node, counterValue);
@@ -57,7 +57,7 @@ var walkTreeOutside = (originalTarget, props) => {
57
57
  node.setAttribute(markerName, "");
58
58
  }
59
59
  if (!alreadyHidden) {
60
- node.setAttribute(controlAttribute, "");
60
+ node.setAttribute(controlAttribute, explicitBooleanValue ? "true" : "");
61
61
  }
62
62
  } catch (e) {
63
63
  console.error("[zag-js > ariaHidden] cannot operate on ", node, e);
@@ -104,7 +104,8 @@ var hideOthers = (originalTarget, parentNode = getParentNode(originalTarget), ma
104
104
  return walkTreeOutside(originalTarget, {
105
105
  parentNode,
106
106
  markerName,
107
- controlAttribute: "aria-hidden"
107
+ controlAttribute: "aria-hidden",
108
+ explicitBooleanValue: true
108
109
  });
109
110
  };
110
111
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/aria-hidden",
3
- "version": "0.82.1",
3
+ "version": "1.0.0",
4
4
  "description": "Hide targets from screen readers",
5
5
  "keywords": [
6
6
  "js",
@@ -30,9 +30,14 @@
30
30
  "types": "dist/index.d.ts",
31
31
  "exports": {
32
32
  ".": {
33
- "types": "./dist/index.d.ts",
34
- "import": "./dist/index.mjs",
35
- "require": "./dist/index.js"
33
+ "import": {
34
+ "types": "./dist/index.d.mts",
35
+ "default": "./dist/index.mjs"
36
+ },
37
+ "require": {
38
+ "types": "./dist/index.d.ts",
39
+ "default": "./dist/index.js"
40
+ }
36
41
  },
37
42
  "./package.json": "./package.json"
38
43
  },