import { useState as f, useId as C, useCallback as E, useMemo as c } from "react";
function m({
  defaultExpanded: l = !1,
  expanded: a,
  onToggle: e
} = {}) {
  const [p, u] = f(l), s = a !== void 0, t = s ? a : p, d = C(), n = `trigger-${d}`, r = `content-${d}`, o = E(() => {
    const i = !t;
    s || u(i), e == null || e(i);
  }, [t, s, e]), x = c(
    () => ({
      "aria-expanded": t,
      "aria-controls": r,
      id: n,
      onClick: o
    }),
    [t, r, n, o]
  ), I = c(
    () => ({
      id: r,
      role: "region",
      "aria-labelledby": n,
      hidden: t ? void 0 : !0
    }),
    [r, n, t]
  );
  return {
    isExpanded: t,
    toggle: o,
    triggerProps: x,
    contentProps: I
  };
}
export {
  m as useExpandCollapse
};
//# sourceMappingURL=useExpandCollapse.js.map
