"use client";
import { useState } from "react";
import { getRangeDefaultValue } from "../utils/getRangeDefaultValue.js";
/**
 * @example Simple Example
 * ```tsx
 * import { Form, Slider, useSlider } from "@react-md/core";
 * import type { ReactElement } from "react";
 *
 * function Example(): ReactElement {
 *   const slider = useSlider({
 *     // these are the defaults and can be changed
 *     min: 0,
 *     max: 100,
 *     step: 1,
 *     defaultValue: 50,
 *   });
 *
 *   // if you need access to the current value or manually change the value
 *   // yourself.
 *   const { value, setValue } = slider;
 *
 *   return (
 *     <Form>
 *       <Slider {...slider} aria-label="Volume" />
 *     </Form>
 *   );
 * }
 * ```
 *
 * @see The `Slider` component for additional examples.
 * @since 2.5.0
 * @since 6.0.0 Now returns an object instead of an ordered tuple and only
 * return the `value` and `setValue` instead of all the slider functionality. In
 * addition, the hook only accepts a single object argument.
 */ export function useSlider(options = {}) {
    const { min = 0, max = 100, step = 1, defaultValue } = options;
    const [value, setValue] = useState(getRangeDefaultValue({
        min,
        max,
        step,
        defaultValue
    }));
    return {
        min,
        max,
        step,
        value,
        setValue
    };
}

//# sourceMappingURL=useSlider.js.map