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