@entur/modal 1.7.73-beta.0 → 1.7.73-beta.3
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/dist/modal.cjs.js +9 -3424
- package/dist/modal.cjs.js.map +1 -1
- package/dist/modal.esm.js +7 -3406
- package/dist/modal.esm.js.map +1 -1
- package/package.json +9 -17
package/dist/modal.cjs.js
CHANGED
|
@@ -5,3373 +5,17 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
5
5
|
const icons = require("@entur/icons");
|
|
6
6
|
const button = require("@entur/button");
|
|
7
7
|
const typography = require("@entur/typography");
|
|
8
|
+
const classNames = require("classnames");
|
|
9
|
+
const dialog = require("@reach/dialog");
|
|
8
10
|
const React = require("react");
|
|
9
|
-
const
|
|
11
|
+
const reactFocusLock = require("react-focus-lock");
|
|
10
12
|
const layout = require("@entur/layout");
|
|
11
|
-
function _interopNamespaceDefault(e) {
|
|
12
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
13
|
-
if (e) {
|
|
14
|
-
for (const k in e) {
|
|
15
|
-
if (k !== "default") {
|
|
16
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: () => e[k]
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
n.default = e;
|
|
25
|
-
return Object.freeze(n);
|
|
26
|
-
}
|
|
27
|
-
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
28
|
-
function getDefaultExportFromCjs(x) {
|
|
29
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
30
|
-
}
|
|
31
|
-
var classnames = { exports: {} };
|
|
32
|
-
/*!
|
|
33
|
-
Copyright (c) 2018 Jed Watson.
|
|
34
|
-
Licensed under the MIT License (MIT), see
|
|
35
|
-
http://jedwatson.github.io/classnames
|
|
36
|
-
*/
|
|
37
|
-
var hasRequiredClassnames;
|
|
38
|
-
function requireClassnames() {
|
|
39
|
-
if (hasRequiredClassnames) return classnames.exports;
|
|
40
|
-
hasRequiredClassnames = 1;
|
|
41
|
-
(function(module2) {
|
|
42
|
-
(function() {
|
|
43
|
-
var hasOwn = {}.hasOwnProperty;
|
|
44
|
-
function classNames2() {
|
|
45
|
-
var classes = "";
|
|
46
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
47
|
-
var arg = arguments[i];
|
|
48
|
-
if (arg) {
|
|
49
|
-
classes = appendClass(classes, parseValue(arg));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return classes;
|
|
53
|
-
}
|
|
54
|
-
function parseValue(arg) {
|
|
55
|
-
if (typeof arg === "string" || typeof arg === "number") {
|
|
56
|
-
return arg;
|
|
57
|
-
}
|
|
58
|
-
if (typeof arg !== "object") {
|
|
59
|
-
return "";
|
|
60
|
-
}
|
|
61
|
-
if (Array.isArray(arg)) {
|
|
62
|
-
return classNames2.apply(null, arg);
|
|
63
|
-
}
|
|
64
|
-
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
65
|
-
return arg.toString();
|
|
66
|
-
}
|
|
67
|
-
var classes = "";
|
|
68
|
-
for (var key in arg) {
|
|
69
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
70
|
-
classes = appendClass(classes, key);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return classes;
|
|
74
|
-
}
|
|
75
|
-
function appendClass(value, newClass) {
|
|
76
|
-
if (!newClass) {
|
|
77
|
-
return value;
|
|
78
|
-
}
|
|
79
|
-
if (value) {
|
|
80
|
-
return value + " " + newClass;
|
|
81
|
-
}
|
|
82
|
-
return value + newClass;
|
|
83
|
-
}
|
|
84
|
-
if (module2.exports) {
|
|
85
|
-
classNames2.default = classNames2;
|
|
86
|
-
module2.exports = classNames2;
|
|
87
|
-
} else {
|
|
88
|
-
window.classNames = classNames2;
|
|
89
|
-
}
|
|
90
|
-
})();
|
|
91
|
-
})(classnames);
|
|
92
|
-
return classnames.exports;
|
|
93
|
-
}
|
|
94
|
-
var classnamesExports = requireClassnames();
|
|
95
|
-
const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
|
|
96
|
-
function canUseDOM$1() {
|
|
97
|
-
return !!(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
98
|
-
}
|
|
99
|
-
var useIsomorphicLayoutEffect$1 = /* @__PURE__ */ canUseDOM$1() ? React.useLayoutEffect : React.useEffect;
|
|
100
|
-
function useForceUpdate() {
|
|
101
|
-
var _useState = React.useState(/* @__PURE__ */ Object.create(null)), dispatch = _useState[1];
|
|
102
|
-
return React.useCallback(function() {
|
|
103
|
-
dispatch(/* @__PURE__ */ Object.create(null));
|
|
104
|
-
}, []);
|
|
105
|
-
}
|
|
106
|
-
var isProduction = process.env.NODE_ENV === "production";
|
|
107
|
-
function warning(condition, message) {
|
|
108
|
-
if (!isProduction) {
|
|
109
|
-
if (condition) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
var text = "Warning: " + message;
|
|
113
|
-
if (typeof console !== "undefined") {
|
|
114
|
-
console.warn(text);
|
|
115
|
-
}
|
|
116
|
-
try {
|
|
117
|
-
throw Error(text);
|
|
118
|
-
} catch (x) {
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
var Portal = function Portal2(_ref2) {
|
|
123
|
-
var children = _ref2.children, _ref$type = _ref2.type, type = _ref$type === void 0 ? "reach-portal" : _ref$type, containerRef = _ref2.containerRef;
|
|
124
|
-
var mountNode = React.useRef(null);
|
|
125
|
-
var portalNode = React.useRef(null);
|
|
126
|
-
var forceUpdate = useForceUpdate();
|
|
127
|
-
if (process.env.NODE_ENV !== "production") {
|
|
128
|
-
React.useEffect(function() {
|
|
129
|
-
if (containerRef != null) {
|
|
130
|
-
process.env.NODE_ENV !== "production" ? warning(typeof containerRef === "object" && "current" in containerRef, "@reach/portal: Invalid value passed to the `containerRef` of a `Portal`. The portal will be appended to the document body, but if you want to attach it to another DOM node you must pass a valid React ref object to `containerRef`.") : void 0;
|
|
131
|
-
process.env.NODE_ENV !== "production" ? warning(containerRef ? containerRef.current != null : true, "@reach/portal: A ref was passed to the `containerRef` prop of a `Portal`, but no DOM node was attached to it. Be sure to pass the ref to a DOM component.\n\nIf you are forwarding the ref from another component, be sure to use the React.forwardRef API. See https://reactjs.org/docs/forwarding-refs.html.") : void 0;
|
|
132
|
-
}
|
|
133
|
-
}, [containerRef]);
|
|
134
|
-
}
|
|
135
|
-
useIsomorphicLayoutEffect$1(function() {
|
|
136
|
-
if (!mountNode.current) return;
|
|
137
|
-
var ownerDocument = mountNode.current.ownerDocument;
|
|
138
|
-
var body = (containerRef == null ? void 0 : containerRef.current) || ownerDocument.body;
|
|
139
|
-
portalNode.current = ownerDocument == null ? void 0 : ownerDocument.createElement(type);
|
|
140
|
-
body.appendChild(portalNode.current);
|
|
141
|
-
forceUpdate();
|
|
142
|
-
return function() {
|
|
143
|
-
if (portalNode.current && body) {
|
|
144
|
-
body.removeChild(portalNode.current);
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
}, [type, forceUpdate, containerRef]);
|
|
148
|
-
return portalNode.current ? /* @__PURE__ */ reactDom.createPortal(children, portalNode.current) : /* @__PURE__ */ React.createElement("span", {
|
|
149
|
-
ref: mountNode
|
|
150
|
-
});
|
|
151
|
-
};
|
|
152
|
-
if (process.env.NODE_ENV !== "production") {
|
|
153
|
-
Portal.displayName = "Portal";
|
|
154
|
-
}
|
|
155
|
-
function canUseDOM() {
|
|
156
|
-
return !!(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
157
|
-
}
|
|
158
|
-
function getOwnerDocument(element) {
|
|
159
|
-
return canUseDOM() ? element ? element.ownerDocument : document : null;
|
|
160
|
-
}
|
|
161
|
-
function isFunction(value) {
|
|
162
|
-
return !!(value && {}.toString.call(value) == "[object Function]");
|
|
163
|
-
}
|
|
164
|
-
function isString(value) {
|
|
165
|
-
return typeof value === "string";
|
|
166
|
-
}
|
|
167
|
-
function noop() {
|
|
168
|
-
}
|
|
169
|
-
var checkedPkgs = {};
|
|
170
|
-
function checkStyles(packageName) {
|
|
171
|
-
if (process.env.NODE_ENV !== "production") {
|
|
172
|
-
var _ref2 = typeof process !== "undefined" ? process.env : {
|
|
173
|
-
NODE_ENV: "development"
|
|
174
|
-
}, environment = _ref2.NODE_ENV;
|
|
175
|
-
if (checkedPkgs[packageName]) return;
|
|
176
|
-
checkedPkgs[packageName] = true;
|
|
177
|
-
if (environment === "development" && parseInt(window.getComputedStyle(document.body).getPropertyValue("--reach-" + packageName), 10) !== 1) {
|
|
178
|
-
console.warn("@reach/" + packageName + ' styles not found. If you are using a bundler like webpack or parcel include this in the entry file of your app before any of your own styles:\n \n import "@reach/' + packageName + `/styles.css";
|
|
179
|
-
|
|
180
|
-
Otherwise you'll need to include them some other way:
|
|
181
|
-
|
|
182
|
-
<link rel="stylesheet" type="text/css" href="node_modules/@reach/` + packageName + '/styles.css" />\n \n For more information visit https://ui.reach.tech/styling.\n ');
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
function useCheckStyles(packageName) {
|
|
187
|
-
if (process.env.NODE_ENV !== "production") {
|
|
188
|
-
var name = React.useRef(packageName);
|
|
189
|
-
React.useEffect(function() {
|
|
190
|
-
return void (name.current = packageName);
|
|
191
|
-
}, [packageName]);
|
|
192
|
-
React.useEffect(function() {
|
|
193
|
-
return checkStyles(name.current);
|
|
194
|
-
}, []);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
function _arrayLikeToArray(arr, len) {
|
|
198
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
199
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
200
|
-
return arr2;
|
|
201
|
-
}
|
|
202
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
203
|
-
if (!o) return;
|
|
204
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
205
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
206
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
207
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
208
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
209
|
-
}
|
|
210
|
-
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
211
|
-
var it;
|
|
212
|
-
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
|
213
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike) {
|
|
214
|
-
if (it) o = it;
|
|
215
|
-
var i = 0;
|
|
216
|
-
return function() {
|
|
217
|
-
if (i >= o.length) return {
|
|
218
|
-
done: true
|
|
219
|
-
};
|
|
220
|
-
return {
|
|
221
|
-
done: false,
|
|
222
|
-
value: o[i++]
|
|
223
|
-
};
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
227
|
-
}
|
|
228
|
-
it = o[Symbol.iterator]();
|
|
229
|
-
return it.next.bind(it);
|
|
230
|
-
}
|
|
231
|
-
function assignRef$1(ref, value) {
|
|
232
|
-
if (ref == null) return;
|
|
233
|
-
if (isFunction(ref)) {
|
|
234
|
-
ref(value);
|
|
235
|
-
} else {
|
|
236
|
-
try {
|
|
237
|
-
ref.current = value;
|
|
238
|
-
} catch (error) {
|
|
239
|
-
throw new Error('Cannot assign value "' + value + '" to ref "' + ref + '"');
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
function useComposedRefs() {
|
|
244
|
-
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
245
|
-
refs[_key] = arguments[_key];
|
|
246
|
-
}
|
|
247
|
-
return React.useCallback(function(node) {
|
|
248
|
-
for (var _iterator = _createForOfIteratorHelperLoose(refs), _step; !(_step = _iterator()).done; ) {
|
|
249
|
-
var ref = _step.value;
|
|
250
|
-
assignRef$1(ref, node);
|
|
251
|
-
}
|
|
252
|
-
}, refs);
|
|
253
|
-
}
|
|
254
|
-
function composeEventHandlers(theirHandler, ourHandler) {
|
|
255
|
-
return function(event) {
|
|
256
|
-
theirHandler && theirHandler(event);
|
|
257
|
-
if (!event.defaultPrevented) {
|
|
258
|
-
return ourHandler(event);
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
function _objectWithoutPropertiesLoose$1(r, e) {
|
|
263
|
-
if (null == r) return {};
|
|
264
|
-
var t = {};
|
|
265
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
266
|
-
if (e.includes(n)) continue;
|
|
267
|
-
t[n] = r[n];
|
|
268
|
-
}
|
|
269
|
-
return t;
|
|
270
|
-
}
|
|
271
|
-
function _extends$1() {
|
|
272
|
-
return _extends$1 = Object.assign ? Object.assign.bind() : function(n) {
|
|
273
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
274
|
-
var t = arguments[e];
|
|
275
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
276
|
-
}
|
|
277
|
-
return n;
|
|
278
|
-
}, _extends$1.apply(null, arguments);
|
|
279
|
-
}
|
|
280
|
-
var propTypes$1 = { exports: {} };
|
|
281
|
-
var reactIs = { exports: {} };
|
|
282
|
-
var reactIs_production_min = {};
|
|
283
|
-
/** @license React v16.13.1
|
|
284
|
-
* react-is.production.min.js
|
|
285
|
-
*
|
|
286
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
287
|
-
*
|
|
288
|
-
* This source code is licensed under the MIT license found in the
|
|
289
|
-
* LICENSE file in the root directory of this source tree.
|
|
290
|
-
*/
|
|
291
|
-
var hasRequiredReactIs_production_min;
|
|
292
|
-
function requireReactIs_production_min() {
|
|
293
|
-
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
294
|
-
hasRequiredReactIs_production_min = 1;
|
|
295
|
-
var b = "function" === typeof Symbol && Symbol.for, c = b ? Symbol.for("react.element") : 60103, d = b ? Symbol.for("react.portal") : 60106, e = b ? Symbol.for("react.fragment") : 60107, f = b ? Symbol.for("react.strict_mode") : 60108, g = b ? Symbol.for("react.profiler") : 60114, h = b ? Symbol.for("react.provider") : 60109, k = b ? Symbol.for("react.context") : 60110, l = b ? Symbol.for("react.async_mode") : 60111, m = b ? Symbol.for("react.concurrent_mode") : 60111, n = b ? Symbol.for("react.forward_ref") : 60112, p = b ? Symbol.for("react.suspense") : 60113, q = b ? Symbol.for("react.suspense_list") : 60120, r = b ? Symbol.for("react.memo") : 60115, t = b ? Symbol.for("react.lazy") : 60116, v = b ? Symbol.for("react.block") : 60121, w = b ? Symbol.for("react.fundamental") : 60117, x = b ? Symbol.for("react.responder") : 60118, y = b ? Symbol.for("react.scope") : 60119;
|
|
296
|
-
function z(a) {
|
|
297
|
-
if ("object" === typeof a && null !== a) {
|
|
298
|
-
var u = a.$$typeof;
|
|
299
|
-
switch (u) {
|
|
300
|
-
case c:
|
|
301
|
-
switch (a = a.type, a) {
|
|
302
|
-
case l:
|
|
303
|
-
case m:
|
|
304
|
-
case e:
|
|
305
|
-
case g:
|
|
306
|
-
case f:
|
|
307
|
-
case p:
|
|
308
|
-
return a;
|
|
309
|
-
default:
|
|
310
|
-
switch (a = a && a.$$typeof, a) {
|
|
311
|
-
case k:
|
|
312
|
-
case n:
|
|
313
|
-
case t:
|
|
314
|
-
case r:
|
|
315
|
-
case h:
|
|
316
|
-
return a;
|
|
317
|
-
default:
|
|
318
|
-
return u;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
case d:
|
|
322
|
-
return u;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
function A(a) {
|
|
327
|
-
return z(a) === m;
|
|
328
|
-
}
|
|
329
|
-
reactIs_production_min.AsyncMode = l;
|
|
330
|
-
reactIs_production_min.ConcurrentMode = m;
|
|
331
|
-
reactIs_production_min.ContextConsumer = k;
|
|
332
|
-
reactIs_production_min.ContextProvider = h;
|
|
333
|
-
reactIs_production_min.Element = c;
|
|
334
|
-
reactIs_production_min.ForwardRef = n;
|
|
335
|
-
reactIs_production_min.Fragment = e;
|
|
336
|
-
reactIs_production_min.Lazy = t;
|
|
337
|
-
reactIs_production_min.Memo = r;
|
|
338
|
-
reactIs_production_min.Portal = d;
|
|
339
|
-
reactIs_production_min.Profiler = g;
|
|
340
|
-
reactIs_production_min.StrictMode = f;
|
|
341
|
-
reactIs_production_min.Suspense = p;
|
|
342
|
-
reactIs_production_min.isAsyncMode = function(a) {
|
|
343
|
-
return A(a) || z(a) === l;
|
|
344
|
-
};
|
|
345
|
-
reactIs_production_min.isConcurrentMode = A;
|
|
346
|
-
reactIs_production_min.isContextConsumer = function(a) {
|
|
347
|
-
return z(a) === k;
|
|
348
|
-
};
|
|
349
|
-
reactIs_production_min.isContextProvider = function(a) {
|
|
350
|
-
return z(a) === h;
|
|
351
|
-
};
|
|
352
|
-
reactIs_production_min.isElement = function(a) {
|
|
353
|
-
return "object" === typeof a && null !== a && a.$$typeof === c;
|
|
354
|
-
};
|
|
355
|
-
reactIs_production_min.isForwardRef = function(a) {
|
|
356
|
-
return z(a) === n;
|
|
357
|
-
};
|
|
358
|
-
reactIs_production_min.isFragment = function(a) {
|
|
359
|
-
return z(a) === e;
|
|
360
|
-
};
|
|
361
|
-
reactIs_production_min.isLazy = function(a) {
|
|
362
|
-
return z(a) === t;
|
|
363
|
-
};
|
|
364
|
-
reactIs_production_min.isMemo = function(a) {
|
|
365
|
-
return z(a) === r;
|
|
366
|
-
};
|
|
367
|
-
reactIs_production_min.isPortal = function(a) {
|
|
368
|
-
return z(a) === d;
|
|
369
|
-
};
|
|
370
|
-
reactIs_production_min.isProfiler = function(a) {
|
|
371
|
-
return z(a) === g;
|
|
372
|
-
};
|
|
373
|
-
reactIs_production_min.isStrictMode = function(a) {
|
|
374
|
-
return z(a) === f;
|
|
375
|
-
};
|
|
376
|
-
reactIs_production_min.isSuspense = function(a) {
|
|
377
|
-
return z(a) === p;
|
|
378
|
-
};
|
|
379
|
-
reactIs_production_min.isValidElementType = function(a) {
|
|
380
|
-
return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === typeof a && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
|
|
381
|
-
};
|
|
382
|
-
reactIs_production_min.typeOf = z;
|
|
383
|
-
return reactIs_production_min;
|
|
384
|
-
}
|
|
385
|
-
var reactIs_development = {};
|
|
386
|
-
/** @license React v16.13.1
|
|
387
|
-
* react-is.development.js
|
|
388
|
-
*
|
|
389
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
390
|
-
*
|
|
391
|
-
* This source code is licensed under the MIT license found in the
|
|
392
|
-
* LICENSE file in the root directory of this source tree.
|
|
393
|
-
*/
|
|
394
|
-
var hasRequiredReactIs_development;
|
|
395
|
-
function requireReactIs_development() {
|
|
396
|
-
if (hasRequiredReactIs_development) return reactIs_development;
|
|
397
|
-
hasRequiredReactIs_development = 1;
|
|
398
|
-
if (process.env.NODE_ENV !== "production") {
|
|
399
|
-
(function() {
|
|
400
|
-
var hasSymbol = typeof Symbol === "function" && Symbol.for;
|
|
401
|
-
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 60103;
|
|
402
|
-
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 60106;
|
|
403
|
-
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 60107;
|
|
404
|
-
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 60108;
|
|
405
|
-
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 60114;
|
|
406
|
-
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 60109;
|
|
407
|
-
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 60110;
|
|
408
|
-
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 60111;
|
|
409
|
-
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 60111;
|
|
410
|
-
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 60112;
|
|
411
|
-
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 60113;
|
|
412
|
-
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for("react.suspense_list") : 60120;
|
|
413
|
-
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 60115;
|
|
414
|
-
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 60116;
|
|
415
|
-
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 60121;
|
|
416
|
-
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117;
|
|
417
|
-
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118;
|
|
418
|
-
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119;
|
|
419
|
-
function isValidElementType(type) {
|
|
420
|
-
return typeof type === "string" || typeof type === "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
421
|
-
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
422
|
-
}
|
|
423
|
-
function typeOf(object) {
|
|
424
|
-
if (typeof object === "object" && object !== null) {
|
|
425
|
-
var $$typeof = object.$$typeof;
|
|
426
|
-
switch ($$typeof) {
|
|
427
|
-
case REACT_ELEMENT_TYPE:
|
|
428
|
-
var type = object.type;
|
|
429
|
-
switch (type) {
|
|
430
|
-
case REACT_ASYNC_MODE_TYPE:
|
|
431
|
-
case REACT_CONCURRENT_MODE_TYPE:
|
|
432
|
-
case REACT_FRAGMENT_TYPE:
|
|
433
|
-
case REACT_PROFILER_TYPE:
|
|
434
|
-
case REACT_STRICT_MODE_TYPE:
|
|
435
|
-
case REACT_SUSPENSE_TYPE:
|
|
436
|
-
return type;
|
|
437
|
-
default:
|
|
438
|
-
var $$typeofType = type && type.$$typeof;
|
|
439
|
-
switch ($$typeofType) {
|
|
440
|
-
case REACT_CONTEXT_TYPE:
|
|
441
|
-
case REACT_FORWARD_REF_TYPE:
|
|
442
|
-
case REACT_LAZY_TYPE:
|
|
443
|
-
case REACT_MEMO_TYPE:
|
|
444
|
-
case REACT_PROVIDER_TYPE:
|
|
445
|
-
return $$typeofType;
|
|
446
|
-
default:
|
|
447
|
-
return $$typeof;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
case REACT_PORTAL_TYPE:
|
|
451
|
-
return $$typeof;
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
return void 0;
|
|
455
|
-
}
|
|
456
|
-
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
457
|
-
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
458
|
-
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
459
|
-
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
460
|
-
var Element2 = REACT_ELEMENT_TYPE;
|
|
461
|
-
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
462
|
-
var Fragment = REACT_FRAGMENT_TYPE;
|
|
463
|
-
var Lazy = REACT_LAZY_TYPE;
|
|
464
|
-
var Memo = REACT_MEMO_TYPE;
|
|
465
|
-
var Portal3 = REACT_PORTAL_TYPE;
|
|
466
|
-
var Profiler = REACT_PROFILER_TYPE;
|
|
467
|
-
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
468
|
-
var Suspense = REACT_SUSPENSE_TYPE;
|
|
469
|
-
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
470
|
-
function isAsyncMode(object) {
|
|
471
|
-
{
|
|
472
|
-
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
473
|
-
hasWarnedAboutDeprecatedIsAsyncMode = true;
|
|
474
|
-
console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.");
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
478
|
-
}
|
|
479
|
-
function isConcurrentMode(object) {
|
|
480
|
-
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
481
|
-
}
|
|
482
|
-
function isContextConsumer(object) {
|
|
483
|
-
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
484
|
-
}
|
|
485
|
-
function isContextProvider(object) {
|
|
486
|
-
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
487
|
-
}
|
|
488
|
-
function isElement(object) {
|
|
489
|
-
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
490
|
-
}
|
|
491
|
-
function isForwardRef(object) {
|
|
492
|
-
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
493
|
-
}
|
|
494
|
-
function isFragment(object) {
|
|
495
|
-
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
496
|
-
}
|
|
497
|
-
function isLazy(object) {
|
|
498
|
-
return typeOf(object) === REACT_LAZY_TYPE;
|
|
499
|
-
}
|
|
500
|
-
function isMemo(object) {
|
|
501
|
-
return typeOf(object) === REACT_MEMO_TYPE;
|
|
502
|
-
}
|
|
503
|
-
function isPortal(object) {
|
|
504
|
-
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
505
|
-
}
|
|
506
|
-
function isProfiler(object) {
|
|
507
|
-
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
508
|
-
}
|
|
509
|
-
function isStrictMode(object) {
|
|
510
|
-
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
511
|
-
}
|
|
512
|
-
function isSuspense(object) {
|
|
513
|
-
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
514
|
-
}
|
|
515
|
-
reactIs_development.AsyncMode = AsyncMode;
|
|
516
|
-
reactIs_development.ConcurrentMode = ConcurrentMode;
|
|
517
|
-
reactIs_development.ContextConsumer = ContextConsumer;
|
|
518
|
-
reactIs_development.ContextProvider = ContextProvider;
|
|
519
|
-
reactIs_development.Element = Element2;
|
|
520
|
-
reactIs_development.ForwardRef = ForwardRef;
|
|
521
|
-
reactIs_development.Fragment = Fragment;
|
|
522
|
-
reactIs_development.Lazy = Lazy;
|
|
523
|
-
reactIs_development.Memo = Memo;
|
|
524
|
-
reactIs_development.Portal = Portal3;
|
|
525
|
-
reactIs_development.Profiler = Profiler;
|
|
526
|
-
reactIs_development.StrictMode = StrictMode;
|
|
527
|
-
reactIs_development.Suspense = Suspense;
|
|
528
|
-
reactIs_development.isAsyncMode = isAsyncMode;
|
|
529
|
-
reactIs_development.isConcurrentMode = isConcurrentMode;
|
|
530
|
-
reactIs_development.isContextConsumer = isContextConsumer;
|
|
531
|
-
reactIs_development.isContextProvider = isContextProvider;
|
|
532
|
-
reactIs_development.isElement = isElement;
|
|
533
|
-
reactIs_development.isForwardRef = isForwardRef;
|
|
534
|
-
reactIs_development.isFragment = isFragment;
|
|
535
|
-
reactIs_development.isLazy = isLazy;
|
|
536
|
-
reactIs_development.isMemo = isMemo;
|
|
537
|
-
reactIs_development.isPortal = isPortal;
|
|
538
|
-
reactIs_development.isProfiler = isProfiler;
|
|
539
|
-
reactIs_development.isStrictMode = isStrictMode;
|
|
540
|
-
reactIs_development.isSuspense = isSuspense;
|
|
541
|
-
reactIs_development.isValidElementType = isValidElementType;
|
|
542
|
-
reactIs_development.typeOf = typeOf;
|
|
543
|
-
})();
|
|
544
|
-
}
|
|
545
|
-
return reactIs_development;
|
|
546
|
-
}
|
|
547
|
-
var hasRequiredReactIs;
|
|
548
|
-
function requireReactIs() {
|
|
549
|
-
if (hasRequiredReactIs) return reactIs.exports;
|
|
550
|
-
hasRequiredReactIs = 1;
|
|
551
|
-
if (process.env.NODE_ENV === "production") {
|
|
552
|
-
reactIs.exports = requireReactIs_production_min();
|
|
553
|
-
} else {
|
|
554
|
-
reactIs.exports = requireReactIs_development();
|
|
555
|
-
}
|
|
556
|
-
return reactIs.exports;
|
|
557
|
-
}
|
|
558
|
-
/*
|
|
559
|
-
object-assign
|
|
560
|
-
(c) Sindre Sorhus
|
|
561
|
-
@license MIT
|
|
562
|
-
*/
|
|
563
|
-
var objectAssign;
|
|
564
|
-
var hasRequiredObjectAssign;
|
|
565
|
-
function requireObjectAssign() {
|
|
566
|
-
if (hasRequiredObjectAssign) return objectAssign;
|
|
567
|
-
hasRequiredObjectAssign = 1;
|
|
568
|
-
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
569
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
570
|
-
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
571
|
-
function toObject(val) {
|
|
572
|
-
if (val === null || val === void 0) {
|
|
573
|
-
throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
574
|
-
}
|
|
575
|
-
return Object(val);
|
|
576
|
-
}
|
|
577
|
-
function shouldUseNative() {
|
|
578
|
-
try {
|
|
579
|
-
if (!Object.assign) {
|
|
580
|
-
return false;
|
|
581
|
-
}
|
|
582
|
-
var test1 = new String("abc");
|
|
583
|
-
test1[5] = "de";
|
|
584
|
-
if (Object.getOwnPropertyNames(test1)[0] === "5") {
|
|
585
|
-
return false;
|
|
586
|
-
}
|
|
587
|
-
var test2 = {};
|
|
588
|
-
for (var i = 0; i < 10; i++) {
|
|
589
|
-
test2["_" + String.fromCharCode(i)] = i;
|
|
590
|
-
}
|
|
591
|
-
var order2 = Object.getOwnPropertyNames(test2).map(function(n) {
|
|
592
|
-
return test2[n];
|
|
593
|
-
});
|
|
594
|
-
if (order2.join("") !== "0123456789") {
|
|
595
|
-
return false;
|
|
596
|
-
}
|
|
597
|
-
var test3 = {};
|
|
598
|
-
"abcdefghijklmnopqrst".split("").forEach(function(letter) {
|
|
599
|
-
test3[letter] = letter;
|
|
600
|
-
});
|
|
601
|
-
if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
|
|
602
|
-
return false;
|
|
603
|
-
}
|
|
604
|
-
return true;
|
|
605
|
-
} catch (err) {
|
|
606
|
-
return false;
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
objectAssign = shouldUseNative() ? Object.assign : function(target, source) {
|
|
610
|
-
var from;
|
|
611
|
-
var to = toObject(target);
|
|
612
|
-
var symbols;
|
|
613
|
-
for (var s = 1; s < arguments.length; s++) {
|
|
614
|
-
from = Object(arguments[s]);
|
|
615
|
-
for (var key in from) {
|
|
616
|
-
if (hasOwnProperty.call(from, key)) {
|
|
617
|
-
to[key] = from[key];
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
if (getOwnPropertySymbols) {
|
|
621
|
-
symbols = getOwnPropertySymbols(from);
|
|
622
|
-
for (var i = 0; i < symbols.length; i++) {
|
|
623
|
-
if (propIsEnumerable.call(from, symbols[i])) {
|
|
624
|
-
to[symbols[i]] = from[symbols[i]];
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
return to;
|
|
630
|
-
};
|
|
631
|
-
return objectAssign;
|
|
632
|
-
}
|
|
633
|
-
var ReactPropTypesSecret_1;
|
|
634
|
-
var hasRequiredReactPropTypesSecret;
|
|
635
|
-
function requireReactPropTypesSecret() {
|
|
636
|
-
if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
|
|
637
|
-
hasRequiredReactPropTypesSecret = 1;
|
|
638
|
-
var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
|
|
639
|
-
ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
640
|
-
return ReactPropTypesSecret_1;
|
|
641
|
-
}
|
|
642
|
-
var has;
|
|
643
|
-
var hasRequiredHas;
|
|
644
|
-
function requireHas() {
|
|
645
|
-
if (hasRequiredHas) return has;
|
|
646
|
-
hasRequiredHas = 1;
|
|
647
|
-
has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
648
|
-
return has;
|
|
649
|
-
}
|
|
650
|
-
var checkPropTypes_1;
|
|
651
|
-
var hasRequiredCheckPropTypes;
|
|
652
|
-
function requireCheckPropTypes() {
|
|
653
|
-
if (hasRequiredCheckPropTypes) return checkPropTypes_1;
|
|
654
|
-
hasRequiredCheckPropTypes = 1;
|
|
655
|
-
var printWarning = function() {
|
|
656
|
-
};
|
|
657
|
-
if (process.env.NODE_ENV !== "production") {
|
|
658
|
-
var ReactPropTypesSecret = /* @__PURE__ */ requireReactPropTypesSecret();
|
|
659
|
-
var loggedTypeFailures = {};
|
|
660
|
-
var has2 = /* @__PURE__ */ requireHas();
|
|
661
|
-
printWarning = function(text) {
|
|
662
|
-
var message = "Warning: " + text;
|
|
663
|
-
if (typeof console !== "undefined") {
|
|
664
|
-
console.error(message);
|
|
665
|
-
}
|
|
666
|
-
try {
|
|
667
|
-
throw new Error(message);
|
|
668
|
-
} catch (x) {
|
|
669
|
-
}
|
|
670
|
-
};
|
|
671
|
-
}
|
|
672
|
-
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
673
|
-
if (process.env.NODE_ENV !== "production") {
|
|
674
|
-
for (var typeSpecName in typeSpecs) {
|
|
675
|
-
if (has2(typeSpecs, typeSpecName)) {
|
|
676
|
-
var error;
|
|
677
|
-
try {
|
|
678
|
-
if (typeof typeSpecs[typeSpecName] !== "function") {
|
|
679
|
-
var err = Error(
|
|
680
|
-
(componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
|
|
681
|
-
);
|
|
682
|
-
err.name = "Invariant Violation";
|
|
683
|
-
throw err;
|
|
684
|
-
}
|
|
685
|
-
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
686
|
-
} catch (ex) {
|
|
687
|
-
error = ex;
|
|
688
|
-
}
|
|
689
|
-
if (error && !(error instanceof Error)) {
|
|
690
|
-
printWarning(
|
|
691
|
-
(componentName || "React class") + ": type specification of " + location + " `" + typeSpecName + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof error + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
|
|
692
|
-
);
|
|
693
|
-
}
|
|
694
|
-
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
695
|
-
loggedTypeFailures[error.message] = true;
|
|
696
|
-
var stack = getStack ? getStack() : "";
|
|
697
|
-
printWarning(
|
|
698
|
-
"Failed " + location + " type: " + error.message + (stack != null ? stack : "")
|
|
699
|
-
);
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
checkPropTypes.resetWarningCache = function() {
|
|
706
|
-
if (process.env.NODE_ENV !== "production") {
|
|
707
|
-
loggedTypeFailures = {};
|
|
708
|
-
}
|
|
709
|
-
};
|
|
710
|
-
checkPropTypes_1 = checkPropTypes;
|
|
711
|
-
return checkPropTypes_1;
|
|
712
|
-
}
|
|
713
|
-
var factoryWithTypeCheckers;
|
|
714
|
-
var hasRequiredFactoryWithTypeCheckers;
|
|
715
|
-
function requireFactoryWithTypeCheckers() {
|
|
716
|
-
if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
|
|
717
|
-
hasRequiredFactoryWithTypeCheckers = 1;
|
|
718
|
-
var ReactIs = requireReactIs();
|
|
719
|
-
var assign = requireObjectAssign();
|
|
720
|
-
var ReactPropTypesSecret = /* @__PURE__ */ requireReactPropTypesSecret();
|
|
721
|
-
var has2 = /* @__PURE__ */ requireHas();
|
|
722
|
-
var checkPropTypes = /* @__PURE__ */ requireCheckPropTypes();
|
|
723
|
-
var printWarning = function() {
|
|
724
|
-
};
|
|
725
|
-
if (process.env.NODE_ENV !== "production") {
|
|
726
|
-
printWarning = function(text) {
|
|
727
|
-
var message = "Warning: " + text;
|
|
728
|
-
if (typeof console !== "undefined") {
|
|
729
|
-
console.error(message);
|
|
730
|
-
}
|
|
731
|
-
try {
|
|
732
|
-
throw new Error(message);
|
|
733
|
-
} catch (x) {
|
|
734
|
-
}
|
|
735
|
-
};
|
|
736
|
-
}
|
|
737
|
-
function emptyFunctionThatReturnsNull() {
|
|
738
|
-
return null;
|
|
739
|
-
}
|
|
740
|
-
factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
741
|
-
var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
|
|
742
|
-
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
743
|
-
function getIteratorFn(maybeIterable) {
|
|
744
|
-
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
745
|
-
if (typeof iteratorFn === "function") {
|
|
746
|
-
return iteratorFn;
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
var ANONYMOUS = "<<anonymous>>";
|
|
750
|
-
var ReactPropTypes = {
|
|
751
|
-
array: createPrimitiveTypeChecker("array"),
|
|
752
|
-
bigint: createPrimitiveTypeChecker("bigint"),
|
|
753
|
-
bool: createPrimitiveTypeChecker("boolean"),
|
|
754
|
-
func: createPrimitiveTypeChecker("function"),
|
|
755
|
-
number: createPrimitiveTypeChecker("number"),
|
|
756
|
-
object: createPrimitiveTypeChecker("object"),
|
|
757
|
-
string: createPrimitiveTypeChecker("string"),
|
|
758
|
-
symbol: createPrimitiveTypeChecker("symbol"),
|
|
759
|
-
any: createAnyTypeChecker(),
|
|
760
|
-
arrayOf: createArrayOfTypeChecker,
|
|
761
|
-
element: createElementTypeChecker(),
|
|
762
|
-
elementType: createElementTypeTypeChecker(),
|
|
763
|
-
instanceOf: createInstanceTypeChecker,
|
|
764
|
-
node: createNodeChecker(),
|
|
765
|
-
objectOf: createObjectOfTypeChecker,
|
|
766
|
-
oneOf: createEnumTypeChecker,
|
|
767
|
-
oneOfType: createUnionTypeChecker,
|
|
768
|
-
shape: createShapeTypeChecker,
|
|
769
|
-
exact: createStrictShapeTypeChecker
|
|
770
|
-
};
|
|
771
|
-
function is(x, y) {
|
|
772
|
-
if (x === y) {
|
|
773
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
774
|
-
} else {
|
|
775
|
-
return x !== x && y !== y;
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
function PropTypeError(message, data) {
|
|
779
|
-
this.message = message;
|
|
780
|
-
this.data = data && typeof data === "object" ? data : {};
|
|
781
|
-
this.stack = "";
|
|
782
|
-
}
|
|
783
|
-
PropTypeError.prototype = Error.prototype;
|
|
784
|
-
function createChainableTypeChecker(validate) {
|
|
785
|
-
if (process.env.NODE_ENV !== "production") {
|
|
786
|
-
var manualPropTypeCallCache = {};
|
|
787
|
-
var manualPropTypeWarningCount = 0;
|
|
788
|
-
}
|
|
789
|
-
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
790
|
-
componentName = componentName || ANONYMOUS;
|
|
791
|
-
propFullName = propFullName || propName;
|
|
792
|
-
if (secret !== ReactPropTypesSecret) {
|
|
793
|
-
if (throwOnDirectAccess) {
|
|
794
|
-
var err = new Error(
|
|
795
|
-
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
|
|
796
|
-
);
|
|
797
|
-
err.name = "Invariant Violation";
|
|
798
|
-
throw err;
|
|
799
|
-
} else if (process.env.NODE_ENV !== "production" && typeof console !== "undefined") {
|
|
800
|
-
var cacheKey = componentName + ":" + propName;
|
|
801
|
-
if (!manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors
|
|
802
|
-
manualPropTypeWarningCount < 3) {
|
|
803
|
-
printWarning(
|
|
804
|
-
"You are manually calling a React.PropTypes validation function for the `" + propFullName + "` prop on `" + componentName + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
|
|
805
|
-
);
|
|
806
|
-
manualPropTypeCallCache[cacheKey] = true;
|
|
807
|
-
manualPropTypeWarningCount++;
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
if (props[propName] == null) {
|
|
812
|
-
if (isRequired) {
|
|
813
|
-
if (props[propName] === null) {
|
|
814
|
-
return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required " + ("in `" + componentName + "`, but its value is `null`."));
|
|
815
|
-
}
|
|
816
|
-
return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required in " + ("`" + componentName + "`, but its value is `undefined`."));
|
|
817
|
-
}
|
|
818
|
-
return null;
|
|
819
|
-
} else {
|
|
820
|
-
return validate(props, propName, componentName, location, propFullName);
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
var chainedCheckType = checkType.bind(null, false);
|
|
824
|
-
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
825
|
-
return chainedCheckType;
|
|
826
|
-
}
|
|
827
|
-
function createPrimitiveTypeChecker(expectedType) {
|
|
828
|
-
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
829
|
-
var propValue = props[propName];
|
|
830
|
-
var propType = getPropType(propValue);
|
|
831
|
-
if (propType !== expectedType) {
|
|
832
|
-
var preciseType = getPreciseType(propValue);
|
|
833
|
-
return new PropTypeError(
|
|
834
|
-
"Invalid " + location + " `" + propFullName + "` of type " + ("`" + preciseType + "` supplied to `" + componentName + "`, expected ") + ("`" + expectedType + "`."),
|
|
835
|
-
{ expectedType }
|
|
836
|
-
);
|
|
837
|
-
}
|
|
838
|
-
return null;
|
|
839
|
-
}
|
|
840
|
-
return createChainableTypeChecker(validate);
|
|
841
|
-
}
|
|
842
|
-
function createAnyTypeChecker() {
|
|
843
|
-
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
844
|
-
}
|
|
845
|
-
function createArrayOfTypeChecker(typeChecker) {
|
|
846
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
847
|
-
if (typeof typeChecker !== "function") {
|
|
848
|
-
return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside arrayOf.");
|
|
849
|
-
}
|
|
850
|
-
var propValue = props[propName];
|
|
851
|
-
if (!Array.isArray(propValue)) {
|
|
852
|
-
var propType = getPropType(propValue);
|
|
853
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array."));
|
|
854
|
-
}
|
|
855
|
-
for (var i = 0; i < propValue.length; i++) {
|
|
856
|
-
var error = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret);
|
|
857
|
-
if (error instanceof Error) {
|
|
858
|
-
return error;
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
return null;
|
|
862
|
-
}
|
|
863
|
-
return createChainableTypeChecker(validate);
|
|
864
|
-
}
|
|
865
|
-
function createElementTypeChecker() {
|
|
866
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
867
|
-
var propValue = props[propName];
|
|
868
|
-
if (!isValidElement(propValue)) {
|
|
869
|
-
var propType = getPropType(propValue);
|
|
870
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement."));
|
|
871
|
-
}
|
|
872
|
-
return null;
|
|
873
|
-
}
|
|
874
|
-
return createChainableTypeChecker(validate);
|
|
875
|
-
}
|
|
876
|
-
function createElementTypeTypeChecker() {
|
|
877
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
878
|
-
var propValue = props[propName];
|
|
879
|
-
if (!ReactIs.isValidElementType(propValue)) {
|
|
880
|
-
var propType = getPropType(propValue);
|
|
881
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement type."));
|
|
882
|
-
}
|
|
883
|
-
return null;
|
|
884
|
-
}
|
|
885
|
-
return createChainableTypeChecker(validate);
|
|
886
|
-
}
|
|
887
|
-
function createInstanceTypeChecker(expectedClass) {
|
|
888
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
889
|
-
if (!(props[propName] instanceof expectedClass)) {
|
|
890
|
-
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
891
|
-
var actualClassName = getClassName(props[propName]);
|
|
892
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
|
|
893
|
-
}
|
|
894
|
-
return null;
|
|
895
|
-
}
|
|
896
|
-
return createChainableTypeChecker(validate);
|
|
897
|
-
}
|
|
898
|
-
function createEnumTypeChecker(expectedValues) {
|
|
899
|
-
if (!Array.isArray(expectedValues)) {
|
|
900
|
-
if (process.env.NODE_ENV !== "production") {
|
|
901
|
-
if (arguments.length > 1) {
|
|
902
|
-
printWarning(
|
|
903
|
-
"Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
|
|
904
|
-
);
|
|
905
|
-
} else {
|
|
906
|
-
printWarning("Invalid argument supplied to oneOf, expected an array.");
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
return emptyFunctionThatReturnsNull;
|
|
910
|
-
}
|
|
911
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
912
|
-
var propValue = props[propName];
|
|
913
|
-
for (var i = 0; i < expectedValues.length; i++) {
|
|
914
|
-
if (is(propValue, expectedValues[i])) {
|
|
915
|
-
return null;
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
919
|
-
var type = getPreciseType(value);
|
|
920
|
-
if (type === "symbol") {
|
|
921
|
-
return String(value);
|
|
922
|
-
}
|
|
923
|
-
return value;
|
|
924
|
-
});
|
|
925
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of value `" + String(propValue) + "` " + ("supplied to `" + componentName + "`, expected one of " + valuesString + "."));
|
|
926
|
-
}
|
|
927
|
-
return createChainableTypeChecker(validate);
|
|
928
|
-
}
|
|
929
|
-
function createObjectOfTypeChecker(typeChecker) {
|
|
930
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
931
|
-
if (typeof typeChecker !== "function") {
|
|
932
|
-
return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside objectOf.");
|
|
933
|
-
}
|
|
934
|
-
var propValue = props[propName];
|
|
935
|
-
var propType = getPropType(propValue);
|
|
936
|
-
if (propType !== "object") {
|
|
937
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an object."));
|
|
938
|
-
}
|
|
939
|
-
for (var key in propValue) {
|
|
940
|
-
if (has2(propValue, key)) {
|
|
941
|
-
var error = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
|
|
942
|
-
if (error instanceof Error) {
|
|
943
|
-
return error;
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
return null;
|
|
948
|
-
}
|
|
949
|
-
return createChainableTypeChecker(validate);
|
|
950
|
-
}
|
|
951
|
-
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
952
|
-
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
953
|
-
process.env.NODE_ENV !== "production" ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0;
|
|
954
|
-
return emptyFunctionThatReturnsNull;
|
|
955
|
-
}
|
|
956
|
-
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
957
|
-
var checker = arrayOfTypeCheckers[i];
|
|
958
|
-
if (typeof checker !== "function") {
|
|
959
|
-
printWarning(
|
|
960
|
-
"Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i + "."
|
|
961
|
-
);
|
|
962
|
-
return emptyFunctionThatReturnsNull;
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
966
|
-
var expectedTypes = [];
|
|
967
|
-
for (var i2 = 0; i2 < arrayOfTypeCheckers.length; i2++) {
|
|
968
|
-
var checker2 = arrayOfTypeCheckers[i2];
|
|
969
|
-
var checkerResult = checker2(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
|
|
970
|
-
if (checkerResult == null) {
|
|
971
|
-
return null;
|
|
972
|
-
}
|
|
973
|
-
if (checkerResult.data && has2(checkerResult.data, "expectedType")) {
|
|
974
|
-
expectedTypes.push(checkerResult.data.expectedType);
|
|
975
|
-
}
|
|
976
|
-
}
|
|
977
|
-
var expectedTypesMessage = expectedTypes.length > 0 ? ", expected one of type [" + expectedTypes.join(", ") + "]" : "";
|
|
978
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`" + expectedTypesMessage + "."));
|
|
979
|
-
}
|
|
980
|
-
return createChainableTypeChecker(validate);
|
|
981
|
-
}
|
|
982
|
-
function createNodeChecker() {
|
|
983
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
984
|
-
if (!isNode(props[propName])) {
|
|
985
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`, expected a ReactNode."));
|
|
986
|
-
}
|
|
987
|
-
return null;
|
|
988
|
-
}
|
|
989
|
-
return createChainableTypeChecker(validate);
|
|
990
|
-
}
|
|
991
|
-
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
992
|
-
return new PropTypeError(
|
|
993
|
-
(componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + type + "`."
|
|
994
|
-
);
|
|
995
|
-
}
|
|
996
|
-
function createShapeTypeChecker(shapeTypes) {
|
|
997
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
998
|
-
var propValue = props[propName];
|
|
999
|
-
var propType = getPropType(propValue);
|
|
1000
|
-
if (propType !== "object") {
|
|
1001
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
|
|
1002
|
-
}
|
|
1003
|
-
for (var key in shapeTypes) {
|
|
1004
|
-
var checker = shapeTypes[key];
|
|
1005
|
-
if (typeof checker !== "function") {
|
|
1006
|
-
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1007
|
-
}
|
|
1008
|
-
var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
|
|
1009
|
-
if (error) {
|
|
1010
|
-
return error;
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
return null;
|
|
1014
|
-
}
|
|
1015
|
-
return createChainableTypeChecker(validate);
|
|
1016
|
-
}
|
|
1017
|
-
function createStrictShapeTypeChecker(shapeTypes) {
|
|
1018
|
-
function validate(props, propName, componentName, location, propFullName) {
|
|
1019
|
-
var propValue = props[propName];
|
|
1020
|
-
var propType = getPropType(propValue);
|
|
1021
|
-
if (propType !== "object") {
|
|
1022
|
-
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
|
|
1023
|
-
}
|
|
1024
|
-
var allKeys = assign({}, props[propName], shapeTypes);
|
|
1025
|
-
for (var key in allKeys) {
|
|
1026
|
-
var checker = shapeTypes[key];
|
|
1027
|
-
if (has2(shapeTypes, key) && typeof checker !== "function") {
|
|
1028
|
-
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1029
|
-
}
|
|
1030
|
-
if (!checker) {
|
|
1031
|
-
return new PropTypeError(
|
|
1032
|
-
"Invalid " + location + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`.\nBad object: " + JSON.stringify(props[propName], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, " ")
|
|
1033
|
-
);
|
|
1034
|
-
}
|
|
1035
|
-
var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
|
|
1036
|
-
if (error) {
|
|
1037
|
-
return error;
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
return null;
|
|
1041
|
-
}
|
|
1042
|
-
return createChainableTypeChecker(validate);
|
|
1043
|
-
}
|
|
1044
|
-
function isNode(propValue) {
|
|
1045
|
-
switch (typeof propValue) {
|
|
1046
|
-
case "number":
|
|
1047
|
-
case "string":
|
|
1048
|
-
case "undefined":
|
|
1049
|
-
return true;
|
|
1050
|
-
case "boolean":
|
|
1051
|
-
return !propValue;
|
|
1052
|
-
case "object":
|
|
1053
|
-
if (Array.isArray(propValue)) {
|
|
1054
|
-
return propValue.every(isNode);
|
|
1055
|
-
}
|
|
1056
|
-
if (propValue === null || isValidElement(propValue)) {
|
|
1057
|
-
return true;
|
|
1058
|
-
}
|
|
1059
|
-
var iteratorFn = getIteratorFn(propValue);
|
|
1060
|
-
if (iteratorFn) {
|
|
1061
|
-
var iterator = iteratorFn.call(propValue);
|
|
1062
|
-
var step;
|
|
1063
|
-
if (iteratorFn !== propValue.entries) {
|
|
1064
|
-
while (!(step = iterator.next()).done) {
|
|
1065
|
-
if (!isNode(step.value)) {
|
|
1066
|
-
return false;
|
|
1067
|
-
}
|
|
1068
|
-
}
|
|
1069
|
-
} else {
|
|
1070
|
-
while (!(step = iterator.next()).done) {
|
|
1071
|
-
var entry = step.value;
|
|
1072
|
-
if (entry) {
|
|
1073
|
-
if (!isNode(entry[1])) {
|
|
1074
|
-
return false;
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
} else {
|
|
1080
|
-
return false;
|
|
1081
|
-
}
|
|
1082
|
-
return true;
|
|
1083
|
-
default:
|
|
1084
|
-
return false;
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
function isSymbol(propType, propValue) {
|
|
1088
|
-
if (propType === "symbol") {
|
|
1089
|
-
return true;
|
|
1090
|
-
}
|
|
1091
|
-
if (!propValue) {
|
|
1092
|
-
return false;
|
|
1093
|
-
}
|
|
1094
|
-
if (propValue["@@toStringTag"] === "Symbol") {
|
|
1095
|
-
return true;
|
|
1096
|
-
}
|
|
1097
|
-
if (typeof Symbol === "function" && propValue instanceof Symbol) {
|
|
1098
|
-
return true;
|
|
1099
|
-
}
|
|
1100
|
-
return false;
|
|
1101
|
-
}
|
|
1102
|
-
function getPropType(propValue) {
|
|
1103
|
-
var propType = typeof propValue;
|
|
1104
|
-
if (Array.isArray(propValue)) {
|
|
1105
|
-
return "array";
|
|
1106
|
-
}
|
|
1107
|
-
if (propValue instanceof RegExp) {
|
|
1108
|
-
return "object";
|
|
1109
|
-
}
|
|
1110
|
-
if (isSymbol(propType, propValue)) {
|
|
1111
|
-
return "symbol";
|
|
1112
|
-
}
|
|
1113
|
-
return propType;
|
|
1114
|
-
}
|
|
1115
|
-
function getPreciseType(propValue) {
|
|
1116
|
-
if (typeof propValue === "undefined" || propValue === null) {
|
|
1117
|
-
return "" + propValue;
|
|
1118
|
-
}
|
|
1119
|
-
var propType = getPropType(propValue);
|
|
1120
|
-
if (propType === "object") {
|
|
1121
|
-
if (propValue instanceof Date) {
|
|
1122
|
-
return "date";
|
|
1123
|
-
} else if (propValue instanceof RegExp) {
|
|
1124
|
-
return "regexp";
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
return propType;
|
|
1128
|
-
}
|
|
1129
|
-
function getPostfixForTypeWarning(value) {
|
|
1130
|
-
var type = getPreciseType(value);
|
|
1131
|
-
switch (type) {
|
|
1132
|
-
case "array":
|
|
1133
|
-
case "object":
|
|
1134
|
-
return "an " + type;
|
|
1135
|
-
case "boolean":
|
|
1136
|
-
case "date":
|
|
1137
|
-
case "regexp":
|
|
1138
|
-
return "a " + type;
|
|
1139
|
-
default:
|
|
1140
|
-
return type;
|
|
1141
|
-
}
|
|
1142
|
-
}
|
|
1143
|
-
function getClassName(propValue) {
|
|
1144
|
-
if (!propValue.constructor || !propValue.constructor.name) {
|
|
1145
|
-
return ANONYMOUS;
|
|
1146
|
-
}
|
|
1147
|
-
return propValue.constructor.name;
|
|
1148
|
-
}
|
|
1149
|
-
ReactPropTypes.checkPropTypes = checkPropTypes;
|
|
1150
|
-
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
|
1151
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1152
|
-
return ReactPropTypes;
|
|
1153
|
-
};
|
|
1154
|
-
return factoryWithTypeCheckers;
|
|
1155
|
-
}
|
|
1156
|
-
var factoryWithThrowingShims;
|
|
1157
|
-
var hasRequiredFactoryWithThrowingShims;
|
|
1158
|
-
function requireFactoryWithThrowingShims() {
|
|
1159
|
-
if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
|
|
1160
|
-
hasRequiredFactoryWithThrowingShims = 1;
|
|
1161
|
-
var ReactPropTypesSecret = /* @__PURE__ */ requireReactPropTypesSecret();
|
|
1162
|
-
function emptyFunction() {
|
|
1163
|
-
}
|
|
1164
|
-
function emptyFunctionWithReset() {
|
|
1165
|
-
}
|
|
1166
|
-
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
1167
|
-
factoryWithThrowingShims = function() {
|
|
1168
|
-
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
1169
|
-
if (secret === ReactPropTypesSecret) {
|
|
1170
|
-
return;
|
|
1171
|
-
}
|
|
1172
|
-
var err = new Error(
|
|
1173
|
-
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
|
|
1174
|
-
);
|
|
1175
|
-
err.name = "Invariant Violation";
|
|
1176
|
-
throw err;
|
|
1177
|
-
}
|
|
1178
|
-
shim.isRequired = shim;
|
|
1179
|
-
function getShim() {
|
|
1180
|
-
return shim;
|
|
1181
|
-
}
|
|
1182
|
-
var ReactPropTypes = {
|
|
1183
|
-
array: shim,
|
|
1184
|
-
bigint: shim,
|
|
1185
|
-
bool: shim,
|
|
1186
|
-
func: shim,
|
|
1187
|
-
number: shim,
|
|
1188
|
-
object: shim,
|
|
1189
|
-
string: shim,
|
|
1190
|
-
symbol: shim,
|
|
1191
|
-
any: shim,
|
|
1192
|
-
arrayOf: getShim,
|
|
1193
|
-
element: shim,
|
|
1194
|
-
elementType: shim,
|
|
1195
|
-
instanceOf: getShim,
|
|
1196
|
-
node: shim,
|
|
1197
|
-
objectOf: getShim,
|
|
1198
|
-
oneOf: getShim,
|
|
1199
|
-
oneOfType: getShim,
|
|
1200
|
-
shape: getShim,
|
|
1201
|
-
exact: getShim,
|
|
1202
|
-
checkPropTypes: emptyFunctionWithReset,
|
|
1203
|
-
resetWarningCache: emptyFunction
|
|
1204
|
-
};
|
|
1205
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1206
|
-
return ReactPropTypes;
|
|
1207
|
-
};
|
|
1208
|
-
return factoryWithThrowingShims;
|
|
1209
|
-
}
|
|
1210
|
-
var hasRequiredPropTypes;
|
|
1211
|
-
function requirePropTypes() {
|
|
1212
|
-
if (hasRequiredPropTypes) return propTypes$1.exports;
|
|
1213
|
-
hasRequiredPropTypes = 1;
|
|
1214
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1215
|
-
var ReactIs = requireReactIs();
|
|
1216
|
-
var throwOnDirectAccess = true;
|
|
1217
|
-
propTypes$1.exports = /* @__PURE__ */ requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
|
|
1218
|
-
} else {
|
|
1219
|
-
propTypes$1.exports = /* @__PURE__ */ requireFactoryWithThrowingShims()();
|
|
1220
|
-
}
|
|
1221
|
-
return propTypes$1.exports;
|
|
1222
|
-
}
|
|
1223
|
-
var propTypesExports = /* @__PURE__ */ requirePropTypes();
|
|
1224
|
-
const PropTypes = /* @__PURE__ */ getDefaultExportFromCjs(propTypesExports);
|
|
1225
|
-
var FOCUS_GROUP$1 = "data-focus-lock";
|
|
1226
|
-
var FOCUS_DISABLED$1 = "data-focus-lock-disabled";
|
|
1227
|
-
var FOCUS_ALLOW$1 = "data-no-focus-lock";
|
|
1228
|
-
var FOCUS_AUTO$1 = "data-autofocus-inside";
|
|
1229
|
-
var FOCUS_NO_AUTOFOCUS$1 = "data-no-autofocus";
|
|
1230
|
-
function assignRef(ref, value) {
|
|
1231
|
-
if (typeof ref === "function") {
|
|
1232
|
-
ref(value);
|
|
1233
|
-
} else if (ref) {
|
|
1234
|
-
ref.current = value;
|
|
1235
|
-
}
|
|
1236
|
-
return ref;
|
|
1237
|
-
}
|
|
1238
|
-
function useCallbackRef(initialValue, callback) {
|
|
1239
|
-
var ref = React.useState(function() {
|
|
1240
|
-
return {
|
|
1241
|
-
// value
|
|
1242
|
-
value: initialValue,
|
|
1243
|
-
// last callback
|
|
1244
|
-
callback,
|
|
1245
|
-
// "memoized" public interface
|
|
1246
|
-
facade: {
|
|
1247
|
-
get current() {
|
|
1248
|
-
return ref.value;
|
|
1249
|
-
},
|
|
1250
|
-
set current(value) {
|
|
1251
|
-
var last = ref.value;
|
|
1252
|
-
if (last !== value) {
|
|
1253
|
-
ref.value = value;
|
|
1254
|
-
ref.callback(value, last);
|
|
1255
|
-
}
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1258
|
-
};
|
|
1259
|
-
})[0];
|
|
1260
|
-
ref.callback = callback;
|
|
1261
|
-
return ref.facade;
|
|
1262
|
-
}
|
|
1263
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
1264
|
-
var currentValues = /* @__PURE__ */ new WeakMap();
|
|
1265
|
-
function useMergeRefs(refs, defaultValue) {
|
|
1266
|
-
var callbackRef = useCallbackRef(null, function(newValue) {
|
|
1267
|
-
return refs.forEach(function(ref) {
|
|
1268
|
-
return assignRef(ref, newValue);
|
|
1269
|
-
});
|
|
1270
|
-
});
|
|
1271
|
-
useIsomorphicLayoutEffect(function() {
|
|
1272
|
-
var oldValue = currentValues.get(callbackRef);
|
|
1273
|
-
if (oldValue) {
|
|
1274
|
-
var prevRefs_1 = new Set(oldValue);
|
|
1275
|
-
var nextRefs_1 = new Set(refs);
|
|
1276
|
-
var current_1 = callbackRef.current;
|
|
1277
|
-
prevRefs_1.forEach(function(ref) {
|
|
1278
|
-
if (!nextRefs_1.has(ref)) {
|
|
1279
|
-
assignRef(ref, null);
|
|
1280
|
-
}
|
|
1281
|
-
});
|
|
1282
|
-
nextRefs_1.forEach(function(ref) {
|
|
1283
|
-
if (!prevRefs_1.has(ref)) {
|
|
1284
|
-
assignRef(ref, current_1);
|
|
1285
|
-
}
|
|
1286
|
-
});
|
|
1287
|
-
}
|
|
1288
|
-
currentValues.set(callbackRef, refs);
|
|
1289
|
-
}, [refs]);
|
|
1290
|
-
return callbackRef;
|
|
1291
|
-
}
|
|
1292
|
-
var hiddenGuard = {
|
|
1293
|
-
width: "1px",
|
|
1294
|
-
height: "0px",
|
|
1295
|
-
padding: 0,
|
|
1296
|
-
overflow: "hidden",
|
|
1297
|
-
position: "fixed",
|
|
1298
|
-
top: "1px",
|
|
1299
|
-
left: "1px"
|
|
1300
|
-
};
|
|
1301
|
-
process.env.NODE_ENV !== "production" ? {
|
|
1302
|
-
children: PropTypes.node
|
|
1303
|
-
} : {};
|
|
1304
|
-
var __assign = function() {
|
|
1305
|
-
__assign = Object.assign || function __assign2(t) {
|
|
1306
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1307
|
-
s = arguments[i];
|
|
1308
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
1309
|
-
}
|
|
1310
|
-
return t;
|
|
1311
|
-
};
|
|
1312
|
-
return __assign.apply(this, arguments);
|
|
1313
|
-
};
|
|
1314
|
-
function __rest(s, e) {
|
|
1315
|
-
var t = {};
|
|
1316
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1317
|
-
t[p] = s[p];
|
|
1318
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1319
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1320
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1321
|
-
t[p[i]] = s[p[i]];
|
|
1322
|
-
}
|
|
1323
|
-
return t;
|
|
1324
|
-
}
|
|
1325
|
-
function __spreadArray(to, from, pack) {
|
|
1326
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
1327
|
-
if (ar || !(i in from)) {
|
|
1328
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
1329
|
-
ar[i] = from[i];
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
1333
|
-
}
|
|
1334
|
-
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
1335
|
-
var e = new Error(message);
|
|
1336
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
1337
|
-
};
|
|
1338
|
-
function ItoI(a) {
|
|
1339
|
-
return a;
|
|
1340
|
-
}
|
|
1341
|
-
function innerCreateMedium(defaults, middleware) {
|
|
1342
|
-
if (middleware === void 0) {
|
|
1343
|
-
middleware = ItoI;
|
|
1344
|
-
}
|
|
1345
|
-
var buffer = [];
|
|
1346
|
-
var assigned = false;
|
|
1347
|
-
var medium = {
|
|
1348
|
-
read: function() {
|
|
1349
|
-
if (assigned) {
|
|
1350
|
-
throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
|
|
1351
|
-
}
|
|
1352
|
-
if (buffer.length) {
|
|
1353
|
-
return buffer[buffer.length - 1];
|
|
1354
|
-
}
|
|
1355
|
-
return defaults;
|
|
1356
|
-
},
|
|
1357
|
-
useMedium: function(data) {
|
|
1358
|
-
var item = middleware(data, assigned);
|
|
1359
|
-
buffer.push(item);
|
|
1360
|
-
return function() {
|
|
1361
|
-
buffer = buffer.filter(function(x) {
|
|
1362
|
-
return x !== item;
|
|
1363
|
-
});
|
|
1364
|
-
};
|
|
1365
|
-
},
|
|
1366
|
-
assignSyncMedium: function(cb) {
|
|
1367
|
-
assigned = true;
|
|
1368
|
-
while (buffer.length) {
|
|
1369
|
-
var cbs = buffer;
|
|
1370
|
-
buffer = [];
|
|
1371
|
-
cbs.forEach(cb);
|
|
1372
|
-
}
|
|
1373
|
-
buffer = {
|
|
1374
|
-
push: function(x) {
|
|
1375
|
-
return cb(x);
|
|
1376
|
-
},
|
|
1377
|
-
filter: function() {
|
|
1378
|
-
return buffer;
|
|
1379
|
-
}
|
|
1380
|
-
};
|
|
1381
|
-
},
|
|
1382
|
-
assignMedium: function(cb) {
|
|
1383
|
-
assigned = true;
|
|
1384
|
-
var pendingQueue = [];
|
|
1385
|
-
if (buffer.length) {
|
|
1386
|
-
var cbs = buffer;
|
|
1387
|
-
buffer = [];
|
|
1388
|
-
cbs.forEach(cb);
|
|
1389
|
-
pendingQueue = buffer;
|
|
1390
|
-
}
|
|
1391
|
-
var executeQueue = function() {
|
|
1392
|
-
var cbs2 = pendingQueue;
|
|
1393
|
-
pendingQueue = [];
|
|
1394
|
-
cbs2.forEach(cb);
|
|
1395
|
-
};
|
|
1396
|
-
var cycle = function() {
|
|
1397
|
-
return Promise.resolve().then(executeQueue);
|
|
1398
|
-
};
|
|
1399
|
-
cycle();
|
|
1400
|
-
buffer = {
|
|
1401
|
-
push: function(x) {
|
|
1402
|
-
pendingQueue.push(x);
|
|
1403
|
-
cycle();
|
|
1404
|
-
},
|
|
1405
|
-
filter: function(filter) {
|
|
1406
|
-
pendingQueue = pendingQueue.filter(filter);
|
|
1407
|
-
return buffer;
|
|
1408
|
-
}
|
|
1409
|
-
};
|
|
1410
|
-
}
|
|
1411
|
-
};
|
|
1412
|
-
return medium;
|
|
1413
|
-
}
|
|
1414
|
-
function createMedium(defaults, middleware) {
|
|
1415
|
-
if (middleware === void 0) {
|
|
1416
|
-
middleware = ItoI;
|
|
1417
|
-
}
|
|
1418
|
-
return innerCreateMedium(defaults, middleware);
|
|
1419
|
-
}
|
|
1420
|
-
function createSidecarMedium(options) {
|
|
1421
|
-
if (options === void 0) {
|
|
1422
|
-
options = {};
|
|
1423
|
-
}
|
|
1424
|
-
var medium = innerCreateMedium(null);
|
|
1425
|
-
medium.options = __assign({ async: true, ssr: false }, options);
|
|
1426
|
-
return medium;
|
|
1427
|
-
}
|
|
1428
|
-
var SideCar$1 = function(_a) {
|
|
1429
|
-
var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
|
|
1430
|
-
if (!sideCar) {
|
|
1431
|
-
throw new Error("Sidecar: please provide `sideCar` property to import the right car");
|
|
1432
|
-
}
|
|
1433
|
-
var Target = sideCar.read();
|
|
1434
|
-
if (!Target) {
|
|
1435
|
-
throw new Error("Sidecar medium not found");
|
|
1436
|
-
}
|
|
1437
|
-
return React__namespace.createElement(Target, __assign({}, rest));
|
|
1438
|
-
};
|
|
1439
|
-
SideCar$1.isSideCarExport = true;
|
|
1440
|
-
function exportSidecar(medium, exported) {
|
|
1441
|
-
medium.useMedium(exported);
|
|
1442
|
-
return SideCar$1;
|
|
1443
|
-
}
|
|
1444
|
-
var mediumFocus$1 = createMedium({}, function(_ref2) {
|
|
1445
|
-
var target = _ref2.target, currentTarget = _ref2.currentTarget;
|
|
1446
|
-
return {
|
|
1447
|
-
target,
|
|
1448
|
-
currentTarget
|
|
1449
|
-
};
|
|
1450
|
-
});
|
|
1451
|
-
var mediumBlur$1 = createMedium();
|
|
1452
|
-
var mediumEffect$1 = createMedium();
|
|
1453
|
-
var mediumSidecar$1 = createSidecarMedium({
|
|
1454
|
-
async: true,
|
|
1455
|
-
ssr: typeof document !== "undefined"
|
|
1456
|
-
});
|
|
1457
|
-
var focusScope = /* @__PURE__ */ React.createContext(void 0);
|
|
1458
|
-
var emptyArray = [];
|
|
1459
|
-
var FocusLock = /* @__PURE__ */ React.forwardRef(function FocusLockUI(props, parentRef) {
|
|
1460
|
-
var _extends2;
|
|
1461
|
-
var _useState = React.useState(), realObserved = _useState[0], setObserved = _useState[1];
|
|
1462
|
-
var observed = React.useRef();
|
|
1463
|
-
var isActive = React.useRef(false);
|
|
1464
|
-
var originalFocusedElement = React.useRef(null);
|
|
1465
|
-
var _useState2 = React.useState({}), update = _useState2[1];
|
|
1466
|
-
var children = props.children, _props$disabled = props.disabled, disabled = _props$disabled === void 0 ? false : _props$disabled, _props$noFocusGuards = props.noFocusGuards, noFocusGuards = _props$noFocusGuards === void 0 ? false : _props$noFocusGuards, _props$persistentFocu = props.persistentFocus, persistentFocus = _props$persistentFocu === void 0 ? false : _props$persistentFocu, _props$crossFrame = props.crossFrame, crossFrame = _props$crossFrame === void 0 ? true : _props$crossFrame, _props$autoFocus = props.autoFocus, autoFocus = _props$autoFocus === void 0 ? true : _props$autoFocus, allowTextSelection = props.allowTextSelection, group = props.group, className = props.className, whiteList = props.whiteList, hasPositiveIndices = props.hasPositiveIndices, _props$shards = props.shards, shards = _props$shards === void 0 ? emptyArray : _props$shards, _props$as = props.as, Container = _props$as === void 0 ? "div" : _props$as, _props$lockProps = props.lockProps, containerProps = _props$lockProps === void 0 ? {} : _props$lockProps, SideCar2 = props.sideCar, _props$returnFocus = props.returnFocus, shouldReturnFocus = _props$returnFocus === void 0 ? false : _props$returnFocus, focusOptions = props.focusOptions, onActivationCallback = props.onActivation, onDeactivationCallback = props.onDeactivation;
|
|
1467
|
-
var _useState3 = React.useState({}), id = _useState3[0];
|
|
1468
|
-
var onActivation = React.useCallback(function(_ref2) {
|
|
1469
|
-
var captureFocusRestore2 = _ref2.captureFocusRestore;
|
|
1470
|
-
if (!originalFocusedElement.current) {
|
|
1471
|
-
var _document;
|
|
1472
|
-
var activeElement = (_document = document) == null ? void 0 : _document.activeElement;
|
|
1473
|
-
originalFocusedElement.current = activeElement;
|
|
1474
|
-
if (activeElement !== document.body) {
|
|
1475
|
-
originalFocusedElement.current = captureFocusRestore2(activeElement);
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
if (observed.current && onActivationCallback) {
|
|
1479
|
-
onActivationCallback(observed.current);
|
|
1480
|
-
}
|
|
1481
|
-
isActive.current = true;
|
|
1482
|
-
update();
|
|
1483
|
-
}, [onActivationCallback]);
|
|
1484
|
-
var onDeactivation = React.useCallback(function() {
|
|
1485
|
-
isActive.current = false;
|
|
1486
|
-
if (onDeactivationCallback) {
|
|
1487
|
-
onDeactivationCallback(observed.current);
|
|
1488
|
-
}
|
|
1489
|
-
update();
|
|
1490
|
-
}, [onDeactivationCallback]);
|
|
1491
|
-
var returnFocus = React.useCallback(function(allowDefer) {
|
|
1492
|
-
var focusRestore = originalFocusedElement.current;
|
|
1493
|
-
if (focusRestore) {
|
|
1494
|
-
var returnFocusTo = (typeof focusRestore === "function" ? focusRestore() : focusRestore) || document.body;
|
|
1495
|
-
var howToReturnFocus = typeof shouldReturnFocus === "function" ? shouldReturnFocus(returnFocusTo) : shouldReturnFocus;
|
|
1496
|
-
if (howToReturnFocus) {
|
|
1497
|
-
var returnFocusOptions = typeof howToReturnFocus === "object" ? howToReturnFocus : void 0;
|
|
1498
|
-
originalFocusedElement.current = null;
|
|
1499
|
-
if (allowDefer) {
|
|
1500
|
-
Promise.resolve().then(function() {
|
|
1501
|
-
return returnFocusTo.focus(returnFocusOptions);
|
|
1502
|
-
});
|
|
1503
|
-
} else {
|
|
1504
|
-
returnFocusTo.focus(returnFocusOptions);
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
}
|
|
1508
|
-
}, [shouldReturnFocus]);
|
|
1509
|
-
var onFocus3 = React.useCallback(function(event) {
|
|
1510
|
-
if (isActive.current) {
|
|
1511
|
-
mediumFocus$1.useMedium(event);
|
|
1512
|
-
}
|
|
1513
|
-
}, []);
|
|
1514
|
-
var onBlur3 = mediumBlur$1.useMedium;
|
|
1515
|
-
var setObserveNode = React.useCallback(function(newObserved) {
|
|
1516
|
-
if (observed.current !== newObserved) {
|
|
1517
|
-
observed.current = newObserved;
|
|
1518
|
-
setObserved(newObserved);
|
|
1519
|
-
}
|
|
1520
|
-
}, []);
|
|
1521
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1522
|
-
if (typeof allowTextSelection !== "undefined") {
|
|
1523
|
-
console.warn("React-Focus-Lock: allowTextSelection is deprecated and enabled by default");
|
|
1524
|
-
}
|
|
1525
|
-
React.useEffect(function() {
|
|
1526
|
-
if (!observed.current && typeof Container !== "string") {
|
|
1527
|
-
console.error("FocusLock: could not obtain ref to internal node");
|
|
1528
|
-
}
|
|
1529
|
-
}, []);
|
|
1530
|
-
}
|
|
1531
|
-
var lockProps = _extends$1((_extends2 = {}, _extends2[FOCUS_DISABLED$1] = disabled && "disabled", _extends2[FOCUS_GROUP$1] = group, _extends2), containerProps);
|
|
1532
|
-
var hasLeadingGuards = noFocusGuards !== true;
|
|
1533
|
-
var hasTailingGuards = hasLeadingGuards && noFocusGuards !== "tail";
|
|
1534
|
-
var mergedRef = useMergeRefs([parentRef, setObserveNode]);
|
|
1535
|
-
var focusScopeValue = React.useMemo(function() {
|
|
1536
|
-
return {
|
|
1537
|
-
observed,
|
|
1538
|
-
shards,
|
|
1539
|
-
enabled: !disabled,
|
|
1540
|
-
active: isActive.current
|
|
1541
|
-
};
|
|
1542
|
-
}, [disabled, isActive.current, shards, realObserved]);
|
|
1543
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, hasLeadingGuards && [
|
|
1544
|
-
/* @__PURE__ */ React.createElement("div", {
|
|
1545
|
-
key: "guard-first",
|
|
1546
|
-
"data-focus-guard": true,
|
|
1547
|
-
tabIndex: disabled ? -1 : 0,
|
|
1548
|
-
style: hiddenGuard
|
|
1549
|
-
}),
|
|
1550
|
-
hasPositiveIndices ? /* @__PURE__ */ React.createElement("div", {
|
|
1551
|
-
key: "guard-nearest",
|
|
1552
|
-
"data-focus-guard": true,
|
|
1553
|
-
tabIndex: disabled ? -1 : 1,
|
|
1554
|
-
style: hiddenGuard
|
|
1555
|
-
}) : null
|
|
1556
|
-
], !disabled && /* @__PURE__ */ React.createElement(SideCar2, {
|
|
1557
|
-
id,
|
|
1558
|
-
sideCar: mediumSidecar$1,
|
|
1559
|
-
observed: realObserved,
|
|
1560
|
-
disabled,
|
|
1561
|
-
persistentFocus,
|
|
1562
|
-
crossFrame,
|
|
1563
|
-
autoFocus,
|
|
1564
|
-
whiteList,
|
|
1565
|
-
shards,
|
|
1566
|
-
onActivation,
|
|
1567
|
-
onDeactivation,
|
|
1568
|
-
returnFocus,
|
|
1569
|
-
focusOptions,
|
|
1570
|
-
noFocusGuards
|
|
1571
|
-
}), /* @__PURE__ */ React.createElement(Container, _extends$1({
|
|
1572
|
-
ref: mergedRef
|
|
1573
|
-
}, lockProps, {
|
|
1574
|
-
className,
|
|
1575
|
-
onBlur: onBlur3,
|
|
1576
|
-
onFocus: onFocus3
|
|
1577
|
-
}), /* @__PURE__ */ React.createElement(focusScope.Provider, {
|
|
1578
|
-
value: focusScopeValue
|
|
1579
|
-
}, children)), hasTailingGuards && /* @__PURE__ */ React.createElement("div", {
|
|
1580
|
-
"data-focus-guard": true,
|
|
1581
|
-
tabIndex: disabled ? -1 : 0,
|
|
1582
|
-
style: hiddenGuard
|
|
1583
|
-
}));
|
|
1584
|
-
});
|
|
1585
|
-
FocusLock.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
1586
|
-
children: propTypesExports.node,
|
|
1587
|
-
disabled: propTypesExports.bool,
|
|
1588
|
-
returnFocus: propTypesExports.oneOfType([propTypesExports.bool, propTypesExports.object, propTypesExports.func]),
|
|
1589
|
-
focusOptions: propTypesExports.object,
|
|
1590
|
-
noFocusGuards: propTypesExports.bool,
|
|
1591
|
-
hasPositiveIndices: propTypesExports.bool,
|
|
1592
|
-
allowTextSelection: propTypesExports.bool,
|
|
1593
|
-
autoFocus: propTypesExports.bool,
|
|
1594
|
-
persistentFocus: propTypesExports.bool,
|
|
1595
|
-
crossFrame: propTypesExports.bool,
|
|
1596
|
-
group: propTypesExports.string,
|
|
1597
|
-
className: propTypesExports.string,
|
|
1598
|
-
whiteList: propTypesExports.func,
|
|
1599
|
-
shards: propTypesExports.arrayOf(propTypesExports.any),
|
|
1600
|
-
as: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.func, propTypesExports.object]),
|
|
1601
|
-
lockProps: propTypesExports.object,
|
|
1602
|
-
onActivation: propTypesExports.func,
|
|
1603
|
-
onDeactivation: propTypesExports.func,
|
|
1604
|
-
sideCar: propTypesExports.any.isRequired
|
|
1605
|
-
} : {};
|
|
1606
|
-
function _setPrototypeOf(t, e) {
|
|
1607
|
-
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t2, e2) {
|
|
1608
|
-
return t2.__proto__ = e2, t2;
|
|
1609
|
-
}, _setPrototypeOf(t, e);
|
|
1610
|
-
}
|
|
1611
|
-
function _inheritsLoose(t, o) {
|
|
1612
|
-
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
1613
|
-
}
|
|
1614
|
-
function _typeof(o) {
|
|
1615
|
-
"@babel/helpers - typeof";
|
|
1616
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
|
|
1617
|
-
return typeof o2;
|
|
1618
|
-
} : function(o2) {
|
|
1619
|
-
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
|
|
1620
|
-
}, _typeof(o);
|
|
1621
|
-
}
|
|
1622
|
-
function toPrimitive(t, r) {
|
|
1623
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
1624
|
-
var e = t[Symbol.toPrimitive];
|
|
1625
|
-
if (void 0 !== e) {
|
|
1626
|
-
var i = e.call(t, r);
|
|
1627
|
-
if ("object" != _typeof(i)) return i;
|
|
1628
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1629
|
-
}
|
|
1630
|
-
return ("string" === r ? String : Number)(t);
|
|
1631
|
-
}
|
|
1632
|
-
function toPropertyKey(t) {
|
|
1633
|
-
var i = toPrimitive(t, "string");
|
|
1634
|
-
return "symbol" == _typeof(i) ? i : i + "";
|
|
1635
|
-
}
|
|
1636
|
-
function _defineProperty(e, r, t) {
|
|
1637
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
1638
|
-
value: t,
|
|
1639
|
-
enumerable: true,
|
|
1640
|
-
configurable: true,
|
|
1641
|
-
writable: true
|
|
1642
|
-
}) : e[r] = t, e;
|
|
1643
|
-
}
|
|
1644
|
-
function withSideEffect(reducePropsToState2, handleStateChangeOnClient2) {
|
|
1645
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1646
|
-
if (typeof reducePropsToState2 !== "function") {
|
|
1647
|
-
throw new Error("Expected reducePropsToState to be a function.");
|
|
1648
|
-
}
|
|
1649
|
-
if (typeof handleStateChangeOnClient2 !== "function") {
|
|
1650
|
-
throw new Error("Expected handleStateChangeOnClient to be a function.");
|
|
1651
|
-
}
|
|
1652
|
-
}
|
|
1653
|
-
function getDisplayName(WrappedComponent) {
|
|
1654
|
-
return WrappedComponent.displayName || WrappedComponent.name || "Component";
|
|
1655
|
-
}
|
|
1656
|
-
return function wrap(WrappedComponent) {
|
|
1657
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1658
|
-
if (typeof WrappedComponent !== "function") {
|
|
1659
|
-
throw new Error("Expected WrappedComponent to be a React component.");
|
|
1660
|
-
}
|
|
1661
|
-
}
|
|
1662
|
-
var mountedInstances = [];
|
|
1663
|
-
var state;
|
|
1664
|
-
function emitChange() {
|
|
1665
|
-
state = reducePropsToState2(mountedInstances.map(function(instance) {
|
|
1666
|
-
return instance.props;
|
|
1667
|
-
}));
|
|
1668
|
-
handleStateChangeOnClient2(state);
|
|
1669
|
-
}
|
|
1670
|
-
var SideEffect = /* @__PURE__ */ function(_PureComponent) {
|
|
1671
|
-
_inheritsLoose(SideEffect2, _PureComponent);
|
|
1672
|
-
function SideEffect2() {
|
|
1673
|
-
return _PureComponent.apply(this, arguments) || this;
|
|
1674
|
-
}
|
|
1675
|
-
SideEffect2.peek = function peek() {
|
|
1676
|
-
return state;
|
|
1677
|
-
};
|
|
1678
|
-
var _proto = SideEffect2.prototype;
|
|
1679
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
1680
|
-
mountedInstances.push(this);
|
|
1681
|
-
emitChange();
|
|
1682
|
-
};
|
|
1683
|
-
_proto.componentDidUpdate = function componentDidUpdate() {
|
|
1684
|
-
emitChange();
|
|
1685
|
-
};
|
|
1686
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
1687
|
-
var index = mountedInstances.indexOf(this);
|
|
1688
|
-
mountedInstances.splice(index, 1);
|
|
1689
|
-
emitChange();
|
|
1690
|
-
};
|
|
1691
|
-
_proto.render = function render() {
|
|
1692
|
-
return /* @__PURE__ */ React.createElement(WrappedComponent, this.props);
|
|
1693
|
-
};
|
|
1694
|
-
return SideEffect2;
|
|
1695
|
-
}(React.PureComponent);
|
|
1696
|
-
_defineProperty(SideEffect, "displayName", "SideEffect(" + getDisplayName(WrappedComponent) + ")");
|
|
1697
|
-
return SideEffect;
|
|
1698
|
-
};
|
|
1699
|
-
}
|
|
1700
|
-
var toArray = function(a) {
|
|
1701
|
-
var ret = Array(a.length);
|
|
1702
|
-
for (var i = 0; i < a.length; ++i) {
|
|
1703
|
-
ret[i] = a[i];
|
|
1704
|
-
}
|
|
1705
|
-
return ret;
|
|
1706
|
-
};
|
|
1707
|
-
var asArray = function(a) {
|
|
1708
|
-
return Array.isArray(a) ? a : [a];
|
|
1709
|
-
};
|
|
1710
|
-
var getFirst = function(a) {
|
|
1711
|
-
return Array.isArray(a) ? a[0] : a;
|
|
1712
|
-
};
|
|
1713
|
-
var isElementHidden = function(node) {
|
|
1714
|
-
if (node.nodeType !== Node.ELEMENT_NODE) {
|
|
1715
|
-
return false;
|
|
1716
|
-
}
|
|
1717
|
-
var computedStyle = window.getComputedStyle(node, null);
|
|
1718
|
-
if (!computedStyle || !computedStyle.getPropertyValue) {
|
|
1719
|
-
return false;
|
|
1720
|
-
}
|
|
1721
|
-
return computedStyle.getPropertyValue("display") === "none" || computedStyle.getPropertyValue("visibility") === "hidden";
|
|
1722
|
-
};
|
|
1723
|
-
var getParentNode = function(node) {
|
|
1724
|
-
return node.parentNode && node.parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? (
|
|
1725
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1726
|
-
node.parentNode.host
|
|
1727
|
-
) : node.parentNode;
|
|
1728
|
-
};
|
|
1729
|
-
var isTopNode = function(node) {
|
|
1730
|
-
return node === document || node && node.nodeType === Node.DOCUMENT_NODE;
|
|
1731
|
-
};
|
|
1732
|
-
var isInert = function(node) {
|
|
1733
|
-
return node.hasAttribute("inert");
|
|
1734
|
-
};
|
|
1735
|
-
var isVisibleUncached = function(node, checkParent) {
|
|
1736
|
-
return !node || isTopNode(node) || !isElementHidden(node) && !isInert(node) && checkParent(getParentNode(node));
|
|
1737
|
-
};
|
|
1738
|
-
var isVisibleCached = function(visibilityCache, node) {
|
|
1739
|
-
var cached = visibilityCache.get(node);
|
|
1740
|
-
if (cached !== void 0) {
|
|
1741
|
-
return cached;
|
|
1742
|
-
}
|
|
1743
|
-
var result = isVisibleUncached(node, isVisibleCached.bind(void 0, visibilityCache));
|
|
1744
|
-
visibilityCache.set(node, result);
|
|
1745
|
-
return result;
|
|
1746
|
-
};
|
|
1747
|
-
var isAutoFocusAllowedUncached = function(node, checkParent) {
|
|
1748
|
-
return node && !isTopNode(node) ? isAutoFocusAllowed(node) ? checkParent(getParentNode(node)) : false : true;
|
|
1749
|
-
};
|
|
1750
|
-
var isAutoFocusAllowedCached = function(cache, node) {
|
|
1751
|
-
var cached = cache.get(node);
|
|
1752
|
-
if (cached !== void 0) {
|
|
1753
|
-
return cached;
|
|
1754
|
-
}
|
|
1755
|
-
var result = isAutoFocusAllowedUncached(node, isAutoFocusAllowedCached.bind(void 0, cache));
|
|
1756
|
-
cache.set(node, result);
|
|
1757
|
-
return result;
|
|
1758
|
-
};
|
|
1759
|
-
var getDataset = function(node) {
|
|
1760
|
-
return node.dataset;
|
|
1761
|
-
};
|
|
1762
|
-
var isHTMLButtonElement = function(node) {
|
|
1763
|
-
return node.tagName === "BUTTON";
|
|
1764
|
-
};
|
|
1765
|
-
var isHTMLInputElement = function(node) {
|
|
1766
|
-
return node.tagName === "INPUT";
|
|
1767
|
-
};
|
|
1768
|
-
var isRadioElement = function(node) {
|
|
1769
|
-
return isHTMLInputElement(node) && node.type === "radio";
|
|
1770
|
-
};
|
|
1771
|
-
var notHiddenInput = function(node) {
|
|
1772
|
-
return !((isHTMLInputElement(node) || isHTMLButtonElement(node)) && (node.type === "hidden" || node.disabled));
|
|
1773
|
-
};
|
|
1774
|
-
var isAutoFocusAllowed = function(node) {
|
|
1775
|
-
var attribute = node.getAttribute(FOCUS_NO_AUTOFOCUS$1);
|
|
1776
|
-
return ![true, "true", ""].includes(attribute);
|
|
1777
|
-
};
|
|
1778
|
-
var isGuard = function(node) {
|
|
1779
|
-
var _a;
|
|
1780
|
-
return Boolean(node && ((_a = getDataset(node)) === null || _a === void 0 ? void 0 : _a.focusGuard));
|
|
1781
|
-
};
|
|
1782
|
-
var isNotAGuard = function(node) {
|
|
1783
|
-
return !isGuard(node);
|
|
1784
|
-
};
|
|
1785
|
-
var isDefined = function(x) {
|
|
1786
|
-
return Boolean(x);
|
|
1787
|
-
};
|
|
1788
|
-
var tabSort = function(a, b) {
|
|
1789
|
-
var aTab = Math.max(0, a.tabIndex);
|
|
1790
|
-
var bTab = Math.max(0, b.tabIndex);
|
|
1791
|
-
var tabDiff = aTab - bTab;
|
|
1792
|
-
var indexDiff = a.index - b.index;
|
|
1793
|
-
if (tabDiff) {
|
|
1794
|
-
if (!aTab) {
|
|
1795
|
-
return 1;
|
|
1796
|
-
}
|
|
1797
|
-
if (!bTab) {
|
|
1798
|
-
return -1;
|
|
1799
|
-
}
|
|
1800
|
-
}
|
|
1801
|
-
return tabDiff || indexDiff;
|
|
1802
|
-
};
|
|
1803
|
-
var getTabIndex = function(node) {
|
|
1804
|
-
if (node.tabIndex < 0) {
|
|
1805
|
-
if (!node.hasAttribute("tabindex")) {
|
|
1806
|
-
return 0;
|
|
1807
|
-
}
|
|
1808
|
-
}
|
|
1809
|
-
return node.tabIndex;
|
|
1810
|
-
};
|
|
1811
|
-
var orderByTabIndex = function(nodes, filterNegative, keepGuards) {
|
|
1812
|
-
return toArray(nodes).map(function(node, index) {
|
|
1813
|
-
var tabIndex = getTabIndex(node);
|
|
1814
|
-
return {
|
|
1815
|
-
node,
|
|
1816
|
-
index,
|
|
1817
|
-
tabIndex: keepGuards && tabIndex === -1 ? (node.dataset || {}).focusGuard ? 0 : -1 : tabIndex
|
|
1818
|
-
};
|
|
1819
|
-
}).filter(function(data) {
|
|
1820
|
-
return !filterNegative || data.tabIndex >= 0;
|
|
1821
|
-
}).sort(tabSort);
|
|
1822
|
-
};
|
|
1823
|
-
var tabbables = [
|
|
1824
|
-
"button:enabled",
|
|
1825
|
-
"select:enabled",
|
|
1826
|
-
"textarea:enabled",
|
|
1827
|
-
"input:enabled",
|
|
1828
|
-
// elements with explicit roles will also use explicit tabindex
|
|
1829
|
-
// '[role="button"]',
|
|
1830
|
-
"a[href]",
|
|
1831
|
-
"area[href]",
|
|
1832
|
-
"summary",
|
|
1833
|
-
"iframe",
|
|
1834
|
-
"object",
|
|
1835
|
-
"embed",
|
|
1836
|
-
"audio[controls]",
|
|
1837
|
-
"video[controls]",
|
|
1838
|
-
"[tabindex]",
|
|
1839
|
-
"[contenteditable]",
|
|
1840
|
-
"[autofocus]"
|
|
1841
|
-
];
|
|
1842
|
-
var queryTabbables = tabbables.join(",");
|
|
1843
|
-
var queryGuardTabbables = "".concat(queryTabbables, ", [data-focus-guard]");
|
|
1844
|
-
var getFocusablesWithShadowDom = function(parent, withGuards) {
|
|
1845
|
-
return toArray((parent.shadowRoot || parent).children).reduce(function(acc, child) {
|
|
1846
|
-
return acc.concat(child.matches(withGuards ? queryGuardTabbables : queryTabbables) ? [child] : [], getFocusablesWithShadowDom(child));
|
|
1847
|
-
}, []);
|
|
1848
|
-
};
|
|
1849
|
-
var getFocusablesWithIFrame = function(parent, withGuards) {
|
|
1850
|
-
var _a;
|
|
1851
|
-
if (parent instanceof HTMLIFrameElement && ((_a = parent.contentDocument) === null || _a === void 0 ? void 0 : _a.body)) {
|
|
1852
|
-
return getFocusables([parent.contentDocument.body], withGuards);
|
|
1853
|
-
}
|
|
1854
|
-
return [parent];
|
|
1855
|
-
};
|
|
1856
|
-
var getFocusables = function(parents, withGuards) {
|
|
1857
|
-
return parents.reduce(function(acc, parent) {
|
|
1858
|
-
var _a;
|
|
1859
|
-
var focusableWithShadowDom = getFocusablesWithShadowDom(parent, withGuards);
|
|
1860
|
-
var focusableWithIframes = (_a = []).concat.apply(_a, focusableWithShadowDom.map(function(node) {
|
|
1861
|
-
return getFocusablesWithIFrame(node, withGuards);
|
|
1862
|
-
}));
|
|
1863
|
-
return acc.concat(
|
|
1864
|
-
// add all tabbables inside and within shadow DOMs in DOM order
|
|
1865
|
-
focusableWithIframes,
|
|
1866
|
-
// add if node is tabbable itself
|
|
1867
|
-
parent.parentNode ? toArray(parent.parentNode.querySelectorAll(queryTabbables)).filter(function(node) {
|
|
1868
|
-
return node === parent;
|
|
1869
|
-
}) : []
|
|
1870
|
-
);
|
|
1871
|
-
}, []);
|
|
1872
|
-
};
|
|
1873
|
-
var getParentAutofocusables = function(parent) {
|
|
1874
|
-
var parentFocus = parent.querySelectorAll("[".concat(FOCUS_AUTO$1, "]"));
|
|
1875
|
-
return toArray(parentFocus).map(function(node) {
|
|
1876
|
-
return getFocusables([node]);
|
|
1877
|
-
}).reduce(function(acc, nodes) {
|
|
1878
|
-
return acc.concat(nodes);
|
|
1879
|
-
}, []);
|
|
1880
|
-
};
|
|
1881
|
-
var filterFocusable = function(nodes, visibilityCache) {
|
|
1882
|
-
return toArray(nodes).filter(function(node) {
|
|
1883
|
-
return isVisibleCached(visibilityCache, node);
|
|
1884
|
-
}).filter(function(node) {
|
|
1885
|
-
return notHiddenInput(node);
|
|
1886
|
-
});
|
|
1887
|
-
};
|
|
1888
|
-
var filterAutoFocusable = function(nodes, cache) {
|
|
1889
|
-
if (cache === void 0) {
|
|
1890
|
-
cache = /* @__PURE__ */ new Map();
|
|
1891
|
-
}
|
|
1892
|
-
return toArray(nodes).filter(function(node) {
|
|
1893
|
-
return isAutoFocusAllowedCached(cache, node);
|
|
1894
|
-
});
|
|
1895
|
-
};
|
|
1896
|
-
var getTabbableNodes = function(topNodes, visibilityCache, withGuards) {
|
|
1897
|
-
return orderByTabIndex(filterFocusable(getFocusables(topNodes, withGuards), visibilityCache), true, withGuards);
|
|
1898
|
-
};
|
|
1899
|
-
var getFocusableNodes = function(topNodes, visibilityCache) {
|
|
1900
|
-
return orderByTabIndex(filterFocusable(getFocusables(topNodes), visibilityCache), false);
|
|
1901
|
-
};
|
|
1902
|
-
var parentAutofocusables = function(topNode, visibilityCache) {
|
|
1903
|
-
return filterFocusable(getParentAutofocusables(topNode), visibilityCache);
|
|
1904
|
-
};
|
|
1905
|
-
var contains = function(scope, element) {
|
|
1906
|
-
if (scope.shadowRoot) {
|
|
1907
|
-
return contains(scope.shadowRoot, element);
|
|
1908
|
-
} else {
|
|
1909
|
-
if (Object.getPrototypeOf(scope).contains !== void 0 && Object.getPrototypeOf(scope).contains.call(scope, element)) {
|
|
1910
|
-
return true;
|
|
1911
|
-
}
|
|
1912
|
-
return toArray(scope.children).some(function(child) {
|
|
1913
|
-
var _a;
|
|
1914
|
-
if (child instanceof HTMLIFrameElement) {
|
|
1915
|
-
var iframeBody = (_a = child.contentDocument) === null || _a === void 0 ? void 0 : _a.body;
|
|
1916
|
-
if (iframeBody) {
|
|
1917
|
-
return contains(iframeBody, element);
|
|
1918
|
-
}
|
|
1919
|
-
return false;
|
|
1920
|
-
}
|
|
1921
|
-
return contains(child, element);
|
|
1922
|
-
});
|
|
1923
|
-
}
|
|
1924
|
-
};
|
|
1925
|
-
var filterNested = function(nodes) {
|
|
1926
|
-
var contained = /* @__PURE__ */ new Set();
|
|
1927
|
-
var l = nodes.length;
|
|
1928
|
-
for (var i = 0; i < l; i += 1) {
|
|
1929
|
-
for (var j = i + 1; j < l; j += 1) {
|
|
1930
|
-
var position = nodes[i].compareDocumentPosition(nodes[j]);
|
|
1931
|
-
if ((position & Node.DOCUMENT_POSITION_CONTAINED_BY) > 0) {
|
|
1932
|
-
contained.add(j);
|
|
1933
|
-
}
|
|
1934
|
-
if ((position & Node.DOCUMENT_POSITION_CONTAINS) > 0) {
|
|
1935
|
-
contained.add(i);
|
|
1936
|
-
}
|
|
1937
|
-
}
|
|
1938
|
-
}
|
|
1939
|
-
return nodes.filter(function(_, index) {
|
|
1940
|
-
return !contained.has(index);
|
|
1941
|
-
});
|
|
1942
|
-
};
|
|
1943
|
-
var getTopParent = function(node) {
|
|
1944
|
-
return node.parentNode ? getTopParent(node.parentNode) : node;
|
|
1945
|
-
};
|
|
1946
|
-
var getAllAffectedNodes = function(node) {
|
|
1947
|
-
var nodes = asArray(node);
|
|
1948
|
-
return nodes.filter(Boolean).reduce(function(acc, currentNode) {
|
|
1949
|
-
var group = currentNode.getAttribute(FOCUS_GROUP$1);
|
|
1950
|
-
acc.push.apply(acc, group ? filterNested(toArray(getTopParent(currentNode).querySelectorAll("[".concat(FOCUS_GROUP$1, '="').concat(group, '"]:not([').concat(FOCUS_DISABLED$1, '="disabled"])')))) : [currentNode]);
|
|
1951
|
-
return acc;
|
|
1952
|
-
}, []);
|
|
1953
|
-
};
|
|
1954
|
-
var safeProbe = function(cb) {
|
|
1955
|
-
try {
|
|
1956
|
-
return cb();
|
|
1957
|
-
} catch (e) {
|
|
1958
|
-
return void 0;
|
|
1959
|
-
}
|
|
1960
|
-
};
|
|
1961
|
-
var getActiveElement = function(inDocument) {
|
|
1962
|
-
if (inDocument === void 0) {
|
|
1963
|
-
inDocument = document;
|
|
1964
|
-
}
|
|
1965
|
-
if (!inDocument || !inDocument.activeElement) {
|
|
1966
|
-
return void 0;
|
|
1967
|
-
}
|
|
1968
|
-
var activeElement = inDocument.activeElement;
|
|
1969
|
-
return activeElement.shadowRoot ? getActiveElement(activeElement.shadowRoot) : activeElement instanceof HTMLIFrameElement && safeProbe(function() {
|
|
1970
|
-
return activeElement.contentWindow.document;
|
|
1971
|
-
}) ? getActiveElement(activeElement.contentWindow.document) : activeElement;
|
|
1972
|
-
};
|
|
1973
|
-
var focusInFrame = function(frame, activeElement) {
|
|
1974
|
-
return frame === activeElement;
|
|
1975
|
-
};
|
|
1976
|
-
var focusInsideIframe = function(topNode, activeElement) {
|
|
1977
|
-
return Boolean(toArray(topNode.querySelectorAll("iframe")).some(function(node) {
|
|
1978
|
-
return focusInFrame(node, activeElement);
|
|
1979
|
-
}));
|
|
1980
|
-
};
|
|
1981
|
-
var focusInside = function(topNode, activeElement) {
|
|
1982
|
-
if (activeElement === void 0) {
|
|
1983
|
-
activeElement = getActiveElement(getFirst(topNode).ownerDocument);
|
|
1984
|
-
}
|
|
1985
|
-
if (!activeElement || activeElement.dataset && activeElement.dataset.focusGuard) {
|
|
1986
|
-
return false;
|
|
1987
|
-
}
|
|
1988
|
-
return getAllAffectedNodes(topNode).some(function(node) {
|
|
1989
|
-
return contains(node, activeElement) || focusInsideIframe(node, activeElement);
|
|
1990
|
-
});
|
|
1991
|
-
};
|
|
1992
|
-
var focusIsHidden = function(inDocument) {
|
|
1993
|
-
if (inDocument === void 0) {
|
|
1994
|
-
inDocument = document;
|
|
1995
|
-
}
|
|
1996
|
-
var activeElement = getActiveElement(inDocument);
|
|
1997
|
-
if (!activeElement) {
|
|
1998
|
-
return false;
|
|
1999
|
-
}
|
|
2000
|
-
return toArray(inDocument.querySelectorAll("[".concat(FOCUS_ALLOW$1, "]"))).some(function(node) {
|
|
2001
|
-
return contains(node, activeElement);
|
|
2002
|
-
});
|
|
2003
|
-
};
|
|
2004
|
-
var findSelectedRadio = function(node, nodes) {
|
|
2005
|
-
return nodes.filter(isRadioElement).filter(function(el) {
|
|
2006
|
-
return el.name === node.name;
|
|
2007
|
-
}).filter(function(el) {
|
|
2008
|
-
return el.checked;
|
|
2009
|
-
})[0] || node;
|
|
2010
|
-
};
|
|
2011
|
-
var correctNode = function(node, nodes) {
|
|
2012
|
-
if (isRadioElement(node) && node.name) {
|
|
2013
|
-
return findSelectedRadio(node, nodes);
|
|
2014
|
-
}
|
|
2015
|
-
return node;
|
|
2016
|
-
};
|
|
2017
|
-
var correctNodes = function(nodes) {
|
|
2018
|
-
var resultSet = /* @__PURE__ */ new Set();
|
|
2019
|
-
nodes.forEach(function(node) {
|
|
2020
|
-
return resultSet.add(correctNode(node, nodes));
|
|
2021
|
-
});
|
|
2022
|
-
return nodes.filter(function(node) {
|
|
2023
|
-
return resultSet.has(node);
|
|
2024
|
-
});
|
|
2025
|
-
};
|
|
2026
|
-
var pickFirstFocus = function(nodes) {
|
|
2027
|
-
if (nodes[0] && nodes.length > 1) {
|
|
2028
|
-
return correctNode(nodes[0], nodes);
|
|
2029
|
-
}
|
|
2030
|
-
return nodes[0];
|
|
2031
|
-
};
|
|
2032
|
-
var pickFocusable = function(nodes, node) {
|
|
2033
|
-
return nodes.indexOf(correctNode(node, nodes));
|
|
2034
|
-
};
|
|
2035
|
-
var NEW_FOCUS = "NEW_FOCUS";
|
|
2036
|
-
var newFocus = function(innerNodes, innerTabbables, outerNodes, activeElement, lastNode) {
|
|
2037
|
-
var cnt = innerNodes.length;
|
|
2038
|
-
var firstFocus = innerNodes[0];
|
|
2039
|
-
var lastFocus = innerNodes[cnt - 1];
|
|
2040
|
-
var isOnGuard = isGuard(activeElement);
|
|
2041
|
-
if (activeElement && innerNodes.indexOf(activeElement) >= 0) {
|
|
2042
|
-
return void 0;
|
|
2043
|
-
}
|
|
2044
|
-
var activeIndex = activeElement !== void 0 ? outerNodes.indexOf(activeElement) : -1;
|
|
2045
|
-
var lastIndex = lastNode ? outerNodes.indexOf(lastNode) : activeIndex;
|
|
2046
|
-
var lastNodeInside = lastNode ? innerNodes.indexOf(lastNode) : -1;
|
|
2047
|
-
if (activeIndex === -1) {
|
|
2048
|
-
if (lastNodeInside !== -1) {
|
|
2049
|
-
return lastNodeInside;
|
|
2050
|
-
}
|
|
2051
|
-
return NEW_FOCUS;
|
|
2052
|
-
}
|
|
2053
|
-
if (lastNodeInside === -1) {
|
|
2054
|
-
return NEW_FOCUS;
|
|
2055
|
-
}
|
|
2056
|
-
var indexDiff = activeIndex - lastIndex;
|
|
2057
|
-
var firstNodeIndex = outerNodes.indexOf(firstFocus);
|
|
2058
|
-
var lastNodeIndex = outerNodes.indexOf(lastFocus);
|
|
2059
|
-
var correctedNodes = correctNodes(outerNodes);
|
|
2060
|
-
var correctedIndex = activeElement !== void 0 ? correctedNodes.indexOf(activeElement) : -1;
|
|
2061
|
-
var correctedIndexDiff = correctedIndex - (lastNode ? correctedNodes.indexOf(lastNode) : activeIndex);
|
|
2062
|
-
if (!indexDiff && lastNodeInside >= 0) {
|
|
2063
|
-
return lastNodeInside;
|
|
2064
|
-
}
|
|
2065
|
-
if (innerTabbables.length === 0) {
|
|
2066
|
-
return lastNodeInside;
|
|
2067
|
-
}
|
|
2068
|
-
var returnFirstNode = pickFocusable(innerNodes, innerTabbables[0]);
|
|
2069
|
-
var returnLastNode = pickFocusable(innerNodes, innerTabbables[innerTabbables.length - 1]);
|
|
2070
|
-
if (activeIndex <= firstNodeIndex && isOnGuard && Math.abs(indexDiff) > 1) {
|
|
2071
|
-
return returnLastNode;
|
|
2072
|
-
}
|
|
2073
|
-
if (activeIndex >= lastNodeIndex && isOnGuard && Math.abs(indexDiff) > 1) {
|
|
2074
|
-
return returnFirstNode;
|
|
2075
|
-
}
|
|
2076
|
-
if (indexDiff && Math.abs(correctedIndexDiff) > 1) {
|
|
2077
|
-
return lastNodeInside;
|
|
2078
|
-
}
|
|
2079
|
-
if (activeIndex <= firstNodeIndex) {
|
|
2080
|
-
return returnLastNode;
|
|
2081
|
-
}
|
|
2082
|
-
if (activeIndex > lastNodeIndex) {
|
|
2083
|
-
return returnFirstNode;
|
|
2084
|
-
}
|
|
2085
|
-
if (indexDiff) {
|
|
2086
|
-
if (Math.abs(indexDiff) > 1) {
|
|
2087
|
-
return lastNodeInside;
|
|
2088
|
-
}
|
|
2089
|
-
return (cnt + lastNodeInside + indexDiff) % cnt;
|
|
2090
|
-
}
|
|
2091
|
-
return void 0;
|
|
2092
|
-
};
|
|
2093
|
-
var findAutoFocused = function(autoFocusables) {
|
|
2094
|
-
return function(node) {
|
|
2095
|
-
var _a;
|
|
2096
|
-
var autofocus = (_a = getDataset(node)) === null || _a === void 0 ? void 0 : _a.autofocus;
|
|
2097
|
-
return (
|
|
2098
|
-
// @ts-expect-error
|
|
2099
|
-
node.autofocus || //
|
|
2100
|
-
autofocus !== void 0 && autofocus !== "false" || //
|
|
2101
|
-
autoFocusables.indexOf(node) >= 0
|
|
2102
|
-
);
|
|
2103
|
-
};
|
|
2104
|
-
};
|
|
2105
|
-
var pickAutofocus = function(nodesIndexes, orderedNodes, groups) {
|
|
2106
|
-
var nodes = nodesIndexes.map(function(_a) {
|
|
2107
|
-
var node = _a.node;
|
|
2108
|
-
return node;
|
|
2109
|
-
});
|
|
2110
|
-
var autoFocusable = filterAutoFocusable(nodes.filter(findAutoFocused(groups)));
|
|
2111
|
-
if (autoFocusable && autoFocusable.length) {
|
|
2112
|
-
return pickFirstFocus(autoFocusable);
|
|
2113
|
-
}
|
|
2114
|
-
return pickFirstFocus(filterAutoFocusable(orderedNodes));
|
|
2115
|
-
};
|
|
2116
|
-
var getParents = function(node, parents) {
|
|
2117
|
-
if (parents === void 0) {
|
|
2118
|
-
parents = [];
|
|
2119
|
-
}
|
|
2120
|
-
parents.push(node);
|
|
2121
|
-
if (node.parentNode) {
|
|
2122
|
-
getParents(node.parentNode.host || node.parentNode, parents);
|
|
2123
|
-
}
|
|
2124
|
-
return parents;
|
|
2125
|
-
};
|
|
2126
|
-
var getCommonParent = function(nodeA, nodeB) {
|
|
2127
|
-
var parentsA = getParents(nodeA);
|
|
2128
|
-
var parentsB = getParents(nodeB);
|
|
2129
|
-
for (var i = 0; i < parentsA.length; i += 1) {
|
|
2130
|
-
var currentParent = parentsA[i];
|
|
2131
|
-
if (parentsB.indexOf(currentParent) >= 0) {
|
|
2132
|
-
return currentParent;
|
|
2133
|
-
}
|
|
2134
|
-
}
|
|
2135
|
-
return false;
|
|
2136
|
-
};
|
|
2137
|
-
var getTopCommonParent = function(baseActiveElement, leftEntry, rightEntries) {
|
|
2138
|
-
var activeElements = asArray(baseActiveElement);
|
|
2139
|
-
var leftEntries = asArray(leftEntry);
|
|
2140
|
-
var activeElement = activeElements[0];
|
|
2141
|
-
var topCommon = false;
|
|
2142
|
-
leftEntries.filter(Boolean).forEach(function(entry) {
|
|
2143
|
-
topCommon = getCommonParent(topCommon || entry, entry) || topCommon;
|
|
2144
|
-
rightEntries.filter(Boolean).forEach(function(subEntry) {
|
|
2145
|
-
var common = getCommonParent(activeElement, subEntry);
|
|
2146
|
-
if (common) {
|
|
2147
|
-
if (!topCommon || contains(common, topCommon)) {
|
|
2148
|
-
topCommon = common;
|
|
2149
|
-
} else {
|
|
2150
|
-
topCommon = getCommonParent(common, topCommon);
|
|
2151
|
-
}
|
|
2152
|
-
}
|
|
2153
|
-
});
|
|
2154
|
-
});
|
|
2155
|
-
return topCommon;
|
|
2156
|
-
};
|
|
2157
|
-
var allParentAutofocusables = function(entries, visibilityCache) {
|
|
2158
|
-
return entries.reduce(function(acc, node) {
|
|
2159
|
-
return acc.concat(parentAutofocusables(node, visibilityCache));
|
|
2160
|
-
}, []);
|
|
2161
|
-
};
|
|
2162
|
-
var reorderNodes = function(srcNodes, dstNodes) {
|
|
2163
|
-
var remap = /* @__PURE__ */ new Map();
|
|
2164
|
-
dstNodes.forEach(function(entity) {
|
|
2165
|
-
return remap.set(entity.node, entity);
|
|
2166
|
-
});
|
|
2167
|
-
return srcNodes.map(function(node) {
|
|
2168
|
-
return remap.get(node);
|
|
2169
|
-
}).filter(isDefined);
|
|
2170
|
-
};
|
|
2171
|
-
var focusSolver = function(topNode, lastNode) {
|
|
2172
|
-
var activeElement = getActiveElement(asArray(topNode).length > 0 ? document : getFirst(topNode).ownerDocument);
|
|
2173
|
-
var entries = getAllAffectedNodes(topNode).filter(isNotAGuard);
|
|
2174
|
-
var commonParent = getTopCommonParent(activeElement || topNode, topNode, entries);
|
|
2175
|
-
var visibilityCache = /* @__PURE__ */ new Map();
|
|
2176
|
-
var anyFocusable = getFocusableNodes(entries, visibilityCache);
|
|
2177
|
-
var innerElements = anyFocusable.filter(function(_a) {
|
|
2178
|
-
var node = _a.node;
|
|
2179
|
-
return isNotAGuard(node);
|
|
2180
|
-
});
|
|
2181
|
-
if (!innerElements[0]) {
|
|
2182
|
-
return void 0;
|
|
2183
|
-
}
|
|
2184
|
-
var outerNodes = getFocusableNodes([commonParent], visibilityCache).map(function(_a) {
|
|
2185
|
-
var node = _a.node;
|
|
2186
|
-
return node;
|
|
2187
|
-
});
|
|
2188
|
-
var orderedInnerElements = reorderNodes(outerNodes, innerElements);
|
|
2189
|
-
var innerFocusables = orderedInnerElements.map(function(_a) {
|
|
2190
|
-
var node = _a.node;
|
|
2191
|
-
return node;
|
|
2192
|
-
});
|
|
2193
|
-
var innerTabbable = orderedInnerElements.filter(function(_a) {
|
|
2194
|
-
var tabIndex = _a.tabIndex;
|
|
2195
|
-
return tabIndex >= 0;
|
|
2196
|
-
}).map(function(_a) {
|
|
2197
|
-
var node = _a.node;
|
|
2198
|
-
return node;
|
|
2199
|
-
});
|
|
2200
|
-
var newId = newFocus(innerFocusables, innerTabbable, outerNodes, activeElement, lastNode);
|
|
2201
|
-
if (newId === NEW_FOCUS) {
|
|
2202
|
-
var focusNode = (
|
|
2203
|
-
// first try only tabbable, and the fallback to all focusable, as long as at least one element should be picked for focus
|
|
2204
|
-
pickAutofocus(anyFocusable, innerTabbable, allParentAutofocusables(entries, visibilityCache)) || pickAutofocus(anyFocusable, innerFocusables, allParentAutofocusables(entries, visibilityCache))
|
|
2205
|
-
);
|
|
2206
|
-
if (focusNode) {
|
|
2207
|
-
return { node: focusNode };
|
|
2208
|
-
} else {
|
|
2209
|
-
console.warn("focus-lock: cannot find any node to move focus into");
|
|
2210
|
-
return void 0;
|
|
2211
|
-
}
|
|
2212
|
-
}
|
|
2213
|
-
if (newId === void 0) {
|
|
2214
|
-
return newId;
|
|
2215
|
-
}
|
|
2216
|
-
return orderedInnerElements[newId];
|
|
2217
|
-
};
|
|
2218
|
-
var expandFocusableNodes = function(topNode) {
|
|
2219
|
-
var entries = getAllAffectedNodes(topNode).filter(isNotAGuard);
|
|
2220
|
-
var commonParent = getTopCommonParent(topNode, topNode, entries);
|
|
2221
|
-
var outerNodes = orderByTabIndex(getFocusables([commonParent], true), true, true);
|
|
2222
|
-
var innerElements = getFocusables(entries, false);
|
|
2223
|
-
return outerNodes.map(function(_a) {
|
|
2224
|
-
var node = _a.node, index = _a.index;
|
|
2225
|
-
return {
|
|
2226
|
-
node,
|
|
2227
|
-
index,
|
|
2228
|
-
lockItem: innerElements.indexOf(node) >= 0,
|
|
2229
|
-
guard: isGuard(node)
|
|
2230
|
-
};
|
|
2231
|
-
});
|
|
2232
|
-
};
|
|
2233
|
-
var focusOn = function(target, focusOptions) {
|
|
2234
|
-
if (!target) {
|
|
2235
|
-
return;
|
|
2236
|
-
}
|
|
2237
|
-
if ("focus" in target) {
|
|
2238
|
-
target.focus(focusOptions);
|
|
2239
|
-
}
|
|
2240
|
-
if ("contentWindow" in target && target.contentWindow) {
|
|
2241
|
-
target.contentWindow.focus();
|
|
2242
|
-
}
|
|
2243
|
-
};
|
|
2244
|
-
var guardCount = 0;
|
|
2245
|
-
var lockDisabled = false;
|
|
2246
|
-
var moveFocusInside = function(topNode, lastNode, options) {
|
|
2247
|
-
if (options === void 0) {
|
|
2248
|
-
options = {};
|
|
2249
|
-
}
|
|
2250
|
-
var focusable = focusSolver(topNode, lastNode);
|
|
2251
|
-
if (lockDisabled) {
|
|
2252
|
-
return;
|
|
2253
|
-
}
|
|
2254
|
-
if (focusable) {
|
|
2255
|
-
if (guardCount > 2) {
|
|
2256
|
-
console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting");
|
|
2257
|
-
lockDisabled = true;
|
|
2258
|
-
setTimeout(function() {
|
|
2259
|
-
lockDisabled = false;
|
|
2260
|
-
}, 1);
|
|
2261
|
-
return;
|
|
2262
|
-
}
|
|
2263
|
-
guardCount++;
|
|
2264
|
-
focusOn(focusable.node, options.focusOptions);
|
|
2265
|
-
guardCount--;
|
|
2266
|
-
}
|
|
2267
|
-
};
|
|
2268
|
-
function weakRef(value) {
|
|
2269
|
-
if (!value)
|
|
2270
|
-
return null;
|
|
2271
|
-
if (typeof WeakRef === "undefined") {
|
|
2272
|
-
return function() {
|
|
2273
|
-
return value || null;
|
|
2274
|
-
};
|
|
2275
|
-
}
|
|
2276
|
-
var w = value ? new WeakRef(value) : null;
|
|
2277
|
-
return function() {
|
|
2278
|
-
return (w === null || w === void 0 ? void 0 : w.deref()) || null;
|
|
2279
|
-
};
|
|
2280
|
-
}
|
|
2281
|
-
var recordElementLocation = function(element) {
|
|
2282
|
-
if (!element) {
|
|
2283
|
-
return null;
|
|
2284
|
-
}
|
|
2285
|
-
var stack = [];
|
|
2286
|
-
var currentElement = element;
|
|
2287
|
-
while (currentElement && currentElement !== document.body) {
|
|
2288
|
-
stack.push({
|
|
2289
|
-
current: weakRef(currentElement),
|
|
2290
|
-
parent: weakRef(currentElement.parentElement),
|
|
2291
|
-
left: weakRef(currentElement.previousElementSibling),
|
|
2292
|
-
right: weakRef(currentElement.nextElementSibling)
|
|
2293
|
-
});
|
|
2294
|
-
currentElement = currentElement.parentElement;
|
|
2295
|
-
}
|
|
2296
|
-
return {
|
|
2297
|
-
element: weakRef(element),
|
|
2298
|
-
stack,
|
|
2299
|
-
ownerDocument: element.ownerDocument
|
|
2300
|
-
};
|
|
2301
|
-
};
|
|
2302
|
-
var restoreFocusTo = function(location) {
|
|
2303
|
-
var _a, _b, _c, _d, _e;
|
|
2304
|
-
if (!location) {
|
|
2305
|
-
return void 0;
|
|
2306
|
-
}
|
|
2307
|
-
var stack = location.stack, ownerDocument = location.ownerDocument;
|
|
2308
|
-
var visibilityCache = /* @__PURE__ */ new Map();
|
|
2309
|
-
for (var _i = 0, stack_1 = stack; _i < stack_1.length; _i++) {
|
|
2310
|
-
var line = stack_1[_i];
|
|
2311
|
-
var parent_1 = (_a = line.parent) === null || _a === void 0 ? void 0 : _a.call(line);
|
|
2312
|
-
if (parent_1 && ownerDocument.contains(parent_1)) {
|
|
2313
|
-
var left = (_b = line.left) === null || _b === void 0 ? void 0 : _b.call(line);
|
|
2314
|
-
var savedCurrent = line.current();
|
|
2315
|
-
var current = parent_1.contains(savedCurrent) ? savedCurrent : void 0;
|
|
2316
|
-
var right = (_c = line.right) === null || _c === void 0 ? void 0 : _c.call(line);
|
|
2317
|
-
var focusables = getTabbableNodes([parent_1], visibilityCache);
|
|
2318
|
-
var aim = (
|
|
2319
|
-
// that is element itself
|
|
2320
|
-
(_e = (_d = current !== null && current !== void 0 ? current : (
|
|
2321
|
-
// or something in it's place
|
|
2322
|
-
left === null || left === void 0 ? void 0 : left.nextElementSibling
|
|
2323
|
-
)) !== null && _d !== void 0 ? _d : (
|
|
2324
|
-
// or somebody to the right, still close enough
|
|
2325
|
-
right
|
|
2326
|
-
)) !== null && _e !== void 0 ? _e : (
|
|
2327
|
-
// or somebody to the left, something?
|
|
2328
|
-
left
|
|
2329
|
-
)
|
|
2330
|
-
);
|
|
2331
|
-
while (aim) {
|
|
2332
|
-
for (var _f = 0, focusables_1 = focusables; _f < focusables_1.length; _f++) {
|
|
2333
|
-
var focusable = focusables_1[_f];
|
|
2334
|
-
if (aim === null || aim === void 0 ? void 0 : aim.contains(focusable.node)) {
|
|
2335
|
-
return focusable.node;
|
|
2336
|
-
}
|
|
2337
|
-
}
|
|
2338
|
-
aim = aim.nextElementSibling;
|
|
2339
|
-
}
|
|
2340
|
-
if (focusables.length) {
|
|
2341
|
-
return focusables[0].node;
|
|
2342
|
-
}
|
|
2343
|
-
}
|
|
2344
|
-
}
|
|
2345
|
-
return void 0;
|
|
2346
|
-
};
|
|
2347
|
-
var captureFocusRestore = function(targetElement) {
|
|
2348
|
-
var location = recordElementLocation(targetElement);
|
|
2349
|
-
return function() {
|
|
2350
|
-
return restoreFocusTo(location);
|
|
2351
|
-
};
|
|
2352
|
-
};
|
|
2353
|
-
var getRelativeFocusable = function(element, scope, useTabbables) {
|
|
2354
|
-
if (!element || !scope) {
|
|
2355
|
-
console.error("no element or scope given");
|
|
2356
|
-
return {};
|
|
2357
|
-
}
|
|
2358
|
-
var shards = asArray(scope);
|
|
2359
|
-
if (shards.every(function(shard) {
|
|
2360
|
-
return !contains(shard, element);
|
|
2361
|
-
})) {
|
|
2362
|
-
console.error("Active element is not contained in the scope");
|
|
2363
|
-
return {};
|
|
2364
|
-
}
|
|
2365
|
-
var focusables = useTabbables ? getTabbableNodes(shards, /* @__PURE__ */ new Map()) : getFocusableNodes(shards, /* @__PURE__ */ new Map());
|
|
2366
|
-
var current = focusables.findIndex(function(_a) {
|
|
2367
|
-
var node = _a.node;
|
|
2368
|
-
return node === element;
|
|
2369
|
-
});
|
|
2370
|
-
if (current === -1) {
|
|
2371
|
-
return void 0;
|
|
2372
|
-
}
|
|
2373
|
-
return {
|
|
2374
|
-
prev: focusables[current - 1],
|
|
2375
|
-
next: focusables[current + 1],
|
|
2376
|
-
first: focusables[0],
|
|
2377
|
-
last: focusables[focusables.length - 1]
|
|
2378
|
-
};
|
|
2379
|
-
};
|
|
2380
|
-
var getBoundary = function(shards, useTabbables) {
|
|
2381
|
-
var set = useTabbables ? getTabbableNodes(asArray(shards), /* @__PURE__ */ new Map()) : getFocusableNodes(asArray(shards), /* @__PURE__ */ new Map());
|
|
2382
|
-
return {
|
|
2383
|
-
first: set[0],
|
|
2384
|
-
last: set[set.length - 1]
|
|
2385
|
-
};
|
|
2386
|
-
};
|
|
2387
|
-
var defaultOptions = function(options) {
|
|
2388
|
-
return Object.assign({
|
|
2389
|
-
scope: document.body,
|
|
2390
|
-
cycle: true,
|
|
2391
|
-
onlyTabbable: true
|
|
2392
|
-
}, options);
|
|
2393
|
-
};
|
|
2394
|
-
var moveFocus = function(fromElement, options, cb) {
|
|
2395
|
-
if (options === void 0) {
|
|
2396
|
-
options = {};
|
|
2397
|
-
}
|
|
2398
|
-
var newOptions = defaultOptions(options);
|
|
2399
|
-
var solution = getRelativeFocusable(fromElement, newOptions.scope, newOptions.onlyTabbable);
|
|
2400
|
-
if (!solution) {
|
|
2401
|
-
return;
|
|
2402
|
-
}
|
|
2403
|
-
var target = cb(solution, newOptions.cycle);
|
|
2404
|
-
if (target) {
|
|
2405
|
-
focusOn(target.node, newOptions.focusOptions);
|
|
2406
|
-
}
|
|
2407
|
-
};
|
|
2408
|
-
var focusNextElement = function(fromElement, options) {
|
|
2409
|
-
if (options === void 0) {
|
|
2410
|
-
options = {};
|
|
2411
|
-
}
|
|
2412
|
-
moveFocus(fromElement, options, function(_a, cycle) {
|
|
2413
|
-
var next = _a.next, first = _a.first;
|
|
2414
|
-
return next || cycle && first;
|
|
2415
|
-
});
|
|
2416
|
-
};
|
|
2417
|
-
var focusPrevElement = function(fromElement, options) {
|
|
2418
|
-
if (options === void 0) {
|
|
2419
|
-
options = {};
|
|
2420
|
-
}
|
|
2421
|
-
moveFocus(fromElement, options, function(_a, cycle) {
|
|
2422
|
-
var prev = _a.prev, last = _a.last;
|
|
2423
|
-
return prev || cycle && last;
|
|
2424
|
-
});
|
|
2425
|
-
};
|
|
2426
|
-
var pickBoundary = function(scope, options, what) {
|
|
2427
|
-
var _a;
|
|
2428
|
-
var boundary = getBoundary(scope, (_a = options.onlyTabbable) !== null && _a !== void 0 ? _a : true);
|
|
2429
|
-
var node = boundary[what];
|
|
2430
|
-
if (node) {
|
|
2431
|
-
focusOn(node.node, options.focusOptions);
|
|
2432
|
-
}
|
|
2433
|
-
};
|
|
2434
|
-
var focusFirstElement = function(scope, options) {
|
|
2435
|
-
if (options === void 0) {
|
|
2436
|
-
options = {};
|
|
2437
|
-
}
|
|
2438
|
-
pickBoundary(scope, options, "first");
|
|
2439
|
-
};
|
|
2440
|
-
var focusLastElement = function(scope, options) {
|
|
2441
|
-
if (options === void 0) {
|
|
2442
|
-
options = {};
|
|
2443
|
-
}
|
|
2444
|
-
pickBoundary(scope, options, "last");
|
|
2445
|
-
};
|
|
2446
|
-
function deferAction$1(action) {
|
|
2447
|
-
setTimeout(action, 1);
|
|
2448
|
-
}
|
|
2449
|
-
var extractRef$2 = function extractRef(ref) {
|
|
2450
|
-
return ref && "current" in ref ? ref.current : ref;
|
|
2451
|
-
};
|
|
2452
|
-
var focusOnBody = function focusOnBody2() {
|
|
2453
|
-
return document && document.activeElement === document.body;
|
|
2454
|
-
};
|
|
2455
|
-
var isFreeFocus = function isFreeFocus2() {
|
|
2456
|
-
return focusOnBody() || focusIsHidden();
|
|
2457
|
-
};
|
|
2458
|
-
var lastActiveTrap = null;
|
|
2459
|
-
var lastActiveFocus = null;
|
|
2460
|
-
var tryRestoreFocus = function tryRestoreFocus2() {
|
|
2461
|
-
return null;
|
|
2462
|
-
};
|
|
2463
|
-
var lastPortaledElement = null;
|
|
2464
|
-
var focusWasOutsideWindow = false;
|
|
2465
|
-
var windowFocused = false;
|
|
2466
|
-
var defaultWhitelist = function defaultWhitelist2() {
|
|
2467
|
-
return true;
|
|
2468
|
-
};
|
|
2469
|
-
var focusWhitelisted = function focusWhitelisted2(activeElement) {
|
|
2470
|
-
return (lastActiveTrap.whiteList || defaultWhitelist)(activeElement);
|
|
2471
|
-
};
|
|
2472
|
-
var recordPortal = function recordPortal2(observerNode, portaledElement) {
|
|
2473
|
-
lastPortaledElement = {
|
|
2474
|
-
observerNode,
|
|
2475
|
-
portaledElement
|
|
2476
|
-
};
|
|
2477
|
-
};
|
|
2478
|
-
var focusIsPortaledPair = function focusIsPortaledPair2(element) {
|
|
2479
|
-
return lastPortaledElement && lastPortaledElement.portaledElement === element;
|
|
2480
|
-
};
|
|
2481
|
-
function autoGuard(startIndex, end, step, allNodes) {
|
|
2482
|
-
var lastGuard = null;
|
|
2483
|
-
var i = startIndex;
|
|
2484
|
-
do {
|
|
2485
|
-
var item = allNodes[i];
|
|
2486
|
-
if (item.guard) {
|
|
2487
|
-
if (item.node.dataset.focusAutoGuard) {
|
|
2488
|
-
lastGuard = item;
|
|
2489
|
-
}
|
|
2490
|
-
} else if (item.lockItem) {
|
|
2491
|
-
if (i !== startIndex) {
|
|
2492
|
-
return;
|
|
2493
|
-
}
|
|
2494
|
-
lastGuard = null;
|
|
2495
|
-
} else {
|
|
2496
|
-
break;
|
|
2497
|
-
}
|
|
2498
|
-
} while ((i += step) !== end);
|
|
2499
|
-
if (lastGuard) {
|
|
2500
|
-
lastGuard.node.tabIndex = 0;
|
|
2501
|
-
}
|
|
2502
|
-
}
|
|
2503
|
-
var focusWasOutside = function focusWasOutside2(crossFrameOption) {
|
|
2504
|
-
if (crossFrameOption) {
|
|
2505
|
-
return Boolean(focusWasOutsideWindow);
|
|
2506
|
-
}
|
|
2507
|
-
return focusWasOutsideWindow === "meanwhile";
|
|
2508
|
-
};
|
|
2509
|
-
var checkInHost = function checkInHost2(check, el, boundary) {
|
|
2510
|
-
return el && (el.host === check && (!el.activeElement || boundary.contains(el.activeElement)) || el.parentNode && checkInHost2(check, el.parentNode, boundary));
|
|
2511
|
-
};
|
|
2512
|
-
var withinHost = function withinHost2(activeElement, workingArea) {
|
|
2513
|
-
return workingArea.some(function(area) {
|
|
2514
|
-
return checkInHost(activeElement, area, area);
|
|
2515
|
-
});
|
|
2516
|
-
};
|
|
2517
|
-
var getNodeFocusables = function getNodeFocusables2(nodes) {
|
|
2518
|
-
return getFocusableNodes(nodes, /* @__PURE__ */ new Map());
|
|
2519
|
-
};
|
|
2520
|
-
var isNotFocusable = function isNotFocusable2(node) {
|
|
2521
|
-
return !getNodeFocusables([node.parentNode]).some(function(el) {
|
|
2522
|
-
return el.node === node;
|
|
2523
|
-
});
|
|
2524
|
-
};
|
|
2525
|
-
var activateTrap = function activateTrap2() {
|
|
2526
|
-
var result = false;
|
|
2527
|
-
if (lastActiveTrap) {
|
|
2528
|
-
var _lastActiveTrap = lastActiveTrap, observed = _lastActiveTrap.observed, persistentFocus = _lastActiveTrap.persistentFocus, autoFocus = _lastActiveTrap.autoFocus, shards = _lastActiveTrap.shards, crossFrame = _lastActiveTrap.crossFrame, focusOptions = _lastActiveTrap.focusOptions, noFocusGuards = _lastActiveTrap.noFocusGuards;
|
|
2529
|
-
var workingNode = observed || lastPortaledElement && lastPortaledElement.portaledElement;
|
|
2530
|
-
if (focusOnBody() && lastActiveFocus && lastActiveFocus !== document.body) {
|
|
2531
|
-
if (!document.body.contains(lastActiveFocus) || isNotFocusable(lastActiveFocus)) {
|
|
2532
|
-
var newTarget = tryRestoreFocus();
|
|
2533
|
-
if (newTarget) {
|
|
2534
|
-
newTarget.focus();
|
|
2535
|
-
}
|
|
2536
|
-
}
|
|
2537
|
-
}
|
|
2538
|
-
var activeElement = document && document.activeElement;
|
|
2539
|
-
if (workingNode) {
|
|
2540
|
-
var workingArea = [workingNode].concat(shards.map(extractRef$2).filter(Boolean));
|
|
2541
|
-
var shouldForceRestoreFocus = function shouldForceRestoreFocus2() {
|
|
2542
|
-
if (!focusWasOutside(crossFrame) || !noFocusGuards || !lastActiveFocus || windowFocused) {
|
|
2543
|
-
return false;
|
|
2544
|
-
}
|
|
2545
|
-
var nodes = getNodeFocusables(workingArea);
|
|
2546
|
-
var lastIndex = nodes.findIndex(function(_ref2) {
|
|
2547
|
-
var node = _ref2.node;
|
|
2548
|
-
return node === lastActiveFocus;
|
|
2549
|
-
});
|
|
2550
|
-
return lastIndex === 0 || lastIndex === nodes.length - 1;
|
|
2551
|
-
};
|
|
2552
|
-
if (!activeElement || focusWhitelisted(activeElement)) {
|
|
2553
|
-
if (persistentFocus || shouldForceRestoreFocus() || !isFreeFocus() || !lastActiveFocus && autoFocus) {
|
|
2554
|
-
if (workingNode && !(focusInside(workingArea) || activeElement && withinHost(activeElement, workingArea) || focusIsPortaledPair(activeElement))) {
|
|
2555
|
-
if (document && !lastActiveFocus && activeElement && !autoFocus) {
|
|
2556
|
-
if (activeElement.blur) {
|
|
2557
|
-
activeElement.blur();
|
|
2558
|
-
}
|
|
2559
|
-
document.body.focus();
|
|
2560
|
-
} else {
|
|
2561
|
-
result = moveFocusInside(workingArea, lastActiveFocus, {
|
|
2562
|
-
focusOptions
|
|
2563
|
-
});
|
|
2564
|
-
lastPortaledElement = {};
|
|
2565
|
-
}
|
|
2566
|
-
}
|
|
2567
|
-
lastActiveFocus = document && document.activeElement;
|
|
2568
|
-
if (lastActiveFocus !== document.body) {
|
|
2569
|
-
tryRestoreFocus = captureFocusRestore(lastActiveFocus);
|
|
2570
|
-
}
|
|
2571
|
-
focusWasOutsideWindow = false;
|
|
2572
|
-
}
|
|
2573
|
-
}
|
|
2574
|
-
if (document && activeElement !== document.activeElement && document.querySelector("[data-focus-auto-guard]")) {
|
|
2575
|
-
var newActiveElement = document && document.activeElement;
|
|
2576
|
-
var allNodes = expandFocusableNodes(workingArea);
|
|
2577
|
-
var focusedIndex = allNodes.map(function(_ref2) {
|
|
2578
|
-
var node = _ref2.node;
|
|
2579
|
-
return node;
|
|
2580
|
-
}).indexOf(newActiveElement);
|
|
2581
|
-
if (focusedIndex > -1) {
|
|
2582
|
-
allNodes.filter(function(_ref3) {
|
|
2583
|
-
var guard = _ref3.guard, node = _ref3.node;
|
|
2584
|
-
return guard && node.dataset.focusAutoGuard;
|
|
2585
|
-
}).forEach(function(_ref4) {
|
|
2586
|
-
var node = _ref4.node;
|
|
2587
|
-
return node.removeAttribute("tabIndex");
|
|
2588
|
-
});
|
|
2589
|
-
autoGuard(focusedIndex, allNodes.length, 1, allNodes);
|
|
2590
|
-
autoGuard(focusedIndex, -1, -1, allNodes);
|
|
2591
|
-
}
|
|
2592
|
-
}
|
|
2593
|
-
}
|
|
2594
|
-
}
|
|
2595
|
-
return result;
|
|
2596
|
-
};
|
|
2597
|
-
var onTrap = function onTrap2(event) {
|
|
2598
|
-
if (activateTrap() && event) {
|
|
2599
|
-
event.stopPropagation();
|
|
2600
|
-
event.preventDefault();
|
|
2601
|
-
}
|
|
2602
|
-
};
|
|
2603
|
-
var onBlur = function onBlur2() {
|
|
2604
|
-
return deferAction$1(activateTrap);
|
|
2605
|
-
};
|
|
2606
|
-
var onFocus = function onFocus2(event) {
|
|
2607
|
-
var source = event.target;
|
|
2608
|
-
var currentNode = event.currentTarget;
|
|
2609
|
-
if (!currentNode.contains(source)) {
|
|
2610
|
-
recordPortal(currentNode, source);
|
|
2611
|
-
}
|
|
2612
|
-
};
|
|
2613
|
-
var FocusWatcher = function FocusWatcher2() {
|
|
2614
|
-
return null;
|
|
2615
|
-
};
|
|
2616
|
-
process.env.NODE_ENV !== "production" ? {
|
|
2617
|
-
children: PropTypes.node.isRequired
|
|
2618
|
-
} : {};
|
|
2619
|
-
var onWindowFocus = function onWindowFocus2() {
|
|
2620
|
-
windowFocused = true;
|
|
2621
|
-
};
|
|
2622
|
-
var onWindowBlur = function onWindowBlur2() {
|
|
2623
|
-
windowFocused = false;
|
|
2624
|
-
focusWasOutsideWindow = "just";
|
|
2625
|
-
deferAction$1(function() {
|
|
2626
|
-
focusWasOutsideWindow = "meanwhile";
|
|
2627
|
-
});
|
|
2628
|
-
};
|
|
2629
|
-
var attachHandler = function attachHandler2() {
|
|
2630
|
-
document.addEventListener("focusin", onTrap);
|
|
2631
|
-
document.addEventListener("focusout", onBlur);
|
|
2632
|
-
window.addEventListener("focus", onWindowFocus);
|
|
2633
|
-
window.addEventListener("blur", onWindowBlur);
|
|
2634
|
-
};
|
|
2635
|
-
var detachHandler = function detachHandler2() {
|
|
2636
|
-
document.removeEventListener("focusin", onTrap);
|
|
2637
|
-
document.removeEventListener("focusout", onBlur);
|
|
2638
|
-
window.removeEventListener("focus", onWindowFocus);
|
|
2639
|
-
window.removeEventListener("blur", onWindowBlur);
|
|
2640
|
-
};
|
|
2641
|
-
function reducePropsToState(propsList) {
|
|
2642
|
-
return propsList.filter(function(_ref6) {
|
|
2643
|
-
var disabled = _ref6.disabled;
|
|
2644
|
-
return !disabled;
|
|
2645
|
-
});
|
|
2646
|
-
}
|
|
2647
|
-
var focusLockAPI = {
|
|
2648
|
-
moveFocusInside,
|
|
2649
|
-
focusInside,
|
|
2650
|
-
focusNextElement,
|
|
2651
|
-
focusPrevElement,
|
|
2652
|
-
focusFirstElement,
|
|
2653
|
-
focusLastElement,
|
|
2654
|
-
captureFocusRestore
|
|
2655
|
-
};
|
|
2656
|
-
function handleStateChangeOnClient(traps) {
|
|
2657
|
-
var trap = traps.slice(-1)[0];
|
|
2658
|
-
if (trap && !lastActiveTrap) {
|
|
2659
|
-
attachHandler();
|
|
2660
|
-
}
|
|
2661
|
-
var lastTrap = lastActiveTrap;
|
|
2662
|
-
var sameTrap = lastTrap && trap && trap.id === lastTrap.id;
|
|
2663
|
-
lastActiveTrap = trap;
|
|
2664
|
-
if (lastTrap && !sameTrap) {
|
|
2665
|
-
lastTrap.onDeactivation();
|
|
2666
|
-
if (!traps.filter(function(_ref7) {
|
|
2667
|
-
var id = _ref7.id;
|
|
2668
|
-
return id === lastTrap.id;
|
|
2669
|
-
}).length) {
|
|
2670
|
-
lastTrap.returnFocus(!trap);
|
|
2671
|
-
}
|
|
2672
|
-
}
|
|
2673
|
-
if (trap) {
|
|
2674
|
-
lastActiveFocus = null;
|
|
2675
|
-
if (!sameTrap || lastTrap.observed !== trap.observed) {
|
|
2676
|
-
trap.onActivation(focusLockAPI);
|
|
2677
|
-
}
|
|
2678
|
-
activateTrap();
|
|
2679
|
-
deferAction$1(activateTrap);
|
|
2680
|
-
} else {
|
|
2681
|
-
detachHandler();
|
|
2682
|
-
lastActiveFocus = null;
|
|
2683
|
-
}
|
|
2684
|
-
}
|
|
2685
|
-
mediumFocus$1.assignSyncMedium(onFocus);
|
|
2686
|
-
mediumBlur$1.assignMedium(onBlur);
|
|
2687
|
-
mediumEffect$1.assignMedium(function(cb) {
|
|
2688
|
-
return cb(focusLockAPI);
|
|
2689
|
-
});
|
|
2690
|
-
const FocusTrap = withSideEffect(reducePropsToState, handleStateChangeOnClient)(FocusWatcher);
|
|
2691
|
-
var FocusLockCombination = /* @__PURE__ */ React.forwardRef(function FocusLockUICombination(props, ref) {
|
|
2692
|
-
return /* @__PURE__ */ React.createElement(FocusLock, _extends$1({
|
|
2693
|
-
sideCar: FocusTrap,
|
|
2694
|
-
ref
|
|
2695
|
-
}, props));
|
|
2696
|
-
});
|
|
2697
|
-
var _ref = FocusLock.propTypes || {};
|
|
2698
|
-
_ref.sideCar;
|
|
2699
|
-
var propTypes = _objectWithoutPropertiesLoose$1(_ref, ["sideCar"]);
|
|
2700
|
-
FocusLockCombination.propTypes = process.env.NODE_ENV !== "production" ? propTypes : {};
|
|
2701
|
-
var zeroRightClassName = "right-scroll-bar-position";
|
|
2702
|
-
var fullWidthClassName = "width-before-scroll-bar";
|
|
2703
|
-
var noScrollbarsClassName = "with-scroll-bars-hidden";
|
|
2704
|
-
var removedBarSizeVariable = "--removed-body-scroll-bar-size";
|
|
2705
|
-
var effectCar = createSidecarMedium();
|
|
2706
|
-
var nothing = function() {
|
|
2707
|
-
return;
|
|
2708
|
-
};
|
|
2709
|
-
var RemoveScroll = React__namespace.forwardRef(function(props, parentRef) {
|
|
2710
|
-
var ref = React__namespace.useRef(null);
|
|
2711
|
-
var _a = React__namespace.useState({
|
|
2712
|
-
onScrollCapture: nothing,
|
|
2713
|
-
onWheelCapture: nothing,
|
|
2714
|
-
onTouchMoveCapture: nothing
|
|
2715
|
-
}), callbacks = _a[0], setCallbacks = _a[1];
|
|
2716
|
-
var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? "div" : _b, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
|
|
2717
|
-
var SideCar2 = sideCar;
|
|
2718
|
-
var containerRef = useMergeRefs([ref, parentRef]);
|
|
2719
|
-
var containerProps = __assign(__assign({}, rest), callbacks);
|
|
2720
|
-
return React__namespace.createElement(
|
|
2721
|
-
React__namespace.Fragment,
|
|
2722
|
-
null,
|
|
2723
|
-
enabled && React__namespace.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
|
|
2724
|
-
forwardProps ? React__namespace.cloneElement(React__namespace.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React__namespace.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
|
|
2725
|
-
);
|
|
2726
|
-
});
|
|
2727
|
-
RemoveScroll.defaultProps = {
|
|
2728
|
-
enabled: true,
|
|
2729
|
-
removeScrollBar: true,
|
|
2730
|
-
inert: false
|
|
2731
|
-
};
|
|
2732
|
-
RemoveScroll.classNames = {
|
|
2733
|
-
fullWidth: fullWidthClassName,
|
|
2734
|
-
zeroRight: zeroRightClassName
|
|
2735
|
-
};
|
|
2736
|
-
var getNonce = function() {
|
|
2737
|
-
if (typeof __webpack_nonce__ !== "undefined") {
|
|
2738
|
-
return __webpack_nonce__;
|
|
2739
|
-
}
|
|
2740
|
-
return void 0;
|
|
2741
|
-
};
|
|
2742
|
-
function makeStyleTag() {
|
|
2743
|
-
if (!document)
|
|
2744
|
-
return null;
|
|
2745
|
-
var tag = document.createElement("style");
|
|
2746
|
-
tag.type = "text/css";
|
|
2747
|
-
var nonce = getNonce();
|
|
2748
|
-
if (nonce) {
|
|
2749
|
-
tag.setAttribute("nonce", nonce);
|
|
2750
|
-
}
|
|
2751
|
-
return tag;
|
|
2752
|
-
}
|
|
2753
|
-
function injectStyles(tag, css) {
|
|
2754
|
-
if (tag.styleSheet) {
|
|
2755
|
-
tag.styleSheet.cssText = css;
|
|
2756
|
-
} else {
|
|
2757
|
-
tag.appendChild(document.createTextNode(css));
|
|
2758
|
-
}
|
|
2759
|
-
}
|
|
2760
|
-
function insertStyleTag(tag) {
|
|
2761
|
-
var head = document.head || document.getElementsByTagName("head")[0];
|
|
2762
|
-
head.appendChild(tag);
|
|
2763
|
-
}
|
|
2764
|
-
var stylesheetSingleton = function() {
|
|
2765
|
-
var counter = 0;
|
|
2766
|
-
var stylesheet = null;
|
|
2767
|
-
return {
|
|
2768
|
-
add: function(style) {
|
|
2769
|
-
if (counter == 0) {
|
|
2770
|
-
if (stylesheet = makeStyleTag()) {
|
|
2771
|
-
injectStyles(stylesheet, style);
|
|
2772
|
-
insertStyleTag(stylesheet);
|
|
2773
|
-
}
|
|
2774
|
-
}
|
|
2775
|
-
counter++;
|
|
2776
|
-
},
|
|
2777
|
-
remove: function() {
|
|
2778
|
-
counter--;
|
|
2779
|
-
if (!counter && stylesheet) {
|
|
2780
|
-
stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
|
|
2781
|
-
stylesheet = null;
|
|
2782
|
-
}
|
|
2783
|
-
}
|
|
2784
|
-
};
|
|
2785
|
-
};
|
|
2786
|
-
var styleHookSingleton = function() {
|
|
2787
|
-
var sheet = stylesheetSingleton();
|
|
2788
|
-
return function(styles, isDynamic) {
|
|
2789
|
-
React__namespace.useEffect(function() {
|
|
2790
|
-
sheet.add(styles);
|
|
2791
|
-
return function() {
|
|
2792
|
-
sheet.remove();
|
|
2793
|
-
};
|
|
2794
|
-
}, [styles && isDynamic]);
|
|
2795
|
-
};
|
|
2796
|
-
};
|
|
2797
|
-
var styleSingleton = function() {
|
|
2798
|
-
var useStyle = styleHookSingleton();
|
|
2799
|
-
var Sheet = function(_a) {
|
|
2800
|
-
var styles = _a.styles, dynamic = _a.dynamic;
|
|
2801
|
-
useStyle(styles, dynamic);
|
|
2802
|
-
return null;
|
|
2803
|
-
};
|
|
2804
|
-
return Sheet;
|
|
2805
|
-
};
|
|
2806
|
-
var zeroGap = {
|
|
2807
|
-
left: 0,
|
|
2808
|
-
top: 0,
|
|
2809
|
-
right: 0,
|
|
2810
|
-
gap: 0
|
|
2811
|
-
};
|
|
2812
|
-
var parse = function(x) {
|
|
2813
|
-
return parseInt(x || "", 10) || 0;
|
|
2814
|
-
};
|
|
2815
|
-
var getOffset = function(gapMode) {
|
|
2816
|
-
var cs = window.getComputedStyle(document.body);
|
|
2817
|
-
var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
|
|
2818
|
-
var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
|
|
2819
|
-
var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
|
|
2820
|
-
return [parse(left), parse(top), parse(right)];
|
|
2821
|
-
};
|
|
2822
|
-
var getGapWidth = function(gapMode) {
|
|
2823
|
-
if (gapMode === void 0) {
|
|
2824
|
-
gapMode = "margin";
|
|
2825
|
-
}
|
|
2826
|
-
if (typeof window === "undefined") {
|
|
2827
|
-
return zeroGap;
|
|
2828
|
-
}
|
|
2829
|
-
var offsets = getOffset(gapMode);
|
|
2830
|
-
var documentWidth = document.documentElement.clientWidth;
|
|
2831
|
-
var windowWidth = window.innerWidth;
|
|
2832
|
-
return {
|
|
2833
|
-
left: offsets[0],
|
|
2834
|
-
top: offsets[1],
|
|
2835
|
-
right: offsets[2],
|
|
2836
|
-
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
|
|
2837
|
-
};
|
|
2838
|
-
};
|
|
2839
|
-
var Style = styleSingleton();
|
|
2840
|
-
var lockAttribute = "data-scroll-locked";
|
|
2841
|
-
var getStyles = function(_a, allowRelative, gapMode, important) {
|
|
2842
|
-
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
|
|
2843
|
-
if (gapMode === void 0) {
|
|
2844
|
-
gapMode = "margin";
|
|
2845
|
-
}
|
|
2846
|
-
return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
|
|
2847
|
-
allowRelative && "position: relative ".concat(important, ";"),
|
|
2848
|
-
gapMode === "margin" && "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
|
|
2849
|
-
gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
|
|
2850
|
-
].filter(Boolean).join(""), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
|
|
2851
|
-
};
|
|
2852
|
-
var getCurrentUseCounter = function() {
|
|
2853
|
-
var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
|
|
2854
|
-
return isFinite(counter) ? counter : 0;
|
|
2855
|
-
};
|
|
2856
|
-
var useLockAttribute = function() {
|
|
2857
|
-
React__namespace.useEffect(function() {
|
|
2858
|
-
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
2859
|
-
return function() {
|
|
2860
|
-
var newCounter = getCurrentUseCounter() - 1;
|
|
2861
|
-
if (newCounter <= 0) {
|
|
2862
|
-
document.body.removeAttribute(lockAttribute);
|
|
2863
|
-
} else {
|
|
2864
|
-
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
2865
|
-
}
|
|
2866
|
-
};
|
|
2867
|
-
}, []);
|
|
2868
|
-
};
|
|
2869
|
-
var RemoveScrollBar = function(_a) {
|
|
2870
|
-
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
|
|
2871
|
-
useLockAttribute();
|
|
2872
|
-
var gap = React__namespace.useMemo(function() {
|
|
2873
|
-
return getGapWidth(gapMode);
|
|
2874
|
-
}, [gapMode]);
|
|
2875
|
-
return React__namespace.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
|
|
2876
|
-
};
|
|
2877
|
-
var passiveSupported = false;
|
|
2878
|
-
if (typeof window !== "undefined") {
|
|
2879
|
-
try {
|
|
2880
|
-
var options = Object.defineProperty({}, "passive", {
|
|
2881
|
-
get: function() {
|
|
2882
|
-
passiveSupported = true;
|
|
2883
|
-
return true;
|
|
2884
|
-
}
|
|
2885
|
-
});
|
|
2886
|
-
window.addEventListener("test", options, options);
|
|
2887
|
-
window.removeEventListener("test", options, options);
|
|
2888
|
-
} catch (err) {
|
|
2889
|
-
passiveSupported = false;
|
|
2890
|
-
}
|
|
2891
|
-
}
|
|
2892
|
-
var nonPassive = passiveSupported ? { passive: false } : false;
|
|
2893
|
-
var alwaysContainsScroll = function(node) {
|
|
2894
|
-
return node.tagName === "TEXTAREA";
|
|
2895
|
-
};
|
|
2896
|
-
var elementCanBeScrolled = function(node, overflow) {
|
|
2897
|
-
if (!(node instanceof Element)) {
|
|
2898
|
-
return false;
|
|
2899
|
-
}
|
|
2900
|
-
var styles = window.getComputedStyle(node);
|
|
2901
|
-
return (
|
|
2902
|
-
// not-not-scrollable
|
|
2903
|
-
styles[overflow] !== "hidden" && // contains scroll inside self
|
|
2904
|
-
!(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
|
|
2905
|
-
);
|
|
2906
|
-
};
|
|
2907
|
-
var elementCouldBeVScrolled = function(node) {
|
|
2908
|
-
return elementCanBeScrolled(node, "overflowY");
|
|
2909
|
-
};
|
|
2910
|
-
var elementCouldBeHScrolled = function(node) {
|
|
2911
|
-
return elementCanBeScrolled(node, "overflowX");
|
|
2912
|
-
};
|
|
2913
|
-
var locationCouldBeScrolled = function(axis, node) {
|
|
2914
|
-
var ownerDocument = node.ownerDocument;
|
|
2915
|
-
var current = node;
|
|
2916
|
-
do {
|
|
2917
|
-
if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
|
|
2918
|
-
current = current.host;
|
|
2919
|
-
}
|
|
2920
|
-
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
2921
|
-
if (isScrollable) {
|
|
2922
|
-
var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
|
|
2923
|
-
if (scrollHeight > clientHeight) {
|
|
2924
|
-
return true;
|
|
2925
|
-
}
|
|
2926
|
-
}
|
|
2927
|
-
current = current.parentNode;
|
|
2928
|
-
} while (current && current !== ownerDocument.body);
|
|
2929
|
-
return false;
|
|
2930
|
-
};
|
|
2931
|
-
var getVScrollVariables = function(_a) {
|
|
2932
|
-
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
2933
|
-
return [
|
|
2934
|
-
scrollTop,
|
|
2935
|
-
scrollHeight,
|
|
2936
|
-
clientHeight
|
|
2937
|
-
];
|
|
2938
|
-
};
|
|
2939
|
-
var getHScrollVariables = function(_a) {
|
|
2940
|
-
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
2941
|
-
return [
|
|
2942
|
-
scrollLeft,
|
|
2943
|
-
scrollWidth,
|
|
2944
|
-
clientWidth
|
|
2945
|
-
];
|
|
2946
|
-
};
|
|
2947
|
-
var elementCouldBeScrolled = function(axis, node) {
|
|
2948
|
-
return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
2949
|
-
};
|
|
2950
|
-
var getScrollVariables = function(axis, node) {
|
|
2951
|
-
return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
2952
|
-
};
|
|
2953
|
-
var getDirectionFactor = function(axis, direction) {
|
|
2954
|
-
return axis === "h" && direction === "rtl" ? -1 : 1;
|
|
2955
|
-
};
|
|
2956
|
-
var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
2957
|
-
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
2958
|
-
var delta = directionFactor * sourceDelta;
|
|
2959
|
-
var target = event.target;
|
|
2960
|
-
var targetInLock = endTarget.contains(target);
|
|
2961
|
-
var shouldCancelScroll = false;
|
|
2962
|
-
var isDeltaPositive = delta > 0;
|
|
2963
|
-
var availableScroll = 0;
|
|
2964
|
-
var availableScrollTop = 0;
|
|
2965
|
-
do {
|
|
2966
|
-
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
2967
|
-
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
2968
|
-
if (position || elementScroll) {
|
|
2969
|
-
if (elementCouldBeScrolled(axis, target)) {
|
|
2970
|
-
availableScroll += elementScroll;
|
|
2971
|
-
availableScrollTop += position;
|
|
2972
|
-
}
|
|
2973
|
-
}
|
|
2974
|
-
if (target instanceof ShadowRoot) {
|
|
2975
|
-
target = target.host;
|
|
2976
|
-
} else {
|
|
2977
|
-
target = target.parentNode;
|
|
2978
|
-
}
|
|
2979
|
-
} while (
|
|
2980
|
-
// portaled content
|
|
2981
|
-
!targetInLock && target !== document.body || // self content
|
|
2982
|
-
targetInLock && (endTarget.contains(target) || endTarget === target)
|
|
2983
|
-
);
|
|
2984
|
-
if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
|
|
2985
|
-
shouldCancelScroll = true;
|
|
2986
|
-
} else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
|
|
2987
|
-
shouldCancelScroll = true;
|
|
2988
|
-
}
|
|
2989
|
-
return shouldCancelScroll;
|
|
2990
|
-
};
|
|
2991
|
-
var getTouchXY = function(event) {
|
|
2992
|
-
return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
|
|
2993
|
-
};
|
|
2994
|
-
var getDeltaXY = function(event) {
|
|
2995
|
-
return [event.deltaX, event.deltaY];
|
|
2996
|
-
};
|
|
2997
|
-
var extractRef$1 = function(ref) {
|
|
2998
|
-
return ref && "current" in ref ? ref.current : ref;
|
|
2999
|
-
};
|
|
3000
|
-
var deltaCompare = function(x, y) {
|
|
3001
|
-
return x[0] === y[0] && x[1] === y[1];
|
|
3002
|
-
};
|
|
3003
|
-
var generateStyle = function(id) {
|
|
3004
|
-
return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
|
|
3005
|
-
};
|
|
3006
|
-
var idCounter = 0;
|
|
3007
|
-
var lockStack = [];
|
|
3008
|
-
function RemoveScrollSideCar(props) {
|
|
3009
|
-
var shouldPreventQueue = React__namespace.useRef([]);
|
|
3010
|
-
var touchStartRef = React__namespace.useRef([0, 0]);
|
|
3011
|
-
var activeAxis = React__namespace.useRef();
|
|
3012
|
-
var id = React__namespace.useState(idCounter++)[0];
|
|
3013
|
-
var Style2 = React__namespace.useState(styleSingleton)[0];
|
|
3014
|
-
var lastProps = React__namespace.useRef(props);
|
|
3015
|
-
React__namespace.useEffect(function() {
|
|
3016
|
-
lastProps.current = props;
|
|
3017
|
-
}, [props]);
|
|
3018
|
-
React__namespace.useEffect(function() {
|
|
3019
|
-
if (props.inert) {
|
|
3020
|
-
document.body.classList.add("block-interactivity-".concat(id));
|
|
3021
|
-
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef$1), true).filter(Boolean);
|
|
3022
|
-
allow_1.forEach(function(el) {
|
|
3023
|
-
return el.classList.add("allow-interactivity-".concat(id));
|
|
3024
|
-
});
|
|
3025
|
-
return function() {
|
|
3026
|
-
document.body.classList.remove("block-interactivity-".concat(id));
|
|
3027
|
-
allow_1.forEach(function(el) {
|
|
3028
|
-
return el.classList.remove("allow-interactivity-".concat(id));
|
|
3029
|
-
});
|
|
3030
|
-
};
|
|
3031
|
-
}
|
|
3032
|
-
return;
|
|
3033
|
-
}, [props.inert, props.lockRef.current, props.shards]);
|
|
3034
|
-
var shouldCancelEvent = React__namespace.useCallback(function(event, parent) {
|
|
3035
|
-
if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
|
|
3036
|
-
return !lastProps.current.allowPinchZoom;
|
|
3037
|
-
}
|
|
3038
|
-
var touch = getTouchXY(event);
|
|
3039
|
-
var touchStart = touchStartRef.current;
|
|
3040
|
-
var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
|
|
3041
|
-
var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
|
|
3042
|
-
var currentAxis;
|
|
3043
|
-
var target = event.target;
|
|
3044
|
-
var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
|
|
3045
|
-
if ("touches" in event && moveDirection === "h" && target.type === "range") {
|
|
3046
|
-
return false;
|
|
3047
|
-
}
|
|
3048
|
-
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
3049
|
-
if (!canBeScrolledInMainDirection) {
|
|
3050
|
-
return true;
|
|
3051
|
-
}
|
|
3052
|
-
if (canBeScrolledInMainDirection) {
|
|
3053
|
-
currentAxis = moveDirection;
|
|
3054
|
-
} else {
|
|
3055
|
-
currentAxis = moveDirection === "v" ? "h" : "v";
|
|
3056
|
-
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
3057
|
-
}
|
|
3058
|
-
if (!canBeScrolledInMainDirection) {
|
|
3059
|
-
return false;
|
|
3060
|
-
}
|
|
3061
|
-
if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
|
|
3062
|
-
activeAxis.current = currentAxis;
|
|
3063
|
-
}
|
|
3064
|
-
if (!currentAxis) {
|
|
3065
|
-
return true;
|
|
3066
|
-
}
|
|
3067
|
-
var cancelingAxis = activeAxis.current || currentAxis;
|
|
3068
|
-
return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY);
|
|
3069
|
-
}, []);
|
|
3070
|
-
var shouldPrevent = React__namespace.useCallback(function(_event) {
|
|
3071
|
-
var event = _event;
|
|
3072
|
-
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
|
|
3073
|
-
return;
|
|
3074
|
-
}
|
|
3075
|
-
var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
|
|
3076
|
-
var sourceEvent = shouldPreventQueue.current.filter(function(e) {
|
|
3077
|
-
return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
|
|
3078
|
-
})[0];
|
|
3079
|
-
if (sourceEvent && sourceEvent.should) {
|
|
3080
|
-
if (event.cancelable) {
|
|
3081
|
-
event.preventDefault();
|
|
3082
|
-
}
|
|
3083
|
-
return;
|
|
3084
|
-
}
|
|
3085
|
-
if (!sourceEvent) {
|
|
3086
|
-
var shardNodes = (lastProps.current.shards || []).map(extractRef$1).filter(Boolean).filter(function(node) {
|
|
3087
|
-
return node.contains(event.target);
|
|
3088
|
-
});
|
|
3089
|
-
var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
|
|
3090
|
-
if (shouldStop) {
|
|
3091
|
-
if (event.cancelable) {
|
|
3092
|
-
event.preventDefault();
|
|
3093
|
-
}
|
|
3094
|
-
}
|
|
3095
|
-
}
|
|
3096
|
-
}, []);
|
|
3097
|
-
var shouldCancel = React__namespace.useCallback(function(name, delta, target, should) {
|
|
3098
|
-
var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
|
|
3099
|
-
shouldPreventQueue.current.push(event);
|
|
3100
|
-
setTimeout(function() {
|
|
3101
|
-
shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
|
|
3102
|
-
return e !== event;
|
|
3103
|
-
});
|
|
3104
|
-
}, 1);
|
|
3105
|
-
}, []);
|
|
3106
|
-
var scrollTouchStart = React__namespace.useCallback(function(event) {
|
|
3107
|
-
touchStartRef.current = getTouchXY(event);
|
|
3108
|
-
activeAxis.current = void 0;
|
|
3109
|
-
}, []);
|
|
3110
|
-
var scrollWheel = React__namespace.useCallback(function(event) {
|
|
3111
|
-
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
3112
|
-
}, []);
|
|
3113
|
-
var scrollTouchMove = React__namespace.useCallback(function(event) {
|
|
3114
|
-
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
3115
|
-
}, []);
|
|
3116
|
-
React__namespace.useEffect(function() {
|
|
3117
|
-
lockStack.push(Style2);
|
|
3118
|
-
props.setCallbacks({
|
|
3119
|
-
onScrollCapture: scrollWheel,
|
|
3120
|
-
onWheelCapture: scrollWheel,
|
|
3121
|
-
onTouchMoveCapture: scrollTouchMove
|
|
3122
|
-
});
|
|
3123
|
-
document.addEventListener("wheel", shouldPrevent, nonPassive);
|
|
3124
|
-
document.addEventListener("touchmove", shouldPrevent, nonPassive);
|
|
3125
|
-
document.addEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
3126
|
-
return function() {
|
|
3127
|
-
lockStack = lockStack.filter(function(inst) {
|
|
3128
|
-
return inst !== Style2;
|
|
3129
|
-
});
|
|
3130
|
-
document.removeEventListener("wheel", shouldPrevent, nonPassive);
|
|
3131
|
-
document.removeEventListener("touchmove", shouldPrevent, nonPassive);
|
|
3132
|
-
document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
3133
|
-
};
|
|
3134
|
-
}, []);
|
|
3135
|
-
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
3136
|
-
return React__namespace.createElement(
|
|
3137
|
-
React__namespace.Fragment,
|
|
3138
|
-
null,
|
|
3139
|
-
inert ? React__namespace.createElement(Style2, { styles: generateStyle(id) }) : null,
|
|
3140
|
-
removeScrollBar ? React__namespace.createElement(RemoveScrollBar, { gapMode: props.gapMode }) : null
|
|
3141
|
-
);
|
|
3142
|
-
}
|
|
3143
|
-
function getOutermostShadowParent(node) {
|
|
3144
|
-
var shadowParent = null;
|
|
3145
|
-
while (node !== null) {
|
|
3146
|
-
if (node instanceof ShadowRoot) {
|
|
3147
|
-
shadowParent = node.host;
|
|
3148
|
-
node = node.host;
|
|
3149
|
-
}
|
|
3150
|
-
node = node.parentNode;
|
|
3151
|
-
}
|
|
3152
|
-
return shadowParent;
|
|
3153
|
-
}
|
|
3154
|
-
const SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
3155
|
-
var ReactRemoveScroll = React__namespace.forwardRef(function(props, ref) {
|
|
3156
|
-
return React__namespace.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: SideCar }));
|
|
3157
|
-
});
|
|
3158
|
-
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
3159
|
-
function _extends() {
|
|
3160
|
-
_extends = Object.assign || function(target) {
|
|
3161
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
3162
|
-
var source = arguments[i];
|
|
3163
|
-
for (var key in source) {
|
|
3164
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
3165
|
-
target[key] = source[key];
|
|
3166
|
-
}
|
|
3167
|
-
}
|
|
3168
|
-
}
|
|
3169
|
-
return target;
|
|
3170
|
-
};
|
|
3171
|
-
return _extends.apply(this, arguments);
|
|
3172
|
-
}
|
|
3173
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
3174
|
-
if (source == null) return {};
|
|
3175
|
-
var target = {};
|
|
3176
|
-
var sourceKeys = Object.keys(source);
|
|
3177
|
-
var key, i;
|
|
3178
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
3179
|
-
key = sourceKeys[i];
|
|
3180
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
3181
|
-
target[key] = source[key];
|
|
3182
|
-
}
|
|
3183
|
-
return target;
|
|
3184
|
-
}
|
|
3185
|
-
var _excluded = ["as", "isOpen"], _excluded2 = ["allowPinchZoom", "as", "dangerouslyBypassFocusLock", "dangerouslyBypassScrollLock", "initialFocusRef", "onClick", "onDismiss", "onKeyDown", "onMouseDown", "unstable_lockFocusAcrossFrames"], _excluded3 = ["as", "onClick", "onKeyDown"], _excluded4 = ["allowPinchZoom", "initialFocusRef", "isOpen", "onDismiss"];
|
|
3186
|
-
var overlayPropTypes = {
|
|
3187
|
-
allowPinchZoom: PropTypes.bool,
|
|
3188
|
-
dangerouslyBypassFocusLock: PropTypes.bool,
|
|
3189
|
-
dangerouslyBypassScrollLock: PropTypes.bool,
|
|
3190
|
-
// TODO:
|
|
3191
|
-
initialFocusRef: function initialFocusRef() {
|
|
3192
|
-
return null;
|
|
3193
|
-
},
|
|
3194
|
-
onDismiss: PropTypes.func
|
|
3195
|
-
};
|
|
3196
|
-
var DialogOverlay = /* @__PURE__ */ React.forwardRef(function DialogOverlay2(_ref2, forwardedRef) {
|
|
3197
|
-
var _ref$as = _ref2.as, Comp = _ref$as === void 0 ? "div" : _ref$as, _ref$isOpen = _ref2.isOpen, isOpen = _ref$isOpen === void 0 ? true : _ref$isOpen, props = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
3198
|
-
useCheckStyles("dialog");
|
|
3199
|
-
React.useEffect(function() {
|
|
3200
|
-
if (isOpen) {
|
|
3201
|
-
window.__REACH_DISABLE_TOOLTIPS = true;
|
|
3202
|
-
} else {
|
|
3203
|
-
window.requestAnimationFrame(function() {
|
|
3204
|
-
window.__REACH_DISABLE_TOOLTIPS = false;
|
|
3205
|
-
});
|
|
3206
|
-
}
|
|
3207
|
-
}, [isOpen]);
|
|
3208
|
-
return isOpen ? /* @__PURE__ */ React.createElement(Portal, {
|
|
3209
|
-
"data-reach-dialog-wrapper": ""
|
|
3210
|
-
}, /* @__PURE__ */ React.createElement(DialogInner, _extends({
|
|
3211
|
-
ref: forwardedRef,
|
|
3212
|
-
as: Comp
|
|
3213
|
-
}, props))) : null;
|
|
3214
|
-
});
|
|
3215
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3216
|
-
DialogOverlay.displayName = "DialogOverlay";
|
|
3217
|
-
DialogOverlay.propTypes = /* @__PURE__ */ _extends({}, overlayPropTypes, {
|
|
3218
|
-
isOpen: PropTypes.bool
|
|
3219
|
-
});
|
|
3220
|
-
}
|
|
3221
|
-
var DialogInner = /* @__PURE__ */ React.forwardRef(function DialogInner2(_ref2, forwardedRef) {
|
|
3222
|
-
var allowPinchZoom = _ref2.allowPinchZoom, _ref2$as = _ref2.as, Comp = _ref2$as === void 0 ? "div" : _ref2$as, _ref2$dangerouslyBypa = _ref2.dangerouslyBypassFocusLock, dangerouslyBypassFocusLock = _ref2$dangerouslyBypa === void 0 ? false : _ref2$dangerouslyBypa, _ref2$dangerouslyBypa2 = _ref2.dangerouslyBypassScrollLock, dangerouslyBypassScrollLock = _ref2$dangerouslyBypa2 === void 0 ? false : _ref2$dangerouslyBypa2, initialFocusRef2 = _ref2.initialFocusRef, onClick = _ref2.onClick, _ref2$onDismiss = _ref2.onDismiss, onDismiss = _ref2$onDismiss === void 0 ? noop : _ref2$onDismiss, onKeyDown = _ref2.onKeyDown, onMouseDown = _ref2.onMouseDown, unstable_lockFocusAcrossFrames = _ref2.unstable_lockFocusAcrossFrames, props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
3223
|
-
var lockFocusAcrossFramesIsDefined = unstable_lockFocusAcrossFrames !== void 0;
|
|
3224
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3225
|
-
React.useEffect(function() {
|
|
3226
|
-
if (lockFocusAcrossFramesIsDefined) {
|
|
3227
|
-
console.warn("The unstable_lockFocusAcrossFrames in @reach/dialog is deprecated. It will be removed in the next minor release.");
|
|
3228
|
-
}
|
|
3229
|
-
}, [lockFocusAcrossFramesIsDefined]);
|
|
3230
|
-
}
|
|
3231
|
-
var mouseDownTarget = React.useRef(null);
|
|
3232
|
-
var overlayNode = React.useRef(null);
|
|
3233
|
-
var ref = useComposedRefs(overlayNode, forwardedRef);
|
|
3234
|
-
var activateFocusLock = React.useCallback(function() {
|
|
3235
|
-
if (initialFocusRef2 && initialFocusRef2.current) {
|
|
3236
|
-
initialFocusRef2.current.focus();
|
|
3237
|
-
}
|
|
3238
|
-
}, [initialFocusRef2]);
|
|
3239
|
-
function handleClick(event) {
|
|
3240
|
-
if (mouseDownTarget.current === event.target) {
|
|
3241
|
-
event.stopPropagation();
|
|
3242
|
-
onDismiss(event);
|
|
3243
|
-
}
|
|
3244
|
-
}
|
|
3245
|
-
function handleKeyDown(event) {
|
|
3246
|
-
if (event.key === "Escape") {
|
|
3247
|
-
event.stopPropagation();
|
|
3248
|
-
onDismiss(event);
|
|
3249
|
-
}
|
|
3250
|
-
}
|
|
3251
|
-
function handleMouseDown(event) {
|
|
3252
|
-
mouseDownTarget.current = event.target;
|
|
3253
|
-
}
|
|
3254
|
-
React.useEffect(function() {
|
|
3255
|
-
return overlayNode.current ? createAriaHider(overlayNode.current) : void 0;
|
|
3256
|
-
}, []);
|
|
3257
|
-
return /* @__PURE__ */ React.createElement(FocusLockCombination, {
|
|
3258
|
-
autoFocus: true,
|
|
3259
|
-
returnFocus: true,
|
|
3260
|
-
onActivation: activateFocusLock,
|
|
3261
|
-
disabled: dangerouslyBypassFocusLock,
|
|
3262
|
-
crossFrame: unstable_lockFocusAcrossFrames != null ? unstable_lockFocusAcrossFrames : true
|
|
3263
|
-
}, /* @__PURE__ */ React.createElement(ReactRemoveScroll, {
|
|
3264
|
-
allowPinchZoom,
|
|
3265
|
-
enabled: !dangerouslyBypassScrollLock
|
|
3266
|
-
}, /* @__PURE__ */ React.createElement(Comp, _extends({}, props, {
|
|
3267
|
-
ref,
|
|
3268
|
-
"data-reach-dialog-overlay": "",
|
|
3269
|
-
onClick: composeEventHandlers(onClick, handleClick),
|
|
3270
|
-
onKeyDown: composeEventHandlers(onKeyDown, handleKeyDown),
|
|
3271
|
-
onMouseDown: composeEventHandlers(onMouseDown, handleMouseDown)
|
|
3272
|
-
}))));
|
|
3273
|
-
});
|
|
3274
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3275
|
-
DialogOverlay.displayName = "DialogOverlay";
|
|
3276
|
-
DialogOverlay.propTypes = /* @__PURE__ */ _extends({}, overlayPropTypes);
|
|
3277
|
-
}
|
|
3278
|
-
var DialogContent = /* @__PURE__ */ React.forwardRef(function DialogContent2(_ref3, forwardedRef) {
|
|
3279
|
-
var _ref3$as = _ref3.as, Comp = _ref3$as === void 0 ? "div" : _ref3$as, onClick = _ref3.onClick;
|
|
3280
|
-
_ref3.onKeyDown;
|
|
3281
|
-
var props = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
3282
|
-
return /* @__PURE__ */ React.createElement(Comp, _extends({
|
|
3283
|
-
"aria-modal": "true",
|
|
3284
|
-
role: "dialog",
|
|
3285
|
-
tabIndex: -1
|
|
3286
|
-
}, props, {
|
|
3287
|
-
ref: forwardedRef,
|
|
3288
|
-
"data-reach-dialog-content": "",
|
|
3289
|
-
onClick: composeEventHandlers(onClick, function(event) {
|
|
3290
|
-
event.stopPropagation();
|
|
3291
|
-
})
|
|
3292
|
-
}));
|
|
3293
|
-
});
|
|
3294
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3295
|
-
DialogContent.displayName = "DialogContent";
|
|
3296
|
-
DialogContent.propTypes = {
|
|
3297
|
-
"aria-label": ariaLabelType,
|
|
3298
|
-
"aria-labelledby": ariaLabelType
|
|
3299
|
-
};
|
|
3300
|
-
}
|
|
3301
|
-
var Dialog = /* @__PURE__ */ React.forwardRef(function Dialog2(_ref4, forwardedRef) {
|
|
3302
|
-
var _ref4$allowPinchZoom = _ref4.allowPinchZoom, allowPinchZoom = _ref4$allowPinchZoom === void 0 ? false : _ref4$allowPinchZoom, initialFocusRef2 = _ref4.initialFocusRef, isOpen = _ref4.isOpen, _ref4$onDismiss = _ref4.onDismiss, onDismiss = _ref4$onDismiss === void 0 ? noop : _ref4$onDismiss, props = _objectWithoutPropertiesLoose(_ref4, _excluded4);
|
|
3303
|
-
return /* @__PURE__ */ React.createElement(DialogOverlay, {
|
|
3304
|
-
allowPinchZoom,
|
|
3305
|
-
initialFocusRef: initialFocusRef2,
|
|
3306
|
-
isOpen,
|
|
3307
|
-
onDismiss
|
|
3308
|
-
}, /* @__PURE__ */ React.createElement(DialogContent, _extends({
|
|
3309
|
-
ref: forwardedRef
|
|
3310
|
-
}, props)));
|
|
3311
|
-
});
|
|
3312
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3313
|
-
Dialog.displayName = "Dialog";
|
|
3314
|
-
Dialog.propTypes = {
|
|
3315
|
-
isOpen: PropTypes.bool,
|
|
3316
|
-
onDismiss: PropTypes.func,
|
|
3317
|
-
"aria-label": ariaLabelType,
|
|
3318
|
-
"aria-labelledby": ariaLabelType
|
|
3319
|
-
};
|
|
3320
|
-
}
|
|
3321
|
-
function createAriaHider(dialogNode) {
|
|
3322
|
-
var originalValues = [];
|
|
3323
|
-
var rootNodes = [];
|
|
3324
|
-
var ownerDocument = getOwnerDocument(dialogNode);
|
|
3325
|
-
if (!dialogNode) {
|
|
3326
|
-
if (process.env.NODE_ENV !== "production") {
|
|
3327
|
-
console.warn("A ref has not yet been attached to a dialog node when attempting to call `createAriaHider`.");
|
|
3328
|
-
}
|
|
3329
|
-
return noop;
|
|
3330
|
-
}
|
|
3331
|
-
Array.prototype.forEach.call(ownerDocument.querySelectorAll("body > *"), function(node) {
|
|
3332
|
-
var _dialogNode$parentNod, _dialogNode$parentNod2;
|
|
3333
|
-
var portalNode = (_dialogNode$parentNod = dialogNode.parentNode) == null ? void 0 : (_dialogNode$parentNod2 = _dialogNode$parentNod.parentNode) == null ? void 0 : _dialogNode$parentNod2.parentNode;
|
|
3334
|
-
if (node === portalNode) {
|
|
3335
|
-
return;
|
|
3336
|
-
}
|
|
3337
|
-
var attr = node.getAttribute("aria-hidden");
|
|
3338
|
-
var alreadyHidden = attr !== null && attr !== "false";
|
|
3339
|
-
if (alreadyHidden) {
|
|
3340
|
-
return;
|
|
3341
|
-
}
|
|
3342
|
-
originalValues.push(attr);
|
|
3343
|
-
rootNodes.push(node);
|
|
3344
|
-
node.setAttribute("aria-hidden", "true");
|
|
3345
|
-
});
|
|
3346
|
-
return function() {
|
|
3347
|
-
rootNodes.forEach(function(node, index) {
|
|
3348
|
-
var originalValue = originalValues[index];
|
|
3349
|
-
if (originalValue === null) {
|
|
3350
|
-
node.removeAttribute("aria-hidden");
|
|
3351
|
-
} else {
|
|
3352
|
-
node.setAttribute("aria-hidden", originalValue);
|
|
3353
|
-
}
|
|
3354
|
-
});
|
|
3355
|
-
};
|
|
3356
|
-
}
|
|
3357
|
-
function ariaLabelType(props, propName, compName, location, propFullName) {
|
|
3358
|
-
var details = "\nSee https://www.w3.org/TR/wai-aria/#aria-label for details.";
|
|
3359
|
-
if (!props["aria-label"] && !props["aria-labelledby"]) {
|
|
3360
|
-
return new Error("A <" + compName + "> must have either an `aria-label` or `aria-labelledby` prop.\n " + details);
|
|
3361
|
-
}
|
|
3362
|
-
if (props["aria-label"] && props["aria-labelledby"]) {
|
|
3363
|
-
return new Error("You provided both `aria-label` and `aria-labelledby` props to a <" + compName + ">. If the a label for this component is visible on the screen, that label's component should be given a unique ID prop, and that ID should be passed as the `aria-labelledby` prop into <" + compName + ">. If the label cannot be determined programmatically from the content of the element, an alternative label should be provided as the `aria-label` prop, which will be used as an `aria-label` on the HTML tag." + details);
|
|
3364
|
-
} else if (props[propName] != null && !isString(props[propName])) {
|
|
3365
|
-
return new Error("Invalid prop `" + propName + "` supplied to `" + compName + "`. Expected `string`, received `" + (Array.isArray(propFullName) ? "array" : typeof propFullName) + "`.");
|
|
3366
|
-
}
|
|
3367
|
-
return null;
|
|
3368
|
-
}
|
|
3369
13
|
const ModalOverlay = ({
|
|
3370
14
|
className,
|
|
3371
15
|
open,
|
|
3372
16
|
...rest
|
|
3373
17
|
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3374
|
-
DialogOverlay,
|
|
18
|
+
dialog.DialogOverlay,
|
|
3375
19
|
{
|
|
3376
20
|
className: classNames("eds-modal__overlay", className),
|
|
3377
21
|
isOpen: open,
|
|
@@ -3396,7 +40,7 @@ const ModalContent = ({
|
|
|
3396
40
|
const Heading = headingsMap[size] || typography.Heading2;
|
|
3397
41
|
const randomId = utils.useRandomId("eds-modal");
|
|
3398
42
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3399
|
-
DialogContent,
|
|
43
|
+
dialog.DialogContent,
|
|
3400
44
|
{
|
|
3401
45
|
className: classNames(
|
|
3402
46
|
"eds-modal__content",
|
|
@@ -3416,7 +60,7 @@ const ModalContent = ({
|
|
|
3416
60
|
const Modal = ({
|
|
3417
61
|
children,
|
|
3418
62
|
closeLabel = "Lukk",
|
|
3419
|
-
initialFocusRef
|
|
63
|
+
initialFocusRef,
|
|
3420
64
|
open,
|
|
3421
65
|
onDismiss,
|
|
3422
66
|
size,
|
|
@@ -3437,7 +81,7 @@ const Modal = ({
|
|
|
3437
81
|
{
|
|
3438
82
|
open,
|
|
3439
83
|
onDismiss: handleOnDismiss,
|
|
3440
|
-
initialFocusRef
|
|
84
|
+
initialFocusRef,
|
|
3441
85
|
children: /* @__PURE__ */ jsxRuntime.jsxs(ModalContent, { size, align, ...rest, children: [
|
|
3442
86
|
showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3443
87
|
button.IconButton,
|
|
@@ -3455,65 +99,6 @@ const Modal = ({
|
|
|
3455
99
|
}
|
|
3456
100
|
);
|
|
3457
101
|
};
|
|
3458
|
-
var FOCUS_GROUP = "data-focus-lock";
|
|
3459
|
-
var FOCUS_DISABLED = "data-focus-lock-disabled";
|
|
3460
|
-
var FOCUS_ALLOW = "data-no-focus-lock";
|
|
3461
|
-
var FOCUS_AUTO = "data-autofocus-inside";
|
|
3462
|
-
var FOCUS_NO_AUTOFOCUS = "data-no-autofocus";
|
|
3463
|
-
var mediumFocus = createMedium({}, function(_ref2) {
|
|
3464
|
-
var target = _ref2.target, currentTarget = _ref2.currentTarget;
|
|
3465
|
-
return {
|
|
3466
|
-
target,
|
|
3467
|
-
currentTarget
|
|
3468
|
-
};
|
|
3469
|
-
});
|
|
3470
|
-
var mediumBlur = createMedium();
|
|
3471
|
-
var mediumEffect = createMedium();
|
|
3472
|
-
var mediumSidecar = createSidecarMedium({
|
|
3473
|
-
async: true,
|
|
3474
|
-
ssr: typeof document !== "undefined"
|
|
3475
|
-
});
|
|
3476
|
-
function deferAction(action) {
|
|
3477
|
-
setTimeout(action, 1);
|
|
3478
|
-
}
|
|
3479
|
-
var inlineProp = function inlineProp2(name, value) {
|
|
3480
|
-
var obj = {};
|
|
3481
|
-
obj[name] = value;
|
|
3482
|
-
return obj;
|
|
3483
|
-
};
|
|
3484
|
-
var extractRef2 = function extractRef3(ref) {
|
|
3485
|
-
return ref && "current" in ref ? ref.current : ref;
|
|
3486
|
-
};
|
|
3487
|
-
var useFocusInside = function useFocusInside2(observedRef) {
|
|
3488
|
-
React.useEffect(function() {
|
|
3489
|
-
var enabled = true;
|
|
3490
|
-
mediumEffect.useMedium(function(car) {
|
|
3491
|
-
var observed = observedRef && observedRef.current;
|
|
3492
|
-
if (enabled && observed) {
|
|
3493
|
-
if (!car.focusInside(observed)) {
|
|
3494
|
-
car.moveFocusInside(observed, null);
|
|
3495
|
-
}
|
|
3496
|
-
}
|
|
3497
|
-
});
|
|
3498
|
-
return function() {
|
|
3499
|
-
enabled = false;
|
|
3500
|
-
};
|
|
3501
|
-
}, [observedRef]);
|
|
3502
|
-
};
|
|
3503
|
-
function MoveFocusInside(_ref2) {
|
|
3504
|
-
var _ref$disabled = _ref2.disabled, isDisabled = _ref$disabled === void 0 ? false : _ref$disabled, className = _ref2.className, children = _ref2.children;
|
|
3505
|
-
var ref = React.useRef(null);
|
|
3506
|
-
useFocusInside(isDisabled ? void 0 : ref);
|
|
3507
|
-
return /* @__PURE__ */ React.createElement("div", _extends$1({}, inlineProp(FOCUS_AUTO, !isDisabled), {
|
|
3508
|
-
ref,
|
|
3509
|
-
className
|
|
3510
|
-
}), children);
|
|
3511
|
-
}
|
|
3512
|
-
MoveFocusInside.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
3513
|
-
children: PropTypes.node.isRequired,
|
|
3514
|
-
disabled: PropTypes.bool,
|
|
3515
|
-
className: PropTypes.string
|
|
3516
|
-
} : {};
|
|
3517
102
|
const Drawer = ({
|
|
3518
103
|
children,
|
|
3519
104
|
className,
|
|
@@ -3536,7 +121,7 @@ const Drawer = ({
|
|
|
3536
121
|
}
|
|
3537
122
|
};
|
|
3538
123
|
const Wrapper = contrast ? layout.Contrast : React.Fragment;
|
|
3539
|
-
const ContentContainer = overlay ? DialogContent : "div";
|
|
124
|
+
const ContentContainer = overlay ? dialog.DialogContent : "div";
|
|
3540
125
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3541
126
|
ConditionalWrapper,
|
|
3542
127
|
{
|
|
@@ -3549,7 +134,7 @@ const Drawer = ({
|
|
|
3549
134
|
className: classNames("eds-drawer", className),
|
|
3550
135
|
onKeyDown: handleKeyDown,
|
|
3551
136
|
style,
|
|
3552
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(MoveFocusInside, { children: [
|
|
137
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(reactFocusLock.MoveFocusInside, { children: [
|
|
3553
138
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3554
139
|
button.IconButton,
|
|
3555
140
|
{
|