@nice2dev/icons 1.3.15 → 1.3.16

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 (140) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/NiceDesktopIconExporter.js +688 -599
  3. package/dist/cjs/NiceFaviconGenerator.js +603 -417
  4. package/dist/cjs/NiceIconPicker.js +788 -508
  5. package/dist/cjs/NiceIconPreview.js +246 -188
  6. package/dist/cjs/NiceIconSetCreator.js +683 -552
  7. package/dist/cjs/NiceIconStacker.js +547 -171
  8. package/dist/cjs/NiceIconValue.js +27 -35
  9. package/dist/cjs/NtdIconBadge.js +384 -360
  10. package/dist/cjs/NtdIconMorph.js +419 -354
  11. package/dist/cjs/NtdStateMorph.js +150 -147
  12. package/dist/cjs/advancedIconSearch.js +373 -510
  13. package/dist/cjs/animationControls.js +518 -642
  14. package/dist/cjs/client.js +12 -15
  15. package/dist/cjs/createIcon.js +349 -251
  16. package/dist/cjs/design-tokens.js +324 -390
  17. package/dist/cjs/figmaExport.js +162 -257
  18. package/dist/cjs/figmaSync.js +234 -316
  19. package/dist/cjs/headless-ui.js +240 -368
  20. package/dist/cjs/iconAnalytics.js +337 -393
  21. package/dist/cjs/iconHtml.js +64 -86
  22. package/dist/cjs/iconMetadata.js +392 -472
  23. package/dist/cjs/iconParts.js +120 -90
  24. package/dist/cjs/iconStack.js +136 -155
  25. package/dist/cjs/iconStyles.js +1609 -504
  26. package/dist/cjs/iconValue.js +359 -430
  27. package/dist/cjs/icons/accessibility.js +1119 -134
  28. package/dist/cjs/icons/actions.js +1290 -330
  29. package/dist/cjs/icons/ai.js +1424 -144
  30. package/dist/cjs/icons/brand.js +1344 -172
  31. package/dist/cjs/icons/business.js +903 -193
  32. package/dist/cjs/icons/devtech.js +1656 -227
  33. package/dist/cjs/icons/ecommerce.js +802 -111
  34. package/dist/cjs/icons/education.js +1345 -199
  35. package/dist/cjs/icons/files.js +1597 -328
  36. package/dist/cjs/icons/fintech.js +793 -104
  37. package/dist/cjs/icons/food.js +1507 -153
  38. package/dist/cjs/icons/fun.js +786 -109
  39. package/dist/cjs/icons/gaming.js +916 -170
  40. package/dist/cjs/icons/health.js +623 -112
  41. package/dist/cjs/icons/index.js +32 -35
  42. package/dist/cjs/icons/input.js +282 -83
  43. package/dist/cjs/icons/legal.js +1065 -122
  44. package/dist/cjs/icons/media.js +1061 -267
  45. package/dist/cjs/icons/navigation.js +387 -122
  46. package/dist/cjs/icons/omniverk.js +747 -90
  47. package/dist/cjs/icons/realestate.js +1520 -193
  48. package/dist/cjs/icons/saas.js +867 -98
  49. package/dist/cjs/icons/science.js +1451 -202
  50. package/dist/cjs/icons/shapes.js +1316 -308
  51. package/dist/cjs/icons/smarthome.js +786 -90
  52. package/dist/cjs/icons/social.js +591 -59
  53. package/dist/cjs/icons/sports.js +1225 -133
  54. package/dist/cjs/icons/sustainability.js +1211 -139
  55. package/dist/cjs/icons/travel.js +1470 -148
  56. package/dist/cjs/icons/ui.js +1508 -315
  57. package/dist/cjs/icons/weather.js +1160 -173
  58. package/dist/cjs/index.js +566 -568
  59. package/dist/cjs/lottieIntegration.js +261 -266
  60. package/dist/cjs/nicetodev-icons.css +1 -1
  61. package/dist/cjs/particleEffects.js +270 -251
  62. package/dist/cjs/resolver.js +229 -284
  63. package/dist/cjs/rsc.js +175 -193
  64. package/dist/cjs/sharpen.js +73 -130
  65. package/dist/cjs/smilAnimations.js +371 -165
  66. package/dist/cjs/stacking.js +87 -122
  67. package/dist/cjs/tailwind-plugin.js +280 -320
  68. package/dist/cjs/types.js +46 -72
  69. package/dist/cjs/utilities.js +163 -324
  70. package/dist/cjs/variantProps.js +12 -52
  71. package/dist/esm/NiceDesktopIconExporter.js +671 -598
  72. package/dist/esm/NiceFaviconGenerator.js +583 -416
  73. package/dist/esm/NiceIconPicker.js +789 -507
  74. package/dist/esm/NiceIconPreview.js +247 -187
  75. package/dist/esm/NiceIconSetCreator.js +685 -551
  76. package/dist/esm/NiceIconStacker.js +549 -170
  77. package/dist/esm/NiceIconValue.js +29 -34
  78. package/dist/esm/NtdIconBadge.js +388 -359
  79. package/dist/esm/NtdIconMorph.js +423 -353
  80. package/dist/esm/NtdStateMorph.js +152 -146
  81. package/dist/esm/advancedIconSearch.js +391 -509
  82. package/dist/esm/animationControls.js +527 -641
  83. package/dist/esm/client.js +48 -10
  84. package/dist/esm/createIcon.js +350 -250
  85. package/dist/esm/design-tokens.js +334 -387
  86. package/dist/esm/figmaExport.js +170 -256
  87. package/dist/esm/figmaSync.js +237 -315
  88. package/dist/esm/headless-ui.js +254 -365
  89. package/dist/esm/iconAnalytics.js +342 -392
  90. package/dist/esm/iconHtml.js +67 -85
  91. package/dist/esm/iconMetadata.js +404 -471
  92. package/dist/esm/iconParts.js +125 -89
  93. package/dist/esm/iconStack.js +145 -154
  94. package/dist/esm/iconStyles.js +1620 -503
  95. package/dist/esm/iconValue.js +361 -429
  96. package/dist/esm/icons/accessibility.js +1133 -133
  97. package/dist/esm/icons/actions.js +1320 -329
  98. package/dist/esm/icons/ai.js +1441 -143
  99. package/dist/esm/icons/brand.js +1351 -171
  100. package/dist/esm/icons/business.js +931 -201
  101. package/dist/esm/icons/devtech.js +1687 -226
  102. package/dist/esm/icons/ecommerce.js +816 -110
  103. package/dist/esm/icons/education.js +1364 -198
  104. package/dist/esm/icons/files.js +1628 -327
  105. package/dist/esm/icons/fintech.js +807 -103
  106. package/dist/esm/icons/food.js +1524 -152
  107. package/dist/esm/icons/fun.js +801 -108
  108. package/dist/esm/icons/gaming.js +933 -169
  109. package/dist/esm/icons/health.js +636 -111
  110. package/dist/esm/icons/index.js +596 -32
  111. package/dist/esm/icons/input.js +326 -82
  112. package/dist/esm/icons/legal.js +1079 -121
  113. package/dist/esm/icons/media.js +1086 -266
  114. package/dist/esm/icons/navigation.js +401 -121
  115. package/dist/esm/icons/omniverk.js +759 -89
  116. package/dist/esm/icons/realestate.js +1544 -198
  117. package/dist/esm/icons/saas.js +880 -97
  118. package/dist/esm/icons/science.js +1477 -208
  119. package/dist/esm/icons/shapes.js +1343 -307
  120. package/dist/esm/icons/smarthome.js +799 -89
  121. package/dist/esm/icons/social.js +599 -58
  122. package/dist/esm/icons/sports.js +1240 -132
  123. package/dist/esm/icons/sustainability.js +1226 -138
  124. package/dist/esm/icons/travel.js +1486 -147
  125. package/dist/esm/icons/ui.js +1540 -314
  126. package/dist/esm/icons/weather.js +1181 -172
  127. package/dist/esm/index.js +756 -58
  128. package/dist/esm/lottieIntegration.js +264 -265
  129. package/dist/esm/nicetodev-icons.css +1 -1
  130. package/dist/esm/particleEffects.js +271 -250
  131. package/dist/esm/resolver.js +231 -283
  132. package/dist/esm/rsc.js +182 -192
  133. package/dist/esm/sharpen.js +78 -129
  134. package/dist/esm/smilAnimations.js +376 -164
  135. package/dist/esm/stacking.js +99 -121
  136. package/dist/esm/tailwind-plugin.js +282 -319
  137. package/dist/esm/types.js +50 -71
  138. package/dist/esm/utilities.js +177 -321
  139. package/dist/esm/variantProps.js +23 -52
  140. package/package.json +15 -22
