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AiC;AAI7E","sources":["packages/@adobe/react-spectrum/src/switch/Switch.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 {AriaSwitchProps, useSwitch} from 'react-aria/useSwitch';\n\nimport {classNames} from '../utils/classNames';\nimport {FocusableRef, StyleProps} from '@react-types/shared';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport React, {forwardRef, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/toggle/vars.css';\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 SpectrumSwitchProps extends AriaSwitchProps, StyleProps {\n  /**\n   * This prop sets the emphasized style which provides visual prominence.\n   */\n  isEmphasized?: boolean;\n}\n\n/**\n * Switches allow users to turn an individual option on or off.\n * They are usually used to activate or deactivate a specific setting.\n */\nexport const Switch = forwardRef(function Switch(\n  props: SpectrumSwitchProps,\n  ref: FocusableRef<HTMLLabelElement>\n) {\n  props = useProviderProps(props);\n  let {isEmphasized = false, isDisabled = false, autoFocus, children, ...otherProps} = props;\n  let {styleProps} = useStyleProps(otherProps);\n  let {hoverProps, isHovered} = useHover({isDisabled});\n\n  let inputRef = useRef<HTMLInputElement>(null);\n  let domRef = useFocusableRef(ref, inputRef);\n  let state = useToggleState(props);\n  let {labelProps, inputProps} = useSwitch(props, state, inputRef);\n\n  return (\n    <label\n      {...labelProps}\n      {...styleProps}\n      {...hoverProps}\n      ref={domRef}\n      className={classNames(\n        styles,\n        'spectrum-ToggleSwitch',\n        {\n          'spectrum-ToggleSwitch--quiet': !isEmphasized,\n          'is-disabled': isDisabled,\n          'is-hovered': isHovered\n        },\n        styleProps.className\n      )}>\n      <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n        <input\n          {...inputProps}\n          ref={inputRef}\n          className={classNames(styles, 'spectrum-ToggleSwitch-input')}\n        />\n      </FocusRing>\n      <span className={classNames(styles, 'spectrum-ToggleSwitch-switch')} />\n      {children && (\n        <span className={classNames(styles, 'spectrum-ToggleSwitch-label')}>{children}</span>\n      )}\n    </label>\n  );\n});\n"],"names":[],"version":3,"file":"Switch.mjs.map"}