@seij/common-ui-icons 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Icon.d.ts.map +1 -1
- package/dist/Icon.js +22 -14
- package/dist/Icon.js.map +1 -1
- package/package.json +1 -1
package/dist/Icon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../src/Icon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../src/Icon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAcxC,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,SAAS,EAAE,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG,SAAS,2CAQ1E"}
|
package/dist/Icon.js
CHANGED
|
@@ -1,32 +1,40 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import { iconLoaders as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense as a, lazy as s } from "react";
|
|
3
|
+
import { iconLoaders as l } from "./iconLoaders.js";
|
|
4
|
+
const c = {};
|
|
5
|
+
function h(t) {
|
|
6
|
+
const e = c[t];
|
|
7
|
+
if (e)
|
|
8
|
+
return e;
|
|
9
|
+
const r = s(l[t]);
|
|
10
|
+
return c[t] = r, r;
|
|
7
11
|
}
|
|
8
|
-
function
|
|
9
|
-
|
|
12
|
+
function g({ name: t, ...e }) {
|
|
13
|
+
const r = h(t), { size: o = 20, ...i } = e;
|
|
14
|
+
return /* @__PURE__ */ n(a, { fallback: /* @__PURE__ */ n(f, { size: o, ...e }), children: /* @__PURE__ */ n(r, { size: o, ...i }) });
|
|
15
|
+
}
|
|
16
|
+
function u({ size: t, children: e }) {
|
|
17
|
+
return /* @__PURE__ */ n(
|
|
10
18
|
"span",
|
|
11
19
|
{
|
|
12
20
|
style: {
|
|
13
21
|
display: "inline-flex",
|
|
14
|
-
width:
|
|
15
|
-
height:
|
|
22
|
+
width: t,
|
|
23
|
+
height: t,
|
|
16
24
|
alignItems: "center",
|
|
17
25
|
justifyContent: "center",
|
|
18
26
|
lineHeight: 0,
|
|
19
27
|
flex: "0 0 auto"
|
|
20
28
|
},
|
|
21
29
|
"aria-hidden": "true",
|
|
22
|
-
children:
|
|
30
|
+
children: e
|
|
23
31
|
}
|
|
24
32
|
);
|
|
25
33
|
}
|
|
26
|
-
function
|
|
27
|
-
return /* @__PURE__ */
|
|
34
|
+
function f({ size: t }) {
|
|
35
|
+
return /* @__PURE__ */ n(u, { size: t, children: /* @__PURE__ */ n("span", { style: { width: "100%", height: "100%", opacity: 0 } }) });
|
|
28
36
|
}
|
|
29
37
|
export {
|
|
30
|
-
|
|
38
|
+
g as Icon
|
|
31
39
|
};
|
|
32
40
|
//# sourceMappingURL=Icon.js.map
|
package/dist/Icon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.js","sources":["../src/Icon.tsx"],"sourcesContent":["import { lazy, PropsWithChildren, Suspense } from \"react\";\nimport type { IconName } from \"./iconNames\";\nimport { iconLoaders } from \"./iconLoaders\";\nimport { IconProps } from \"./IconProps\";\n\nexport function Icon({ name, ...iconProps }: { name: IconName } & IconProps) {\n const LazyIcon =
|
|
1
|
+
{"version":3,"file":"Icon.js","sources":["../src/Icon.tsx"],"sourcesContent":["import { lazy, PropsWithChildren, Suspense } from \"react\";\nimport type { IconName } from \"./iconNames\";\nimport { iconLoaders } from \"./iconLoaders\";\nimport { IconProps } from \"./IconProps\";\n\nconst lazyIconCache: Partial<Record<IconName, ReturnType<typeof lazy>>> = {};\n\nfunction getLazyIcon(name: IconName) {\n const cached = lazyIconCache[name];\n if (cached) {\n return cached;\n }\n const created = lazy(iconLoaders[name]);\n lazyIconCache[name] = created;\n return created;\n}\n\nexport function Icon({ name, ...iconProps }: { name: IconName } & IconProps) {\n const LazyIcon = getLazyIcon(name);\n const { size = 20, ...restProps } = iconProps;\n return (\n <Suspense fallback={<Placeholder size={size} {...iconProps} />}>\n <LazyIcon size={size} {...restProps} />\n </Suspense>\n );\n}\n\nfunction Box({ size, children }: { size: number } & PropsWithChildren) {\n return (\n <span\n style={{\n display: \"inline-flex\",\n width: size,\n height: size,\n alignItems: \"center\",\n justifyContent: \"center\",\n lineHeight: 0,\n flex: \"0 0 auto\",\n }}\n aria-hidden=\"true\"\n >\n {children}\n </span>\n );\n}\n\nfunction Placeholder({ size }: { size: number }) {\n return (\n <Box size={size}>\n <span style={{ width: \"100%\", height: \"100%\", opacity: 0 }} />\n </Box>\n );\n}\n"],"names":["lazyIconCache","getLazyIcon","name","cached","created","lazy","iconLoaders","Icon","iconProps","LazyIcon","size","restProps","jsx","Suspense","Placeholder","Box","children"],"mappings":";;;AAKA,MAAMA,IAAoE,CAAA;AAE1E,SAASC,EAAYC,GAAgB;AACnC,QAAMC,IAASH,EAAcE,CAAI;AACjC,MAAIC;AACF,WAAOA;AAET,QAAMC,IAAUC,EAAKC,EAAYJ,CAAI,CAAC;AACtC,SAAAF,EAAcE,CAAI,IAAIE,GACfA;AACT;AAEO,SAASG,EAAK,EAAE,MAAAL,GAAM,GAAGM,KAA6C;AAC3E,QAAMC,IAAWR,EAAYC,CAAI,GAC3B,EAAE,MAAAQ,IAAO,IAAI,GAAGC,MAAcH;AACpC,SACE,gBAAAI,EAACC,GAAA,EAAS,UAAU,gBAAAD,EAACE,KAAY,MAAAJ,GAAa,GAAGF,EAAA,CAAW,GAC1D,UAAA,gBAAAI,EAACH,GAAA,EAAS,MAAAC,GAAa,GAAGC,GAAW,GACvC;AAEJ;AAEA,SAASI,EAAI,EAAE,MAAAL,GAAM,UAAAM,KAAkD;AACrE,SACE,gBAAAJ;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,SAAS;AAAA,QACT,OAAOF;AAAA,QACP,QAAQA;AAAA,QACR,YAAY;AAAA,QACZ,gBAAgB;AAAA,QAChB,YAAY;AAAA,QACZ,MAAM;AAAA,MAAA;AAAA,MAER,eAAY;AAAA,MAEX,UAAAM;AAAA,IAAA;AAAA,EAAA;AAGP;AAEA,SAASF,EAAY,EAAE,MAAAJ,KAA0B;AAC/C,SACE,gBAAAE,EAACG,GAAA,EAAI,MAAAL,GACH,UAAA,gBAAAE,EAAC,UAAK,OAAO,EAAE,OAAO,QAAQ,QAAQ,QAAQ,SAAS,EAAA,GAAK,GAC9D;AAEJ;"}
|