@react-aria/tabs 3.8.6-nightly.4516 → 3.8.6-nightly.4528

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
@@ -49,7 +49,7 @@ function $0175d55c2a017ebc$export$fdf4756d5b8ef90a(props, state, ref) {
49
49
  let { key: key, isDisabled: propsDisabled, shouldSelectOnPressUp: shouldSelectOnPressUp } = props;
50
50
  let { selectionManager: manager, selectedKey: selectedKey } = state;
51
51
  let isSelected = key === selectedKey;
52
- let isDisabled = propsDisabled || state.isDisabled || state.disabledKeys.has(key);
52
+ let isDisabled = propsDisabled || state.isDisabled || state.selectionManager.isDisabled(key);
53
53
  let { itemProps: itemProps, isPressed: isPressed } = (0, $8kq0t$useSelectableItem)({
54
54
  selectionManager: manager,
55
55
  key: key,
@@ -157,28 +157,32 @@ function $34bce698202e07cb$export$fae0121b5afe572d(props, state, ref) {
157
157
  getKeyBelow(key) {
158
158
  return this.getNextKey(key);
159
159
  }
160
+ isDisabled(key) {
161
+ var _this_collection_getItem_props, _this_collection_getItem;
162
+ return this.disabledKeys.has(key) || !!((_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : (_this_collection_getItem_props = _this_collection_getItem.props) === null || _this_collection_getItem_props === void 0 ? void 0 : _this_collection_getItem_props.isDisabled);
163
+ }
160
164
  getFirstKey() {
161
165
  let key = this.collection.getFirstKey();
162
- if (key != null && this.disabledKeys.has(key)) key = this.getNextKey(key);
166
+ if (key != null && this.isDisabled(key)) key = this.getNextKey(key);
163
167
  return key;
164
168
  }
165
169
  getLastKey() {
166
170
  let key = this.collection.getLastKey();
167
- if (key != null && this.disabledKeys.has(key)) key = this.getPreviousKey(key);
171
+ if (key != null && this.isDisabled(key)) key = this.getPreviousKey(key);
168
172
  return key;
169
173
  }
170
174
  getNextKey(key) {
171
175
  do {
172
176
  key = this.collection.getKeyAfter(key);
173
177
  if (key == null) key = this.collection.getFirstKey();
174
- }while (this.disabledKeys.has(key));
178
+ }while (this.isDisabled(key));
175
179
  return key;
176
180
  }
177
181
  getPreviousKey(key) {
178
182
  do {
179
183
  key = this.collection.getKeyBefore(key);
180
184
  if (key == null) key = this.collection.getLastKey();
181
- }while (this.disabledKeys.has(key));
185
+ }while (this.isDisabled(key));
182
186
  return key;
183
187
  }
184
188
  constructor(collection, direction, orientation, disabledKeys = new Set()){
package/dist/main.js CHANGED
@@ -57,7 +57,7 @@ function $4eeea1c984cc0628$export$fdf4756d5b8ef90a(props, state, ref) {
57
57
  let { key: key, isDisabled: propsDisabled, shouldSelectOnPressUp: shouldSelectOnPressUp } = props;
58
58
  let { selectionManager: manager, selectedKey: selectedKey } = state;
59
59
  let isSelected = key === selectedKey;
60
- let isDisabled = propsDisabled || state.isDisabled || state.disabledKeys.has(key);
60
+ let isDisabled = propsDisabled || state.isDisabled || state.selectionManager.isDisabled(key);
61
61
  let { itemProps: itemProps, isPressed: isPressed } = (0, $1cJu1$reactariaselection.useSelectableItem)({
62
62
  selectionManager: manager,
63
63
  key: key,
@@ -165,28 +165,32 @@ function $8db1928b18472a1f$export$fae0121b5afe572d(props, state, ref) {
165
165
  getKeyBelow(key) {
166
166
  return this.getNextKey(key);
167
167
  }
168
+ isDisabled(key) {
169
+ var _this_collection_getItem_props, _this_collection_getItem;
170
+ return this.disabledKeys.has(key) || !!((_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : (_this_collection_getItem_props = _this_collection_getItem.props) === null || _this_collection_getItem_props === void 0 ? void 0 : _this_collection_getItem_props.isDisabled);
171
+ }
168
172
  getFirstKey() {
169
173
  let key = this.collection.getFirstKey();
170
- if (key != null && this.disabledKeys.has(key)) key = this.getNextKey(key);
174
+ if (key != null && this.isDisabled(key)) key = this.getNextKey(key);
171
175
  return key;
172
176
  }
173
177
  getLastKey() {
174
178
  let key = this.collection.getLastKey();
175
- if (key != null && this.disabledKeys.has(key)) key = this.getPreviousKey(key);
179
+ if (key != null && this.isDisabled(key)) key = this.getPreviousKey(key);
176
180
  return key;
177
181
  }
178
182
  getNextKey(key) {
179
183
  do {
180
184
  key = this.collection.getKeyAfter(key);
181
185
  if (key == null) key = this.collection.getFirstKey();
182
- }while (this.disabledKeys.has(key));
186
+ }while (this.isDisabled(key));
183
187
  return key;
184
188
  }
185
189
  getPreviousKey(key) {
186
190
  do {
187
191
  key = this.collection.getKeyBefore(key);
188
192
  if (key == null) key = this.collection.getLastKey();
189
- }while (this.disabledKeys.has(key));
193
+ }while (this.isDisabled(key));
190
194
  return key;
191
195
  }
192
196
  constructor(collection, direction, orientation, disabledKeys = new Set()){
package/dist/main.js.map CHANGED
@@ -1 +1 @@
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,OAAO,CAAC,QAAQ;IAG5B,IAAI,SAAS,0CAAQ,GAAG,CAAC;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,UAAU,IAAI,MAAM,YAAY,CAAC,GAAG,CAAC;IAC7E,IAAI,aAAC,SAAS,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,2CAAgB,EAAE;QAC7C,kBAAkB;aAClB;aACA;oBACA;+BACA;QACA,cAAc;IAChB;IAEA,IAAI,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AO;IACT;IA9DA,YAAY,UAAyB,EAAE,SAAoB,EAAE,WAAwB,EAAE,eAAyB,IAAI,KAAK,CAAE;QACzH,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,aAAa,GAAG,cAAc,SAAS,gBAAgB;QAC5D,IAAI,CAAC,YAAY,GAAG;IACtB;AA2DF;;;;;ADjDO,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,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,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/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, labelable: true});\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-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","/*\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, Key, KeyboardDelegate, Orientation} from '@react-types/shared';\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 (key != null && 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 (key != null && 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,KAA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,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,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/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.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, {isLink: !!item?.props?.href, labelable: true});\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-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","/*\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, Key, KeyboardDelegate, Node, Orientation} from '@react-types/shared';\n\nexport class TabsKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: Collection<Node<T>>;\n private flipDirection: boolean;\n private disabledKeys: Set<Key>;\n\n constructor(collection: Collection<Node<T>>, direction: Direction, orientation: Orientation, disabledKeys: Set<Key> = new Set()) {\n this.collection = collection;\n this.flipDirection = direction === 'rtl' && orientation === 'horizontal';\n this.disabledKeys = disabledKeys;\n }\n\n getKeyLeftOf(key: Key) {\n if (this.flipDirection) {\n return this.getNextKey(key);\n }\n return this.getPreviousKey(key);\n }\n\n getKeyRightOf(key: Key) {\n if (this.flipDirection) {\n return this.getPreviousKey(key);\n }\n return this.getNextKey(key);\n }\n\n getKeyAbove(key: Key) {\n return this.getPreviousKey(key);\n }\n\n getKeyBelow(key: Key) {\n return this.getNextKey(key);\n }\n\n private isDisabled(key: Key) {\n return this.disabledKeys.has(key) || !!this.collection.getItem(key)?.props?.isDisabled;\n }\n\n getFirstKey() {\n let key = this.collection.getFirstKey();\n if (key != null && this.isDisabled(key)) {\n key = this.getNextKey(key);\n }\n return key;\n }\n\n getLastKey() {\n let key = this.collection.getLastKey();\n if (key != null && this.isDisabled(key)) {\n key = this.getPreviousKey(key);\n }\n return key;\n }\n\n getNextKey(key) {\n do {\n key = this.collection.getKeyAfter(key);\n if (key == null) {\n key = this.collection.getFirstKey();\n }\n } while (this.isDisabled(key));\n return key;\n }\n\n getPreviousKey(key) {\n do {\n key = this.collection.getKeyBefore(key);\n if (key == null) {\n key = this.collection.getLastKey();\n }\n } while (this.isDisabled(key));\n return key;\n }\n}\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -49,7 +49,7 @@ function $0175d55c2a017ebc$export$fdf4756d5b8ef90a(props, state, ref) {
49
49
  let { key: key, isDisabled: propsDisabled, shouldSelectOnPressUp: shouldSelectOnPressUp } = props;
50
50
  let { selectionManager: manager, selectedKey: selectedKey } = state;
51
51
  let isSelected = key === selectedKey;
52
- let isDisabled = propsDisabled || state.isDisabled || state.disabledKeys.has(key);
52
+ let isDisabled = propsDisabled || state.isDisabled || state.selectionManager.isDisabled(key);
53
53
  let { itemProps: itemProps, isPressed: isPressed } = (0, $8kq0t$useSelectableItem)({
54
54
  selectionManager: manager,
55
55
  key: key,
@@ -157,28 +157,32 @@ function $34bce698202e07cb$export$fae0121b5afe572d(props, state, ref) {
157
157
  getKeyBelow(key) {
158
158
  return this.getNextKey(key);
159
159
  }
160
+ isDisabled(key) {
161
+ var _this_collection_getItem_props, _this_collection_getItem;
162
+ return this.disabledKeys.has(key) || !!((_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : (_this_collection_getItem_props = _this_collection_getItem.props) === null || _this_collection_getItem_props === void 0 ? void 0 : _this_collection_getItem_props.isDisabled);
163
+ }
160
164
  getFirstKey() {
161
165
  let key = this.collection.getFirstKey();
162
- if (key != null && this.disabledKeys.has(key)) key = this.getNextKey(key);
166
+ if (key != null && this.isDisabled(key)) key = this.getNextKey(key);
163
167
  return key;
164
168
  }
165
169
  getLastKey() {
166
170
  let key = this.collection.getLastKey();
167
- if (key != null && this.disabledKeys.has(key)) key = this.getPreviousKey(key);
171
+ if (key != null && this.isDisabled(key)) key = this.getPreviousKey(key);
168
172
  return key;
169
173
  }
170
174
  getNextKey(key) {
171
175
  do {
172
176
  key = this.collection.getKeyAfter(key);
173
177
  if (key == null) key = this.collection.getFirstKey();
174
- }while (this.disabledKeys.has(key));
178
+ }while (this.isDisabled(key));
175
179
  return key;
176
180
  }
177
181
  getPreviousKey(key) {
178
182
  do {
179
183
  key = this.collection.getKeyBefore(key);
180
184
  if (key == null) key = this.collection.getLastKey();
181
- }while (this.disabledKeys.has(key));
185
+ }while (this.isDisabled(key));
182
186
  return key;
183
187
  }
184
188
  constructor(collection, direction, orientation, disabledKeys = new Set()){
@@ -1 +1 @@
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,OAAO,CAAC,QAAQ;IAG5B,IAAI,SAAS,0CAAQ,GAAG,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,EAA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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/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, labelable: true});\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-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","/*\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, Key, KeyboardDelegate, Orientation} from '@react-types/shared';\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 (key != null && 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 (key != null && 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,OAAO,CAAC,QAAQ;IAG5B,IAAI,SAAS,0CAAQ,GAAG,CAAC;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,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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,IAAI,CAAC,UAAU,CAAC,MAAM;QAC/B,OAAO;IACT;IAlEA,YAAY,UAA+B,EAAE,SAAoB,EAAE,WAAwB,EAAE,eAAyB,IAAI,KAAK,CAAE;QAC/H,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,aAAa,GAAG,cAAc,SAAS,gBAAgB;QAC5D,IAAI,CAAC,YAAY,GAAG;IACtB;AA+DF;;;;;ADrDO,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/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.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, {isLink: !!item?.props?.href, labelable: true});\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-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","/*\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, Key, KeyboardDelegate, Node, Orientation} from '@react-types/shared';\n\nexport class TabsKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: Collection<Node<T>>;\n private flipDirection: boolean;\n private disabledKeys: Set<Key>;\n\n constructor(collection: Collection<Node<T>>, direction: Direction, orientation: Orientation, disabledKeys: Set<Key> = new Set()) {\n this.collection = collection;\n this.flipDirection = direction === 'rtl' && orientation === 'horizontal';\n this.disabledKeys = disabledKeys;\n }\n\n getKeyLeftOf(key: Key) {\n if (this.flipDirection) {\n return this.getNextKey(key);\n }\n return this.getPreviousKey(key);\n }\n\n getKeyRightOf(key: Key) {\n if (this.flipDirection) {\n return this.getPreviousKey(key);\n }\n return this.getNextKey(key);\n }\n\n getKeyAbove(key: Key) {\n return this.getPreviousKey(key);\n }\n\n getKeyBelow(key: Key) {\n return this.getNextKey(key);\n }\n\n private isDisabled(key: Key) {\n return this.disabledKeys.has(key) || !!this.collection.getItem(key)?.props?.isDisabled;\n }\n\n getFirstKey() {\n let key = this.collection.getFirstKey();\n if (key != null && this.isDisabled(key)) {\n key = this.getNextKey(key);\n }\n return key;\n }\n\n getLastKey() {\n let key = this.collection.getLastKey();\n if (key != null && this.isDisabled(key)) {\n key = this.getPreviousKey(key);\n }\n return key;\n }\n\n getNextKey(key) {\n do {\n key = this.collection.getKeyAfter(key);\n if (key == null) {\n key = this.collection.getFirstKey();\n }\n } while (this.isDisabled(key));\n return key;\n }\n\n getPreviousKey(key) {\n do {\n key = this.collection.getKeyBefore(key);\n if (key == null) {\n key = this.collection.getLastKey();\n }\n } while (this.isDisabled(key));\n return key;\n }\n}\n"],"names":[],"version":3,"file":"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.4516+b2c996158",
3
+ "version": "3.8.6-nightly.4528+3ebcc660d",
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.2804+b2c996158",
26
- "@react-aria/i18n": "3.0.0-nightly.2804+b2c996158",
27
- "@react-aria/selection": "3.0.0-nightly.2804+b2c996158",
28
- "@react-aria/utils": "3.0.0-nightly.2804+b2c996158",
29
- "@react-stately/tabs": "3.0.0-nightly.2804+b2c996158",
30
- "@react-types/shared": "3.0.0-nightly.2804+b2c996158",
31
- "@react-types/tabs": "3.3.6-nightly.4516+b2c996158",
25
+ "@react-aria/focus": "3.0.0-nightly.2816+3ebcc660d",
26
+ "@react-aria/i18n": "3.0.0-nightly.2816+3ebcc660d",
27
+ "@react-aria/selection": "3.0.0-nightly.2816+3ebcc660d",
28
+ "@react-aria/utils": "3.0.0-nightly.2816+3ebcc660d",
29
+ "@react-stately/tabs": "3.0.0-nightly.2816+3ebcc660d",
30
+ "@react-types/shared": "3.0.0-nightly.2816+3ebcc660d",
31
+ "@react-types/tabs": "3.3.6-nightly.4528+3ebcc660d",
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": "b2c9961586795542603b899a1e1925cbeee9f34f"
41
+ "gitHead": "3ebcc660dd5abfae62ec9002a938916828ce05aa"
42
42
  }
@@ -10,14 +10,14 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import {Collection, Direction, Key, KeyboardDelegate, Orientation} from '@react-types/shared';
13
+ import {Collection, Direction, Key, KeyboardDelegate, Node, Orientation} from '@react-types/shared';
14
14
 
15
15
  export class TabsKeyboardDelegate<T> implements KeyboardDelegate {
16
- private collection: Collection<T>;
16
+ private collection: Collection<Node<T>>;
17
17
  private flipDirection: boolean;
18
18
  private disabledKeys: Set<Key>;
19
19
 
20
- constructor(collection: Collection<T>, direction: Direction, orientation: Orientation, disabledKeys: Set<Key> = new Set()) {
20
+ constructor(collection: Collection<Node<T>>, direction: Direction, orientation: Orientation, disabledKeys: Set<Key> = new Set()) {
21
21
  this.collection = collection;
22
22
  this.flipDirection = direction === 'rtl' && orientation === 'horizontal';
23
23
  this.disabledKeys = disabledKeys;
@@ -45,9 +45,13 @@ export class TabsKeyboardDelegate<T> implements KeyboardDelegate {
45
45
  return this.getNextKey(key);
46
46
  }
47
47
 
48
+ private isDisabled(key: Key) {
49
+ return this.disabledKeys.has(key) || !!this.collection.getItem(key)?.props?.isDisabled;
50
+ }
51
+
48
52
  getFirstKey() {
49
53
  let key = this.collection.getFirstKey();
50
- if (key != null && this.disabledKeys.has(key)) {
54
+ if (key != null && this.isDisabled(key)) {
51
55
  key = this.getNextKey(key);
52
56
  }
53
57
  return key;
@@ -55,7 +59,7 @@ export class TabsKeyboardDelegate<T> implements KeyboardDelegate {
55
59
 
56
60
  getLastKey() {
57
61
  let key = this.collection.getLastKey();
58
- if (key != null && this.disabledKeys.has(key)) {
62
+ if (key != null && this.isDisabled(key)) {
59
63
  key = this.getPreviousKey(key);
60
64
  }
61
65
  return key;
@@ -67,7 +71,7 @@ export class TabsKeyboardDelegate<T> implements KeyboardDelegate {
67
71
  if (key == null) {
68
72
  key = this.collection.getFirstKey();
69
73
  }
70
- } while (this.disabledKeys.has(key));
74
+ } while (this.isDisabled(key));
71
75
  return key;
72
76
  }
73
77
 
@@ -77,7 +81,7 @@ export class TabsKeyboardDelegate<T> implements KeyboardDelegate {
77
81
  if (key == null) {
78
82
  key = this.collection.getLastKey();
79
83
  }
80
- } while (this.disabledKeys.has(key));
84
+ } while (this.isDisabled(key));
81
85
  return key;
82
86
  }
83
87
  }
package/src/useTab.ts CHANGED
@@ -43,7 +43,7 @@ export function useTab<T>(
43
43
 
44
44
  let isSelected = key === selectedKey;
45
45
 
46
- let isDisabled = propsDisabled || state.isDisabled || state.disabledKeys.has(key);
46
+ let isDisabled = propsDisabled || state.isDisabled || state.selectionManager.isDisabled(key);
47
47
  let {itemProps, isPressed} = useSelectableItem({
48
48
  selectionManager: manager,
49
49
  key,