@react-aria/tabs 3.7.1-nightly.4153 → 3.7.1-nightly.4162

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 CHANGED
@@ -46,11 +46,11 @@ function $99b62ae3ff97ec45$export$567fc7097e064344(state, key, role) {
46
46
 
47
47
  function $0175d55c2a017ebc$export$fdf4756d5b8ef90a(props, state, ref) {
48
48
  var _item_props;
49
- let { key: key , isDisabled: propsDisabled , shouldSelectOnPressUp: shouldSelectOnPressUp } = props;
50
- let { selectionManager: manager , selectedKey: selectedKey } = state;
49
+ let { key: key, isDisabled: propsDisabled, shouldSelectOnPressUp: shouldSelectOnPressUp } = props;
50
+ let { selectionManager: manager, selectedKey: selectedKey } = state;
51
51
  let isSelected = key === selectedKey;
52
52
  let isDisabled = propsDisabled || state.isDisabled || state.disabledKeys.has(key);
53
- let { itemProps: itemProps , isPressed: isPressed } = (0, $8kq0t$useSelectableItem)({
53
+ let { itemProps: itemProps, isPressed: isPressed } = (0, $8kq0t$useSelectableItem)({
54
54
  selectionManager: manager,
55
55
  key: key,
56
56
  ref: ref,
@@ -60,7 +60,7 @@ function $0175d55c2a017ebc$export$fdf4756d5b8ef90a(props, state, ref) {
60
60
  });
61
61
  let tabId = (0, $99b62ae3ff97ec45$export$567fc7097e064344)(state, key, "tab");
62
62
  let tabPanelId = (0, $99b62ae3ff97ec45$export$567fc7097e064344)(state, key, "tabpanel");
63
- let { tabIndex: tabIndex } = itemProps;
63
+ let { tabIndex: tabIndex } = itemProps;
64
64
  let item = state.collection.getItem(key);
65
65
  let domProps = (0, $8kq0t$filterDOMProps)(item === null || item === void 0 ? void 0 : item.props, {
66
66
  isLink: !!(item === null || item === void 0 ? void 0 : (_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.href)
@@ -191,16 +191,16 @@ function $34bce698202e07cb$export$fae0121b5afe572d(props, state, ref) {
191
191
 
192
192
 
193
193
  function $58d314389b21fa3f$export$773e389e644c5874(props, state, ref) {
194
- let { orientation: orientation = "horizontal" , keyboardActivation: keyboardActivation = "automatic" } = props;
195
- let { collection: collection , selectionManager: manager , disabledKeys: disabledKeys } = state;
196
- let { direction: direction } = (0, $8kq0t$useLocale)();
194
+ let { orientation: orientation = "horizontal", keyboardActivation: keyboardActivation = "automatic" } = props;
195
+ let { collection: collection, selectionManager: manager, disabledKeys: disabledKeys } = state;
196
+ let { direction: direction } = (0, $8kq0t$useLocale)();
197
197
  let delegate = (0, $8kq0t$useMemo)(()=>new (0, $bfc6f2d60b8a4c40$export$15010ca3c1abe90b)(collection, direction, orientation, disabledKeys), [
198
198
  collection,
199
199
  disabledKeys,
200
200
  orientation,
201
201
  direction
202
202
  ]);
203
- let { collectionProps: collectionProps } = (0, $8kq0t$useSelectableCollection)({
203
+ let { collectionProps: collectionProps } = (0, $8kq0t$useSelectableCollection)({
204
204
  ref: ref,
205
205
  selectionManager: manager,
206
206
  keyboardDelegate: delegate,
package/dist/main.js CHANGED
@@ -53,11 +53,11 @@ function $a217ebca77471970$export$567fc7097e064344(state, key, role) {
53
53
 
54
54
  function $4eeea1c984cc0628$export$fdf4756d5b8ef90a(props, state, ref) {
55
55
  var _item_props;
56
- let { key: key , isDisabled: propsDisabled , shouldSelectOnPressUp: shouldSelectOnPressUp } = props;
57
- let { selectionManager: manager , selectedKey: selectedKey } = state;
56
+ let { key: key, isDisabled: propsDisabled, shouldSelectOnPressUp: shouldSelectOnPressUp } = props;
57
+ let { selectionManager: manager, selectedKey: selectedKey } = state;
58
58
  let isSelected = key === selectedKey;
59
59
  let isDisabled = propsDisabled || state.isDisabled || state.disabledKeys.has(key);
60
- let { itemProps: itemProps , isPressed: isPressed } = (0, $1cJu1$reactariaselection.useSelectableItem)({
60
+ let { itemProps: itemProps, isPressed: isPressed } = (0, $1cJu1$reactariaselection.useSelectableItem)({
61
61
  selectionManager: manager,
62
62
  key: key,
63
63
  ref: ref,
@@ -67,7 +67,7 @@ function $4eeea1c984cc0628$export$fdf4756d5b8ef90a(props, state, ref) {
67
67
  });
68
68
  let tabId = (0, $a217ebca77471970$export$567fc7097e064344)(state, key, "tab");
69
69
  let tabPanelId = (0, $a217ebca77471970$export$567fc7097e064344)(state, key, "tabpanel");
70
- let { tabIndex: tabIndex } = itemProps;
70
+ let { tabIndex: tabIndex } = itemProps;
71
71
  let item = state.collection.getItem(key);
72
72
  let domProps = (0, $1cJu1$reactariautils.filterDOMProps)(item === null || item === void 0 ? void 0 : item.props, {
73
73
  isLink: !!(item === null || item === void 0 ? void 0 : (_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.href)
@@ -198,16 +198,16 @@ function $8db1928b18472a1f$export$fae0121b5afe572d(props, state, ref) {
198
198
 
199
199
 
200
200
  function $f2b4a4926440e901$export$773e389e644c5874(props, state, ref) {
201
- let { orientation: orientation = "horizontal" , keyboardActivation: keyboardActivation = "automatic" } = props;
202
- let { collection: collection , selectionManager: manager , disabledKeys: disabledKeys } = state;
203
- let { direction: direction } = (0, $1cJu1$reactariai18n.useLocale)();
201
+ let { orientation: orientation = "horizontal", keyboardActivation: keyboardActivation = "automatic" } = props;
202
+ let { collection: collection, selectionManager: manager, disabledKeys: disabledKeys } = state;
203
+ let { direction: direction } = (0, $1cJu1$reactariai18n.useLocale)();
204
204
  let delegate = (0, $1cJu1$react.useMemo)(()=>new (0, $283e5d8830177ead$export$15010ca3c1abe90b)(collection, direction, orientation, disabledKeys), [
205
205
  collection,
206
206
  disabledKeys,
207
207
  orientation,
208
208
  direction
209
209
  ]);
210
- let { collectionProps: collectionProps } = (0, $1cJu1$reactariaselection.useSelectableCollection)({
210
+ let { collectionProps: collectionProps } = (0, $1cJu1$reactariaselection.useSelectableCollection)({
211
211
  ref: ref,
212
212
  selectionManager: manager,
213
213
  keyboardDelegate: delegate,
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;ACVD;;;;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B;IAC/B,IAAI,SAAS,CAAA,GAAA,2BAAI;IACjB,CAAA,GAAA,yCAAM,EAAE,IAAI,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/index.ts","packages/@react-aria/tabs/src/useTab.ts","packages/@react-aria/tabs/src/utils.ts","packages/@react-aria/tabs/src/useTabPanel.ts","packages/@react-aria/tabs/src/useTabList.ts","packages/@react-aria/tabs/src/TabsKeyboardDelegate.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useTab} from './useTab';\nexport {useTabPanel} from './useTabPanel';\nexport {useTabList} from './useTabList';\nexport type {AriaTabListProps, AriaTabPanelProps, AriaTabProps} from '@react-types/tabs';\nexport type {Orientation} from '@react-types/shared';\nexport type {TabAria} from './useTab';\nexport type {TabPanelAria} from './useTabPanel';\nexport type {AriaTabListOptions, TabListAria} from './useTabList';\n","/*\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} 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.disabledKeys.has(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, {isLink: !!item?.props?.href});\n delete domProps.id;\n\n return {\n tabProps: mergeProps(domProps, 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","/*\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';\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","/*\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","/*\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","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, Direction, KeyboardDelegate, Orientation} from '@react-types/shared';\nimport {Key} from 'react';\n\nexport class TabsKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: Collection<T>;\n private flipDirection: boolean;\n private disabledKeys: Set<Key>;\n\n constructor(collection: Collection<T>, direction: Direction, orientation: Orientation, disabledKeys: Set<Key> = new Set()) {\n this.collection = collection;\n this.flipDirection = direction === 'rtl' && orientation === 'horizontal'; \n this.disabledKeys = disabledKeys;\n }\n\n getKeyLeftOf(key: Key) {\n if (this.flipDirection) {\n return this.getNextKey(key);\n }\n return this.getPreviousKey(key);\n }\n\n getKeyRightOf(key: Key) {\n if (this.flipDirection) {\n return this.getPreviousKey(key);\n } \n return this.getNextKey(key);\n }\n\n getKeyAbove(key: Key) {\n return this.getPreviousKey(key);\n }\n\n getKeyBelow(key: Key) {\n return this.getNextKey(key);\n }\n\n getFirstKey() {\n let key = this.collection.getFirstKey();\n if (this.disabledKeys.has(key)) {\n key = this.getNextKey(key);\n }\n return key;\n }\n\n getLastKey() {\n let key = this.collection.getLastKey();\n if (this.disabledKeys.has(key)) {\n key = this.getPreviousKey(key);\n }\n return key;\n }\n\n getNextKey(key) {\n do {\n key = this.collection.getKeyAfter(key);\n if (key == null) {\n key = this.collection.getFirstKey();\n }\n } while (this.disabledKeys.has(key));\n return key;\n }\n\n getPreviousKey(key) {\n do {\n key = this.collection.getKeyBefore(key);\n if (key == null) {\n key = this.collection.getLastKey();\n }\n } while (this.disabledKeys.has(key));\n return key;\n }\n}\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;ACVD;;;;;;;;;;CAUC,GAKM,MAAM,4CAAU,IAAI;AAEpB,SAAS,0CAAc,KAAsB,EAAE,GAAQ,EAAE,IAAY;IAC1E,IAAI,OAAO,QAAQ,UACjB,MAAM,IAAI,QAAQ,QAAQ;IAG5B,IAAI,SAAS,0CAAQ,IAAI;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC;AACnC;;;;ADWO,SAAS,0CACd,KAAmB,EACnB,KAAsB,EACtB,GAAgC;QAsBsB;IApBtD,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,cAAc,MAAM,aAAa,IAAI;IAC7E,IAAI,aAAC,SAAS,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,2CAAgB,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,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B,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,yCAAmB,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,yCAAM,EAAE,IAAI,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/index.ts","packages/@react-aria/tabs/src/useTab.ts","packages/@react-aria/tabs/src/utils.ts","packages/@react-aria/tabs/src/useTabPanel.ts","packages/@react-aria/tabs/src/useTabList.ts","packages/@react-aria/tabs/src/TabsKeyboardDelegate.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useTab} from './useTab';\nexport {useTabPanel} from './useTabPanel';\nexport {useTabList} from './useTabList';\nexport type {AriaTabListProps, AriaTabPanelProps, AriaTabProps} from '@react-types/tabs';\nexport type {Orientation} from '@react-types/shared';\nexport type {TabAria} from './useTab';\nexport type {TabPanelAria} from './useTabPanel';\nexport type {AriaTabListOptions, TabListAria} from './useTabList';\n","/*\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} 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.disabledKeys.has(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, {isLink: !!item?.props?.href});\n delete domProps.id;\n\n return {\n tabProps: mergeProps(domProps, 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","/*\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';\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","/*\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","/*\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","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, Direction, KeyboardDelegate, Orientation} from '@react-types/shared';\nimport {Key} from 'react';\n\nexport class TabsKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: Collection<T>;\n private flipDirection: boolean;\n private disabledKeys: Set<Key>;\n\n constructor(collection: Collection<T>, direction: Direction, orientation: Orientation, disabledKeys: Set<Key> = new Set()) {\n this.collection = collection;\n this.flipDirection = direction === 'rtl' && orientation === 'horizontal'; \n this.disabledKeys = disabledKeys;\n }\n\n getKeyLeftOf(key: Key) {\n if (this.flipDirection) {\n return this.getNextKey(key);\n }\n return this.getPreviousKey(key);\n }\n\n getKeyRightOf(key: Key) {\n if (this.flipDirection) {\n return this.getPreviousKey(key);\n } \n return this.getNextKey(key);\n }\n\n getKeyAbove(key: Key) {\n return this.getPreviousKey(key);\n }\n\n getKeyBelow(key: Key) {\n return this.getNextKey(key);\n }\n\n getFirstKey() {\n let key = this.collection.getFirstKey();\n if (this.disabledKeys.has(key)) {\n key = this.getNextKey(key);\n }\n return key;\n }\n\n getLastKey() {\n let key = this.collection.getLastKey();\n if (this.disabledKeys.has(key)) {\n key = this.getPreviousKey(key);\n }\n return key;\n }\n\n getNextKey(key) {\n do {\n key = this.collection.getKeyAfter(key);\n if (key == null) {\n key = this.collection.getFirstKey();\n }\n } while (this.disabledKeys.has(key));\n return key;\n }\n\n getPreviousKey(key) {\n do {\n key = this.collection.getKeyBefore(key);\n if (key == null) {\n key = this.collection.getLastKey();\n }\n } while (this.disabledKeys.has(key));\n return key;\n }\n}\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -46,11 +46,11 @@ function $99b62ae3ff97ec45$export$567fc7097e064344(state, key, role) {
46
46
 
47
47
  function $0175d55c2a017ebc$export$fdf4756d5b8ef90a(props, state, ref) {
48
48
  var _item_props;
49
- let { key: key , isDisabled: propsDisabled , shouldSelectOnPressUp: shouldSelectOnPressUp } = props;
50
- let { selectionManager: manager , selectedKey: selectedKey } = state;
49
+ let { key: key, isDisabled: propsDisabled, shouldSelectOnPressUp: shouldSelectOnPressUp } = props;
50
+ let { selectionManager: manager, selectedKey: selectedKey } = state;
51
51
  let isSelected = key === selectedKey;
52
52
  let isDisabled = propsDisabled || state.isDisabled || state.disabledKeys.has(key);
53
- let { itemProps: itemProps , isPressed: isPressed } = (0, $8kq0t$useSelectableItem)({
53
+ let { itemProps: itemProps, isPressed: isPressed } = (0, $8kq0t$useSelectableItem)({
54
54
  selectionManager: manager,
55
55
  key: key,
56
56
  ref: ref,
@@ -60,7 +60,7 @@ function $0175d55c2a017ebc$export$fdf4756d5b8ef90a(props, state, ref) {
60
60
  });
61
61
  let tabId = (0, $99b62ae3ff97ec45$export$567fc7097e064344)(state, key, "tab");
62
62
  let tabPanelId = (0, $99b62ae3ff97ec45$export$567fc7097e064344)(state, key, "tabpanel");
63
- let { tabIndex: tabIndex } = itemProps;
63
+ let { tabIndex: tabIndex } = itemProps;
64
64
  let item = state.collection.getItem(key);
65
65
  let domProps = (0, $8kq0t$filterDOMProps)(item === null || item === void 0 ? void 0 : item.props, {
66
66
  isLink: !!(item === null || item === void 0 ? void 0 : (_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.href)
@@ -191,16 +191,16 @@ function $34bce698202e07cb$export$fae0121b5afe572d(props, state, ref) {
191
191
 
192
192
 
193
193
  function $58d314389b21fa3f$export$773e389e644c5874(props, state, ref) {
194
- let { orientation: orientation = "horizontal" , keyboardActivation: keyboardActivation = "automatic" } = props;
195
- let { collection: collection , selectionManager: manager , disabledKeys: disabledKeys } = state;
196
- let { direction: direction } = (0, $8kq0t$useLocale)();
194
+ let { orientation: orientation = "horizontal", keyboardActivation: keyboardActivation = "automatic" } = props;
195
+ let { collection: collection, selectionManager: manager, disabledKeys: disabledKeys } = state;
196
+ let { direction: direction } = (0, $8kq0t$useLocale)();
197
197
  let delegate = (0, $8kq0t$useMemo)(()=>new (0, $bfc6f2d60b8a4c40$export$15010ca3c1abe90b)(collection, direction, orientation, disabledKeys), [
198
198
  collection,
199
199
  disabledKeys,
200
200
  orientation,
201
201
  direction
202
202
  ]);
203
- let { collectionProps: collectionProps } = (0, $8kq0t$useSelectableCollection)({
203
+ let { collectionProps: collectionProps } = (0, $8kq0t$useSelectableCollection)({
204
204
  ref: ref,
205
205
  selectionManager: manager,
206
206
  keyboardDelegate: delegate,
@@ -1 +1 @@
1
- {"mappings":";;;;;;AAA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wB;QACxB,WAAW;QACX,cAAc;IAChB;IAEA,+BAA+B;IAC/B,IAAI,SAAS,CAAA,GAAA,YAAI;IACjB,CAAA,GAAA,yCAAM,EAAE,IAAI,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/index.ts","packages/@react-aria/tabs/src/useTab.ts","packages/@react-aria/tabs/src/utils.ts","packages/@react-aria/tabs/src/useTabPanel.ts","packages/@react-aria/tabs/src/useTabList.ts","packages/@react-aria/tabs/src/TabsKeyboardDelegate.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useTab} from './useTab';\nexport {useTabPanel} from './useTabPanel';\nexport {useTabList} from './useTabList';\nexport type {AriaTabListProps, AriaTabPanelProps, AriaTabProps} from '@react-types/tabs';\nexport type {Orientation} from '@react-types/shared';\nexport type {TabAria} from './useTab';\nexport type {TabPanelAria} from './useTabPanel';\nexport type {AriaTabListOptions, TabListAria} from './useTabList';\n","/*\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} 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.disabledKeys.has(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, {isLink: !!item?.props?.href});\n delete domProps.id;\n\n return {\n tabProps: mergeProps(domProps, 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","/*\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';\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","/*\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","/*\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","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, Direction, KeyboardDelegate, Orientation} from '@react-types/shared';\nimport {Key} from 'react';\n\nexport class TabsKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: Collection<T>;\n private flipDirection: boolean;\n private disabledKeys: Set<Key>;\n\n constructor(collection: Collection<T>, direction: Direction, orientation: Orientation, disabledKeys: Set<Key> = new Set()) {\n this.collection = collection;\n this.flipDirection = direction === 'rtl' && orientation === 'horizontal'; \n this.disabledKeys = disabledKeys;\n }\n\n getKeyLeftOf(key: Key) {\n if (this.flipDirection) {\n return this.getNextKey(key);\n }\n return this.getPreviousKey(key);\n }\n\n getKeyRightOf(key: Key) {\n if (this.flipDirection) {\n return this.getPreviousKey(key);\n } \n return this.getNextKey(key);\n }\n\n getKeyAbove(key: Key) {\n return this.getPreviousKey(key);\n }\n\n getKeyBelow(key: Key) {\n return this.getNextKey(key);\n }\n\n getFirstKey() {\n let key = this.collection.getFirstKey();\n if (this.disabledKeys.has(key)) {\n key = this.getNextKey(key);\n }\n return key;\n }\n\n getLastKey() {\n let key = this.collection.getLastKey();\n if (this.disabledKeys.has(key)) {\n key = this.getPreviousKey(key);\n }\n return key;\n }\n\n getNextKey(key) {\n do {\n key = this.collection.getKeyAfter(key);\n if (key == null) {\n key = this.collection.getFirstKey();\n }\n } while (this.disabledKeys.has(key));\n return key;\n }\n\n getPreviousKey(key) {\n do {\n key = this.collection.getKeyBefore(key);\n if (key == null) {\n key = this.collection.getLastKey();\n }\n } while (this.disabledKeys.has(key));\n return key;\n }\n}\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC;ACVD;;;;;;;;;;CAUC,GAKM,MAAM,4CAAU,IAAI;AAEpB,SAAS,0CAAc,KAAsB,EAAE,GAAQ,EAAE,IAAY;IAC1E,IAAI,OAAO,QAAQ,UACjB,MAAM,IAAI,QAAQ,QAAQ;IAG5B,IAAI,SAAS,0CAAQ,IAAI;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC;AACnC;;;;ADWO,SAAS,0CACd,KAAmB,EACnB,KAAsB,EACtB,GAAgC;QAsBsB;IApBtD,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,cAAc,MAAM,aAAa,IAAI;IAC7E,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,YAA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;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,IAAI,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/index.ts","packages/@react-aria/tabs/src/useTab.ts","packages/@react-aria/tabs/src/utils.ts","packages/@react-aria/tabs/src/useTabPanel.ts","packages/@react-aria/tabs/src/useTabList.ts","packages/@react-aria/tabs/src/TabsKeyboardDelegate.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useTab} from './useTab';\nexport {useTabPanel} from './useTabPanel';\nexport {useTabList} from './useTabList';\nexport type {AriaTabListProps, AriaTabPanelProps, AriaTabProps} from '@react-types/tabs';\nexport type {Orientation} from '@react-types/shared';\nexport type {TabAria} from './useTab';\nexport type {TabPanelAria} from './useTabPanel';\nexport type {AriaTabListOptions, TabListAria} from './useTabList';\n","/*\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} 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.disabledKeys.has(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, {isLink: !!item?.props?.href});\n delete domProps.id;\n\n return {\n tabProps: mergeProps(domProps, 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","/*\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';\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","/*\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","/*\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","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, Direction, KeyboardDelegate, Orientation} from '@react-types/shared';\nimport {Key} from 'react';\n\nexport class TabsKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: Collection<T>;\n private flipDirection: boolean;\n private disabledKeys: Set<Key>;\n\n constructor(collection: Collection<T>, direction: Direction, orientation: Orientation, disabledKeys: Set<Key> = new Set()) {\n this.collection = collection;\n this.flipDirection = direction === 'rtl' && orientation === 'horizontal'; \n this.disabledKeys = disabledKeys;\n }\n\n getKeyLeftOf(key: Key) {\n if (this.flipDirection) {\n return this.getNextKey(key);\n }\n return this.getPreviousKey(key);\n }\n\n getKeyRightOf(key: Key) {\n if (this.flipDirection) {\n return this.getPreviousKey(key);\n } \n return this.getNextKey(key);\n }\n\n getKeyAbove(key: Key) {\n return this.getPreviousKey(key);\n }\n\n getKeyBelow(key: Key) {\n return this.getNextKey(key);\n }\n\n getFirstKey() {\n let key = this.collection.getFirstKey();\n if (this.disabledKeys.has(key)) {\n key = this.getNextKey(key);\n }\n return key;\n }\n\n getLastKey() {\n let key = this.collection.getLastKey();\n if (this.disabledKeys.has(key)) {\n key = this.getPreviousKey(key);\n }\n return key;\n }\n\n getNextKey(key) {\n do {\n key = this.collection.getKeyAfter(key);\n if (key == null) {\n key = this.collection.getFirstKey();\n }\n } while (this.disabledKeys.has(key));\n return key;\n }\n\n getPreviousKey(key) {\n do {\n key = this.collection.getKeyBefore(key);\n if (key == null) {\n key = this.collection.getLastKey();\n }\n } while (this.disabledKeys.has(key));\n return key;\n }\n}\n"],"names":[],"version":3,"file":"module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/tabs",
3
- "version": "3.7.1-nightly.4153+54d260d73",
3
+ "version": "3.7.1-nightly.4162+e79cff031",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,15 +22,15 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/focus": "3.0.0-nightly.2444+54d260d73",
26
- "@react-aria/i18n": "3.0.0-nightly.2444+54d260d73",
27
- "@react-aria/interactions": "3.0.0-nightly.2444+54d260d73",
28
- "@react-aria/selection": "3.0.0-nightly.2444+54d260d73",
29
- "@react-aria/utils": "3.0.0-nightly.2444+54d260d73",
30
- "@react-stately/list": "3.9.3-nightly.4153+54d260d73",
31
- "@react-stately/tabs": "3.0.0-nightly.2444+54d260d73",
32
- "@react-types/shared": "3.0.0-nightly.2444+54d260d73",
33
- "@react-types/tabs": "3.3.3-nightly.4153+54d260d73",
25
+ "@react-aria/focus": "3.0.0-nightly.2453+e79cff031",
26
+ "@react-aria/i18n": "3.0.0-nightly.2453+e79cff031",
27
+ "@react-aria/interactions": "3.0.0-nightly.2453+e79cff031",
28
+ "@react-aria/selection": "3.0.0-nightly.2453+e79cff031",
29
+ "@react-aria/utils": "3.0.0-nightly.2453+e79cff031",
30
+ "@react-stately/list": "3.9.3-nightly.4162+e79cff031",
31
+ "@react-stately/tabs": "3.0.0-nightly.2453+e79cff031",
32
+ "@react-types/shared": "3.0.0-nightly.2453+e79cff031",
33
+ "@react-types/tabs": "3.3.3-nightly.4162+e79cff031",
34
34
  "@swc/helpers": "^0.5.0"
35
35
  },
36
36
  "peerDependencies": {
@@ -40,5 +40,5 @@
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
- "gitHead": "54d260d736f3e24d02c4277e593f4ab34930f9bd"
43
+ "gitHead": "e79cff031ecf3cea7242daddf308625d638fd056"
44
44
  }