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C,aAAa,CAAC,sBAAwB,aAAa,CAAC;QACrE;qBAEF,0DAAC,CAAA,GAAA,8BAAG;QACF,kBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL;qBAGJ,0DAAC,CAAA,GAAA,oCAAS,uBACR,0DAAC,CAAA,GAAA,sCAAW;QACV,OAAO;YACL,MAAM;gBAAC,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,0BAA0B;gBAAE,GAAG,UAAU;YAAA;YACzE,MAAM;gBAAC,MAAM;gBAAK,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,qBAAqB;YAAA;YAChE,QAAQ;gBAAC,MAAM;gBAAmB,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,uBAAuB;YAAA;YAClF,aAAa;gBAAC,kBAAkB,CAAA,GAAA,mDAAK,CAAC,CAAC,4BAA4B;gBAAE,GAAG,gBAAgB;YAAA;QAC1F;OACC,UACA,4BACC,0DAAC,CAAA,GAAA,+DAAc;QACb,MAAK;QACL,kBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL;;AAUtB","sources":["packages/@adobe/react-spectrum/src/listbox/ListBoxOption.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 CheckmarkMedium from '@spectrum-icons/ui/CheckmarkMedium';\nimport {classNames} from '../utils/classNames';\nimport {ClearSlots, SlotProvider} from '../utils/Slots';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {Grid} from '../layout/Grid';\nimport {isFocusVisible} from 'react-aria/private/interactions/useFocusVisible';\nimport {ListBoxContext} from './ListBoxContext';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {Node} from '@react-types/shared';\nimport React, {JSX, useContext, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {Text} from '../text/Text';\nimport {useHover} from 'react-aria/useHover';\nimport {useOption} from 'react-aria/useListBox';\n\ninterface OptionProps<T> {\n  item: Node<T>\n}\n\n/** @private */\nexport function ListBoxOption<T>(props: OptionProps<T>): JSX.Element {\n  let {item} = props;\n\n  let {\n    rendered,\n    key\n  } = item;\n  let ElementType: React.ElementType = item.props.href ? 'a' : 'div';\n  let {state, shouldFocusOnHover, shouldUseVirtualFocus} = useContext(ListBoxContext)!;\n\n  let ref = useRef<any>(undefined);\n  let {optionProps, labelProps, descriptionProps, isSelected, isDisabled, isFocused} = useOption(\n    {\n      'aria-label': item['aria-label'],\n      key,\n      isVirtualized: true\n    },\n    state,\n    ref\n  );\n  let {hoverProps, isHovered} = useHover({\n    ...props,\n    isDisabled\n  });\n\n  let contents = typeof rendered === 'string'\n    ? <Text>{rendered}</Text>\n    : rendered;\n\n  let isKeyboardModality = isFocusVisible();\n\n  return (\n    <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n      <ElementType\n        {...mergeProps(optionProps, shouldFocusOnHover ? {} : hoverProps)}\n        ref={ref}\n        className={classNames(\n          styles,\n          'spectrum-Menu-item',\n          {\n            // If using virtual focus, apply focused styles to the item when the user is interacting with keyboard modality\n            'is-focused': shouldUseVirtualFocus && isFocused && isKeyboardModality,\n            'is-disabled': isDisabled,\n            'is-selected': isSelected,\n            'is-selectable': state.selectionManager.selectionMode !== 'none',\n            // When shouldFocusOnHover is false, apply hover styles both when hovered with the mouse.\n            // Otherwise, apply hover styles when focused using non-keyboard modality.\n            'is-hovered': (isHovered && !shouldFocusOnHover) || (isFocused && !isKeyboardModality)\n          }\n        )}>\n        <Grid\n          UNSAFE_className={\n            classNames(\n              styles,\n              'spectrum-Menu-itemGrid'\n            )\n          }>\n          <ClearSlots>\n            <SlotProvider\n              slots={{\n                text: {UNSAFE_className: styles['spectrum-Menu-itemLabel'], ...labelProps},\n                icon: {size: 'S', UNSAFE_className: styles['spectrum-Menu-icon']},\n                avatar: {size: 'avatar-size-100', UNSAFE_className: styles['spectrum-Menu-avatar']},\n                description: {UNSAFE_className: styles['spectrum-Menu-description'], ...descriptionProps}\n              }}>\n              {contents}\n              {isSelected &&\n                <CheckmarkMedium\n                  slot=\"checkmark\"\n                  UNSAFE_className={\n                    classNames(\n                      styles,\n                      'spectrum-Menu-checkmark'\n                    )\n                  } />\n              }\n            </SlotProvider>\n          </ClearSlots>\n        </Grid>\n      </ElementType>\n    </FocusRing>\n  );\n}\n"],"names":[],"version":3,"file":"ListBoxOption.cjs.map"}