@puzzle-ui/icons 0.3.0 → 0.5.0

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/README.md CHANGED
@@ -42,16 +42,6 @@ For icon-only controls, label the control and keep its icon decorative:
42
42
  </button>
43
43
  ```
44
44
 
45
- ## Server rendering
46
-
47
- The package also exports `SSRIcon` and `SSRIconProps`. `SSRIcon` is an async
48
- component that fetches icon data on the server and falls back to Iconify's
49
- client-side loading when data is unavailable.
50
-
51
- Use it only in rendering environments that support async components, such
52
- as an appropriate React Server Component setup. It is not a drop-in async
53
- component for ordinary client-side React rendering.
54
-
55
45
  Icon loading can make external requests to Iconify. Account for network
56
46
  availability and your Content Security Policy. Framework compatibility is
57
47
  still being evaluated.
@@ -59,7 +49,6 @@ still being evaluated.
59
49
  ## Exports
60
50
 
61
51
  - `Icon`, `IconProps`
62
- - `SSRIcon`, `SSRIconProps`
63
52
 
64
53
  Import from `@puzzle-ui/icons`; generated internal icon-set files are not
65
54
  exported package entry points. ESM and CommonJS builds and TypeScript
package/dist/index.cjs CHANGED
@@ -1,62 +1,50 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let _iconify_react = require("@iconify/react");
3
3
  let react_jsx_runtime = require("react/jsx-runtime");
4
- let _iconify_utils = require("@iconify/utils");
5
4
  // src/icon.tsx
6
- const Icon = ({ name, size, color, ...props }) => {
5
+ const Icon = ({ name, size, color, showLoader = false, style, children, ...props }) => {
6
+ const iconStyle = {
7
+ display: "inline-block",
8
+ flexShrink: 0,
9
+ verticalAlign: "middle",
10
+ ...style,
11
+ color: color ?? style?.color,
12
+ width: size !== void 0 ? size : style?.width ?? props.width,
13
+ height: size !== void 0 ? size : style?.height ?? props.height
14
+ };
7
15
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_iconify_react.Icon, {
8
16
  ...props,
9
17
  icon: name ?? "",
10
- width: size,
11
- height: size,
12
- style: {
13
- color,
14
- width: size ? `${size}px` : void 0,
15
- height: size ? `${size}px` : void 0
16
- }
17
- });
18
- };
19
- // src/ssr-icon.tsx
20
- async function fetchIconDataServer(iconName) {
21
- const iconObj = (0, _iconify_utils.stringToIcon)(iconName);
22
- if (!iconObj) return null;
23
- try {
24
- const response = await fetch(`https://iconify.design/${iconObj.prefix}.json?icons=${iconObj.name}`);
25
- if (!response.ok) return null;
26
- const json = await response.json();
27
- return (0, _iconify_utils.getIconData)(json, iconObj.name);
28
- } catch (error) {
29
- console.error(`[SSR] Error fetching icon ${iconName}:`, error);
30
- return null;
31
- }
32
- }
33
- const SSRIcon = async ({ name, size, color, ...props }) => {
34
- const iconData = await fetchIconDataServer(name);
35
- if (iconData) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_iconify_react.Icon, {
36
- ...props,
37
- icon: iconData,
38
- width: size,
39
- height: size,
40
- style: {
41
- color,
42
- width: size ? `${size}px` : void 0,
43
- height: size ? `${size}px` : void 0
44
- }
45
- });
46
- console.warn(`[SSR] Fallback to client-side for icon: ${name}`);
47
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_iconify_react.Icon, {
48
- ...props,
49
- icon: name ?? "",
50
- width: size,
51
- height: size,
52
- style: {
53
- color,
54
- width: size ? `${size}px` : void 0,
55
- height: size ? `${size}px` : void 0
56
- }
18
+ width: size ?? props.width ?? "1em",
19
+ height: size ?? props.height ?? "1em",
20
+ style: iconStyle,
21
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
22
+ ...props,
23
+ width: size ?? props.width ?? "1em",
24
+ height: size ?? props.height ?? "1em",
25
+ style: iconStyle,
26
+ viewBox: "0 0 100 100",
27
+ children: showLoader ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: `
28
+ @keyframes puzzle-icon-loading { from { opacity: 1; } to { opacity: 0.2; } }
29
+ .puzzle-icon-loading-bar { animation: puzzle-icon-loading 1.2s linear infinite; }
30
+ @media (prefers-reduced-motion: reduce) { .puzzle-icon-loading-bar { animation: none; } }
31
+ ` }), Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
32
+ className: "puzzle-icon-loading-bar",
33
+ x: "47",
34
+ y: "4",
35
+ width: "6",
36
+ height: "24",
37
+ rx: "3",
38
+ fill: iconStyle.color ?? "currentColor",
39
+ transform: `rotate(${index * 30} 50 50)`,
40
+ style: {
41
+ animationDelay: `${index * .1}s`,
42
+ opacity: (index + 1) / 12
43
+ }
44
+ }, index))] }) : children
45
+ })
57
46
  });
