@chakra-ui/focus-lock
Advanced tools
Comparing version 1.0.1 to 1.0.2
# Change Log | ||
## 1.0.2 | ||
### Patch Changes | ||
- Updated dependencies | ||
[[`e73878ee`](https://github.com/chakra-ui/chakra-ui/commit/e73878ee686c11d3f94ad6ac61b19ae9508d75a5)]: | ||
- @chakra-ui/utils@1.0.2 | ||
## 1.0.1 | ||
@@ -4,0 +12,0 @@ |
@@ -18,8 +18,2 @@ "use strict"; | ||
/** | ||
* React component to trap focus within an element or component. | ||
* Mostly used in Modals, Popovers, etc. | ||
* | ||
* @see Docs https://chakra-ui.com/components/focuslock | ||
*/ | ||
var FocusLock = function FocusLock(props) { | ||
@@ -33,7 +27,8 @@ var initialFocusRef = props.initialFocusRef, | ||
autoFocus = props.autoFocus, | ||
persistentFocus = props.persistentFocus; | ||
persistentFocus = props.persistentFocus, | ||
lockFocusAcrossFrames = props.lockFocusAcrossFrames; | ||
var onActivation = React.useCallback(function () { | ||
if (initialFocusRef == null ? void 0 : initialFocusRef.current) { | ||
if (initialFocusRef != null && initialFocusRef.current) { | ||
initialFocusRef.current.focus(); | ||
} else if (contentRef == null ? void 0 : contentRef.current) { | ||
} else if (contentRef != null && contentRef.current) { | ||
var focusables = (0, _utils.getAllFocusable)(contentRef.current); | ||
@@ -53,2 +48,3 @@ | ||
return /*#__PURE__*/React.createElement(_reactFocusLock["default"], { | ||
crossFrame: lockFocusAcrossFrames, | ||
persistentFocus: persistentFocus, | ||
@@ -55,0 +51,0 @@ autoFocus: autoFocus, |
import * as React from "react"; | ||
import ReactFocusLock from "react-focus-lock"; | ||
import { __DEV__, getAllFocusable, focus } from "@chakra-ui/utils"; | ||
/** | ||
* React component to trap focus within an element or component. | ||
* Mostly used in Modals, Popovers, etc. | ||
* | ||
* @see Docs https://chakra-ui.com/components/focuslock | ||
*/ | ||
export var FocusLock = props => { | ||
@@ -20,8 +13,9 @@ var { | ||
autoFocus, | ||
persistentFocus | ||
persistentFocus, | ||
lockFocusAcrossFrames | ||
} = props; | ||
var onActivation = React.useCallback(() => { | ||
if (initialFocusRef == null ? void 0 : initialFocusRef.current) { | ||
if (initialFocusRef != null && initialFocusRef.current) { | ||
initialFocusRef.current.focus(); | ||
} else if (contentRef == null ? void 0 : contentRef.current) { | ||
} else if (contentRef != null && contentRef.current) { | ||
var focusables = getAllFocusable(contentRef.current); | ||
@@ -41,2 +35,3 @@ | ||
return /*#__PURE__*/React.createElement(ReactFocusLock, { | ||
crossFrame: lockFocusAcrossFrames, | ||
persistentFocus: persistentFocus, | ||
@@ -43,0 +38,0 @@ autoFocus: autoFocus, |
@@ -40,10 +40,10 @@ import * as React from "react"; | ||
persistentFocus?: boolean; | ||
/** | ||
* Enables aggressive focus capturing within iframes. | ||
* - If `true`: keep focus in the lock, no matter where lock is active | ||
* - If `false`: allows focus to move outside of iframe | ||
*/ | ||
lockFocusAcrossFrames?: boolean; | ||
} | ||
/** | ||
* React component to trap focus within an element or component. | ||
* Mostly used in Modals, Popovers, etc. | ||
* | ||
* @see Docs https://chakra-ui.com/components/focuslock | ||
*/ | ||
export declare const FocusLock: React.FC<FocusLockProps>; | ||
export default FocusLock; |
{ | ||
"name": "@chakra-ui/focus-lock", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "React focus lock for all Chakra components", | ||
@@ -54,3 +54,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@chakra-ui/utils": "1.0.1", | ||
"@chakra-ui/utils": "1.0.2", | ||
"react-focus-lock": "2.4.1" | ||
@@ -57,0 +57,0 @@ }, |
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
21998
144
+ Added@chakra-ui/utils@1.0.2(transitive)
- Removed@chakra-ui/utils@1.0.1(transitive)
Updated@chakra-ui/utils@1.0.2