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AK,GAAG;QAC7B,GAAG,UAAU;qBACd,0DAAC;QACE,GAAG,UAAU;QACb,GAAG,UAAU;QACd,KAAK;QACL,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;;AAM1C","sources":["packages/@adobe/react-spectrum/src/color/ColorSlider.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 {AriaColorSliderProps, useColorSlider} from 'react-aria/useColorSlider';\n\nimport {classNames} from '../utils/classNames';\nimport {ColorSliderContext} from 'react-aria-components/ColorSlider';\nimport {ColorThumb} from './ColorThumb';\nimport {FocusableRef, StyleProps} from '@react-types/shared';\nimport {Label} from '../label/Label';\nimport React, {ReactNode, useRef, useState} from 'react';\nimport {SlotProvider} from '../utils/Slots';\nimport styles from '@adobe/spectrum-css-temp/components/colorslider/vars.css';\nimport {useColorSliderState} from 'react-stately/useColorSliderState';\nimport {useContextProps} from 'react-aria-components/slots';\nimport {useFocus} from 'react-aria/useFocus';\nimport {useFocusableRef} from '../utils/useDOMRef';\nimport {useFocusVisible} from 'react-aria/useFocusVisible';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useProviderProps} from '../provider/Provider';\nimport {useStyleProps} from '../utils/styleProps';\n\nexport interface SpectrumColorSliderProps extends AriaColorSliderProps, StyleProps {\n  /**\n   * Whether the value label is displayed. True by default if there is a label, false by default if\n   * not.\n   */\n  showValueLabel?: boolean;\n  /** A ContextualHelp element to place next to the label. */\n  contextualHelp?: ReactNode;\n}\n\n/**\n * ColorSliders allow users to adjust an individual channel of a color value.\n */\nexport const ColorSlider = React.forwardRef(function ColorSlider(\n  props: SpectrumColorSliderProps,\n  ref: FocusableRef<HTMLDivElement>\n) {\n  props = useProviderProps(props);\n  let inputRef = useRef(null);\n  let trackRef = useRef(null);\n  let domRef = useFocusableRef(ref, inputRef);\n  [props, domRef] = useContextProps(props, domRef, ColorSliderContext);\n\n  let {isDisabled, channel, orientation, label, showValueLabel, 'aria-label': ariaLabel} = props;\n  let vertical = orientation === 'vertical';\n\n  let {styleProps} = useStyleProps(props);\n  let {locale} = useLocale();\n\n  let state = useColorSliderState({...props, locale});\n\n  // If vertical and a label is provided, use it as an aria-label instead.\n  if (vertical && label) {\n    ariaLabel = ariaLabel || (typeof label === 'string' ? label : undefined);\n    label = null;\n  }\n\n  // If no external label, aria-label or aria-labelledby is provided,\n  // default to displaying the localized channel value.\n  // Specifically check if label is undefined. If label is `null` then display no visible label.\n  // A default aria-label is provided by useColorSlider in that case.\n  if (label === undefined && !ariaLabel && !props['aria-labelledby'] && !vertical) {\n    label = state.value.getChannelName(channel, locale);\n  }\n\n  // Show the value label by default if there is a visible label\n  if (showValueLabel == null) {\n    showValueLabel = !!label;\n  }\n\n  let {inputProps, thumbProps, trackProps, labelProps, outputProps} = useColorSlider(\n    {\n      ...props,\n      label,\n      'aria-label': ariaLabel,\n      trackRef,\n      inputRef\n    },\n    state\n  );\n\n  let {isFocusVisible} = useFocusVisible();\n  let [isFocused, setIsFocused] = useState(false);\n  let {focusProps} = useFocus({\n    isDisabled,\n    onFocusChange: setIsFocused\n  });\n\n  return (\n    <div\n      ref={domRef}\n      {...styleProps}\n      className={classNames(\n        styles,\n        {\n          'spectrum-ColorSlider-container--horizontal': !vertical,\n          'spectrum-ColorSlider-container--vertical': vertical\n        },\n        styleProps.className\n      )}>\n      {label && (\n        <div className={classNames(styles, 'spectrum-ColorSlider-labelContainer')}>\n          <Label {...labelProps}>{label}</Label>\n          {props.contextualHelp && (\n            <SlotProvider\n              slots={{\n                actionButton: {\n                  UNSAFE_className: classNames(styles, 'spectrum-ColorSlider-contextualHelp')\n                }\n              }}>\n              {props.contextualHelp}\n            </SlotProvider>\n          )}\n          {showValueLabel && (\n            <Label\n              elementType=\"span\"\n              UNSAFE_className={classNames(styles, 'spectrum-ColorSlider-valueLabel')}>\n              <output {...outputProps}>{state.value.formatChannelValue(channel, locale)}</output>\n            </Label>\n          )}\n        </div>\n      )}\n      <div\n        {...trackProps}\n        ref={trackRef}\n        className={classNames(styles, 'spectrum-ColorSlider', {\n          'is-disabled': isDisabled,\n          'spectrum-ColorSlider--vertical': vertical\n        })}>\n        <ColorThumb\n          value={state.getDisplayColor()}\n          isFocused={isFocused && isFocusVisible}\n          isDisabled={isDisabled}\n          isDragging={state.isThumbDragging(0)}\n          containerRef={trackRef}\n          className={classNames(styles, 'spectrum-ColorSlider-handle')}\n          {...thumbProps}>\n          <input\n            {...inputProps}\n            {...focusProps}\n            ref={inputRef}\n            className={classNames(styles, 'spectrum-ColorSlider-slider')}\n          />\n        </ColorThumb>\n      </div>\n    </div>\n  );\n});\n"],"names":[],"version":3,"file":"ColorSlider.cjs.map"}