import { z as C, m as B, H as L, G as y, y as g, F as S, J as E, B as b, n as D, i as v, K as H, L as M, E as T, N as z, M as K, O as N, e as O, W as P, A as _, Q as A } from "./Toggle-5mHDjpoq.js";
import { C as I, L as w, g as R, h as V, l as W, i as X } from "./aggregator-e8E2YGic.js";
import { K as Z } from "./Keyboard-1CGTJ7G-.js";
import { j as t } from "./jsx-runtime-NmMXPjeo.js";
import { useState as $, useEffect as F, useCallback as G } from "react";
import { P as J } from "./Center-ZEYtK6iF.js";
import { C as h } from "./css-M9deYuc0.js";
import "react-hook-form";
import { L as Q } from "./List-XYe_oss-.js";
const U = ({
  data: e,
  emtpyContent: s,
  value: l,
  onChange: o,
  allowMultiple: a,
  allowNone: c,
  hideColumnHeader: r = !1,
  children: u,
  columns: d,
  visible: i,
  replaceOnSingle: n,
  ...p
}) => /* @__PURE__ */ t.jsx(Q, { data: e, emptyContent: s, children: /* @__PURE__ */ t.jsx(
  C,
  {
    value: l,
    onChange: o,
    allowMultiple: a,
    allowNone: c,
    replaceOnSingle: n,
    children: /* @__PURE__ */ t.jsxs(B, { visible: i, className: h.B("select"), ...p, children: [
      u,
      /* @__PURE__ */ t.jsx(L, { disabled: !i, children: /* @__PURE__ */ t.jsx(y.Header, { hide: r, columns: d, children: /* @__PURE__ */ t.jsx(g.Virtual, { itemHeight: y.itemHeight, children: S(y.Item) }) }) })
    ] })
  }
) }), q = ({
  children: e = Y,
  value: s,
  onChange: l,
  entryRenderKey: o = "key",
  allowNone: a = !1,
  allowMultiple: c = !1,
  data: r,
  replaceOnSingle: u,
  ...d
}) => {
  const { onSelect: i } = E({
    allowMultiple: c,
    allowNone: a,
    replaceOnSingle: u,
    data: r,
    value: s,
    onChange: l
  });
  return /* @__PURE__ */ t.jsx(J, { ...d, children: r.map((n) => e({
    key: n.key,
    onClick: () => i(n.key),
    selected: n.key === s,
    entry: n,
    title: n[o]
  })) });
}, Y = ({
  onClick: e,
  selected: s,
  title: l
}) => /* @__PURE__ */ t.jsx(b, { onClick: e, variant: s ? "filled" : "outlined", children: l }), ee = ({
  selected: e,
  renderKey: s,
  toggle: l,
  visible: o,
  children: a,
  ...c
}) => /* @__PURE__ */ t.jsx(
  b,
  {
    className: h.B("select-button"),
    onClick: l,
    variant: "outlined",
    endIcon: /* @__PURE__ */ t.jsx(D.Caret.Up, { className: h.BE("select-button", "indicator") }),
    ...c,
    children: a ?? (e == null ? void 0 : e[s])
  }
), se = S(ee), pe = ({
  data: e,
  value: s,
  columns: l = [],
  children: o = se,
  tagKey: a = "key",
  allowNone: c = !1,
  onChange: r,
  disabled: u,
  hideColumnHeader: d = !0
}) => {
  const { close: i, visible: n, toggle: p } = v(), [k, f] = $(
    (e == null ? void 0 : e.find((m) => m.key === s)) ?? null
  );
  F(() => {
    f((e == null ? void 0 : e.find((m) => m.key === s)) ?? null);
  }, [e, s]);
  const j = G(
    (m, x) => {
      if (i(), m == null)
        return f(null), r(s);
      f(x.entries[0]), r(m);
    },
    [r, s, i, f]
  );
  return /* @__PURE__ */ t.jsx(
    U,
    {
      close: i,
      data: e,
      visible: n,
      value: [s],
      onChange: j,
      allowMultiple: !1,
      allowNone: c,
      columns: l,
      hideColumnHeader: d,
      children: o({
        selected: k,
        renderKey: a,
        toggle: p,
        visible: n,
        disabled: u
      })
    }
  );
}, te = [
  {
    key: "h2",
    label: "XL"
  },
  {
    key: "h3",
    label: "L"
  },
  {
    key: "h4",
    label: "M"
  },
  {
    key: "p",
    label: "S"
  },
  {
    key: "small",
    label: "XS"
  }
], le = ({
  key: e,
  entry: s,
  onClick: l,
  selected: o
}) => /* @__PURE__ */ t.jsx(
  b,
  {
    variant: o ? "filled" : "outlined",
    onClick: l,
    children: s.label
  },
  e
), ne = ({
  children: e = le,
  ...s
}) => /* @__PURE__ */ t.jsx(q, { ...s, data: te, children: e }), ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  ComponentSizeLevels: I,
  CoreDateTime: H,
  DateTime: M,
  Editable: T,
  Keyboard: Z,
  LEVELS: w,
  LevelComponentSizes: R,
  Link: z,
  MaybeEditable: K,
  SelectLevel: ne,
  Symbols: N,
  Text: O,
  WithIcon: P,
  dimensions: V,
  edit: _,
  formatChildren: A,
  levelZ: W,
  specZ: X
}, Symbol.toStringTag, { value: "Module" }));
export {
  q as B,
  U as C,
  pe as D,
  ne as S,
  ee as a,
  se as d,
  ye as e
};
//# sourceMappingURL=external-nr751KOA.js.map
