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,GAAG;IAEH,IAAI,cAAC,UAAU,kBAAE,cAAc,EAAC,GAAG,CAAA,GAAA,yCAAW;IAC9C,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,iCAAO,EAAE;IAEvC,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,GAAG,KAAK;QACR,kBAAkB;QAClB,QAAQ;mBACN;uBACA;wBACA;uBACA;4BACA;wBACA;QACF;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,6CAAa,EAAE,OAAO;QAAC,QAAQ;IAAI;IAClD,OAAO,SAAS,EAAE;IAElB,qBACE,0DAAC,CAAA,GAAA,6BAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,qCAAS,EAAE,UAAU,YAAY,WAAW;QAC/C,GAAG,WAAW;QACf,KAAK;QACL,OAAO;YAAC,GAAG,WAAW,KAAK;YAAE,GAAG,YAAY,KAAK;QAAA;QACjD,gBAAc,aAAa;QAC3B,iBAAe,cAAc;QAC7B,gBAAc,aAAa;QAC3B,sBAAoB,kBAAkB;QACtC,iBAAe,cAAc;qBAC7B,0DAAC,CAAA,GAAA,6CAAa,uBACZ,0DAAC;QAAM,KAAK;QAAW,GAAG,CAAA,GAAA,qCAAS,EAAE,YAAY,WAAW;uBAE9D,0DAAC,CAAA,GAAA,kCAAO;QACN,QAAQ;YACN;gBAAC,CAAA,GAAA,sCAAW;gBAAG;oBAAC,GAAG,UAAU;oBAAE,KAAK;gBAAQ;aAAE;SAC/C;OACA,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Slider.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 {AriaSliderProps, AriaSliderThumbProps, useSlider, useSliderThumb} from 'react-aria/useSlider';\n\nimport {\n  ClassNameOrFunction,\n  ContextValue,\n  dom,\n  Provider,\n  RenderProps,\n  SlotProps,\n  useContextProps,\n  useRenderProps,\n  useSlot,\n  useSlottedContext\n} from './utils';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {forwardRefType, GlobalDOMAttributes, RefObject} from '@react-types/shared';\nimport {HoverEvents, Orientation} from '@react-types/shared';\nimport {LabelContext} from './Label';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {createContext, ForwardedRef, forwardRef, HTMLAttributes, OutputHTMLAttributes, useContext, useRef} from 'react';\nimport {SliderState, useSliderState} from 'react-stately/useSliderState';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useHover} from 'react-aria/useHover';\nimport {useNumberFormatter} from 'react-aria/useNumberFormatter';\nimport {VisuallyHidden} from 'react-aria/VisuallyHidden';\n\nexport interface SliderProps<T = number | number[]> extends Omit<AriaSliderProps<T>, 'label'>, RenderProps<SliderRenderProps>, SlotProps, 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-Slider'\n   */\n  className?: ClassNameOrFunction<SliderRenderProps>,\n  /**\n   * The display format of the value label.\n   */\n  formatOptions?: Intl.NumberFormatOptions\n}\n\nexport const SliderContext = createContext<ContextValue<SliderProps, HTMLDivElement>>(null);\nexport const SliderStateContext = createContext<SliderState | null>(null);\nexport const SliderTrackContext = createContext<ContextValue<SliderTrackContextValue, HTMLDivElement>>(null);\nexport const SliderOutputContext = createContext<ContextValue<SliderOutputContextValue, HTMLOutputElement>>(null);\n\nexport interface SliderRenderProps {\n  /**\n   * The orientation of the slider.\n   * @selector [data-orientation=\"horizontal | vertical\"]\n   */\n  orientation: Orientation,\n  /**\n   * Whether the slider is disabled.\n   * @selector [data-disabled]\n   */\n  isDisabled: boolean,\n  /**\n   * State of the slider.\n   */\n  state: SliderState\n}\n\n/**\n * A slider allows a user to select one or more values within a range.\n */\nexport const Slider = /*#__PURE__*/ (forwardRef as forwardRefType)(function Slider<T extends number | number[]>(props: SliderProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n  [props, ref] = useContextProps(props, ref, SliderContext);\n  let trackRef = useRef<HTMLDivElement>(null);\n  let numberFormatter = useNumberFormatter(props.formatOptions);\n  let state = useSliderState({...props, numberFormatter});\n  let [labelRef, label] = useSlot(\n    !props['aria-label'] && !props['aria-labelledby']\n  );\n  let {\n    groupProps,\n    trackProps,\n    labelProps,\n    outputProps\n  } = useSlider({...props, label}, state, trackRef);\n\n  let renderProps = useRenderProps({\n    ...props,\n    values: {\n      orientation: state.orientation,\n      isDisabled: state.isDisabled,\n      state\n    },\n    defaultClassName: 'react-aria-Slider'\n  });\n\n  let DOMProps = filterDOMProps(props, {global: true});\n  delete DOMProps.id;\n\n  return (\n    <Provider\n      values={[\n        [SliderStateContext, state],\n        [SliderTrackContext, {...trackProps, ref: trackRef}],\n        [SliderOutputContext, outputProps],\n        [LabelContext, {...labelProps, ref: labelRef}]\n      ]}>\n      <dom.div\n        {...mergeProps(DOMProps, renderProps, groupProps)}\n        ref={ref}\n        slot={props.slot || undefined}\n        data-orientation={state.orientation}\n        data-disabled={state.isDisabled || undefined} />\n    </Provider>\n  );\n});\n\nexport interface SliderOutputProps extends RenderProps<SliderRenderProps, 'output'>, GlobalDOMAttributes<HTMLOutputElement> {\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-SliderOutput'\n   */\n  className?: ClassNameOrFunction<SliderRenderProps>\n}\ninterface SliderOutputContextValue extends Omit<OutputHTMLAttributes<HTMLOutputElement>, 'children' | 'className' | 'style'>, SliderOutputProps {}\n\n/**\n * A slider output displays the current value of a slider as text.\n */\nexport const SliderOutput = /*#__PURE__*/ (forwardRef as forwardRefType)(function SliderOutput(props: SliderOutputProps, ref: ForwardedRef<HTMLOutputElement>) {\n  [props, ref] = useContextProps(props, ref, SliderOutputContext);\n  let {children, style, className, render, ...otherProps} = props;\n  let state = useContext(SliderStateContext)!;\n  let renderProps = useRenderProps({\n    className,\n    style,\n    children,\n    render,\n    defaultChildren: state.getThumbValueLabel(0),\n    defaultClassName: 'react-aria-SliderOutput',\n    values: {\n      orientation: state.orientation,\n      isDisabled: state.isDisabled,\n      state\n    }\n  });\n\n  return (\n    <dom.output\n      {...otherProps}\n      {...renderProps}\n      ref={ref}\n      data-orientation={state.orientation || undefined}\n      data-disabled={state.isDisabled || undefined} />\n  );\n});\n\nexport interface SliderTrackRenderProps extends SliderRenderProps {\n  /**\n   * Whether the slider track is currently hovered with a mouse.\n   * @selector [data-hovered]\n   */\n  isHovered: boolean\n}\n\nexport interface SliderTrackProps extends HoverEvents, RenderProps<SliderTrackRenderProps>, 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-SliderTrack'\n   */\n  className?: ClassNameOrFunction<SliderTrackRenderProps>\n}\ninterface SliderTrackContextValue extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'className' | 'style'>, SliderTrackProps {}\n\n/**\n * A slider track is a container for one or more slider thumbs.\n */\nexport const SliderTrack = /*#__PURE__*/ (forwardRef as forwardRefType)(function SliderTrack(props: SliderTrackProps, ref: ForwardedRef<HTMLDivElement>) {\n  [props, ref] = useContextProps(props, ref, SliderTrackContext);\n  let state = useContext(SliderStateContext)!;\n  let {onHoverStart, onHoverEnd, onHoverChange, ...otherProps} = props;\n  let {hoverProps, isHovered} = useHover({onHoverStart, onHoverEnd, onHoverChange});\n  let renderProps = useRenderProps({\n    ...props,\n    defaultClassName: 'react-aria-SliderTrack',\n    values: {\n      orientation: state.orientation,\n      isDisabled: state.isDisabled,\n      isHovered,\n      state\n    }\n  });\n\n  return (\n    <dom.div\n      {...mergeProps(otherProps, hoverProps)}\n      {...renderProps}\n      ref={ref}\n      data-hovered={isHovered || undefined}\n      data-orientation={state.orientation || undefined}\n      data-disabled={state.isDisabled || undefined} />\n  );\n});\n\nexport interface SliderThumbRenderProps {\n  /**\n   * State of the slider.\n   */\n  state: SliderState,\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 SliderThumbProps extends Omit<AriaSliderThumbProps, 'label' | 'validationState'>, HoverEvents, RenderProps<SliderThumbRenderProps>, 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-SliderThumb'\n   */\n  className?: ClassNameOrFunction<SliderThumbRenderProps>,\n  /**\n   * A ref for the HTML input element.\n   */\n  inputRef?: RefObject<HTMLInputElement | null>\n}\n\n/**\n * A slider thumb represents an individual value that the user can adjust within a slider track.\n */\nexport const SliderThumb = /*#__PURE__*/ (forwardRef as forwardRefType)(function SliderThumb(props: SliderThumbProps, ref: ForwardedRef<HTMLDivElement>) {\n  let {\n    inputRef: userInputRef = null\n  } = props;\n  let state = useContext(SliderStateContext)!;\n  let {ref: trackRef} = useSlottedContext(SliderTrackContext)!;\n  let {index = 0} = props;\n  let defaultInputRef = useRef<HTMLInputElement>(null);\n  let inputRef = userInputRef || defaultInputRef;\n  let [labelRef, label] = useSlot(\n    !props['aria-label'] && !props['aria-labelledby']\n  );\n  let {thumbProps, inputProps, labelProps, isDragging, isFocused, isDisabled} = useSliderThumb({\n    ...props,\n    index,\n    trackRef: trackRef as RefObject<HTMLDivElement | null>,\n    inputRef,\n    label\n  }, state);\n\n  let {focusProps, isFocusVisible} = useFocusRing();\n  let {hoverProps, isHovered} = useHover(props);\n\n  let renderProps = useRenderProps({\n    ...props,\n    defaultClassName: 'react-aria-SliderThumb',\n    values: {\n      state,\n      isHovered,\n      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(DOMProps, thumbProps, hoverProps)}\n      {...renderProps}\n      ref={ref}\n      style={{...thumbProps.style, ...renderProps.style}}\n      data-hovered={isHovered || undefined}\n      data-dragging={isDragging || undefined}\n      data-focused={isFocused || undefined}\n      data-focus-visible={isFocusVisible || undefined}\n      data-disabled={isDisabled || undefined}>\n      <VisuallyHidden>\n        <input ref={inputRef} {...mergeProps(inputProps, focusProps)} />\n      </VisuallyHidden>\n      <Provider\n        values={[\n          [LabelContext, {...labelProps, ref: labelRef}]\n        ]}>\n        {renderProps.children}\n      </Provider>\n    </dom.div>\n  );\n});\n"],"names":[],"version":3,"file":"Slider.cjs.map"}