import { jsx } from 'react/jsx-runtime';
import { useCallback } from 'react';
import { NiceButton as We, NiceSlider as so, NiceTextArea as Os } from '../packages/ui/dist/index.js';

const variantMap = {
    "dark": "secondary",
    "light": "ghost",
    "outline-secondary": "outline",
    "outline-info": "info",
    "outline-warning": "warning",
    "outline-danger": "error",
};
const sizeMap = {
    "sm": "sm",
    "md": "md",
};
const Button = ({ variant = "dark", size = "md", className = "", children, disabled, onClick, title, style, }) => {
    return (jsx(We, { variant: variantMap[variant], size: sizeMap[size], className: className, disabled: disabled, onClick: onClick, "aria-label": title, style: style, children: children }));
};
const RangeInput = ({ accentColor, style, className = "", value, min = 0, max = 100, step = 1, onChange, onMouseUp, }) => {
    const handleChange = useCallback((val) => {
        if (onChange) {
            const syntheticEvent = {
                target: { value: String(val) },
                currentTarget: { value: String(val) },
            };
            onChange(syntheticEvent);
        }
        // Trigger onMouseUp on every change since NiceSlider doesn't have onChangeEnd
        if (onMouseUp) {
            onMouseUp({});
        }
    }, [onChange, onMouseUp]);
    return (jsx(so, { value: typeof value === "number" ? value : Number(value) || 0, min: Number(min), max: Number(max), step: Number(step), className: className, style: { ...style, "--nice-accent": accentColor }, onChange: handleChange, showValue: false }));
};
const TextArea = ({ className = "", value, onChange, rows, placeholder, disabled, style, }) => {
    const handleChange = useCallback((newValue) => {
        if (onChange) {
            const syntheticEvent = {
                target: { value: newValue },
                currentTarget: { value: newValue },
            };
            onChange(syntheticEvent);
        }
    }, [onChange]);
    return (jsx(Os, { className: className, value: typeof value === "string" ? value : String(value !== null && value !== void 0 ? value : ""), onChange: handleChange, rows: rows, placeholder: placeholder, disabled: disabled, style: style }));
};

export { Button, RangeInput, TextArea };
//# sourceMappingURL=LocalUI.js.map
