UNPKG

@cerberus-design/react

Version:

The Cerberus Design React component library.

33 lines (31 loc) 897 B
import { CerberusPrimitive } from "./chunk-BKPIKVU2.js"; // src/system/factory.ts import { ark } from "@ark-ui/react/factory"; function cerberusFactory(component, defaultProps) { const { withNoRecipe } = new CerberusPrimitive(); const arkComponent = ark[component]; if (arkComponent) { return withNoRecipe(arkComponent, { defaultProps: defaultProps ?? {} }); } throw new Error( `Component "${String(component)}" is not a valid Cerberus component. Please check the component name.` ); } var cache = /* @__PURE__ */ new Map(); var cerberusFactoryProxy = new Proxy(cerberusFactory, { apply(target, thisArg, argArray) { return target.apply(thisArg, argArray); }, get(_target, el) { if (!cache.has(el)) { cache.set(el, cerberusFactory(el)); } return cache.get(el); } }); export { cerberusFactoryProxy }; //# sourceMappingURL=chunk-ZFONE65Q.js.map