58
47
  };
59
48
  exports.Icon = Icon;
60
- exports.SSRIcon = SSRIcon;
61
49
 
62
50
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["IconifyIcon","stringToIcon","getIconData","IconifyIcon"],"sources":["../src/icon.tsx","../src/ssr-icon.tsx"],"sourcesContent":["import { Icon as IconifyIcon } from \"@iconify/react\";\nimport type { ComponentProps } from \"react\";\n\ntype IconProps = Omit<ComponentProps<\"svg\">, \"mode\" | \"onLoad\" | \"rotate\"> & {\n name: string;\n size?: number;\n color?: string;\n};\n\nconst Icon = ({ name, size, color, ...props }: IconProps) => {\n return (\n <IconifyIcon\n {...props}\n icon={name ?? \"\"}\n width={size}\n height={size}\n style={{\n color: color,\n width: size ? `${size}px` : undefined,\n height: size ? `${size}px` : undefined,\n }}\n />\n );\n};\n\nexport { Icon, type IconProps };\n","import { Icon as IconifyIcon } from \"@iconify/react\";\nimport type { ComponentProps } from \"react\";\nimport { getIconData, stringToIcon } from \"@iconify/utils\";\n\nasync function fetchIconDataServer(iconName: string) {\n const iconObj = stringToIcon(iconName);\n if (!iconObj) return null;\n\n try {\n const response = await fetch(\n `https://iconify.design/${iconObj.prefix}.json?icons=${iconObj.name}`,\n );\n if (!response.ok) return null;\n\n const json = await response.json();\n return getIconData(json, iconObj.name);\n } catch (error) {\n console.error(`[SSR] Error fetching icon ${iconName}:`, error);\n return null;\n }\n}\n\ntype SSRIconProps = Omit<\n ComponentProps<\"svg\">,\n \"mode\" | \"onLoad\" | \"rotate\"\n> & {\n name: string;\n size?: number;\n color?: string;\n};\n\nconst SSRIcon = async ({ name, size, color, ...props }: SSRIconProps) => {\n const iconData = await fetchIconDataServer(name);\n if (iconData) {\n return (\n <IconifyIcon\n {...props}\n icon={iconData}\n width={size}\n height={size}\n style={{\n color: color,\n width: size ? `${size}px` : undefined,\n height: size ? `${size}px` : undefined,\n }}\n />\n );\n }\n console.warn(`[SSR] Fallback to client-side for icon: ${name}`);\n return (\n <IconifyIcon\n {...props}\n icon={name ?? \"\"}\n width={size}\n height={size}\n style={{\n color: color,\n width: size ? `${size}px` : undefined,\n height: size ? `${size}px` : undefined,\n }}\n />\n );\n};\n\nexport { SSRIcon, type SSRIconProps };\n"],"mappings":";;;;;AASA,MAAM,QAAQ,EAAE,MAAM,MAAM,OAAO,GAAG,YAAuB;CAC3D,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,eAAAA,MAAD;EACE,GAAI;EACJ,MAAM,QAAQ;EACd,OAAO;EACP,QAAQ;EACR,OAAO;GACE;GACP,OAAO,OAAO,GAAG,KAAK,MAAM,KAAA;GAC5B,QAAQ,OAAO,GAAG,KAAK,MAAM,KAAA;EAC/B;CACD,CAAA;AAEL;;ACnBA,eAAe,oBAAoB,UAAkB;CACnD,MAAM,WAAA,GAAUC,eAAAA,aAAAA,CAAa,QAAQ;CACrC,IAAI,CAAC,SAAS,OAAO;CAErB,IAAI;EACF,MAAM,WAAW,MAAM,MACrB,0BAA0B,QAAQ,OAAO,cAAc,QAAQ,MACjE;EACA,IAAI,CAAC,SAAS,IAAI,OAAO;EAEzB,MAAM,OAAO,MAAM,SAAS,KAAK;EACjC,QAAA,GAAOC,eAAAA,YAAAA,CAAY,MAAM,QAAQ,IAAI;CACvC,SAAS,OAAO;EACd,QAAQ,MAAM,6BAA6B,SAAS,IAAI,KAAK;EAC7D,OAAO;CACT;AACF;AAWA,MAAM,UAAU,OAAO,EAAE,MAAM,MAAM,OAAO,GAAG,YAA0B;CACvE,MAAM,WAAW,MAAM,oBAAoB,IAAI;CAC/C,IAAI,UACF,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,eAAAA,MAAD;EACE,GAAI;EACJ,MAAM;EACN,OAAO;EACP,QAAQ;EACR,OAAO;GACE;GACP,OAAO,OAAO,GAAG,KAAK,MAAM,KAAA;GAC5B,QAAQ,OAAO,GAAG,KAAK,MAAM,KAAA;EAC/B;CACD,CAAA;CAGL,QAAQ,KAAK,2CAA2C,MAAM;CAC9D,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,eAAAA,MAAD;EACE,GAAI;EACJ,MAAM,QAAQ;EACd,OAAO;EACP,QAAQ;EACR,OAAO;GACE;GACP,OAAO,OAAO,GAAG,KAAK,MAAM,KAAA;GAC5B,QAAQ,OAAO,GAAG,KAAK,MAAM,KAAA;EAC/B;CACD,CAAA;AAEL"}
1
+ {"version":3,"file":"index.cjs","names":["IconifyIcon"],"sources":["../src/icon.tsx"],"sourcesContent":["import { Icon as IconifyIcon } from \"@iconify/react\";\nimport type { ComponentProps, CSSProperties } from \"react\";\n\ntype IconProps = Omit<ComponentProps<\"svg\">, \"mode\" | \"onLoad\" | \"rotate\"> & {\n name: string;\n size?: number;\n color?: string;\n showLoader?: boolean;\n};\n\nconst Icon = ({\n name,\n size,\n color,\n showLoader = false,\n style,\n children,\n ...props\n}: IconProps) => {\n const iconStyle: CSSProperties = {\n display: \"inline-block\",\n flexShrink: 0,\n verticalAlign: \"middle\",\n ...style,\n color: color ?? style?.color,\n width: size !== undefined ? size : (style?.width ?? props.width),\n height: size !== undefined ? size : (style?.height ?? props.height),\n };\n\n return (\n <IconifyIcon\n {...props}\n icon={name ?? \"\"}\n width={size ?? props.width ?? \"1em\"}\n height={size ?? props.height ?? \"1em\"}\n style={iconStyle}\n >\n <svg\n {...props}\n width={size ?? props.width ?? \"1em\"}\n height={size ?? props.height ?? \"1em\"}\n style={iconStyle}\n viewBox=\"0 0 100 100\"\n >\n {showLoader ? (\n <>\n <style>{`\n @keyframes puzzle-icon-loading { from { opacity: 1; } to { opacity: 0.2; } }\n .puzzle-icon-loading-bar { animation: puzzle-icon-loading 1.2s linear infinite; }\n @media (prefers-reduced-motion: reduce) { .puzzle-icon-loading-bar { animation: none; } }\n `}</style>\n {Array.from({ length: 12 }, (_, index) => (\n <rect\n key={index}\n className=\"puzzle-icon-loading-bar\"\n x=\"47\"\n y=\"4\"\n width=\"6\"\n height=\"24\"\n rx=\"3\"\n fill={iconStyle.color ?? \"currentColor\"}\n transform={`rotate(${index * 30} 50 50)`}\n style={{\n animationDelay: `${index * 0.1}s`,\n opacity: (index + 1) / 12,\n }}\n />\n ))}\n </>\n ) : (\n children\n )}\n </svg>\n </IconifyIcon>\n );\n};\n\nexport { Icon, type IconProps };\n"],"mappings":";;;;AAUA,MAAM,QAAQ,EACZ,MACA,MACA,OACA,aAAa,OACb,OACA,UACA,GAAG,YACY;CACf,MAAM,YAA2B;EAC/B,SAAS;EACT,YAAY;EACZ,eAAe;EACf,GAAG;EACH,OAAO,SAAS,OAAO;EACvB,OAAO,SAAS,KAAA,IAAY,OAAQ,OAAO,SAAS,MAAM;EAC1D,QAAQ,SAAS,KAAA,IAAY,OAAQ,OAAO,UAAU,MAAM;CAC9D;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,eAAAA,MAAD;EACE,GAAI;EACJ,MAAM,QAAQ;EACd,OAAO,QAAQ,MAAM,SAAS;EAC9B,QAAQ,QAAQ,MAAM,UAAU;EAChC,OAAO;EAEP,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GACE,GAAI;GACJ,OAAO,QAAQ,MAAM,SAAS;GAC9B,QAAQ,QAAQ,MAAM,UAAU;GAChC,OAAO;GACP,SAAQ;GAEP,UAAA,aACC,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,SAAD,EAAA,UAAQ;;;;cAIC,CAAA,GACR,MAAM,KAAK,EAAE,QAAQ,GAAG,IAAI,GAAG,UAC9B,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IAEE,WAAU;IACV,GAAE;IACF,GAAE;IACF,OAAM;IACN,QAAO;IACP,IAAG;IACH,MAAM,UAAU,SAAS;IACzB,WAAW,UAAU,QAAQ,GAAG;IAChC,OAAO;KACL,gBAAgB,GAAG,QAAQ,GAAI;KAC/B,UAAU,QAAQ,KAAK;IACzB;GACD,GAbM,KAaN,CACF,CACD,EAAA,CAAA,IAEF;EAEC,CAAA;CACM,CAAA;AAEjB"}
package/dist/index.d.cts CHANGED
@@ -5,10 +5,4 @@ type IconProps = Omit<ComponentProps<"svg">, "mode" | "onLoad" | "rotate"> & {
5
5
  color?: string;
6
6
  };
