laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
28 lines (27 loc) • 1.02 kB
JavaScript
"use client";
import { isValidElement as v } from "react";
import { FilteredElementKeyMap as f } from "./types.js";
import { isEventKey as m } from "./excludeEventProps.js";
import { isSvgElementPropKey as p } from "./svgPropertiesNoEvents.js";
var c = (r, i, a, t) => {
var e;
if (typeof i == "symbol" || typeof i == "number")
return !0;
var o = (e = t && (f === null || f === void 0 ? void 0 : f[t])) !== null && e !== void 0 ? e : [], n = i.startsWith("data-"), l = typeof r != "function" && (!!t && o.includes(i) || p(i)), u = !!a && m(i);
return n || l || u;
}, P = (r, i, a) => {
if (!r || typeof r == "function" || typeof r == "boolean")
return null;
var t = r;
if (/* @__PURE__ */ v(r) && (t = r.props), typeof t != "object" && typeof t != "function")
return null;
var e = {};
return Object.keys(t).forEach((o) => {
var n;
c((n = t) === null || n === void 0 ? void 0 : n[o], o, i, a) && (e[o] = t[o]);
}), e;
};
export {
P as filterProps,
c as isValidSpreadableProp
};