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W,SAAS;qBAGxB,0DAAC,CAAA,GAAA,sCAAW;QACV,OAAO;YACL,MAAM;gBACJ,MAAM;gBACN,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;YACvC;YACA,MAAM;gBACJ,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;YACvC;QACF;OACC,OAAO,aAAa,YAAY,2BAC7B,0DAAC,CAAA,GAAA,8BAAG,SAAG,YACP;AAKd","sources":["packages/@adobe/react-spectrum/src/button/ToggleButton.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 {FocusableRef} from '@react-types/shared';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React from 'react';\nimport {SlotProvider} from '../utils/Slots';\nimport {SpectrumActionButtonProps} from './ActionButton';\nimport styles from '@adobe/spectrum-css-temp/components/button/vars.css';\nimport {Text} from '../text/Text';\nimport {ToggleButtonProps, useToggleButton} from 'react-aria/useToggleButton';\nimport {useFocusableRef} from '../utils/useDOMRef';\nimport {useHover} from 'react-aria/useHover';\nimport {useProviderProps} from '../provider/Provider';\nimport {useStyleProps} from '../utils/styleProps';\nimport {useToggleState} from 'react-stately/useToggleState';\n\nexport interface SpectrumToggleButtonProps extends Omit<ToggleButtonProps, 'onClick'>, Omit<SpectrumActionButtonProps, 'aria-current' | 'type' | 'form' | 'formAction' | 'formEncType' | 'formMethod' | 'formNoValidate' | 'formTarget' | 'name' | 'value'> {\n  /** Whether the button should be displayed with an [emphasized style](https://spectrum.adobe.com/page/action-button/#Emphasis). */\n  isEmphasized?: boolean\n}\n\n/**\n * ToggleButtons allow users to toggle a selection on or off, for example\n * switching between two states or modes.\n */\nexport const ToggleButton = React.forwardRef(function ToggleButton(props: SpectrumToggleButtonProps, ref: FocusableRef<HTMLButtonElement>) {\n  props = useProviderProps(props);\n  let {\n    isQuiet,\n    isDisabled,\n    isEmphasized,\n    staticColor,\n    children,\n    autoFocus,\n    ...otherProps\n  } = props;\n\n  let domRef = useFocusableRef(ref);\n  let state = useToggleState(props);\n  let {buttonProps, isPressed} = useToggleButton(props, state, domRef);\n  let {hoverProps, isHovered} = useHover({isDisabled});\n  let {styleProps} = useStyleProps(otherProps);\n  let isTextOnly = React.Children.toArray(props.children).every(c => !React.isValidElement(c));\n\n  return (\n    <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n      <button\n        {...styleProps}\n        {...mergeProps(buttonProps, hoverProps)}\n        ref={domRef}\n        className={\n          classNames(\n            styles,\n            'spectrum-ActionButton',\n            {\n              'spectrum-ActionButton--quiet': isQuiet,\n              'spectrum-ActionButton--emphasized': isEmphasized,\n              'spectrum-ActionButton--staticColor': !!staticColor,\n              'spectrum-ActionButton--staticWhite': staticColor === 'white',\n              'spectrum-ActionButton--staticBlack': staticColor === 'black',\n              'is-active': isPressed,\n              'is-disabled': isDisabled,\n              'is-hovered': isHovered,\n              'is-selected': state.isSelected\n            },\n            styleProps.className\n          )\n        }>\n        <SlotProvider\n          slots={{\n            icon: {\n              size: 'S',\n              UNSAFE_className: classNames(styles, 'spectrum-Icon')\n            },\n            text: {\n              UNSAFE_className: classNames(styles, 'spectrum-ActionButton-label')\n            }\n          }}>\n          {typeof children === 'string' || isTextOnly\n            ? <Text>{children}</Text>\n            : children}\n        </SlotProvider>\n      </button>\n    </FocusRing>\n  );\n});\n"],"names":[],"version":3,"file":"ToggleButton.cjs.map"}