{"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAyBM,SAAS,yCAAkB,KAA6B;IAC7D,IAAI,YAAC,QAAQ,cAAE,UAAU,oBAAE,gBAAgB,eAAE,WAAW,QAAE,IAAI,EAAC,GAAG;IAClE,IAAI,gBAAC,YAAY,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,4CAAgB,EAAE;QACjD,SAAS,KAAK,QAAQ;QACtB,cAAc,IAAI,CAAC,aAAa;IAClC;IAEA,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAyB;IAC9C,CAAA,GAAA,uEAAiB,EAAE;QACjB,YAAY;qBACZ;QACA,KAAK;IACP;IAEA,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,sCAAQ;IAC1B,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,wCAAa;IAEtC,qBACE,0DAAC,CAAA,GAAA,qBAAO,SACL,kCACC,0DAAC;QACC,MAAK;QACL,KAAK;QACL,OAAO,CAAA,GAAA,mEAAgB,EAAE,kBAAkB;OAC1C,KAAK,GAAG,KAAK,MAAM,UAAU,CAAC,WAAW,oBACxC,0DAAC;QAAI,MAAK;QAAe,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAExD,KAAK,QAAQ,kBACZ,0DAAC;QAAK,GAAG,YAAY;QAAE,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OAClD,KAAK,QAAQ,kBAKtB,0DAAC;QACE,GAAG,UAAU;QACd,OAAO,CAAA,GAAA,mEAAgB,EAAE,YAAY;QACrC,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OAC7B;AAIT","sources":["packages/@adobe/react-spectrum/src/listbox/ListBoxSection.tsx"],"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 {classNames} from '../utils/classNames';\n\nimport {LayoutInfo} from 'react-stately/useVirtualizerState';\nimport {layoutInfoToStyle} from 'react-aria/private/virtualizer/VirtualizerItem';\nimport {ListBoxContext} from './ListBoxContext';\nimport {Node} from '@react-types/shared';\nimport React, {Fragment, JSX, ReactNode, useContext, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {useListBoxSection} from 'react-aria/useListBox';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {\n  useVirtualizerItem,\n  VirtualizerItemOptions\n} from 'react-aria/private/virtualizer/useVirtualizerItem';\n\ninterface ListBoxSectionProps<T> extends Omit<VirtualizerItemOptions, 'ref' | 'layoutInfo'> {\n  layoutInfo: LayoutInfo;\n  headerLayoutInfo: LayoutInfo | null;\n  item: Node<T>;\n  children?: ReactNode;\n}\n\n/** @private */\nexport function ListBoxSection<T>(props: ListBoxSectionProps<T>): JSX.Element {\n  let {children, layoutInfo, headerLayoutInfo, virtualizer, item} = props;\n  let {headingProps, groupProps} = useListBoxSection({\n    heading: item.rendered,\n    'aria-label': item['aria-label']\n  });\n\n  let headerRef = useRef<HTMLDivElement | null>(null);\n  useVirtualizerItem({\n    layoutInfo: headerLayoutInfo,\n    virtualizer,\n    ref: headerRef\n  });\n\n  let {direction} = useLocale();\n  let {state} = useContext(ListBoxContext)!;\n\n  return (\n    <Fragment>\n      {headerLayoutInfo && (\n        <div\n          role=\"presentation\"\n          ref={headerRef}\n          style={layoutInfoToStyle(headerLayoutInfo, direction)}>\n          {item.key !== state.collection.getFirstKey() && (\n            <div role=\"presentation\" className={classNames(styles, 'spectrum-Menu-divider')} />\n          )}\n          {item.rendered && (\n            <div {...headingProps} className={classNames(styles, 'spectrum-Menu-sectionHeading')}>\n              {item.rendered}\n            </div>\n          )}\n        </div>\n      )}\n      <div\n        {...groupProps}\n        style={layoutInfoToStyle(layoutInfo, direction)}\n        className={classNames(styles, 'spectrum-Menu')}>\n        {children}\n      </div>\n    </Fragment>\n  );\n}\n"],"names":[],"version":3,"file":"ListBoxSection.cjs.map"}