7
7
  declare const Icon: ({ name, size, color, ...props }: IconProps) => import("react").JSX.Element;
8
- type SSRIconProps = Omit<ComponentProps<"svg">, "mode" | "onLoad" | "rotate"> & {
9
- name: string;
10
- size?: number;
11
- color?: string;
12
- };
13
- declare const SSRIcon: ({ name, size, color, ...props }: SSRIconProps) => Promise<import("react").JSX.Element>;
14
- export { Icon, type IconProps, SSRIcon, type SSRIconProps };
8
+ export { Icon, type IconProps };
package/dist/index.d.ts CHANGED
@@ -3,12 +3,7 @@ type IconProps = Omit<ComponentProps<"svg">, "mode" | "onLoad" | "rotate"> & {
3
3
  name: string;
4
4
  size?: number;
5
5
  color?: string;
6
+ showLoader?: boolean;
6
7
  };
7
- declare const Icon: ({ name, size, color, ...props }: IconProps) => import("react").JSX.Element;
8
- type SSRIconProps = Omit<ComponentProps<"svg">, "mode" | "onLoad" | "rotate"> & {
9
- name: string;
10
- size?: number;
11
- color?: string;
12
- };
13
- declare const SSRIcon: ({ name, size, color, ...props }: SSRIconProps) => Promise<import("react").JSX.Element>;
14
- export { Icon, type IconProps, SSRIcon, type SSRIconProps };
8
+ declare const Icon: ({ name, size, color, showLoader, style, children, ...props }: IconProps) => import("react").JSX.Element;
9
+ export { Icon, type IconProps };
package/dist/index.js CHANGED
@@ -1,60 +1,49 @@
1
1
  import { Icon as Icon$1 } from "@iconify/react";
