@nice2dev/icons 1.3.15 → 1.3.17

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.
Files changed (153) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +1 -1
  3. package/dist/cjs/NiceDesktopIconExporter.js +688 -599
  4. package/dist/cjs/NiceFaviconGenerator.js +603 -417
  5. package/dist/cjs/NiceIconPicker.js +788 -508
  6. package/dist/cjs/NiceIconPreview.js +246 -188
  7. package/dist/cjs/NiceIconSetCreator.js +683 -552
  8. package/dist/cjs/NiceIconStacker.js +547 -171
  9. package/dist/cjs/NiceIconValue.js +27 -35
  10. package/dist/cjs/NtdIconBadge.js +384 -360
  11. package/dist/cjs/NtdIconMorph.js +419 -354
  12. package/dist/cjs/NtdStateMorph.js +150 -147
  13. package/dist/cjs/advancedIconSearch.js +373 -510
  14. package/dist/cjs/animationControls.js +518 -642
  15. package/dist/cjs/animationSpeed.js +69 -0
  16. package/dist/cjs/client.js +12 -15
  17. package/dist/cjs/createIcon.js +374 -252
  18. package/dist/cjs/design-tokens.js +324 -390
  19. package/dist/cjs/figmaExport.js +162 -257
  20. package/dist/cjs/figmaSync.js +234 -316
  21. package/dist/cjs/headless-ui.js +240 -368
  22. package/dist/cjs/iconAnalytics.js +337 -393
  23. package/dist/cjs/iconHtml.js +64 -86
  24. package/dist/cjs/iconMetadata.js +392 -472
  25. package/dist/cjs/iconParts.js +120 -90
  26. package/dist/cjs/iconStack.js +136 -155
  27. package/dist/cjs/iconStyles.js +1670 -509
  28. package/dist/cjs/iconValue.js +359 -430
  29. package/dist/cjs/icons/accessibility.js +1119 -134
  30. package/dist/cjs/icons/actions.js +1290 -330
  31. package/dist/cjs/icons/ai.js +1424 -144
  32. package/dist/cjs/icons/brand.js +613 -184
  33. package/dist/cjs/icons/business.js +938 -192
  34. package/dist/cjs/icons/devtech.js +1656 -227
  35. package/dist/cjs/icons/ecommerce.js +802 -111
  36. package/dist/cjs/icons/education.js +1345 -199
  37. package/dist/cjs/icons/files.js +1597 -328
  38. package/dist/cjs/icons/fintech.js +793 -104
  39. package/dist/cjs/icons/food.js +1028 -156
  40. package/dist/cjs/icons/fun.js +804 -109
  41. package/dist/cjs/icons/gaming.js +916 -170
  42. package/dist/cjs/icons/health.js +623 -112
  43. package/dist/cjs/icons/index.js +32 -42
  44. package/dist/cjs/icons/input.js +282 -83
  45. package/dist/cjs/icons/legal.js +1065 -122
  46. package/dist/cjs/icons/media.js +1061 -267
  47. package/dist/cjs/icons/navigation.js +407 -123
  48. package/dist/cjs/icons/omniverk.js +523 -93
  49. package/dist/cjs/icons/realestate.js +1520 -193
  50. package/dist/cjs/icons/saas.js +867 -98
  51. package/dist/cjs/icons/science.js +1344 -202
  52. package/dist/cjs/icons/shapes.js +1316 -308
  53. package/dist/cjs/icons/smarthome.js +786 -90
  54. package/dist/cjs/icons/social.js +591 -59
  55. package/dist/cjs/icons/sports.js +1133 -133
  56. package/dist/cjs/icons/sustainability.js +1211 -139
  57. package/dist/cjs/icons/travel.js +1470 -148
  58. package/dist/cjs/icons/ui.js +1508 -315
  59. package/dist/cjs/icons/weather.js +1160 -173
  60. package/dist/cjs/index.js +559 -568
  61. package/dist/cjs/lottieIntegration.js +261 -266
  62. package/dist/cjs/nicetodev-icons.css +1 -1
  63. package/dist/cjs/particleEffects.js +270 -251
  64. package/dist/cjs/resolver.js +229 -284
  65. package/dist/cjs/rsc.js +175 -193
  66. package/dist/cjs/sharpen.js +73 -130
  67. package/dist/cjs/smilAnimations.js +380 -165
  68. package/dist/cjs/stacking.js +87 -122
  69. package/dist/cjs/tailwind-plugin.js +280 -320
  70. package/dist/cjs/types.js +46 -72
  71. package/dist/cjs/utilities.js +163 -324
  72. package/dist/cjs/variantProps.js +12 -52
  73. package/dist/esm/NiceDesktopIconExporter.js +671 -598
  74. package/dist/esm/NiceFaviconGenerator.js +583 -416
  75. package/dist/esm/NiceIconPicker.js +789 -507
  76. package/dist/esm/NiceIconPreview.js +247 -187
  77. package/dist/esm/NiceIconSetCreator.js +685 -551
  78. package/dist/esm/NiceIconStacker.js +549 -170
  79. package/dist/esm/NiceIconValue.js +29 -34
  80. package/dist/esm/NtdIconBadge.js +388 -359
  81. package/dist/esm/NtdIconMorph.js +423 -353
  82. package/dist/esm/NtdStateMorph.js +152 -146
  83. package/dist/esm/advancedIconSearch.js +391 -509
  84. package/dist/esm/animationControls.js +527 -641
  85. package/dist/esm/animationSpeed.js +69 -0
  86. package/dist/esm/client.js +48 -10
  87. package/dist/esm/createIcon.js +375 -251
  88. package/dist/esm/design-tokens.js +334 -387
  89. package/dist/esm/figmaExport.js +170 -256
  90. package/dist/esm/figmaSync.js +237 -315
  91. package/dist/esm/headless-ui.js +254 -365
  92. package/dist/esm/iconAnalytics.js +342 -392
  93. package/dist/esm/iconHtml.js +67 -85
  94. package/dist/esm/iconMetadata.js +404 -471
  95. package/dist/esm/iconParts.js +125 -89
  96. package/dist/esm/iconStack.js +145 -154
  97. package/dist/esm/iconStyles.js +1681 -508
  98. package/dist/esm/iconValue.js +361 -429
  99. package/dist/esm/icons/accessibility.js +1133 -133
  100. package/dist/esm/icons/actions.js +1320 -329
  101. package/dist/esm/icons/ai.js +1441 -143
  102. package/dist/esm/icons/brand.js +616 -179
  103. package/dist/esm/icons/business.js +957 -191
  104. package/dist/esm/icons/devtech.js +1687 -226
  105. package/dist/esm/icons/ecommerce.js +816 -110
  106. package/dist/esm/icons/education.js +1364 -198
  107. package/dist/esm/icons/files.js +1628 -327
  108. package/dist/esm/icons/fintech.js +807 -103
  109. package/dist/esm/icons/food.js +1043 -153
  110. package/dist/esm/icons/fun.js +819 -108
  111. package/dist/esm/icons/gaming.js +933 -169
  112. package/dist/esm/icons/health.js +636 -111
  113. package/dist/esm/icons/index.js +589 -32
  114. package/dist/esm/icons/input.js +326 -82
  115. package/dist/esm/icons/legal.js +1079 -121
  116. package/dist/esm/icons/media.js +1086 -266
  117. package/dist/esm/icons/navigation.js +421 -122
  118. package/dist/esm/icons/omniverk.js +534 -91
  119. package/dist/esm/icons/realestate.js +1544 -198
  120. package/dist/esm/icons/saas.js +880 -97
  121. package/dist/esm/icons/science.js +1370 -208
  122. package/dist/esm/icons/shapes.js +1343 -307
  123. package/dist/esm/icons/smarthome.js +799 -89
  124. package/dist/esm/icons/social.js +599 -58
  125. package/dist/esm/icons/sports.js +1148 -132
  126. package/dist/esm/icons/sustainability.js +1226 -138
  127. package/dist/esm/icons/travel.js +1486 -147
  128. package/dist/esm/icons/ui.js +1540 -314
  129. package/dist/esm/icons/weather.js +1181 -172
  130. package/dist/esm/index.js +749 -58
  131. package/dist/esm/lottieIntegration.js +264 -265
  132. package/dist/esm/nicetodev-icons.css +1 -1
  133. package/dist/esm/particleEffects.js +271 -250
  134. package/dist/esm/resolver.js +231 -283
  135. package/dist/esm/rsc.js +182 -192
  136. package/dist/esm/sharpen.js +78 -129
  137. package/dist/esm/smilAnimations.js +385 -164
  138. package/dist/esm/stacking.js +99 -121
  139. package/dist/esm/tailwind-plugin.js +282 -319
  140. package/dist/esm/types.js +50 -71
  141. package/dist/esm/utilities.js +177 -321
  142. package/dist/esm/variantProps.js +23 -52
  143. package/dist/types/animationSpeed.d.ts +19 -0
  144. package/dist/types/createIcon.d.ts +6 -0
  145. package/dist/types/iconStyles.d.ts +6 -1
  146. package/dist/types/icons/brand.d.ts +0 -4
  147. package/dist/types/icons/food.d.ts +0 -3
  148. package/dist/types/icons/index.d.ts +3 -3
  149. package/dist/types/icons/omniverk.d.ts +0 -3
  150. package/dist/types/icons/science.d.ts +1 -1
  151. package/dist/types/smilAnimations.d.ts +4 -2
  152. package/dist/types/types.d.ts +7 -0
  153. package/package.json +15 -22
