@stihl-design-system/components
Version:
Welcome to the STIHL Design System react component library.
38 lines (37 loc) • 1.16 kB
JavaScript
"use client";
import u from "react";
const l = (e) => typeof e != "number" || isNaN(e) ? 0 : e / 16, d = (e, r) => `[STIHL Design System] - [${e}]: ${r}`, m = (e, r) => `The "${e}" prop is required. Please add the "${e}" prop to the ${r} component.`, y = (e, r) => e == null ? void 0 : e.closest(r), c = (e, r, a) => {
let s = !1;
const n = {
fn: r,
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- any is needed here to allow any React component type to be checked
displayName: r.displayName || r.name
};
return u.Children.forEach(e, (t) => {
if (s || !u.isValidElement(t)) return;
if (t.type === n.fn) {
s = !0;
return;
}
const i = t.type, o = (
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- any is needed here to allow any React component type to be checked
i.displayName || i.name
);
if (typeof o == "string" && o === n.displayName) {
s = !0;
return;
}
const p = t.props;
if (a && p.children && c(p.children, n.fn, a)) {
s = !0;
return;
}
}), s;
};
export {
y as a,
c,
d as g,
l as p,
m as r
};