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.tsx"],"sourcesContent":["import {ClassNameOrFunction, dom, RenderProps, useRenderProps} from './utils';\nimport {Color} from 'react-stately/Color';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {GlobalDOMAttributes, HoverEvents, RefObject} from '@react-types/shared';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {createContext, ForwardedRef, forwardRef, HTMLAttributes, InputHTMLAttributes, useContext} from 'react';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useHover} from 'react-aria/useHover';\n\ninterface ColorState {\n  getDisplayColor(): Color,\n  isDragging: boolean\n}\n\ninterface InternalColorThumbContextValue {\n  state: ColorState,\n  thumbProps: HTMLAttributes<HTMLElement>,\n  inputXRef: RefObject<HTMLInputElement | null>,\n  inputYRef?: RefObject<HTMLInputElement | null>,\n  xInputProps: InputHTMLAttributes<HTMLInputElement>,\n  yInputProps?: InputHTMLAttributes<HTMLInputElement>,\n  isDisabled?: boolean\n}\n\nexport const InternalColorThumbContext = createContext<InternalColorThumbContextValue | null>(null);\n\nexport interface ColorThumbRenderProps {\n  /**\n   * The selected color, excluding the alpha channel.\n   */\n  color: Color,\n  /**\n   * Whether this thumb is currently being dragged.\n   * @selector [data-dragging]\n   */\n  isDragging: boolean,\n  /**\n   * Whether the thumb is currently hovered with a mouse.\n   * @selector [data-hovered]\n   */\n  isHovered: boolean,\n  /**\n   * Whether the thumb is currently focused.\n   * @selector [data-focused]\n   */\n  isFocused: boolean,\n  /**\n   * Whether the thumb is keyboard focused.\n   * @selector [data-focus-visible]\n   */\n  isFocusVisible: boolean,\n  /**\n   * Whether the thumb is disabled.\n   * @selector [data-disabled]\n   */\n  isDisabled: boolean\n}\n\nexport interface ColorThumbProps extends HoverEvents, RenderProps<ColorThumbRenderProps>, GlobalDOMAttributes<HTMLDivElement> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\n   * @default 'react-aria-ColorThumb'\n   */\n  className?: ClassNameOrFunction<ColorThumbRenderProps>\n}\n\n/**\n * A color thumb appears within a ColorArea, ColorSlider, or ColorWheel and allows a user to drag to adjust the color value.\n */\nexport const ColorThumb = forwardRef(function ColorThumb(props: ColorThumbProps, ref: ForwardedRef<HTMLDivElement>) {\n  let {state, thumbProps, inputXRef, inputYRef, xInputProps, yInputProps, isDisabled = false} = useContext(InternalColorThumbContext)!;\n  let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n  let {hoverProps, isHovered} = useHover(props);\n\n  let renderProps = useRenderProps({\n    ...props,\n    defaultClassName: 'react-aria-ColorThumb',\n    defaultStyle: {\n      ...thumbProps.style,\n      backgroundColor: state.getDisplayColor().toString()\n    },\n    values: {\n      color: state.getDisplayColor(),\n      isHovered,\n      isDragging: state.isDragging,\n      isFocused,\n      isFocusVisible,\n      isDisabled\n    }\n  });\n\n  let DOMProps = filterDOMProps(props, {global: true});\n  delete DOMProps.id;\n\n  return (\n    <dom.div\n      {...mergeProps(thumbProps, hoverProps, DOMProps)}\n      {...renderProps}\n      ref={ref}\n      data-hovered={isHovered || undefined}\n      data-dragging={state.isDragging || undefined}\n      data-focused={isFocused || undefined}\n      data-focus-visible={isFocusVisible || undefined}\n      data-disabled={isDisabled || undefined}>\n      <input ref={inputXRef} {...xInputProps} {...focusProps} />\n      {yInputProps && <input ref={inputYRef} {...yInputProps} {...focusProps} />}\n      {renderProps.children}\n    </dom.div>\n  );\n});\n"],"names":[],"version":3,"file":"ColorThumb.cjs.map"}