@react-aria/tabs 3.8.6-nightly.4552 → 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
package/dist/useTab.mjs
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {generateId as $99b62ae3ff97ec45$export$567fc7097e064344} from "./utils.mjs";
|
|
2
|
+
import {filterDOMProps as $dObGJ$filterDOMProps, useLinkProps as $dObGJ$useLinkProps, mergeProps as $dObGJ$mergeProps} from "@react-aria/utils";
|
|
3
|
+
import {useSelectableItem as $dObGJ$useSelectableItem} from "@react-aria/selection";
|
|
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 $0175d55c2a017ebc$export$fdf4756d5b8ef90a(props, state, ref) {
|
|
19
|
+
let { key: key, isDisabled: propsDisabled, shouldSelectOnPressUp: shouldSelectOnPressUp } = props;
|
|
20
|
+
let { selectionManager: manager, selectedKey: selectedKey } = state;
|
|
21
|
+
let isSelected = key === selectedKey;
|
|
22
|
+
let isDisabled = propsDisabled || state.isDisabled || state.selectionManager.isDisabled(key);
|
|
23
|
+
let { itemProps: itemProps, isPressed: isPressed } = (0, $dObGJ$useSelectableItem)({
|
|
24
|
+
selectionManager: manager,
|
|
25
|
+
key: key,
|
|
26
|
+
ref: ref,
|
|
27
|
+
isDisabled: isDisabled,
|
|
28
|
+
shouldSelectOnPressUp: shouldSelectOnPressUp,
|
|
29
|
+
linkBehavior: "selection"
|
|
30
|
+
});
|
|
31
|
+
let tabId = (0, $99b62ae3ff97ec45$export$567fc7097e064344)(state, key, "tab");
|
|
32
|
+
let tabPanelId = (0, $99b62ae3ff97ec45$export$567fc7097e064344)(state, key, "tabpanel");
|
|
33
|
+
let { tabIndex: tabIndex } = itemProps;
|
|
34
|
+
let item = state.collection.getItem(key);
|
|
35
|
+
let domProps = (0, $dObGJ$filterDOMProps)(item === null || item === void 0 ? void 0 : item.props, {
|
|
36
|
+
labelable: true
|
|
37
|
+
});
|
|
38
|
+
delete domProps.id;
|
|
39
|
+
let linkProps = (0, $dObGJ$useLinkProps)(item === null || item === void 0 ? void 0 : item.props);
|
|
40
|
+
return {
|
|
41
|
+
tabProps: (0, $dObGJ$mergeProps)(domProps, linkProps, itemProps, {
|
|
42
|
+
id: tabId,
|
|
43
|
+
"aria-selected": isSelected,
|
|
44
|
+
"aria-disabled": isDisabled || undefined,
|
|
45
|
+
"aria-controls": isSelected ? tabPanelId : undefined,
|
|
46
|
+
tabIndex: isDisabled ? undefined : tabIndex,
|
|
47
|
+
role: "tab"
|
|
48
|
+
}),
|
|
49
|
+
isSelected: isSelected,
|
|
50
|
+
isDisabled: isDisabled,
|
|
51
|
+
isPressed: isPressed
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
export {$0175d55c2a017ebc$export$fdf4756d5b8ef90a as useTab};
|
|
57
|
+
//# sourceMappingURL=useTab.mjs.map
|
|
@@ -0,0 +1,57 @@
|
|
|
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 {useSelectableItem as $dObGJ$useSelectableItem} from "@react-aria/selection";
|
|
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 $0175d55c2a017ebc$export$fdf4756d5b8ef90a(props, state, ref) {
|
|
19
|
+
let { key: key, isDisabled: propsDisabled, shouldSelectOnPressUp: shouldSelectOnPressUp } = props;
|
|
20
|
+
let { selectionManager: manager, selectedKey: selectedKey } = state;
|
|
21
|
+
let isSelected = key === selectedKey;
|
|
22
|
+
let isDisabled = propsDisabled || state.isDisabled || state.selectionManager.isDisabled(key);
|
|
23
|
+
let { itemProps: itemProps, isPressed: isPressed } = (0, $dObGJ$useSelectableItem)({
|
|
24
|
+
selectionManager: manager,
|
|
25
|
+
key: key,
|
|
26
|
+
ref: ref,
|
|
27
|
+
isDisabled: isDisabled,
|
|
28
|
+
shouldSelectOnPressUp: shouldSelectOnPressUp,
|
|
29
|
+
linkBehavior: "selection"
|
|
30
|
+
});
|
|
31
|
+
let tabId = (0, $99b62ae3ff97ec45$export$567fc7097e064344)(state, key, "tab");
|
|
32
|
+
let tabPanelId = (0, $99b62ae3ff97ec45$export$567fc7097e064344)(state, key, "tabpanel");
|
|
33
|
+
let { tabIndex: tabIndex } = itemProps;
|
|
34
|
+
let item = state.collection.getItem(key);
|
|
35
|
+
let domProps = (0, $dObGJ$filterDOMProps)(item === null || item === void 0 ? void 0 : item.props, {
|
|
36
|
+
labelable: true
|
|
37
|
+
});
|
|
38
|
+
delete domProps.id;
|
|
39
|
+
let linkProps = (0, $dObGJ$useLinkProps)(item === null || item === void 0 ? void 0 : item.props);
|
|
40
|
+
return {
|
|
41
|
+
tabProps: (0, $dObGJ$mergeProps)(domProps, linkProps, itemProps, {
|
|
42
|
+
id: tabId,
|
|
43
|
+
"aria-selected": isSelected,
|
|
44
|
+
"aria-disabled": isDisabled || undefined,
|
|
45
|
+
"aria-controls": isSelected ? tabPanelId : undefined,
|
|
46
|
+
tabIndex: isDisabled ? undefined : tabIndex,
|
|
47
|
+
role: "tab"
|
|
48
|
+
}),
|
|
49
|
+
isSelected: isSelected,
|
|
50
|
+
isDisabled: isDisabled,
|
|
51
|
+
isPressed: isPressed
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
export {$0175d55c2a017ebc$export$fdf4756d5b8ef90a as useTab};
|
|
57
|
+
//# sourceMappingURL=useTab.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAyBM,SAAS,0CACd,KAAmB,EACnB,KAAsB,EACtB,GAAgC;IAEhC,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;IAExC,OAAO;QACL,UAAU,CAAA,GAAA,iBAAS,EAAE,UAAU,WAAW,WAAW;YACnD,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} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, useLinkProps} from '@react-aria/utils';\nimport {generateId} from './utils';\nimport {RefObject} from 'react';\nimport {TabListState} from '@react-stately/tabs';\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>\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\n return {\n tabProps: mergeProps(domProps, 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"}
|
|
@@ -0,0 +1,67 @@
|
|
|
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$react = require("react");
|
|
5
|
+
var $c5HcZ$reactariai18n = require("@react-aria/i18n");
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;AAUA;;;;;;AAuBO,SAAS,0CAAc,KAA4B,EAAE,KAAsB,EAAE,GAA2B;IAC7G,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} from '@react-types/shared';\nimport {mergeProps, useId, useLabels} from '@react-aria/utils';\nimport {RefObject, useMemo} from 'react';\nimport {TabListState} from '@react-stately/tabs';\nimport {tabsIds} from './utils';\nimport {TabsKeyboardDelegate} from './TabsKeyboardDelegate';\nimport {useLocale} from '@react-aria/i18n';\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>): 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"}
|
|
@@ -0,0 +1,62 @@
|
|
|
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 {useMemo as $bQNZs$useMemo} from "react";
|
|
5
|
+
import {useLocale as $bQNZs$useLocale} from "@react-aria/i18n";
|
|
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.mjs.map
|
|
@@ -0,0 +1,62 @@
|
|
|
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 {useMemo as $bQNZs$useMemo} from "react";
|
|
5
|
+
import {useLocale as $bQNZs$useLocale} from "@react-aria/i18n";
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;AAAA;;;;;;;;;;AAUA;;;;;;AAuBO,SAAS,0CAAc,KAA4B,EAAE,KAAsB,EAAE,GAA2B;IAC7G,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} from '@react-types/shared';\nimport {mergeProps, useId, useLabels} from '@react-aria/utils';\nimport {RefObject, useMemo} from 'react';\nimport {TabListState} from '@react-stately/tabs';\nimport {tabsIds} from './utils';\nimport {TabsKeyboardDelegate} from './TabsKeyboardDelegate';\nimport {useLocale} from '@react-aria/i18n';\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>): 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"}
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAoBM,SAAS,0CAAe,KAAwB,EAAE,KAAsB,EAAE,GAAuB;IACtG,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} from '@react-types/shared';\nimport {generateId} from './utils';\nimport {mergeProps, useLabels} from '@react-aria/utils';\nimport {RefObject} from 'react';\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>, ref: RefObject<Element>): 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"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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.mjs.map
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAoBM,SAAS,0CAAe,KAAwB,EAAE,KAAsB,EAAE,GAAuB;IACtG,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} from '@react-types/shared';\nimport {generateId} from './utils';\nimport {mergeProps, useLabels} from '@react-aria/utils';\nimport {RefObject} from 'react';\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>, ref: RefObject<Element>): 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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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 (typeof key === "string") key = key.replace(/\s+/g, "");
|
|
21
|
+
let baseId = $a217ebca77471970$export$c5f62239608282b6.get(state);
|
|
22
|
+
return `${baseId}-${role}-${key}`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=utils.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC,GAKM,MAAM,4CAAU,IAAI;AAEpB,SAAS,0CAAc,KAAsB,EAAE,GAAQ,EAAE,IAAY;IAC1E,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>, key: Key, role: string) {\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
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
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 (typeof key === "string") key = key.replace(/\s+/g, "");
|
|
14
|
+
let baseId = $99b62ae3ff97ec45$export$c5f62239608282b6.get(state);
|
|
15
|
+
return `${baseId}-${role}-${key}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export {$99b62ae3ff97ec45$export$c5f62239608282b6 as tabsIds, $99b62ae3ff97ec45$export$567fc7097e064344 as generateId};
|
|
20
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1,20 @@
|
|
|
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 (typeof key === "string") key = key.replace(/\s+/g, "");
|
|
14
|
+
let baseId = $99b62ae3ff97ec45$export$c5f62239608282b6.get(state);
|
|
15
|
+
return `${baseId}-${role}-${key}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export {$99b62ae3ff97ec45$export$c5f62239608282b6 as tabsIds, $99b62ae3ff97ec45$export$567fc7097e064344 as generateId};
|
|
20
|
+
//# sourceMappingURL=utils.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA;;;;;;;;;;CAUC,GAKM,MAAM,4CAAU,IAAI;AAEpB,SAAS,0CAAc,KAAsB,EAAE,GAAQ,EAAE,IAAY;IAC1E,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>, key: Key, role: string) {\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.8.6-nightly.
|
|
3
|
+
"version": "3.8.6-nightly.4558+c5e4b3701",
|
|
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": "3.0.0-nightly.
|
|
26
|
-
"@react-aria/i18n": "3.0.0-nightly.
|
|
27
|
-
"@react-aria/selection": "3.0.0-nightly.
|
|
28
|
-
"@react-aria/utils": "3.0.0-nightly.
|
|
29
|
-
"@react-stately/tabs": "3.0.0-nightly.
|
|
30
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
31
|
-
"@react-types/tabs": "3.3.6-nightly.
|
|
25
|
+
"@react-aria/focus": "3.0.0-nightly.2846+c5e4b3701",
|
|
26
|
+
"@react-aria/i18n": "3.0.0-nightly.2846+c5e4b3701",
|
|
27
|
+
"@react-aria/selection": "3.0.0-nightly.2846+c5e4b3701",
|
|
28
|
+
"@react-aria/utils": "3.0.0-nightly.2846+c5e4b3701",
|
|
29
|
+
"@react-stately/tabs": "3.0.0-nightly.2846+c5e4b3701",
|
|
30
|
+
"@react-types/shared": "3.0.0-nightly.2846+c5e4b3701",
|
|
31
|
+
"@react-types/tabs": "3.3.6-nightly.4558+c5e4b3701",
|
|
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": "c5e4b3701fdb89eb551f1b3697ac253f06ef68fa"
|
|
42
42
|
}
|