react-focus-on 3.5.2 → 3.6.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/CHANGELOG.md +22 -0
- package/dist/es2015/Combination.js +3 -3
- package/dist/es2015/Effect.d.ts +0 -1
- package/dist/es2015/Effect.js +4 -1
- package/dist/es2015/InteractivityDisabler.d.ts +1 -1
- package/dist/es2015/UI.js +11 -10
- package/dist/es2015/medium.d.ts +2 -2
- package/dist/es2015/reExports.js +2 -2
- package/dist/es2015/sidecar.d.ts +1 -2
- package/dist/es2015/types.d.ts +24 -22
- package/dist/es5/Combination.js +1 -0
- package/dist/es5/Effect.d.ts +0 -1
- package/dist/es5/Effect.js +5 -1
- package/dist/es5/InteractivityDisabler.d.ts +1 -1
- package/dist/es5/InteractivityDisabler.js +1 -0
- package/dist/es5/UI.js +8 -6
- package/dist/es5/index.js +1 -1
- package/dist/es5/medium.d.ts +2 -2
- package/dist/es5/medium.js +1 -0
- package/dist/es5/reExports.js +4 -3
- package/dist/es5/sidecar.d.ts +1 -2
- package/dist/es5/types.d.ts +24 -22
- package/package.json +16 -11
- package/sidecar/sidecar.d.ts +1 -1
- package/dist/es2015/component.d.ts +0 -2
- package/dist/es2015/component.js +0 -12
- package/dist/es5/component.d.ts +0 -2
- package/dist/es5/component.js +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
# [3.6.0](https://github.com/theKashey/react-focus-on/compare/v3.5.4...v3.6.0) (2022-05-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update underlaying packages; brings React 18 and Shadow DOM support ([5bd7b5c](https://github.com/theKashey/react-focus-on/commit/5bd7b5c))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## [3.5.4](https://github.com/theKashey/react-focus-on/compare/v3.5.3...v3.5.4) (2021-11-09)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [3.5.3](https://github.com/theKashey/react-focus-on/compare/v3.5.2...v3.5.3) (2021-11-09)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* add tslib as dependency, fixes [#54](https://github.com/theKashey/react-focus-on/issues/54) ([ce204cd](https://github.com/theKashey/react-focus-on/commit/ce204cd))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
1
23
|
## [3.5.2](https://github.com/theKashey/react-focus-on/compare/v3.5.1...v3.5.2) (2021-03-28)
|
|
2
24
|
|
|
3
25
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { FocusOn as ReactFocusOn } from './UI';
|
|
4
4
|
import SideCar from './sidecar';
|
|
5
5
|
var RequireSideCar = function (props) {
|
|
6
|
-
return React.createElement(SideCar,
|
|
6
|
+
return React.createElement(SideCar, __assign({}, props));
|
|
7
7
|
};
|
|
8
|
-
export var FocusOn = React.forwardRef(function (props, ref) { return React.createElement(ReactFocusOn,
|
|
8
|
+
export var FocusOn = React.forwardRef(function (props, ref) { return React.createElement(ReactFocusOn, __assign({}, props, { ref: ref, sideCar: RequireSideCar })); });
|
package/dist/es2015/Effect.d.ts
CHANGED
package/dist/es2015/Effect.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __spreadArrays } from "tslib";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { hideOthers } from 'aria-hidden';
|
|
3
4
|
import { InteractivityDisabler } from './InteractivityDisabler';
|
|
@@ -77,7 +78,9 @@ export function Effect(_a) {
|
|
|
77
78
|
var _undo = function () { return null; };
|
|
78
79
|
var unmounted = false;
|
|
79
80
|
var onNodeActivation = function (node) {
|
|
80
|
-
|
|
81
|
+
if (!noIsolation) {
|
|
82
|
+
_undo = hideOthers(__spreadArrays([node], (shards || []).map(extractRef)), document.body, focusHiddenMarker);
|
|
83
|
+
}
|
|
81
84
|
setActiveNode(function () { return node; });
|
|
82
85
|
};
|
|
83
86
|
var onNodeDeactivation = function () {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export declare const InteractivityDisabler: React.
|
|
2
|
+
export declare const InteractivityDisabler: React.FC;
|
package/dist/es2015/UI.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { RemoveScroll } from 'react-remove-scroll/UI';
|
|
4
4
|
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, style = props.style, as = props.as, rest =
|
|
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, style = props.style, as = props.as, rest = __rest(props, ["children", "autoFocus", "shards", "enabled", "scrollLock", "focusLock", "returnFocus", "inert", "allowPinchZoom", "sideCar", "className", "shouldIgnore", "style", "as"]);
|
|
9
9
|
var SideCar = sideCar;
|
|
10
|
-
var onActivation = lockProps.onActivation, onDeactivation = lockProps.onDeactivation, restProps =
|
|
10
|
+
var onActivation = lockProps.onActivation, onDeactivation = lockProps.onDeactivation, restProps = __rest(lockProps, ["onActivation", "onDeactivation"]);
|
|
11
|
+
var appliedLockProps = __assign(__assign({}, restProps), { sideCar: sideCar,
|
|
12
|
+
shards: shards,
|
|
13
|
+
allowPinchZoom: allowPinchZoom,
|
|
14
|
+
as: as,
|
|
15
|
+
inert: inert,
|
|
16
|
+
style: style, enabled: enabled && scrollLock });
|
|
11
17
|
return (React.createElement(React.Fragment, null,
|
|
12
|
-
React.createElement(ReactFocusLock, { ref: parentRef, sideCar: sideCar, disabled: !(lockProps && enabled && focusLock), returnFocus: returnFocus, autoFocus: autoFocus, shards: shards, onActivation: onActivation, onDeactivation: onDeactivation, className: className,
|
|
13
|
-
|
|
14
|
-
allowPinchZoom: allowPinchZoom,
|
|
15
|
-
as: as,
|
|
16
|
-
inert: inert,
|
|
17
|
-
style: style, enabled: enabled && scrollLock }) }, children),
|
|
18
|
-
enabled && (React.createElement(SideCar, tslib_1.__assign({}, rest, { sideCar: effectCar, setLockProps: setLockProps, shards: shards })))));
|
|
18
|
+
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, as: RemoveScroll }, children),
|
|
19
|
+
enabled && (React.createElement(SideCar, __assign({}, rest, { sideCar: effectCar, setLockProps: setLockProps, shards: shards })))));
|
|
19
20
|
});
|
|
20
21
|
export * from './reExports';
|
package/dist/es2015/medium.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const effectCar: Readonly<import("use-sidecar/dist/es5/types").
|
|
1
|
+
import { EffectProps } from "./types";
|
|
2
|
+
export declare const effectCar: Readonly<import("use-sidecar/dist/es5/types").SideCarMedium<EffectProps>>;
|
|
3
3
|
export declare const focusHiddenMarker = "data-focus-on-hidden";
|
package/dist/es2015/reExports.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
2
|
import { RemoveScroll } from 'react-remove-scroll/UI';
|
|
3
3
|
export { AutoFocusInside, MoveFocusInside, InFocusGuard } from 'react-focus-lock/UI';
|
|
4
|
-
export var classNames =
|
|
4
|
+
export var classNames = __assign({}, RemoveScroll.classNames);
|
package/dist/es2015/sidecar.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import 'react-focus-lock/sidecar';
|
|
3
2
|
import 'react-remove-scroll/sidecar';
|
|
4
|
-
declare const _default: import("
|
|
3
|
+
declare const _default: import("use-sidecar").SideCarComponent<import("./types").EffectProps>;
|
|
5
4
|
export default _default;
|
package/dist/es2015/types.d.ts
CHANGED
|
@@ -1,89 +1,91 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import ReactFocusLock from 'react-focus-lock/UI';
|
|
3
|
+
import { ComponentProps } from "react";
|
|
2
4
|
export interface LockProps {
|
|
3
|
-
onMouseDown
|
|
4
|
-
onTouchStart
|
|
5
|
-
onActivation
|
|
6
|
-
onDeactivation
|
|
5
|
+
onMouseDown?: ((e: React.MouseEvent) => void) | undefined;
|
|
6
|
+
onTouchStart?: ((e: React.TouchEvent) => void) | undefined;
|
|
7
|
+
onActivation?: ((node: HTMLElement) => void) | undefined;
|
|
8
|
+
onDeactivation?: (() => void) | undefined;
|
|
7
9
|
}
|
|
8
10
|
export interface CommonProps {
|
|
9
11
|
/**
|
|
10
12
|
* action to perform on Esc key press
|
|
11
13
|
*/
|
|
12
|
-
onEscapeKey?: (event: Event) => void;
|
|
14
|
+
onEscapeKey?: ((event: Event) => void) | undefined;
|
|
13
15
|
/**
|
|
14
16
|
* action to perform on click outside
|
|
15
17
|
*/
|
|
16
|
-
onClickOutside?: (event: MouseEvent | TouchEvent) => void;
|
|
18
|
+
onClickOutside?: ((event: MouseEvent | TouchEvent) => void) | undefined;
|
|
17
19
|
/**
|
|
18
20
|
* callback on lock activation
|
|
19
21
|
* @param node the main node
|
|
20
22
|
*/
|
|
21
|
-
onActivation?: (node: HTMLElement) => void;
|
|
23
|
+
onActivation?: ((node: HTMLElement) => void) | undefined;
|
|
22
24
|
/**
|
|
23
25
|
* callback on lock deactivation
|
|
24
26
|
*/
|
|
25
|
-
onDeactivation?: () => void;
|
|
27
|
+
onDeactivation?: (() => void) | undefined;
|
|
26
28
|
/**
|
|
27
29
|
* [scroll-lock] control isolation
|
|
28
30
|
* @see {@link https://github.com/theKashey/react-remove-scroll#usage}
|
|
29
31
|
*/
|
|
30
|
-
noIsolation?: boolean;
|
|
32
|
+
noIsolation?: boolean | undefined;
|
|
31
33
|
/**
|
|
32
34
|
* [scroll-lock] full page inert (event suppression)
|
|
33
35
|
* @default false
|
|
34
36
|
* @see {@link https://github.com/theKashey/react-remove-scroll#usage}
|
|
35
37
|
*/
|
|
36
|
-
inert?: boolean;
|
|
38
|
+
inert?: boolean | undefined;
|
|
37
39
|
/**
|
|
38
40
|
* [scroll-lock] allows scroll based zoom
|
|
39
41
|
* @default false
|
|
40
42
|
* @see https://github.com/theKashey/react-remove-scroll#usage
|
|
41
43
|
*/
|
|
42
|
-
allowPinchZoom?: boolean;
|
|
44
|
+
allowPinchZoom?: boolean | undefined;
|
|
43
45
|
/**
|
|
44
46
|
* a list of elements which should be considered as a part of the lock
|
|
45
47
|
*/
|
|
46
|
-
shards?: Array<React.RefObject<any> | HTMLElement
|
|
48
|
+
shards?: (Array<React.RefObject<any> | HTMLElement>) | undefined;
|
|
47
49
|
}
|
|
48
50
|
export interface ReactFocusOnProps extends CommonProps {
|
|
49
51
|
/**
|
|
50
52
|
* The main switch
|
|
51
53
|
*/
|
|
52
|
-
enabled?: boolean;
|
|
54
|
+
enabled?: boolean | undefined;
|
|
53
55
|
/**
|
|
54
56
|
* Controls scroll lock behavior
|
|
55
57
|
*/
|
|
56
|
-
scrollLock?: boolean;
|
|
58
|
+
scrollLock?: boolean | undefined;
|
|
57
59
|
/**
|
|
58
60
|
* Controls focus lock behavior
|
|
59
61
|
*/
|
|
60
|
-
focusLock?: boolean;
|
|
62
|
+
focusLock?: boolean | undefined;
|
|
61
63
|
/**
|
|
62
64
|
* [focus-lock] control autofocus
|
|
63
65
|
* @default true
|
|
64
66
|
*/
|
|
65
|
-
autoFocus?: boolean;
|
|
67
|
+
autoFocus?: boolean | undefined;
|
|
66
68
|
/**
|
|
67
69
|
* [focus-lock] control returnFocus
|
|
68
70
|
* @default true
|
|
69
71
|
*/
|
|
70
|
-
returnFocus?:
|
|
72
|
+
returnFocus?: ComponentProps<typeof ReactFocusLock>['returnFocus'] | undefined;
|
|
71
73
|
/**
|
|
72
74
|
* [focus-lock] allows "ignoring" focus on some elements
|
|
73
75
|
* @see {@link https://github.com/theKashey/react-focus-lock#api}
|
|
74
76
|
*/
|
|
75
|
-
shouldIgnore?: (candidate: HTMLElement) => boolean;
|
|
77
|
+
shouldIgnore?: ((candidate: HTMLElement) => boolean) | undefined;
|
|
76
78
|
/**
|
|
77
79
|
* allows replacement of the host node
|
|
78
80
|
* @default div
|
|
79
81
|
*/
|
|
80
|
-
as?: string | React.ElementType;
|
|
81
|
-
style?: React.CSSProperties;
|
|
82
|
-
className?: string;
|
|
82
|
+
as?: string | React.ElementType | undefined;
|
|
83
|
+
style?: React.CSSProperties | undefined;
|
|
84
|
+
className?: string | undefined;
|
|
83
85
|
children: React.ReactNode;
|
|
84
86
|
}
|
|
85
87
|
export interface ReactFocusOnSideProps extends ReactFocusOnProps {
|
|
86
|
-
sideCar: React.
|
|
88
|
+
sideCar: React.FC<any>;
|
|
87
89
|
}
|
|
88
90
|
export interface EffectProps extends CommonProps {
|
|
89
91
|
setLockProps(settings: LockProps): void;
|
package/dist/es5/Combination.js
CHANGED
package/dist/es5/Effect.d.ts
CHANGED
package/dist/es5/Effect.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Effect = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
3
5
|
var React = require("react");
|
|
4
6
|
var aria_hidden_1 = require("aria-hidden");
|
|
5
7
|
var InteractivityDisabler_1 = require("./InteractivityDisabler");
|
|
@@ -79,7 +81,9 @@ function Effect(_a) {
|
|
|
79
81
|
var _undo = function () { return null; };
|
|
80
82
|
var unmounted = false;
|
|
81
83
|
var onNodeActivation = function (node) {
|
|
82
|
-
|
|
84
|
+
if (!noIsolation) {
|
|
85
|
+
_undo = aria_hidden_1.hideOthers(tslib_1.__spreadArrays([node], (shards || []).map(extractRef)), document.body, medium_1.focusHiddenMarker);
|
|
86
|
+
}
|
|
83
87
|
setActiveNode(function () { return node; });
|
|
84
88
|
};
|
|
85
89
|
var onNodeDeactivation = function () {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export declare const InteractivityDisabler: React.
|
|
2
|
+
export declare const InteractivityDisabler: React.FC;
|
package/dist/es5/UI.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FocusOn = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
5
|
var React = require("react");
|
|
5
6
|
var UI_1 = require("react-remove-scroll/UI");
|
|
@@ -10,13 +11,14 @@ exports.FocusOn = React.forwardRef(function (props, parentRef) {
|
|
|
10
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, style = props.style, as = props.as, rest = tslib_1.__rest(props, ["children", "autoFocus", "shards", "enabled", "scrollLock", "focusLock", "returnFocus", "inert", "allowPinchZoom", "sideCar", "className", "shouldIgnore", "style", "as"]);
|
|
11
12
|
var SideCar = sideCar;
|
|
12
13
|
var onActivation = lockProps.onActivation, onDeactivation = lockProps.onDeactivation, restProps = tslib_1.__rest(lockProps, ["onActivation", "onDeactivation"]);
|
|
14
|
+
var appliedLockProps = tslib_1.__assign(tslib_1.__assign({}, restProps), { sideCar: sideCar,
|
|
15
|
+
shards: shards,
|
|
16
|
+
allowPinchZoom: allowPinchZoom,
|
|
17
|
+
as: as,
|
|
18
|
+
inert: inert,
|
|
19
|
+
style: style, enabled: enabled && scrollLock });
|
|
13
20
|
return (React.createElement(React.Fragment, null,
|
|
14
|
-
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,
|
|
15
|
-
shards: shards,
|
|
16
|
-
allowPinchZoom: allowPinchZoom,
|
|
17
|
-
as: as,
|
|
18
|
-
inert: inert,
|
|
19
|
-
style: style, enabled: enabled && scrollLock }) }, children),
|
|
21
|
+
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, as: UI_1.RemoveScroll }, children),
|
|
20
22
|
enabled && (React.createElement(SideCar, tslib_1.__assign({}, rest, { sideCar: medium_1.effectCar, setLockProps: setLockProps, shards: shards })))));
|
|
21
23
|
});
|
|
22
24
|
tslib_1.__exportStar(require("./reExports"), exports);
|
package/dist/es5/index.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
4
|
var Combination_1 = require("./Combination");
|
|
5
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "FocusOn", { enumerable: true, get: function () { return Combination_1.FocusOn; } });
|
|
6
6
|
tslib_1.__exportStar(require("./reExports"), exports);
|
package/dist/es5/medium.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const effectCar: Readonly<import("use-sidecar/dist/es5/types").
|
|
1
|
+
import { EffectProps } from "./types";
|
|
2
|
+
export declare const effectCar: Readonly<import("use-sidecar/dist/es5/types").SideCarMedium<EffectProps>>;
|
|
3
3
|
export declare const focusHiddenMarker = "data-focus-on-hidden";
|
package/dist/es5/medium.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.focusHiddenMarker = exports.effectCar = void 0;
|
|
3
4
|
var use_sidecar_1 = require("use-sidecar");
|
|
4
5
|
exports.effectCar = use_sidecar_1.createSidecarMedium();
|
|
5
6
|
exports.focusHiddenMarker = 'data-focus-on-hidden';
|
package/dist/es5/reExports.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.classNames = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
5
|
var UI_1 = require("react-remove-scroll/UI");
|
|
5
6
|
var UI_2 = require("react-focus-lock/UI");
|
|
6
|
-
exports
|
|
7
|
-
exports
|
|
8
|
-
exports
|
|
7
|
+
Object.defineProperty(exports, "AutoFocusInside", { enumerable: true, get: function () { return UI_2.AutoFocusInside; } });
|
|
8
|
+
Object.defineProperty(exports, "MoveFocusInside", { enumerable: true, get: function () { return UI_2.MoveFocusInside; } });
|
|
9
|
+
Object.defineProperty(exports, "InFocusGuard", { enumerable: true, get: function () { return UI_2.InFocusGuard; } });
|
|
9
10
|
exports.classNames = tslib_1.__assign({}, UI_1.RemoveScroll.classNames);
|
package/dist/es5/sidecar.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import 'react-focus-lock/sidecar';
|
|
3
2
|
import 'react-remove-scroll/sidecar';
|
|
4
|
-
declare const _default: import("
|
|
3
|
+
declare const _default: import("use-sidecar").SideCarComponent<import("./types").EffectProps>;
|
|
5
4
|
export default _default;
|
package/dist/es5/types.d.ts
CHANGED
|
@@ -1,89 +1,91 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import ReactFocusLock from 'react-focus-lock/UI';
|
|
3
|
+
import { ComponentProps } from "react";
|
|
2
4
|
export interface LockProps {
|
|
3
|
-
onMouseDown
|
|
4
|
-
onTouchStart
|
|
5
|
-
onActivation
|
|
6
|
-
onDeactivation
|
|
5
|
+
onMouseDown?: ((e: React.MouseEvent) => void) | undefined;
|
|
6
|
+
onTouchStart?: ((e: React.TouchEvent) => void) | undefined;
|
|
7
|
+
onActivation?: ((node: HTMLElement) => void) | undefined;
|
|
8
|
+
onDeactivation?: (() => void) | undefined;
|
|
7
9
|
}
|
|
8
10
|
export interface CommonProps {
|
|
9
11
|
/**
|
|
10
12
|
* action to perform on Esc key press
|
|
11
13
|
*/
|
|
12
|
-
onEscapeKey?: (event: Event) => void;
|
|
14
|
+
onEscapeKey?: ((event: Event) => void) | undefined;
|
|
13
15
|
/**
|
|
14
16
|
* action to perform on click outside
|
|
15
17
|
*/
|
|
16
|
-
onClickOutside?: (event: MouseEvent | TouchEvent) => void;
|
|
18
|
+
onClickOutside?: ((event: MouseEvent | TouchEvent) => void) | undefined;
|
|
17
19
|
/**
|
|
18
20
|
* callback on lock activation
|
|
19
21
|
* @param node the main node
|
|
20
22
|
*/
|
|
21
|
-
onActivation?: (node: HTMLElement) => void;
|
|
23
|
+
onActivation?: ((node: HTMLElement) => void) | undefined;
|
|
22
24
|
/**
|
|
23
25
|
* callback on lock deactivation
|
|
24
26
|
*/
|
|
25
|
-
onDeactivation?: () => void;
|
|
27
|
+
onDeactivation?: (() => void) | undefined;
|
|
26
28
|
/**
|
|
27
29
|
* [scroll-lock] control isolation
|
|
28
30
|
* @see {@link https://github.com/theKashey/react-remove-scroll#usage}
|
|
29
31
|
*/
|
|
30
|
-
noIsolation?: boolean;
|
|
32
|
+
noIsolation?: boolean | undefined;
|
|
31
33
|
/**
|
|
32
34
|
* [scroll-lock] full page inert (event suppression)
|
|
33
35
|
* @default false
|
|
34
36
|
* @see {@link https://github.com/theKashey/react-remove-scroll#usage}
|
|
35
37
|
*/
|
|
36
|
-
inert?: boolean;
|
|
38
|
+
inert?: boolean | undefined;
|
|
37
39
|
/**
|
|
38
40
|
* [scroll-lock] allows scroll based zoom
|
|
39
41
|
* @default false
|
|
40
42
|
* @see https://github.com/theKashey/react-remove-scroll#usage
|
|
41
43
|
*/
|
|
42
|
-
allowPinchZoom?: boolean;
|
|
44
|
+
allowPinchZoom?: boolean | undefined;
|
|
43
45
|
/**
|
|
44
46
|
* a list of elements which should be considered as a part of the lock
|
|
45
47
|
*/
|
|
46
|
-
shards?: Array<React.RefObject<any> | HTMLElement
|
|
48
|
+
shards?: (Array<React.RefObject<any> | HTMLElement>) | undefined;
|
|
47
49
|
}
|
|
48
50
|
export interface ReactFocusOnProps extends CommonProps {
|
|
49
51
|
/**
|
|
50
52
|
* The main switch
|
|
51
53
|
*/
|
|
52
|
-
enabled?: boolean;
|
|
54
|
+
enabled?: boolean | undefined;
|
|
53
55
|
/**
|
|
54
56
|
* Controls scroll lock behavior
|
|
55
57
|
*/
|
|
56
|
-
scrollLock?: boolean;
|
|
58
|
+
scrollLock?: boolean | undefined;
|
|
57
59
|
/**
|
|
58
60
|
* Controls focus lock behavior
|
|
59
61
|
*/
|
|
60
|
-
focusLock?: boolean;
|
|
62
|
+
focusLock?: boolean | undefined;
|
|
61
63
|
/**
|
|
62
64
|
* [focus-lock] control autofocus
|
|
63
65
|
* @default true
|
|
64
66
|
*/
|
|
65
|
-
autoFocus?: boolean;
|
|
67
|
+
autoFocus?: boolean | undefined;
|
|
66
68
|
/**
|
|
67
69
|
* [focus-lock] control returnFocus
|
|
68
70
|
* @default true
|
|
69
71
|
*/
|
|
70
|
-
returnFocus?:
|
|
72
|
+
returnFocus?: ComponentProps<typeof ReactFocusLock>['returnFocus'] | undefined;
|
|
71
73
|
/**
|
|
72
74
|
* [focus-lock] allows "ignoring" focus on some elements
|
|
73
75
|
* @see {@link https://github.com/theKashey/react-focus-lock#api}
|
|
74
76
|
*/
|
|
75
|
-
shouldIgnore?: (candidate: HTMLElement) => boolean;
|
|
77
|
+
shouldIgnore?: ((candidate: HTMLElement) => boolean) | undefined;
|
|
76
78
|
/**
|
|
77
79
|
* allows replacement of the host node
|
|
78
80
|
* @default div
|
|
79
81
|
*/
|
|
80
|
-
as?: string | React.ElementType;
|
|
81
|
-
style?: React.CSSProperties;
|
|
82
|
-
className?: string;
|
|
82
|
+
as?: string | React.ElementType | undefined;
|
|
83
|
+
style?: React.CSSProperties | undefined;
|
|
84
|
+
className?: string | undefined;
|
|
83
85
|
children: React.ReactNode;
|
|
84
86
|
}
|
|
85
87
|
export interface ReactFocusOnSideProps extends ReactFocusOnProps {
|
|
86
|
-
sideCar: React.
|
|
88
|
+
sideCar: React.FC<any>;
|
|
87
89
|
}
|
|
88
90
|
export interface EffectProps extends CommonProps {
|
|
89
91
|
setLockProps(settings: LockProps): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-focus-on",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "The final solution for WAI ARIA compatible modal dialogs or full-screen tasks.",
|
|
5
5
|
"main": "dist/es5/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,13 +24,17 @@
|
|
|
24
24
|
"link:ss": "rsync -av ../react-remove-scroll-bar/node_modules/react-style-singleton node_modules/ --exclude node_modules --exclude .git",
|
|
25
25
|
"link:all": "yarn link:fl & yarn link:rfl & yarn link:ss & yarn link:rf & yarn link:sb"
|
|
26
26
|
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/theKashey/react-focus-on.git"
|
|
30
|
+
},
|
|
27
31
|
"sideEffects": [
|
|
28
32
|
"**/sidecar.js"
|
|
29
33
|
],
|
|
30
34
|
"author": "Anton Korzunov <thekashey@gmail.com>",
|
|
31
35
|
"license": "MIT",
|
|
32
36
|
"devDependencies": {
|
|
33
|
-
"@types/react": "^
|
|
37
|
+
"@types/react": "^18.0.8",
|
|
34
38
|
"conventional-changelog-cli": "^2.0.12",
|
|
35
39
|
"enzyme": "^3.10.0",
|
|
36
40
|
"enzyme-adapter-react-16": "^1.14.0",
|
|
@@ -40,19 +44,20 @@
|
|
|
40
44
|
"ts-react-toolbox": "^0.2.10"
|
|
41
45
|
},
|
|
42
46
|
"dependencies": {
|
|
43
|
-
"aria-hidden": "^1.1.
|
|
44
|
-
"react-focus-lock": "^2.
|
|
45
|
-
"react-remove-scroll": "^2.
|
|
46
|
-
"react-style-singleton": "^2.
|
|
47
|
-
"
|
|
48
|
-
"use-
|
|
47
|
+
"aria-hidden": "^1.1.3",
|
|
48
|
+
"react-focus-lock": "^2.9.0",
|
|
49
|
+
"react-remove-scroll": "^2.5.2",
|
|
50
|
+
"react-style-singleton": "^2.2.0",
|
|
51
|
+
"tslib": "^2.3.1",
|
|
52
|
+
"use-callback-ref": "^1.3.0",
|
|
53
|
+
"use-sidecar": "^1.1.2"
|
|
49
54
|
},
|
|
50
55
|
"engines": {
|
|
51
56
|
"node": ">=8.5.0"
|
|
52
57
|
},
|
|
53
58
|
"peerDependencies": {
|
|
54
|
-
"react": "^16.8.0 || ^17.0.0",
|
|
55
|
-
"
|
|
59
|
+
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
60
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
56
61
|
},
|
|
57
62
|
"peerDependenciesMeta": {
|
|
58
63
|
"@types/react": {
|
|
@@ -75,7 +80,7 @@
|
|
|
75
80
|
"isolation"
|
|
76
81
|
],
|
|
77
82
|
"resolutions": {
|
|
78
|
-
"typescript": "^3.
|
|
83
|
+
"typescript": "^3.8.0"
|
|
79
84
|
},
|
|
80
85
|
"homepage": "https://github.com/theKashey/react-focus-on#readme"
|
|
81
86
|
}
|
package/sidecar/sidecar.d.ts
CHANGED
package/dist/es2015/component.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { RemoveScroll } from 'react-remove-scroll/UI';
|
|
3
|
-
import ReactFocusLock from 'react-focus-lock/UI';
|
|
4
|
-
var extractRef = function (ref) { return (('current' in ref) ? ref.current : ref); };
|
|
5
|
-
export function ReactFocusOn(props) {
|
|
6
|
-
var _a = React.useState(null), lockProps = _a[0], setLockProps = _a[1];
|
|
7
|
-
var _b = this.props, children = _b.children, autoFocus = _b.autoFocus, shards = _b.shards, _c = _b.enabled, enabled = _c === void 0 ? true : _c, _d = _b.scrollLock, scrollLock = _d === void 0 ? true : _d, _e = _b.focusLock, focusLock = _e === void 0 ? true : _e, sideCar = _b.sideCar;
|
|
8
|
-
return (React.createElement(React.Fragment, null,
|
|
9
|
-
React.createElement(RemoveScroll, { sideCar: enabled && sideCar, enabled: enabled && scrollLock, shards: shards },
|
|
10
|
-
enabled && React.createElement(Effect, null),
|
|
11
|
-
React.createElement(ReactFocusLock, { sideCar: enabled && sideCar, disabled: !(this.state.lockProps && enabled && focusLock), returnFocus: true, autoFocus: autoFocus, onActivation: this.onActivation, onDeactivation: this.onDeactivation, shards: shards, lockProps: lockProps }, children))));
|
|
12
|
-
}
|
package/dist/es5/component.d.ts
DELETED
package/dist/es5/component.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var React = require("react");
|
|
4
|
-
var UI_1 = require("react-remove-scroll/UI");
|
|
5
|
-
var UI_2 = require("react-focus-lock/UI");
|
|
6
|
-
var InteractivityDisabler_1 = require("./InteractivityDisabler");
|
|
7
|
-
var extractRef = function (ref) { return (('current' in ref) ? ref.current : ref); };
|
|
8
|
-
function ReactFocusOn(props) {
|
|
9
|
-
var _a = React.useState(null), lockProps = _a[0], setLockProps = _a[1];
|
|
10
|
-
var _b = this.props, children = _b.children, autoFocus = _b.autoFocus, shards = _b.shards, _c = _b.enabled, enabled = _c === void 0 ? true : _c, _d = _b.scrollLock, scrollLock = _d === void 0 ? true : _d, _e = _b.focusLock, focusLock = _e === void 0 ? true : _e, sideCar = _b.sideCar;
|
|
11
|
-
return (React.createElement(React.Fragment, null,
|
|
12
|
-
React.createElement(UI_1.RemoveScroll, { sideCar: enabled && sideCar, enabled: enabled && scrollLock, shards: shards },
|
|
13
|
-
enabled && React.createElement(InteractivityDisabler_1.InteractivityDisabler, null),
|
|
14
|
-
React.createElement(UI_2.default, { sideCar: enabled && sideCar, disabled: !(this.state.lockProps && enabled && focusLock), returnFocus: true, autoFocus: autoFocus, onActivation: this.onActivation, onDeactivation: this.onDeactivation, shards: shards, lockProps: lockProps }, children))));
|
|
15
|
-
}
|
|
16
|
-
exports.ReactFocusOn = ReactFocusOn;
|