react-focus-on 3.8.2 → 3.9.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/README.md +1 -0
- package/dist/es2015/UI.js +2 -2
- package/dist/es2015/types.d.ts +7 -0
- package/dist/es5/UI.js +2 -2
- package/dist/es5/types.d.ts +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,6 +56,7 @@ import {FocusOn} from 'react-focus-on';
|
|
|
56
56
|
- `[autoFocus=true]` - enables or disables `auto focus` management (see [react-focus-lock documentation](https://github.com/theKashey/react-focus-lock))
|
|
57
57
|
- `[returnFocus=true]` - enables or disables `return focus` on lock deactivation (see [react-focus-lock documentation](https://github.com/theKashey/react-focus-lock))
|
|
58
58
|
- `[whiteList=fn]` - you could whitelist locations FocusLock should carry about. Everything outside it will ignore. For example - any modals (see [react-focus-lock documentation](https://github.com/theKashey/react-focus-lock))
|
|
59
|
+
- `[crossFrame=true]` - enables or disables cross frame focus trapping. Setting this to false allows focus to move outside iframes (see [react-focus-lock issue](https://github.com/theKashey/react-focus-lock/issues/104))
|
|
59
60
|
---
|
|
60
61
|
- `[gapMode]` - the way removed ScrollBar would be _compensated_ - margin(default), or padding. See [scroll-locky documentation](https://github.com/theKashey/react-scroll-locky#gap-modes) to find the one you need.
|
|
61
62
|
- `[noIsolation]` - disables aria-hidden isolation
|
package/dist/es2015/UI.js
CHANGED
|
@@ -5,7 +5,7 @@ import ReactFocusLock from 'react-focus-lock/UI';
|
|
|
5
5
|
import { effectCar } from './medium';
|
|
6
6
|
export var FocusOn = React.forwardRef(function (props, parentRef) {
|
|
7
7
|
var _a = React.useState(false), lockProps = _a[0], setLockProps = _a[1];
|
|
8
|
-
var children = props.children, autoFocus = props.autoFocus, shards = props.shards, _b = props.enabled, enabled = _b === void 0 ? true : _b, _c = props.scrollLock, scrollLock = _c === void 0 ? true : _c, _d = props.focusLock, focusLock = _d === void 0 ? true : _d, _e = props.returnFocus, returnFocus = _e === void 0 ? true : _e, inert = props.inert, allowPinchZoom = props.allowPinchZoom, sideCar = props.sideCar, className = props.className, shouldIgnore = props.shouldIgnore, preventScrollOnFocus = props.preventScrollOnFocus, style = props.style, as = props.as, gapMode = props.gapMode, rest = __rest(props, ["children", "autoFocus", "shards", "enabled", "scrollLock", "focusLock", "returnFocus", "inert", "allowPinchZoom", "sideCar", "className", "shouldIgnore", "preventScrollOnFocus", "style", "as", "gapMode"]);
|
|
8
|
+
var children = props.children, autoFocus = props.autoFocus, shards = props.shards, crossFrame = props.crossFrame, _b = props.enabled, enabled = _b === void 0 ? true : _b, _c = props.scrollLock, scrollLock = _c === void 0 ? true : _c, _d = props.focusLock, focusLock = _d === void 0 ? true : _d, _e = props.returnFocus, returnFocus = _e === void 0 ? true : _e, inert = props.inert, allowPinchZoom = props.allowPinchZoom, sideCar = props.sideCar, className = props.className, shouldIgnore = props.shouldIgnore, preventScrollOnFocus = props.preventScrollOnFocus, style = props.style, as = props.as, gapMode = props.gapMode, rest = __rest(props, ["children", "autoFocus", "shards", "crossFrame", "enabled", "scrollLock", "focusLock", "returnFocus", "inert", "allowPinchZoom", "sideCar", "className", "shouldIgnore", "preventScrollOnFocus", "style", "as", "gapMode"]);
|
|
9
9
|
var SideCar = sideCar;
|
|
10
10
|
var onActivation = lockProps.onActivation, onDeactivation = lockProps.onDeactivation, restProps = __rest(lockProps, ["onActivation", "onDeactivation"]);
|
|
11
11
|
var appliedLockProps = __assign(__assign({}, restProps), { as: as,
|
|
@@ -16,7 +16,7 @@ export var FocusOn = React.forwardRef(function (props, parentRef) {
|
|
|
16
16
|
gapMode: gapMode,
|
|
17
17
|
inert: inert, enabled: enabled && scrollLock });
|
|
18
18
|
return (React.createElement(React.Fragment, null,
|
|
19
|
-
React.createElement(ReactFocusLock, { ref: parentRef, sideCar: sideCar, disabled: !(lockProps && enabled && focusLock), returnFocus: returnFocus, autoFocus: autoFocus, shards: shards, onActivation: onActivation, onDeactivation: onDeactivation, className: className, whiteList: shouldIgnore, lockProps: appliedLockProps, focusOptions: preventScrollOnFocus ? { preventScroll: true } : undefined, as: RemoveScroll }, children),
|
|
19
|
+
React.createElement(ReactFocusLock, { ref: parentRef, sideCar: sideCar, disabled: !(lockProps && enabled && focusLock), returnFocus: returnFocus, autoFocus: autoFocus, shards: shards, crossFrame: crossFrame, onActivation: onActivation, onDeactivation: onDeactivation, className: className, whiteList: shouldIgnore, lockProps: appliedLockProps, focusOptions: preventScrollOnFocus ? { preventScroll: true } : undefined, as: RemoveScroll }, children),
|
|
20
20
|
enabled && (React.createElement(SideCar, __assign({}, rest, { sideCar: effectCar, setLockProps: setLockProps, shards: shards })))));
|
|
21
21
|
});
|
|
22
22
|
export * from './reExports';
|
package/dist/es2015/types.d.ts
CHANGED
|
@@ -82,6 +82,13 @@ export interface ReactFocusOnProps extends CommonProps {
|
|
|
82
82
|
* @default false
|
|
83
83
|
*/
|
|
84
84
|
preventScrollOnFocus?: boolean | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* [focus-lock] enables or disables cross-frame focus management when within an iframe.
|
|
87
|
+
* `true` means that focus will be restricted within the iframe
|
|
88
|
+
* `false` allows focus to leave the iframe and move to elements outside of it
|
|
89
|
+
* @default true
|
|
90
|
+
*/
|
|
91
|
+
crossFrame?: boolean | undefined;
|
|
85
92
|
/**
|
|
86
93
|
* [focus-lock] allows "ignoring" focus on some elements
|
|
87
94
|
* @see {@link https://github.com/theKashey/react-focus-lock#api}
|
package/dist/es5/UI.js
CHANGED
|
@@ -8,7 +8,7 @@ var UI_2 = require("react-focus-lock/UI");
|
|
|
8
8
|
var medium_1 = require("./medium");
|
|
9
9
|
exports.FocusOn = React.forwardRef(function (props, parentRef) {
|
|
10
10
|
var _a = React.useState(false), lockProps = _a[0], setLockProps = _a[1];
|
|
11
|
-
var children = props.children, autoFocus = props.autoFocus, shards = props.shards, _b = props.enabled, enabled = _b === void 0 ? true : _b, _c = props.scrollLock, scrollLock = _c === void 0 ? true : _c, _d = props.focusLock, focusLock = _d === void 0 ? true : _d, _e = props.returnFocus, returnFocus = _e === void 0 ? true : _e, inert = props.inert, allowPinchZoom = props.allowPinchZoom, sideCar = props.sideCar, className = props.className, shouldIgnore = props.shouldIgnore, preventScrollOnFocus = props.preventScrollOnFocus, style = props.style, as = props.as, gapMode = props.gapMode, rest = tslib_1.__rest(props, ["children", "autoFocus", "shards", "enabled", "scrollLock", "focusLock", "returnFocus", "inert", "allowPinchZoom", "sideCar", "className", "shouldIgnore", "preventScrollOnFocus", "style", "as", "gapMode"]);
|
|
11
|
+
var children = props.children, autoFocus = props.autoFocus, shards = props.shards, crossFrame = props.crossFrame, _b = props.enabled, enabled = _b === void 0 ? true : _b, _c = props.scrollLock, scrollLock = _c === void 0 ? true : _c, _d = props.focusLock, focusLock = _d === void 0 ? true : _d, _e = props.returnFocus, returnFocus = _e === void 0 ? true : _e, inert = props.inert, allowPinchZoom = props.allowPinchZoom, sideCar = props.sideCar, className = props.className, shouldIgnore = props.shouldIgnore, preventScrollOnFocus = props.preventScrollOnFocus, style = props.style, as = props.as, gapMode = props.gapMode, rest = tslib_1.__rest(props, ["children", "autoFocus", "shards", "crossFrame", "enabled", "scrollLock", "focusLock", "returnFocus", "inert", "allowPinchZoom", "sideCar", "className", "shouldIgnore", "preventScrollOnFocus", "style", "as", "gapMode"]);
|
|
12
12
|
var SideCar = sideCar;
|
|
13
13
|
var onActivation = lockProps.onActivation, onDeactivation = lockProps.onDeactivation, restProps = tslib_1.__rest(lockProps, ["onActivation", "onDeactivation"]);
|
|
14
14
|
var appliedLockProps = tslib_1.__assign(tslib_1.__assign({}, restProps), { as: as,
|
|
@@ -19,7 +19,7 @@ exports.FocusOn = React.forwardRef(function (props, parentRef) {
|
|
|
19
19
|
gapMode: gapMode,
|
|
20
20
|
inert: inert, enabled: enabled && scrollLock });
|
|
21
21
|
return (React.createElement(React.Fragment, null,
|
|
22
|
-
React.createElement(UI_2.default, { ref: parentRef, sideCar: sideCar, disabled: !(lockProps && enabled && focusLock), returnFocus: returnFocus, autoFocus: autoFocus, shards: shards, onActivation: onActivation, onDeactivation: onDeactivation, className: className, whiteList: shouldIgnore, lockProps: appliedLockProps, focusOptions: preventScrollOnFocus ? { preventScroll: true } : undefined, as: UI_1.RemoveScroll }, children),
|
|
22
|
+
React.createElement(UI_2.default, { ref: parentRef, sideCar: sideCar, disabled: !(lockProps && enabled && focusLock), returnFocus: returnFocus, autoFocus: autoFocus, shards: shards, crossFrame: crossFrame, onActivation: onActivation, onDeactivation: onDeactivation, className: className, whiteList: shouldIgnore, lockProps: appliedLockProps, focusOptions: preventScrollOnFocus ? { preventScroll: true } : undefined, as: UI_1.RemoveScroll }, children),
|
|
23
23
|
enabled && (React.createElement(SideCar, tslib_1.__assign({}, rest, { sideCar: medium_1.effectCar, setLockProps: setLockProps, shards: shards })))));
|
|
24
24
|
});
|
|
25
25
|
tslib_1.__exportStar(require("./reExports"), exports);
|
package/dist/es5/types.d.ts
CHANGED
|
@@ -82,6 +82,13 @@ export interface ReactFocusOnProps extends CommonProps {
|
|
|
82
82
|
* @default false
|
|
83
83
|
*/
|
|
84
84
|
preventScrollOnFocus?: boolean | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* [focus-lock] enables or disables cross-frame focus management when within an iframe.
|
|
87
|
+
* `true` means that focus will be restricted within the iframe
|
|
88
|
+
* `false` allows focus to leave the iframe and move to elements outside of it
|
|
89
|
+
* @default true
|
|
90
|
+
*/
|
|
91
|
+
crossFrame?: boolean | undefined;
|
|
85
92
|
/**
|
|
86
93
|
* [focus-lock] allows "ignoring" focus on some elements
|
|
87
94
|
* @see {@link https://github.com/theKashey/react-focus-lock#api}
|