@react-aria/tabs 3.1.1 → 3.1.3-nightly.3120

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/main.js CHANGED
@@ -1,8 +1,8 @@
1
- var $9kdwR$reactariaselection = require("@react-aria/selection");
2
- var $9kdwR$reactariafocus = require("@react-aria/focus");
3
- var $9kdwR$react = require("react");
4
- var $9kdwR$reactariautils = require("@react-aria/utils");
5
- var $9kdwR$reactariai18n = require("@react-aria/i18n");
1
+ var $1cJu1$reactariaselection = require("@react-aria/selection");
2
+ var $1cJu1$reactariafocus = require("@react-aria/focus");
3
+ var $1cJu1$react = require("react");
4
+ var $1cJu1$reactariautils = require("@react-aria/utils");
5
+ var $1cJu1$reactariai18n = require("@react-aria/i18n");
6
6
 
7
7
  function $parcel$exportWildcard(dest, source) {
8
8
  Object.keys(source).forEach(function(key) {
@@ -23,31 +23,31 @@ function $parcel$exportWildcard(dest, source) {
23
23
  function $parcel$export(e, n, v, s) {
24
24
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
25
25
  }
26
- var $0ff220f72f44a5b1$exports = {};
26
+ var $4eeea1c984cc0628$exports = {};
27
27
 
28
- $parcel$export($0ff220f72f44a5b1$exports, "useTab", () => $0ff220f72f44a5b1$export$fdf4756d5b8ef90a);
29
- const $bd08da35cf93e9d9$export$c5f62239608282b6 = new WeakMap();
30
- function $bd08da35cf93e9d9$export$567fc7097e064344(state, key, role) {
28
+ $parcel$export($4eeea1c984cc0628$exports, "useTab", () => $4eeea1c984cc0628$export$fdf4756d5b8ef90a);
29
+ const $a217ebca77471970$export$c5f62239608282b6 = new WeakMap();
30
+ function $a217ebca77471970$export$567fc7097e064344(state, key, role) {
31
31
  if (typeof key === 'string') key = key.replace(/\s+/g, '');
32
- let baseId = $bd08da35cf93e9d9$export$c5f62239608282b6.get(state);
32
+ let baseId = $a217ebca77471970$export$c5f62239608282b6.get(state);
33
33
  return `${baseId}-${role}-${key}`;
34
34
  }
35
35
 
36
36
 
37
37
 
38
- function $0ff220f72f44a5b1$export$fdf4756d5b8ef90a(props, state, ref) {
38
+ function $4eeea1c984cc0628$export$fdf4756d5b8ef90a(props, state, ref) {
39
39
  let { key: key , isDisabled: propsDisabled } = props;
40
40
  let { selectionManager: manager , selectedKey: selectedKey } = state;
41
41
  let isSelected = key === selectedKey;
42
42
  let isDisabled = propsDisabled || state.disabledKeys.has(key);
43
- let { itemProps: itemProps } = $9kdwR$reactariaselection.useSelectableItem({
43
+ let { itemProps: itemProps } = $1cJu1$reactariaselection.useSelectableItem({
44
44
  selectionManager: manager,
45
45
  key: key,
46
46
  ref: ref,
47
47
  isDisabled: isDisabled
48
48
  });
49
- let tabId = $bd08da35cf93e9d9$export$567fc7097e064344(state, key, 'tab');
50
- let tabPanelId = $bd08da35cf93e9d9$export$567fc7097e064344(state, key, 'tabpanel');
49
+ let tabId = $a217ebca77471970$export$567fc7097e064344(state, key, 'tab');
50
+ let tabPanelId = $a217ebca77471970$export$567fc7097e064344(state, key, 'tabpanel');
51
51
  let { tabIndex: tabIndex } = itemProps;
52
52
  return {
53
53
  tabProps: {
@@ -63,23 +63,23 @@ function $0ff220f72f44a5b1$export$fdf4756d5b8ef90a(props, state, ref) {
63
63
  }
64
64
 
65
65
 
66
- var $dbaecb12ea1e18dc$exports = {};
66
+ var $8db1928b18472a1f$exports = {};
67
67
 
68
- $parcel$export($dbaecb12ea1e18dc$exports, "useTabPanel", () => $dbaecb12ea1e18dc$export$fae0121b5afe572d);
68
+ $parcel$export($8db1928b18472a1f$exports, "useTabPanel", () => $8db1928b18472a1f$export$fae0121b5afe572d);
69
69
 
70
70
 
71
71
 
72
72
 
73
- function $dbaecb12ea1e18dc$export$fae0121b5afe572d(props, state, ref) {
74
- let [tabIndex, setTabIndex] = $9kdwR$react.useState(0);
73
+ function $8db1928b18472a1f$export$fae0121b5afe572d(props, state, ref) {
74
+ let [tabIndex, setTabIndex] = $1cJu1$react.useState(0);
75
75
  // The tabpanel should have tabIndex=0 when there are no tabbable elements within it.
76
76
  // Otherwise, tabbing from the focused tab should go directly to the first tabbable element
77
77
  // within the tabpanel.
78
- $9kdwR$reactariautils.useLayoutEffect(()=>{
79
- if (ref?.current) {
78
+ $1cJu1$reactariautils.useLayoutEffect(()=>{
79
+ if (ref === null || ref === void 0 ? void 0 : ref.current) {
80
80
  let update = ()=>{
81
81
  // Detect if there are any tabbable elements and update the tabIndex accordingly.
82
- let walker = $9kdwR$reactariafocus.getFocusableTreeWalker(ref.current, {
82
+ let walker = $1cJu1$reactariafocus.getFocusableTreeWalker(ref.current, {
83
83
  tabbable: true
84
84
  });
85
85
  setTabIndex(walker.nextNode() ? undefined : 0);
@@ -103,14 +103,14 @@ function $dbaecb12ea1e18dc$export$fae0121b5afe572d(props, state, ref) {
103
103
  }, [
104
104
  ref
105
105
  ]);
106
- const id = $bd08da35cf93e9d9$export$567fc7097e064344(state, state?.selectedKey, 'tabpanel');
107
- const tabPanelProps = $9kdwR$reactariautils.useLabels({
106
+ const id = $a217ebca77471970$export$567fc7097e064344(state, state === null || state === void 0 ? void 0 : state.selectedKey, 'tabpanel');
107
+ const tabPanelProps = $1cJu1$reactariautils.useLabels({
108
108
  ...props,
109
109
  id: id,
110
- 'aria-labelledby': $bd08da35cf93e9d9$export$567fc7097e064344(state, state?.selectedKey, 'tab')
110
+ 'aria-labelledby': $a217ebca77471970$export$567fc7097e064344(state, state === null || state === void 0 ? void 0 : state.selectedKey, 'tab')
111
111
  });
112
112
  return {
113
- tabPanelProps: $9kdwR$reactariautils.mergeProps(tabPanelProps, {
113
+ tabPanelProps: $1cJu1$reactariautils.mergeProps(tabPanelProps, {
114
114
  tabIndex: tabIndex,
115
115
  role: 'tabpanel',
116
116
  'aria-describedby': props['aria-describedby'],
@@ -120,19 +120,13 @@ function $dbaecb12ea1e18dc$export$fae0121b5afe572d(props, state, ref) {
120
120
  }
121
121
 
122
122
 
123
- var $ad9d731057bdaf7b$exports = {};
123
+ var $f2b4a4926440e901$exports = {};
124
124
 
125
- $parcel$export($ad9d731057bdaf7b$exports, "useTabList", () => $ad9d731057bdaf7b$export$773e389e644c5874);
125
+ $parcel$export($f2b4a4926440e901$exports, "useTabList", () => $f2b4a4926440e901$export$773e389e644c5874);
126
126
 
127
127
 
128
128
 
129
- class $3899102b8abfde9c$export$15010ca3c1abe90b {
130
- constructor(collection, direction, orientation, disabledKeys = new Set()){
131
- this.collection = collection;
132
- this.flipDirection = direction === 'rtl' && orientation === 'horizontal';
133
- this.orientation = orientation;
134
- this.disabledKeys = disabledKeys;
135
- }
129
+ class $283e5d8830177ead$export$15010ca3c1abe90b {
136
130
  getKeyLeftOf(key) {
137
131
  if (this.flipDirection) return this.getNextKey(key);
138
132
  else {
@@ -179,23 +173,29 @@ class $3899102b8abfde9c$export$15010ca3c1abe90b {
179
173
  }while (this.disabledKeys.has(key))
180
174
  return key;
181
175
  }
176
+ constructor(collection, direction, orientation, disabledKeys = new Set()){
177
+ this.collection = collection;
178
+ this.flipDirection = direction === 'rtl' && orientation === 'horizontal';
179
+ this.orientation = orientation;
180
+ this.disabledKeys = disabledKeys;
181
+ }
182
182
  }
183
183
 
184
184
 
185
185
 
186
186
 
187
- function $ad9d731057bdaf7b$export$773e389e644c5874(props, state, ref) {
187
+ function $f2b4a4926440e901$export$773e389e644c5874(props, state, ref) {
188
188
  let { orientation: orientation = 'horizontal' , keyboardActivation: keyboardActivation = 'automatic' } = props;
189
189
  let { collection: collection , selectionManager: manager , disabledKeys: disabledKeys } = state;
190
- let { direction: direction } = $9kdwR$reactariai18n.useLocale();
191
- let delegate = $9kdwR$react.useMemo(()=>new $3899102b8abfde9c$export$15010ca3c1abe90b(collection, direction, orientation, disabledKeys)
190
+ let { direction: direction } = $1cJu1$reactariai18n.useLocale();
191
+ let delegate = $1cJu1$react.useMemo(()=>new $283e5d8830177ead$export$15010ca3c1abe90b(collection, direction, orientation, disabledKeys)
192
192
  , [
193
193
  collection,
194
194
  disabledKeys,
195
195
  orientation,
196
196
  direction
197
197
  ]);
198
- let { collectionProps: collectionProps } = $9kdwR$reactariaselection.useSelectableCollection({
198
+ let { collectionProps: collectionProps } = $1cJu1$reactariaselection.useSelectableCollection({
199
199
  ref: ref,
200
200
  selectionManager: manager,
201
201
  keyboardDelegate: delegate,
@@ -204,15 +204,15 @@ function $ad9d731057bdaf7b$export$773e389e644c5874(props, state, ref) {
204
204
  scrollRef: ref
205
205
  });
206
206
  // Compute base id for all tabs
207
- let tabsId = $9kdwR$reactariautils.useId();
208
- $bd08da35cf93e9d9$export$c5f62239608282b6.set(state, tabsId);
209
- let tabListLabelProps = $9kdwR$reactariautils.useLabels({
207
+ let tabsId = $1cJu1$reactariautils.useId();
208
+ $a217ebca77471970$export$c5f62239608282b6.set(state, tabsId);
209
+ let tabListLabelProps = $1cJu1$reactariautils.useLabels({
210
210
  ...props,
211
211
  id: tabsId
212
212
  });
213
213
  return {
214
214
  tabListProps: {
215
- ...$9kdwR$reactariautils.mergeProps(collectionProps, tabListLabelProps),
215
+ ...$1cJu1$reactariautils.mergeProps(collectionProps, tabListLabelProps),
216
216
  role: 'tablist',
217
217
  'aria-orientation': orientation,
218
218
  tabIndex: undefined
@@ -221,9 +221,9 @@ function $ad9d731057bdaf7b$export$773e389e644c5874(props, state, ref) {
221
221
  }
222
222
 
223
223
 
224
- $parcel$exportWildcard(module.exports, $0ff220f72f44a5b1$exports);
225
- $parcel$exportWildcard(module.exports, $dbaecb12ea1e18dc$exports);
226
- $parcel$exportWildcard(module.exports, $ad9d731057bdaf7b$exports);
224
+ $parcel$exportWildcard(module.exports, $4eeea1c984cc0628$exports);
225
+ $parcel$exportWildcard(module.exports, $8db1928b18472a1f$exports);
226
+ $parcel$exportWildcard(module.exports, $f2b4a4926440e901$exports);
227
227
 
228
228
 
229
229
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AEeO,KAAK,C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;YACf,CAAkB,mBAAE,WAAW;YAC/B,QAAQ,EAAE,SAAS;QACrB,CAAC;IACH,CAAC;AACH,CAAC;","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 */\n\nexport * from './useTab';\nexport * from './useTabPanel';\nexport * 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 {generateId} from './utils';\nimport {HTMLAttributes, RefObject} from 'react';\nimport {TabListState} from '@react-stately/tabs';\nimport {useSelectableItem} from '@react-aria/selection';\n\ninterface TabAria {\n /** Props for the tab element. */\n tabProps: HTMLAttributes<HTMLElement>\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<HTMLElement>\n): TabAria {\n let {key, isDisabled: propsDisabled} = props;\n let {selectionManager: manager, selectedKey} = state;\n\n let isSelected = key === selectedKey;\n\n let isDisabled = propsDisabled || state.disabledKeys.has(key);\n let {itemProps} = useSelectableItem({\n selectionManager: manager,\n key,\n ref,\n isDisabled\n });\n\n let tabId = generateId(state, key, 'tab');\n let tabPanelId = generateId(state, key, 'tabpanel');\n let {tabIndex} = itemProps;\n\n return {\n tabProps: {\n ...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 };\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 {generateId} from './utils';\nimport {getFocusableTreeWalker} from '@react-aria/focus';\nimport {HTMLAttributes, RefObject, useState} from 'react';\nimport {mergeProps, useLabels, useLayoutEffect} from '@react-aria/utils';\nimport {TabListState} from '@react-stately/tabs';\n\ninterface TabPanelAria {\n /** Props for the tab panel element. */\n tabPanelProps: HTMLAttributes<HTMLElement>\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<HTMLElement>): TabPanelAria {\n let [tabIndex, setTabIndex] = useState(0);\n\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 useLayoutEffect(() => {\n if (ref?.current) {\n let update = () => {\n // Detect if there are any tabbable elements and update the tabIndex accordingly.\n let walker = getFocusableTreeWalker(ref.current, {tabbable: true});\n setTabIndex(walker.nextNode() ? undefined : 0);\n };\n\n update();\n\n // Update when new elements are inserted, or the tabIndex/disabled attribute updates.\n let observer = new MutationObserver(update);\n observer.observe(ref.current, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: ['tabIndex', 'disabled']\n });\n\n return () => {\n observer.disconnect();\n };\n }\n }, [ref]);\n\n const id = generateId(state, 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 {HTMLAttributes, RefObject, useMemo} from 'react';\nimport {mergeProps, useId, useLabels} from '@react-aria/utils';\nimport {TabListState} from '@react-stately/tabs';\nimport {tabsIds} from './utils';\nimport {TabsKeyboardDelegate} from './TabsKeyboardDelegate';\nimport {useLocale} from '@react-aria/i18n';\nimport {useSelectableCollection} from '@react-aria/selection';\n\ninterface TabListAria {\n /** Props for the tablist container. */\n tabListProps: HTMLAttributes<HTMLElement>\n}\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: AriaTabListProps<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 });\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 private orientation: Orientation;\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.orientation = orientation;\n this.disabledKeys = disabledKeys;\n }\n\n getKeyLeftOf(key: Key) {\n if (this.flipDirection) {\n return this.getNextKey(key);\n } else {\n if (this.orientation === 'horizontal') {\n return this.getPreviousKey(key);\n }\n return null;\n }\n }\n\n getKeyRightOf(key: Key) {\n if (this.flipDirection) {\n return this.getPreviousKey(key);\n } else {\n if (this.orientation === 'horizontal') {\n return this.getNextKey(key);\n }\n return null;\n }\n }\n\n getKeyAbove(key: Key) {\n if (this.orientation === 'vertical') {\n return this.getPreviousKey(key);\n }\n return null;\n }\n\n getKeyBelow(key: Key) {\n if (this.orientation === 'vertical') {\n return this.getNextKey(key);\n }\n return null;\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":"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6BAA+B;IAC/B,GAAG,CAAC,MAAM,GAAG,2BAAK;IAClB,yCAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM;IAEzB,GAAG,CAAC,iBAAiB,GAAG,+BAAS,CAAC,CAAC;WAAG,KAAK;QAAE,EAAE,EAAE,MAAM;IAAA,CAAC;IAExD,MAAM,CAAC,CAAC;QACN,YAAY,EAAE,CAAC;eACV,gCAAU,CAAC,eAAe,EAAE,iBAAiB;YAChD,IAAI,EAAE,CAAS;YACf,CAAkB,mBAAE,WAAW;YAC/B,QAAQ,EAAE,SAAS;QACrB,CAAC;IACH,CAAC;AACH,CAAC;","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 */\n\nexport * from './useTab';\nexport * from './useTabPanel';\nexport * 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 {generateId} from './utils';\nimport {HTMLAttributes, RefObject} from 'react';\nimport {TabListState} from '@react-stately/tabs';\nimport {useSelectableItem} from '@react-aria/selection';\n\ninterface TabAria {\n /** Props for the tab element. */\n tabProps: HTMLAttributes<HTMLElement>\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<HTMLElement>\n): TabAria {\n let {key, isDisabled: propsDisabled} = props;\n let {selectionManager: manager, selectedKey} = state;\n\n let isSelected = key === selectedKey;\n\n let isDisabled = propsDisabled || state.disabledKeys.has(key);\n let {itemProps} = useSelectableItem({\n selectionManager: manager,\n key,\n ref,\n isDisabled\n });\n\n let tabId = generateId(state, key, 'tab');\n let tabPanelId = generateId(state, key, 'tabpanel');\n let {tabIndex} = itemProps;\n\n return {\n tabProps: {\n ...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 };\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 {generateId} from './utils';\nimport {getFocusableTreeWalker} from '@react-aria/focus';\nimport {HTMLAttributes, RefObject, useState} from 'react';\nimport {mergeProps, useLabels, useLayoutEffect} from '@react-aria/utils';\nimport {TabListState} from '@react-stately/tabs';\n\ninterface TabPanelAria {\n /** Props for the tab panel element. */\n tabPanelProps: HTMLAttributes<HTMLElement>\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<HTMLElement>): TabPanelAria {\n let [tabIndex, setTabIndex] = useState(0);\n\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 useLayoutEffect(() => {\n if (ref?.current) {\n let update = () => {\n // Detect if there are any tabbable elements and update the tabIndex accordingly.\n let walker = getFocusableTreeWalker(ref.current, {tabbable: true});\n setTabIndex(walker.nextNode() ? undefined : 0);\n };\n\n update();\n\n // Update when new elements are inserted, or the tabIndex/disabled attribute updates.\n let observer = new MutationObserver(update);\n observer.observe(ref.current, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: ['tabIndex', 'disabled']\n });\n\n return () => {\n observer.disconnect();\n };\n }\n }, [ref]);\n\n const id = generateId(state, 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 {HTMLAttributes, RefObject, useMemo} from 'react';\nimport {mergeProps, useId, useLabels} from '@react-aria/utils';\nimport {TabListState} from '@react-stately/tabs';\nimport {tabsIds} from './utils';\nimport {TabsKeyboardDelegate} from './TabsKeyboardDelegate';\nimport {useLocale} from '@react-aria/i18n';\nimport {useSelectableCollection} from '@react-aria/selection';\n\ninterface TabListAria {\n /** Props for the tablist container. */\n tabListProps: HTMLAttributes<HTMLElement>\n}\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: AriaTabListProps<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 });\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 private orientation: Orientation;\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.orientation = orientation;\n this.disabledKeys = disabledKeys;\n }\n\n getKeyLeftOf(key: Key) {\n if (this.flipDirection) {\n return this.getNextKey(key);\n } else {\n if (this.orientation === 'horizontal') {\n return this.getPreviousKey(key);\n }\n return null;\n }\n }\n\n getKeyRightOf(key: Key) {\n if (this.flipDirection) {\n return this.getPreviousKey(key);\n } else {\n if (this.orientation === 'horizontal') {\n return this.getNextKey(key);\n }\n return null;\n }\n }\n\n getKeyAbove(key: Key) {\n if (this.orientation === 'vertical') {\n return this.getPreviousKey(key);\n }\n return null;\n }\n\n getKeyBelow(key: Key) {\n if (this.orientation === 'vertical') {\n return this.getNextKey(key);\n }\n return null;\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
@@ -1,37 +1,37 @@
1
- import {useSelectableItem as $2w1zq$useSelectableItem, useSelectableCollection as $2w1zq$useSelectableCollection} from "@react-aria/selection";
2
- import {getFocusableTreeWalker as $2w1zq$getFocusableTreeWalker} from "@react-aria/focus";
3
- import {useState as $2w1zq$useState, useMemo as $2w1zq$useMemo} from "react";
4
- import {useLayoutEffect as $2w1zq$useLayoutEffect, useLabels as $2w1zq$useLabels, mergeProps as $2w1zq$mergeProps, useId as $2w1zq$useId} from "@react-aria/utils";
5
- import {useLocale as $2w1zq$useLocale} from "@react-aria/i18n";
1
+ import {useSelectableItem as $8kq0t$useSelectableItem, useSelectableCollection as $8kq0t$useSelectableCollection} from "@react-aria/selection";
2
+ import {getFocusableTreeWalker as $8kq0t$getFocusableTreeWalker} from "@react-aria/focus";
3
+ import {useState as $8kq0t$useState, useMemo as $8kq0t$useMemo} from "react";
4
+ import {useLayoutEffect as $8kq0t$useLayoutEffect, useLabels as $8kq0t$useLabels, mergeProps as $8kq0t$mergeProps, useId as $8kq0t$useId} from "@react-aria/utils";
5
+ import {useLocale as $8kq0t$useLocale} from "@react-aria/i18n";
6
6
 
7
7
  function $parcel$export(e, n, v, s) {
8
8
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
9
9
  }
10
- var $3fe344f807ac4c8e$exports = {};
10
+ var $0175d55c2a017ebc$exports = {};
11
11
 
12
- $parcel$export($3fe344f807ac4c8e$exports, "useTab", () => $3fe344f807ac4c8e$export$fdf4756d5b8ef90a);
13
- const $f3c5d9bf2bc7f8de$export$c5f62239608282b6 = new WeakMap();
14
- function $f3c5d9bf2bc7f8de$export$567fc7097e064344(state, key, role) {
12
+ $parcel$export($0175d55c2a017ebc$exports, "useTab", () => $0175d55c2a017ebc$export$fdf4756d5b8ef90a);
13
+ const $99b62ae3ff97ec45$export$c5f62239608282b6 = new WeakMap();
14
+ function $99b62ae3ff97ec45$export$567fc7097e064344(state, key, role) {
15
15
  if (typeof key === 'string') key = key.replace(/\s+/g, '');
16
- let baseId = $f3c5d9bf2bc7f8de$export$c5f62239608282b6.get(state);
16
+ let baseId = $99b62ae3ff97ec45$export$c5f62239608282b6.get(state);
17
17
  return `${baseId}-${role}-${key}`;
18
18
  }
19
19
 
20
20
 
21
21
 
22
- function $3fe344f807ac4c8e$export$fdf4756d5b8ef90a(props, state, ref) {
22
+ function $0175d55c2a017ebc$export$fdf4756d5b8ef90a(props, state, ref) {
23
23
  let { key: key , isDisabled: propsDisabled } = props;
24
24
  let { selectionManager: manager , selectedKey: selectedKey } = state;
25
25
  let isSelected = key === selectedKey;
26
26
  let isDisabled = propsDisabled || state.disabledKeys.has(key);
27
- let { itemProps: itemProps } = $2w1zq$useSelectableItem({
27
+ let { itemProps: itemProps } = $8kq0t$useSelectableItem({
28
28
  selectionManager: manager,
29
29
  key: key,
30
30
  ref: ref,
31
31
  isDisabled: isDisabled
32
32
  });
33
- let tabId = $f3c5d9bf2bc7f8de$export$567fc7097e064344(state, key, 'tab');
34
- let tabPanelId = $f3c5d9bf2bc7f8de$export$567fc7097e064344(state, key, 'tabpanel');
33
+ let tabId = $99b62ae3ff97ec45$export$567fc7097e064344(state, key, 'tab');
34
+ let tabPanelId = $99b62ae3ff97ec45$export$567fc7097e064344(state, key, 'tabpanel');
35
35
  let { tabIndex: tabIndex } = itemProps;
36
36
  return {
37
37
  tabProps: {
@@ -47,23 +47,23 @@ function $3fe344f807ac4c8e$export$fdf4756d5b8ef90a(props, state, ref) {
47
47
  }
48
48
 
49
49
 
50
- var $75f26214f08824e6$exports = {};
50
+ var $34bce698202e07cb$exports = {};
51
51
 
52
- $parcel$export($75f26214f08824e6$exports, "useTabPanel", () => $75f26214f08824e6$export$fae0121b5afe572d);
52
+ $parcel$export($34bce698202e07cb$exports, "useTabPanel", () => $34bce698202e07cb$export$fae0121b5afe572d);
53
53
 
54
54
 
55
55
 
56
56
 
57
- function $75f26214f08824e6$export$fae0121b5afe572d(props, state, ref) {
58
- let [tabIndex, setTabIndex] = $2w1zq$useState(0);
57
+ function $34bce698202e07cb$export$fae0121b5afe572d(props, state, ref) {
58
+ let [tabIndex, setTabIndex] = $8kq0t$useState(0);
59
59
  // The tabpanel should have tabIndex=0 when there are no tabbable elements within it.
60
60
  // Otherwise, tabbing from the focused tab should go directly to the first tabbable element
61
61
  // within the tabpanel.
62
- $2w1zq$useLayoutEffect(()=>{
63
- if (ref?.current) {
62
+ $8kq0t$useLayoutEffect(()=>{
63
+ if (ref === null || ref === void 0 ? void 0 : ref.current) {
64
64
  let update = ()=>{
65
65
  // Detect if there are any tabbable elements and update the tabIndex accordingly.
66
- let walker = $2w1zq$getFocusableTreeWalker(ref.current, {
66
+ let walker = $8kq0t$getFocusableTreeWalker(ref.current, {
67
67
  tabbable: true
68
68
  });
69
69
  setTabIndex(walker.nextNode() ? undefined : 0);
@@ -87,14 +87,14 @@ function $75f26214f08824e6$export$fae0121b5afe572d(props, state, ref) {
87
87
  }, [
88
88
  ref
89
89
  ]);
90
- const id = $f3c5d9bf2bc7f8de$export$567fc7097e064344(state, state?.selectedKey, 'tabpanel');
91
- const tabPanelProps = $2w1zq$useLabels({
90
+ const id = $99b62ae3ff97ec45$export$567fc7097e064344(state, state === null || state === void 0 ? void 0 : state.selectedKey, 'tabpanel');
91
+ const tabPanelProps = $8kq0t$useLabels({
92
92
  ...props,
93
93
  id: id,
94
- 'aria-labelledby': $f3c5d9bf2bc7f8de$export$567fc7097e064344(state, state?.selectedKey, 'tab')
94
+ 'aria-labelledby': $99b62ae3ff97ec45$export$567fc7097e064344(state, state === null || state === void 0 ? void 0 : state.selectedKey, 'tab')
95
95
  });
96
96
  return {
97
- tabPanelProps: $2w1zq$mergeProps(tabPanelProps, {
97
+ tabPanelProps: $8kq0t$mergeProps(tabPanelProps, {
98
98
  tabIndex: tabIndex,
99
99
  role: 'tabpanel',
100
100
  'aria-describedby': props['aria-describedby'],
@@ -104,19 +104,13 @@ function $75f26214f08824e6$export$fae0121b5afe572d(props, state, ref) {
104
104
  }
105
105
 
106
106
 
107
- var $f988a1e9c0dca53a$exports = {};
107
+ var $58d314389b21fa3f$exports = {};
108
108
 
109
- $parcel$export($f988a1e9c0dca53a$exports, "useTabList", () => $f988a1e9c0dca53a$export$773e389e644c5874);
109
+ $parcel$export($58d314389b21fa3f$exports, "useTabList", () => $58d314389b21fa3f$export$773e389e644c5874);
110
110
 
111
111
 
112
112
 
113
- class $be8ed410c7020442$export$15010ca3c1abe90b {
114
- constructor(collection, direction, orientation, disabledKeys = new Set()){
115
- this.collection = collection;
116
- this.flipDirection = direction === 'rtl' && orientation === 'horizontal';
117
- this.orientation = orientation;
118
- this.disabledKeys = disabledKeys;
119
- }
113
+ class $bfc6f2d60b8a4c40$export$15010ca3c1abe90b {
120
114
  getKeyLeftOf(key) {
121
115
  if (this.flipDirection) return this.getNextKey(key);
122
116
  else {
@@ -163,23 +157,29 @@ class $be8ed410c7020442$export$15010ca3c1abe90b {
163
157
  }while (this.disabledKeys.has(key))
164
158
  return key;
165
159
  }
160
+ constructor(collection, direction, orientation, disabledKeys = new Set()){
161
+ this.collection = collection;
162
+ this.flipDirection = direction === 'rtl' && orientation === 'horizontal';
163
+ this.orientation = orientation;
164
+ this.disabledKeys = disabledKeys;
165
+ }
166
166
  }
167
167
 
168
168
 
169
169
 
170
170
 
171
- function $f988a1e9c0dca53a$export$773e389e644c5874(props, state, ref) {
171
+ function $58d314389b21fa3f$export$773e389e644c5874(props, state, ref) {
172
172
  let { orientation: orientation = 'horizontal' , keyboardActivation: keyboardActivation = 'automatic' } = props;
173
173
  let { collection: collection , selectionManager: manager , disabledKeys: disabledKeys } = state;
174
- let { direction: direction } = $2w1zq$useLocale();
175
- let delegate = $2w1zq$useMemo(()=>new $be8ed410c7020442$export$15010ca3c1abe90b(collection, direction, orientation, disabledKeys)
174
+ let { direction: direction } = $8kq0t$useLocale();
175
+ let delegate = $8kq0t$useMemo(()=>new $bfc6f2d60b8a4c40$export$15010ca3c1abe90b(collection, direction, orientation, disabledKeys)
176
176
  , [
177
177
  collection,
178
178
  disabledKeys,
179
179
  orientation,
180
180
  direction
181
181
  ]);
182
- let { collectionProps: collectionProps } = $2w1zq$useSelectableCollection({
182
+ let { collectionProps: collectionProps } = $8kq0t$useSelectableCollection({
183
183
  ref: ref,
184
184
  selectionManager: manager,
185
185
  keyboardDelegate: delegate,
@@ -188,15 +188,15 @@ function $f988a1e9c0dca53a$export$773e389e644c5874(props, state, ref) {
188
188
  scrollRef: ref
189
189
  });
190
190
  // Compute base id for all tabs
191
- let tabsId = $2w1zq$useId();
192
- $f3c5d9bf2bc7f8de$export$c5f62239608282b6.set(state, tabsId);
193
- let tabListLabelProps = $2w1zq$useLabels({
191
+ let tabsId = $8kq0t$useId();
192
+ $99b62ae3ff97ec45$export$c5f62239608282b6.set(state, tabsId);
193
+ let tabListLabelProps = $8kq0t$useLabels({
194
194
  ...props,
195
195
  id: tabsId
196
196
  });
197
197
  return {
198
198
  tabListProps: {
199
- ...$2w1zq$mergeProps(collectionProps, tabListLabelProps),
199
+ ...$8kq0t$mergeProps(collectionProps, tabListLabelProps),
200
200
  role: 'tablist',
201
201
  'aria-orientation': orientation,
202
202
  tabIndex: undefined
@@ -207,5 +207,5 @@ function $f988a1e9c0dca53a$export$773e389e644c5874(props, state, ref) {
207
207
 
208
208
 
209
209
 
210
- export {$3fe344f807ac4c8e$export$fdf4756d5b8ef90a as useTab, $75f26214f08824e6$export$fae0121b5afe572d as useTabPanel, $f988a1e9c0dca53a$export$773e389e644c5874 as useTabList};
210
+ export {$0175d55c2a017ebc$export$fdf4756d5b8ef90a as useTab, $34bce698202e07cb$export$fae0121b5afe572d as useTabPanel, $58d314389b21fa3f$export$773e389e644c5874 as useTabList};
211
211
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;AEeO,KAAK,CAAC,yCAAO,GAAG,GAAG,CAAC,OAAO;SAElB,yCAAU,CAAI,KAAsB,EAAE,GAAQ,EAAE,IAAY,EAAE,CAAC;IAC7E,EAAE,EAAE,MAAM,CAAC,GAAG,KAAK,CAAQ,SACzB,GAAG,GAAG,GAAG,CAAC,OAAO,SAAS,CAAE;IAG9B,GAAG,CAAC,MAAM,GAAG,yCAAO,CAAC,GAAG,CAAC,KAAK;IAC9B,MAAM,IAAI,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,GAAG;AACjC,CAAC;;;;SDGe,yCAAM,CACpB,KAAmB,EACnB,KAAsB,EACtB,GAA2B,EAClB,CAAC;IACV,GAAG,CAAC,CAAC,MAAA,GAAG,GAAE,UAAU,EAAE,aAAa,EAAA,CAAC,GAAG,KAAK;IAC5C,GAAG,CAAC,CAAC,CAAA,gBAAgB,EAAE,OAAO,gBAAE,WAAW,EAAA,CAAC,GAAG,KAAK;IAEpD,GAAG,CAAC,UAAU,GAAG,GAAG,KAAK,WAAW;IAEpC,GAAG,CAAC,UAAU,GAAG,aAAa,IAAI,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG;IAC5D,GAAG,CAAC,CAAC,YAAA,SAAS,EAAA,CAAC,GAAG,wBAAiB,CAAC,CAAC;QACnC,gBAAgB,EAAE,OAAO;aACzB,GAAG;aACH,GAAG;oBACH,UAAU;IACZ,CAAC;IAED,GAAG,CAAC,KAAK,GAAG,yCAAU,CAAC,KAAK,EAAE,GAAG,EAAE,CAAK;IACxC,GAAG,CAAC,UAAU,GAAG,yCAAU,CAAC,KAAK,EAAE,GAAG,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K,EAAE,MAAM;IAEzB,GAAG,CAAC,iBAAiB,GAAG,gBAAS,CAAC,CAAC;WAAG,KAAK;QAAE,EAAE,EAAE,MAAM;IAAA,CAAC;IAExD,MAAM,CAAC,CAAC;QACN,YAAY,EAAE,CAAC;eACV,iBAAU,CAAC,eAAe,EAAE,iBAAiB;YAChD,IAAI,EAAE,CAAS;YACf,CAAkB,mBAAE,WAAW;YAC/B,QAAQ,EAAE,SAAS;QACrB,CAAC;IACH,CAAC;AACH,CAAC;","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 */\n\nexport * from './useTab';\nexport * from './useTabPanel';\nexport * 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 {generateId} from './utils';\nimport {HTMLAttributes, RefObject} from 'react';\nimport {TabListState} from '@react-stately/tabs';\nimport {useSelectableItem} from '@react-aria/selection';\n\ninterface TabAria {\n /** Props for the tab element. */\n tabProps: HTMLAttributes<HTMLElement>\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<HTMLElement>\n): TabAria {\n let {key, isDisabled: propsDisabled} = props;\n let {selectionManager: manager, selectedKey} = state;\n\n let isSelected = key === selectedKey;\n\n let isDisabled = propsDisabled || state.disabledKeys.has(key);\n let {itemProps} = useSelectableItem({\n selectionManager: manager,\n key,\n ref,\n isDisabled\n });\n\n let tabId = generateId(state, key, 'tab');\n let tabPanelId = generateId(state, key, 'tabpanel');\n let {tabIndex} = itemProps;\n\n return {\n tabProps: {\n ...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 };\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 {generateId} from './utils';\nimport {getFocusableTreeWalker} from '@react-aria/focus';\nimport {HTMLAttributes, RefObject, useState} from 'react';\nimport {mergeProps, useLabels, useLayoutEffect} from '@react-aria/utils';\nimport {TabListState} from '@react-stately/tabs';\n\ninterface TabPanelAria {\n /** Props for the tab panel element. */\n tabPanelProps: HTMLAttributes<HTMLElement>\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<HTMLElement>): TabPanelAria {\n let [tabIndex, setTabIndex] = useState(0);\n\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 useLayoutEffect(() => {\n if (ref?.current) {\n let update = () => {\n // Detect if there are any tabbable elements and update the tabIndex accordingly.\n let walker = getFocusableTreeWalker(ref.current, {tabbable: true});\n setTabIndex(walker.nextNode() ? undefined : 0);\n };\n\n update();\n\n // Update when new elements are inserted, or the tabIndex/disabled attribute updates.\n let observer = new MutationObserver(update);\n observer.observe(ref.current, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: ['tabIndex', 'disabled']\n });\n\n return () => {\n observer.disconnect();\n };\n }\n }, [ref]);\n\n const id = generateId(state, 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 {HTMLAttributes, RefObject, useMemo} from 'react';\nimport {mergeProps, useId, useLabels} from '@react-aria/utils';\nimport {TabListState} from '@react-stately/tabs';\nimport {tabsIds} from './utils';\nimport {TabsKeyboardDelegate} from './TabsKeyboardDelegate';\nimport {useLocale} from '@react-aria/i18n';\nimport {useSelectableCollection} from '@react-aria/selection';\n\ninterface TabListAria {\n /** Props for the tablist container. */\n tabListProps: HTMLAttributes<HTMLElement>\n}\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: AriaTabListProps<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 });\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 private orientation: Orientation;\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.orientation = orientation;\n this.disabledKeys = disabledKeys;\n }\n\n getKeyLeftOf(key: Key) {\n if (this.flipDirection) {\n return this.getNextKey(key);\n } else {\n if (this.orientation === 'horizontal') {\n return this.getPreviousKey(key);\n }\n return null;\n }\n }\n\n getKeyRightOf(key: Key) {\n if (this.flipDirection) {\n return this.getPreviousKey(key);\n } else {\n if (this.orientation === 'horizontal') {\n return this.getNextKey(key);\n }\n return null;\n }\n }\n\n getKeyAbove(key: Key) {\n if (this.orientation === 'vertical') {\n return this.getPreviousKey(key);\n }\n return null;\n }\n\n getKeyBelow(key: Key) {\n if (this.orientation === 'vertical') {\n return this.getNextKey(key);\n }\n return null;\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":";;;;;;;;;;;;AEeO,KAAK,CAAC,yCAAO,GAAG,GAAG,CAAC,OAAO;SAElB,yCAAU,CAAI,KAAsB,EAAE,GAAQ,EAAE,IAAY,EAAE,CAAC;IAC7E,EAAE,EAAE,MAAM,CAAC,GAAG,KAAK,CAAQ,SACzB,GAAG,GAAG,GAAG,CAAC,OAAO,SAAS,CAAE;IAG9B,GAAG,CAAC,MAAM,GAAG,yCAAO,CAAC,GAAG,CAAC,KAAK;IAC9B,MAAM,IAAI,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,GAAG;AACjC,CAAC;;;;SDGe,yCAAM,CACpB,KAAmB,EACnB,KAAsB,EACtB,GAA2B,EAClB,CAAC;IACV,GAAG,CAAC,CAAC,MAAA,GAAG,GAAE,UAAU,EAAE,aAAa,EAAA,CAAC,GAAG,KAAK;IAC5C,GAAG,CAAC,CAAC,CAAA,gBAAgB,EAAE,OAAO,gBAAE,WAAW,EAAA,CAAC,GAAG,KAAK;IAEpD,GAAG,CAAC,UAAU,GAAG,GAAG,KAAK,WAAW;IAEpC,GAAG,CAAC,UAAU,GAAG,aAAa,IAAI,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG;IAC5D,GAAG,CAAC,CAAC,YAAA,SAAS,EAAA,CAAC,GAAG,wBAAiB,CAAC,CAAC;QACnC,gBAAgB,EAAE,OAAO;aACzB,GAAG;aACH,GAAG;oBACH,UAAU;IACZ,CAAC;IAED,GAAG,CAAC,KAAK,GAAG,yCAAU,CAAC,KAAK,EAAE,GAAG,EAAE,CAAK;IACxC,GAAG,CAA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,CAAC,CAAC;aAC/C,GAAG;QACH,gBAAgB,EAAE,OAAO;QACzB,gBAAgB,EAAE,QAAQ;QAC1B,aAAa,EAAE,kBAAkB,KAAK,CAAW;QACjD,sBAAsB,EAAE,IAAI;QAC5B,SAAS,EAAE,GAAG;IAChB,CAAC;IAED,EAA+B,AAA/B,6BAA+B;IAC/B,GAAG,CAAC,MAAM,GAAG,YAAK;IAClB,yCAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM;IAEzB,GAAG,CAAC,iBAAiB,GAAG,gBAAS,CAAC,CAAC;WAAG,KAAK;QAAE,EAAE,EAAE,MAAM;IAAA,CAAC;IAExD,MAAM,CAAC,CAAC;QACN,YAAY,EAAE,CAAC;eACV,iBAAU,CAAC,eAAe,EAAE,iBAAiB;YAChD,IAAI,EAAE,CAAS;YACf,CAAkB,mBAAE,WAAW;YAC/B,QAAQ,EAAE,SAAS;QACrB,CAAC;IACH,CAAC;AACH,CAAC;","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 */\n\nexport * from './useTab';\nexport * from './useTabPanel';\nexport * 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 {generateId} from './utils';\nimport {HTMLAttributes, RefObject} from 'react';\nimport {TabListState} from '@react-stately/tabs';\nimport {useSelectableItem} from '@react-aria/selection';\n\ninterface TabAria {\n /** Props for the tab element. */\n tabProps: HTMLAttributes<HTMLElement>\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<HTMLElement>\n): TabAria {\n let {key, isDisabled: propsDisabled} = props;\n let {selectionManager: manager, selectedKey} = state;\n\n let isSelected = key === selectedKey;\n\n let isDisabled = propsDisabled || state.disabledKeys.has(key);\n let {itemProps} = useSelectableItem({\n selectionManager: manager,\n key,\n ref,\n isDisabled\n });\n\n let tabId = generateId(state, key, 'tab');\n let tabPanelId = generateId(state, key, 'tabpanel');\n let {tabIndex} = itemProps;\n\n return {\n tabProps: {\n ...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 };\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 {generateId} from './utils';\nimport {getFocusableTreeWalker} from '@react-aria/focus';\nimport {HTMLAttributes, RefObject, useState} from 'react';\nimport {mergeProps, useLabels, useLayoutEffect} from '@react-aria/utils';\nimport {TabListState} from '@react-stately/tabs';\n\ninterface TabPanelAria {\n /** Props for the tab panel element. */\n tabPanelProps: HTMLAttributes<HTMLElement>\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<HTMLElement>): TabPanelAria {\n let [tabIndex, setTabIndex] = useState(0);\n\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 useLayoutEffect(() => {\n if (ref?.current) {\n let update = () => {\n // Detect if there are any tabbable elements and update the tabIndex accordingly.\n let walker = getFocusableTreeWalker(ref.current, {tabbable: true});\n setTabIndex(walker.nextNode() ? undefined : 0);\n };\n\n update();\n\n // Update when new elements are inserted, or the tabIndex/disabled attribute updates.\n let observer = new MutationObserver(update);\n observer.observe(ref.current, {\n subtree: true,\n childList: true,\n attributes: true,\n attributeFilter: ['tabIndex', 'disabled']\n });\n\n return () => {\n observer.disconnect();\n };\n }\n }, [ref]);\n\n const id = generateId(state, 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 {HTMLAttributes, RefObject, useMemo} from 'react';\nimport {mergeProps, useId, useLabels} from '@react-aria/utils';\nimport {TabListState} from '@react-stately/tabs';\nimport {tabsIds} from './utils';\nimport {TabsKeyboardDelegate} from './TabsKeyboardDelegate';\nimport {useLocale} from '@react-aria/i18n';\nimport {useSelectableCollection} from '@react-aria/selection';\n\ninterface TabListAria {\n /** Props for the tablist container. */\n tabListProps: HTMLAttributes<HTMLElement>\n}\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: AriaTabListProps<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 });\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 private orientation: Orientation;\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.orientation = orientation;\n this.disabledKeys = disabledKeys;\n }\n\n getKeyLeftOf(key: Key) {\n if (this.flipDirection) {\n return this.getNextKey(key);\n } else {\n if (this.orientation === 'horizontal') {\n return this.getPreviousKey(key);\n }\n return null;\n }\n }\n\n getKeyRightOf(key: Key) {\n if (this.flipDirection) {\n return this.getPreviousKey(key);\n } else {\n if (this.orientation === 'horizontal') {\n return this.getNextKey(key);\n }\n return null;\n }\n }\n\n getKeyAbove(key: Key) {\n if (this.orientation === 'vertical') {\n return this.getPreviousKey(key);\n }\n return null;\n }\n\n getKeyBelow(key: Key) {\n if (this.orientation === 'vertical') {\n return this.getNextKey(key);\n }\n return null;\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.1.1",
3
+ "version": "3.1.3-nightly.3120+1aa66e6e7",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -18,15 +18,15 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@babel/runtime": "^7.6.2",
21
- "@react-aria/focus": "^3.5.1",
22
- "@react-aria/i18n": "^3.3.5",
23
- "@react-aria/interactions": "^3.8.0",
24
- "@react-aria/selection": "^3.7.2",
25
- "@react-aria/utils": "^3.11.1",
26
- "@react-stately/list": "^3.4.2",
27
- "@react-stately/tabs": "^3.0.2",
28
- "@react-types/shared": "^3.11.0",
29
- "@react-types/tabs": "^3.0.2"
21
+ "@react-aria/focus": "3.0.0-nightly.1424+1aa66e6e7",
22
+ "@react-aria/i18n": "3.0.0-nightly.1424+1aa66e6e7",
23
+ "@react-aria/interactions": "3.0.0-nightly.1424+1aa66e6e7",
24
+ "@react-aria/selection": "3.0.0-nightly.1424+1aa66e6e7",
25
+ "@react-aria/utils": "3.0.0-nightly.1424+1aa66e6e7",
26
+ "@react-stately/list": "3.4.4-nightly.3120+1aa66e6e7",
27
+ "@react-stately/tabs": "3.0.0-nightly.1424+1aa66e6e7",
28
+ "@react-types/shared": "3.0.0-nightly.1424+1aa66e6e7",
29
+ "@react-types/tabs": "3.0.4-nightly.3120+1aa66e6e7"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": "^16.8.0 || ^17.0.0-rc.1"
@@ -34,5 +34,5 @@
34
34
  "publishConfig": {
35
35
  "access": "public"
36
36
  },
37
- "gitHead": "54c2366c4f31bd4bf619126131cd583c12972acc"
37
+ "gitHead": "1aa66e6e75e2da014f44177686c3332cd625fb9f"
38
38
  }