{"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAuBM,SAAS,0CACd,KAAwB,EACxB,KAA6B,EAC7B,GAA8B;IAE9B,qFAAqF;IACrF,2FAA2F;IAC3F,uBAAuB;IACvB,IAAI,WAAW,CAAA,GAAA,6CAAkB,EAAE,OAAO,YAAY;IAEtD,MAAM,KAAK,CAAA,GAAA,oCAAS,EAAE,OAAO,MAAM,EAAE,IAAI,OAAO,aAAa;IAC7D,MAAM,gBAAgB,CAAA,GAAA,mCAAQ,EAAE;QAC9B,GAAG,KAAK;YACR;QACA,mBAAmB,CAAA,GAAA,oCAAS,EAAE,OAAO,OAAO,aAAa;IAC3D;IAEA,OAAO;QACL,eAAe,CAAA,GAAA,oCAAS,EAAE,eAAe;sBACvC;YACA,MAAM;YACN,oBAAoB,KAAK,CAAC,mBAAmB;YAC7C,gBAAgB,KAAK,CAAC,eAAe;QACvC;IACF;AACF","sources":["packages/react-aria/src/tabs/useTabPanel.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMAttributes, DOMProps, Key, RefObject} from '@react-types/shared';\nimport {generateId} from './utils';\nimport {mergeProps} from '../utils/mergeProps';\nimport {TabListState} from 'react-stately/useTabListState';\nimport {useHasTabbableChild} from '../focus/useHasTabbableChild';\nimport {useLabels} from '../utils/useLabels';\n\nexport interface AriaTabPanelProps extends Omit<DOMProps, 'id'>, AriaLabelingProps {\n  /** The unique id of the tab. */\n  id?: Key;\n}\n\nexport interface TabPanelAria {\n  /** Props for the tab panel element. */\n  tabPanelProps: DOMAttributes;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a tab panel. A tab panel is a\n * container for the contents of a tab, and is shown when the tab is selected.\n */\nexport function useTabPanel<T>(\n  props: AriaTabPanelProps,\n  state: TabListState<T> | null,\n  ref: RefObject<Element | null>\n): 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({\n    ...props,\n    id,\n    'aria-labelledby': generateId(state, state?.selectedKey, 'tab')\n  });\n\n  return {\n    tabPanelProps: mergeProps(tabPanelProps, {\n      tabIndex,\n      role: 'tabpanel',\n      'aria-describedby': props['aria-describedby'],\n      'aria-details': props['aria-details']\n    })\n  };\n}\n"],"names":[],"version":3,"file":"useTabPanel.cjs.map"}