import { jsxs as x, jsx as i } from "react/jsx-runtime";
import { forwardRef as y, useCallback as d } from "react";
import { cx as B } from "../../utils/classNames.js";
import { useArrowTheme as u } from "../../hooks/useArrowTheme.js";
import { IconButton as a } from "../icon-button/IconButton.js";
function z() {
  return /* @__PURE__ */ i("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ i("path", { d: "M5 11h14v2H5z" }) });
}
function H() {
  return /* @__PURE__ */ i("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ i("path", { d: "M11 5h2v6h6v2h-6v6h-2v-6H5v-2h6z" }) });
}
function V() {
  return /* @__PURE__ */ i("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ i("path", { d: "M9 3h6l1 2h4v2H4V5h4l1-2Zm1 6h2v8h-2V9Zm4 0h2v8h-2V9ZM7 9h2v8H7V9Z" }) });
}
const Z = y(
  ({
    currentCount: h,
    a11yLabelIncrease: v = "Increase quantity",
    a11yLabelDecrease: o = "Decrease quantity",
    a11yLabelRemove: p = "Remove item",
    leftIcon: f = "minus",
    maxCount: t = 9,
    inverse: m,
    className: c,
    onIncrease: e,
    onDecrease: r,
    onRemove: s,
    ...n
  }, w) => {
    const g = u(), b = m ?? g.inverse, l = f === "delete" && h === 1, M = d(() => {
      if (l) {
        s == null || s();
        return;
      }
      h !== 0 && (r == null || r(Math.max(h - 1, 0)));
    }, [h, r, s, l]), k = d(() => {
      h >= t || e == null || e(Math.min(h + 1, t));
    }, [h, t, e]);
    return /* @__PURE__ */ x(
      "div",
      {
        ref: w,
        className: B("tdds-stepper", c),
        "data-inverse": b ? "true" : void 0,
        ...n,
        children: [
          /* @__PURE__ */ i(
            a,
            {
              a11yLabel: l ? p : o,
              icon: l ? /* @__PURE__ */ i(V, {}) : /* @__PURE__ */ i(z, {}),
              size: "small",
              background: "none",
              disabled: !l && h === 0,
              onClick: M
            }
          ),
          /* @__PURE__ */ i("span", { children: h }),
          /* @__PURE__ */ i(
            a,
            {
              a11yLabel: v,
              icon: /* @__PURE__ */ i(H, {}),
              size: "small",
              background: "none",
              disabled: h >= t,
              onClick: k
            }
          ),
          /* @__PURE__ */ i("div", { "aria-live": "polite" })
        ]
      }
    );
  }
);
Z.displayName = "Stepper";
export {
  Z as Stepper
};
//# sourceMappingURL=Stepper.js.map
