@react-aria/tabs 3.8.6-nightly.4555 → 3.8.6-nightly.4558
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/TabsKeyboardDelegate.main.js +68 -0
- package/dist/TabsKeyboardDelegate.main.js.map +1 -0
- package/dist/TabsKeyboardDelegate.mjs +63 -0
- package/dist/TabsKeyboardDelegate.module.js +63 -0
- package/dist/TabsKeyboardDelegate.module.js.map +1 -0
- package/dist/import.mjs +3 -219
- package/dist/main.js +6 -222
- package/dist/main.js.map +1 -1
- package/dist/module.js +3 -219
- package/dist/module.js.map +1 -1
- package/dist/useTab.main.js +62 -0
- package/dist/useTab.main.js.map +1 -0
- package/dist/useTab.mjs +57 -0
- package/dist/useTab.module.js +57 -0
- package/dist/useTab.module.js.map +1 -0
- package/dist/useTabList.main.js +67 -0
- package/dist/useTabList.main.js.map +1 -0
- package/dist/useTabList.mjs +62 -0
- package/dist/useTabList.module.js +62 -0
- package/dist/useTabList.module.js.map +1 -0
- package/dist/useTabPanel.main.js +47 -0
- package/dist/useTabPanel.main.js.map +1 -0
- package/dist/useTabPanel.mjs +42 -0
- package/dist/useTabPanel.module.js +42 -0
- package/dist/useTabPanel.module.js.map +1 -0
- package/dist/utils.main.js +26 -0
- package/dist/utils.main.js.map +1 -0
- package/dist/utils.mjs +20 -0
- package/dist/utils.module.js +20 -0
- package/dist/utils.module.js.map +1 -0
- package/package.json +9 -9
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
|
|
2
|
+
function $parcel$export(e, n, v, s) {
|
|
3
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
$parcel$export(module.exports, "TabsKeyboardDelegate", () => $283e5d8830177ead$export$15010ca3c1abe90b);
|
|
7
|
+
/*
|
|
8
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
9
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
11
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
14
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
15
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
|
+
* governing permissions and limitations under the License.
|
|
17
|
+
*/ class $283e5d8830177ead$export$15010ca3c1abe90b {
|
|
18
|
+
getKeyLeftOf(key) {
|
|
19
|
+
if (this.flipDirection) return this.getNextKey(key);
|
|
20
|
+
return this.getPreviousKey(key);
|
|
21
|
+
}
|
|
22
|
+
getKeyRightOf(key) {
|
|
23
|
+
if (this.flipDirection) return this.getPreviousKey(key);
|
|
24
|
+
return this.getNextKey(key);
|
|
25
|
+
}
|
|
26
|
+
getKeyAbove(key) {
|
|
27
|
+
return this.getPreviousKey(key);
|
|
28
|
+
}
|
|
29
|
+
getKeyBelow(key) {
|
|
30
|
+
return this.getNextKey(key);
|
|
31
|
+
}
|
|
32
|
+
isDisabled(key) {
|
|
33
|
+
var _this_collection_getItem_props, _this_collection_getItem;
|
|
34
|
+
return this.disabledKeys.has(key) || !!((_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : (_this_collection_getItem_props = _this_collection_getItem.props) === null || _this_collection_getItem_props === void 0 ? void 0 : _this_collection_getItem_props.isDisabled);
|
|
35
|
+
}
|
|
36
|
+
getFirstKey() {
|
|
37
|
+
let key = this.collection.getFirstKey();
|
|
38
|
+
if (key != null && this.isDisabled(key)) key = this.getNextKey(key);
|
|
39
|
+
return key;
|
|
40
|
+
}
|
|
41
|
+
getLastKey() {
|
|
42
|
+
let key = this.collection.getLastKey();
|
|
43
|
+
if (key != null && this.isDisabled(key)) key = this.getPreviousKey(key);
|
|
44
|
+
return key;
|
|
45
|
+
}
|
|
46
|
+
getNextKey(key) {
|
|
47
|
+
do {
|
|
48
|
+
key = this.collection.getKeyAfter(key);
|
|
49
|
+
if (key == null) key = this.collection.getFirstKey();
|
|
50
|
+
}while (this.isDisabled(key));
|
|
51
|
+
return key;
|
|
52
|
+
}
|
|
53
|
+
getPreviousKey(key) {
|
|
54
|
+
do {
|
|
55
|
+
key = this.collection.getKeyBefore(key);
|
|
56
|
+
if (key == null) key = this.collection.getLastKey();
|
|
57
|
+
}while (this.isDisabled(key));
|
|
58
|
+
return key;
|
|
59
|
+
}
|
|
60
|
+
constructor(collection, direction, orientation, disabledKeys = new Set()){
|
|
61
|
+
this.collection = collection;
|
|
62
|
+
this.flipDirection = direction === "rtl" && orientation === "horizontal";
|
|
63
|
+
this.disabledKeys = disabledKeys;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=TabsKeyboardDelegate.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAIM,MAAM;IAWX,aAAa,GAAQ,EAAE;QACrB,IAAI,IAAI,CAAC,aAAa,EACpB,OAAO,IAAI,CAAC,UAAU,CAAC;QAEzB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B;IAEA,cAAc,GAAQ,EAAE;QACtB,IAAI,IAAI,CAAC,aAAa,EACpB,OAAO,IAAI,CAAC,cAAc,CAAC;QAE7B,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB;IAEA,YAAY,GAAQ,EAAE;QACpB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B;IAEA,YAAY,GAAQ,EAAE;QACpB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB;IAEQ,WAAW,GAAQ,EAAE;YACY,gCAAA;QAAvC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAC,2BAAA,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,kBAAxB,gDAAA,iCAAA,yBAA8B,KAAK,cAAnC,qDAAA,+BAAqC,UAAU;IACxF;IAEA,cAAc;QACZ,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW;QACrC,IAAI,OAAO,QAAQ,IAAI,CAAC,UAAU,CAAC,MACjC,MAAM,IAAI,CAAC,UAAU,CAAC;QAExB,OAAO;IACT;IAEA,aAAa;QACX,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU;QACpC,IAAI,OAAO,QAAQ,IAAI,CAAC,UAAU,CAAC,MACjC,MAAM,IAAI,CAAC,cAAc,CAAC;QAE5B,OAAO;IACT;IAEA,WAAW,GAAG,EAAE;QACd,GAAG;YACD,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;YAClC,IAAI,OAAO,MACT,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW;QAErC,QAAS,IAAI,CAAC,UAAU,CAAC,MAAM;QAC/B,OAAO;IACT;IAEA,eAAe,GAAG,EAAE;QAClB,GAAG;YACD,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;YACnC,IAAI,OAAO,MACT,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU;QAEpC,QAAS,IAAI,CAAC,UAAU,CAAC,MAAM;QAC/B,OAAO;IACT;IAlEA,YAAY,UAA+B,EAAE,SAAoB,EAAE,WAAwB,EAAE,eAAyB,IAAI,KAAK,CAAE;QAC/H,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,aAAa,GAAG,cAAc,SAAS,gBAAgB;QAC5D,IAAI,CAAC,YAAY,GAAG;IACtB;AA+DF","sources":["packages/@react-aria/tabs/src/TabsKeyboardDelegate.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, Direction, Key, KeyboardDelegate, Node, Orientation} from '@react-types/shared';\n\nexport class TabsKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: Collection<Node<T>>;\n private flipDirection: boolean;\n private disabledKeys: Set<Key>;\n\n constructor(collection: Collection<Node<T>>, direction: Direction, orientation: Orientation, disabledKeys: Set<Key> = new Set()) {\n this.collection = collection;\n this.flipDirection = direction === 'rtl' && orientation === 'horizontal';\n this.disabledKeys = disabledKeys;\n }\n\n getKeyLeftOf(key: Key) {\n if (this.flipDirection) {\n return this.getNextKey(key);\n }\n return this.getPreviousKey(key);\n }\n\n getKeyRightOf(key: Key) {\n if (this.flipDirection) {\n return this.getPreviousKey(key);\n }\n return this.getNextKey(key);\n }\n\n getKeyAbove(key: Key) {\n return this.getPreviousKey(key);\n }\n\n getKeyBelow(key: Key) {\n return this.getNextKey(key);\n }\n\n private isDisabled(key: Key) {\n return this.disabledKeys.has(key) || !!this.collection.getItem(key)?.props?.isDisabled;\n }\n\n getFirstKey() {\n let key = this.collection.getFirstKey();\n if (key != null && this.isDisabled(key)) {\n key = this.getNextKey(key);\n }\n return key;\n }\n\n getLastKey() {\n let key = this.collection.getLastKey();\n if (key != null && this.isDisabled(key)) {\n key = this.getPreviousKey(key);\n }\n return key;\n }\n\n getNextKey(key) {\n do {\n key = this.collection.getKeyAfter(key);\n if (key == null) {\n key = this.collection.getFirstKey();\n }\n } while (this.isDisabled(key));\n return key;\n }\n\n getPreviousKey(key) {\n do {\n key = this.collection.getKeyBefore(key);\n if (key == null) {\n key = this.collection.getLastKey();\n }\n } while (this.isDisabled(key));\n return key;\n }\n}\n"],"names":[],"version":3,"file":"TabsKeyboardDelegate.main.js.map"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/ class $bfc6f2d60b8a4c40$export$15010ca3c1abe90b {
|
|
12
|
+
getKeyLeftOf(key) {
|
|
13
|
+
if (this.flipDirection) return this.getNextKey(key);
|
|
14
|
+
return this.getPreviousKey(key);
|
|
15
|
+
}
|
|
16
|
+
getKeyRightOf(key) {
|
|
17
|
+
if (this.flipDirection) return this.getPreviousKey(key);
|
|
18
|
+
return this.getNextKey(key);
|
|
19
|
+
}
|
|
20
|
+
getKeyAbove(key) {
|
|
21
|
+
return this.getPreviousKey(key);
|
|
22
|
+
}
|
|
23
|
+
getKeyBelow(key) {
|
|
24
|
+
return this.getNextKey(key);
|
|
25
|
+
}
|
|
26
|
+
isDisabled(key) {
|
|
27
|
+
var _this_collection_getItem_props, _this_collection_getItem;
|
|
28
|
+
return this.disabledKeys.has(key) || !!((_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : (_this_collection_getItem_props = _this_collection_getItem.props) === null || _this_collection_getItem_props === void 0 ? void 0 : _this_collection_getItem_props.isDisabled);
|
|
29
|
+
}
|
|
30
|
+
getFirstKey() {
|
|
31
|
+
let key = this.collection.getFirstKey();
|
|
32
|
+
if (key != null && this.isDisabled(key)) key = this.getNextKey(key);
|
|
33
|
+
return key;
|
|
34
|
+
}
|
|
35
|
+
getLastKey() {
|
|
36
|
+
let key = this.collection.getLastKey();
|
|
37
|
+
if (key != null && this.isDisabled(key)) key = this.getPreviousKey(key);
|
|
38
|
+
return key;
|
|
39
|
+
}
|
|
40
|
+
getNextKey(key) {
|
|
41
|
+
do {
|
|
42
|
+
key = this.collection.getKeyAfter(key);
|
|
43
|
+
if (key == null) key = this.collection.getFirstKey();
|
|
44
|
+
}while (this.isDisabled(key));
|
|
45
|
+
return key;
|
|
46
|
+
}
|
|
47
|
+
getPreviousKey(key) {
|
|
48
|
+
do {
|
|
49
|
+
key = this.collection.getKeyBefore(key);
|
|
50
|
+
if (key == null) key = this.collection.getLastKey();
|
|
51
|
+
}while (this.isDisabled(key));
|
|
52
|
+
return key;
|
|
53
|
+
}
|
|
54
|
+
constructor(collection, direction, orientation, disabledKeys = new Set()){
|
|
55
|
+
this.collection = collection;
|
|
56
|
+
this.flipDirection = direction === "rtl" && orientation === "horizontal";
|
|
57
|
+
this.disabledKeys = disabledKeys;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
export {$bfc6f2d60b8a4c40$export$15010ca3c1abe90b as TabsKeyboardDelegate};
|
|
63
|
+
//# sourceMappingURL=TabsKeyboardDelegate.mjs.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/ class $bfc6f2d60b8a4c40$export$15010ca3c1abe90b {
|
|
12
|
+
getKeyLeftOf(key) {
|
|
13
|
+
if (this.flipDirection) return this.getNextKey(key);
|
|
14
|
+
return this.getPreviousKey(key);
|
|
15
|
+
}
|
|
16
|
+
getKeyRightOf(key) {
|
|
17
|
+
if (this.flipDirection) return this.getPreviousKey(key);
|
|
18
|
+
return this.getNextKey(key);
|
|
19
|
+
}
|
|
20
|
+
getKeyAbove(key) {
|
|
21
|
+
return this.getPreviousKey(key);
|
|
22
|
+
}
|
|
23
|
+
getKeyBelow(key) {
|
|
24
|
+
return this.getNextKey(key);
|
|
25
|
+
}
|
|
26
|
+
isDisabled(key) {
|
|
27
|
+
var _this_collection_getItem_props, _this_collection_getItem;
|
|
28
|
+
return this.disabledKeys.has(key) || !!((_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : (_this_collection_getItem_props = _this_collection_getItem.props) === null || _this_collection_getItem_props === void 0 ? void 0 : _this_collection_getItem_props.isDisabled);
|
|
29
|
+
}
|
|
30
|
+
getFirstKey() {
|
|
31
|
+
let key = this.collection.getFirstKey();
|
|
32
|
+
if (key != null && this.isDisabled(key)) key = this.getNextKey(key);
|
|
33
|
+
return key;
|
|
34
|
+
}
|
|
35
|
+
getLastKey() {
|
|
36
|
+
let key = this.collection.getLastKey();
|
|
37
|
+
if (key != null && this.isDisabled(key)) key = this.getPreviousKey(key);
|
|
38
|
+
return key;
|
|
39
|
+
}
|
|
40
|
+
getNextKey(key) {
|
|
41
|
+
do {
|
|
42
|
+
key = this.collection.getKeyAfter(key);
|
|
43
|
+
if (key == null) key = this.collection.getFirstKey();
|
|
44
|
+
}while (this.isDisabled(key));
|
|
45
|
+
return key;
|
|
46
|
+
}
|
|
47
|
+
getPreviousKey(key) {
|
|
48
|
+
do {
|
|
49
|
+
key = this.collection.getKeyBefore(key);
|
|
50
|
+
if (key == null) key = this.collection.getLastKey();
|
|
51
|
+
}while (this.isDisabled(key));
|
|
52
|
+
return key;
|
|
53
|
+
}
|
|
54
|
+
constructor(collection, direction, orientation, disabledKeys = new Set()){
|
|
55
|
+
this.collection = collection;
|
|
56
|
+
this.flipDirection = direction === "rtl" && orientation === "horizontal";
|
|
57
|
+
this.disabledKeys = disabledKeys;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
export {$bfc6f2d60b8a4c40$export$15010ca3c1abe90b as TabsKeyboardDelegate};
|
|
63
|
+
//# sourceMappingURL=TabsKeyboardDelegate.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA;;;;;;;;;;CAUC,GAIM,MAAM;IAWX,aAAa,GAAQ,EAAE;QACrB,IAAI,IAAI,CAAC,aAAa,EACpB,OAAO,IAAI,CAAC,UAAU,CAAC;QAEzB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B;IAEA,cAAc,GAAQ,EAAE;QACtB,IAAI,IAAI,CAAC,aAAa,EACpB,OAAO,IAAI,CAAC,cAAc,CAAC;QAE7B,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB;IAEA,YAAY,GAAQ,EAAE;QACpB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B;IAEA,YAAY,GAAQ,EAAE;QACpB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB;IAEQ,WAAW,GAAQ,EAAE;YACY,gCAAA;QAAvC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAC,2BAAA,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,kBAAxB,gDAAA,iCAAA,yBAA8B,KAAK,cAAnC,qDAAA,+BAAqC,UAAU;IACxF;IAEA,cAAc;QACZ,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW;QACrC,IAAI,OAAO,QAAQ,IAAI,CAAC,UAAU,CAAC,MACjC,MAAM,IAAI,CAAC,UAAU,CAAC;QAExB,OAAO;IACT;IAEA,aAAa;QACX,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU;QACpC,IAAI,OAAO,QAAQ,IAAI,CAAC,UAAU,CAAC,MACjC,MAAM,IAAI,CAAC,cAAc,CAAC;QAE5B,OAAO;IACT;IAEA,WAAW,GAAG,EAAE;QACd,GAAG;YACD,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;YAClC,IAAI,OAAO,MACT,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW;QAErC,QAAS,IAAI,CAAC,UAAU,CAAC,MAAM;QAC/B,OAAO;IACT;IAEA,eAAe,GAAG,EAAE;QAClB,GAAG;YACD,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;YACnC,IAAI,OAAO,MACT,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU;QAEpC,QAAS,IAAI,CAAC,UAAU,CAAC,MAAM;QAC/B,OAAO;IACT;IAlEA,YAAY,UAA+B,EAAE,SAAoB,EAAE,WAAwB,EAAE,eAAyB,IAAI,KAAK,CAAE;QAC/H,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,aAAa,GAAG,cAAc,SAAS,gBAAgB;QAC5D,IAAI,CAAC,YAAY,GAAG;IACtB;AA+DF","sources":["packages/@react-aria/tabs/src/TabsKeyboardDelegate.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, Direction, Key, KeyboardDelegate, Node, Orientation} from '@react-types/shared';\n\nexport class TabsKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: Collection<Node<T>>;\n private flipDirection: boolean;\n private disabledKeys: Set<Key>;\n\n constructor(collection: Collection<Node<T>>, direction: Direction, orientation: Orientation, disabledKeys: Set<Key> = new Set()) {\n this.collection = collection;\n this.flipDirection = direction === 'rtl' && orientation === 'horizontal';\n this.disabledKeys = disabledKeys;\n }\n\n getKeyLeftOf(key: Key) {\n if (this.flipDirection) {\n return this.getNextKey(key);\n }\n return this.getPreviousKey(key);\n }\n\n getKeyRightOf(key: Key) {\n if (this.flipDirection) {\n return this.getPreviousKey(key);\n }\n return this.getNextKey(key);\n }\n\n getKeyAbove(key: Key) {\n return this.getPreviousKey(key);\n }\n\n getKeyBelow(key: Key) {\n return this.getNextKey(key);\n }\n\n private isDisabled(key: Key) {\n return this.disabledKeys.has(key) || !!this.collection.getItem(key)?.props?.isDisabled;\n }\n\n getFirstKey() {\n let key = this.collection.getFirstKey();\n if (key != null && this.isDisabled(key)) {\n key = this.getNextKey(key);\n }\n return key;\n }\n\n getLastKey() {\n let key = this.collection.getLastKey();\n if (key != null && this.isDisabled(key)) {\n key = this.getPreviousKey(key);\n }\n return key;\n }\n\n getNextKey(key) {\n do {\n key = this.collection.getKeyAfter(key);\n if (key == null) {\n key = this.collection.getFirstKey();\n }\n } while (this.isDisabled(key));\n return key;\n }\n\n getPreviousKey(key) {\n do {\n key = this.collection.getKeyBefore(key);\n if (key == null) {\n key = this.collection.getLastKey();\n }\n } while (this.isDisabled(key));\n return key;\n }\n}\n"],"names":[],"version":3,"file":"TabsKeyboardDelegate.module.js.map"}
|
package/dist/import.mjs
CHANGED
|
@@ -1,86 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {useMemo as $8kq0t$useMemo} from "react";
|
|
5
|
-
import {useLocale as $8kq0t$useLocale} from "@react-aria/i18n";
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
9
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
11
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
*
|
|
13
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
14
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
15
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
|
-
* governing permissions and limitations under the License.
|
|
17
|
-
*/ /*
|
|
18
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
19
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
20
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
21
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
22
|
-
*
|
|
23
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
24
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
25
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
26
|
-
* governing permissions and limitations under the License.
|
|
27
|
-
*/
|
|
28
|
-
/*
|
|
29
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
30
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
31
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
32
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
33
|
-
*
|
|
34
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
35
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
36
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
37
|
-
* governing permissions and limitations under the License.
|
|
38
|
-
*/ const $99b62ae3ff97ec45$export$c5f62239608282b6 = new WeakMap();
|
|
39
|
-
function $99b62ae3ff97ec45$export$567fc7097e064344(state, key, role) {
|
|
40
|
-
if (typeof key === "string") key = key.replace(/\s+/g, "");
|
|
41
|
-
let baseId = $99b62ae3ff97ec45$export$c5f62239608282b6.get(state);
|
|
42
|
-
return `${baseId}-${role}-${key}`;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
function $0175d55c2a017ebc$export$fdf4756d5b8ef90a(props, state, ref) {
|
|
48
|
-
let { key: key, isDisabled: propsDisabled, shouldSelectOnPressUp: shouldSelectOnPressUp } = props;
|
|
49
|
-
let { selectionManager: manager, selectedKey: selectedKey } = state;
|
|
50
|
-
let isSelected = key === selectedKey;
|
|
51
|
-
let isDisabled = propsDisabled || state.isDisabled || state.selectionManager.isDisabled(key);
|
|
52
|
-
let { itemProps: itemProps, isPressed: isPressed } = (0, $8kq0t$useSelectableItem)({
|
|
53
|
-
selectionManager: manager,
|
|
54
|
-
key: key,
|
|
55
|
-
ref: ref,
|
|
56
|
-
isDisabled: isDisabled,
|
|
57
|
-
shouldSelectOnPressUp: shouldSelectOnPressUp,
|
|
58
|
-
linkBehavior: "selection"
|
|
59
|
-
});
|
|
60
|
-
let tabId = (0, $99b62ae3ff97ec45$export$567fc7097e064344)(state, key, "tab");
|
|
61
|
-
let tabPanelId = (0, $99b62ae3ff97ec45$export$567fc7097e064344)(state, key, "tabpanel");
|
|
62
|
-
let { tabIndex: tabIndex } = itemProps;
|
|
63
|
-
let item = state.collection.getItem(key);
|
|
64
|
-
let domProps = (0, $8kq0t$filterDOMProps)(item === null || item === void 0 ? void 0 : item.props, {
|
|
65
|
-
labelable: true
|
|
66
|
-
});
|
|
67
|
-
delete domProps.id;
|
|
68
|
-
let linkProps = (0, $8kq0t$useLinkProps)(item === null || item === void 0 ? void 0 : item.props);
|
|
69
|
-
return {
|
|
70
|
-
tabProps: (0, $8kq0t$mergeProps)(domProps, linkProps, itemProps, {
|
|
71
|
-
id: tabId,
|
|
72
|
-
"aria-selected": isSelected,
|
|
73
|
-
"aria-disabled": isDisabled || undefined,
|
|
74
|
-
"aria-controls": isSelected ? tabPanelId : undefined,
|
|
75
|
-
tabIndex: isDisabled ? undefined : tabIndex,
|
|
76
|
-
role: "tab"
|
|
77
|
-
}),
|
|
78
|
-
isSelected: isSelected,
|
|
79
|
-
isDisabled: isDisabled,
|
|
80
|
-
isPressed: isPressed
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
|
|
1
|
+
import {useTab as $0175d55c2a017ebc$export$fdf4756d5b8ef90a} from "./useTab.mjs";
|
|
2
|
+
import {useTabPanel as $34bce698202e07cb$export$fae0121b5afe572d} from "./useTabPanel.mjs";
|
|
3
|
+
import {useTabList as $58d314389b21fa3f$export$773e389e644c5874} from "./useTabList.mjs";
|
|
84
4
|
|
|
85
5
|
/*
|
|
86
6
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -95,142 +15,6 @@ function $0175d55c2a017ebc$export$fdf4756d5b8ef90a(props, state, ref) {
|
|
|
95
15
|
*/
|
|
96
16
|
|
|
97
17
|
|
|
98
|
-
function $34bce698202e07cb$export$fae0121b5afe572d(props, state, ref) {
|
|
99
|
-
// The tabpanel should have tabIndex=0 when there are no tabbable elements within it.
|
|
100
|
-
// Otherwise, tabbing from the focused tab should go directly to the first tabbable element
|
|
101
|
-
// within the tabpanel.
|
|
102
|
-
let tabIndex = (0, $8kq0t$useHasTabbableChild)(ref) ? undefined : 0;
|
|
103
|
-
var _props_id;
|
|
104
|
-
const id = (0, $99b62ae3ff97ec45$export$567fc7097e064344)(state, (_props_id = props.id) !== null && _props_id !== void 0 ? _props_id : state === null || state === void 0 ? void 0 : state.selectedKey, "tabpanel");
|
|
105
|
-
const tabPanelProps = (0, $8kq0t$useLabels)({
|
|
106
|
-
...props,
|
|
107
|
-
id: id,
|
|
108
|
-
"aria-labelledby": (0, $99b62ae3ff97ec45$export$567fc7097e064344)(state, state === null || state === void 0 ? void 0 : state.selectedKey, "tab")
|
|
109
|
-
});
|
|
110
|
-
return {
|
|
111
|
-
tabPanelProps: (0, $8kq0t$mergeProps)(tabPanelProps, {
|
|
112
|
-
tabIndex: tabIndex,
|
|
113
|
-
role: "tabpanel",
|
|
114
|
-
"aria-describedby": props["aria-describedby"],
|
|
115
|
-
"aria-details": props["aria-details"]
|
|
116
|
-
})
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
/*
|
|
122
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
123
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
124
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
125
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
126
|
-
*
|
|
127
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
128
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
129
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
130
|
-
* governing permissions and limitations under the License.
|
|
131
|
-
*/
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
/*
|
|
135
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
136
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
137
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
138
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
139
|
-
*
|
|
140
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
141
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
142
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
143
|
-
* governing permissions and limitations under the License.
|
|
144
|
-
*/ class $bfc6f2d60b8a4c40$export$15010ca3c1abe90b {
|
|
145
|
-
getKeyLeftOf(key) {
|
|
146
|
-
if (this.flipDirection) return this.getNextKey(key);
|
|
147
|
-
return this.getPreviousKey(key);
|
|
148
|
-
}
|
|
149
|
-
getKeyRightOf(key) {
|
|
150
|
-
if (this.flipDirection) return this.getPreviousKey(key);
|
|
151
|
-
return this.getNextKey(key);
|
|
152
|
-
}
|
|
153
|
-
getKeyAbove(key) {
|
|
154
|
-
return this.getPreviousKey(key);
|
|
155
|
-
}
|
|
156
|
-
getKeyBelow(key) {
|
|
157
|
-
return this.getNextKey(key);
|
|
158
|
-
}
|
|
159
|
-
isDisabled(key) {
|
|
160
|
-
var _this_collection_getItem_props, _this_collection_getItem;
|
|
161
|
-
return this.disabledKeys.has(key) || !!((_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : (_this_collection_getItem_props = _this_collection_getItem.props) === null || _this_collection_getItem_props === void 0 ? void 0 : _this_collection_getItem_props.isDisabled);
|
|
162
|
-
}
|
|
163
|
-
getFirstKey() {
|
|
164
|
-
let key = this.collection.getFirstKey();
|
|
165
|
-
if (key != null && this.isDisabled(key)) key = this.getNextKey(key);
|
|
166
|
-
return key;
|
|
167
|
-
}
|
|
168
|
-
getLastKey() {
|
|
169
|
-
let key = this.collection.getLastKey();
|
|
170
|
-
if (key != null && this.isDisabled(key)) key = this.getPreviousKey(key);
|
|
171
|
-
return key;
|
|
172
|
-
}
|
|
173
|
-
getNextKey(key) {
|
|
174
|
-
do {
|
|
175
|
-
key = this.collection.getKeyAfter(key);
|
|
176
|
-
if (key == null) key = this.collection.getFirstKey();
|
|
177
|
-
}while (this.isDisabled(key));
|
|
178
|
-
return key;
|
|
179
|
-
}
|
|
180
|
-
getPreviousKey(key) {
|
|
181
|
-
do {
|
|
182
|
-
key = this.collection.getKeyBefore(key);
|
|
183
|
-
if (key == null) key = this.collection.getLastKey();
|
|
184
|
-
}while (this.isDisabled(key));
|
|
185
|
-
return key;
|
|
186
|
-
}
|
|
187
|
-
constructor(collection, direction, orientation, disabledKeys = new Set()){
|
|
188
|
-
this.collection = collection;
|
|
189
|
-
this.flipDirection = direction === "rtl" && orientation === "horizontal";
|
|
190
|
-
this.disabledKeys = disabledKeys;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
function $58d314389b21fa3f$export$773e389e644c5874(props, state, ref) {
|
|
198
|
-
let { orientation: orientation = "horizontal", keyboardActivation: keyboardActivation = "automatic" } = props;
|
|
199
|
-
let { collection: collection, selectionManager: manager, disabledKeys: disabledKeys } = state;
|
|
200
|
-
let { direction: direction } = (0, $8kq0t$useLocale)();
|
|
201
|
-
let delegate = (0, $8kq0t$useMemo)(()=>new (0, $bfc6f2d60b8a4c40$export$15010ca3c1abe90b)(collection, direction, orientation, disabledKeys), [
|
|
202
|
-
collection,
|
|
203
|
-
disabledKeys,
|
|
204
|
-
orientation,
|
|
205
|
-
direction
|
|
206
|
-
]);
|
|
207
|
-
let { collectionProps: collectionProps } = (0, $8kq0t$useSelectableCollection)({
|
|
208
|
-
ref: ref,
|
|
209
|
-
selectionManager: manager,
|
|
210
|
-
keyboardDelegate: delegate,
|
|
211
|
-
selectOnFocus: keyboardActivation === "automatic",
|
|
212
|
-
disallowEmptySelection: true,
|
|
213
|
-
scrollRef: ref,
|
|
214
|
-
linkBehavior: "selection"
|
|
215
|
-
});
|
|
216
|
-
// Compute base id for all tabs
|
|
217
|
-
let tabsId = (0, $8kq0t$useId)();
|
|
218
|
-
(0, $99b62ae3ff97ec45$export$c5f62239608282b6).set(state, tabsId);
|
|
219
|
-
let tabListLabelProps = (0, $8kq0t$useLabels)({
|
|
220
|
-
...props,
|
|
221
|
-
id: tabsId
|
|
222
|
-
});
|
|
223
|
-
return {
|
|
224
|
-
tabListProps: {
|
|
225
|
-
...(0, $8kq0t$mergeProps)(collectionProps, tabListLabelProps),
|
|
226
|
-
role: "tablist",
|
|
227
|
-
"aria-orientation": orientation,
|
|
228
|
-
tabIndex: undefined
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
|
|
234
18
|
|
|
235
19
|
|
|
236
20
|
export {$0175d55c2a017ebc$export$fdf4756d5b8ef90a as useTab, $34bce698202e07cb$export$fae0121b5afe572d as useTabPanel, $58d314389b21fa3f$export$773e389e644c5874 as useTabList};
|