{"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAsBM,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,kCAAoB,0DAAC;QAAI,MAAK;QAAe,KAAK;QAAW,OAAO,CAAA,GAAA,mEAAgB,EAAE,kBAAkB;OACtG,KAAK,GAAG,KAAK,MAAM,UAAU,CAAC,WAAW,oBACxC,0DAAC;QACC,MAAK;QACL,WAAW,CAAA,GAAA,oCAAS,EAClB,CAAA,GAAA,mDAAK,GACL;QAGL,KAAK,QAAQ,kBACZ,0DAAC;QACE,GAAG,YAAY;QAChB,WACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL;OAGH,KAAK,QAAQ,kBAIpB,0DAAC;QACE,GAAG,UAAU;QACd,OAAO,CAAA,GAAA,mEAAgB,EAAE,YAAY;QACrC,WACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL;OAGH;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 {useVirtualizerItem, VirtualizerItemOptions} 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 && <div role=\"presentation\" ref={headerRef} style={layoutInfoToStyle(headerLayoutInfo, direction)}>\n        {item.key !== state.collection.getFirstKey() &&\n          <div\n            role=\"presentation\"\n            className={classNames(\n              styles,\n              'spectrum-Menu-divider'\n            )} />\n        }\n        {item.rendered &&\n          <div\n            {...headingProps}\n            className={\n              classNames(\n                styles,\n                'spectrum-Menu-sectionHeading'\n              )\n            }>\n            {item.rendered}\n          </div>\n        }\n      </div>}\n      <div\n        {...groupProps}\n        style={layoutInfoToStyle(layoutInfo, direction)}\n        className={\n          classNames(\n            styles,\n            'spectrum-Menu'\n          )\n        }>\n        {children}\n      </div>\n    </Fragment>\n  );\n}\n"],"names":[],"version":3,"file":"ListBoxSection.cjs.map"}