welcome-ui
Version:
Customizable design system with react, typescript, tailwindcss and ariakit.
38 lines (37 loc) • 1.46 kB
JavaScript
"use client";
import { c as P } from "./T22PY7TE-BxbmImwX.js";
import { u as _ } from "./XCKGTAUF-DkxWCbaW.js";
import { f as b, c as k, _ as x, i as S, l as O, L as R, u as N, d as w, p as y, a as i, b as B } from "./OE2EFRVA-C3721cM3.js";
import { useRef as M, useState as T, useEffect as V } from "react";
var h = "button", j = Symbol("disclosure"), H = k(
function(n) {
var o = n, { store: e, toggleOnClick: p = !0 } = o, s = x(o, ["store", "toggleOnClick"]);
const f = P();
e = e || f, S(
e,
process.env.NODE_ENV !== "production" && "Disclosure must receive a `store` prop or be wrapped in a DisclosureProvider component."
);
const u = M(null), [m, v] = T(!1), r = e.useState("disclosureElement"), a = e.useState("open");
V(() => {
let t = r === u.current;
r != null && r.isConnected || (e == null || e.setDisclosureElement(u.current), t = !0), v(a && t);
}, [r, e, a]);
const l = s.onClick, D = O(p), [E, g] = R(s, j, !0), C = N((t) => {
l == null || l(t), !t.defaultPrevented && (E || D(t) && (e == null || e.setDisclosureElement(t.currentTarget), e == null || e.toggle()));
}), c = e.useState("contentElement");
return s = w(i(i({
"aria-expanded": m,
"aria-controls": c == null ? void 0 : c.id
}, g), s), {
ref: y(u, s.ref),
onClick: C
}), s = _(s), s;
}
), F = b(function(n) {
const o = H(n);
return B(h, o);
});
export {
F as D,
H as u
};