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