UNPKG

one

Version:

One is a React framework for web, iOS, and Android apps.

1 lines • 1.18 kB
{"version":3,"file":"withStaticProperties.js","names":[],"sources":["esm/utils/withStaticProperties.js"],"sourcesContent":["import React from \"react\";\nconst Decorated = /* @__PURE__ */ Symbol();\nconst withStaticProperties = (component, staticProps) => {\n const next = (() => {\n if (component[Decorated]) {\n const _ = React.forwardRef(\n (props, ref) => React.createElement(component, { ...props, ref })\n );\n for (const key in component) {\n const v = component[key];\n _[key] = v && typeof v === \"object\" ? { ...v } : v;\n }\n }\n return component;\n })();\n Object.assign(next, staticProps);\n next[Decorated] = true;\n return next;\n};\nexport {\n withStaticProperties\n};\n//# sourceMappingURL=withStaticProperties.js.map\n"],"mappings":";;;AACA,MAAM,YAA4B,uBAAO;AACzC,MAAM,wBAAwB,WAAW,gBAAgB;CACvD,MAAM,cAAc;EAClB,IAAI,UAAU,YAAY;GACxB,MAAM,IAAI,MAAM,YACb,OAAO,QAAQ,MAAM,cAAc,WAAW;IAAE,GAAG;IAAO;GAAI,CAAC,CAClE;GACA,KAAK,MAAM,OAAO,WAAW;IAC3B,MAAM,IAAI,UAAU;IACpB,EAAE,OAAO,KAAK,OAAO,MAAM,WAAW,EAAE,GAAG,EAAE,IAAI;GACnD;EACF;EACA,OAAO;CACT,EAAC,CAAE;CACH,OAAO,OAAO,MAAM,WAAW;CAC/B,KAAK,aAAa;CAClB,OAAO;AACT"}