'use strict';

var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
var primitives_Slider = require('./primitives/Slider.js');
var utils = require('./utils-CTr7wn5d.js');
var primitives_Field = require('./primitives/Field.js');

const Slider = React.forwardRef(({ label, error, helpText, required = false, className, labelProps, disabled, id: idProp, ...otherProps }, ref) => {
    const generatedId = React.useId();
    const id = idProp ?? generatedId;
    const errorId = `error_${id}`;
    const helpTextId = `helpText_${id}`;
    const ariaDescribedBy = [error ? errorId : null, helpText ? helpTextId : null]
        .filter(Boolean)
        .join(" ") || undefined;
    const hasField = !!(label || error || helpText);
    const slider = (jsxRuntime.jsx(primitives_Slider.Slider, { ref: ref, id: id, disabled: disabled, "aria-invalid": !!error || undefined, "aria-describedby": ariaDescribedBy, "aria-label": !label ? undefined : label, className: utils.cn(!hasField && className), ...otherProps }));
    if (!hasField) {
        return slider;
    }
    return (jsxRuntime.jsxs(primitives_Field.Field, { "data-disabled": disabled || undefined, "data-invalid": !!error || undefined, className: className, children: [label && (jsxRuntime.jsxs(primitives_Field.FieldLabel, { htmlFor: id, ...labelProps, children: [label, required && (jsxRuntime.jsx("span", { "aria-hidden": "true", className: "text-destructive", children: "*" }))] })), jsxRuntime.jsxs(primitives_Field.FieldContent, { children: [slider, !!error && jsxRuntime.jsx(primitives_Field.FieldError, { id: errorId, children: error }), helpText && (jsxRuntime.jsx(primitives_Field.FieldDescription, { id: helpTextId, children: helpText }))] })] }));
});
Slider.displayName = "Slider";

exports.Slider = Slider;
//# sourceMappingURL=Slider-jNUS9vt8.js.map