2
- import { jsx } from "react/jsx-runtime";
3
- import { getIconData, stringToIcon } from "@iconify/utils";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
3
  // src/icon.tsx
5
- const Icon = ({ name, size, color, ...props }) => {
4
+ const Icon = ({ name, size, color, showLoader = false, style, children, ...props }) => {
5
+ const iconStyle = {
6
+ display: "inline-block",
7
+ flexShrink: 0,
8
+ verticalAlign: "middle",
9
+ ...style,
10
+ color: color ?? style?.color,
11
+ width: size !== void 0 ? size : style?.width ?? props.width,
12
+ height: size !== void 0 ? size : style?.height ?? props.height
13
+ };
6
14
  return /* @__PURE__ */ jsx(Icon$1, {
7
15
  ...props,
8
16
  icon: name ?? "",
9
- width: size,
10
- height: size,
11
- style: {
12
- color,
13
- width: size ? `${size}px` : void 0,
14
- height: size ? `${size}px` : void 0
15
- }
17
+ width: size ?? props.width ?? "1em",
18
+ height: size ?? props.height ?? "1em",
19
+ style: iconStyle,
20
+ children: /* @__PURE__ */ jsx("svg", {
21
+ ...props,
22
+ width: size ?? props.width ?? "1em",
23
+ height: size ?? props.height ?? "1em",
24
+ style: iconStyle,
25
+ viewBox: "0 0 100 100",
26
+ children: showLoader ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("style", { children: `
27
+ @keyframes puzzle-icon-loading { from { opacity: 1; } to { opacity: 0.2; } }
28
+ .puzzle-icon-loading-bar { animation: puzzle-icon-loading 1.2s linear infinite; }
29
+ @media (prefers-reduced-motion: reduce) { .puzzle-icon-loading-bar { animation: none; } }
30
+ ` }), Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ jsx("rect", {
31
+ className: "puzzle-icon-loading-bar",
32
+ x: "47",
33
+ y: "4",
34
+ width: "6",
35
+ height: "24",
36
+ rx: "3",
37
+ fill: iconStyle.color ?? "currentColor",
38
+ transform: `rotate(${index * 30} 50 50)`,
39
+ style: {
40
+ animationDelay: `${index * .1}s`,
41
+ opacity: (index + 1) / 12
42
+ }
43
+ }, index))] }) : children
44
+ })
16
45
  });