@@ -1,275 +1,397 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var React = require('react');
5
- var sharpen = require('./sharpen.js');
6
- var smilAnimations = require('./smilAnimations.js');
7
- var stacking = require('./stacking.js');
8
- var types = require('./types.js');
9
-
10
- /* ── Dark mode detection hook ───────────────────────── */
11
- // No `matchMedia` (jsdom without a polyfill, some embedded webviews): light, and nothing to
12
- // subscribe to — an icon must not throw where a page renders.
13
- const hasMatchMedia = () => typeof window !== 'undefined' && typeof window.matchMedia === 'function';
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
5
+ const animationSpeed = require("./animationSpeed.js");
6
+ const sharpen = require("./sharpen.js");
7
+ const smilAnimations = require("./smilAnimations.js");
8
+ const stacking = require("./stacking.js");
9
+ const types = require("./types.js");
10
+ const hasMatchMedia = () => typeof window !== "undefined" && typeof window.matchMedia === "function";
14
11
  function getColorScheme() {
15
- if (!hasMatchMedia()) {
16
- return 'light';
17
- }
18
- return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
12
+ if (!hasMatchMedia()) {
13
+ return "light";
14
+ }
15
+ return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
19
16
  }
20
17
  function subscribeColorScheme(callback) {
21
- if (!hasMatchMedia()) {
22
- return () => { };
23
- }
24
- const mq = window.matchMedia('(prefers-color-scheme: dark)');
25
- mq.addEventListener('change', callback);
26
- return () => mq.removeEventListener('change', callback);
18
+ if (!hasMatchMedia()) {
19
+ return () => {
20
+ };
21
+ }
22
+ const mq = window.matchMedia("(prefers-color-scheme: dark)");
23
+ mq.addEventListener("change", callback);
24
+ return () => mq.removeEventListener("change", callback);
27
25
  }
28
26
  function useColorScheme() {
29
- return React.useSyncExternalStore(subscribeColorScheme, getColorScheme, () => 'light');
27
+ return React.useSyncExternalStore(subscribeColorScheme, getColorScheme, () => "light");
30
28
  }
31
29
  const BOX_CENTER = [12, 12];
