import { jsx as t, jsxs as i, Fragment as j } from "react/jsx-runtime";
import { forwardRef as A } from "react";
import { cx as m } from "../../utils/classNames.js";
import { useArrowTheme as C } from "../../hooks/useArrowTheme.js";
import { Divider as k } from "../divider/Divider.js";
const q = A(
  ({ children: n, background: s, inverse: l, className: c }, e) => {
    const r = C(), d = l ?? r.inverse;
    return /* @__PURE__ */ t(
      "ul",
      {
        ref: e,
        className: m("tdds-list", c),
        "data-version": "v2",
        "data-inverse": d ? "true" : void 0,
        "data-background": s || void 0,
        role: "list",
        children: n
      }
    );
  }
);
q.displayName = "List";
const w = A(
  ({
    label: n,
    labelId: s,
    body: l,
    status: c,
    leadingDecorationType: e,
    leadingImage: r,
    leadingIcon: d,
    leadingDecorationA11yLabel: D,
    dividerPosition: v = "bottom",
    trailingContent: u,
    navigationUrl: h,
    inverse: E,
    focused: F,
    className: _,
    children: f
  }, p) => {
    const I = C(), o = E ?? I.inverse;
    if (f)
      return /* @__PURE__ */ t(
        "li",
        {
          ref: p,
          className: m("tdds-list-item", _),
          "data-inverse": o ? "true" : void 0,
          role: "listitem",
          children: f
        }
      );
    if (!n)
      return null;
    const R = /* @__PURE__ */ i(j, { children: [
      /* @__PURE__ */ t("div", { className: "tdds-list-item__label", children: n }),
      l == null ? void 0 : l.map(
        (a, g) => a.text ? /* @__PURE__ */ i("div", { className: "tdds-list-item__optional-copy", children: [
          a.icon ?? null,
          a.text
        ] }, g) : null
      )
    ] }), $ = e ? /* @__PURE__ */ i(
      "div",
      {
        className: "tdds-list-item__leading-decoration",
        "data-image-type": e,
        id: s ? `${s}-leading-decoration` : void 0,
        children: [
          e === "icon" && d ? d : null,
          e !== "icon" && r ? /* @__PURE__ */ t("img", { src: r, alt: D || "" }) : null
        ]
      }
    ) : null, N = /* @__PURE__ */ i("div", { className: "tdds-list-item__content", children: [
      $,
      /* @__PURE__ */ i("div", { className: "tdds-list-item__main-content", id: s || void 0, children: [
        R,
        c ?? null
      ] }),
      u ? /* @__PURE__ */ t("div", { className: "tdds-list-item__trailing-content", children: u }) : null
    ] }), x = v === "top" ? /* @__PURE__ */ t(k, { inverse: o }) : null, L = v === "bottom" ? /* @__PURE__ */ t(k, { inverse: o }) : null;
    return /* @__PURE__ */ t(
      "li",
      {
        ref: p,
        className: m("tdds-list-item", _),
        "data-inverse": o ? "true" : void 0,
        role: "listitem",
        children: h ? /* @__PURE__ */ i(
          "a",
          {
            href: h,
            className: m({ "force-focus": !!F }),
            children: [
              x,
              N,
              L
            ]
          }
        ) : /* @__PURE__ */ i(j, { children: [
          x,
          N,
          L
        ] })
      }
    );
  }
);
w.displayName = "ListItem";
export {
  q as List,
  w as ListItem
};
//# sourceMappingURL=List.js.map
