@eightshift/ui-components 7.2.0 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Autocomplete-pLMPWMFq.js +451 -0
- package/dist/Button-Biwg7zwt.js +223 -0
- package/dist/Dialog-C1sh8jbh.js +2474 -0
- package/dist/{Disclosure-NYWFw9RJ.js → Disclosure-B_SHgiUz.js} +50 -51
- package/dist/FocusScope-lGkM8AO8.js +734 -0
- package/dist/Form-BxIJCHYd.js +5 -0
- package/dist/Heading-B2EsUuu6.js +16 -0
- package/dist/{Hidden-8TB37dpK.js → Hidden-DYY00jLm.js} +10 -10
- package/dist/I18nProvider-Cm6dj5jY.js +93 -0
- package/dist/Label-B1TkoVOG.js +17 -0
- package/dist/ListBox-BquE0m8z.js +584 -0
- package/dist/{NumberFormatter-m5VW6MTK.js → NumberFormatter-JHF0Tadk.js} +24 -26
- package/dist/PortalProvider-BYcv24il.js +13 -0
- package/dist/RadioGroup-BxjLooWU.js +324 -0
- package/dist/SearchField-BkAU0HLm.js +322 -0
- package/dist/SelectionIndicator-Bx_EYBXD.js +13 -0
- package/dist/{Slider-DW1RuMVp.js → Slider-DSv6fyZ6.js} +321 -363
- package/dist/Text-C8pfwn0W.js +16 -0
- package/dist/{VisuallyHidden-CfsnJHZb.js → VisuallyHidden-KcXlGa5p.js} +12 -12
- package/dist/{animation-Bd2peown.js → animation-BJ-2VKdB.js} +12 -12
- package/dist/assets/fonts/google-sans-flex-latin-ext-full-normal.woff2 +0 -0
- package/dist/assets/fonts/google-sans-flex-latin-full-normal.woff2 +0 -0
- package/dist/assets/fonts/google-sans-flex-symbols-full-normal.woff2 +0 -0
- package/dist/assets/style-admin.css +1 -1
- package/dist/assets/style-editor.css +1 -1
- package/dist/assets/style.css +1 -1
- package/dist/{button-D9cbyHeZ.js → button-CawAzlko.js} +21 -73
- package/dist/{checkbox-BO5RZmO8.js → checkbox-t7VrqXv2.js} +59 -62
- package/dist/{color-swatch-D2ZBkuTt.js → color-swatch-gU09x9Ga.js} +417 -414
- package/dist/components/base-control/base-control.js +2 -2
- package/dist/components/base-control/container.js +1 -1
- package/dist/components/breakpoint-preview/breakpoint-preview.js +1 -1
- package/dist/components/button/button.js +1 -1
- package/dist/components/checkbox/checkbox.js +1 -1
- package/dist/components/color-pickers/color-picker.js +2 -2
- package/dist/components/color-pickers/color-swatch.js +1 -1
- package/dist/components/color-pickers/gradient-editor.js +1 -1
- package/dist/components/color-pickers/solid-color-picker.js +1 -1
- package/dist/components/component-toggle/component-toggle.js +4 -4
- package/dist/components/container-panel/container-panel.js +5 -5
- package/dist/components/draggable/draggable-handle.js +1 -1
- package/dist/components/draggable/draggable.js +1 -1
- package/dist/components/draggable-list/draggable-list-item.js +1 -1
- package/dist/components/draggable-list/draggable-list.js +2 -2
- package/dist/components/expandable/expandable.js +7 -7
- package/dist/components/index.js +15 -15
- package/dist/components/input-field/input-field.js +1 -1
- package/dist/components/item-collection/item-collection.js +1 -1
- package/dist/components/link-input/link-input.js +1 -1
- package/dist/components/matrix-align/matrix-align.js +5 -5
- package/dist/components/menu/menu.js +11 -11
- package/dist/components/modal/modal.js +1 -1
- package/dist/components/number-picker/number-picker.js +1 -1
- package/dist/components/option-select/option-select.js +3 -3
- package/dist/components/options-panel/options-panel.js +3 -3
- package/dist/components/placeholders/file-picker-shell.js +1 -1
- package/dist/components/placeholders/file-placeholder.js +1 -1
- package/dist/components/popover/popover.js +6 -6
- package/dist/components/portal-provider/portal-provider.js +2 -2
- package/dist/components/radio/radio.js +9 -9
- package/dist/components/repeater/repeater-item.js +2 -2
- package/dist/components/repeater/repeater.js +3 -3
- package/dist/components/responsive/mini-responsive.js +6 -6
- package/dist/components/responsive/responsive-legacy.js +5 -5
- package/dist/components/responsive/responsive.js +5 -5
- package/dist/components/responsive-preview/responsive-preview.js +2 -2
- package/dist/components/select/async-multi-select.js +27 -26
- package/dist/components/select/async-select.js +27 -26
- package/dist/components/select/multi-select.js +33 -32
- package/dist/components/select/shared.js +1 -1
- package/dist/components/select/single-select.js +33 -32
- package/dist/components/select/styles.js +1 -1
- package/dist/components/slider/column-config-slider.js +8 -8
- package/dist/components/slider/slider.js +8 -8
- package/dist/components/slider/utils.js +1 -1
- package/dist/components/smart-image/smart-image.js +1 -1
- package/dist/components/tabs/tabs.js +1 -1
- package/dist/components/toggle/switch.js +1 -1
- package/dist/components/toggle/toggle.js +3 -3
- package/dist/components/toggle-button/toggle-button.js +1 -1
- package/dist/components/tooltip/tooltip.js +1 -1
- package/dist/{draggable-CTDVJ4zd.js → draggable-Cxv-OueQ.js} +1 -1
- package/dist/filterDOMProps-BfW758QC.js +69 -0
- package/dist/{gradient-editor-xfxA_s9a.js → gradient-editor-CInqVF8v.js} +6 -11
- package/dist/icons/index.js +1 -1
- package/dist/icons/jsx-svg.js +1 -1
- package/dist/index.js +15 -15
- package/dist/{input-field-_OCWbftf.js → input-field-BdFrxQ-R.js} +46 -47
- package/dist/{jsx-svg-BRJ4n3pD.js → jsx-svg-DT1SBWuP.js} +6 -12
- package/dist/keyboard-CT41mQzR.js +55 -0
- package/dist/{link-input-Bh8G7Urm.js → link-input-BDFhSSvH.js} +324 -356
- package/dist/{modal-snrElwty.js → modal-CJDaBdPh.js} +100 -92
- package/dist/{number-ZZIxJukn.js → number-MWRvGfyE.js} +10 -10
- package/dist/{number-picker-Dhtx4409.js → number-picker-BrxrB-xq.js} +43 -42
- package/dist/{shared-BiWZjrGF.js → shared-CI4kcnm8.js} +482 -502
- package/dist/{smart-image-CBNbxJ57.js → smart-image-eGdMu9s9.js} +2 -2
- package/dist/{solid-color-picker-DukArNH-.js → solid-color-picker-DXgX-OAm.js} +926 -935
- package/dist/{switch-DmsvyQPa.js → switch-DNHFoCCx.js} +28 -28
- package/dist/{tabs-DaIUEc0g.js → tabs-C2tPOEYr.js} +150 -153
- package/dist/textSelection-BhX_2zV9.js +45 -0
- package/dist/{toggle-button-BlzUGfGy.js → toggle-button-DYDp11rq.js} +35 -35
- package/dist/{tooltip-BzJzYlcc.js → tooltip-C-hT6tN9.js} +162 -162
- package/dist/{useAsyncList-BNzwKoX4.js → useAsyncList-DsOh1xIx.js} +54 -74
- package/dist/{useButton-ra1ZSZ4z.js → useButton-BMZc4fTX.js} +11 -11
- package/dist/{SelectionManager-B8lLv6Ue.js → useCollection-CBVYSuGz.js} +1689 -1777
- package/dist/{useEvent-DkZVfgsS.js → useEvent-ypAU33vv.js} +5 -5
- package/dist/useField-BXf__jxy.js +32 -0
- package/dist/{useFilter-OiMnf6sb.js → useFilter-CfKEbIwL.js} +5 -5
- package/dist/{useFocusRing-DuYL4cdO.js → useFocusRing-BgYY-7ko.js} +23 -23
- package/dist/useFormReset-BuMc_O4y.js +17 -0
- package/dist/{FieldError-BWDbP5Db.js → useFormValidation-BcME9D0E.js} +63 -66
- package/dist/useHover-lyApu3ba.js +975 -0
- package/dist/{useLabel-2EohW5l6.js → useLabel-Rv8cIIKk.js} +8 -8
- package/dist/{useLabels-B2p7RXi5.js → useLabels-xOYtkA8o.js} +5 -5
- package/dist/useListState-u6DfeXHi.js +135 -0
- package/dist/{useLocalizedStringFormatter-Dv2diN3k.js → useLocalizedStringFormatter-CR-bmorj.js} +45 -45
- package/dist/{useNumberField-2xbi3jRV.js → useNumberFieldState-xL-ecwNz.js} +665 -619
- package/dist/useNumberFormatter-CR1PAFPG.js +10 -0
- package/dist/useOverlayTriggerState-AeCx45Gv.js +551 -0
- package/dist/usePress-Dnx5rBoD.js +593 -0
- package/dist/useTextField-BW3ZwGyz.js +159 -0
- package/dist/{useToggle-ecIirvIM.js → useToggle-BF5wptMP.js} +19 -20
- package/dist/useToggleState-D5P01lch.js +22 -0
- package/dist/useToolbar-BT25-MJg.js +55 -0
- package/dist/utilities/debounce-throttle.js +1 -1
- package/dist/utilities/es-dash.js +1 -1
- package/dist/utilities/index.js +3 -3
- package/dist/{utils-B_uiqNa4.js → utils-JFcCNFzy.js} +121 -122
- package/package.json +18 -18
- package/dist/Button-h6xF_WrP.js +0 -225
- package/dist/Dialog-i5VLQw1o.js +0 -2488
- package/dist/FocusScope-CgwbGOBB.js +0 -746
- package/dist/Form-DTMkbrQY.js +0 -5
- package/dist/Heading-Hol-wS_B.js +0 -16
- package/dist/Input-BURqyJXW.js +0 -161
- package/dist/Label-DFXXxMKY.js +0 -17
- package/dist/ListBox-B21SgugS.js +0 -601
- package/dist/OverlayArrow-BoloUPQM.js +0 -573
- package/dist/PortalProvider-DinZZCKX.js +0 -14
- package/dist/RSPContexts-C_z0bI8W.js +0 -12
- package/dist/RadioGroup-BwlGtCja.js +0 -329
- package/dist/SearchField-DR_I4_yn.js +0 -765
- package/dist/SelectionIndicator-31L6EI9F.js +0 -13
- package/dist/Text-O6VBBDlP.js +0 -16
- package/dist/context-C-XNeJ_l.js +0 -93
- package/dist/filterDOMProps-_2_3GD-K.js +0 -69
- package/dist/textSelection-Dv6WPj0Z.js +0 -45
- package/dist/useField-D0WrzR2F.js +0 -32
- package/dist/useFormReset-DdkykzAn.js +0 -18
- package/dist/useHover-qaMm3XFO.js +0 -982
- package/dist/useListState-CD_5vfyy.js +0 -147
- package/dist/useNumberFormatter-C2Cm2mNj.js +0 -10
- package/dist/usePress-ZP1TjkFf.js +0 -678
- package/dist/useToggleState-IIDbiKPl.js +0 -23
- /package/dist/{List-DWlgW2Ex.js → List---tsVJlI.js} +0 -0
- /package/dist/{build-module-Bsx62nlm.js → build-module-K6vi4xE0.js} +0 -0
- /package/dist/{debounce-throttle-DXxSAKpq.js → debounce-throttle-LSPAPFtq.js} +0 -0
- /package/dist/{dist-2gkv7_1U.js → dist-jw8wvxoG.js} +0 -0
- /package/dist/{es-dash-HqXWZZ3_.js → es-dash-BuShf_ht.js} +0 -0
- /package/dist/{utilities-lwX686oD.js → utilities-DV0KKJNR.js} +0 -0
|
@@ -1,746 +0,0 @@
|
|
|
1
|
-
import { g as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c } from "./utils-B_uiqNa4.js";
|
|
2
|
-
import { F as $c87311424ea30a05$export$a11b0059900ceec8, G as $431fbd86ca7dc216$export$f21a1ffae260145a, H as $d4ee10de306f2510$export$e58f029f0fbfdb29, M as $c87311424ea30a05$export$6446a186d09e379e, U as $f4e2df6bd15f8569$export$98658e8c59125e6a, V as $d4ee10de306f2510$export$cd4e5573fbe2b576, W as $431fbd86ca7dc216$export$b204af158042fbac, b as $b4b717babfbb907b$export$bebd5a1431fec25d, c as $507fabe10e71c6fb$export$630ff653c5ada6a9, s as $3ad3f6e1647bc98d$export$80f3e147d781571c, y as $b4b717babfbb907b$export$4c063cf1350e6fed, z as $d4ee10de306f2510$export$4282f70798064fe0 } from "./useHover-qaMm3XFO.js";
|
|
3
|
-
import React, { useContext, useEffect, useMemo, useRef } from "react";
|
|
4
|
-
//#region node_modules/@react-aria/utils/dist/ShadowTreeWalker.mjs
|
|
5
|
-
var $dfc540311bf7f109$export$63eb3ababa9c55c4 = class {
|
|
6
|
-
get currentNode() {
|
|
7
|
-
return this._currentNode;
|
|
8
|
-
}
|
|
9
|
-
set currentNode(node) {
|
|
10
|
-
if (!$d4ee10de306f2510$export$4282f70798064fe0(this.root, node)) throw new Error("Cannot set currentNode to a node that is not contained by the root node.");
|
|
11
|
-
const walkers = [];
|
|
12
|
-
let curNode = node;
|
|
13
|
-
let currentWalkerCurrentNode = node;
|
|
14
|
-
this._currentNode = node;
|
|
15
|
-
while (curNode && curNode !== this.root) if (curNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
|
16
|
-
const shadowRoot = curNode;
|
|
17
|
-
const walker = this._doc.createTreeWalker(shadowRoot, this.whatToShow, { acceptNode: this._acceptNode });
|
|
18
|
-
walkers.push(walker);
|
|
19
|
-
walker.currentNode = currentWalkerCurrentNode;
|
|
20
|
-
this._currentSetFor.add(walker);
|
|
21
|
-
curNode = currentWalkerCurrentNode = shadowRoot.host;
|
|
22
|
-
} else curNode = curNode.parentNode;
|
|
23
|
-
const walker = this._doc.createTreeWalker(this.root, this.whatToShow, { acceptNode: this._acceptNode });
|
|
24
|
-
walkers.push(walker);
|
|
25
|
-
walker.currentNode = currentWalkerCurrentNode;
|
|
26
|
-
this._currentSetFor.add(walker);
|
|
27
|
-
this._walkerStack = walkers;
|
|
28
|
-
}
|
|
29
|
-
get doc() {
|
|
30
|
-
return this._doc;
|
|
31
|
-
}
|
|
32
|
-
firstChild() {
|
|
33
|
-
let currentNode = this.currentNode;
|
|
34
|
-
let newNode = this.nextNode();
|
|
35
|
-
if (!$d4ee10de306f2510$export$4282f70798064fe0(currentNode, newNode)) {
|
|
36
|
-
this.currentNode = currentNode;
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
if (newNode) this.currentNode = newNode;
|
|
40
|
-
return newNode;
|
|
41
|
-
}
|
|
42
|
-
lastChild() {
|
|
43
|
-
let newNode = this._walkerStack[0].lastChild();
|
|
44
|
-
if (newNode) this.currentNode = newNode;
|
|
45
|
-
return newNode;
|
|
46
|
-
}
|
|
47
|
-
nextNode() {
|
|
48
|
-
const nextNode = this._walkerStack[0].nextNode();
|
|
49
|
-
if (nextNode) {
|
|
50
|
-
if (nextNode.shadowRoot) {
|
|
51
|
-
var _this_filter;
|
|
52
|
-
let nodeResult;
|
|
53
|
-
if (typeof this.filter === "function") nodeResult = this.filter(nextNode);
|
|
54
|
-
else if ((_this_filter = this.filter) === null || _this_filter === void 0 ? void 0 : _this_filter.acceptNode) nodeResult = this.filter.acceptNode(nextNode);
|
|
55
|
-
if (nodeResult === NodeFilter.FILTER_ACCEPT) {
|
|
56
|
-
this.currentNode = nextNode;
|
|
57
|
-
return nextNode;
|
|
58
|
-
}
|
|
59
|
-
let newNode = this.nextNode();
|
|
60
|
-
if (newNode) this.currentNode = newNode;
|
|
61
|
-
return newNode;
|
|
62
|
-
}
|
|
63
|
-
if (nextNode) this.currentNode = nextNode;
|
|
64
|
-
return nextNode;
|
|
65
|
-
} else if (this._walkerStack.length > 1) {
|
|
66
|
-
this._walkerStack.shift();
|
|
67
|
-
let newNode = this.nextNode();
|
|
68
|
-
if (newNode) this.currentNode = newNode;
|
|
69
|
-
return newNode;
|
|
70
|
-
} else return null;
|
|
71
|
-
}
|
|
72
|
-
previousNode() {
|
|
73
|
-
const currentWalker = this._walkerStack[0];
|
|
74
|
-
if (currentWalker.currentNode === currentWalker.root) {
|
|
75
|
-
if (this._currentSetFor.has(currentWalker)) {
|
|
76
|
-
this._currentSetFor.delete(currentWalker);
|
|
77
|
-
if (this._walkerStack.length > 1) {
|
|
78
|
-
this._walkerStack.shift();
|
|
79
|
-
let newNode = this.previousNode();
|
|
80
|
-
if (newNode) this.currentNode = newNode;
|
|
81
|
-
return newNode;
|
|
82
|
-
} else return null;
|
|
83
|
-
}
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
const previousNode = currentWalker.previousNode();
|
|
87
|
-
if (previousNode) {
|
|
88
|
-
if (previousNode.shadowRoot) {
|
|
89
|
-
var _this_filter;
|
|
90
|
-
let nodeResult;
|
|
91
|
-
if (typeof this.filter === "function") nodeResult = this.filter(previousNode);
|
|
92
|
-
else if ((_this_filter = this.filter) === null || _this_filter === void 0 ? void 0 : _this_filter.acceptNode) nodeResult = this.filter.acceptNode(previousNode);
|
|
93
|
-
if (nodeResult === NodeFilter.FILTER_ACCEPT) {
|
|
94
|
-
if (previousNode) this.currentNode = previousNode;
|
|
95
|
-
return previousNode;
|
|
96
|
-
}
|
|
97
|
-
let newNode = this.lastChild();
|
|
98
|
-
if (newNode) this.currentNode = newNode;
|
|
99
|
-
return newNode;
|
|
100
|
-
}
|
|
101
|
-
if (previousNode) this.currentNode = previousNode;
|
|
102
|
-
return previousNode;
|
|
103
|
-
} else if (this._walkerStack.length > 1) {
|
|
104
|
-
this._walkerStack.shift();
|
|
105
|
-
let newNode = this.previousNode();
|
|
106
|
-
if (newNode) this.currentNode = newNode;
|
|
107
|
-
return newNode;
|
|
108
|
-
} else return null;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* @deprecated
|
|
112
|
-
*/ nextSibling() {
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* @deprecated
|
|
117
|
-
*/ previousSibling() {
|
|
118
|
-
return null;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* @deprecated
|
|
122
|
-
*/ parentNode() {
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
constructor(doc, root, whatToShow, filter) {
|
|
126
|
-
this._walkerStack = [];
|
|
127
|
-
this._currentSetFor = new Set();
|
|
128
|
-
this._acceptNode = (node) => {
|
|
129
|
-
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
130
|
-
const shadowRoot = node.shadowRoot;
|
|
131
|
-
if (shadowRoot) {
|
|
132
|
-
const walker = this._doc.createTreeWalker(shadowRoot, this.whatToShow, { acceptNode: this._acceptNode });
|
|
133
|
-
this._walkerStack.unshift(walker);
|
|
134
|
-
return NodeFilter.FILTER_ACCEPT;
|
|
135
|
-
} else {
|
|
136
|
-
var _this_filter;
|
|
137
|
-
if (typeof this.filter === "function") return this.filter(node);
|
|
138
|
-
else if ((_this_filter = this.filter) === null || _this_filter === void 0 ? void 0 : _this_filter.acceptNode) return this.filter.acceptNode(node);
|
|
139
|
-
else if (this.filter === null) return NodeFilter.FILTER_ACCEPT;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
return NodeFilter.FILTER_SKIP;
|
|
143
|
-
};
|
|
144
|
-
this._doc = doc;
|
|
145
|
-
this.root = root;
|
|
146
|
-
this.filter = filter !== null && filter !== void 0 ? filter : null;
|
|
147
|
-
this.whatToShow = whatToShow !== null && whatToShow !== void 0 ? whatToShow : NodeFilter.SHOW_ALL;
|
|
148
|
-
this._currentNode = root;
|
|
149
|
-
this._walkerStack.unshift(doc.createTreeWalker(root, whatToShow, this._acceptNode));
|
|
150
|
-
const shadowRoot = root.shadowRoot;
|
|
151
|
-
if (shadowRoot) {
|
|
152
|
-
const walker = this._doc.createTreeWalker(shadowRoot, this.whatToShow, { acceptNode: this._acceptNode });
|
|
153
|
-
this._walkerStack.unshift(walker);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
function $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root, whatToShow, filter) {
|
|
158
|
-
if ($f4e2df6bd15f8569$export$98658e8c59125e6a()) return new $dfc540311bf7f109$export$63eb3ababa9c55c4(doc, root, whatToShow, filter);
|
|
159
|
-
return doc.createTreeWalker(root, whatToShow, filter);
|
|
160
|
-
}
|
|
161
|
-
//#endregion
|
|
162
|
-
//#region node_modules/@react-aria/focus/dist/FocusScope.mjs
|
|
163
|
-
var $9bf71ea28793e738$var$FocusContext = React.createContext(null);
|
|
164
|
-
var $9bf71ea28793e738$var$RESTORE_FOCUS_EVENT = "react-aria-focus-scope-restore";
|
|
165
|
-
var $9bf71ea28793e738$var$activeScope = null;
|
|
166
|
-
function $9bf71ea28793e738$export$20e40289641fbbb6(props) {
|
|
167
|
-
let { children, contain, restoreFocus, autoFocus } = props;
|
|
168
|
-
let startRef = useRef(null);
|
|
169
|
-
let endRef = useRef(null);
|
|
170
|
-
let scopeRef = useRef([]);
|
|
171
|
-
let { parentNode } = useContext($9bf71ea28793e738$var$FocusContext) || {};
|
|
172
|
-
let node = useMemo(() => new $9bf71ea28793e738$var$TreeNode({ scopeRef }), [scopeRef]);
|
|
173
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
174
|
-
let parent = parentNode || $9bf71ea28793e738$export$d06fae2ee68b101e.root;
|
|
175
|
-
if ($9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(parent.scopeRef) && $9bf71ea28793e738$var$activeScope && !$9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, parent.scopeRef)) {
|
|
176
|
-
let activeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode($9bf71ea28793e738$var$activeScope);
|
|
177
|
-
if (activeNode) parent = activeNode;
|
|
178
|
-
}
|
|
179
|
-
parent.addChild(node);
|
|
180
|
-
$9bf71ea28793e738$export$d06fae2ee68b101e.addNode(node);
|
|
181
|
-
}, [node, parentNode]);
|
|
182
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
183
|
-
let node = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
|
|
184
|
-
if (node) node.contain = !!contain;
|
|
185
|
-
}, [contain]);
|
|
186
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
187
|
-
var _startRef_current;
|
|
188
|
-
let node = (_startRef_current = startRef.current) === null || _startRef_current === void 0 ? void 0 : _startRef_current.nextSibling;
|
|
189
|
-
let nodes = [];
|
|
190
|
-
let stopPropagation = (e) => e.stopPropagation();
|
|
191
|
-
while (node && node !== endRef.current) {
|
|
192
|
-
nodes.push(node);
|
|
193
|
-
node.addEventListener($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT, stopPropagation);
|
|
194
|
-
node = node.nextSibling;
|
|
195
|
-
}
|
|
196
|
-
scopeRef.current = nodes;
|
|
197
|
-
return () => {
|
|
198
|
-
for (let node of nodes) node.removeEventListener($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT, stopPropagation);
|
|
199
|
-
};
|
|
200
|
-
}, [children]);
|
|
201
|
-
$9bf71ea28793e738$var$useActiveScopeTracker(scopeRef, restoreFocus, contain);
|
|
202
|
-
$9bf71ea28793e738$var$useFocusContainment(scopeRef, contain);
|
|
203
|
-
$9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain);
|
|
204
|
-
$9bf71ea28793e738$var$useAutoFocus(scopeRef, autoFocus);
|
|
205
|
-
useEffect(() => {
|
|
206
|
-
const activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac(scopeRef.current ? scopeRef.current[0] : void 0));
|
|
207
|
-
let scope = null;
|
|
208
|
-
if ($9bf71ea28793e738$var$isElementInScope(activeElement, scopeRef.current)) {
|
|
209
|
-
for (let node of $9bf71ea28793e738$export$d06fae2ee68b101e.traverse()) if (node.scopeRef && $9bf71ea28793e738$var$isElementInScope(activeElement, node.scopeRef.current)) scope = node;
|
|
210
|
-
if (scope === $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef)) $9bf71ea28793e738$var$activeScope = scope.scopeRef;
|
|
211
|
-
}
|
|
212
|
-
}, [scopeRef]);
|
|
213
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
214
|
-
return () => {
|
|
215
|
-
var _focusScopeTree_getTreeNode_parent, _focusScopeTree_getTreeNode;
|
|
216
|
-
var _focusScopeTree_getTreeNode_parent_scopeRef;
|
|
217
|
-
let parentScope = (_focusScopeTree_getTreeNode_parent_scopeRef = (_focusScopeTree_getTreeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef)) === null || _focusScopeTree_getTreeNode === void 0 ? void 0 : (_focusScopeTree_getTreeNode_parent = _focusScopeTree_getTreeNode.parent) === null || _focusScopeTree_getTreeNode_parent === void 0 ? void 0 : _focusScopeTree_getTreeNode_parent.scopeRef) !== null && _focusScopeTree_getTreeNode_parent_scopeRef !== void 0 ? _focusScopeTree_getTreeNode_parent_scopeRef : null;
|
|
218
|
-
if ((scopeRef === $9bf71ea28793e738$var$activeScope || $9bf71ea28793e738$var$isAncestorScope(scopeRef, $9bf71ea28793e738$var$activeScope)) && (!parentScope || $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(parentScope))) $9bf71ea28793e738$var$activeScope = parentScope;
|
|
219
|
-
$9bf71ea28793e738$export$d06fae2ee68b101e.removeTreeNode(scopeRef);
|
|
220
|
-
};
|
|
221
|
-
}, [scopeRef]);
|
|
222
|
-
let focusManager = useMemo(() => $9bf71ea28793e738$var$createFocusManagerForScope(scopeRef), []);
|
|
223
|
-
let value = useMemo(() => ({
|
|
224
|
-
focusManager,
|
|
225
|
-
parentNode: node
|
|
226
|
-
}), [node, focusManager]);
|
|
227
|
-
return React.createElement($9bf71ea28793e738$var$FocusContext.Provider, { value }, React.createElement("span", {
|
|
228
|
-
"data-focus-scope-start": true,
|
|
229
|
-
hidden: true,
|
|
230
|
-
ref: startRef
|
|
231
|
-
}), children, React.createElement("span", {
|
|
232
|
-
"data-focus-scope-end": true,
|
|
233
|
-
hidden: true,
|
|
234
|
-
ref: endRef
|
|
235
|
-
}));
|
|
236
|
-
}
|
|
237
|
-
function $9bf71ea28793e738$var$createFocusManagerForScope(scopeRef) {
|
|
238
|
-
return {
|
|
239
|
-
focusNext(opts = {}) {
|
|
240
|
-
let scope = scopeRef.current;
|
|
241
|
-
let { from, tabbable, wrap, accept } = opts;
|
|
242
|
-
var _scope_;
|
|
243
|
-
let node = from || $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac((_scope_ = scope[0]) !== null && _scope_ !== void 0 ? _scope_ : void 0));
|
|
244
|
-
let sentinel = scope[0].previousElementSibling;
|
|
245
|
-
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa($9bf71ea28793e738$var$getScopeRoot(scope), {
|
|
246
|
-
tabbable,
|
|
247
|
-
accept
|
|
248
|
-
}, scope);
|
|
249
|
-
walker.currentNode = $9bf71ea28793e738$var$isElementInScope(node, scope) ? node : sentinel;
|
|
250
|
-
let nextNode = walker.nextNode();
|
|
251
|
-
if (!nextNode && wrap) {
|
|
252
|
-
walker.currentNode = sentinel;
|
|
253
|
-
nextNode = walker.nextNode();
|
|
254
|
-
}
|
|
255
|
-
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
|
|
256
|
-
return nextNode;
|
|
257
|
-
},
|
|
258
|
-
focusPrevious(opts = {}) {
|
|
259
|
-
let scope = scopeRef.current;
|
|
260
|
-
let { from, tabbable, wrap, accept } = opts;
|
|
261
|
-
var _scope_;
|
|
262
|
-
let node = from || $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac((_scope_ = scope[0]) !== null && _scope_ !== void 0 ? _scope_ : void 0));
|
|
263
|
-
let sentinel = scope[scope.length - 1].nextElementSibling;
|
|
264
|
-
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa($9bf71ea28793e738$var$getScopeRoot(scope), {
|
|
265
|
-
tabbable,
|
|
266
|
-
accept
|
|
267
|
-
}, scope);
|
|
268
|
-
walker.currentNode = $9bf71ea28793e738$var$isElementInScope(node, scope) ? node : sentinel;
|
|
269
|
-
let previousNode = walker.previousNode();
|
|
270
|
-
if (!previousNode && wrap) {
|
|
271
|
-
walker.currentNode = sentinel;
|
|
272
|
-
previousNode = walker.previousNode();
|
|
273
|
-
}
|
|
274
|
-
if (previousNode) $9bf71ea28793e738$var$focusElement(previousNode, true);
|
|
275
|
-
return previousNode;
|
|
276
|
-
},
|
|
277
|
-
focusFirst(opts = {}) {
|
|
278
|
-
let scope = scopeRef.current;
|
|
279
|
-
let { tabbable, accept } = opts;
|
|
280
|
-
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa($9bf71ea28793e738$var$getScopeRoot(scope), {
|
|
281
|
-
tabbable,
|
|
282
|
-
accept
|
|
283
|
-
}, scope);
|
|
284
|
-
walker.currentNode = scope[0].previousElementSibling;
|
|
285
|
-
let nextNode = walker.nextNode();
|
|
286
|
-
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
|
|
287
|
-
return nextNode;
|
|
288
|
-
},
|
|
289
|
-
focusLast(opts = {}) {
|
|
290
|
-
let scope = scopeRef.current;
|
|
291
|
-
let { tabbable, accept } = opts;
|
|
292
|
-
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa($9bf71ea28793e738$var$getScopeRoot(scope), {
|
|
293
|
-
tabbable,
|
|
294
|
-
accept
|
|
295
|
-
}, scope);
|
|
296
|
-
walker.currentNode = scope[scope.length - 1].nextElementSibling;
|
|
297
|
-
let previousNode = walker.previousNode();
|
|
298
|
-
if (previousNode) $9bf71ea28793e738$var$focusElement(previousNode, true);
|
|
299
|
-
return previousNode;
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
function $9bf71ea28793e738$var$getScopeRoot(scope) {
|
|
304
|
-
return scope[0].parentElement;
|
|
305
|
-
}
|
|
306
|
-
function $9bf71ea28793e738$var$shouldContainFocus(scopeRef) {
|
|
307
|
-
let scope = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode($9bf71ea28793e738$var$activeScope);
|
|
308
|
-
while (scope && scope.scopeRef !== scopeRef) {
|
|
309
|
-
if (scope.contain) return false;
|
|
310
|
-
scope = scope.parent;
|
|
311
|
-
}
|
|
312
|
-
return true;
|
|
313
|
-
}
|
|
314
|
-
function $9bf71ea28793e738$var$getRadiosInGroup(element) {
|
|
315
|
-
if (!element.form) return Array.from($431fbd86ca7dc216$export$b204af158042fbac(element).querySelectorAll(`input[type="radio"][name="${CSS.escape(element.name)}"]`)).filter((radio) => !radio.form);
|
|
316
|
-
const radioList = element.form.elements.namedItem(element.name);
|
|
317
|
-
let ownerWindow = $431fbd86ca7dc216$export$f21a1ffae260145a(element);
|
|
318
|
-
if (radioList instanceof ownerWindow.RadioNodeList) return Array.from(radioList).filter((el) => el instanceof ownerWindow.HTMLInputElement);
|
|
319
|
-
if (radioList instanceof ownerWindow.HTMLInputElement) return [radioList];
|
|
320
|
-
return [];
|
|
321
|
-
}
|
|
322
|
-
function $9bf71ea28793e738$var$isTabbableRadio(element) {
|
|
323
|
-
if (element.checked) return true;
|
|
324
|
-
const radios = $9bf71ea28793e738$var$getRadiosInGroup(element);
|
|
325
|
-
return radios.length > 0 && !radios.some((radio) => radio.checked);
|
|
326
|
-
}
|
|
327
|
-
function $9bf71ea28793e738$var$useFocusContainment(scopeRef, contain) {
|
|
328
|
-
let focusedNode = useRef(void 0);
|
|
329
|
-
let raf = useRef(void 0);
|
|
330
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
331
|
-
let scope = scopeRef.current;
|
|
332
|
-
if (!contain) {
|
|
333
|
-
if (raf.current) {
|
|
334
|
-
cancelAnimationFrame(raf.current);
|
|
335
|
-
raf.current = void 0;
|
|
336
|
-
}
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac(scope ? scope[0] : void 0);
|
|
340
|
-
let onKeyDown = (e) => {
|
|
341
|
-
if (e.key !== "Tab" || e.altKey || e.ctrlKey || e.metaKey || !$9bf71ea28793e738$var$shouldContainFocus(scopeRef) || e.isComposing) return;
|
|
342
|
-
let focusedElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
|
|
343
|
-
let scope = scopeRef.current;
|
|
344
|
-
if (!scope || !$9bf71ea28793e738$var$isElementInScope(focusedElement, scope)) return;
|
|
345
|
-
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa($9bf71ea28793e738$var$getScopeRoot(scope), { tabbable: true }, scope);
|
|
346
|
-
if (!focusedElement) return;
|
|
347
|
-
walker.currentNode = focusedElement;
|
|
348
|
-
let nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
|
|
349
|
-
if (!nextElement) {
|
|
350
|
-
walker.currentNode = e.shiftKey ? scope[scope.length - 1].nextElementSibling : scope[0].previousElementSibling;
|
|
351
|
-
nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
|
|
352
|
-
}
|
|
353
|
-
e.preventDefault();
|
|
354
|
-
if (nextElement) $9bf71ea28793e738$var$focusElement(nextElement, true);
|
|
355
|
-
};
|
|
356
|
-
let onFocus = (e) => {
|
|
357
|
-
if ((!$9bf71ea28793e738$var$activeScope || $9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, scopeRef)) && $9bf71ea28793e738$var$isElementInScope($d4ee10de306f2510$export$e58f029f0fbfdb29(e), scopeRef.current)) {
|
|
358
|
-
$9bf71ea28793e738$var$activeScope = scopeRef;
|
|
359
|
-
focusedNode.current = $d4ee10de306f2510$export$e58f029f0fbfdb29(e);
|
|
360
|
-
} else if ($9bf71ea28793e738$var$shouldContainFocus(scopeRef) && !$9bf71ea28793e738$var$isElementInChildScope($d4ee10de306f2510$export$e58f029f0fbfdb29(e), scopeRef)) {
|
|
361
|
-
if (focusedNode.current) focusedNode.current.focus();
|
|
362
|
-
else if ($9bf71ea28793e738$var$activeScope && $9bf71ea28793e738$var$activeScope.current) $9bf71ea28793e738$var$focusFirstInScope($9bf71ea28793e738$var$activeScope.current);
|
|
363
|
-
} else if ($9bf71ea28793e738$var$shouldContainFocus(scopeRef)) focusedNode.current = $d4ee10de306f2510$export$e58f029f0fbfdb29(e);
|
|
364
|
-
};
|
|
365
|
-
let onBlur = (e) => {
|
|
366
|
-
if (raf.current) cancelAnimationFrame(raf.current);
|
|
367
|
-
raf.current = requestAnimationFrame(() => {
|
|
368
|
-
let modality = $507fabe10e71c6fb$export$630ff653c5ada6a9();
|
|
369
|
-
let shouldSkipFocusRestore = (modality === "virtual" || modality === null) && $c87311424ea30a05$export$a11b0059900ceec8() && $c87311424ea30a05$export$6446a186d09e379e();
|
|
370
|
-
let activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
|
|
371
|
-
if (!shouldSkipFocusRestore && activeElement && $9bf71ea28793e738$var$shouldContainFocus(scopeRef) && !$9bf71ea28793e738$var$isElementInChildScope(activeElement, scopeRef)) {
|
|
372
|
-
$9bf71ea28793e738$var$activeScope = scopeRef;
|
|
373
|
-
let target = $d4ee10de306f2510$export$e58f029f0fbfdb29(e);
|
|
374
|
-
if (target && target.isConnected) {
|
|
375
|
-
var _focusedNode_current;
|
|
376
|
-
focusedNode.current = target;
|
|
377
|
-
(_focusedNode_current = focusedNode.current) === null || _focusedNode_current === void 0 || _focusedNode_current.focus();
|
|
378
|
-
} else if ($9bf71ea28793e738$var$activeScope.current) $9bf71ea28793e738$var$focusFirstInScope($9bf71ea28793e738$var$activeScope.current);
|
|
379
|
-
}
|
|
380
|
-
});
|
|
381
|
-
};
|
|
382
|
-
ownerDocument.addEventListener("keydown", onKeyDown, false);
|
|
383
|
-
ownerDocument.addEventListener("focusin", onFocus, false);
|
|
384
|
-
scope === null || scope === void 0 || scope.forEach((element) => element.addEventListener("focusin", onFocus, false));
|
|
385
|
-
scope === null || scope === void 0 || scope.forEach((element) => element.addEventListener("focusout", onBlur, false));
|
|
386
|
-
return () => {
|
|
387
|
-
ownerDocument.removeEventListener("keydown", onKeyDown, false);
|
|
388
|
-
ownerDocument.removeEventListener("focusin", onFocus, false);
|
|
389
|
-
scope === null || scope === void 0 || scope.forEach((element) => element.removeEventListener("focusin", onFocus, false));
|
|
390
|
-
scope === null || scope === void 0 || scope.forEach((element) => element.removeEventListener("focusout", onBlur, false));
|
|
391
|
-
};
|
|
392
|
-
}, [scopeRef, contain]);
|
|
393
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
394
|
-
return () => {
|
|
395
|
-
if (raf.current) cancelAnimationFrame(raf.current);
|
|
396
|
-
};
|
|
397
|
-
}, [raf]);
|
|
398
|
-
}
|
|
399
|
-
function $9bf71ea28793e738$var$isElementInAnyScope(element) {
|
|
400
|
-
return $9bf71ea28793e738$var$isElementInChildScope(element);
|
|
401
|
-
}
|
|
402
|
-
function $9bf71ea28793e738$var$isElementInScope(element, scope) {
|
|
403
|
-
if (!element) return false;
|
|
404
|
-
if (!scope) return false;
|
|
405
|
-
return scope.some((node) => $d4ee10de306f2510$export$4282f70798064fe0(node, element));
|
|
406
|
-
}
|
|
407
|
-
function $9bf71ea28793e738$var$isElementInChildScope(element, scope = null) {
|
|
408
|
-
if (element instanceof Element && element.closest("[data-react-aria-top-layer]")) return true;
|
|
409
|
-
for (let { scopeRef: s } of $9bf71ea28793e738$export$d06fae2ee68b101e.traverse($9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scope))) if (s && $9bf71ea28793e738$var$isElementInScope(element, s.current)) return true;
|
|
410
|
-
return false;
|
|
411
|
-
}
|
|
412
|
-
function $9bf71ea28793e738$export$1258395f99bf9cbf(element) {
|
|
413
|
-
return $9bf71ea28793e738$var$isElementInChildScope(element, $9bf71ea28793e738$var$activeScope);
|
|
414
|
-
}
|
|
415
|
-
function $9bf71ea28793e738$var$isAncestorScope(ancestor, scope) {
|
|
416
|
-
var _focusScopeTree_getTreeNode;
|
|
417
|
-
let parent = (_focusScopeTree_getTreeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scope)) === null || _focusScopeTree_getTreeNode === void 0 ? void 0 : _focusScopeTree_getTreeNode.parent;
|
|
418
|
-
while (parent) {
|
|
419
|
-
if (parent.scopeRef === ancestor) return true;
|
|
420
|
-
parent = parent.parent;
|
|
421
|
-
}
|
|
422
|
-
return false;
|
|
423
|
-
}
|
|
424
|
-
function $9bf71ea28793e738$var$focusElement(element, scroll = false) {
|
|
425
|
-
if (element != null && !scroll) try {
|
|
426
|
-
$3ad3f6e1647bc98d$export$80f3e147d781571c(element);
|
|
427
|
-
} catch {}
|
|
428
|
-
else if (element != null) try {
|
|
429
|
-
element.focus();
|
|
430
|
-
} catch {}
|
|
431
|
-
}
|
|
432
|
-
function $9bf71ea28793e738$var$getFirstInScope(scope, tabbable = true) {
|
|
433
|
-
let sentinel = scope[0].previousElementSibling;
|
|
434
|
-
let scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
|
|
435
|
-
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, { tabbable }, scope);
|
|
436
|
-
walker.currentNode = sentinel;
|
|
437
|
-
let nextNode = walker.nextNode();
|
|
438
|
-
if (tabbable && !nextNode) {
|
|
439
|
-
scopeRoot = $9bf71ea28793e738$var$getScopeRoot(scope);
|
|
440
|
-
walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(scopeRoot, { tabbable: false }, scope);
|
|
441
|
-
walker.currentNode = sentinel;
|
|
442
|
-
nextNode = walker.nextNode();
|
|
443
|
-
}
|
|
444
|
-
return nextNode;
|
|
445
|
-
}
|
|
446
|
-
function $9bf71ea28793e738$var$focusFirstInScope(scope, tabbable = true) {
|
|
447
|
-
$9bf71ea28793e738$var$focusElement($9bf71ea28793e738$var$getFirstInScope(scope, tabbable));
|
|
448
|
-
}
|
|
449
|
-
function $9bf71ea28793e738$var$useAutoFocus(scopeRef, autoFocus) {
|
|
450
|
-
const autoFocusRef = React.useRef(autoFocus);
|
|
451
|
-
useEffect(() => {
|
|
452
|
-
if (autoFocusRef.current) {
|
|
453
|
-
$9bf71ea28793e738$var$activeScope = scopeRef;
|
|
454
|
-
if (!$9bf71ea28793e738$var$isElementInScope($d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac(scopeRef.current ? scopeRef.current[0] : void 0)), $9bf71ea28793e738$var$activeScope.current) && scopeRef.current) $9bf71ea28793e738$var$focusFirstInScope(scopeRef.current);
|
|
455
|
-
}
|
|
456
|
-
autoFocusRef.current = false;
|
|
457
|
-
}, [scopeRef]);
|
|
458
|
-
}
|
|
459
|
-
function $9bf71ea28793e738$var$useActiveScopeTracker(scopeRef, restore, contain) {
|
|
460
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
461
|
-
if (restore || contain) return;
|
|
462
|
-
let scope = scopeRef.current;
|
|
463
|
-
const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac(scope ? scope[0] : void 0);
|
|
464
|
-
let onFocus = (e) => {
|
|
465
|
-
let target = $d4ee10de306f2510$export$e58f029f0fbfdb29(e);
|
|
466
|
-
if ($9bf71ea28793e738$var$isElementInScope(target, scopeRef.current)) $9bf71ea28793e738$var$activeScope = scopeRef;
|
|
467
|
-
else if (!$9bf71ea28793e738$var$isElementInAnyScope(target)) $9bf71ea28793e738$var$activeScope = null;
|
|
468
|
-
};
|
|
469
|
-
ownerDocument.addEventListener("focusin", onFocus, false);
|
|
470
|
-
scope === null || scope === void 0 || scope.forEach((element) => element.addEventListener("focusin", onFocus, false));
|
|
471
|
-
return () => {
|
|
472
|
-
ownerDocument.removeEventListener("focusin", onFocus, false);
|
|
473
|
-
scope === null || scope === void 0 || scope.forEach((element) => element.removeEventListener("focusin", onFocus, false));
|
|
474
|
-
};
|
|
475
|
-
}, [
|
|
476
|
-
scopeRef,
|
|
477
|
-
restore,
|
|
478
|
-
contain
|
|
479
|
-
]);
|
|
480
|
-
}
|
|
481
|
-
function $9bf71ea28793e738$var$shouldRestoreFocus(scopeRef) {
|
|
482
|
-
let scope = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode($9bf71ea28793e738$var$activeScope);
|
|
483
|
-
while (scope && scope.scopeRef !== scopeRef) {
|
|
484
|
-
if (scope.nodeToRestore) return false;
|
|
485
|
-
scope = scope.parent;
|
|
486
|
-
}
|
|
487
|
-
return (scope === null || scope === void 0 ? void 0 : scope.scopeRef) === scopeRef;
|
|
488
|
-
}
|
|
489
|
-
function $9bf71ea28793e738$var$useRestoreFocus(scopeRef, restoreFocus, contain) {
|
|
490
|
-
const nodeToRestoreRef = useRef(typeof document !== "undefined" ? $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac(scopeRef.current ? scopeRef.current[0] : void 0)) : null);
|
|
491
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
492
|
-
let scope = scopeRef.current;
|
|
493
|
-
const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac(scope ? scope[0] : void 0);
|
|
494
|
-
if (!restoreFocus || contain) return;
|
|
495
|
-
let onFocus = () => {
|
|
496
|
-
if ((!$9bf71ea28793e738$var$activeScope || $9bf71ea28793e738$var$isAncestorScope($9bf71ea28793e738$var$activeScope, scopeRef)) && $9bf71ea28793e738$var$isElementInScope($d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument), scopeRef.current)) $9bf71ea28793e738$var$activeScope = scopeRef;
|
|
497
|
-
};
|
|
498
|
-
ownerDocument.addEventListener("focusin", onFocus, false);
|
|
499
|
-
scope === null || scope === void 0 || scope.forEach((element) => element.addEventListener("focusin", onFocus, false));
|
|
500
|
-
return () => {
|
|
501
|
-
ownerDocument.removeEventListener("focusin", onFocus, false);
|
|
502
|
-
scope === null || scope === void 0 || scope.forEach((element) => element.removeEventListener("focusin", onFocus, false));
|
|
503
|
-
};
|
|
504
|
-
}, [scopeRef, contain]);
|
|
505
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
506
|
-
const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac(scopeRef.current ? scopeRef.current[0] : void 0);
|
|
507
|
-
if (!restoreFocus) return;
|
|
508
|
-
let onKeyDown = (e) => {
|
|
509
|
-
if (e.key !== "Tab" || e.altKey || e.ctrlKey || e.metaKey || !$9bf71ea28793e738$var$shouldContainFocus(scopeRef) || e.isComposing) return;
|
|
510
|
-
let focusedElement = ownerDocument.activeElement;
|
|
511
|
-
if (!$9bf71ea28793e738$var$isElementInChildScope(focusedElement, scopeRef) || !$9bf71ea28793e738$var$shouldRestoreFocus(scopeRef)) return;
|
|
512
|
-
let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
|
|
513
|
-
if (!treeNode) return;
|
|
514
|
-
let nodeToRestore = treeNode.nodeToRestore;
|
|
515
|
-
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(ownerDocument.body, { tabbable: true });
|
|
516
|
-
walker.currentNode = focusedElement;
|
|
517
|
-
let nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
|
|
518
|
-
if (!nodeToRestore || !nodeToRestore.isConnected || nodeToRestore === ownerDocument.body) {
|
|
519
|
-
nodeToRestore = void 0;
|
|
520
|
-
treeNode.nodeToRestore = void 0;
|
|
521
|
-
}
|
|
522
|
-
if ((!nextElement || !$9bf71ea28793e738$var$isElementInChildScope(nextElement, scopeRef)) && nodeToRestore) {
|
|
523
|
-
walker.currentNode = nodeToRestore;
|
|
524
|
-
do
|
|
525
|
-
nextElement = e.shiftKey ? walker.previousNode() : walker.nextNode();
|
|
526
|
-
while ($9bf71ea28793e738$var$isElementInChildScope(nextElement, scopeRef));
|
|
527
|
-
e.preventDefault();
|
|
528
|
-
e.stopPropagation();
|
|
529
|
-
if (nextElement) $9bf71ea28793e738$var$focusElement(nextElement, true);
|
|
530
|
-
else if (!$9bf71ea28793e738$var$isElementInAnyScope(nodeToRestore)) focusedElement.blur();
|
|
531
|
-
else $9bf71ea28793e738$var$focusElement(nodeToRestore, true);
|
|
532
|
-
}
|
|
533
|
-
};
|
|
534
|
-
if (!contain) ownerDocument.addEventListener("keydown", onKeyDown, true);
|
|
535
|
-
return () => {
|
|
536
|
-
if (!contain) ownerDocument.removeEventListener("keydown", onKeyDown, true);
|
|
537
|
-
};
|
|
538
|
-
}, [
|
|
539
|
-
scopeRef,
|
|
540
|
-
restoreFocus,
|
|
541
|
-
contain
|
|
542
|
-
]);
|
|
543
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
544
|
-
const ownerDocument = $431fbd86ca7dc216$export$b204af158042fbac(scopeRef.current ? scopeRef.current[0] : void 0);
|
|
545
|
-
if (!restoreFocus) return;
|
|
546
|
-
let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
|
|
547
|
-
if (!treeNode) return;
|
|
548
|
-
var _nodeToRestoreRef_current;
|
|
549
|
-
treeNode.nodeToRestore = (_nodeToRestoreRef_current = nodeToRestoreRef.current) !== null && _nodeToRestoreRef_current !== void 0 ? _nodeToRestoreRef_current : void 0;
|
|
550
|
-
return () => {
|
|
551
|
-
let treeNode = $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(scopeRef);
|
|
552
|
-
if (!treeNode) return;
|
|
553
|
-
let nodeToRestore = treeNode.nodeToRestore;
|
|
554
|
-
let activeElement = $d4ee10de306f2510$export$cd4e5573fbe2b576(ownerDocument);
|
|
555
|
-
if (restoreFocus && nodeToRestore && (activeElement && $9bf71ea28793e738$var$isElementInChildScope(activeElement, scopeRef) || activeElement === ownerDocument.body && $9bf71ea28793e738$var$shouldRestoreFocus(scopeRef))) {
|
|
556
|
-
let clonedTree = $9bf71ea28793e738$export$d06fae2ee68b101e.clone();
|
|
557
|
-
requestAnimationFrame(() => {
|
|
558
|
-
if (ownerDocument.activeElement === ownerDocument.body) {
|
|
559
|
-
let treeNode = clonedTree.getTreeNode(scopeRef);
|
|
560
|
-
while (treeNode) {
|
|
561
|
-
if (treeNode.nodeToRestore && treeNode.nodeToRestore.isConnected) {
|
|
562
|
-
$9bf71ea28793e738$var$restoreFocusToElement(treeNode.nodeToRestore);
|
|
563
|
-
return;
|
|
564
|
-
}
|
|
565
|
-
treeNode = treeNode.parent;
|
|
566
|
-
}
|
|
567
|
-
treeNode = clonedTree.getTreeNode(scopeRef);
|
|
568
|
-
while (treeNode) {
|
|
569
|
-
if (treeNode.scopeRef && treeNode.scopeRef.current && $9bf71ea28793e738$export$d06fae2ee68b101e.getTreeNode(treeNode.scopeRef)) {
|
|
570
|
-
$9bf71ea28793e738$var$restoreFocusToElement($9bf71ea28793e738$var$getFirstInScope(treeNode.scopeRef.current, true));
|
|
571
|
-
return;
|
|
572
|
-
}
|
|
573
|
-
treeNode = treeNode.parent;
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
};
|
|
579
|
-
}, [scopeRef, restoreFocus]);
|
|
580
|
-
}
|
|
581
|
-
function $9bf71ea28793e738$var$restoreFocusToElement(node) {
|
|
582
|
-
if (node.dispatchEvent(new CustomEvent($9bf71ea28793e738$var$RESTORE_FOCUS_EVENT, {
|
|
583
|
-
bubbles: true,
|
|
584
|
-
cancelable: true
|
|
585
|
-
}))) $9bf71ea28793e738$var$focusElement(node);
|
|
586
|
-
}
|
|
587
|
-
function $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, opts, scope) {
|
|
588
|
-
let filter = (opts === null || opts === void 0 ? void 0 : opts.tabbable) ? $b4b717babfbb907b$export$bebd5a1431fec25d : $b4b717babfbb907b$export$4c063cf1350e6fed;
|
|
589
|
-
let doc = $431fbd86ca7dc216$export$b204af158042fbac((root === null || root === void 0 ? void 0 : root.nodeType) === Node.ELEMENT_NODE ? root : null);
|
|
590
|
-
let walker = $dfc540311bf7f109$export$4d0f8be8b12a7ef6(doc, root || doc, NodeFilter.SHOW_ELEMENT, { acceptNode(node) {
|
|
591
|
-
if ($d4ee10de306f2510$export$4282f70798064fe0(opts === null || opts === void 0 ? void 0 : opts.from, node)) return NodeFilter.FILTER_REJECT;
|
|
592
|
-
if ((opts === null || opts === void 0 ? void 0 : opts.tabbable) && node.tagName === "INPUT" && node.getAttribute("type") === "radio") {
|
|
593
|
-
if (!$9bf71ea28793e738$var$isTabbableRadio(node)) return NodeFilter.FILTER_REJECT;
|
|
594
|
-
if (walker.currentNode.tagName === "INPUT" && walker.currentNode.type === "radio" && walker.currentNode.name === node.name) return NodeFilter.FILTER_REJECT;
|
|
595
|
-
}
|
|
596
|
-
if (filter(node) && (!scope || $9bf71ea28793e738$var$isElementInScope(node, scope)) && (!(opts === null || opts === void 0 ? void 0 : opts.accept) || opts.accept(node))) return NodeFilter.FILTER_ACCEPT;
|
|
597
|
-
return NodeFilter.FILTER_SKIP;
|
|
598
|
-
} });
|
|
599
|
-
if (opts === null || opts === void 0 ? void 0 : opts.from) walker.currentNode = opts.from;
|
|
600
|
-
return walker;
|
|
601
|
-
}
|
|
602
|
-
function $9bf71ea28793e738$export$c5251b9e124bf29(ref, defaultOptions = {}) {
|
|
603
|
-
return {
|
|
604
|
-
focusNext(opts = {}) {
|
|
605
|
-
let root = ref.current;
|
|
606
|
-
if (!root) return null;
|
|
607
|
-
let { from, tabbable = defaultOptions.tabbable, wrap = defaultOptions.wrap, accept = defaultOptions.accept } = opts;
|
|
608
|
-
let node = from || $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac(root));
|
|
609
|
-
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
|
|
610
|
-
tabbable,
|
|
611
|
-
accept
|
|
612
|
-
});
|
|
613
|
-
if ($d4ee10de306f2510$export$4282f70798064fe0(root, node)) walker.currentNode = node;
|
|
614
|
-
let nextNode = walker.nextNode();
|
|
615
|
-
if (!nextNode && wrap) {
|
|
616
|
-
walker.currentNode = root;
|
|
617
|
-
nextNode = walker.nextNode();
|
|
618
|
-
}
|
|
619
|
-
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
|
|
620
|
-
return nextNode;
|
|
621
|
-
},
|
|
622
|
-
focusPrevious(opts = defaultOptions) {
|
|
623
|
-
let root = ref.current;
|
|
624
|
-
if (!root) return null;
|
|
625
|
-
let { from, tabbable = defaultOptions.tabbable, wrap = defaultOptions.wrap, accept = defaultOptions.accept } = opts;
|
|
626
|
-
let node = from || $d4ee10de306f2510$export$cd4e5573fbe2b576($431fbd86ca7dc216$export$b204af158042fbac(root));
|
|
627
|
-
let walker = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
|
|
628
|
-
tabbable,
|
|
629
|
-
accept
|
|
630
|
-
});
|
|
631
|
-
if ($d4ee10de306f2510$export$4282f70798064fe0(root, node)) walker.currentNode = node;
|
|
632
|
-
else {
|
|
633
|
-
let next = $9bf71ea28793e738$var$last(walker);
|
|
634
|
-
if (next) $9bf71ea28793e738$var$focusElement(next, true);
|
|
635
|
-
return next !== null && next !== void 0 ? next : null;
|
|
636
|
-
}
|
|
637
|
-
let previousNode = walker.previousNode();
|
|
638
|
-
if (!previousNode && wrap) {
|
|
639
|
-
walker.currentNode = root;
|
|
640
|
-
let lastNode = $9bf71ea28793e738$var$last(walker);
|
|
641
|
-
if (!lastNode) return null;
|
|
642
|
-
previousNode = lastNode;
|
|
643
|
-
}
|
|
644
|
-
if (previousNode) $9bf71ea28793e738$var$focusElement(previousNode, true);
|
|
645
|
-
return previousNode !== null && previousNode !== void 0 ? previousNode : null;
|
|
646
|
-
},
|
|
647
|
-
focusFirst(opts = defaultOptions) {
|
|
648
|
-
let root = ref.current;
|
|
649
|
-
if (!root) return null;
|
|
650
|
-
let { tabbable = defaultOptions.tabbable, accept = defaultOptions.accept } = opts;
|
|
651
|
-
let nextNode = $9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
|
|
652
|
-
tabbable,
|
|
653
|
-
accept
|
|
654
|
-
}).nextNode();
|
|
655
|
-
if (nextNode) $9bf71ea28793e738$var$focusElement(nextNode, true);
|
|
656
|
-
return nextNode;
|
|
657
|
-
},
|
|
658
|
-
focusLast(opts = defaultOptions) {
|
|
659
|
-
let root = ref.current;
|
|
660
|
-
if (!root) return null;
|
|
661
|
-
let { tabbable = defaultOptions.tabbable, accept = defaultOptions.accept } = opts;
|
|
662
|
-
let next = $9bf71ea28793e738$var$last($9bf71ea28793e738$export$2d6ec8fc375ceafa(root, {
|
|
663
|
-
tabbable,
|
|
664
|
-
accept
|
|
665
|
-
}));
|
|
666
|
-
if (next) $9bf71ea28793e738$var$focusElement(next, true);
|
|
667
|
-
return next !== null && next !== void 0 ? next : null;
|
|
668
|
-
}
|
|
669
|
-
};
|
|
670
|
-
}
|
|
671
|
-
function $9bf71ea28793e738$var$last(walker) {
|
|
672
|
-
let next = void 0;
|
|
673
|
-
let last;
|
|
674
|
-
do {
|
|
675
|
-
last = walker.lastChild();
|
|
676
|
-
if (last) next = last;
|
|
677
|
-
} while (last);
|
|
678
|
-
return next;
|
|
679
|
-
}
|
|
680
|
-
var $9bf71ea28793e738$var$Tree = class $9bf71ea28793e738$var$Tree {
|
|
681
|
-
get size() {
|
|
682
|
-
return this.fastMap.size;
|
|
683
|
-
}
|
|
684
|
-
getTreeNode(data) {
|
|
685
|
-
return this.fastMap.get(data);
|
|
686
|
-
}
|
|
687
|
-
addTreeNode(scopeRef, parent, nodeToRestore) {
|
|
688
|
-
let parentNode = this.fastMap.get(parent !== null && parent !== void 0 ? parent : null);
|
|
689
|
-
if (!parentNode) return;
|
|
690
|
-
let node = new $9bf71ea28793e738$var$TreeNode({ scopeRef });
|
|
691
|
-
parentNode.addChild(node);
|
|
692
|
-
node.parent = parentNode;
|
|
693
|
-
this.fastMap.set(scopeRef, node);
|
|
694
|
-
if (nodeToRestore) node.nodeToRestore = nodeToRestore;
|
|
695
|
-
}
|
|
696
|
-
addNode(node) {
|
|
697
|
-
this.fastMap.set(node.scopeRef, node);
|
|
698
|
-
}
|
|
699
|
-
removeTreeNode(scopeRef) {
|
|
700
|
-
if (scopeRef === null) return;
|
|
701
|
-
let node = this.fastMap.get(scopeRef);
|
|
702
|
-
if (!node) return;
|
|
703
|
-
let parentNode = node.parent;
|
|
704
|
-
for (let current of this.traverse()) if (current !== node && node.nodeToRestore && current.nodeToRestore && node.scopeRef && node.scopeRef.current && $9bf71ea28793e738$var$isElementInScope(current.nodeToRestore, node.scopeRef.current)) current.nodeToRestore = node.nodeToRestore;
|
|
705
|
-
let children = node.children;
|
|
706
|
-
if (parentNode) {
|
|
707
|
-
parentNode.removeChild(node);
|
|
708
|
-
if (children.size > 0) children.forEach((child) => parentNode && parentNode.addChild(child));
|
|
709
|
-
}
|
|
710
|
-
this.fastMap.delete(node.scopeRef);
|
|
711
|
-
}
|
|
712
|
-
*traverse(node = this.root) {
|
|
713
|
-
if (node.scopeRef != null) yield node;
|
|
714
|
-
if (node.children.size > 0) for (let child of node.children) yield* this.traverse(child);
|
|
715
|
-
}
|
|
716
|
-
clone() {
|
|
717
|
-
var _node_parent;
|
|
718
|
-
let newTree = new $9bf71ea28793e738$var$Tree();
|
|
719
|
-
var _node_parent_scopeRef;
|
|
720
|
-
for (let node of this.traverse()) newTree.addTreeNode(node.scopeRef, (_node_parent_scopeRef = (_node_parent = node.parent) === null || _node_parent === void 0 ? void 0 : _node_parent.scopeRef) !== null && _node_parent_scopeRef !== void 0 ? _node_parent_scopeRef : null, node.nodeToRestore);
|
|
721
|
-
return newTree;
|
|
722
|
-
}
|
|
723
|
-
constructor() {
|
|
724
|
-
this.fastMap = new Map();
|
|
725
|
-
this.root = new $9bf71ea28793e738$var$TreeNode({ scopeRef: null });
|
|
726
|
-
this.fastMap.set(null, this.root);
|
|
727
|
-
}
|
|
728
|
-
};
|
|
729
|
-
var $9bf71ea28793e738$var$TreeNode = class {
|
|
730
|
-
addChild(node) {
|
|
731
|
-
this.children.add(node);
|
|
732
|
-
node.parent = this;
|
|
733
|
-
}
|
|
734
|
-
removeChild(node) {
|
|
735
|
-
this.children.delete(node);
|
|
736
|
-
node.parent = void 0;
|
|
737
|
-
}
|
|
738
|
-
constructor(props) {
|
|
739
|
-
this.children = new Set();
|
|
740
|
-
this.contain = false;
|
|
741
|
-
this.scopeRef = props.scopeRef;
|
|
742
|
-
}
|
|
743
|
-
};
|
|
744
|
-
var $9bf71ea28793e738$export$d06fae2ee68b101e = new $9bf71ea28793e738$var$Tree();
|
|
745
|
-
//#endregion
|
|
746
|
-
export { $dfc540311bf7f109$export$4d0f8be8b12a7ef6 as a, $9bf71ea28793e738$export$c5251b9e124bf29 as i, $9bf71ea28793e738$export$20e40289641fbbb6 as n, $9bf71ea28793e738$export$2d6ec8fc375ceafa as r, $9bf71ea28793e738$export$1258395f99bf9cbf as t };
|