UNPKG

@konstructio/ui

Version:

A set of reusable and customizable React components built for konstruct.io

75 lines (74 loc) 2.52 kB
import { t as g } from "./dist-C4El7dZ5.js"; import * as e from "react"; import { jsx as y } from "react/jsx-runtime"; var S = /* @__PURE__ */ Symbol.for("react.lazy"), p = e[" use ".trim().toString()]; function E(t) { return typeof t == "object" && t !== null && "then" in t; } function d(t) { return t != null && typeof t == "object" && "$$typeof" in t && t.$$typeof === S && "_payload" in t && E(t._payload); } // @__NO_SIDE_EFFECTS__ function C(t) { const n = /* @__PURE__ */ _(t), o = e.forwardRef((i, r) => { let { children: l, ...s } = i; d(l) && typeof p == "function" && (l = p(l._payload)); const a = e.Children.toArray(l), c = a.find(b); if (c) { const f = c.props.children, m = a.map((u) => u === c ? e.Children.count(f) > 1 ? e.Children.only(null) : e.isValidElement(f) ? f.props.children : null : u); return /* @__PURE__ */ y(n, { ...s, ref: r, children: e.isValidElement(f) ? e.cloneElement(f, void 0, m) : null }); } return /* @__PURE__ */ y(n, { ...s, ref: r, children: l }); }); return o.displayName = `${t}.Slot`, o; } var V = /* @__PURE__ */ C("Slot"); // @__NO_SIDE_EFFECTS__ function _(t) { const n = e.forwardRef((o, i) => { let { children: r, ...l } = o; if (d(r) && typeof p == "function" && (r = p(r._payload)), e.isValidElement(r)) { const s = $(r), a = h(l, r.props); return r.type !== e.Fragment && (a.ref = i ? g(i, s) : s), e.cloneElement(r, a); } return e.Children.count(r) > 1 ? e.Children.only(null) : null; }); return n.displayName = `${t}.SlotClone`, n; } var R = /* @__PURE__ */ Symbol("radix.slottable"); function b(t) { return e.isValidElement(t) && typeof t.type == "function" && "__radixId" in t.type && t.type.__radixId === R; } function h(t, n) { const o = { ...n }; for (const i in n) { const r = t[i], l = n[i]; /^on[A-Z]/.test(i) ? r && l ? o[i] = (...s) => { const a = l(...s); return r(...s), a; } : r && (o[i] = r) : i === "style" ? o[i] = { ...r, ...l } : i === "className" && (o[i] = [r, l].filter(Boolean).join(" ")); } return { ...t, ...o }; } function $(t) { let n = Object.getOwnPropertyDescriptor(t.props, "ref")?.get, o = n && "isReactWarning" in n && n.isReactWarning; return o ? t.ref : (n = Object.getOwnPropertyDescriptor(t, "ref")?.get, o = n && "isReactWarning" in n && n.isReactWarning, o ? t.props.ref : t.props.ref || t.ref); } export { C as n, V as t };