@react-aria/tabs 3.11.0 → 3.12.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/import.mjs +2 -6
- package/dist/main.js +4 -8
- package/dist/main.js.map +1 -1
- package/dist/module.js +2 -6
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +3 -0
- package/package.json +16 -18
- package/src/index.ts +3 -7
- package/dist/TabsKeyboardDelegate.main.js +0 -73
- package/dist/TabsKeyboardDelegate.main.js.map +0 -1
- package/dist/TabsKeyboardDelegate.mjs +0 -68
- package/dist/TabsKeyboardDelegate.module.js +0 -68
- package/dist/TabsKeyboardDelegate.module.js.map +0 -1
- package/dist/types.d.ts +0 -42
- package/dist/types.d.ts.map +0 -1
- package/dist/useTab.main.js +0 -68
- package/dist/useTab.main.js.map +0 -1
- package/dist/useTab.mjs +0 -63
- package/dist/useTab.module.js +0 -63
- package/dist/useTab.module.js.map +0 -1
- package/dist/useTabList.main.js +0 -67
- package/dist/useTabList.main.js.map +0 -1
- package/dist/useTabList.mjs +0 -62
- package/dist/useTabList.module.js +0 -62
- package/dist/useTabList.module.js.map +0 -1
- package/dist/useTabPanel.main.js +0 -47
- package/dist/useTabPanel.main.js.map +0 -1
- package/dist/useTabPanel.mjs +0 -42
- package/dist/useTabPanel.module.js +0 -42
- package/dist/useTabPanel.module.js.map +0 -1
- package/dist/utils.main.js +0 -29
- package/dist/utils.main.js.map +0 -1
- package/dist/utils.mjs +0 -23
- package/dist/utils.module.js +0 -23
- package/dist/utils.module.js.map +0 -1
- package/src/TabsKeyboardDelegate.ts +0 -98
- package/src/useTab.ts +0 -82
- package/src/useTabList.ts +0 -75
- package/src/useTabPanel.ts +0 -47
- package/src/utils.ts +0 -33
package/dist/useTab.module.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import {generateId as $99b62ae3ff97ec45$export$567fc7097e064344} from "./utils.module.js";
|
|
2
|
-
import {filterDOMProps as $dObGJ$filterDOMProps, useLinkProps as $dObGJ$useLinkProps, mergeProps as $dObGJ$mergeProps} from "@react-aria/utils";
|
|
3
|
-
import {useFocusable as $dObGJ$useFocusable} from "@react-aria/focus";
|
|
4
|
-
import {useSelectableItem as $dObGJ$useSelectableItem} from "@react-aria/selection";
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
8
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
9
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
10
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
13
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
14
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
|
-
* governing permissions and limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function $0175d55c2a017ebc$export$fdf4756d5b8ef90a(props, state, ref) {
|
|
21
|
-
let { key: key, isDisabled: propsDisabled, shouldSelectOnPressUp: shouldSelectOnPressUp } = props;
|
|
22
|
-
let { selectionManager: manager, selectedKey: selectedKey } = state;
|
|
23
|
-
let isSelected = key === selectedKey;
|
|
24
|
-
let isDisabled = propsDisabled || state.isDisabled || state.selectionManager.isDisabled(key);
|
|
25
|
-
let { itemProps: itemProps, isPressed: isPressed } = (0, $dObGJ$useSelectableItem)({
|
|
26
|
-
selectionManager: manager,
|
|
27
|
-
key: key,
|
|
28
|
-
ref: ref,
|
|
29
|
-
isDisabled: isDisabled,
|
|
30
|
-
shouldSelectOnPressUp: shouldSelectOnPressUp,
|
|
31
|
-
linkBehavior: 'selection'
|
|
32
|
-
});
|
|
33
|
-
let tabId = (0, $99b62ae3ff97ec45$export$567fc7097e064344)(state, key, 'tab');
|
|
34
|
-
let tabPanelId = (0, $99b62ae3ff97ec45$export$567fc7097e064344)(state, key, 'tabpanel');
|
|
35
|
-
let { tabIndex: tabIndex } = itemProps;
|
|
36
|
-
let item = state.collection.getItem(key);
|
|
37
|
-
let domProps = (0, $dObGJ$filterDOMProps)(item === null || item === void 0 ? void 0 : item.props, {
|
|
38
|
-
labelable: true
|
|
39
|
-
});
|
|
40
|
-
delete domProps.id;
|
|
41
|
-
let linkProps = (0, $dObGJ$useLinkProps)(item === null || item === void 0 ? void 0 : item.props);
|
|
42
|
-
let { focusableProps: focusableProps } = (0, $dObGJ$useFocusable)({
|
|
43
|
-
...item === null || item === void 0 ? void 0 : item.props,
|
|
44
|
-
isDisabled: isDisabled
|
|
45
|
-
}, ref);
|
|
46
|
-
return {
|
|
47
|
-
tabProps: (0, $dObGJ$mergeProps)(domProps, focusableProps, linkProps, itemProps, {
|
|
48
|
-
id: tabId,
|
|
49
|
-
'aria-selected': isSelected,
|
|
50
|
-
'aria-disabled': isDisabled || undefined,
|
|
51
|
-
'aria-controls': isSelected ? tabPanelId : undefined,
|
|
52
|
-
tabIndex: isDisabled ? undefined : tabIndex,
|
|
53
|
-
role: 'tab'
|
|
54
|
-
}),
|
|
55
|
-
isSelected: isSelected,
|
|
56
|
-
isDisabled: isDisabled,
|
|
57
|
-
isPressed: isPressed
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
export {$0175d55c2a017ebc$export$fdf4756d5b8ef90a as useTab};
|
|
63
|
-
//# sourceMappingURL=useTab.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAyBM,SAAS,0CACd,KAAmB,EACnB,KAAsB,EACtB,GAAuC;IAEvC,IAAI,OAAC,GAAG,EAAE,YAAY,aAAa,yBAAE,qBAAqB,EAAC,GAAG;IAC9D,IAAI,EAAC,kBAAkB,OAAO,eAAE,WAAW,EAAC,GAAG;IAE/C,IAAI,aAAa,QAAQ;IAEzB,IAAI,aAAa,iBAAiB,MAAM,UAAU,IAAI,MAAM,gBAAgB,CAAC,UAAU,CAAC;IACxF,IAAI,aAAC,SAAS,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,wBAAgB,EAAE;QAC7C,kBAAkB;aAClB;aACA;oBACA;+BACA;QACA,cAAc;IAChB;IAEA,IAAI,QAAQ,CAAA,GAAA,yCAAS,EAAE,OAAO,KAAK;IACnC,IAAI,aAAa,CAAA,GAAA,yCAAS,EAAE,OAAO,KAAK;IACxC,IAAI,YAAC,QAAQ,EAAC,GAAG;IAEjB,IAAI,OAAO,MAAM,UAAU,CAAC,OAAO,CAAC;IACpC,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,iBAAA,2BAAA,KAAM,KAAK,EAAE;QAAC,WAAW;IAAI;IAC3D,OAAO,SAAS,EAAE;IAClB,IAAI,YAAY,CAAA,GAAA,mBAAW,EAAE,iBAAA,2BAAA,KAAM,KAAK;IACxC,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE;WAC/B,iBAAA,2BAAA,KAAM,KAAK,AAAd;oBACA;IACF,GAAG;IAEH,OAAO;QACL,UAAU,CAAA,GAAA,iBAAS,EAAE,UAAU,gBAAgB,WAAW,WAAW;YACnE,IAAI;YACJ,iBAAiB;YACjB,iBAAiB,cAAc;YAC/B,iBAAiB,aAAa,aAAa;YAC3C,UAAU,aAAa,YAAY;YACnC,MAAM;QACR;oBACA;oBACA;mBACA;IACF;AACF","sources":["packages/@react-aria/tabs/src/useTab.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 {AriaTabProps} from '@react-types/tabs';\nimport {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, useLinkProps} from '@react-aria/utils';\nimport {generateId} from './utils';\nimport {TabListState} from '@react-stately/tabs';\nimport {useFocusable} from '@react-aria/focus';\nimport {useSelectableItem} from '@react-aria/selection';\n\nexport interface TabAria {\n /** Props for the tab element. */\n tabProps: DOMAttributes,\n /** Whether the tab is currently selected. */\n isSelected: boolean,\n /** Whether the tab is disabled. */\n isDisabled: boolean,\n /** Whether the tab is currently in a pressed state. */\n isPressed: boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for a tab.\n * When selected, the associated tab panel is shown.\n */\nexport function useTab<T>(\n props: AriaTabProps,\n state: TabListState<T>,\n ref: RefObject<FocusableElement | null>\n): TabAria {\n let {key, isDisabled: propsDisabled, shouldSelectOnPressUp} = props;\n let {selectionManager: manager, selectedKey} = state;\n\n let isSelected = key === selectedKey;\n\n let isDisabled = propsDisabled || state.isDisabled || state.selectionManager.isDisabled(key);\n let {itemProps, isPressed} = useSelectableItem({\n selectionManager: manager,\n key,\n ref,\n isDisabled,\n shouldSelectOnPressUp,\n linkBehavior: 'selection'\n });\n\n let tabId = generateId(state, key, 'tab');\n let tabPanelId = generateId(state, key, 'tabpanel');\n let {tabIndex} = itemProps;\n\n let item = state.collection.getItem(key);\n let domProps = filterDOMProps(item?.props, {labelable: true});\n delete domProps.id;\n let linkProps = useLinkProps(item?.props);\n let {focusableProps} = useFocusable({\n ...item?.props,\n isDisabled\n }, ref);\n\n return {\n tabProps: mergeProps(domProps, focusableProps, linkProps, itemProps, {\n id: tabId,\n 'aria-selected': isSelected,\n 'aria-disabled': isDisabled || undefined,\n 'aria-controls': isSelected ? tabPanelId : undefined,\n tabIndex: isDisabled ? undefined : tabIndex,\n role: 'tab'\n }),\n isSelected,\n isDisabled,\n isPressed\n };\n}\n"],"names":[],"version":3,"file":"useTab.module.js.map"}
|
package/dist/useTabList.main.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
var $a217ebca77471970$exports = require("./utils.main.js");
|
|
2
|
-
var $283e5d8830177ead$exports = require("./TabsKeyboardDelegate.main.js");
|
|
3
|
-
var $c5HcZ$reactariautils = require("@react-aria/utils");
|
|
4
|
-
var $c5HcZ$reactariai18n = require("@react-aria/i18n");
|
|
5
|
-
var $c5HcZ$react = require("react");
|
|
6
|
-
var $c5HcZ$reactariaselection = require("@react-aria/selection");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function $parcel$export(e, n, v, s) {
|
|
10
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
$parcel$export(module.exports, "useTabList", () => $f2b4a4926440e901$export$773e389e644c5874);
|
|
14
|
-
/*
|
|
15
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
16
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
17
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
18
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
-
*
|
|
20
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
21
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
22
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
23
|
-
* governing permissions and limitations under the License.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
function $f2b4a4926440e901$export$773e389e644c5874(props, state, ref) {
|
|
31
|
-
let { orientation: orientation = 'horizontal', keyboardActivation: keyboardActivation = 'automatic' } = props;
|
|
32
|
-
let { collection: collection, selectionManager: manager, disabledKeys: disabledKeys } = state;
|
|
33
|
-
let { direction: direction } = (0, $c5HcZ$reactariai18n.useLocale)();
|
|
34
|
-
let delegate = (0, $c5HcZ$react.useMemo)(()=>new (0, $283e5d8830177ead$exports.TabsKeyboardDelegate)(collection, direction, orientation, disabledKeys), [
|
|
35
|
-
collection,
|
|
36
|
-
disabledKeys,
|
|
37
|
-
orientation,
|
|
38
|
-
direction
|
|
39
|
-
]);
|
|
40
|
-
let { collectionProps: collectionProps } = (0, $c5HcZ$reactariaselection.useSelectableCollection)({
|
|
41
|
-
ref: ref,
|
|
42
|
-
selectionManager: manager,
|
|
43
|
-
keyboardDelegate: delegate,
|
|
44
|
-
selectOnFocus: keyboardActivation === 'automatic',
|
|
45
|
-
disallowEmptySelection: true,
|
|
46
|
-
scrollRef: ref,
|
|
47
|
-
linkBehavior: 'selection'
|
|
48
|
-
});
|
|
49
|
-
// Compute base id for all tabs
|
|
50
|
-
let tabsId = (0, $c5HcZ$reactariautils.useId)();
|
|
51
|
-
(0, $a217ebca77471970$exports.tabsIds).set(state, tabsId);
|
|
52
|
-
let tabListLabelProps = (0, $c5HcZ$reactariautils.useLabels)({
|
|
53
|
-
...props,
|
|
54
|
-
id: tabsId
|
|
55
|
-
});
|
|
56
|
-
return {
|
|
57
|
-
tabListProps: {
|
|
58
|
-
...(0, $c5HcZ$reactariautils.mergeProps)(collectionProps, tabListLabelProps),
|
|
59
|
-
role: 'tablist',
|
|
60
|
-
'aria-orientation': orientation,
|
|
61
|
-
tabIndex: undefined
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
//# sourceMappingURL=useTabList.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;AAUA;;;;;;AAuBO,SAAS,0CAAc,KAA4B,EAAE,KAAsB,EAAE,GAAkC;IACpH,IAAI,eACF,cAAc,kCACd,qBAAqB,aACtB,GAAG;IACJ,IAAI,cACF,UAAU,EACV,kBAAkB,OAAO,gBACzB,YAAY,EACb,GAAG;IACJ,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,8BAAQ;IAC1B,IAAI,WAAW,CAAA,GAAA,oBAAM,EAAE,IAAM,IAAI,CAAA,GAAA,8CAAmB,EAClD,YACA,WACA,aACA,eAAe;QAAC;QAAY;QAAc;QAAa;KAAU;IAEnE,IAAI,mBAAC,eAAe,EAAC,GAAG,CAAA,GAAA,iDAAsB,EAAE;aAC9C;QACA,kBAAkB;QAClB,kBAAkB;QAClB,eAAe,uBAAuB;QACtC,wBAAwB;QACxB,WAAW;QACX,cAAc;IAChB;IAEA,+BAA+B;IAC/B,IAAI,SAAS,CAAA,GAAA,2BAAI;IACjB,CAAA,GAAA,iCAAM,EAAE,GAAG,CAAC,OAAO;IAEnB,IAAI,oBAAoB,CAAA,GAAA,+BAAQ,EAAE;QAAC,GAAG,KAAK;QAAE,IAAI;IAAM;IAEvD,OAAO;QACL,cAAc;YACZ,GAAG,CAAA,GAAA,gCAAS,EAAE,iBAAiB,kBAAkB;YACjD,MAAM;YACN,oBAAoB;YACpB,UAAU;QACZ;IACF;AACF","sources":["packages/@react-aria/tabs/src/useTabList.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 {AriaTabListProps} from '@react-types/tabs';\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {mergeProps, useId, useLabels} from '@react-aria/utils';\nimport {TabListState} from '@react-stately/tabs';\nimport {tabsIds} from './utils';\nimport {TabsKeyboardDelegate} from './TabsKeyboardDelegate';\nimport {useLocale} from '@react-aria/i18n';\nimport {useMemo} from 'react';\nimport {useSelectableCollection} from '@react-aria/selection';\n\nexport interface AriaTabListOptions<T> extends Omit<AriaTabListProps<T>, 'children'> {}\n\nexport interface TabListAria {\n /** Props for the tablist container. */\n tabListProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a tab list.\n * Tabs organize content into multiple sections and allow users to navigate between them.\n */\nexport function useTabList<T>(props: AriaTabListOptions<T>, state: TabListState<T>, ref: RefObject<HTMLElement | null>): TabListAria {\n let {\n orientation = 'horizontal',\n keyboardActivation = 'automatic'\n } = props;\n let {\n collection,\n selectionManager: manager,\n disabledKeys\n } = state;\n let {direction} = useLocale();\n let delegate = useMemo(() => new TabsKeyboardDelegate(\n collection,\n direction,\n orientation,\n disabledKeys), [collection, disabledKeys, orientation, direction]);\n\n let {collectionProps} = useSelectableCollection({\n ref,\n selectionManager: manager,\n keyboardDelegate: delegate,\n selectOnFocus: keyboardActivation === 'automatic',\n disallowEmptySelection: true,\n scrollRef: ref,\n linkBehavior: 'selection'\n });\n\n // Compute base id for all tabs\n let tabsId = useId();\n tabsIds.set(state, tabsId);\n\n let tabListLabelProps = useLabels({...props, id: tabsId});\n\n return {\n tabListProps: {\n ...mergeProps(collectionProps, tabListLabelProps),\n role: 'tablist',\n 'aria-orientation': orientation,\n tabIndex: undefined\n }\n };\n}\n"],"names":[],"version":3,"file":"useTabList.main.js.map"}
|
package/dist/useTabList.mjs
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import {tabsIds as $99b62ae3ff97ec45$export$c5f62239608282b6} from "./utils.mjs";
|
|
2
|
-
import {TabsKeyboardDelegate as $bfc6f2d60b8a4c40$export$15010ca3c1abe90b} from "./TabsKeyboardDelegate.mjs";
|
|
3
|
-
import {useId as $bQNZs$useId, useLabels as $bQNZs$useLabels, mergeProps as $bQNZs$mergeProps} from "@react-aria/utils";
|
|
4
|
-
import {useLocale as $bQNZs$useLocale} from "@react-aria/i18n";
|
|
5
|
-
import {useMemo as $bQNZs$useMemo} from "react";
|
|
6
|
-
import {useSelectableCollection as $bQNZs$useSelectableCollection} from "@react-aria/selection";
|
|
7
|
-
|
|
8
|
-
/*
|
|
9
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
10
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
11
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
12
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
-
*
|
|
14
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
15
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
16
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
17
|
-
* governing permissions and limitations under the License.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function $58d314389b21fa3f$export$773e389e644c5874(props, state, ref) {
|
|
25
|
-
let { orientation: orientation = 'horizontal', keyboardActivation: keyboardActivation = 'automatic' } = props;
|
|
26
|
-
let { collection: collection, selectionManager: manager, disabledKeys: disabledKeys } = state;
|
|
27
|
-
let { direction: direction } = (0, $bQNZs$useLocale)();
|
|
28
|
-
let delegate = (0, $bQNZs$useMemo)(()=>new (0, $bfc6f2d60b8a4c40$export$15010ca3c1abe90b)(collection, direction, orientation, disabledKeys), [
|
|
29
|
-
collection,
|
|
30
|
-
disabledKeys,
|
|
31
|
-
orientation,
|
|
32
|
-
direction
|
|
33
|
-
]);
|
|
34
|
-
let { collectionProps: collectionProps } = (0, $bQNZs$useSelectableCollection)({
|
|
35
|
-
ref: ref,
|
|
36
|
-
selectionManager: manager,
|
|
37
|
-
keyboardDelegate: delegate,
|
|
38
|
-
selectOnFocus: keyboardActivation === 'automatic',
|
|
39
|
-
disallowEmptySelection: true,
|
|
40
|
-
scrollRef: ref,
|
|
41
|
-
linkBehavior: 'selection'
|
|
42
|
-
});
|
|
43
|
-
// Compute base id for all tabs
|
|
44
|
-
let tabsId = (0, $bQNZs$useId)();
|
|
45
|
-
(0, $99b62ae3ff97ec45$export$c5f62239608282b6).set(state, tabsId);
|
|
46
|
-
let tabListLabelProps = (0, $bQNZs$useLabels)({
|
|
47
|
-
...props,
|
|
48
|
-
id: tabsId
|
|
49
|
-
});
|
|
50
|
-
return {
|
|
51
|
-
tabListProps: {
|
|
52
|
-
...(0, $bQNZs$mergeProps)(collectionProps, tabListLabelProps),
|
|
53
|
-
role: 'tablist',
|
|
54
|
-
'aria-orientation': orientation,
|
|
55
|
-
tabIndex: undefined
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
export {$58d314389b21fa3f$export$773e389e644c5874 as useTabList};
|
|
62
|
-
//# sourceMappingURL=useTabList.module.js.map
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import {tabsIds as $99b62ae3ff97ec45$export$c5f62239608282b6} from "./utils.module.js";
|
|
2
|
-
import {TabsKeyboardDelegate as $bfc6f2d60b8a4c40$export$15010ca3c1abe90b} from "./TabsKeyboardDelegate.module.js";
|
|
3
|
-
import {useId as $bQNZs$useId, useLabels as $bQNZs$useLabels, mergeProps as $bQNZs$mergeProps} from "@react-aria/utils";
|
|
4
|
-
import {useLocale as $bQNZs$useLocale} from "@react-aria/i18n";
|
|
5
|
-
import {useMemo as $bQNZs$useMemo} from "react";
|
|
6
|
-
import {useSelectableCollection as $bQNZs$useSelectableCollection} from "@react-aria/selection";
|
|
7
|
-
|
|
8
|
-
/*
|
|
9
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
10
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
11
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
12
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
-
*
|
|
14
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
15
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
16
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
17
|
-
* governing permissions and limitations under the License.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function $58d314389b21fa3f$export$773e389e644c5874(props, state, ref) {
|
|
25
|
-
let { orientation: orientation = 'horizontal', keyboardActivation: keyboardActivation = 'automatic' } = props;
|
|
26
|
-
let { collection: collection, selectionManager: manager, disabledKeys: disabledKeys } = state;
|
|
27
|
-
let { direction: direction } = (0, $bQNZs$useLocale)();
|
|
28
|
-
let delegate = (0, $bQNZs$useMemo)(()=>new (0, $bfc6f2d60b8a4c40$export$15010ca3c1abe90b)(collection, direction, orientation, disabledKeys), [
|
|
29
|
-
collection,
|
|
30
|
-
disabledKeys,
|
|
31
|
-
orientation,
|
|
32
|
-
direction
|
|
33
|
-
]);
|
|
34
|
-
let { collectionProps: collectionProps } = (0, $bQNZs$useSelectableCollection)({
|
|
35
|
-
ref: ref,
|
|
36
|
-
selectionManager: manager,
|
|
37
|
-
keyboardDelegate: delegate,
|
|
38
|
-
selectOnFocus: keyboardActivation === 'automatic',
|
|
39
|
-
disallowEmptySelection: true,
|
|
40
|
-
scrollRef: ref,
|
|
41
|
-
linkBehavior: 'selection'
|
|
42
|
-
});
|
|
43
|
-
// Compute base id for all tabs
|
|
44
|
-
let tabsId = (0, $bQNZs$useId)();
|
|
45
|
-
(0, $99b62ae3ff97ec45$export$c5f62239608282b6).set(state, tabsId);
|
|
46
|
-
let tabListLabelProps = (0, $bQNZs$useLabels)({
|
|
47
|
-
...props,
|
|
48
|
-
id: tabsId
|
|
49
|
-
});
|
|
50
|
-
return {
|
|
51
|
-
tabListProps: {
|
|
52
|
-
...(0, $bQNZs$mergeProps)(collectionProps, tabListLabelProps),
|
|
53
|
-
role: 'tablist',
|
|
54
|
-
'aria-orientation': orientation,
|
|
55
|
-
tabIndex: undefined
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
export {$58d314389b21fa3f$export$773e389e644c5874 as useTabList};
|
|
62
|
-
//# sourceMappingURL=useTabList.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;AAAA;;;;;;;;;;AAUA;;;;;;AAuBO,SAAS,0CAAc,KAA4B,EAAE,KAAsB,EAAE,GAAkC;IACpH,IAAI,eACF,cAAc,kCACd,qBAAqB,aACtB,GAAG;IACJ,IAAI,cACF,UAAU,EACV,kBAAkB,OAAO,gBACzB,YAAY,EACb,GAAG;IACJ,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,WAAW,CAAA,GAAA,cAAM,EAAE,IAAM,IAAI,CAAA,GAAA,yCAAmB,EAClD,YACA,WACA,aACA,eAAe;QAAC;QAAY;QAAc;QAAa;KAAU;IAEnE,IAAI,mBAAC,eAAe,EAAC,GAAG,CAAA,GAAA,8BAAsB,EAAE;aAC9C;QACA,kBAAkB;QAClB,kBAAkB;QAClB,eAAe,uBAAuB;QACtC,wBAAwB;QACxB,WAAW;QACX,cAAc;IAChB;IAEA,+BAA+B;IAC/B,IAAI,SAAS,CAAA,GAAA,YAAI;IACjB,CAAA,GAAA,yCAAM,EAAE,GAAG,CAAC,OAAO;IAEnB,IAAI,oBAAoB,CAAA,GAAA,gBAAQ,EAAE;QAAC,GAAG,KAAK;QAAE,IAAI;IAAM;IAEvD,OAAO;QACL,cAAc;YACZ,GAAG,CAAA,GAAA,iBAAS,EAAE,iBAAiB,kBAAkB;YACjD,MAAM;YACN,oBAAoB;YACpB,UAAU;QACZ;IACF;AACF","sources":["packages/@react-aria/tabs/src/useTabList.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 {AriaTabListProps} from '@react-types/tabs';\nimport {DOMAttributes, RefObject} from '@react-types/shared';\nimport {mergeProps, useId, useLabels} from '@react-aria/utils';\nimport {TabListState} from '@react-stately/tabs';\nimport {tabsIds} from './utils';\nimport {TabsKeyboardDelegate} from './TabsKeyboardDelegate';\nimport {useLocale} from '@react-aria/i18n';\nimport {useMemo} from 'react';\nimport {useSelectableCollection} from '@react-aria/selection';\n\nexport interface AriaTabListOptions<T> extends Omit<AriaTabListProps<T>, 'children'> {}\n\nexport interface TabListAria {\n /** Props for the tablist container. */\n tabListProps: DOMAttributes\n}\n\n/**\n * Provides the behavior and accessibility implementation for a tab list.\n * Tabs organize content into multiple sections and allow users to navigate between them.\n */\nexport function useTabList<T>(props: AriaTabListOptions<T>, state: TabListState<T>, ref: RefObject<HTMLElement | null>): TabListAria {\n let {\n orientation = 'horizontal',\n keyboardActivation = 'automatic'\n } = props;\n let {\n collection,\n selectionManager: manager,\n disabledKeys\n } = state;\n let {direction} = useLocale();\n let delegate = useMemo(() => new TabsKeyboardDelegate(\n collection,\n direction,\n orientation,\n disabledKeys), [collection, disabledKeys, orientation, direction]);\n\n let {collectionProps} = useSelectableCollection({\n ref,\n selectionManager: manager,\n keyboardDelegate: delegate,\n selectOnFocus: keyboardActivation === 'automatic',\n disallowEmptySelection: true,\n scrollRef: ref,\n linkBehavior: 'selection'\n });\n\n // Compute base id for all tabs\n let tabsId = useId();\n tabsIds.set(state, tabsId);\n\n let tabListLabelProps = useLabels({...props, id: tabsId});\n\n return {\n tabListProps: {\n ...mergeProps(collectionProps, tabListLabelProps),\n role: 'tablist',\n 'aria-orientation': orientation,\n tabIndex: undefined\n }\n };\n}\n"],"names":[],"version":3,"file":"useTabList.module.js.map"}
|
package/dist/useTabPanel.main.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
var $a217ebca77471970$exports = require("./utils.main.js");
|
|
2
|
-
var $8Zd8I$reactariautils = require("@react-aria/utils");
|
|
3
|
-
var $8Zd8I$reactariafocus = require("@react-aria/focus");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function $parcel$export(e, n, v, s) {
|
|
7
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
$parcel$export(module.exports, "useTabPanel", () => $8db1928b18472a1f$export$fae0121b5afe572d);
|
|
11
|
-
/*
|
|
12
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
13
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
14
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
15
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
18
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
19
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
20
|
-
* governing permissions and limitations under the License.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function $8db1928b18472a1f$export$fae0121b5afe572d(props, state, ref) {
|
|
25
|
-
// The tabpanel should have tabIndex=0 when there are no tabbable elements within it.
|
|
26
|
-
// Otherwise, tabbing from the focused tab should go directly to the first tabbable element
|
|
27
|
-
// within the tabpanel.
|
|
28
|
-
let tabIndex = (0, $8Zd8I$reactariafocus.useHasTabbableChild)(ref) ? undefined : 0;
|
|
29
|
-
var _props_id;
|
|
30
|
-
const id = (0, $a217ebca77471970$exports.generateId)(state, (_props_id = props.id) !== null && _props_id !== void 0 ? _props_id : state === null || state === void 0 ? void 0 : state.selectedKey, 'tabpanel');
|
|
31
|
-
const tabPanelProps = (0, $8Zd8I$reactariautils.useLabels)({
|
|
32
|
-
...props,
|
|
33
|
-
id: id,
|
|
34
|
-
'aria-labelledby': (0, $a217ebca77471970$exports.generateId)(state, state === null || state === void 0 ? void 0 : state.selectedKey, 'tab')
|
|
35
|
-
});
|
|
36
|
-
return {
|
|
37
|
-
tabPanelProps: (0, $8Zd8I$reactariautils.mergeProps)(tabPanelProps, {
|
|
38
|
-
tabIndex: tabIndex,
|
|
39
|
-
role: 'tabpanel',
|
|
40
|
-
'aria-describedby': props['aria-describedby'],
|
|
41
|
-
'aria-details': props['aria-details']
|
|
42
|
-
})
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
//# sourceMappingURL=useTabPanel.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/useTabPanel.mjs
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import {generateId as $99b62ae3ff97ec45$export$567fc7097e064344} from "./utils.mjs";
|
|
2
|
-
import {useLabels as $jik2T$useLabels, mergeProps as $jik2T$mergeProps} from "@react-aria/utils";
|
|
3
|
-
import {useHasTabbableChild as $jik2T$useHasTabbableChild} from "@react-aria/focus";
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
7
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
-
* governing permissions and limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
function $34bce698202e07cb$export$fae0121b5afe572d(props, state, ref) {
|
|
19
|
-
// The tabpanel should have tabIndex=0 when there are no tabbable elements within it.
|
|
20
|
-
// Otherwise, tabbing from the focused tab should go directly to the first tabbable element
|
|
21
|
-
// within the tabpanel.
|
|
22
|
-
let tabIndex = (0, $jik2T$useHasTabbableChild)(ref) ? undefined : 0;
|
|
23
|
-
var _props_id;
|
|
24
|
-
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');
|
|
25
|
-
const tabPanelProps = (0, $jik2T$useLabels)({
|
|
26
|
-
...props,
|
|
27
|
-
id: id,
|
|
28
|
-
'aria-labelledby': (0, $99b62ae3ff97ec45$export$567fc7097e064344)(state, state === null || state === void 0 ? void 0 : state.selectedKey, 'tab')
|
|
29
|
-
});
|
|
30
|
-
return {
|
|
31
|
-
tabPanelProps: (0, $jik2T$mergeProps)(tabPanelProps, {
|
|
32
|
-
tabIndex: tabIndex,
|
|
33
|
-
role: 'tabpanel',
|
|
34
|
-
'aria-describedby': props['aria-describedby'],
|
|
35
|
-
'aria-details': props['aria-details']
|
|
36
|
-
})
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export {$34bce698202e07cb$export$fae0121b5afe572d as useTabPanel};
|
|
42
|
-
//# sourceMappingURL=useTabPanel.module.js.map
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import {generateId as $99b62ae3ff97ec45$export$567fc7097e064344} from "./utils.module.js";
|
|
2
|
-
import {useLabels as $jik2T$useLabels, mergeProps as $jik2T$mergeProps} from "@react-aria/utils";
|
|
3
|
-
import {useHasTabbableChild as $jik2T$useHasTabbableChild} from "@react-aria/focus";
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
7
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
-
* governing permissions and limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
function $34bce698202e07cb$export$fae0121b5afe572d(props, state, ref) {
|
|
19
|
-
// The tabpanel should have tabIndex=0 when there are no tabbable elements within it.
|
|
20
|
-
// Otherwise, tabbing from the focused tab should go directly to the first tabbable element
|
|
21
|
-
// within the tabpanel.
|
|
22
|
-
let tabIndex = (0, $jik2T$useHasTabbableChild)(ref) ? undefined : 0;
|
|
23
|
-
var _props_id;
|
|
24
|
-
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');
|
|
25
|
-
const tabPanelProps = (0, $jik2T$useLabels)({
|
|
26
|
-
...props,
|
|
27
|
-
id: id,
|
|
28
|
-
'aria-labelledby': (0, $99b62ae3ff97ec45$export$567fc7097e064344)(state, state === null || state === void 0 ? void 0 : state.selectedKey, 'tab')
|
|
29
|
-
});
|
|
30
|
-
return {
|
|
31
|
-
tabPanelProps: (0, $jik2T$mergeProps)(tabPanelProps, {
|
|
32
|
-
tabIndex: tabIndex,
|
|
33
|
-
role: 'tabpanel',
|
|
34
|
-
'aria-describedby': props['aria-describedby'],
|
|
35
|
-
'aria-details': props['aria-details']
|
|
36
|
-
})
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export {$34bce698202e07cb$export$fae0121b5afe572d as useTabPanel};
|
|
42
|
-
//# sourceMappingURL=useTabPanel.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
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, "tabsIds", () => $a217ebca77471970$export$c5f62239608282b6);
|
|
7
|
-
$parcel$export(module.exports, "generateId", () => $a217ebca77471970$export$567fc7097e064344);
|
|
8
|
-
/*
|
|
9
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
10
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
11
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
12
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
-
*
|
|
14
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
15
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
16
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
17
|
-
* governing permissions and limitations under the License.
|
|
18
|
-
*/ const $a217ebca77471970$export$c5f62239608282b6 = new WeakMap();
|
|
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 '';
|
|
22
|
-
if (typeof key === 'string') key = key.replace(/\s+/g, '');
|
|
23
|
-
let baseId = $a217ebca77471970$export$c5f62239608282b6.get(state);
|
|
24
|
-
if (process.env.NODE_ENV !== 'production' && !baseId) console.error('There is no tab id, please check if you have rendered the tab panel before the tab list.');
|
|
25
|
-
return `${baseId}-${role}-${key}`;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
//# sourceMappingURL=utils.main.js.map
|
package/dist/utils.main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC,GAKM,MAAM,4CAAkD,IAAI;AAE5D,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,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,gBAAgB,CAAC,QAC5C,QAAQ,KAAK,CAAC;IAEhB,OAAO,GAAG,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE,KAAK;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: WeakMap<TabListState<unknown>, string> = new WeakMap<TabListState<unknown>, string>();\n\nexport function generateId<T>(state: TabListState<T> | null, key: Key | null | undefined, role: string): 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 if (process.env.NODE_ENV !== 'production' && !baseId) {\n console.error('There is no tab id, please check if you have rendered the tab panel before the tab list.');\n }\n return `${baseId}-${role}-${key}`;\n}\n\n"],"names":[],"version":3,"file":"utils.main.js.map"}
|
package/dist/utils.mjs
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
*/ const $99b62ae3ff97ec45$export$c5f62239608282b6 = new WeakMap();
|
|
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 '';
|
|
15
|
-
if (typeof key === 'string') key = key.replace(/\s+/g, '');
|
|
16
|
-
let baseId = $99b62ae3ff97ec45$export$c5f62239608282b6.get(state);
|
|
17
|
-
if (process.env.NODE_ENV !== 'production' && !baseId) console.error('There is no tab id, please check if you have rendered the tab panel before the tab list.');
|
|
18
|
-
return `${baseId}-${role}-${key}`;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export {$99b62ae3ff97ec45$export$c5f62239608282b6 as tabsIds, $99b62ae3ff97ec45$export$567fc7097e064344 as generateId};
|
|
23
|
-
//# sourceMappingURL=utils.module.js.map
|
package/dist/utils.module.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
*/ const $99b62ae3ff97ec45$export$c5f62239608282b6 = new WeakMap();
|
|
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 '';
|
|
15
|
-
if (typeof key === 'string') key = key.replace(/\s+/g, '');
|
|
16
|
-
let baseId = $99b62ae3ff97ec45$export$c5f62239608282b6.get(state);
|
|
17
|
-
if (process.env.NODE_ENV !== 'production' && !baseId) console.error('There is no tab id, please check if you have rendered the tab panel before the tab list.');
|
|
18
|
-
return `${baseId}-${role}-${key}`;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export {$99b62ae3ff97ec45$export$c5f62239608282b6 as tabsIds, $99b62ae3ff97ec45$export$567fc7097e064344 as generateId};
|
|
23
|
-
//# sourceMappingURL=utils.module.js.map
|
package/dist/utils.module.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"AAAA;;;;;;;;;;CAUC,GAKM,MAAM,4CAAkD,IAAI;AAE5D,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,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,gBAAgB,CAAC,QAC5C,QAAQ,KAAK,CAAC;IAEhB,OAAO,GAAG,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE,KAAK;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: WeakMap<TabListState<unknown>, string> = new WeakMap<TabListState<unknown>, string>();\n\nexport function generateId<T>(state: TabListState<T> | null, key: Key | null | undefined, role: string): 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 if (process.env.NODE_ENV !== 'production' && !baseId) {\n console.error('There is no tab id, please check if you have rendered the tab panel before the tab list.');\n }\n return `${baseId}-${role}-${key}`;\n}\n\n"],"names":[],"version":3,"file":"utils.module.js.map"}
|
|
@@ -1,98 +0,0 @@
|
|
|
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
|
-
*/
|
|
12
|
-
|
|
13
|
-
import {Collection, Direction, Key, KeyboardDelegate, Node, Orientation} from '@react-types/shared';
|
|
14
|
-
|
|
15
|
-
export class TabsKeyboardDelegate<T> implements KeyboardDelegate {
|
|
16
|
-
private collection: Collection<Node<T>>;
|
|
17
|
-
private flipDirection: boolean;
|
|
18
|
-
private disabledKeys: Set<Key>;
|
|
19
|
-
private tabDirection: boolean;
|
|
20
|
-
|
|
21
|
-
constructor(collection: Collection<Node<T>>, direction: Direction, orientation: Orientation, disabledKeys: Set<Key> = new Set()) {
|
|
22
|
-
this.collection = collection;
|
|
23
|
-
this.flipDirection = direction === 'rtl' && orientation === 'horizontal';
|
|
24
|
-
this.disabledKeys = disabledKeys;
|
|
25
|
-
this.tabDirection = orientation === 'horizontal';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
getKeyLeftOf(key: Key): Key | null {
|
|
29
|
-
if (this.flipDirection) {
|
|
30
|
-
return this.getNextKey(key);
|
|
31
|
-
}
|
|
32
|
-
return this.getPreviousKey(key);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
getKeyRightOf(key: Key): Key | null {
|
|
36
|
-
if (this.flipDirection) {
|
|
37
|
-
return this.getPreviousKey(key);
|
|
38
|
-
}
|
|
39
|
-
return this.getNextKey(key);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
private isDisabled(key: Key) {
|
|
44
|
-
return this.disabledKeys.has(key) || !!this.collection.getItem(key)?.props?.isDisabled;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
getFirstKey(): Key | null {
|
|
48
|
-
let key = this.collection.getFirstKey();
|
|
49
|
-
if (key != null && this.isDisabled(key)) {
|
|
50
|
-
key = this.getNextKey(key);
|
|
51
|
-
}
|
|
52
|
-
return key;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
getLastKey(): Key | null {
|
|
56
|
-
let key = this.collection.getLastKey();
|
|
57
|
-
if (key != null && this.isDisabled(key)) {
|
|
58
|
-
key = this.getPreviousKey(key);
|
|
59
|
-
}
|
|
60
|
-
return key;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
getKeyAbove(key: Key): Key | null {
|
|
64
|
-
if (this.tabDirection) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
return this.getPreviousKey(key);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
getKeyBelow(key: Key): Key | null {
|
|
71
|
-
if (this.tabDirection) {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
return this.getNextKey(key);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
getNextKey(startKey: Key): Key | null {
|
|
78
|
-
let key: Key | null = startKey;
|
|
79
|
-
do {
|
|
80
|
-
key = this.collection.getKeyAfter(key);
|
|
81
|
-
if (key == null) {
|
|
82
|
-
key = this.collection.getFirstKey();
|
|
83
|
-
}
|
|
84
|
-
} while (key != null && this.isDisabled(key));
|
|
85
|
-
return key;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
getPreviousKey(startKey: Key): Key | null {
|
|
89
|
-
let key: Key | null = startKey;
|
|
90
|
-
do {
|
|
91
|
-
key = this.collection.getKeyBefore(key);
|
|
92
|
-
if (key == null) {
|
|
93
|
-
key = this.collection.getLastKey();
|
|
94
|
-
}
|
|
95
|
-
} while (key != null && this.isDisabled(key));
|
|
96
|
-
return key;
|
|
97
|
-
}
|
|
98
|
-
}
|