import { jsx as r, jsxs as g } from "react/jsx-runtime";
import { createElement as f, useId as k } from "react";
import { a as j } from "./heading-gqtQNo5n.mjs";
import { c as n } from "./bind-CU-R61T-.mjs";
import { r as C } from "./close.es-BPmk2wkU.mjs";
const d = {
  "purpur-dismissable-chip-group": "_purpur-dismissable-chip-group_17jk4_1",
  "purpur-dismissable-chip-group__container": "_purpur-dismissable-chip-group__container_17jk4_7",
  "purpur-dismissable-chip-group__container--full-width": "_purpur-dismissable-chip-group__container--full-width_17jk4_14",
  "purpur-dismissable-chip-group-item-wrapper": "_purpur-dismissable-chip-group-item-wrapper_17jk4_17",
  "purpur-dismissable-chip-group-item": "_purpur-dismissable-chip-group-item_17jk4_17",
  "purpur-dismissable-chip-group-item--disabled": "_purpur-dismissable-chip-group-item--disabled_17jk4_43"
}, m = n.bind(d), l = "purpur-dismissable-chip-group-item", _ = ({
  children: p,
  id: s,
  onDismiss: e,
  disabled: i,
  ...a
}) => {
  const o = (u) => {
    i ? u.preventDefault() : e?.(s);
  };
  return /* @__PURE__ */ r("li", { className: m(`${l}-wrapper`), children: /* @__PURE__ */ f(
    "button",
    {
      ...a,
      className: m(`${l}`, {
        [`${l}--disabled`]: i
      }),
      key: s,
      disabled: i,
      "aria-disabled": i,
      onClick: o
    },
    p,
    /* @__PURE__ */ r(C, { size: "sm" })
  ) }, s);
};
_.displayName = "DismissableChipGroupItem";
const c = n.bind(d), t = "purpur-dismissable-chip-group", b = ({
  children: p,
  className: s,
  fullWidth: e = !1,
  title: i,
  titleTag: a,
  ...o
}) => {
  const u = k(), h = c([t, s]);
  return /* @__PURE__ */ g(
    "div",
    {
      ...o,
      "aria-labelledby": i ? `${u}-label` : void 0,
      className: h,
      role: "group",
      children: [
        i && /* @__PURE__ */ r(j, { tag: a ?? "h2", variant: "subsection-100", children: i }),
        /* @__PURE__ */ r(
          "ul",
          {
            "data-testid": "dismissable-chip-group-container",
            className: c(`${t}__container`, {
              [`${t}__container--full-width`]: e
            }),
            "aria-live": "polite",
            "aria-relevant": "additions removals",
            children: p
          }
        )
      ]
    }
  );
};
b.Item = _;
b.displayName = "DismissableChipGroup";
export {
  b as D
};
//# sourceMappingURL=dismissable-chip-group-Bl0D18qM.mjs.map
