@zag-js/dom-utils
Advanced tools
Comparing version 0.0.0-dev-20220603135505 to 0.0.0-dev-20220604091726
@@ -931,2 +931,3 @@ var __create = Object.create; | ||
// src/live-region.ts | ||
var LIVE_REGION_ID = "__live-region__"; | ||
function createLiveRegion(opts = {}) { | ||
@@ -938,7 +939,7 @@ var _a; | ||
function announce(message, delay) { | ||
const oldRegion = doc.getElementById("__live-region__"); | ||
const oldRegion = doc.getElementById(LIVE_REGION_ID); | ||
oldRegion == null ? void 0 : oldRegion.remove(); | ||
delay = delay != null ? delay : _delay; | ||
const region = doc.createElement("span"); | ||
region.id = "__live-region__"; | ||
region.id = LIVE_REGION_ID; | ||
region.dataset.liveAnnouncer = "true"; | ||
@@ -955,6 +956,12 @@ const role = level !== "assertive" ? "status" : "alert"; | ||
function destroy() { | ||
const oldRegion = doc.getElementById("__live-region__"); | ||
const oldRegion = doc.getElementById(LIVE_REGION_ID); | ||
oldRegion == null ? void 0 : oldRegion.remove(); | ||
} | ||
return { announce, destroy }; | ||
return { | ||
announce, | ||
destroy, | ||
toJSON() { | ||
return LIVE_REGION_ID; | ||
} | ||
}; | ||
} | ||
@@ -961,0 +968,0 @@ |
@@ -11,3 +11,4 @@ export declare type LiveRegionOptions = { | ||
destroy: () => void; | ||
toJSON(): string; | ||
}; | ||
//# sourceMappingURL=live-region.d.ts.map |
{ | ||
"name": "@zag-js/dom-utils", | ||
"version": "0.0.0-dev-20220603135505", | ||
"version": "0.0.0-dev-20220604091726", | ||
"description": "", | ||
@@ -29,3 +29,3 @@ "keywords": [ | ||
"@types/react": "^18.0.0", | ||
"@zag-js/utils": "0.0.0-dev-20220603135505", | ||
"@zag-js/utils": "0.0.0-dev-20220604091726", | ||
"scroll-into-view-if-needed": "^2.2.29" | ||
@@ -32,0 +32,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
269867
2772
+ Added@zag-js/utils@0.0.0-dev-20220604091726(transitive)
- Removed@zag-js/utils@0.0.0-dev-20220603135505(transitive)