UNPKG

welcome-ui

Version:

Customizable design system with react • styled-components • styled-system and ariakit.

38 lines (37 loc) 1.47 kB
"use client"; import { u as P } from "./X5NMLKT6-Ctro4-UX.mjs"; import { u as _ } from "./VGCJ63VH-C4H4_vtu.mjs"; import { f as b, c as k, _ as x, i as S, u as O, a as R, b as N, d as h, e as w, g as c, h as y } from "./LVA2YJMS-B8X1PCyC.mjs"; import { useRef as B, useState as M, useEffect as T } from "react"; var V = "button", j = Symbol("disclosure"), H = k( function(n) { var o = n, { store: e, toggleOnClick: p = !0 } = o, s = x(o, ["store", "toggleOnClick"]); const f = _(); 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 = B(null), [m, v] = M(!1), r = e.useState("disclosureElement"), a = e.useState("open"); T(() => { 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())); }), i = e.useState("contentElement"); return s = h(c(c({ "aria-expanded": m, "aria-controls": i == null ? void 0 : i.id }, g), s), { ref: w(u, s.ref), onClick: C }), s = P(s), s; } ), G = b(function(n) { const o = H(n); return y(V, o); }); export { G as D, H as u };