@chakra-ui/live-region
Advanced tools
Comparing version 1.1.0 to 1.1.1
# Change Log | ||
## 1.1.1 | ||
### Patch Changes | ||
- [#5075](https://github.com/chakra-ui/chakra-ui/pull/5075) | ||
[`b28142946`](https://github.com/chakra-ui/chakra-ui/commit/b281429462a099b7fd7f9352e837cd28d1a2da0e) | ||
Thanks [@cschroeter](https://github.com/cschroeter)! - Update babel config to | ||
transpile soruces for older browsers. This fixes issues with CRA and | ||
Storybook. | ||
- Updated dependencies | ||
[[`b28142946`](https://github.com/chakra-ui/chakra-ui/commit/b281429462a099b7fd7f9352e837cd28d1a2da0e)]: | ||
- @chakra-ui/utils@1.9.1 | ||
## 1.1.0 | ||
@@ -4,0 +17,0 @@ |
@@ -28,4 +28,4 @@ 'use strict'; | ||
class LiveRegion { | ||
constructor(options) { | ||
var LiveRegion = /*#__PURE__*/function () { | ||
function LiveRegion(options) { | ||
this.region = void 0; | ||
@@ -43,3 +43,5 @@ this.options = void 0; | ||
speak(message) { | ||
var _proto = LiveRegion.prototype; | ||
_proto.speak = function speak(message) { | ||
this.clear(); | ||
@@ -50,20 +52,23 @@ | ||
} | ||
} | ||
}; | ||
destroy() { | ||
_proto.destroy = function destroy() { | ||
if (this.region) { | ||
this.region.parentNode?.removeChild(this.region); | ||
var _this$region$parentNo; | ||
(_this$region$parentNo = this.region.parentNode) == null ? void 0 : _this$region$parentNo.removeChild(this.region); | ||
} | ||
} | ||
}; | ||
clear() { | ||
_proto.clear = function clear() { | ||
if (this.region) { | ||
this.region.innerText = ""; | ||
} | ||
} | ||
}; | ||
} | ||
return LiveRegion; | ||
}(); | ||
function getOptions(options) { | ||
const defaultOptions = { | ||
var defaultOptions = { | ||
"aria-live": "polite", | ||
@@ -85,3 +90,3 @@ "aria-atomic": "true", | ||
function getRegion(options) { | ||
let region = utils.isBrowser ? document.getElementById(options.id) : null; | ||
var region = utils.isBrowser ? document.getElementById(options.id) : null; | ||
if (region) return region; | ||
@@ -118,5 +123,11 @@ | ||
function useLiveRegion(options) { | ||
const [liveRegion] = React__namespace.useState(() => new LiveRegion(options)); | ||
React__namespace.useEffect(() => () => { | ||
liveRegion.destroy(); | ||
var _React$useState = React__namespace.useState(function () { | ||
return new LiveRegion(options); | ||
}), | ||
liveRegion = _React$useState[0]; | ||
React__namespace.useEffect(function () { | ||
return function () { | ||
liveRegion.destroy(); | ||
}; | ||
}, [liveRegion]); | ||
@@ -123,0 +134,0 @@ return liveRegion; |
@@ -28,4 +28,4 @@ 'use strict'; | ||
class LiveRegion { | ||
constructor(options) { | ||
var LiveRegion = /*#__PURE__*/function () { | ||
function LiveRegion(options) { | ||
this.region = void 0; | ||
@@ -43,3 +43,5 @@ this.options = void 0; | ||
speak(message) { | ||
var _proto = LiveRegion.prototype; | ||
_proto.speak = function speak(message) { | ||
this.clear(); | ||
@@ -50,20 +52,23 @@ | ||
} | ||
} | ||
}; | ||
destroy() { | ||
_proto.destroy = function destroy() { | ||
if (this.region) { | ||
this.region.parentNode?.removeChild(this.region); | ||
var _this$region$parentNo; | ||
(_this$region$parentNo = this.region.parentNode) == null ? void 0 : _this$region$parentNo.removeChild(this.region); | ||
} | ||
} | ||
}; | ||
clear() { | ||
_proto.clear = function clear() { | ||
if (this.region) { | ||
this.region.innerText = ""; | ||
} | ||
} | ||
}; | ||
} | ||
return LiveRegion; | ||
}(); | ||
function getOptions(options) { | ||
const defaultOptions = { | ||
var defaultOptions = { | ||
"aria-live": "polite", | ||
@@ -85,3 +90,3 @@ "aria-atomic": "true", | ||
function getRegion(options) { | ||
let region = utils.isBrowser ? document.getElementById(options.id) : null; | ||
var region = utils.isBrowser ? document.getElementById(options.id) : null; | ||
if (region) return region; | ||
@@ -118,5 +123,11 @@ | ||
function useLiveRegion(options) { | ||
const [liveRegion] = React__namespace.useState(() => new LiveRegion(options)); | ||
React__namespace.useEffect(() => () => { | ||
liveRegion.destroy(); | ||
var _React$useState = React__namespace.useState(function () { | ||
return new LiveRegion(options); | ||
}), | ||
liveRegion = _React$useState[0]; | ||
React__namespace.useEffect(function () { | ||
return function () { | ||
liveRegion.destroy(); | ||
}; | ||
}, [liveRegion]); | ||
@@ -123,0 +134,0 @@ return liveRegion; |
import { isBrowser } from '@chakra-ui/utils'; | ||
import * as React from 'react'; | ||
class LiveRegion { | ||
constructor(options) { | ||
var LiveRegion = /*#__PURE__*/function () { | ||
function LiveRegion(options) { | ||
this.region = void 0; | ||
@@ -18,3 +18,5 @@ this.options = void 0; | ||
speak(message) { | ||
var _proto = LiveRegion.prototype; | ||
_proto.speak = function speak(message) { | ||
this.clear(); | ||
@@ -25,20 +27,23 @@ | ||
} | ||
} | ||
}; | ||
destroy() { | ||
_proto.destroy = function destroy() { | ||
if (this.region) { | ||
this.region.parentNode?.removeChild(this.region); | ||
var _this$region$parentNo; | ||
(_this$region$parentNo = this.region.parentNode) == null ? void 0 : _this$region$parentNo.removeChild(this.region); | ||
} | ||
} | ||
}; | ||
clear() { | ||
_proto.clear = function clear() { | ||
if (this.region) { | ||
this.region.innerText = ""; | ||
} | ||
} | ||
}; | ||
} | ||
return LiveRegion; | ||
}(); | ||
function getOptions(options) { | ||
const defaultOptions = { | ||
var defaultOptions = { | ||
"aria-live": "polite", | ||
@@ -60,3 +65,3 @@ "aria-atomic": "true", | ||
function getRegion(options) { | ||
let region = isBrowser ? document.getElementById(options.id) : null; | ||
var region = isBrowser ? document.getElementById(options.id) : null; | ||
if (region) return region; | ||
@@ -93,5 +98,11 @@ | ||
function useLiveRegion(options) { | ||
const [liveRegion] = React.useState(() => new LiveRegion(options)); | ||
React.useEffect(() => () => { | ||
liveRegion.destroy(); | ||
var _React$useState = React.useState(function () { | ||
return new LiveRegion(options); | ||
}), | ||
liveRegion = _React$useState[0]; | ||
React.useEffect(function () { | ||
return function () { | ||
liveRegion.destroy(); | ||
}; | ||
}, [liveRegion]); | ||
@@ -98,0 +109,0 @@ return liveRegion; |
export * from "./live-region"; | ||
export * from "./use-live-region"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -51,1 +51,2 @@ /// <reference types="react" /> | ||
} | ||
//# sourceMappingURL=live-region.d.ts.map |
import { LiveRegion, LiveRegionOptions } from "./live-region"; | ||
export declare function useLiveRegion(options?: LiveRegionOptions): LiveRegion; | ||
export default useLiveRegion; | ||
//# sourceMappingURL=use-live-region.d.ts.map |
{ | ||
"name": "@chakra-ui/live-region", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Aria live region for React components", | ||
@@ -22,3 +22,4 @@ "keywords": [ | ||
"files": [ | ||
"dist" | ||
"dist", | ||
"src" | ||
], | ||
@@ -37,3 +38,3 @@ "publishConfig": { | ||
"dependencies": { | ||
"@chakra-ui/utils": "1.9.0" | ||
"@chakra-ui/utils": "1.9.1" | ||
}, | ||
@@ -40,0 +41,0 @@ "peerDependencies": { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
28749
17
498
0
+ Added@chakra-ui/utils@1.9.1(transitive)
- Removed@chakra-ui/utils@1.9.0(transitive)
Updated@chakra-ui/utils@1.9.1