import { x as f, j as e, z as g, b7 as x, Y as p } from "./index-c65ca4a4.mjs";
const h = ({ hex: r, value: l, title: t, size: a = "md", isSelected: c, onSelect: i }) => {
  const b = p(null), u = (o) => {
    o.preventDefault(), i(l !== void 0 ? l : r);
  }, d = r.length === 4 && r[3] === "0" || r.length === 8 && r.slice(6) === "00";
  let s = "h-5 w-5";
  switch (a) {
    case "lg":
      s = "w-6 h-6";
      break;
  }
  return /* @__PURE__ */ e.jsx(
    "button",
    {
      ref: b,
      className: f(
        "relative flex shrink-0 cursor-pointer items-center rounded-full border border-grey-200 dark:border-grey-800",
        s,
        c && "outline outline-2 outline-green"
      ),
      style: { backgroundColor: r },
      title: t,
      type: "button",
      onClick: u,
      children: d && /* @__PURE__ */ e.jsx("div", { className: "absolute left-0 top-0 z-10 w-[136%] origin-left rotate-45 border-b border-b-red" })
    }
  );
}, j = ({ title: r, value: l, swatches: t, swatchSize: a = "md", onSwatchChange: c, onTogglePicker: i, isExpanded: b, picker: u = !0, containerClassName: d }) => {
  let s = t.find((o) => o.value === l || o.hex === l);
  return b && (s = void 0), d = f(
    "flex flex-col gap-3"
  ), /* @__PURE__ */ e.jsxs("div", { className: d, children: [
    r && /* @__PURE__ */ e.jsx(g, { useLabelTag: !0, children: r }),
    /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1", children: [
      /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-1", children: t.map(({ customContent: o, ...n }) => o ? /* @__PURE__ */ e.jsx(x, { children: o }, n.title) : /* @__PURE__ */ e.jsx(h, { isSelected: (s == null ? void 0 : s.title) === n.title, size: a, onSelect: c, ...n }, n.title)) }),
      u && /* @__PURE__ */ e.jsxs("button", { "aria-label": "Pick color", className: "relative h-6 w-6 cursor-pointer rounded-full border border-grey-200 dark:border-grey-800", type: "button", onClick: i, children: [
        /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 rounded-full bg-[conic-gradient(hsl(360,100%,50%),hsl(315,100%,50%),hsl(270,100%,50%),hsl(225,100%,50%),hsl(180,100%,50%),hsl(135,100%,50%),hsl(90,100%,50%),hsl(45,100%,50%),hsl(0,100%,50%))]" }),
        l && !s && /* @__PURE__ */ e.jsx("div", { className: "dark:border-grey-950 absolute inset-[3px] overflow-hidden rounded-full border border-white", style: { backgroundColor: l }, children: l === "transparent" && /* @__PURE__ */ e.jsx("div", { className: "absolute left-[3px] top-[3px] z-10 w-[136%] origin-left rotate-45 border-b border-b-red" }) })
      ] })
    ] })
  ] });
};
export {
  j as C
};
//# sourceMappingURL=ColorIndicator-6c9a0d02.mjs.map