32
- /**
33
- * Factory function that creates a React icon component from SVG path renderers.
34
- *
35
- * Returns a `React.forwardRef` component that accepts {@link NtdIconProps} and
36
- * renders an accessible `<svg>` element with the correct variant, colors,
37
- * size, animation class, and ARIA attributes.
38
- *
39
- * @param options - Icon configuration (display name, viewBox, variant renderers).
40
- * @returns A `ForwardRefExoticComponent` ready for use as `<NtdMyIcon />`.
41
- *
42
- * @example
43
- * ```tsx
44
- * import { createIcon } from '@nicetodev/icons';
45
- *
46
- * export const NtdStar = createIcon({
47
- * displayName: 'NtdStar',
48
- * paths: {
49
- * solid: ({ primaryColor }) => <path d="M12 2l3 7h7l-5.5 4 2 7L12 16l-6.5 4 2-7L2 9h7z" fill={primaryColor} />,
50
- * outline: ({ primaryColor, strokeWidth }) => <path d="..." stroke={primaryColor} strokeWidth={strokeWidth} fill="none" />,
51
- * duotone: ({ primaryColor, secondaryColor, secondaryOpacity }) => (
52
- * <>
53
- * <path d="..." fill={secondaryColor} opacity={secondaryOpacity} />
54
- * <path d="..." stroke={primaryColor} fill="none" />
55
- * </>
56
- * ),
57
- * },
58
- * });
59
- * ```
60
- */
61
- /* ── Gradient helper ───────────────────────────────── */
62
- function renderGradientDef(id, preset, type, angle, animation) {
63
- const stops = types.GRADIENT_PRESETS[preset];
64
- if (!stops) {
65
- return null;
66
- }
67
- const stopEls = stops.map((color, i) => {
68
- const offset = `${Math.round((i / (stops.length - 1)) * 100)}%`;
69
- const nextColor = stops[(i + 1) % stops.length];
70
- if (animation === 'pulse') {
71
- return (jsxRuntime.jsx("stop", { offset: offset, stopColor: color, children: jsxRuntime.jsx("animate", { attributeName: "stop-color", values: `${color};${nextColor};${color}`, dur: "3s", repeatCount: "indefinite" }) }, i));
30
+ function renderGradientDef(id, preset, type, angle, animation, timeScale = 1) {
31
+ const stops = types.GRADIENT_PRESETS[preset];
32
+ if (!stops) {
33
+ return null;
34
+ }
35
+ const loop = `${Number((3 * timeScale).toFixed(4))}s`;
36
+ const stopEls = stops.map((color, i) => {
37
+ const offset = `${Math.round(i / (stops.length - 1) * 100)}%`;
38
+ const nextColor = stops[(i + 1) % stops.length];
39
+ if (animation === "pulse") {
40
+ return /* @__PURE__ */ jsxRuntime.jsx("stop", { offset, stopColor: color, children: /* @__PURE__ */ jsxRuntime.jsx(
41
+ "animate",
42
+ {
43
+ attributeName: "stop-color",
44
+ values: `${color};${nextColor};${color}`,
45
+ dur: loop,
46
+ repeatCount: "indefinite"
72
47
  }
73
- return jsxRuntime.jsx("stop", { offset: offset, stopColor: color }, i);
74
- });
75
- if (type === 'radial') {
76
- return (jsxRuntime.jsx("radialGradient", { id: id, cx: "50%", cy: "50%", r: "50%", children: stopEls }));
48
+ ) }, i);
77
49
  }
78
- // Linear gradient: use gradientTransform for angle
79
- const animateEls = [];
80
- if (animation === 'spin') {
81
- animateEls.push(jsxRuntime.jsx("animateTransform", { attributeName: "gradientTransform", type: "rotate", from: "0 12 12", to: "360 12 12", dur: "3s", repeatCount: "indefinite" }, "spin"));
50
+ return /* @__PURE__ */ jsxRuntime.jsx("stop", { offset, stopColor: color }, i);
51
+ });
52
+ if (type === "radial") {
53
+ return /* @__PURE__ */ jsxRuntime.jsx("radialGradient", { id, cx: "50%", cy: "50%", r: "50%", children: stopEls });
54
+ }
55
+ const animateEls = [];
56
+ if (animation === "spin") {
57
+ animateEls.push(
58
+ /* @__PURE__ */ jsxRuntime.jsx(
59
+ "animateTransform",
60
+ {
61
+ attributeName: "gradientTransform",
62
+ type: "rotate",
63
+ from: "0 12 12",
64
+ to: "360 12 12",
65
+ dur: loop,
66
+ repeatCount: "indefinite"
67
+ },
68
+ "spin"
69
+ )
70
+ );
71
+ }
72
+ if (animation === "shift") {
73
+ animateEls.push(
74
+ /* @__PURE__ */ jsxRuntime.jsx(
75
+ "animate",
76
+ {
77
+ attributeName: "x1",
78
+ values: "-24;24;-24",
79
+ dur: loop,
80
+ repeatCount: "indefinite"
81
+ },
82
+ "shift-x1"
83
+ ),
84
+ /* @__PURE__ */ jsxRuntime.jsx(
85
+ "animate",
86
+ {
87
+ attributeName: "x2",
88
+ values: "0;48;0",
89
+ dur: loop,
90
+ repeatCount: "indefinite"
91
+ },
92
+ "shift-x2"
93
+ )
94
+ );
95
+ }
96
+ return /* @__PURE__ */ jsxRuntime.jsxs(
97
+ "linearGradient",
98
+ {
99
+ id,
100
+ x1: "0",
101
+ y1: "0",
102
+ x2: "24",
103
+ y2: "0",
104
+ gradientUnits: "userSpaceOnUse",
105
+ gradientTransform: animation === "spin" ? void 0 : `rotate(${angle}, 12, 12)`,
106
+ children: [
107
+ stopEls,
108
+ animateEls
109
+ ]
82
110
  }
83
- if (animation === 'shift') {
84
- animateEls.push(jsxRuntime.jsx("animate", { attributeName: "x1", values: "-24;24;-24", dur: "3s", repeatCount: "indefinite" }, "shift-x1"), jsxRuntime.jsx("animate", { attributeName: "x2", values: "0;48;0", dur: "3s", repeatCount: "indefinite" }, "shift-x2"));
85
- }
86
- return (jsxRuntime.jsxs("linearGradient", { id: id, x1: "0", y1: "0", x2: "24", y2: "0", gradientUnits: "userSpaceOnUse", gradientTransform: animation === 'spin' ? undefined : `rotate(${angle}, 12, 12)`, children: [stopEls, animateEls] }));
111
+ );
87
112
  }
88
- /* ── 3D filter helper ───────────────────────────────── */
89
113
  function render3dFilterDef(filterId) {
90
- return (
114
+ return (
91
115
  // The region is the icon's box plus a margin for the shadow, not a share of the shape's
92
116
  // bounding box: a lone horizontal or vertical line (NtdMinus) has a zero-height box, and a
93
117
  // filter region of 140% of zero rendered nothing.
94
- jsxRuntime.jsxs("filter", { id: filterId, filterUnits: "userSpaceOnUse", x: "-4", y: "-4", width: "32", height: "32", children: [jsxRuntime.jsx("feDropShadow", { dx: "0", dy: "1.5", stdDeviation: "1", floodOpacity: "0.35" }), jsxRuntime.jsxs("feComponentTransfer", { in: "SourceGraphic", result: "highlight", children: [jsxRuntime.jsx("feFuncR", { type: "linear", slope: "1.2", intercept: "0.1" }), jsxRuntime.jsx("feFuncG", { type: "linear", slope: "1.2", intercept: "0.1" }), jsxRuntime.jsx("feFuncB", { type: "linear", slope: "1.2", intercept: "0.1" })] }), jsxRuntime.jsx("feComposite", { operator: "in", in: "highlight", in2: "SourceGraphic", result: "highlightMask" }), jsxRuntime.jsx("feMerge", { children: jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" }) })] }));
118
+ /* @__PURE__ */ jsxRuntime.jsxs("filter", { id: filterId, filterUnits: "userSpaceOnUse", x: "-4", y: "-4", width: "32", height: "32", children: [
119
+ /* @__PURE__ */ jsxRuntime.jsx("feDropShadow", { dx: "0", dy: "1.5", stdDeviation: "1", floodOpacity: "0.35" }),
120
+ /* @__PURE__ */ jsxRuntime.jsxs("feComponentTransfer", { in: "SourceGraphic", result: "highlight", children: [
121
+ /* @__PURE__ */ jsxRuntime.jsx("feFuncR", { type: "linear", slope: "1.2", intercept: "0.1" }),
122
+ /* @__PURE__ */ jsxRuntime.jsx("feFuncG", { type: "linear", slope: "1.2", intercept: "0.1" }),
123
+ /* @__PURE__ */ jsxRuntime.jsx("feFuncB", { type: "linear", slope: "1.2", intercept: "0.1" })
124
+ ] }),
125
+ /* @__PURE__ */ jsxRuntime.jsx("feComposite", { operator: "in", in: "highlight", in2: "SourceGraphic", result: "highlightMask" }),
126
+ /* @__PURE__ */ jsxRuntime.jsx("feMerge", { children: /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" }) })
127
+ ] })
128
+ );
95
129
  }
96
- /* ── Cutout shape helper ──────────────────────────── */
97
130
  function renderCutoutShape(shape, fill, maskId) {
98
- const mask = `url(#${maskId})`;
99
- switch (shape) {
100
- case 'circle':
101
- return jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "11", fill: fill, mask: mask });
102
- case 'square':
103
- return jsxRuntime.jsx("rect", { x: "1", y: "1", width: "22", height: "22", fill: fill, mask: mask });
104
- case 'hexagon':
105
- return (jsxRuntime.jsx("polygon", { points: "12,1 22.39,6.5 22.39,17.5 12,23 1.61,17.5 1.61,6.5", fill: fill, mask: mask }));
106
- case 'diamond':
107
- return jsxRuntime.jsx("polygon", { points: "12,1 23,12 12,23 1,12", fill: fill, mask: mask });
108
- case 'shield':
109
- return (jsxRuntime.jsx("path", { d: "M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5L12 1z", fill: fill, mask: mask }));
110
- case 'squircle':
111
- return (jsxRuntime.jsx("path", { d: "M12 1C5.5 1 1 5.5 1 8.5v7C1 18.5 5.5 23 12 23s11-4.5 11-7.5v-7C23 5.5 18.5 1 12 1z", fill: fill, mask: mask }));
112
- case 'rounded-square':
113
- default:
114
- return jsxRuntime.jsx("rect", { x: "1", y: "1", width: "22", height: "22", rx: "4", fill: fill, mask: mask });
115
- }
116
- }
117
- function createIcon(options) {
118
- var _a, _b, _c, _d;
119
- const { displayName, viewBox = '0 0 24 24', paths, textCenter = BOX_CENTER } = options;
120
- const solidDuotone = (props) => paths.solid({ ...props, accentColor: props.secondaryColor, accentOpacity: 1 });
121
- const perfect = {
122
- x: (_a = options.perfectStackX) !== null && _a !== void 0 ? _a : textCenter[0],
123
- y: (_b = options.perfectStackY) !== null && _b !== void 0 ? _b : textCenter[1],
124
- rotation: (_c = options.perfectStackRotation) !== null && _c !== void 0 ? _c : stacking.BOX_PERFECT_STACK.rotation,
125
- size: (_d = options.perfectStackSize) !== null && _d !== void 0 ? _d : stacking.BOX_PERFECT_STACK.size,
126
- };
127
- const Icon = React.forwardRef(({ size = 'md', variant = 'solid', cutoutShape = 'rounded-square', color, lightColor, darkColor, primaryColor: propPrimaryColor = 'currentColor', secondaryColor, accentColor, primaryOpacity = 1, secondaryOpacity = 0.4, accentOpacity = 1, strokeWidth = 1, strokeLinecap: propLinecap, strokeLinejoin: propLinejoin, animation, animationDuration, smilAnimation, smilDuration = 1, smilRepeatCount = 'indefinite', smilEasing = 'ease-in-out', smilDelay = 0, gradient, gradientType = 'linear', gradientAngle = 135, gradientAnimation,
128
- // Transform props
129
- rotate, flipX, flipY, scale, transition, transformOrigin = 'center center',
130
- // stacking (1.3.5): the parent icon reads a child's own align / size from its props
131
- children, stackAlign: _stackAlign, stackSize: _stackSize, stackRotation: _stackRotation, stackOffsetX: _stackOffsetX, stackOffsetY: _stackOffsetY, textColor, textSize, title, className, style, ...rest }, ref) => {
132
- var _a, _b, _c, _d, _e, _f, _g;
133
- const resolvedSize = typeof size === 'number' ? size : ((_a = types.SIZE_MAP[size]) !== null && _a !== void 0 ? _a : 24);
134
- const gradId = React.useId();
135
- // the prefix of the ids of the clip paths the renderers draw (IconRenderProps.uid)
136
- const uid = React.useId();
137
- const center = { x: 12, y: 12 }; // Default center for 24x24 viewBox
138
- // Use dark/light mode detection when both colors are specified
139
- const colorScheme = useColorScheme();
140
- const adaptiveColor = lightColor && darkColor ? (colorScheme === 'dark' ? darkColor : lightColor) : undefined;
141
- // Resolve semantic color to actual color value
142
- // Priority: adaptiveColor > semantic color > propPrimaryColor
143
- const primaryColor = adaptiveColor !== null && adaptiveColor !== void 0 ? adaptiveColor : (color
144
- ? `var(${types.SEMANTIC_COLOR_VARS[color]}, ${types.SEMANTIC_COLOR_DEFAULTS[color]})`
145
- : propPrimaryColor);
146
- const resolvedSecondary = secondaryColor !== null && secondaryColor !== void 0 ? secondaryColor : primaryColor;
147
- const resolvedAccent = accentColor !== null && accentColor !== void 0 ? accentColor : '#ffffff';
148
- const effectivePrimary = gradient ? `url(#${gradId})` : primaryColor;
149
- // Sharp variant uses square line caps and mitered joins
150
- const strokeLinecap = variant === 'sharp' ? 'square' : (propLinecap !== null && propLinecap !== void 0 ? propLinecap : 'round');
151
- const strokeLinejoin = variant === 'sharp' ? 'miter' : (propLinejoin !== null && propLinejoin !== void 0 ? propLinejoin : 'round');
152
- // Mini variant uses thinner strokes
153
- const effectiveStrokeWidth = variant === 'mini' ? Math.max(1.5, strokeWidth - 0.5) : strokeWidth;
154
- const renderProps = {
155
- variant,
156
- primaryColor: effectivePrimary,
157
- secondaryColor: resolvedSecondary,
158
- accentColor: resolvedAccent,
159
- primaryOpacity,
160
- secondaryOpacity,
161
- accentOpacity,
162
- strokeWidth: effectiveStrokeWidth,
163
- strokeLinecap,
164
- strokeLinejoin,
165
- uid,
166
- };
167
- // Resolve renderer with fallback chain. `wireframe` has no authored layer
168
- // at all — it is a mechanical re-draw of the full `solid` construction, so
169
- // it never indexes `paths`. A duotone left out is the solid with its details
170
- // in secondary (1.3.8): the body keeps primary, the larger area.
171
- const renderer = variant === 'wireframe'
172
- ? paths.solid
173
- : variant === 'duotone' && !paths.duotone
174
- ? solidDuotone
175
- : ((_g = (_f = (_e = (_d = (_c = (_b = paths[variant]) !== null && _b !== void 0 ? _b : (variant === 'sharp' ? paths.solid : undefined)) !== null && _c !== void 0 ? _c : (variant === 'rounded' ? paths.solid : undefined)) !== null && _d !== void 0 ? _d : (variant === 'mini' ? paths.solid : undefined)) !== null && _e !== void 0 ? _e : (variant === '3d' ? paths.solid : undefined)) !== null && _f !== void 0 ? _f : (variant === 'vivid' ? paths.solid : undefined)) !== null && _g !== void 0 ? _g : paths.solid);
176
- // 3D variant uses a filter for depth effect
177
- const is3d = variant === '3d';
178
- const filterId = React.useId();
179
- // Cutout variant uses SVG mask for knockout/cutout effect
180
- const isCutout = variant === 'cutout';
181
- const maskId = React.useId();
182
- const classes = ['ntd-icon', animation ? `ntd-anim-${animation}` : '', className !== null && className !== void 0 ? className : '']
183
- .filter(Boolean)
184
- .join(' ');
185
- // Build CSS transform string from props
186
- const transforms = [];
187
- if (rotate) {
188
- transforms.push(`rotate(${rotate}deg)`);
131
+ const mask = `url(#${maskId})`;
132
+ switch (shape) {
133
+ case "circle":
134
+ return /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "11", fill, mask });
135
+ case "square":
136
+ return /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "1", y: "1", width: "22", height: "22", fill, mask });
137
+ case "hexagon":
138
+ return /* @__PURE__ */ jsxRuntime.jsx(
139
+ "polygon",
140
+ {
141
+ points: "12,1 22.39,6.5 22.39,17.5 12,23 1.61,17.5 1.61,6.5",
142
+ fill,
143
+ mask
144
+ }
145
+ );
146
+ case "diamond":
147
+ return /* @__PURE__ */ jsxRuntime.jsx("polygon", { points: "12,1 23,12 12,23 1,12", fill, mask });
148
+ case "shield":
149
+ return /* @__PURE__ */ jsxRuntime.jsx(
150
+ "path",
151
+ {
152
+ d: "M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5L12 1z",
153
+ fill,
154
+ mask
189
155
  }
190
- if (flipX) {
191
- transforms.push('scaleX(-1)');
156
+ );
157
+ case "squircle":
158
+ return /* @__PURE__ */ jsxRuntime.jsx(
159
+ "path",
160
+ {
161
+ d: "M12 1C5.5 1 1 5.5 1 8.5v7C1 18.5 5.5 23 12 23s11-4.5 11-7.5v-7C23 5.5 18.5 1 12 1z",
162
+ fill,
163
+ mask
192
164
  }
193
- if (flipY) {
194
- transforms.push('scaleY(-1)');
165
+ );
166
+ case "rounded-square":
167
+ default:
168
+ return /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "1", y: "1", width: "22", height: "22", rx: "4", fill, mask });
169
+ }
170
+ }
171
+ function createIcon(options) {
172
+ const {
173
+ displayName,
174
+ viewBox = "0 0 24 24",
175
+ paths,
176
+ textCenter = BOX_CENTER,
177
+ animated = false
178
+ } = options;
179
+ const solidDuotone = (props) => paths.solid({ ...props, accentColor: props.secondaryColor, accentOpacity: 1 });
180
+ const perfect = {
181
+ x: options.perfectStackX ?? textCenter[0],
182
+ y: options.perfectStackY ?? textCenter[1],
183
+ rotation: options.perfectStackRotation ?? stacking.BOX_PERFECT_STACK.rotation,
184
+ size: options.perfectStackSize ?? stacking.BOX_PERFECT_STACK.size
185
+ };
186
+ const Icon = React.forwardRef(
187
+ ({
188
+ size = "md",
189
+ variant = "solid",
190
+ cutoutShape = "rounded-square",
191
+ color,
192
+ lightColor,
193
+ darkColor,
194
+ primaryColor: propPrimaryColor = "currentColor",
195
+ secondaryColor,
196
+ accentColor,
197
+ primaryOpacity = 1,
198
+ secondaryOpacity = 0.4,
199
+ accentOpacity = 1,
200
+ strokeWidth = 1,
201
+ strokeLinecap: propLinecap,
202
+ strokeLinejoin: propLinejoin,
203
+ animation,
204
+ animationDuration,
205
+ animationSpeed: animationSpeed$1,
206
+ smilAnimation,
207
+ smilDuration,
208
+ smilRepeatCount = "indefinite",
209
+ smilEasing = "ease-in-out",
210
+ smilDelay = 0,
211
+ gradient,
212
+ gradientType = "linear",
213
+ gradientAngle = 135,
214
+ gradientAnimation,
215
+ // Transform props
216
+ rotate,
217
+ flipX,
218
+ flipY,
219
+ scale,
220
+ transition,
221
+ transformOrigin = "center center",
222
+ // stacking (1.3.5): the parent icon reads a child's own align / size from its props
223
+ children,
224
+ stackAlign: _stackAlign,
225
+ stackSize: _stackSize,
226
+ stackRotation: _stackRotation,
227
+ stackOffsetX: _stackOffsetX,
228
+ stackOffsetY: _stackOffsetY,
229
+ textColor,
230
+ textSize,
231
+ title,
232
+ className,
233
+ style,
234
+ ...rest
235
+ }, ref) => {
236
+ const resolvedSize = typeof size === "number" ? size : types.SIZE_MAP[size] ?? 24;
237
+ const gradId = React.useId();
238
+ const uid = React.useId();
239
+ const center = { x: 12, y: 12 };
240
+ const colorScheme = useColorScheme();
241
+ const adaptiveColor = lightColor && darkColor ? colorScheme === "dark" ? darkColor : lightColor : void 0;
242
+ const primaryColor = adaptiveColor ?? (color ? `var(${types.SEMANTIC_COLOR_VARS[color]}, ${types.SEMANTIC_COLOR_DEFAULTS[color]})` : propPrimaryColor);
243
+ const resolvedSecondary = secondaryColor ?? primaryColor;
244
+ const resolvedAccent = accentColor ?? "#ffffff";
245
+ const effectivePrimary = gradient ? `url(#${gradId})` : primaryColor;
246
+ const strokeLinecap = variant === "sharp" ? "square" : propLinecap ?? "round";
247
+ const strokeLinejoin = variant === "sharp" ? "miter" : propLinejoin ?? "round";
248
+ const effectiveStrokeWidth = variant === "mini" ? Math.max(1.5, strokeWidth - 0.5) : strokeWidth;
249
+ const renderProps = {
250
+ variant,
251
+ primaryColor: effectivePrimary,
252
+ secondaryColor: resolvedSecondary,
253
+ accentColor: resolvedAccent,
254
+ primaryOpacity,
255
+ secondaryOpacity,
256
+ accentOpacity,
257
+ strokeWidth: effectiveStrokeWidth,
258
+ strokeLinecap,
259
+ strokeLinejoin,
260
+ uid
261
+ };
262
+ const renderer = variant === "wireframe" ? paths.solid : variant === "duotone" && !paths.duotone ? solidDuotone : paths[variant] ?? (variant === "sharp" ? paths.solid : void 0) ?? (variant === "rounded" ? paths.solid : void 0) ?? (variant === "mini" ? paths.solid : void 0) ?? (variant === "3d" ? paths.solid : void 0) ?? (variant === "vivid" ? paths.solid : void 0) ?? paths.solid;
263
+ const is3d = variant === "3d";
264
+ const filterId = React.useId();
265
+ const isCutout = variant === "cutout";
266
+ const maskId = React.useId();
267
+ const classes = ["ntd-icon", animation ? `ntd-anim-${animation}` : "", className ?? ""].filter(Boolean).join(" ");
268
+ const transforms = [];
269
+ if (rotate) {
270
+ transforms.push(`rotate(${rotate}deg)`);
271
+ }
272
+ if (flipX) {
273
+ transforms.push("scaleX(-1)");
274
+ }
275
+ if (flipY) {
276
+ transforms.push("scaleY(-1)");
277
+ }
278
+ if (scale && scale !== 1) {
279
+ transforms.push(`scale(${scale})`);
280
+ }
281
+ const transformString = transforms.length > 0 ? transforms.join(" ") : void 0;
282
+ const transitionValue = transition === true ? "transform 0.3s ease" : typeof transition === "string" ? `transform ${transition}` : void 0;
283
+ const timeScale = animationSpeed.animationScale(animationSpeed$1);
284
+ const animStyle = {
285
+ // the variable carries the duration to the parts an icon animates inside itself
286
+ ...animationDuration ? { animationDuration, "--ntd-anim-duration": animationDuration } : {},
287
+ // animations.css multiplies its times by it (default 2 there, the slowdown)
288
+ ...animationSpeed$1 !== void 0 ? { "--ntd-anim-scale": String(timeScale) } : {},
289
+ ...transformString ? { transform: transformString } : {},
290
+ ...transformString ? { transformOrigin } : {},
291
+ ...transitionValue ? { transition: transitionValue } : {},
292
+ ...style
293
+ };
294
+ const smilAnimationElements = smilAnimation ? smilAnimations.generateSmilAnimation(
295
+ {
296
+ type: smilAnimation,
297
+ // 1 s before 1.3.17 by default; a given smilDuration keeps its length
298
+ duration: (smilDuration ?? 1) * animationSpeed.durationScale(smilDuration !== void 0, animationSpeed$1),
299
+ repeatCount: smilRepeatCount,
300
+ easing: smilEasing,
301
+ delay: smilDelay
302
+ },
303
+ center
304
+ ) : null;
305
+ const needsSmilScaleWrapper = smilAnimation && ["heartbeat", "scale-pulse", "grow", "shrink", "rubber", "pop"].includes(smilAnimation);
306
+ const rendered = isCutout ? renderCutoutShape(cutoutShape, gradient ? effectivePrimary : resolvedSecondary, maskId) : variant === "sharp" ? sharpen.sharpenTree(renderer(renderProps)) : variant === "rounded" ? sharpen.roundTree(renderer(renderProps)) : variant === "wireframe" ? sharpen.wireTree(renderer(renderProps), effectivePrimary) : renderer(renderProps);
307
+ const paced = animated ? animationSpeed.retimeTree(rendered, timeScale) : rendered;
308
+ const stacked = stacking.renderStackChildren(children, {
309
+ variant,
310
+ primaryColor: effectivePrimary,
311
+ accentColor: resolvedAccent,
312
+ tileColor: gradient ? effectivePrimary : resolvedSecondary,
313
+ strokeWidth,
314
+ perfect,
315
+ textColor,
316
+ textSize
317
+ });
318
+ const drawn = stacked ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
319
+ paced,
320
+ stacked
321
+ ] }) : paced;
322
+ const iconContent = variant === "mini" ? /* @__PURE__ */ jsxRuntime.jsx(
323
+ "g",
324
+ {
325
+ transform: `translate(${center.x} ${center.y}) scale(${sharpen.MINI_SCALE}) translate(${-center.x} ${-center.y})`,
326
+ children: drawn
195
327
  }
196
- if (scale && scale !== 1) {
197
- transforms.push(`scale(${scale})`);
328
+ ) : drawn;
329
+ return /* @__PURE__ */ jsxRuntime.jsxs(
330
+ "svg",
331
+ {
332
+ ref,
333
+ xmlns: "http://www.w3.org/2000/svg",
334
+ viewBox,
335
+ width: resolvedSize,
336
+ height: resolvedSize,
337
+ fill: "none",
338
+ strokeLinecap,
339
+ strokeLinejoin,
340
+ className: classes,
341
+ style: animStyle,
342
+ role: title ? "img" : "presentation",
343
+ "aria-hidden": title ? void 0 : true,
344
+ "aria-label": title,
345
+ ...rest,
346
+ children: [
347
+ title && /* @__PURE__ */ jsxRuntime.jsx("title", { children: title }),
348
+ gradient && /* @__PURE__ */ jsxRuntime.jsx("defs", { children: renderGradientDef(
349
+ gradId,
350
+ gradient,
351
+ gradientType,
352
+ gradientAngle,
353
+ gradientAnimation,
354
+ timeScale
355
+ ) }),
356
+ is3d && /* @__PURE__ */ jsxRuntime.jsx("defs", { children: render3dFilterDef(filterId) }),
357
+ isCutout && /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("mask", { id: maskId, children: [
358
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "0", y: "0", width: "24", height: "24", fill: "white" }),
359
+ /* @__PURE__ */ jsxRuntime.jsx("g", { transform: "translate(12,12) scale(0.8) translate(-12,-12)", children: (() => {
360
+ const mask = paths.solid({
361
+ ...renderProps,
362
+ primaryColor: "black",
363
+ secondaryColor: "black",
364
+ accentColor: "white",
365
+ primaryOpacity: 1,
366
+ secondaryOpacity: 1,
367
+ accentOpacity: 1,
368
+ uid: `${uid}m`
369
+ });
370
+ return animated ? animationSpeed.retimeTree(mask, timeScale) : mask;
371
+ })() })
372
+ ] }) }),
373
+ smilAnimation ? needsSmilScaleWrapper ? /* @__PURE__ */ jsxRuntime.jsxs(
374
+ "g",
375
+ {
376
+ transform: `translate(${center.x}, ${center.y})`,
377
+ filter: is3d ? `url(#${filterId})` : void 0,
378
+ children: [
379
+ /* @__PURE__ */ jsxRuntime.jsx("g", { transform: `translate(-${center.x}, -${center.y})`, children: iconContent }),
380
+ smilAnimationElements
381
+ ]
382
+ }
383
+ ) : /* @__PURE__ */ jsxRuntime.jsxs("g", { filter: is3d ? `url(#${filterId})` : void 0, children: [
384
+ iconContent,
385
+ smilAnimationElements
386
+ ] }) : is3d ? /* @__PURE__ */ jsxRuntime.jsx("g", { filter: `url(#${filterId})`, children: iconContent }) : iconContent
387
+ ]
198
388
  }
199
- const transformString = transforms.length > 0 ? transforms.join(' ') : undefined;
200
- // Build transition style
201
- const transitionValue = transition === true
202
- ? 'transform 0.3s ease'
203
- : typeof transition === 'string'
204
- ? `transform ${transition}`
205
- : undefined;
206
- const animStyle = {
207
- // the variable carries the duration to the parts an icon animates inside itself
208
- ...(animationDuration
209
- ? { animationDuration, '--ntd-anim-duration': animationDuration }
210
- : {}),
211
- ...(transformString ? { transform: transformString } : {}),
212
- ...(transformString ? { transformOrigin } : {}),
213
- ...(transitionValue ? { transition: transitionValue } : {}),
214
- ...style,
215
- };
216
- // Generate SMIL animation elements if requested
217
- const smilAnimationElements = smilAnimation
218
- ? smilAnimations.generateSmilAnimation({
219
- type: smilAnimation,
220
- duration: smilDuration,
221
- repeatCount: smilRepeatCount,
222
- easing: smilEasing,
223
- delay: smilDelay,
224
- }, center)
225
- : null;
226
- // For scale-based SMIL animations, we need to wrap content in transform groups
227
- const needsSmilScaleWrapper = smilAnimation &&
228
- ['heartbeat', 'scale-pulse', 'grow', 'shrink', 'rubber', 'pop'].includes(smilAnimation);
229
- // `sharp`, `rounded` and `wireframe` have no per-icon paths — all three
230
- // reuse `solid` and are re-drawn here, otherwise they would render
231
- // identically to `solid` for fill-based icons. `mini` likewise only thins
232
- // the stroke, which does nothing to a filled shape, so it also gets scaled
233
- // down about the centre.
234
- const rendered = isCutout
235
- ? renderCutoutShape(cutoutShape, gradient ? effectivePrimary : resolvedSecondary, maskId)
236
- : variant === 'sharp'
237
- ? sharpen.sharpenTree(renderer(renderProps))
238
- : variant === 'rounded'
239
- ? sharpen.roundTree(renderer(renderProps))
240
- : variant === 'wireframe'
241
- ? sharpen.wireTree(renderer(renderProps), effectivePrimary)
242
- : renderer(renderProps);
243
- // Children stacked in the icon (1.3.5) — drawn as they are, not re-drawn as the variant.
244
- const stacked = stacking.renderStackChildren(children, {
245
- variant,
246
- primaryColor: effectivePrimary,
247
- accentColor: resolvedAccent,
248
- tileColor: gradient ? effectivePrimary : resolvedSecondary,
249
- strokeWidth,
250
- perfect,
251
- textColor,
252
- textSize,
253
- });
254
- const drawn = stacked ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [rendered, stacked] })) : (rendered);
255
- const iconContent = variant === 'mini' ? (jsxRuntime.jsx("g", { transform: `translate(${center.x} ${center.y}) scale(${sharpen.MINI_SCALE}) translate(${-center.x} ${-center.y})`, children: drawn })) : (drawn);
256
- return (jsxRuntime.jsxs("svg", { ref: ref, xmlns: "http://www.w3.org/2000/svg", viewBox: viewBox, width: resolvedSize, height: resolvedSize, fill: "none", strokeLinecap: strokeLinecap, strokeLinejoin: strokeLinejoin, className: classes, style: animStyle, role: title ? 'img' : 'presentation', "aria-hidden": title ? undefined : true, "aria-label": title, ...rest, children: [title && jsxRuntime.jsx("title", { children: title }), gradient && (jsxRuntime.jsx("defs", { children: renderGradientDef(gradId, gradient, gradientType, gradientAngle, gradientAnimation) })), is3d && jsxRuntime.jsx("defs", { children: render3dFilterDef(filterId) }), isCutout && (jsxRuntime.jsx("defs", { children: jsxRuntime.jsxs("mask", { id: maskId, children: [jsxRuntime.jsx("rect", { x: "0", y: "0", width: "24", height: "24", fill: "white" }), jsxRuntime.jsx("g", { transform: "translate(12,12) scale(0.8) translate(-12,-12)", children: paths.solid({
257
- ...renderProps,
258
- primaryColor: 'black',
259
- secondaryColor: 'black',
260
- accentColor: 'white',
261
- primaryOpacity: 1,
262
- secondaryOpacity: 1,
263
- accentOpacity: 1,
264
- uid: `${uid}m`,
265
- }) })] }) })), smilAnimation ? (needsSmilScaleWrapper ? (jsxRuntime.jsxs("g", { transform: `translate(${center.x}, ${center.y})`, filter: is3d ? `url(#${filterId})` : undefined, children: [jsxRuntime.jsx("g", { transform: `translate(-${center.x}, -${center.y})`, children: iconContent }), smilAnimationElements] })) : (jsxRuntime.jsxs("g", { filter: is3d ? `url(#${filterId})` : undefined, children: [iconContent, smilAnimationElements] }))) : is3d ? (jsxRuntime.jsx("g", { filter: `url(#${filterId})`, children: iconContent })) : (iconContent)] }));
266
- });
267
- Icon.displayName = displayName;
268
- // lets a parent icon tell this one among its children (stacking, 1.3.5), and tells the stacker
269
- // where a child of this one goes by default (1.3.8)
270
- Icon[stacking.NTD_ICON_MARK] = true;
271
- Icon[stacking.PERFECT_STACK] = perfect;
272
- return Icon;
389
+ );
390
+ }
391
+ );
392
+ Icon.displayName = displayName;
393
+ Icon[stacking.NTD_ICON_MARK] = true;
394
+ Icon[stacking.PERFECT_STACK] = perfect;
395
+ return Icon;
273
396
  }
274
-
275
397
  exports.createIcon = createIcon;