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