import { j as e } from "../../../../../../../_virtual/jsx-runtime.js";
import { useState as x } from "react";
import "../../../../../../../node_modules/.pnpm/@formkit_auto-animate@0.8.2/node_modules/@formkit/auto-animate/index.js";
import "../../../../../../../node_modules/.pnpm/react-hot-toast@2.5.2_react-dom@18.3.0-canary-3d9b20132-20240124_react@18.3.0-canary-3d_c02c1e17bf76c343fd22d1f22394ecf5/node_modules/react-hot-toast/dist/index.js";
import { FieldTitle as u } from "../field-factory.js";
import { Slider as d } from "../../../../../../../node_modules/.pnpm/@radix-ui_themes@3.1.4_@types_react-dom@18.3.6_@types_react@18.3.3__@types_react@18.3.3_46b1dabc193c5ff5696ee783983c694e/node_modules/@radix-ui/themes/dist/esm/components/slider.js";
import { Root as f } from "../../../../../../../node_modules/.pnpm/@radix-ui_themes@3.1.4_@types_react-dom@18.3.6_@types_react@18.3.3__@types_react@18.3.3_46b1dabc193c5ff5696ee783983c694e/node_modules/@radix-ui/themes/dist/esm/components/text-field.js";
const V = (a) => {
  const { schema: t, currentValue: s, onChange: i, title: r, description: m } = a, n = t["ui:unit"] ?? "", l = t["ui:multiplier"] ?? 1, [c, p] = x(s);
  return /* @__PURE__ */ e.jsxs("div", { className: "slider-field flex-1 flex justify-between gap-3 items-center", children: [
    /* @__PURE__ */ e.jsx(u, { title: r, description: m }),
    /* @__PURE__ */ e.jsxs("div", { className: "ml-auto basis-1/3 flex items-center gap-2", children: [
      /* @__PURE__ */ e.jsx(
        d,
        {
          onValueChange: (o) => {
            console.log("slider value changed", o[0]), p(o[0]), i(o[0]);
          },
          size: "1",
          variant: "soft",
          min: t.minimum,
          max: t.maximum,
          step: t.multipleOf ?? 1,
          defaultValue: [s]
        }
      ),
      typeof s == "number" && /* @__PURE__ */ e.jsxs("span", { className: "text-gray-500 text-sm text-nowrap whitespace-nowrap", children: [
        c * l,
        " ",
        n
      ] })
    ] })
  ] });
}, y = (a) => {
  const { currentValue: t, onChange: s, schema: i, title: r, description: m, placeholder: n } = a;
  return /* @__PURE__ */ e.jsxs("div", { className: "number-field flex-1 flex justify-between gap-3 items-center", children: [
    /* @__PURE__ */ e.jsx(u, { title: r, description: m }),
    /* @__PURE__ */ e.jsx(
      f,
      {
        defaultValue: t,
        type: "number",
        onChange: (l) => s(l.target.value ? Number(l.target.value) : null),
        className: "!max-w-[50px] !text-right",
        inputMode: "numeric",
        min: i.minimum,
        max: i.maximum,
        step: i.multipleOf ?? 1,
        placeholder: n ?? i["ui:placeholder"]
      }
    )
  ] });
};
export {
  y as NumberField,
  V as SliderField
};
//# sourceMappingURL=number.js.map
