@neo4j-ndl/react 1.0.5 → 1.0.7

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.
@@ -1,283 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- /**
3
- *
4
- * Copyright (c) "Neo4j"
5
- * Neo4j Sweden AB [http://neo4j.com]
6
- *
7
- * This file is part of Neo4j.
8
- *
9
- * Neo4j is free software: you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License as published by
11
- * the Free Software Foundation, either version 3 of the License, or
12
- * (at your option) any later version.
13
- *
14
- * This program is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- * GNU General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU General Public License
20
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
- */
22
- /* eslint-disable consistent-return, jsx-a11y/no-noninteractive-tabindex */
23
- import * as React from 'react';
24
- /**
25
- * A modified version of the Material UI (@mui/material) TrapFocus component.
26
- * We use a modified/slimmed version for easier maintenance.
27
- *
28
- * See the LICENSES.txt file for license for @mui/material
29
- */
30
- function setRef(ref, value) {
31
- if (typeof ref === 'function') {
32
- ref(value);
33
- }
34
- else if (ref) {
35
- ref.current = value;
36
- }
37
- }
38
- function useForkRef(refA, refB) {
39
- /**
40
- * This will create a new function if the ref props change and are defined.
41
- * This means react will call the old forkRef with `null` and the new forkRef
42
- * with the ref. Cleanup naturally emerges from this behavior.
43
- */
44
- return React.useMemo(() => {
45
- if (refA == null && refB == null) {
46
- return null;
47
- }
48
- return (refValue) => {
49
- setRef(refA, refValue);
50
- setRef(refB, refValue);
51
- };
52
- }, [refA, refB]);
53
- }
54
- function ownerDocument(node) {
55
- return (node && node.ownerDocument) || document;
56
- }
57
- // Inspired by https://github.com/focus-trap/tabbable
58
- const candidatesSelector = [
59
- 'input',
60
- 'select',
61
- 'textarea',
62
- 'a[href]',
63
- 'button',
64
- '[tabindex]',
65
- 'audio[controls]',
66
- 'video[controls]',
67
- '[contenteditable]:not([contenteditable="false"])',
68
- ].join(',');
69
- function getTabIndex(node) {
70
- const tabindexAttr = parseInt(node.getAttribute('tabindex'), 10);
71
- if (!Number.isNaN(tabindexAttr)) {
72
- return tabindexAttr;
73
- }
74
- // Browsers do not return `tabIndex` correctly for contentEditable nodes;
75
- // https://bugs.chromium.org/p/chromium/issues/detail?id=661108&q=contenteditable%20tabindex&can=2
76
- // so if they don't have a tabindex attribute specifically set, assume it's 0.
77
- // in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default
78
- // `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,
79
- // yet they are still part of the regular tab order; in FF, they get a default
80
- // `tabIndex` of 0; since Chrome still puts those elements in the regular tab
81
- // order, consider their tab index to be 0.
82
- if (node.contentEditable === 'true' ||
83
- ((node.nodeName === 'AUDIO' ||
84
- node.nodeName === 'VIDEO' ||
85
- node.nodeName === 'DETAILS') &&
86
- node.getAttribute('tabindex') === null)) {
87
- return 0;
88
- }
89
- return node.tabIndex;
90
- }
91
- function isNonTabbableRadio(node) {
92
- if (node.tagName !== 'INPUT' || node.type !== 'radio') {
93
- return false;
94
- }
95
- if (!node.name) {
96
- return false;
97
- }
98
- const getRadio = (selector) => node.ownerDocument.querySelector(`input[type="radio"]${selector}`);
99
- let roving = getRadio(`[name="${node.name}"]:checked`);
100
- if (!roving) {
101
- roving = getRadio(`[name="${node.name}"]`);
102
- }
103
- return roving !== node;
104
- }
105
- function isNodeMatchingSelectorFocusable(node) {
106
- if (node.disabled ||
107
- (node.tagName === 'INPUT' && node.type === 'hidden') ||
108
- isNonTabbableRadio(node)) {
109
- return false;
110
- }
111
- return true;
112
- }
113
- function defaultGetTabbable(root) {
114
- const regularTabNodes = [];
115
- const orderedTabNodes = [];
116
- Array.from(root.querySelectorAll(candidatesSelector)).forEach((node, i) => {
117
- const nodeTabIndex = getTabIndex(node);
118
- if (nodeTabIndex === -1 || !isNodeMatchingSelectorFocusable(node)) {
119
- return;
120
- }
121
- if (nodeTabIndex === 0) {
122
- regularTabNodes.push(node);
123
- }
124
- else {
125
- orderedTabNodes.push({
126
- documentOrder: i,
127
- tabIndex: nodeTabIndex,
128
- node,
129
- });
130
- }
131
- });
132
- return orderedTabNodes
133
- .sort((a, b) => a.tabIndex === b.tabIndex
134
- ? a.documentOrder - b.documentOrder
135
- : a.tabIndex - b.tabIndex)
136
- .map((a) => a.node)
137
- .concat(regularTabNodes);
138
- }
139
- /**
140
- * Utility component that locks focus inside the component.
141
- */
142
- export function TrapFocus(props) {
143
- const { children, disableRestoreFocus = false, getTabbable = defaultGetTabbable, open, } = props;
144
- const ignoreNextEnforceFocus = React.useRef();
145
- const sentinelStart = React.useRef(null);
146
- const sentinelEnd = React.useRef(null);
147
- const nodeToRestore = React.useRef(null);
148
- const reactFocusEventTarget = React.useRef(null);
149
- const rootRef = React.useRef(null);
150
- const handleRef = useForkRef(children.ref, rootRef);
151
- const lastKeydown = React.useRef(null);
152
- React.useEffect(() => {
153
- // We might render an empty child.
154
- if (!open || !rootRef.current) {
155
- return;
156
- }
157
- const doc = ownerDocument(rootRef.current);
158
- if (!rootRef.current.contains(doc.activeElement)) {
159
- if (!rootRef.current.hasAttribute('tabIndex')) {
160
- rootRef.current.setAttribute('tabIndex', '-1');
161
- }
162
- rootRef.current.focus();
163
- }
164
- return () => {
165
- // restoreLastFocus()
166
- if (!disableRestoreFocus) {
167
- // In IE11 it is possible for document.activeElement to be null resulting
168
- // in nodeToRestore.current being null.
169
- // Not all elements in IE11 have a focus method.
170
- // Once IE11 support is dropped the focus() call can be unconditional.
171
- if (nodeToRestore.current && nodeToRestore.current.focus) {
172
- ignoreNextEnforceFocus.current = true;
173
- nodeToRestore.current.focus();
174
- }
175
- nodeToRestore.current = null;
176
- }
177
- };
178
- // Missing `disableRestoreFocus` which is fine.
179
- // We don't support changing that prop on an open TrapFocus
180
- // eslint-disable-next-line react-hooks/exhaustive-deps
181
- }, [open]);
182
- React.useEffect(() => {
183
- // We might render an empty child.
184
- if (!open || !rootRef.current) {
185
- return;
186
- }
187
- const doc = ownerDocument(rootRef.current);
188
- const contain = (nativeEvent) => {
189
- var _a, _b;
190
- const { current: rootElement } = rootRef;
191
- // Cleanup functions are executed lazily in React 17.
192
- // Contain can be called between the component being unmounted and its cleanup function being run.
193
- if (rootElement === null) {
194
- return;
195
- }
196
- if (!doc.hasFocus() || ignoreNextEnforceFocus.current) {
197
- ignoreNextEnforceFocus.current = false;
198
- return;
199
- }
200
- if (!rootElement.contains(doc.activeElement)) {
201
- // if the focus event is not coming from inside the children's react tree, reset the refs
202
- if ((nativeEvent &&
203
- reactFocusEventTarget.current !== nativeEvent.target) ||
204
- doc.activeElement !== reactFocusEventTarget.current) {
205
- reactFocusEventTarget.current = null;
206
- }
207
- else if (reactFocusEventTarget.current !== null) {
208
- return;
209
- }
210
- let tabbable = [];
211
- if (doc.activeElement === sentinelStart.current ||
212
- doc.activeElement === sentinelEnd.current) {
213
- tabbable = getTabbable(rootRef.current);
214
- }
215
- if (tabbable.length > 0) {
216
- const isShiftTab = Boolean(((_a = lastKeydown.current) === null || _a === void 0 ? void 0 : _a.shiftKey) && ((_b = lastKeydown.current) === null || _b === void 0 ? void 0 : _b.key) === 'Tab');
217
- const focusNext = tabbable[0];
218
- const focusPrevious = tabbable[tabbable.length - 1];
219
- if (isShiftTab) {
220
- focusPrevious.focus();
221
- }
222
- else {
223
- focusNext.focus();
224
- }
225
- }
226
- else {
227
- rootElement.focus();
228
- }
229
- }
230
- };
231
- const loopFocus = (nativeEvent) => {
232
- var _a;
233
- lastKeydown.current = nativeEvent;
234
- if (nativeEvent.key !== 'Tab') {
235
- return;
236
- }
237
- // Make sure the next tab starts from the right place.
238
- // doc.activeElement referes to the origin.
239
- if (doc.activeElement === rootRef.current && nativeEvent.shiftKey) {
240
- // We need to ignore the next contain as
241
- // it will try to move the focus back to the rootRef element.
242
- ignoreNextEnforceFocus.current = true;
243
- (_a = sentinelEnd.current) === null || _a === void 0 ? void 0 : _a.focus();
244
- }
245
- };
246
- doc.addEventListener('focusin', contain);
247
- doc.addEventListener('keydown', loopFocus, true);
248
- // With Edge, Safari and Firefox, no focus related events are fired when the focused area stops being a focused area.
249
- // e.g. https://bugzilla.mozilla.org/show_bug.cgi?id=559561.
250
- // Instead, we can look if the active element was restored on the BODY element.
251
- //
252
- // The whatwg spec defines how the browser should behave but does not explicitly mention any events:
253
- // https://html.spec.whatwg.org/multipage/interaction.html#focus-fixup-rule.
254
- const interval = setInterval(() => {
255
- var _a;
256
- if (((_a = doc.activeElement) === null || _a === void 0 ? void 0 : _a.tagName) === 'BODY') {
257
- contain();
258
- }
259
- }, 50);
260
- return () => {
261
- clearInterval(interval);
262
- doc.removeEventListener('focusin', contain);
263
- doc.removeEventListener('keydown', loopFocus, true);
264
- };
265
- }, [disableRestoreFocus, open, getTabbable]);
266
- const onFocus = (event) => {
267
- if (nodeToRestore.current === null) {
268
- nodeToRestore.current = event.relatedTarget;
269
- }
270
- reactFocusEventTarget.current = event.target;
271
- const childrenPropsHandler = children.props.onFocus;
272
- if (childrenPropsHandler) {
273
- childrenPropsHandler(event);
274
- }
275
- };
276
- const handleFocusSentinel = (event) => {
277
- if (nodeToRestore.current === null) {
278
- nodeToRestore.current = event.relatedTarget;
279
- }
280
- };
281
- return (_jsxs(React.Fragment, { children: [_jsx("div", { tabIndex: 0, onFocus: handleFocusSentinel, ref: sentinelStart, "data-test": "sentinelStart" }), React.cloneElement(children, { ref: handleRef, onFocus }), _jsx("div", { tabIndex: 0, onFocus: handleFocusSentinel, ref: sentinelEnd, "data-test": "sentinelEnd" })] }));
282
- }
283
- //# sourceMappingURL=TrapFocus.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TrapFocus.js","sourceRoot":"","sources":["../../../src/trap-focus/TrapFocus.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;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aAAa,eACR,eAAe,GACzB,EACD,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAC1D,cACE,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,mBAAmB,EAC5B,GAAG,EAAE,WAAW,eACN,aAAa,GACvB,IACa,CAClB,CAAC;AACJ,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/trap-focus/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,aAAa,CAAC"}
@@ -1,34 +0,0 @@
1
- /**
2
- *
3
- * Copyright (c) "Neo4j"
4
- * Neo4j Sweden AB [http://neo4j.com]
5
- *
6
- * This file is part of Neo4j.
7
- *
8
- * Neo4j is free software: you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation, either version 3 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
- */
21
- interface TrapFocusProps {
22
- /**
23
- * Must take a ref
24
- */
25
- children: any;
26
- open: boolean;
27
- disableRestoreFocus?: boolean;
28
- getTabbable?: (e: HTMLElement) => HTMLElement[];
29
- }
30
- /**
31
- * Utility component that locks focus inside the component.
32
- */
33
- export declare function TrapFocus(props: TrapFocusProps): JSX.Element;
34
- export {};
@@ -1,21 +0,0 @@
1
- /**
2
- *
3
- * Copyright (c) "Neo4j"
4
- * Neo4j Sweden AB [http://neo4j.com]
5
- *
6
- * This file is part of Neo4j.
7
- *
8
- * Neo4j is free software: you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation, either version 3 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
- */
21
- export * from './TrapFocus';