17
46
  };
18
- // src/ssr-icon.tsx
19
- async function fetchIconDataServer(iconName) {
20
- const iconObj = stringToIcon(iconName);
21
- if (!iconObj) return null;
22
- try {
23
- const response = await fetch(`https://iconify.design/${iconObj.prefix}.json?icons=${iconObj.name}`);
24
- if (!response.ok) return null;
25
- const json = await response.json();
26
- return getIconData(json, iconObj.name);
27
- } catch (error) {
28
- console.error(`[SSR] Error fetching icon ${iconName}:`, error);
29
- return null;
30
- }
31
- }
32
- const SSRIcon = async ({ name, size, color, ...props }) => {
33
- const iconData = await fetchIconDataServer(name);
34
- if (iconData) return /* @__PURE__ */ jsx(Icon$1, {
35
- ...props,
36
- icon: iconData,
37
- width: size,
38
- height: size,
39
- style: {
40
- color,
41
- width: size ? `${size}px` : void 0,
42
- height: size ? `${size}px` : void 0
43
- }
44
- });
45
- console.warn(`[SSR] Fallback to client-side for icon: ${name}`);
46
- return /* @__PURE__ */ jsx(Icon$1, {
47
- ...props,
48
- icon: name ?? "",
49
- width: size,
50
- height: size,
51
- style: {
52
- color,
53
- width: size ? `${size}px` : void 0,
54
- height: size ? `${size}px` : void 0
55
- }
56
- });
57
- };
58
- export { Icon, SSRIcon };
47
+ export { Icon };
59
48
 