@@ -1,273 +1,373 @@
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 { 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 { SIZE_MAP, SEMANTIC_COLOR_VARS, SEMANTIC_COLOR_DEFAULTS, GRADIENT_PRESETS } from "./types.js";
7
+ const hasMatchMedia = () => typeof window !== "undefined" && typeof window.matchMedia === "function";
12
8
  function getColorScheme() {
13
- if (!hasMatchMedia()) {
14
- return 'light';
15
- }
16
- return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
9
+ if (!hasMatchMedia()) {
10
+ return "light";
11
+ }
12
+ return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
17
13
  }
18
14
  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);
15
+ if (!hasMatchMedia()) {
16
+ return () => {
17
+ };
18
+ }
19
+ const mq = window.matchMedia("(prefers-color-scheme: dark)");
20
+ mq.addEventListener("change", callback);
21
+ return () => mq.removeEventListener("change", callback);
25
22
  }
26
23
  function useColorScheme() {
27
- return useSyncExternalStore(subscribeColorScheme, getColorScheme, () => 'light');
24
+ return useSyncExternalStore(subscribeColorScheme, getColorScheme, () => "light");
28
25
  }
29
26
  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
27
  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
+ const stops = GRADIENT_PRESETS[preset];
29
+ if (!stops) {
30
+ return null;
31
+ }
32
+ const stopEls = stops.map((color, i) => {
33
+ const offset = `${Math.round(i / (stops.length - 1) * 100)}%`;
34
+ const nextColor = stops[(i + 1) % stops.length];
35
+ if (animation === "pulse") {
36
+ return /* @__PURE__ */ jsx("stop", { offset, stopColor: color, children: /* @__PURE__ */ jsx(
37
+ "animate",
38
+ {
39
+ attributeName: "stop-color",
40
+ values: `${color};${nextColor};${color}`,
41
+ dur: "3s",
42
+ repeatCount: "indefinite"
70
43
  }
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 }));
44
+ ) }, i);
75
45
  }
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"));
46
+ return /* @__PURE__ */ jsx("stop", { offset, stopColor: color }, i);
47
+ });
48
+ if (type === "radial") {
49
+ return /* @__PURE__ */ jsx("radialGradient", { id, cx: "50%", cy: "50%", r: "50%", children: stopEls });
50
+ }
51
+ const animateEls = [];
52
+ if (animation === "spin") {
53
+ animateEls.push(
54
+ /* @__PURE__ */ jsx(
55
+ "animateTransform",
56
+ {
57
+ attributeName: "gradientTransform",
58
+ type: "rotate",
59
+ from: "0 12 12",
60
+ to: "360 12 12",
61
+ dur: "3s",
62
+ repeatCount: "indefinite"
63
+ },
64
+ "spin"
65
+ )
66
+ );
67
+ }
68
+ if (animation === "shift") {
69
+ animateEls.push(
70
+ /* @__PURE__ */ jsx(
71
+ "animate",
72
+ {
73
+ attributeName: "x1",
74
+ values: "-24;24;-24",
75
+ dur: "3s",
76
+ repeatCount: "indefinite"
77
+ },
78
+ "shift-x1"
79
+ ),
80
+ /* @__PURE__ */ jsx(
81
+ "animate",
82
+ {
83
+ attributeName: "x2",
84
+ values: "0;48;0",
85
+ dur: "3s",
86
+ repeatCount: "indefinite"
87
+ },
88
+ "shift-x2"
89
+ )
90
+ );
91
+ }
92
+ return /* @__PURE__ */ jsxs(
93
+ "linearGradient",
94
+ {
95
+ id,
96
+ x1: "0",
97
+ y1: "0",
98
+ x2: "24",
99
+ y2: "0",
100
+ gradientUnits: "userSpaceOnUse",
101
+ gradientTransform: animation === "spin" ? void 0 : `rotate(${angle}, 12, 12)`,
102
+ children: [
103
+ stopEls,
104
+ animateEls
105
+ ]
80
106
  }
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] }));
107
+ );
85
108
  }
