@react-aria/tabs 3.9.4 → 3.9.6-nightly.5022
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 +9 -6
- package/dist/TabsKeyboardDelegate.main.js.map +1 -1
- package/dist/TabsKeyboardDelegate.mjs +9 -6
- package/dist/TabsKeyboardDelegate.module.js +9 -6
- package/dist/TabsKeyboardDelegate.module.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/useTabPanel.main.js.map +1 -1
- package/dist/useTabPanel.module.js.map +1 -1
- package/dist/utils.main.js +2 -0
- package/dist/utils.main.js.map +1 -1
- package/dist/utils.mjs +2 -0
- package/dist/utils.module.js +2 -0
- package/dist/utils.module.js.map +1 -1
- package/package.json +9 -9
- package/src/TabsKeyboardDelegate.ts +16 -7
- package/src/useTabPanel.ts +1 -1
- package/src/utils.ts +5 -1
|
@@ -23,12 +23,6 @@ $parcel$export(module.exports, "TabsKeyboardDelegate", () => $283e5d8830177ead$e
|
|
|
23
23
|
if (this.flipDirection) return this.getPreviousKey(key);
|
|
24
24
|
return this.getNextKey(key);
|
|
25
25
|
}
|
|
26
|
-
getKeyAbove(key) {
|
|
27
|
-
return this.getPreviousKey(key);
|
|
28
|
-
}
|
|
29
|
-
getKeyBelow(key) {
|
|
30
|
-
return this.getNextKey(key);
|
|
31
|
-
}
|
|
32
26
|
isDisabled(key) {
|
|
33
27
|
var _this_collection_getItem_props, _this_collection_getItem;
|
|
34
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);
|
|
@@ -43,6 +37,14 @@ $parcel$export(module.exports, "TabsKeyboardDelegate", () => $283e5d8830177ead$e
|
|
|
43
37
|
if (key != null && this.isDisabled(key)) key = this.getPreviousKey(key);
|
|
44
38
|
return key;
|
|
45
39
|
}
|
|
40
|
+
getKeyAbove(key) {
|
|
41
|
+
if (this.tabDirection) return null;
|
|
42
|
+
return this.getPreviousKey(key);
|
|
43
|
+
}
|
|
44
|
+
getKeyBelow(key) {
|
|
45
|
+
if (this.tabDirection) return null;
|
|
46
|
+
return this.getNextKey(key);
|
|
47
|
+
}
|
|
46
48
|
getNextKey(key) {
|
|
47
49
|
do {
|
|
48
50
|
key = this.collection.getKeyAfter(key);
|
|
@@ -61,6 +63,7 @@ $parcel$export(module.exports, "TabsKeyboardDelegate", () => $283e5d8830177ead$e
|
|
|
61
63
|
this.collection = collection;
|
|
62
64
|
this.flipDirection = direction === 'rtl' && orientation === 'horizontal';
|
|
63
65
|
this.disabledKeys = disabledKeys;
|
|
66
|
+
this.tabDirection = orientation === 'horizontal';
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
69
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAIM,MAAM;
|
|
1
|
+
{"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAIM,MAAM;IAaX,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;IAGQ,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;Q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*\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 private tabDirection: boolean;\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 this.tabDirection = orientation === 'horizontal';\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\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 getKeyAbove(key: Key) {\n if (this.tabDirection) {\n return null;\n }\n return this.getPreviousKey(key);\n }\n\n getKeyBelow(key: Key) {\n if (this.tabDirection) {\n return null;\n }\n return this.getNextKey(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"}
|
|
@@ -17,12 +17,6 @@
|
|
|
17
17
|
if (this.flipDirection) return this.getPreviousKey(key);
|
|
18
18
|
return this.getNextKey(key);
|
|
19
19
|
}
|
|
20
|
-
getKeyAbove(key) {
|
|
21
|
-
return this.getPreviousKey(key);
|
|
22
|
-
}
|
|
23
|
-
getKeyBelow(key) {
|
|
24
|
-
return this.getNextKey(key);
|
|
25
|
-
}
|
|
26
20
|
isDisabled(key) {
|
|
27
21
|
var _this_collection_getItem_props, _this_collection_getItem;
|
|
28
22
|
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);
|
|
@@ -37,6 +31,14 @@
|
|
|
37
31
|
if (key != null && this.isDisabled(key)) key = this.getPreviousKey(key);
|
|
38
32
|
return key;
|
|
39
33
|
}
|
|
34
|
+
getKeyAbove(key) {
|
|
35
|
+
if (this.tabDirection) return null;
|
|
36
|
+
return this.getPreviousKey(key);
|
|
37
|
+
}
|
|
38
|
+
getKeyBelow(key) {
|
|
39
|
+
if (this.tabDirection) return null;
|
|
40
|
+
return this.getNextKey(key);
|
|
41
|
+
}
|
|
40
42
|
getNextKey(key) {
|
|
41
43
|
do {
|
|
42
44
|
key = this.collection.getKeyAfter(key);
|
|
@@ -55,6 +57,7 @@
|
|
|
55
57
|
this.collection = collection;
|
|
56
58
|
this.flipDirection = direction === 'rtl' && orientation === 'horizontal';
|
|
57
59
|
this.disabledKeys = disabledKeys;
|
|
60
|
+
this.tabDirection = orientation === 'horizontal';
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
63
|
|
|
@@ -17,12 +17,6 @@
|
|
|
17
17
|
if (this.flipDirection) return this.getPreviousKey(key);
|
|
18
18
|
return this.getNextKey(key);
|
|
19
19
|
}
|
|
20
|
-
getKeyAbove(key) {
|
|
21
|
-
return this.getPreviousKey(key);
|
|
22
|
-
}
|
|
23
|
-
getKeyBelow(key) {
|
|
24
|
-
return this.getNextKey(key);
|
|
25
|
-
}
|
|
26
20
|
isDisabled(key) {
|
|
27
21
|
var _this_collection_getItem_props, _this_collection_getItem;
|
|
28
22
|
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);
|
|
@@ -37,6 +31,14 @@
|
|
|
37
31
|
if (key != null && this.isDisabled(key)) key = this.getPreviousKey(key);
|
|
38
32
|
return key;
|
|
39
33
|
}
|
|
34
|
+
getKeyAbove(key) {
|
|
35
|
+
if (this.tabDirection) return null;
|
|
36
|
+
return this.getPreviousKey(key);
|
|
37
|
+
}
|
|
38
|
+
getKeyBelow(key) {
|
|
39
|
+
if (this.tabDirection) return null;
|
|
40
|
+
return this.getNextKey(key);
|
|
41
|
+
}
|
|
40
42
|
getNextKey(key) {
|
|
41
43
|
do {
|
|
42
44
|
key = this.collection.getKeyAfter(key);
|
|
@@ -55,6 +57,7 @@
|
|
|
55
57
|
this.collection = collection;
|
|
56
58
|
this.flipDirection = direction === 'rtl' && orientation === 'horizontal';
|
|
57
59
|
this.disabledKeys = disabledKeys;
|
|
60
|
+
this.tabDirection = orientation === 'horizontal';
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
63
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAAA;;;;;;;;;;CAUC,GAIM,MAAM;
|
|
1
|
+
{"mappings":"AAAA;;;;;;;;;;CAUC,GAIM,MAAM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;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;IA1EA,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;QACpB,IAAI,CAAC,YAAY,GAAG,gBAAgB;IACtC;AAsEF","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 private tabDirection: boolean;\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 this.tabDirection = orientation === 'horizontal';\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\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 getKeyAbove(key: Key) {\n if (this.tabDirection) {\n return null;\n }\n return this.getPreviousKey(key);\n }\n\n getKeyBelow(key: Key) {\n if (this.tabDirection) {\n return null;\n }\n return this.getNextKey(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/types.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export interface TabPanelAria {
|
|
|
24
24
|
* Provides the behavior and accessibility implementation for a tab panel. A tab panel is a container for
|
|
25
25
|
* the contents of a tab, and is shown when the tab is selected.
|
|
26
26
|
*/
|
|
27
|
-
export function useTabPanel<T>(props: AriaTabPanelProps, state: TabListState<T
|
|
27
|
+
export function useTabPanel<T>(props: AriaTabPanelProps, state: TabListState<T> | null, ref: RefObject<Element | null>): TabPanelAria;
|
|
28
28
|
export interface AriaTabListOptions<T> extends Omit<AriaTabListProps<T>, 'children'> {
|
|
29
29
|
}
|
|
30
30
|
export interface TabListAria {
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;ACmBA;IACE,iCAAiC;IACjC,QAAQ,EAAE,aAAa,CAAC;IAC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CAAuC;IACvC,YAAY,EAAE,aAAa,CAAA;CAC5B;AAED;;;GAGG;AACH,2BAA2B,CAAC,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,GAAG,WAAW,CAyCnI;AC5DD,YAAY,EAAC,gBAAgB,EAAE,iBAAiB,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AACzF,YAAY,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC","sources":["packages/@react-aria/tabs/src/packages/@react-aria/tabs/src/utils.ts","packages/@react-aria/tabs/src/packages/@react-aria/tabs/src/useTab.ts","packages/@react-aria/tabs/src/packages/@react-aria/tabs/src/useTabPanel.ts","packages/@react-aria/tabs/src/packages/@react-aria/tabs/src/TabsKeyboardDelegate.ts","packages/@react-aria/tabs/src/packages/@react-aria/tabs/src/useTabList.ts","packages/@react-aria/tabs/src/packages/@react-aria/tabs/src/index.ts","packages/@react-aria/tabs/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,"/*\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 */\nexport {useTab} from './useTab';\nexport {useTabPanel} from './useTabPanel';\nexport {useTabList} from './useTabList';\nexport type {AriaTabListProps, AriaTabPanelProps, AriaTabProps} from '@react-types/tabs';\nexport type {Orientation} from '@react-types/shared';\nexport type {TabAria} from './useTab';\nexport type {TabPanelAria} from './useTabPanel';\nexport type {AriaTabListOptions, TabListAria} from './useTabList';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAmBM,SAAS,0CAAe,KAAwB,EAAE,
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAmBM,SAAS,0CAAe,KAAwB,EAAE,KAA6B,EAAE,GAA8B;IACpH,qFAAqF;IACrF,2FAA2F;IAC3F,uBAAuB;IACvB,IAAI,WAAW,CAAA,GAAA,yCAAkB,EAAE,OAAO,YAAY;QAEzB;IAA7B,MAAM,KAAK,CAAA,GAAA,oCAAS,EAAE,OAAO,CAAA,YAAA,MAAM,EAAE,cAAR,uBAAA,YAAY,kBAAA,4BAAA,MAAO,WAAW,EAAE;IAC7D,MAAM,gBAAgB,CAAA,GAAA,+BAAQ,EAAE;QAAC,GAAG,KAAK;YAAE;QAAI,mBAAmB,CAAA,GAAA,oCAAS,EAAE,OAAO,kBAAA,4BAAA,MAAO,WAAW,EAAE;IAAM;IAE9G,OAAO;QACL,eAAe,CAAA,GAAA,gCAAS,EAAE,eAAe;sBACvC;YACA,MAAM;YACN,oBAAoB,KAAK,CAAC,mBAAmB;YAC7C,gBAAgB,KAAK,CAAC,eAAe;QACvC;IACF;AACF","sources":["packages/@react-aria/tabs/src/useTabPanel.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 {AriaTabPanelProps} from '@react-types/tabs';\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {generateId} from './utils';\nimport {mergeProps, useLabels} from '@react-aria/utils';\nimport {TabListState} from '@react-stately/tabs';\nimport {useHasTabbableChild} from '@react-aria/focus';\n\nexport interface TabPanelAria {\n /** Props for the tab panel element. */\n tabPanelProps: DOMAttributes\n}\n\n\n/**\n * Provides the behavior and accessibility implementation for a tab panel. A tab panel is a container for\n * the contents of a tab, and is shown when the tab is selected.\n */\nexport function useTabPanel<T>(props: AriaTabPanelProps, state: TabListState<T> | null, ref: RefObject<Element | null>): TabPanelAria {\n // The tabpanel should have tabIndex=0 when there are no tabbable elements within it.\n // Otherwise, tabbing from the focused tab should go directly to the first tabbable element\n // within the tabpanel.\n let tabIndex = useHasTabbableChild(ref) ? undefined : 0;\n\n const id = generateId(state, props.id ?? state?.selectedKey, 'tabpanel');\n const tabPanelProps = useLabels({...props, id, 'aria-labelledby': generateId(state, state?.selectedKey, 'tab')});\n\n return {\n tabPanelProps: mergeProps(tabPanelProps, {\n tabIndex,\n role: 'tabpanel',\n 'aria-describedby': props['aria-describedby'],\n 'aria-details': props['aria-details']\n })\n };\n}\n"],"names":[],"version":3,"file":"useTabPanel.main.js.map"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAmBM,SAAS,0CAAe,KAAwB,EAAE,
|
|
1
|
+
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAmBM,SAAS,0CAAe,KAAwB,EAAE,KAA6B,EAAE,GAA8B;IACpH,qFAAqF;IACrF,2FAA2F;IAC3F,uBAAuB;IACvB,IAAI,WAAW,CAAA,GAAA,0BAAkB,EAAE,OAAO,YAAY;QAEzB;IAA7B,MAAM,KAAK,CAAA,GAAA,yCAAS,EAAE,OAAO,CAAA,YAAA,MAAM,EAAE,cAAR,uBAAA,YAAY,kBAAA,4BAAA,MAAO,WAAW,EAAE;IAC7D,MAAM,gBAAgB,CAAA,GAAA,gBAAQ,EAAE;QAAC,GAAG,KAAK;YAAE;QAAI,mBAAmB,CAAA,GAAA,yCAAS,EAAE,OAAO,kBAAA,4BAAA,MAAO,WAAW,EAAE;IAAM;IAE9G,OAAO;QACL,eAAe,CAAA,GAAA,iBAAS,EAAE,eAAe;sBACvC;YACA,MAAM;YACN,oBAAoB,KAAK,CAAC,mBAAmB;YAC7C,gBAAgB,KAAK,CAAC,eAAe;QACvC;IACF;AACF","sources":["packages/@react-aria/tabs/src/useTabPanel.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 {AriaTabPanelProps} from '@react-types/tabs';\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {generateId} from './utils';\nimport {mergeProps, useLabels} from '@react-aria/utils';\nimport {TabListState} from '@react-stately/tabs';\nimport {useHasTabbableChild} from '@react-aria/focus';\n\nexport interface TabPanelAria {\n /** Props for the tab panel element. */\n tabPanelProps: DOMAttributes\n}\n\n\n/**\n * Provides the behavior and accessibility implementation for a tab panel. A tab panel is a container for\n * the contents of a tab, and is shown when the tab is selected.\n */\nexport function useTabPanel<T>(props: AriaTabPanelProps, state: TabListState<T> | null, ref: RefObject<Element | null>): TabPanelAria {\n // The tabpanel should have tabIndex=0 when there are no tabbable elements within it.\n // Otherwise, tabbing from the focused tab should go directly to the first tabbable element\n // within the tabpanel.\n let tabIndex = useHasTabbableChild(ref) ? undefined : 0;\n\n const id = generateId(state, props.id ?? state?.selectedKey, 'tabpanel');\n const tabPanelProps = useLabels({...props, id, 'aria-labelledby': generateId(state, state?.selectedKey, 'tab')});\n\n return {\n tabPanelProps: mergeProps(tabPanelProps, {\n tabIndex,\n role: 'tabpanel',\n 'aria-describedby': props['aria-describedby'],\n 'aria-details': props['aria-details']\n })\n };\n}\n"],"names":[],"version":3,"file":"useTabPanel.module.js.map"}
|
package/dist/utils.main.js
CHANGED
|
@@ -17,6 +17,8 @@ $parcel$export(module.exports, "generateId", () => $a217ebca77471970$export$567f
|
|
|
17
17
|
* governing permissions and limitations under the License.
|
|
18
18
|
*/ const $a217ebca77471970$export$c5f62239608282b6 = new WeakMap();
|
|
19
19
|
function $a217ebca77471970$export$567fc7097e064344(state, key, role) {
|
|
20
|
+
if (!state) // this case should only happen in the first render before the tabs are registered
|
|
21
|
+
return '';
|
|
20
22
|
if (typeof key === 'string') key = key.replace(/\s+/g, '');
|
|
21
23
|
let baseId = $a217ebca77471970$export$c5f62239608282b6.get(state);
|
|
22
24
|
return `${baseId}-${role}-${key}`;
|
package/dist/utils.main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC,GAKM,MAAM,4CAAU,IAAI;AAEpB,SAAS,0CAAc,
|
|
1
|
+
{"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC,GAKM,MAAM,4CAAU,IAAI;AAEpB,SAAS,0CAAc,KAA6B,EAAE,GAA2B,EAAE,IAAY;IACpG,IAAI,CAAC,OACH,kFAAkF;IAClF,OAAO;IAET,IAAI,OAAO,QAAQ,UACjB,MAAM,IAAI,OAAO,CAAC,QAAQ;IAG5B,IAAI,SAAS,0CAAQ,GAAG,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC;AACnC","sources":["packages/@react-aria/tabs/src/utils.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 {Key} from '@react-types/shared';\nimport {TabListState} from '@react-stately/tabs';\n\nexport const tabsIds = new WeakMap<TabListState<unknown>, string>();\n\nexport function generateId<T>(state: TabListState<T> | null, key: Key | null | undefined, role: string) {\n if (!state) {\n // this case should only happen in the first render before the tabs are registered\n return '';\n }\n if (typeof key === 'string') {\n key = key.replace(/\\s+/g, '');\n }\n\n let baseId = tabsIds.get(state);\n return `${baseId}-${role}-${key}`;\n}\n\n"],"names":[],"version":3,"file":"utils.main.js.map"}
|
package/dist/utils.mjs
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/ const $99b62ae3ff97ec45$export$c5f62239608282b6 = new WeakMap();
|
|
12
12
|
function $99b62ae3ff97ec45$export$567fc7097e064344(state, key, role) {
|
|
13
|
+
if (!state) // this case should only happen in the first render before the tabs are registered
|
|
14
|
+
return '';
|
|
13
15
|
if (typeof key === 'string') key = key.replace(/\s+/g, '');
|
|
14
16
|
let baseId = $99b62ae3ff97ec45$export$c5f62239608282b6.get(state);
|
|
15
17
|
return `${baseId}-${role}-${key}`;
|
package/dist/utils.module.js
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/ const $99b62ae3ff97ec45$export$c5f62239608282b6 = new WeakMap();
|
|
12
12
|
function $99b62ae3ff97ec45$export$567fc7097e064344(state, key, role) {
|
|
13
|
+
if (!state) // this case should only happen in the first render before the tabs are registered
|
|
14
|
+
return '';
|
|
13
15
|
if (typeof key === 'string') key = key.replace(/\s+/g, '');
|
|
14
16
|
let baseId = $99b62ae3ff97ec45$export$c5f62239608282b6.get(state);
|
|
15
17
|
return `${baseId}-${role}-${key}`;
|
package/dist/utils.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAAA;;;;;;;;;;CAUC,GAKM,MAAM,4CAAU,IAAI;AAEpB,SAAS,0CAAc,
|
|
1
|
+
{"mappings":"AAAA;;;;;;;;;;CAUC,GAKM,MAAM,4CAAU,IAAI;AAEpB,SAAS,0CAAc,KAA6B,EAAE,GAA2B,EAAE,IAAY;IACpG,IAAI,CAAC,OACH,kFAAkF;IAClF,OAAO;IAET,IAAI,OAAO,QAAQ,UACjB,MAAM,IAAI,OAAO,CAAC,QAAQ;IAG5B,IAAI,SAAS,0CAAQ,GAAG,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC;AACnC","sources":["packages/@react-aria/tabs/src/utils.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 {Key} from '@react-types/shared';\nimport {TabListState} from '@react-stately/tabs';\n\nexport const tabsIds = new WeakMap<TabListState<unknown>, string>();\n\nexport function generateId<T>(state: TabListState<T> | null, key: Key | null | undefined, role: string) {\n if (!state) {\n // this case should only happen in the first render before the tabs are registered\n return '';\n }\n if (typeof key === 'string') {\n key = key.replace(/\\s+/g, '');\n }\n\n let baseId = tabsIds.get(state);\n return `${baseId}-${role}-${key}`;\n}\n\n"],"names":[],"version":3,"file":"utils.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/tabs",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.6-nightly.5022+b4093dfef",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-aria/focus": "
|
|
26
|
-
"@react-aria/i18n": "
|
|
27
|
-
"@react-aria/selection": "
|
|
28
|
-
"@react-aria/utils": "
|
|
29
|
-
"@react-stately/tabs": "
|
|
30
|
-
"@react-types/shared": "
|
|
31
|
-
"@react-types/tabs": "
|
|
25
|
+
"@react-aria/focus": "3.0.0-nightly.3094+b4093dfef",
|
|
26
|
+
"@react-aria/i18n": "3.0.0-nightly.3094+b4093dfef",
|
|
27
|
+
"@react-aria/selection": "3.0.0-nightly.3094+b4093dfef",
|
|
28
|
+
"@react-aria/utils": "3.0.0-nightly.3094+b4093dfef",
|
|
29
|
+
"@react-stately/tabs": "3.0.0-nightly.3094+b4093dfef",
|
|
30
|
+
"@react-types/shared": "3.0.0-nightly.3094+b4093dfef",
|
|
31
|
+
"@react-types/tabs": "3.3.10-nightly.5022+b4093dfef",
|
|
32
32
|
"@swc/helpers": "^0.5.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "b4093dfef3eff0e5fe60d00c53fe2478b96e662f"
|
|
42
42
|
}
|
|
@@ -16,11 +16,13 @@ export class TabsKeyboardDelegate<T> implements KeyboardDelegate {
|
|
|
16
16
|
private collection: Collection<Node<T>>;
|
|
17
17
|
private flipDirection: boolean;
|
|
18
18
|
private disabledKeys: Set<Key>;
|
|
19
|
+
private tabDirection: boolean;
|
|
19
20
|
|
|
20
21
|
constructor(collection: Collection<Node<T>>, direction: Direction, orientation: Orientation, disabledKeys: Set<Key> = new Set()) {
|
|
21
22
|
this.collection = collection;
|
|
22
23
|
this.flipDirection = direction === 'rtl' && orientation === 'horizontal';
|
|
23
24
|
this.disabledKeys = disabledKeys;
|
|
25
|
+
this.tabDirection = orientation === 'horizontal';
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
getKeyLeftOf(key: Key) {
|
|
@@ -37,13 +39,6 @@ export class TabsKeyboardDelegate<T> implements KeyboardDelegate {
|
|
|
37
39
|
return this.getNextKey(key);
|
|
38
40
|
}
|
|
39
41
|
|
|
40
|
-
getKeyAbove(key: Key) {
|
|
41
|
-
return this.getPreviousKey(key);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
getKeyBelow(key: Key) {
|
|
45
|
-
return this.getNextKey(key);
|
|
46
|
-
}
|
|
47
42
|
|
|
48
43
|
private isDisabled(key: Key) {
|
|
49
44
|
return this.disabledKeys.has(key) || !!this.collection.getItem(key)?.props?.isDisabled;
|
|
@@ -64,6 +59,20 @@ export class TabsKeyboardDelegate<T> implements KeyboardDelegate {
|
|
|
64
59
|
}
|
|
65
60
|
return key;
|
|
66
61
|
}
|
|
62
|
+
|
|
63
|
+
getKeyAbove(key: Key) {
|
|
64
|
+
if (this.tabDirection) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
return this.getPreviousKey(key);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
getKeyBelow(key: Key) {
|
|
71
|
+
if (this.tabDirection) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
return this.getNextKey(key);
|
|
75
|
+
}
|
|
67
76
|
|
|
68
77
|
getNextKey(key) {
|
|
69
78
|
do {
|
package/src/useTabPanel.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface TabPanelAria {
|
|
|
27
27
|
* Provides the behavior and accessibility implementation for a tab panel. A tab panel is a container for
|
|
28
28
|
* the contents of a tab, and is shown when the tab is selected.
|
|
29
29
|
*/
|
|
30
|
-
export function useTabPanel<T>(props: AriaTabPanelProps, state: TabListState<T
|
|
30
|
+
export function useTabPanel<T>(props: AriaTabPanelProps, state: TabListState<T> | null, ref: RefObject<Element | null>): TabPanelAria {
|
|
31
31
|
// The tabpanel should have tabIndex=0 when there are no tabbable elements within it.
|
|
32
32
|
// Otherwise, tabbing from the focused tab should go directly to the first tabbable element
|
|
33
33
|
// within the tabpanel.
|
package/src/utils.ts
CHANGED
|
@@ -15,7 +15,11 @@ import {TabListState} from '@react-stately/tabs';
|
|
|
15
15
|
|
|
16
16
|
export const tabsIds = new WeakMap<TabListState<unknown>, string>();
|
|
17
17
|
|
|
18
|
-
export function generateId<T>(state: TabListState<T
|
|
18
|
+
export function generateId<T>(state: TabListState<T> | null, key: Key | null | undefined, role: string) {
|
|
19
|
+
if (!state) {
|
|
20
|
+
// this case should only happen in the first render before the tabs are registered
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
19
23
|
if (typeof key === 'string') {
|
|
20
24
|
key = key.replace(/\s+/g, '');
|
|
21
25
|
}
|