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;QACF;OACC,OAAO,KAAK,QAAQ,KAAK,yBAAW,gCAAC,CAAA,GAAA,yCAAG,SAAG,KAAK,QAAQ,IAAW,KAAK,QAAQ,gBACjF,gCAAC,CAAA,GAAA,yCAAS,SACP,gCACC,gCAAC;QACC,MAAM;QACL,GAAG,iBAAiB;QACrB,kBAAkB,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,iDAAK,GAAG;;AAQrD;AAEA,SAAS,sCAAgB,KAAK;IAC5B,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,yCAAY,EAAE;IAEjC,qBACE,gCAAC,QAAS,0BACR,gCAAC,CAAA,GAAA,yCAAU;QAAG,GAAG,KAAK;QAAE,OAAA;;AAG9B","sources":["packages/@adobe/react-spectrum/src/tag/Tag.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 {AriaTagProps, useTag} from 'react-aria/useTagGroup';\n\nimport {classNames} from '../utils/classNames';\nimport {ClearButton} from '../button/ClearButton';\nimport {ClearSlots, SlotProvider} from '../utils/Slots';\nimport type {ListState} from 'react-stately/useListState';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {ReactNode, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/tags/vars.css';\nimport {Text} from '../text/Text';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useHover} from 'react-aria/useHover';\nimport {useStyleProps} from '../utils/styleProps';\n\nexport interface SpectrumTagProps<T> extends AriaTagProps<T> {\n  state: ListState<T>;\n}\n\nexport function Tag<T>(props: SpectrumTagProps<T>): ReactNode {\n  const {item, state, ...otherProps} = props;\n\n  // @ts-ignore\n  let {styleProps} = useStyleProps(otherProps);\n  let {hoverProps, isHovered} = useHover({});\n  let {isFocused, isFocusVisible, focusProps} = useFocusRing({within: false});\n  let ref = useRef(null);\n  let {removeButtonProps, gridCellProps, rowProps, allowsRemoving} = useTag(\n    {\n      ...props,\n      item\n    },\n    state,\n    ref\n  );\n\n  return (\n    <div\n      {...mergeProps(rowProps, hoverProps, focusProps)}\n      className={classNames(\n        styles,\n        'spectrum-Tag',\n        {\n          'focus-ring': isFocusVisible,\n          'is-focused': isFocused,\n          'is-hovered': isHovered,\n          'spectrum-Tag--removable': allowsRemoving\n        },\n        styleProps.className\n      )}\n      ref={ref}>\n      <div className={classNames(styles, 'spectrum-Tag-cell')} {...gridCellProps}>\n        <SlotProvider\n          slots={{\n            icon: {UNSAFE_className: classNames(styles, 'spectrum-Tag-icon'), size: 'XS'},\n            text: {UNSAFE_className: classNames(styles, 'spectrum-Tag-content')},\n            avatar: {\n              UNSAFE_className: classNames(styles, 'spectrum-Tag-avatar'),\n              size: 'avatar-size-50'\n            }\n          }}>\n          {typeof item.rendered === 'string' ? <Text>{item.rendered}</Text> : item.rendered}\n          <ClearSlots>\n            {allowsRemoving && (\n              <TagRemoveButton\n                item={item}\n                {...removeButtonProps}\n                UNSAFE_className={classNames(styles, 'spectrum-Tag-removeButton')}\n              />\n            )}\n          </ClearSlots>\n        </SlotProvider>\n      </div>\n    </div>\n  );\n}\n\nfunction TagRemoveButton(props) {\n  let {styleProps} = useStyleProps(props);\n\n  return (\n    <span {...styleProps}>\n      <ClearButton {...props} inset />\n    </span>\n  );\n}\n"],"names":[],"version":3,"file":"Tag.mjs.map"}