60
49
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["IconifyIcon","IconifyIcon"],"sources":["../src/icon.tsx","../src/ssr-icon.tsx"],"sourcesContent":["import { Icon as IconifyIcon } from \"@iconify/react\";\nimport type { ComponentProps } from \"react\";\n\ntype IconProps = Omit<ComponentProps<\"svg\">, \"mode\" | \"onLoad\" | \"rotate\"> & {\n name: string;\n size?: number;\n color?: string;\n};\n\nconst Icon = ({ name, size, color, ...props }: IconProps) => {\n return (\n <IconifyIcon\n {...props}\n icon={name ?? \"\"}\n width={size}\n height={size}\n style={{\n color: color,\n width: size ? `${size}px` : undefined,\n height: size ? `${size}px` : undefined,\n }}\n />\n );\n};\n\nexport { Icon, type IconProps };\n","import { Icon as IconifyIcon } from \"@iconify/react\";\nimport type { ComponentProps } from \"react\";\nimport { getIconData, stringToIcon } from \"@iconify/utils\";\n\nasync function fetchIconDataServer(iconName: string) {\n const iconObj = stringToIcon(iconName);\n if (!iconObj) return null;\n\n try {\n const response = await fetch(\n `https://iconify.design/${iconObj.prefix}.json?icons=${iconObj.name}`,\n );\n if (!response.ok) return null;\n\n const json = await response.json();\n return getIconData(json, iconObj.name);\n } catch (error) {\n console.error(`[SSR] Error fetching icon ${iconName}:`, error);\n return null;\n }\n}\n\ntype SSRIconProps = Omit<\n ComponentProps<\"svg\">,\n \"mode\" | \"onLoad\" | \"rotate\"\n> & {\n name: string;\n size?: number;\n color?: string;\n};\n\nconst SSRIcon = async ({ name, size, color, ...props }: SSRIconProps) => {\n const iconData = await fetchIconDataServer(name);\n if (iconData) {\n return (\n <IconifyIcon\n {...props}\n icon={iconData}\n width={size}\n height={size}\n style={{\n color: color,\n width: size ? `${size}px` : undefined,\n height: size ? `${size}px` : undefined,\n }}\n />\n );\n }\n console.warn(`[SSR] Fallback to client-side for icon: ${name}`);\n return (\n <IconifyIcon\n {...props}\n icon={name ?? \"\"}\n width={size}\n height={size}\n style={{\n color: color,\n width: size ? `${size}px` : undefined,\n height: size ? `${size}px` : undefined,\n }}\n />\n );\n};\n\nexport { SSRIcon, type SSRIconProps };\n"],"mappings":";;;;AASA,MAAM,QAAQ,EAAE,MAAM,MAAM,OAAO,GAAG,YAAuB;CAC3D,OACE,oBAACA,QAAD;EACE,GAAI;EACJ,MAAM,QAAQ;EACd,OAAO;EACP,QAAQ;EACR,OAAO;GACE;GACP,OAAO,OAAO,GAAG,KAAK,MAAM,KAAA;GAC5B,QAAQ,OAAO,GAAG,KAAK,MAAM,KAAA;EAC/B;CACD,CAAA;AAEL;;ACnBA,eAAe,oBAAoB,UAAkB;CACnD,MAAM,UAAU,aAAa,QAAQ;CACrC,IAAI,CAAC,SAAS,OAAO;CAErB,IAAI;EACF,MAAM,WAAW,MAAM,MACrB,0BAA0B,QAAQ,OAAO,cAAc,QAAQ,MACjE;EACA,IAAI,CAAC,SAAS,IAAI,OAAO;EAEzB,MAAM,OAAO,MAAM,SAAS,KAAK;EACjC,OAAO,YAAY,MAAM,QAAQ,IAAI;CACvC,SAAS,OAAO;EACd,QAAQ,MAAM,6BAA6B,SAAS,IAAI,KAAK;EAC7D,OAAO;CACT;AACF;AAWA,MAAM,UAAU,OAAO,EAAE,MAAM,MAAM,OAAO,GAAG,YAA0B;CACvE,MAAM,WAAW,MAAM,oBAAoB,IAAI;CAC/C,IAAI,UACF,OACE,oBAACC,QAAD;EACE,GAAI;EACJ,MAAM;EACN,OAAO;EACP,QAAQ;EACR,OAAO;GACE;GACP,OAAO,OAAO,GAAG,KAAK,MAAM,KAAA;GAC5B,QAAQ,OAAO,GAAG,KAAK,MAAM,KAAA;EAC/B;CACD,CAAA;CAGL,QAAQ,KAAK,2CAA2C,MAAM;CAC9D,OACE,oBAACA,QAAD;EACE,GAAI;EACJ,MAAM,QAAQ;EACd,OAAO;EACP,QAAQ;EACR,OAAO;GACE;GACP,OAAO,OAAO,GAAG,KAAK,MAAM,KAAA;GAC5B,QAAQ,OAAO,GAAG,KAAK,MAAM,KAAA;EAC/B;CACD,CAAA;AAEL"}
1
+ {"version":3,"file":"index.js","names":["IconifyIcon"],"sources":["../src/icon.tsx"],"sourcesContent":["import { Icon as IconifyIcon } from \"@iconify/react\";\nimport type { ComponentProps, CSSProperties } from \"react\";\n\ntype IconProps = Omit<ComponentProps<\"svg\">, \"mode\" | \"onLoad\" | \"rotate\"> & {\n name: string;\n size?: number;\n color?: string;\n showLoader?: boolean;\n};\n\nconst Icon = ({\n name,\n size,\n color,\n showLoader = false,\n style,\n children,\n ...props\n}: IconProps) => {\n const iconStyle: CSSProperties = {\n display: \"inline-block\",\n flexShrink: 0,\n verticalAlign: \"middle\",\n ...style,\n color: color ?? style?.color,\n width: size !== undefined ? size : (style?.width ?? props.width),\n height: size !== undefined ? size : (style?.height ?? props.height),\n };\n\n return (\n <IconifyIcon\n {...props}\n icon={name ?? \"\"}\n width={size ?? props.width ?? \"1em\"}\n height={size ?? props.height ?? \"1em\"}\n style={iconStyle}\n >\n <svg\n {...props}\n width={size ?? props.width ?? \"1em\"}\n height={size ?? props.height ?? \"1em\"}\n style={iconStyle}\n viewBox=\"0 0 100 100\"\n >\n {showLoader ? (\n <>\n <style>{`\n @keyframes puzzle-icon-loading { from { opacity: 1; } to { opacity: 0.2; } }\n .puzzle-icon-loading-bar { animation: puzzle-icon-loading 1.2s linear infinite; }\n @media (prefers-reduced-motion: reduce) { .puzzle-icon-loading-bar { animation: none; } }\n `}</style>\n {Array.from({ length: 12 }, (_, index) => (\n <rect\n key={index}\n className=\"puzzle-icon-loading-bar\"\n x=\"47\"\n y=\"4\"\n width=\"6\"\n height=\"24\"\n rx=\"3\"\n fill={iconStyle.color ?? \"currentColor\"}\n transform={`rotate(${index * 30} 50 50)`}\n style={{\n animationDelay: `${index * 0.1}s`,\n opacity: (index + 1) / 12,\n }}\n />\n ))}\n </>\n ) : (\n children\n )}\n </svg>\n </IconifyIcon>\n );\n};\n\nexport { Icon, type IconProps };\n"],"mappings":";;;AAUA,MAAM,QAAQ,EACZ,MACA,MACA,OACA,aAAa,OACb,OACA,UACA,GAAG,YACY;CACf,MAAM,YAA2B;EAC/B,SAAS;EACT,YAAY;EACZ,eAAe;EACf,GAAG;EACH,OAAO,SAAS,OAAO;EACvB,OAAO,SAAS,KAAA,IAAY,OAAQ,OAAO,SAAS,MAAM;EAC1D,QAAQ,SAAS,KAAA,IAAY,OAAQ,OAAO,UAAU,MAAM;CAC9D;CAEA,OACE,oBAACA,QAAD;EACE,GAAI;EACJ,MAAM,QAAQ;EACd,OAAO,QAAQ,MAAM,SAAS;EAC9B,QAAQ,QAAQ,MAAM,UAAU;EAChC,OAAO;EAEP,UAAA,oBAAC,OAAD;GACE,GAAI;GACJ,OAAO,QAAQ,MAAM,SAAS;GAC9B,QAAQ,QAAQ,MAAM,UAAU;GAChC,OAAO;GACP,SAAQ;GAEP,UAAA,aACC,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,SAAD,EAAA,UAAQ;;;;cAIC,CAAA,GACR,MAAM,KAAK,EAAE,QAAQ,GAAG,IAAI,GAAG,UAC9B,oBAAC,QAAD;IAEE,WAAU;IACV,GAAE;IACF,GAAE;IACF,OAAM;IACN,QAAO;IACP,IAAG;IACH,MAAM,UAAU,SAAS;IACzB,WAAW,UAAU,QAAQ,GAAG;IAChC,OAAO;KACL,gBAAgB,GAAG,QAAQ,GAAI;KAC/B,UAAU,QAAQ,KAAK;IACzB;GACD,GAbM,KAaN,CACF,CACD,EAAA,CAAA,IAEF;EAEC,CAAA;CACM,CAAA;AAEjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@puzzle-ui/icons",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Icons for Puzzle",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -29,6 +29,7 @@
29
29
  ],
30
30
  "scripts": {
31
31
  "build": "tsdown",
32
+ "typecheck": "tsc --noEmit -p .",
32
33
  "vitest": "bunx vitest run --passWithNoTests",
33
34
  "vitest:watch": "bunx vitest run --watch --passWithNoTests",
34
35
  "clean": "rm -rf dist",
@@ -37,7 +38,7 @@
37
38
  "dependencies": {
38
39
  "@iconify/react": "^6.0.3",
39
40
  "@iconify/utils": "^3.1.7",
40
- "@puzzle-ui/core": "^0.3.0"
41
+ "@puzzle-ui/core": "^0.5.0"
41
42
  },
42
43
  "peerDependencies": {
43
44
  "react": "^19.0.0",
@@ -47,7 +48,7 @@
47
48
  "@types/react": "^19.0.0",
48
49
  "@types/react-dom": "^19.0.0",
49
50
  "tsdown": "^0.23.1",
50
- "typescript": "^6.0.3",
51
+ "typescript": "^7.0.2",
51
52
  "vitest": "latest"
52
53
  }
53
54
  }