import { j as e } from "../../_virtual/jsx-runtime.js";
import { createRef as I, useState as L, useEffect as h } from "react";
import { ListItemFlexContainer as W } from "./styles.js";
import { getListItemWrapperByVariant as v } from "./utils.js";
import { ListItemPrefix as y } from "./components/ListItemPrefix/index.js";
import { ListItemContent as x } from "./components/ListItemContent/index.js";
import { ListItemSuffix as C } from "./components/ListItemSuffix/index.js";
import { noop as T } from "../../utils/index.js";
const B = (o) => {
  const {
    variant: t = "default",
    state: f = "default",
    primaryText: m,
    prefix: r,
    suffix: i,
    divider: c = !1,
    dividerStartsFromText: d = !1,
    disabled: n,
    onClick: l
  } = o, p = v(t), s = I(), [u, j] = L(0);
  return h(() => {
    var a;
    (a = s.current) != null && a.clientWidth && j(s.current.clientWidth);
  }, [s.current, r]), /* @__PURE__ */ e.jsx(
    p,
    {
      divider: c,
      onClick: f === "default" && !n ? l : T,
      state: f,
      prefixWidth: u,
      dividerStartsFromText: d,
      disabled: n,
      children: /* @__PURE__ */ e.jsxs(W, { variant: t, children: [
        r && /* @__PURE__ */ e.jsx(y, { prefix: r, variant: t, ref: s }),
        o.variant === "multi-line" ? /* @__PURE__ */ e.jsx(
          x,
          {
            primaryText: m,
            secondaryText: o.secondaryText,
            variant: t,
            prefix: r,
            suffix: i
          }
        ) : /* @__PURE__ */ e.jsx(
          x,
          {
            primaryText: m,
            variant: t,
            prefix: r,
            suffix: i
          }
        ),
        i && /* @__PURE__ */ e.jsx(C, { suffix: i, variant: t })
      ] })
    }
  );
};
export {
  B as ListItem
};
