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um/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(props: SpectrumSwitchProps, ref: FocusableRef<HTMLLabelElement>) {\n  props = useProviderProps(props);\n  let {\n    isEmphasized = false,\n    isDisabled = false,\n    autoFocus,\n    children,\n    ...otherProps\n  } = 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 {inputProps} = useSwitch(props, state, inputRef);\n\n\n  return (\n    <label\n      {...styleProps}\n      {...hoverProps}\n      ref={domRef}\n      className={\n        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      }>\n      <FocusRing focusRingClass={classNames(styles, 'focus-ring')} autoFocus={autoFocus}>\n        <input\n          {...inputProps}\n          ref={inputRef}\n          className={classNames(styles, 'spectrum-ToggleSwitch-input')} />\n      </FocusRing>\n      <span className={classNames(styles, 'spectrum-ToggleSwitch-switch')} />\n      {children && (\n        <span className={classNames(styles, 'spectrum-ToggleSwitch-label')}>\n          {children}\n        </span>\n      )}\n    </label>\n  );\n});\n"],"names":[],"version":3,"file":"Switch.cjs.map"}