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YAClC,iCAAiC;QACnC;OAGH;WAAI,CAAA,GAAA,gEAAY,EAAE,MAAM,MAAM,UAAU;KAAE,CAAC,GAAG,CAAC,CAAA;QAC9C,IAAI,qBACF,0DAAC,CAAA,GAAA,kCAAO;YACN,KAAK,KAAK,GAAG;YACb,MAAM;YACN,OAAO;;QAGX,IAAI,KAAK,OAAO,EACd,OAAO,KAAK,OAAO,CAAC;QAGtB,OAAO;IACT;AAKV","sources":["packages/@adobe/react-spectrum/src/menu/MenuSection.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';\nimport {getChildNodes} from 'react-stately/private/collections/getChildNodes';\nimport {MenuItem} from './MenuItem';\nimport {Node} from '@react-types/shared';\nimport React, {Fragment, JSX} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {TreeState} from 'react-stately/useTreeState';\nimport {useMenuSection} from 'react-aria/useMenu';\nimport {useSeparator} from 'react-aria/useSeparator';\n\ninterface MenuSectionProps<T> {\n  item: Node<T>,\n  state: TreeState<T>\n}\n\n/** @private */\nexport function MenuSection<T>(props: MenuSectionProps<T>): JSX.Element {\n  let {item, state} = props;\n  let {itemProps, headingProps, groupProps} = useMenuSection({\n    heading: item.rendered,\n    'aria-label': item['aria-label']\n  });\n\n  let {separatorProps} = useSeparator({\n    elementType: 'div'\n  });\n\n  let firstSectionKey = state.collection.getFirstKey();\n  let lastSectionKey = [...state.collection].filter(node => node.type === 'section').at(-1)?.key;\n  let sectionIsFirst = firstSectionKey === item.key && state.collection.getFirstKey() === firstSectionKey;\n  let lastKey = state.collection.getLastKey();\n  let sectionIsLast = lastSectionKey === item.key && lastKey != null && state.collection.getItem(lastKey)!.parentKey === lastSectionKey;\n\n  return (\n    <Fragment>\n      {item.key !== state.collection.getFirstKey() &&\n        <div\n          {...separatorProps}\n          className={classNames(\n            styles,\n            'spectrum-Menu-divider'\n          )} />\n      }\n      <div {...itemProps}>\n        {item.rendered &&\n          <span\n            {...headingProps}\n            className={\n              classNames(\n                styles,\n                'spectrum-Menu-sectionHeading'\n              )\n            }>\n            {item.rendered}\n          </span>\n        }\n        <div\n          {...groupProps}\n          className={\n            classNames(\n              styles,\n                'spectrum-Menu',\n              {\n                'spectrum-Menu-section--noHeading': item.rendered == null,\n                'spectrum-Menu-section--isFirst': sectionIsFirst,\n                'spectrum-Menu-section--isLast': sectionIsLast\n              }\n            )\n          }>\n          {[...getChildNodes(item, state.collection)].map(node => {\n            let item = (\n              <MenuItem\n                key={node.key}\n                item={node}\n                state={state} />\n            );\n\n            if (node.wrapper) {\n              item = node.wrapper(item);\n            }\n\n            return item;\n          })}\n        </div>\n      </div>\n    </Fragment>\n  );\n}\n"],"names":[],"version":3,"file":"MenuSection.cjs.map"}