import { j as s } from "../../../../../../../_virtual/jsx-runtime.js";
import "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 c } from "../field-factory.js";
import { tx as a } from "../../../../../../style-system/dist/twind.js";
import { a as p } from "../../../../../../sdk/dist/shared/chunk-I46VBMLF.js";
import { Icon as h } from "../../../../../../../node_modules/.pnpm/@iconify_react@6.0.0_react@18.3.0-canary-3d9b20132-20240124/node_modules/@iconify/react/dist/iconify.js";
import { Root as f, Trigger as g, Content as j, Group as N, Item as v } 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/select.js";
import { Root as m, Item as u } 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/segmented-control.js";
import { Tooltip as b } 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/tooltip.js";
const G = (x) => {
  const { schema: o, currentValue: i, formData: w, onChange: l, title: r, description: n, noFieldGrow: d } = x, t = p(o) ?? [];
  switch (o["ui:display"] ?? (t.length > 3 ? "select" : "button-group")) {
    case "radio":
      return /* @__PURE__ */ s.jsxs("div", { className: "radio-field", children: [
        /* @__PURE__ */ s.jsx(c, { title: r, description: n }),
        /* @__PURE__ */ s.jsx("div", { className: "flex flex-col gap-2", children: t.filter((e) => !e["ui:hidden-option"]).map((e) => /* @__PURE__ */ s.jsxs("div", { className: "", children: [
          /* @__PURE__ */ s.jsxs("label", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ s.jsx(
              "input",
              {
                type: "radio",
                value: e.const,
                checked: i === e.const,
                onChange: () => l(e.const),
                className: "form-radio mr-1 text-upstart-600 ring-upstart-600 focus:ring-transparent"
              }
            ),
            /* @__PURE__ */ s.jsx("span", { className: "font-medium", children: e.title })
          ] }),
          e.description && /* @__PURE__ */ s.jsx("p", { className: "text-sm text-gray-500 leading-tight select-none", children: e.description })
        ] }, e.const)) })
      ] });
    case "button-group":
      return /* @__PURE__ */ s.jsxs(
        "div",
        {
          className: a("button-group-field flex-1 flex justify-between gap-2", !d && "flex-grow"),
          children: [
            /* @__PURE__ */ s.jsx(c, { title: r, description: n }),
            /* @__PURE__ */ s.jsx(
              m,
              {
                onValueChange: l,
                defaultValue: i,
                size: "1",
                radius: "medium",
                className: "!h-[26px]",
                children: t.filter((e) => !e["ui:hidden-option"]).map((e) => /* @__PURE__ */ s.jsx(
                  u,
                  {
                    value: e.const,
                    className: a("[&_.rt-SegmentedControlItemLabel]:(px-[7px])"),
                    children: e.title
                  },
                  e.const
                ))
              }
            )
          ]
        }
      );
    case "icon-group":
      return /* @__PURE__ */ s.jsxs(
        "div",
        {
          className: a(
            "icon-group-field flex flex-grow shrink-0 justify-between gap-2",
            !d && "flex-grow"
          ),
          children: [
            /* @__PURE__ */ s.jsx(c, { title: r, description: n }),
            /* @__PURE__ */ s.jsx(
              m,
              {
                onValueChange: l,
                defaultValue: i,
                size: "1",
                radius: "medium",
                className: "!h-[26px]",
                children: t.filter((e) => !e["ui:hidden-option"]).map((e) => /* @__PURE__ */ s.jsx(
                  u,
                  {
                    value: e.const,
                    className: a("[&_.rt-SegmentedControlItemLabel]:px-[6px]"),
                    children: /* @__PURE__ */ s.jsx(
                      b,
                      {
                        content: /* @__PURE__ */ s.jsx("span", { className: "block text-xs p-0.5", children: e.title }),
                        className: "!z-[99999]",
                        children: /* @__PURE__ */ s.jsx("div", { children: e["ui:icon"] ? /* @__PURE__ */ s.jsx(h, { icon: e["ui:icon"], className: "w-5 h-5 pointer-events-none" }) : e.title })
                      },
                      e.const
                    )
                  },
                  e.const
                ))
              }
            )
          ]
        }
      );
    default:
      return /* @__PURE__ */ s.jsxs("div", { className: a("flex justify-between pr-1 gap-4", !d && "flex-grow"), children: [
        /* @__PURE__ */ s.jsx(c, { title: r, description: n }),
        /* @__PURE__ */ s.jsxs(f, { defaultValue: i, size: "2", onValueChange: (e) => l(e), children: [
          /* @__PURE__ */ s.jsx(
            g,
            {
              radius: "large",
              variant: "ghost",
              placeholder: o["ui:placeholder"] ?? "Not specified"
            }
          ),
          /* @__PURE__ */ s.jsx(j, { position: "popper", children: /* @__PURE__ */ s.jsx(N, { children: t.filter((e) => !e["ui:hidden-option"]).map((e) => /* @__PURE__ */ s.jsx(v, { value: e.const, children: e.title }, e.const)) }) })
        ] })
      ] });
  }
};
export {
  G as default
};
//# sourceMappingURL=enum.js.map