86
- /* ── 3D filter helper ───────────────────────────────── */
87
109
  function render3dFilterDef(filterId) {
88
- return (
110
+ return (
89
111
  // The region is the icon's box plus a margin for the shadow, not a share of the shape's
90
112
  // bounding box: a lone horizontal or vertical line (NtdMinus) has a zero-height box, and a
91
113
  // 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" }) })] }));
114
+ /* @__PURE__ */ jsxs("filter", { id: filterId, filterUnits: "userSpaceOnUse", x: "-4", y: "-4", width: "32", height: "32", children: [
115
+ /* @__PURE__ */ jsx("feDropShadow", { dx: "0", dy: "1.5", stdDeviation: "1", floodOpacity: "0.35" }),
116
+ /* @__PURE__ */ jsxs("feComponentTransfer", { in: "SourceGraphic", result: "highlight", children: [
117
+ /* @__PURE__ */ jsx("feFuncR", { type: "linear", slope: "1.2", intercept: "0.1" }),
118
+ /* @__PURE__ */ jsx("feFuncG", { type: "linear", slope: "1.2", intercept: "0.1" }),
119
+ /* @__PURE__ */ jsx("feFuncB", { type: "linear", slope: "1.2", intercept: "0.1" })
120
+ ] }),
121
+ /* @__PURE__ */ jsx("feComposite", { operator: "in", in: "highlight", in2: "SourceGraphic", result: "highlightMask" }),
122
+ /* @__PURE__ */ jsx("feMerge", { children: /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" }) })
123
+ ] })
124
+ );
93
125
  }
94
- /* ── Cutout shape helper ──────────────────────────── */
95
126
  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)`);
127
+ const mask = `url(#${maskId})`;
128
+ switch (shape) {
129
+ case "circle":
130
+ return /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "11", fill, mask });
131
+ case "square":
132
+ return /* @__PURE__ */ jsx("rect", { x: "1", y: "1", width: "22", height: "22", fill, mask });
133
+ case "hexagon":
134
+ return /* @__PURE__ */ jsx(
135
+ "polygon",
136
+ {
137
+ points: "12,1 22.39,6.5 22.39,17.5 12,23 1.61,17.5 1.61,6.5",
138
+ fill,
139
+ mask
140
+ }
141
+ );
142
+ case "diamond":
143
+ return /* @__PURE__ */ jsx("polygon", { points: "12,1 23,12 12,23 1,12", fill, mask });
144
+ case "shield":
145
+ return /* @__PURE__ */ jsx(
146
+ "path",
147
+ {
148
+ d: "M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5L12 1z",
149
+ fill,
150
+ mask
187
151
  }
188
- if (flipX) {
189
- transforms.push('scaleX(-1)');
152
+ );
153
+ case "squircle":
154
+ return /* @__PURE__ */ jsx(
155
+ "path",
156
+ {
157
+ 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",
158
+ fill,
159
+ mask
190
160
  }
191
- if (flipY) {
192
- transforms.push('scaleY(-1)');
161
+ );
162
+ case "rounded-square":
163
+ default:
164
+ return /* @__PURE__ */ jsx("rect", { x: "1", y: "1", width: "22", height: "22", rx: "4", fill, mask });
165
+ }
166
+ }
167
+ function createIcon(options) {
168
+ const { displayName, viewBox = "0 0 24 24", paths, textCenter = BOX_CENTER } = options;
169
+ const solidDuotone = (props) => paths.solid({ ...props, accentColor: props.secondaryColor, accentOpacity: 1 });
170
+ const perfect = {
171
+ x: options.perfectStackX ?? textCenter[0],
172
+ y: options.perfectStackY ?? textCenter[1],
173
+ rotation: options.perfectStackRotation ?? BOX_PERFECT_STACK.rotation,
174
+ size: options.perfectStackSize ?? BOX_PERFECT_STACK.size
175
+ };
176
+ const Icon = forwardRef(
177
+ ({
178
+ size = "md",
179
+ variant = "solid",
180
+ cutoutShape = "rounded-square",
181
+ color,
182
+ lightColor,
183
+ darkColor,
184
+ primaryColor: propPrimaryColor = "currentColor",
185
+ secondaryColor,
186
+ accentColor,
187
+ primaryOpacity = 1,
188
+ secondaryOpacity = 0.4,
189
+ accentOpacity = 1,
190
+ strokeWidth = 1,
191
+ strokeLinecap: propLinecap,
192
+ strokeLinejoin: propLinejoin,
193
+ animation,
194
+ animationDuration,
195
+ smilAnimation,
196
+ smilDuration = 1,
197
+ smilRepeatCount = "indefinite",
198
+ smilEasing = "ease-in-out",
199
+ smilDelay = 0,
200
+ gradient,
201
+ gradientType = "linear",
202
+ gradientAngle = 135,
203
+ gradientAnimation,
204
+ // Transform props
205
+ rotate,
206
+ flipX,
207
+ flipY,
208
+ scale,
209
+ transition,
210
+ transformOrigin = "center center",
211
+ // stacking (1.3.5): the parent icon reads a child's own align / size from its props
212
+ children,
213
+ stackAlign: _stackAlign,
214
+ stackSize: _stackSize,
215
+ stackRotation: _stackRotation,
216
+ stackOffsetX: _stackOffsetX,
217
+ stackOffsetY: _stackOffsetY,
218
+ textColor,
219
+ textSize,
220
+ title,
221
+ className,
222
+ style,
223
+ ...rest
224
+ }, ref) => {
225
+ const resolvedSize = typeof size === "number" ? size : SIZE_MAP[size] ?? 24;
226
+ const gradId = useId();
227
+ const uid = useId();
228
+ const center = { x: 12, y: 12 };
229
+ const colorScheme = useColorScheme();
230
+ const adaptiveColor = lightColor && darkColor ? colorScheme === "dark" ? darkColor : lightColor : void 0;
231
+ const primaryColor = adaptiveColor ?? (color ? `var(${SEMANTIC_COLOR_VARS[color]}, ${SEMANTIC_COLOR_DEFAULTS[color]})` : propPrimaryColor);
232
+ const resolvedSecondary = secondaryColor ?? primaryColor;
233
+ const resolvedAccent = accentColor ?? "#ffffff";
234
+ const effectivePrimary = gradient ? `url(#${gradId})` : primaryColor;
235
+ const strokeLinecap = variant === "sharp" ? "square" : propLinecap ?? "round";
236
+ const strokeLinejoin = variant === "sharp" ? "miter" : propLinejoin ?? "round";
237
+ const effectiveStrokeWidth = variant === "mini" ? Math.max(1.5, strokeWidth - 0.5) : strokeWidth;
238
+ const renderProps = {
239
+ variant,
240
+ primaryColor: effectivePrimary,
241
+ secondaryColor: resolvedSecondary,
242
+ accentColor: resolvedAccent,
243
+ primaryOpacity,
244
+ secondaryOpacity,
245
+ accentOpacity,
246
+ strokeWidth: effectiveStrokeWidth,
247
+ strokeLinecap,
248
+ strokeLinejoin,
249
+ uid
250
+ };
251
+ 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;
252
+ const is3d = variant === "3d";
253
+ const filterId = useId();
254
+ const isCutout = variant === "cutout";
255
+ const maskId = useId();
256
+ const classes = ["ntd-icon", animation ? `ntd-anim-${animation}` : "", className ?? ""].filter(Boolean).join(" ");
257
+ const transforms = [];
258
+ if (rotate) {
259
+ transforms.push(`rotate(${rotate}deg)`);
260
+ }
261
+ if (flipX) {
262
+ transforms.push("scaleX(-1)");
263
+ }
264
+ if (flipY) {
265
+ transforms.push("scaleY(-1)");
266
+ }
267
+ if (scale && scale !== 1) {
268
+ transforms.push(`scale(${scale})`);
269
+ }
270
+ const transformString = transforms.length > 0 ? transforms.join(" ") : void 0;
271
+ const transitionValue = transition === true ? "transform 0.3s ease" : typeof transition === "string" ? `transform ${transition}` : void 0;
272
+ const animStyle = {
273
+ // the variable carries the duration to the parts an icon animates inside itself
274
+ ...animationDuration ? { animationDuration, "--ntd-anim-duration": animationDuration } : {},
275
+ ...transformString ? { transform: transformString } : {},
276
+ ...transformString ? { transformOrigin } : {},
277
+ ...transitionValue ? { transition: transitionValue } : {},
278
+ ...style
279
+ };
280
+ const smilAnimationElements = smilAnimation ? generateSmilAnimation(
281
+ {
282
+ type: smilAnimation,
283
+ duration: smilDuration,
284
+ repeatCount: smilRepeatCount,
285
+ easing: smilEasing,
286
+ delay: smilDelay
287
+ },
288
+ center
289
+ ) : null;
290
+ const needsSmilScaleWrapper = smilAnimation && ["heartbeat", "scale-pulse", "grow", "shrink", "rubber", "pop"].includes(smilAnimation);
291
+ 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);
292
+ const stacked = renderStackChildren(children, {
293
+ variant,
294
+ primaryColor: effectivePrimary,
295
+ accentColor: resolvedAccent,
296
+ tileColor: gradient ? effectivePrimary : resolvedSecondary,
297
+ strokeWidth,
298
+ perfect,
299
+ textColor,
300
+ textSize
301
+ });
302
+ const drawn = stacked ? /* @__PURE__ */ jsxs(Fragment, { children: [
303
+ rendered,
304
+ stacked
305
+ ] }) : rendered;
306
+ const iconContent = variant === "mini" ? /* @__PURE__ */ jsx(
307
+ "g",
308
+ {
309
+ transform: `translate(${center.x} ${center.y}) scale(${MINI_SCALE}) translate(${-center.x} ${-center.y})`,
310
+ children: drawn
193
311
  }
194
- if (scale && scale !== 1) {
195
- transforms.push(`scale(${scale})`);
312
+ ) : drawn;
313
+ return /* @__PURE__ */ jsxs(
314
+ "svg",
315
+ {
316
+ ref,
317
+ xmlns: "http://www.w3.org/2000/svg",
318
+ viewBox,
319
+ width: resolvedSize,
320
+ height: resolvedSize,
321
+ fill: "none",
322
+ strokeLinecap,
323
+ strokeLinejoin,
324
+ className: classes,
325
+ style: animStyle,
326
+ role: title ? "img" : "presentation",
327
+ "aria-hidden": title ? void 0 : true,
328
+ "aria-label": title,
329
+ ...rest,
330
+ children: [
331
+ title && /* @__PURE__ */ jsx("title", { children: title }),
332
+ gradient && /* @__PURE__ */ jsx("defs", { children: renderGradientDef(gradId, gradient, gradientType, gradientAngle, gradientAnimation) }),
333
+ is3d && /* @__PURE__ */ jsx("defs", { children: render3dFilterDef(filterId) }),
334
+ isCutout && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("mask", { id: maskId, children: [
335
+ /* @__PURE__ */ jsx("rect", { x: "0", y: "0", width: "24", height: "24", fill: "white" }),
336
+ /* @__PURE__ */ jsx("g", { transform: "translate(12,12) scale(0.8) translate(-12,-12)", children: paths.solid({
337
+ ...renderProps,
338
+ primaryColor: "black",
339
+ secondaryColor: "black",
340
+ accentColor: "white",
341
+ primaryOpacity: 1,
342
+ secondaryOpacity: 1,
343
+ accentOpacity: 1,
344
+ uid: `${uid}m`
345
+ }) })
346
+ ] }) }),
347
+ smilAnimation ? needsSmilScaleWrapper ? /* @__PURE__ */ jsxs(
348
+ "g",
349
+ {
350
+ transform: `translate(${center.x}, ${center.y})`,
351
+ filter: is3d ? `url(#${filterId})` : void 0,
352
+ children: [
353
+ /* @__PURE__ */ jsx("g", { transform: `translate(-${center.x}, -${center.y})`, children: iconContent }),
354
+ smilAnimationElements
355
+ ]
356
+ }
357
+ ) : /* @__PURE__ */ jsxs("g", { filter: is3d ? `url(#${filterId})` : void 0, children: [
358
+ iconContent,
359
+ smilAnimationElements
360
+ ] }) : is3d ? /* @__PURE__ */ jsx("g", { filter: `url(#${filterId})`, children: iconContent }) : iconContent
361
+ ]
196
362
  }
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;
363
+ );
364
+ }
365
+ );
366
+ Icon.displayName = displayName;
367
+ Icon[NTD_ICON_MARK] = true;
368
+ Icon[PERFECT_STACK] = perfect;
369
+ return Icon;
271
370
  }
272
-
273
- export { createIcon };
371
+ export {
372
+ createIcon
373
+ };