@zag-js/live-region 0.2.2 → 0.9.1
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 +2 -20
- package/dist/index.mjs +1 -17
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -23,25 +23,7 @@ __export(src_exports, {
|
|
|
23
23
|
createLiveRegion: () => createLiveRegion
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(src_exports);
|
|
26
|
-
|
|
27
|
-
// ../dom/src/visually-hidden.ts
|
|
28
|
-
var visuallyHiddenStyle = {
|
|
29
|
-
border: "0",
|
|
30
|
-
clip: "rect(0 0 0 0)",
|
|
31
|
-
height: "1px",
|
|
32
|
-
margin: "-1px",
|
|
33
|
-
overflow: "hidden",
|
|
34
|
-
padding: "0",
|
|
35
|
-
position: "absolute",
|
|
36
|
-
width: "1px",
|
|
37
|
-
whiteSpace: "nowrap",
|
|
38
|
-
wordWrap: "normal"
|
|
39
|
-
};
|
|
40
|
-
function setVisuallyHidden(el) {
|
|
41
|
-
Object.assign(el.style, visuallyHiddenStyle);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// src/index.ts
|
|
26
|
+
var import_visually_hidden = require("@zag-js/visually-hidden");
|
|
45
27
|
var ID = "__live-region__";
|
|
46
28
|
function createLiveRegion(opts = {}) {
|
|
47
29
|
const { level = "polite", document: doc = document, root, delay: _delay = 0 } = opts;
|
|
@@ -57,7 +39,7 @@ function createLiveRegion(opts = {}) {
|
|
|
57
39
|
const role = level !== "assertive" ? "status" : "alert";
|
|
58
40
|
region.setAttribute("aria-live", level);
|
|
59
41
|
region.setAttribute("role", role);
|
|
60
|
-
setVisuallyHidden(region);
|
|
42
|
+
(0, import_visually_hidden.setVisuallyHidden)(region);
|
|
61
43
|
parent.appendChild(region);
|
|
62
44
|
win.setTimeout(() => {
|
|
63
45
|
region.textContent = message;
|
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
// ../dom/src/visually-hidden.ts
|
|
2
|
-
var visuallyHiddenStyle = {
|
|
3
|
-
border: "0",
|
|
4
|
-
clip: "rect(0 0 0 0)",
|
|
5
|
-
height: "1px",
|
|
6
|
-
margin: "-1px",
|
|
7
|
-
overflow: "hidden",
|
|
8
|
-
padding: "0",
|
|
9
|
-
position: "absolute",
|
|
10
|
-
width: "1px",
|
|
11
|
-
whiteSpace: "nowrap",
|
|
12
|
-
wordWrap: "normal"
|
|
13
|
-
};
|
|
14
|
-
function setVisuallyHidden(el) {
|
|
15
|
-
Object.assign(el.style, visuallyHiddenStyle);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
1
|
// src/index.ts
|
|
2
|
+
import { setVisuallyHidden } from "@zag-js/visually-hidden";
|
|
19
3
|
var ID = "__live-region__";
|
|
20
4
|
function createLiveRegion(opts = {}) {
|
|
21
5
|
const { level = "polite", document: doc = document, root, delay: _delay = 0 } = opts;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/live-region",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Implementing live region for screen readers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -15,9 +15,11 @@
|
|
|
15
15
|
"files": [
|
|
16
16
|
"dist/**/*"
|
|
17
17
|
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@zag-js/visually-hidden": "0.9.1"
|
|
20
|
+
},
|
|
18
21
|
"devDependencies": {
|
|
19
|
-
"clean-package": "2.2.0"
|
|
20
|
-
"@zag-js/dom-utils": "0.2.4"
|
|
22
|
+
"clean-package": "2.2.0"
|
|
21
23
|
},
|
|
22
24
|
"publishConfig": {
|
|
23
25
|
"access": "public"
|