@abgov/react-components 4.0.0-alpha.26 → 4.0.0-alpha.27
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/package.json +1 -1
- package/react-components.esm.js +80 -89
- package/react-components.umd.js +80 -89
package/package.json
CHANGED
package/react-components.esm.js
CHANGED
|
@@ -2594,7 +2594,7 @@ function instance$u($$self, $$props, $$invalidate) {
|
|
|
2594
2594
|
type
|
|
2595
2595
|
} = $$props;
|
|
2596
2596
|
let {
|
|
2597
|
-
heading
|
|
2597
|
+
heading = ""
|
|
2598
2598
|
} = $$props;
|
|
2599
2599
|
let {
|
|
2600
2600
|
testid = ""
|
|
@@ -7664,7 +7664,7 @@ function create_if_block$9(ctx) {
|
|
|
7664
7664
|
ctx[2] && `--width: ${
|
|
7665
7665
|
/*width*/
|
|
7666
7666
|
ctx[2]};`) + ";");
|
|
7667
|
-
set_custom_element_data(goa_focus_trap, "
|
|
7667
|
+
set_custom_element_data(goa_focus_trap, "active",
|
|
7668
7668
|
/*open*/
|
|
7669
7669
|
ctx[1]);
|
|
7670
7670
|
},
|
|
@@ -7765,7 +7765,7 @@ function create_if_block$9(ctx) {
|
|
|
7765
7765
|
if (!current || dirty &
|
|
7766
7766
|
/*open*/
|
|
7767
7767
|
2) {
|
|
7768
|
-
set_custom_element_data(goa_focus_trap, "
|
|
7768
|
+
set_custom_element_data(goa_focus_trap, "active",
|
|
7769
7769
|
/*open*/
|
|
7770
7770
|
ctx[1]);
|
|
7771
7771
|
}
|
|
@@ -11989,7 +11989,7 @@ function create_fragment$7(ctx) {
|
|
|
11989
11989
|
insert(target, div, anchor);
|
|
11990
11990
|
/*div_binding*/
|
|
11991
11991
|
|
|
11992
|
-
ctx[
|
|
11992
|
+
ctx[4](div);
|
|
11993
11993
|
},
|
|
11994
11994
|
|
|
11995
11995
|
p: noop,
|
|
@@ -12000,20 +12000,16 @@ function create_fragment$7(ctx) {
|
|
|
12000
12000
|
if (detaching) detach(div);
|
|
12001
12001
|
/*div_binding*/
|
|
12002
12002
|
|
|
12003
|
-
ctx[
|
|
12003
|
+
ctx[4](null);
|
|
12004
12004
|
}
|
|
12005
12005
|
|
|
12006
12006
|
};
|
|
12007
12007
|
}
|
|
12008
12008
|
|
|
12009
12009
|
function isFocusable(element) {
|
|
12010
|
-
|
|
12011
|
-
|
|
12012
|
-
|
|
12013
|
-
|
|
12014
|
-
if (element.disabled) {
|
|
12015
|
-
return false;
|
|
12016
|
-
}
|
|
12010
|
+
const isTabbable = element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute('tabIndex') !== null;
|
|
12011
|
+
if (isTabbable) return true;
|
|
12012
|
+
if (element.disabled) return false;
|
|
12017
12013
|
|
|
12018
12014
|
switch (element.nodeName) {
|
|
12019
12015
|
case 'A':
|
|
@@ -12033,13 +12029,14 @@ function isFocusable(element) {
|
|
|
12033
12029
|
}
|
|
12034
12030
|
|
|
12035
12031
|
function instance$6($$self, $$props, $$invalidate) {
|
|
12036
|
-
let
|
|
12032
|
+
let isActive;
|
|
12033
|
+
let {
|
|
12034
|
+
active
|
|
12035
|
+
} = $$props;
|
|
12037
12036
|
let ignoreFocusChanges = false;
|
|
12038
12037
|
let lastFocus;
|
|
12039
12038
|
let element;
|
|
12040
|
-
let
|
|
12041
|
-
open
|
|
12042
|
-
} = $$props;
|
|
12039
|
+
let hasListeners = false;
|
|
12043
12040
|
|
|
12044
12041
|
function removeListeners() {
|
|
12045
12042
|
document.removeEventListener('focus', trapFocus, true);
|
|
@@ -12047,15 +12044,18 @@ function instance$6($$self, $$props, $$invalidate) {
|
|
|
12047
12044
|
|
|
12048
12045
|
function addListeners() {
|
|
12049
12046
|
document.addEventListener('focus', trapFocus, true);
|
|
12050
|
-
}
|
|
12047
|
+
} // ====
|
|
12048
|
+
// First Node
|
|
12049
|
+
// ====
|
|
12051
12050
|
|
|
12052
|
-
function attemptFocusOnFirstDescendant(descendants) {
|
|
12053
|
-
if (!descendants) return false;
|
|
12054
12051
|
|
|
12055
|
-
|
|
12056
|
-
|
|
12052
|
+
function focusOnFirstNode(nodes) {
|
|
12053
|
+
if (!nodes) return false;
|
|
12057
12054
|
|
|
12058
|
-
|
|
12055
|
+
for (const node of nodes) {
|
|
12056
|
+
const isFocusable = focus(node) || focusOnFirstNode(node.childNodes) || focusOnFirstNodeOfSlot(node) || focusOnFirstNodeOfShadowDOM(node);
|
|
12057
|
+
|
|
12058
|
+
if (isFocusable) {
|
|
12059
12059
|
return true;
|
|
12060
12060
|
}
|
|
12061
12061
|
}
|
|
@@ -12063,37 +12063,34 @@ function instance$6($$self, $$props, $$invalidate) {
|
|
|
12063
12063
|
return false;
|
|
12064
12064
|
}
|
|
12065
12065
|
|
|
12066
|
-
function
|
|
12067
|
-
|
|
12068
|
-
|
|
12069
|
-
if (node instanceof HTMLSlotElement) {
|
|
12070
|
-
let assingedNodesOfSlotElement = (_a = node) === null || _a === void 0 ? void 0 : _a.assignedNodes();
|
|
12066
|
+
function focusOnFirstNodeOfSlot(node) {
|
|
12067
|
+
if (!(node instanceof HTMLSlotElement)) return false;
|
|
12071
12068
|
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
}
|
|
12069
|
+
if (focusOnFirstNode(node.assignedNodes())) {
|
|
12070
|
+
return true;
|
|
12075
12071
|
}
|
|
12076
12072
|
}
|
|
12077
12073
|
|
|
12078
|
-
function
|
|
12079
|
-
var _a
|
|
12074
|
+
function focusOnFirstNodeOfShadowDOM(node) {
|
|
12075
|
+
var _a;
|
|
12080
12076
|
|
|
12081
|
-
if (node instanceof HTMLElement)
|
|
12082
|
-
let childNodesOfShadowRoot = (_b = (_a = node) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.childNodes;
|
|
12077
|
+
if (!(node instanceof HTMLElement)) return false;
|
|
12083
12078
|
|
|
12084
|
-
|
|
12085
|
-
|
|
12086
|
-
}
|
|
12079
|
+
if (focusOnFirstNode((_a = node.shadowRoot) === null || _a === void 0 ? void 0 : _a.childNodes)) {
|
|
12080
|
+
return true;
|
|
12087
12081
|
}
|
|
12088
|
-
}
|
|
12082
|
+
} // ====
|
|
12083
|
+
// Last Node
|
|
12084
|
+
// ====
|
|
12089
12085
|
|
|
12090
|
-
function attemptFocusOnLastDescendant(descendants) {
|
|
12091
|
-
if (!descendants) return false;
|
|
12092
12086
|
|
|
12093
|
-
|
|
12094
|
-
|
|
12087
|
+
function focusOnLastNode(nodes) {
|
|
12088
|
+
if (!nodes) return false;
|
|
12095
12089
|
|
|
12096
|
-
|
|
12090
|
+
for (let i = nodes.length - 1; i >= 0; i--) {
|
|
12091
|
+
let node = nodes[i];
|
|
12092
|
+
|
|
12093
|
+
if (focus(node) || focusOnLastNode(node.childNodes) || focusOnLastNodeOfSlot(node) || focusOnLastNodeOfShadowDOM(node)) {
|
|
12097
12094
|
return true;
|
|
12098
12095
|
}
|
|
12099
12096
|
}
|
|
@@ -12101,67 +12098,57 @@ function instance$6($$self, $$props, $$invalidate) {
|
|
|
12101
12098
|
return false;
|
|
12102
12099
|
}
|
|
12103
12100
|
|
|
12104
|
-
function
|
|
12105
|
-
|
|
12106
|
-
|
|
12107
|
-
if (node instanceof HTMLSlotElement) {
|
|
12108
|
-
let assingedNodesOfSlotElement = (_a = node) === null || _a === void 0 ? void 0 : _a.assignedNodes();
|
|
12101
|
+
function focusOnLastNodeOfSlot(node) {
|
|
12102
|
+
if (!(node instanceof HTMLSlotElement)) return false;
|
|
12109
12103
|
|
|
12110
|
-
|
|
12111
|
-
|
|
12112
|
-
}
|
|
12104
|
+
if (focusOnLastNode(node.assignedNodes())) {
|
|
12105
|
+
return true;
|
|
12113
12106
|
}
|
|
12114
12107
|
}
|
|
12115
12108
|
|
|
12116
|
-
function
|
|
12117
|
-
var _a
|
|
12109
|
+
function focusOnLastNodeOfShadowDOM(node) {
|
|
12110
|
+
var _a;
|
|
12118
12111
|
|
|
12119
|
-
if (node instanceof HTMLElement)
|
|
12120
|
-
let childNodesOfShadowRoot = (_b = (_a = node) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.childNodes;
|
|
12112
|
+
if (!(node instanceof HTMLElement)) return false;
|
|
12121
12113
|
|
|
12122
|
-
|
|
12123
|
-
|
|
12124
|
-
}
|
|
12114
|
+
if (focusOnLastNode((_a = node.shadowRoot) === null || _a === void 0 ? void 0 : _a.childNodes)) {
|
|
12115
|
+
return true;
|
|
12125
12116
|
}
|
|
12126
12117
|
}
|
|
12127
12118
|
|
|
12128
|
-
function
|
|
12129
|
-
if (!isFocusable(element))
|
|
12130
|
-
return false;
|
|
12131
|
-
}
|
|
12132
|
-
|
|
12133
|
-
ignoreFocusChanges = true;
|
|
12119
|
+
function focus(element) {
|
|
12120
|
+
if (!isFocusable(element)) return false;
|
|
12134
12121
|
|
|
12135
12122
|
try {
|
|
12123
|
+
ignoreFocusChanges = true;
|
|
12136
12124
|
element.focus();
|
|
12137
|
-
} catch (e) {}
|
|
12125
|
+
} catch (e) {} finally {
|
|
12126
|
+
ignoreFocusChanges = false;
|
|
12127
|
+
}
|
|
12138
12128
|
|
|
12139
|
-
ignoreFocusChanges = false;
|
|
12140
12129
|
return document.activeElement === element;
|
|
12141
12130
|
}
|
|
12142
12131
|
|
|
12143
12132
|
function trapFocus(event) {
|
|
12144
12133
|
var _a;
|
|
12145
12134
|
|
|
12146
|
-
if (ignoreFocusChanges)
|
|
12147
|
-
return;
|
|
12148
|
-
}
|
|
12149
|
-
|
|
12135
|
+
if (ignoreFocusChanges) return;
|
|
12150
12136
|
const slotElements = (_a = element.firstChild) === null || _a === void 0 ? void 0 : _a.assignedElements();
|
|
12151
12137
|
if (!(slotElements === null || slotElements === void 0 ? void 0 : slotElements.length)) return;
|
|
12152
12138
|
const contentRootElement = slotElements[0];
|
|
12153
12139
|
|
|
12154
12140
|
if (event.composedPath().includes(contentRootElement)) {
|
|
12155
12141
|
lastFocus = event.target;
|
|
12156
|
-
|
|
12157
|
-
|
|
12142
|
+
return;
|
|
12143
|
+
}
|
|
12158
12144
|
|
|
12159
|
-
|
|
12160
|
-
attemptFocusOnLastDescendant(contentRootElement.childNodes);
|
|
12161
|
-
}
|
|
12145
|
+
focusOnFirstNode(contentRootElement.childNodes);
|
|
12162
12146
|
|
|
12163
|
-
|
|
12147
|
+
if (lastFocus == document.activeElement) {
|
|
12148
|
+
focusOnLastNode(contentRootElement.childNodes);
|
|
12164
12149
|
}
|
|
12150
|
+
|
|
12151
|
+
lastFocus = document.activeElement;
|
|
12165
12152
|
}
|
|
12166
12153
|
|
|
12167
12154
|
function div_binding($$value) {
|
|
@@ -12172,30 +12159,34 @@ function instance$6($$self, $$props, $$invalidate) {
|
|
|
12172
12159
|
}
|
|
12173
12160
|
|
|
12174
12161
|
$$self.$$set = $$props => {
|
|
12175
|
-
if ('
|
|
12162
|
+
if ('active' in $$props) $$invalidate(1, active = $$props.active);
|
|
12176
12163
|
};
|
|
12177
12164
|
|
|
12178
12165
|
$$self.$$.update = () => {
|
|
12179
12166
|
if ($$self.$$.dirty &
|
|
12180
|
-
/*
|
|
12167
|
+
/*active*/
|
|
12181
12168
|
2) {
|
|
12182
|
-
$$invalidate(
|
|
12169
|
+
$$invalidate(3, isActive = toBoolean(active));
|
|
12183
12170
|
}
|
|
12184
12171
|
|
|
12185
12172
|
if ($$self.$$.dirty &
|
|
12186
|
-
/*
|
|
12187
|
-
|
|
12173
|
+
/*isActive, hasListeners*/
|
|
12174
|
+
12) {
|
|
12188
12175
|
{
|
|
12189
|
-
if (
|
|
12176
|
+
if (isActive && !hasListeners) {
|
|
12190
12177
|
addListeners();
|
|
12191
|
-
|
|
12178
|
+
$$invalidate(2, hasListeners = true);
|
|
12179
|
+
}
|
|
12180
|
+
|
|
12181
|
+
if (!isActive && hasListeners) {
|
|
12192
12182
|
removeListeners();
|
|
12183
|
+
$$invalidate(2, hasListeners = false);
|
|
12193
12184
|
}
|
|
12194
12185
|
}
|
|
12195
12186
|
}
|
|
12196
12187
|
};
|
|
12197
12188
|
|
|
12198
|
-
return [element,
|
|
12189
|
+
return [element, active, hasListeners, isActive, div_binding];
|
|
12199
12190
|
}
|
|
12200
12191
|
|
|
12201
12192
|
class FocusTrap extends SvelteElement {
|
|
@@ -12206,7 +12197,7 @@ class FocusTrap extends SvelteElement {
|
|
|
12206
12197
|
props: attribute_to_object(this.attributes),
|
|
12207
12198
|
customElement: true
|
|
12208
12199
|
}, instance$6, create_fragment$7, safe_not_equal, {
|
|
12209
|
-
|
|
12200
|
+
active: 1
|
|
12210
12201
|
}, null);
|
|
12211
12202
|
|
|
12212
12203
|
if (options) {
|
|
@@ -12222,16 +12213,16 @@ class FocusTrap extends SvelteElement {
|
|
|
12222
12213
|
}
|
|
12223
12214
|
|
|
12224
12215
|
static get observedAttributes() {
|
|
12225
|
-
return ["
|
|
12216
|
+
return ["active"];
|
|
12226
12217
|
}
|
|
12227
12218
|
|
|
12228
|
-
get
|
|
12219
|
+
get active() {
|
|
12229
12220
|
return this.$$.ctx[1];
|
|
12230
12221
|
}
|
|
12231
12222
|
|
|
12232
|
-
set
|
|
12223
|
+
set active(active) {
|
|
12233
12224
|
this.$$set({
|
|
12234
|
-
|
|
12225
|
+
active
|
|
12235
12226
|
});
|
|
12236
12227
|
flush();
|
|
12237
12228
|
}
|
package/react-components.umd.js
CHANGED
|
@@ -2650,7 +2650,7 @@
|
|
|
2650
2650
|
type
|
|
2651
2651
|
} = $$props;
|
|
2652
2652
|
let {
|
|
2653
|
-
heading
|
|
2653
|
+
heading = ""
|
|
2654
2654
|
} = $$props;
|
|
2655
2655
|
let {
|
|
2656
2656
|
testid = ""
|
|
@@ -7707,7 +7707,7 @@
|
|
|
7707
7707
|
ctx[2] && `--width: ${
|
|
7708
7708
|
/*width*/
|
|
7709
7709
|
ctx[2]};`) + ";");
|
|
7710
|
-
set_custom_element_data(goa_focus_trap, "
|
|
7710
|
+
set_custom_element_data(goa_focus_trap, "active",
|
|
7711
7711
|
/*open*/
|
|
7712
7712
|
ctx[1]);
|
|
7713
7713
|
},
|
|
@@ -7808,7 +7808,7 @@
|
|
|
7808
7808
|
if (!current || dirty &
|
|
7809
7809
|
/*open*/
|
|
7810
7810
|
2) {
|
|
7811
|
-
set_custom_element_data(goa_focus_trap, "
|
|
7811
|
+
set_custom_element_data(goa_focus_trap, "active",
|
|
7812
7812
|
/*open*/
|
|
7813
7813
|
ctx[1]);
|
|
7814
7814
|
}
|
|
@@ -12035,7 +12035,7 @@
|
|
|
12035
12035
|
insert(target, div, anchor);
|
|
12036
12036
|
/*div_binding*/
|
|
12037
12037
|
|
|
12038
|
-
ctx[
|
|
12038
|
+
ctx[4](div);
|
|
12039
12039
|
},
|
|
12040
12040
|
|
|
12041
12041
|
p: noop,
|
|
@@ -12046,20 +12046,16 @@
|
|
|
12046
12046
|
if (detaching) detach(div);
|
|
12047
12047
|
/*div_binding*/
|
|
12048
12048
|
|
|
12049
|
-
ctx[
|
|
12049
|
+
ctx[4](null);
|
|
12050
12050
|
}
|
|
12051
12051
|
|
|
12052
12052
|
};
|
|
12053
12053
|
}
|
|
12054
12054
|
|
|
12055
12055
|
function isFocusable(element) {
|
|
12056
|
-
|
|
12057
|
-
|
|
12058
|
-
|
|
12059
|
-
|
|
12060
|
-
if (element.disabled) {
|
|
12061
|
-
return false;
|
|
12062
|
-
}
|
|
12056
|
+
const isTabbable = element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute('tabIndex') !== null;
|
|
12057
|
+
if (isTabbable) return true;
|
|
12058
|
+
if (element.disabled) return false;
|
|
12063
12059
|
|
|
12064
12060
|
switch (element.nodeName) {
|
|
12065
12061
|
case 'A':
|
|
@@ -12079,13 +12075,14 @@
|
|
|
12079
12075
|
}
|
|
12080
12076
|
|
|
12081
12077
|
function instance$6($$self, $$props, $$invalidate) {
|
|
12082
|
-
let
|
|
12078
|
+
let isActive;
|
|
12079
|
+
let {
|
|
12080
|
+
active
|
|
12081
|
+
} = $$props;
|
|
12083
12082
|
let ignoreFocusChanges = false;
|
|
12084
12083
|
let lastFocus;
|
|
12085
12084
|
let element;
|
|
12086
|
-
let
|
|
12087
|
-
open
|
|
12088
|
-
} = $$props;
|
|
12085
|
+
let hasListeners = false;
|
|
12089
12086
|
|
|
12090
12087
|
function removeListeners() {
|
|
12091
12088
|
document.removeEventListener('focus', trapFocus, true);
|
|
@@ -12093,15 +12090,18 @@
|
|
|
12093
12090
|
|
|
12094
12091
|
function addListeners() {
|
|
12095
12092
|
document.addEventListener('focus', trapFocus, true);
|
|
12096
|
-
}
|
|
12093
|
+
} // ====
|
|
12094
|
+
// First Node
|
|
12095
|
+
// ====
|
|
12097
12096
|
|
|
12098
|
-
function attemptFocusOnFirstDescendant(descendants) {
|
|
12099
|
-
if (!descendants) return false;
|
|
12100
12097
|
|
|
12101
|
-
|
|
12102
|
-
|
|
12098
|
+
function focusOnFirstNode(nodes) {
|
|
12099
|
+
if (!nodes) return false;
|
|
12103
12100
|
|
|
12104
|
-
|
|
12101
|
+
for (const node of nodes) {
|
|
12102
|
+
const isFocusable = focus(node) || focusOnFirstNode(node.childNodes) || focusOnFirstNodeOfSlot(node) || focusOnFirstNodeOfShadowDOM(node);
|
|
12103
|
+
|
|
12104
|
+
if (isFocusable) {
|
|
12105
12105
|
return true;
|
|
12106
12106
|
}
|
|
12107
12107
|
}
|
|
@@ -12109,37 +12109,34 @@
|
|
|
12109
12109
|
return false;
|
|
12110
12110
|
}
|
|
12111
12111
|
|
|
12112
|
-
function
|
|
12113
|
-
|
|
12114
|
-
|
|
12115
|
-
if (node instanceof HTMLSlotElement) {
|
|
12116
|
-
let assingedNodesOfSlotElement = (_a = node) === null || _a === void 0 ? void 0 : _a.assignedNodes();
|
|
12112
|
+
function focusOnFirstNodeOfSlot(node) {
|
|
12113
|
+
if (!(node instanceof HTMLSlotElement)) return false;
|
|
12117
12114
|
|
|
12118
|
-
|
|
12119
|
-
|
|
12120
|
-
}
|
|
12115
|
+
if (focusOnFirstNode(node.assignedNodes())) {
|
|
12116
|
+
return true;
|
|
12121
12117
|
}
|
|
12122
12118
|
}
|
|
12123
12119
|
|
|
12124
|
-
function
|
|
12125
|
-
var _a
|
|
12120
|
+
function focusOnFirstNodeOfShadowDOM(node) {
|
|
12121
|
+
var _a;
|
|
12126
12122
|
|
|
12127
|
-
if (node instanceof HTMLElement)
|
|
12128
|
-
let childNodesOfShadowRoot = (_b = (_a = node) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.childNodes;
|
|
12123
|
+
if (!(node instanceof HTMLElement)) return false;
|
|
12129
12124
|
|
|
12130
|
-
|
|
12131
|
-
|
|
12132
|
-
}
|
|
12125
|
+
if (focusOnFirstNode((_a = node.shadowRoot) === null || _a === void 0 ? void 0 : _a.childNodes)) {
|
|
12126
|
+
return true;
|
|
12133
12127
|
}
|
|
12134
|
-
}
|
|
12128
|
+
} // ====
|
|
12129
|
+
// Last Node
|
|
12130
|
+
// ====
|
|
12135
12131
|
|
|
12136
|
-
function attemptFocusOnLastDescendant(descendants) {
|
|
12137
|
-
if (!descendants) return false;
|
|
12138
12132
|
|
|
12139
|
-
|
|
12140
|
-
|
|
12133
|
+
function focusOnLastNode(nodes) {
|
|
12134
|
+
if (!nodes) return false;
|
|
12141
12135
|
|
|
12142
|
-
|
|
12136
|
+
for (let i = nodes.length - 1; i >= 0; i--) {
|
|
12137
|
+
let node = nodes[i];
|
|
12138
|
+
|
|
12139
|
+
if (focus(node) || focusOnLastNode(node.childNodes) || focusOnLastNodeOfSlot(node) || focusOnLastNodeOfShadowDOM(node)) {
|
|
12143
12140
|
return true;
|
|
12144
12141
|
}
|
|
12145
12142
|
}
|
|
@@ -12147,67 +12144,57 @@
|
|
|
12147
12144
|
return false;
|
|
12148
12145
|
}
|
|
12149
12146
|
|
|
12150
|
-
function
|
|
12151
|
-
|
|
12152
|
-
|
|
12153
|
-
if (node instanceof HTMLSlotElement) {
|
|
12154
|
-
let assingedNodesOfSlotElement = (_a = node) === null || _a === void 0 ? void 0 : _a.assignedNodes();
|
|
12147
|
+
function focusOnLastNodeOfSlot(node) {
|
|
12148
|
+
if (!(node instanceof HTMLSlotElement)) return false;
|
|
12155
12149
|
|
|
12156
|
-
|
|
12157
|
-
|
|
12158
|
-
}
|
|
12150
|
+
if (focusOnLastNode(node.assignedNodes())) {
|
|
12151
|
+
return true;
|
|
12159
12152
|
}
|
|
12160
12153
|
}
|
|
12161
12154
|
|
|
12162
|
-
function
|
|
12163
|
-
var _a
|
|
12155
|
+
function focusOnLastNodeOfShadowDOM(node) {
|
|
12156
|
+
var _a;
|
|
12164
12157
|
|
|
12165
|
-
if (node instanceof HTMLElement)
|
|
12166
|
-
let childNodesOfShadowRoot = (_b = (_a = node) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.childNodes;
|
|
12158
|
+
if (!(node instanceof HTMLElement)) return false;
|
|
12167
12159
|
|
|
12168
|
-
|
|
12169
|
-
|
|
12170
|
-
}
|
|
12160
|
+
if (focusOnLastNode((_a = node.shadowRoot) === null || _a === void 0 ? void 0 : _a.childNodes)) {
|
|
12161
|
+
return true;
|
|
12171
12162
|
}
|
|
12172
12163
|
}
|
|
12173
12164
|
|
|
12174
|
-
function
|
|
12175
|
-
if (!isFocusable(element))
|
|
12176
|
-
return false;
|
|
12177
|
-
}
|
|
12178
|
-
|
|
12179
|
-
ignoreFocusChanges = true;
|
|
12165
|
+
function focus(element) {
|
|
12166
|
+
if (!isFocusable(element)) return false;
|
|
12180
12167
|
|
|
12181
12168
|
try {
|
|
12169
|
+
ignoreFocusChanges = true;
|
|
12182
12170
|
element.focus();
|
|
12183
|
-
} catch (e) {}
|
|
12171
|
+
} catch (e) {} finally {
|
|
12172
|
+
ignoreFocusChanges = false;
|
|
12173
|
+
}
|
|
12184
12174
|
|
|
12185
|
-
ignoreFocusChanges = false;
|
|
12186
12175
|
return document.activeElement === element;
|
|
12187
12176
|
}
|
|
12188
12177
|
|
|
12189
12178
|
function trapFocus(event) {
|
|
12190
12179
|
var _a;
|
|
12191
12180
|
|
|
12192
|
-
if (ignoreFocusChanges)
|
|
12193
|
-
return;
|
|
12194
|
-
}
|
|
12195
|
-
|
|
12181
|
+
if (ignoreFocusChanges) return;
|
|
12196
12182
|
const slotElements = (_a = element.firstChild) === null || _a === void 0 ? void 0 : _a.assignedElements();
|
|
12197
12183
|
if (!(slotElements === null || slotElements === void 0 ? void 0 : slotElements.length)) return;
|
|
12198
12184
|
const contentRootElement = slotElements[0];
|
|
12199
12185
|
|
|
12200
12186
|
if (event.composedPath().includes(contentRootElement)) {
|
|
12201
12187
|
lastFocus = event.target;
|
|
12202
|
-
|
|
12203
|
-
|
|
12188
|
+
return;
|
|
12189
|
+
}
|
|
12204
12190
|
|
|
12205
|
-
|
|
12206
|
-
attemptFocusOnLastDescendant(contentRootElement.childNodes);
|
|
12207
|
-
}
|
|
12191
|
+
focusOnFirstNode(contentRootElement.childNodes);
|
|
12208
12192
|
|
|
12209
|
-
|
|
12193
|
+
if (lastFocus == document.activeElement) {
|
|
12194
|
+
focusOnLastNode(contentRootElement.childNodes);
|
|
12210
12195
|
}
|
|
12196
|
+
|
|
12197
|
+
lastFocus = document.activeElement;
|
|
12211
12198
|
}
|
|
12212
12199
|
|
|
12213
12200
|
function div_binding($$value) {
|
|
@@ -12218,30 +12205,34 @@
|
|
|
12218
12205
|
}
|
|
12219
12206
|
|
|
12220
12207
|
$$self.$$set = $$props => {
|
|
12221
|
-
if ('
|
|
12208
|
+
if ('active' in $$props) $$invalidate(1, active = $$props.active);
|
|
12222
12209
|
};
|
|
12223
12210
|
|
|
12224
12211
|
$$self.$$.update = () => {
|
|
12225
12212
|
if ($$self.$$.dirty &
|
|
12226
|
-
/*
|
|
12213
|
+
/*active*/
|
|
12227
12214
|
2) {
|
|
12228
|
-
$$invalidate(
|
|
12215
|
+
$$invalidate(3, isActive = toBoolean(active));
|
|
12229
12216
|
}
|
|
12230
12217
|
|
|
12231
12218
|
if ($$self.$$.dirty &
|
|
12232
|
-
/*
|
|
12233
|
-
|
|
12219
|
+
/*isActive, hasListeners*/
|
|
12220
|
+
12) {
|
|
12234
12221
|
{
|
|
12235
|
-
if (
|
|
12222
|
+
if (isActive && !hasListeners) {
|
|
12236
12223
|
addListeners();
|
|
12237
|
-
|
|
12224
|
+
$$invalidate(2, hasListeners = true);
|
|
12225
|
+
}
|
|
12226
|
+
|
|
12227
|
+
if (!isActive && hasListeners) {
|
|
12238
12228
|
removeListeners();
|
|
12229
|
+
$$invalidate(2, hasListeners = false);
|
|
12239
12230
|
}
|
|
12240
12231
|
}
|
|
12241
12232
|
}
|
|
12242
12233
|
};
|
|
12243
12234
|
|
|
12244
|
-
return [element,
|
|
12235
|
+
return [element, active, hasListeners, isActive, div_binding];
|
|
12245
12236
|
}
|
|
12246
12237
|
|
|
12247
12238
|
class FocusTrap extends SvelteElement {
|
|
@@ -12252,7 +12243,7 @@
|
|
|
12252
12243
|
props: attribute_to_object(this.attributes),
|
|
12253
12244
|
customElement: true
|
|
12254
12245
|
}, instance$6, create_fragment$7, safe_not_equal, {
|
|
12255
|
-
|
|
12246
|
+
active: 1
|
|
12256
12247
|
}, null);
|
|
12257
12248
|
|
|
12258
12249
|
if (options) {
|
|
@@ -12268,16 +12259,16 @@
|
|
|
12268
12259
|
}
|
|
12269
12260
|
|
|
12270
12261
|
static get observedAttributes() {
|
|
12271
|
-
return ["
|
|
12262
|
+
return ["active"];
|
|
12272
12263
|
}
|
|
12273
12264
|
|
|
12274
|
-
get
|
|
12265
|
+
get active() {
|
|
12275
12266
|
return this.$$.ctx[1];
|
|
12276
12267
|
}
|
|
12277
12268
|
|
|
12278
|
-
set
|
|
12269
|
+
set active(active) {
|
|
12279
12270
|
this.$$set({
|
|
12280
|
-
|
|
12271
|
+
active
|
|
12281
12272
|
});
|
|
12282
12273
|
flush();
|
|
12283
12274
|
}
|