@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,275 +1,373 @@
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 sharpen = require("./sharpen.js");
6
+ const smilAnimations = require("./smilAnimations.js");
7
+ const stacking = require("./stacking.js");
8
+ const types = require("./types.js");
9
+ const hasMatchMedia = () => typeof window !== "undefined" && typeof window.matchMedia === "function";
14
10
  function getColorScheme() {
15
- if (!hasMatchMedia()) {
16
- return 'light';
17
- }
18
- return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
11
+ if (!hasMatchMedia()) {
12
+ return "light";
13
+ }
14
+ return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
19
15
  }
20
16
  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);
17
+ if (!hasMatchMedia()) {
18
+ return () => {
19
+ };
20
+ }
21
+ const mq = window.matchMedia("(prefers-color-scheme: dark)");
22
+ mq.addEventListener("change", callback);
23
+ return () => mq.removeEventListener("change", callback);
27
24
  }
28
25
  function useColorScheme() {
29
- return React.useSyncExternalStore(subscribeColorScheme, getColorScheme, () => 'light');
26
+ return React.useSyncExternalStore(subscribeColorScheme, getColorScheme, () => "light");
30
27
  }
31
28
  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
29
  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
+ const stops = types.GRADIENT_PRESETS[preset];
31
+ if (!stops) {
32
+ return null;
33
+ }
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__ */ jsxRuntime.jsx("stop", { offset, stopColor: color, children: /* @__PURE__ */ jsxRuntime.jsx(
39
+ "animate",
40
+ {
41
+ attributeName: "stop-color",
42
+ values: `${color};${nextColor};${color}`,
43
+ dur: "3s",
44
+ repeatCount: "indefinite"
72
45
  }
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 }));
46
+ ) }, i);
77
47
  }
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"));
48
+ return /* @__PURE__ */ jsxRuntime.jsx("stop", { offset, stopColor: color }, i);
49
+ });
50
+ if (type === "radial") {
51
+ return /* @__PURE__ */ jsxRuntime.jsx("radialGradient", { id, cx: "50%", cy: "50%", r: "50%", children: stopEls });
52
+ }
53
+ const animateEls = [];
54
+ if (animation === "spin") {
55
+ animateEls.push(
56
+ /* @__PURE__ */ jsxRuntime.jsx(
57
+ "animateTransform",
58
+ {
59
+ attributeName: "gradientTransform",
60
+ type: "rotate",
61
+ from: "0 12 12",
62
+ to: "360 12 12",
63
+ dur: "3s",
64
+ repeatCount: "indefinite"
65
+ },
66
+ "spin"
67
+ )
68
+ );
69
+ }
70
+ if (animation === "shift") {
71
+ animateEls.push(
72
+ /* @__PURE__ */ jsxRuntime.jsx(
73
+ "animate",
74
+ {
75
+ attributeName: "x1",
76
+ values: "-24;24;-24",
77
+ dur: "3s",
78
+ repeatCount: "indefinite"
79
+ },
80
+ "shift-x1"
81
+ ),
82
+ /* @__PURE__ */ jsxRuntime.jsx(
83
+ "animate",
84
+ {
85
+ attributeName: "x2",
86
+ values: "0;48;0",
87
+ dur: "3s",
88
+ repeatCount: "indefinite"
89
+ },
90
+ "shift-x2"
91
+ )
92
+ );
93
+ }
94
+ return /* @__PURE__ */ jsxRuntime.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
+ ]
82
108
  }
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] }));
109
+ );
87
110
  }
88
- /* ── 3D filter helper ───────────────────────────────── */
89
111
  function render3dFilterDef(filterId) {
90
- return (
112
+ return (
91
113
  // The region is the icon's box plus a margin for the shadow, not a share of the shape's
92
114
  // bounding box: a lone horizontal or vertical line (NtdMinus) has a zero-height box, and a
93
115
  // 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" }) })] }));
116
+ /* @__PURE__ */ jsxRuntime.jsxs("filter", { id: filterId, filterUnits: "userSpaceOnUse", x: "-4", y: "-4", width: "32", height: "32", children: [
117
+ /* @__PURE__ */ jsxRuntime.jsx("feDropShadow", { dx: "0", dy: "1.5", stdDeviation: "1", floodOpacity: "0.35" }),
118
+ /* @__PURE__ */ jsxRuntime.jsxs("feComponentTransfer", { in: "SourceGraphic", result: "highlight", children: [
119
+ /* @__PURE__ */ jsxRuntime.jsx("feFuncR", { type: "linear", slope: "1.2", intercept: "0.1" }),
120
+ /* @__PURE__ */ jsxRuntime.jsx("feFuncG", { type: "linear", slope: "1.2", intercept: "0.1" }),
121
+ /* @__PURE__ */ jsxRuntime.jsx("feFuncB", { type: "linear", slope: "1.2", intercept: "0.1" })
122
+ ] }),
123
+ /* @__PURE__ */ jsxRuntime.jsx("feComposite", { operator: "in", in: "highlight", in2: "SourceGraphic", result: "highlightMask" }),
124
+ /* @__PURE__ */ jsxRuntime.jsx("feMerge", { children: /* @__PURE__ */ jsxRuntime.jsx("feMergeNode", { in: "SourceGraphic" }) })
125
+ ] })
126
+ );
95
127
  }
96
- /* ── Cutout shape helper ──────────────────────────── */
97
128
  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)`);
129
+ const mask = `url(#${maskId})`;
130
+ switch (shape) {
131
+ case "circle":
132
+ return /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "11", fill, mask });
133
+ case "square":
134
+ return /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "1", y: "1", width: "22", height: "22", fill, mask });
135
+ case "hexagon":
136
+ return /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx("polygon", { points: "12,1 23,12 12,23 1,12", fill, mask });
146
+ case "shield":
147
+ return /* @__PURE__ */ jsxRuntime.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
189
153
  }
190
- if (flipX) {
191
- transforms.push('scaleX(-1)');
154
+ );
155
+ case "squircle":
156
+ return /* @__PURE__ */ jsxRuntime.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
192
162
  }
193
- if (flipY) {
194
- transforms.push('scaleY(-1)');
163
+ );
164
+ case "rounded-square":
165
+ default:
166
+ return /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "1", y: "1", width: "22", height: "22", rx: "4", fill, mask });
167
+ }
168
+ }
169
+ function createIcon(options) {
170
+ const { displayName, viewBox = "0 0 24 24", paths, textCenter = BOX_CENTER } = options;
171
+ const solidDuotone = (props) => paths.solid({ ...props, accentColor: props.secondaryColor, accentOpacity: 1 });
172
+ const perfect = {
173
+ x: options.perfectStackX ?? textCenter[0],
174
+ y: options.perfectStackY ?? textCenter[1],
175
+ rotation: options.perfectStackRotation ?? stacking.BOX_PERFECT_STACK.rotation,
176
+ size: options.perfectStackSize ?? stacking.BOX_PERFECT_STACK.size
177
+ };
178
+ const Icon = React.forwardRef(
179
+ ({
180
+ size = "md",
181
+ variant = "solid",
182
+ cutoutShape = "rounded-square",
183
+ color,
184
+ lightColor,
185
+ darkColor,
186
+ primaryColor: propPrimaryColor = "currentColor",
187
+ secondaryColor,
188
+ accentColor,
189
+ primaryOpacity = 1,
190
+ secondaryOpacity = 0.4,
191
+ accentOpacity = 1,
192
+ strokeWidth = 1,
193
+ strokeLinecap: propLinecap,
194
+ strokeLinejoin: propLinejoin,
195
+ animation,
196
+ animationDuration,
197
+ smilAnimation,
198
+ smilDuration = 1,
199
+ smilRepeatCount = "indefinite",
200
+ smilEasing = "ease-in-out",
201
+ smilDelay = 0,
202
+ gradient,
203
+ gradientType = "linear",
204
+ gradientAngle = 135,
205
+ gradientAnimation,
206
+ // Transform props
207
+ rotate,
208
+ flipX,
209
+ flipY,
210
+ scale,
211
+ transition,
212
+ transformOrigin = "center center",
213
+ // stacking (1.3.5): the parent icon reads a child's own align / size from its props
214
+ children,
215
+ stackAlign: _stackAlign,
216
+ stackSize: _stackSize,
217
+ stackRotation: _stackRotation,
218
+ stackOffsetX: _stackOffsetX,
219
+ stackOffsetY: _stackOffsetY,
220
+ textColor,
221
+ textSize,
222
+ title,
223
+ className,
224
+ style,
225
+ ...rest
226
+ }, ref) => {
227
+ const resolvedSize = typeof size === "number" ? size : types.SIZE_MAP[size] ?? 24;
228
+ const gradId = React.useId();
229
+ const uid = React.useId();
230
+ const center = { x: 12, y: 12 };
231
+ const colorScheme = useColorScheme();
232
+ const adaptiveColor = lightColor && darkColor ? colorScheme === "dark" ? darkColor : lightColor : void 0;
233
+ const primaryColor = adaptiveColor ?? (color ? `var(${types.SEMANTIC_COLOR_VARS[color]}, ${types.SEMANTIC_COLOR_DEFAULTS[color]})` : propPrimaryColor);
234
+ const resolvedSecondary = secondaryColor ?? primaryColor;
235
+ const resolvedAccent = accentColor ?? "#ffffff";
236
+ const effectivePrimary = gradient ? `url(#${gradId})` : primaryColor;
237
+ const strokeLinecap = variant === "sharp" ? "square" : propLinecap ?? "round";
238
+ const strokeLinejoin = variant === "sharp" ? "miter" : propLinejoin ?? "round";
239
+ const effectiveStrokeWidth = variant === "mini" ? Math.max(1.5, strokeWidth - 0.5) : strokeWidth;
240
+ const renderProps = {
241
+ variant,
242
+ primaryColor: effectivePrimary,
243
+ secondaryColor: resolvedSecondary,
244
+ accentColor: resolvedAccent,
245
+ primaryOpacity,
246
+ secondaryOpacity,
247
+ accentOpacity,
248
+ strokeWidth: effectiveStrokeWidth,
249
+ strokeLinecap,
250
+ strokeLinejoin,
251
+ uid
252
+ };
253
+ 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;
254
+ const is3d = variant === "3d";
255
+ const filterId = React.useId();
256
+ const isCutout = variant === "cutout";
257
+ const maskId = React.useId();
258
+ const classes = ["ntd-icon", animation ? `ntd-anim-${animation}` : "", className ?? ""].filter(Boolean).join(" ");
259
+ const transforms = [];
260
+ if (rotate) {
261
+ transforms.push(`rotate(${rotate}deg)`);
262
+ }
263
+ if (flipX) {
264
+ transforms.push("scaleX(-1)");
265
+ }
266
+ if (flipY) {
267
+ transforms.push("scaleY(-1)");
268
+ }
269
+ if (scale && scale !== 1) {
270
+ transforms.push(`scale(${scale})`);
271
+ }
272
+ const transformString = transforms.length > 0 ? transforms.join(" ") : void 0;
273
+ const transitionValue = transition === true ? "transform 0.3s ease" : typeof transition === "string" ? `transform ${transition}` : void 0;
274
+ const animStyle = {
275
+ // the variable carries the duration to the parts an icon animates inside itself
276
+ ...animationDuration ? { animationDuration, "--ntd-anim-duration": animationDuration } : {},
277
+ ...transformString ? { transform: transformString } : {},
278
+ ...transformString ? { transformOrigin } : {},
279
+ ...transitionValue ? { transition: transitionValue } : {},
280
+ ...style
281
+ };
282
+ const smilAnimationElements = smilAnimation ? smilAnimations.generateSmilAnimation(
283
+ {
284
+ type: smilAnimation,
285
+ duration: smilDuration,
286
+ repeatCount: smilRepeatCount,
287
+ easing: smilEasing,
288
+ delay: smilDelay
289
+ },
290
+ center
291
+ ) : null;
292
+ const needsSmilScaleWrapper = smilAnimation && ["heartbeat", "scale-pulse", "grow", "shrink", "rubber", "pop"].includes(smilAnimation);
293
+ 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);
294
+ const stacked = stacking.renderStackChildren(children, {
295
+ variant,
296
+ primaryColor: effectivePrimary,
297
+ accentColor: resolvedAccent,
298
+ tileColor: gradient ? effectivePrimary : resolvedSecondary,
299
+ strokeWidth,
300
+ perfect,
301
+ textColor,
302
+ textSize
303
+ });
304
+ const drawn = stacked ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
305
+ rendered,
306
+ stacked
307
+ ] }) : rendered;
308
+ const iconContent = variant === "mini" ? /* @__PURE__ */ jsxRuntime.jsx(
309
+ "g",
310
+ {
311
+ transform: `translate(${center.x} ${center.y}) scale(${sharpen.MINI_SCALE}) translate(${-center.x} ${-center.y})`,
312
+ children: drawn
195
313
  }
196
- if (scale && scale !== 1) {
197
- transforms.push(`scale(${scale})`);
314
+ ) : drawn;
315
+ return /* @__PURE__ */ jsxRuntime.jsxs(
316
+ "svg",
317
+ {
318
+ ref,
319
+ xmlns: "http://www.w3.org/2000/svg",
320
+ viewBox,
321
+ width: resolvedSize,
322
+ height: resolvedSize,
323
+ fill: "none",
324
+ strokeLinecap,
325
+ strokeLinejoin,
326
+ className: classes,
327
+ style: animStyle,
328
+ role: title ? "img" : "presentation",
329
+ "aria-hidden": title ? void 0 : true,
330
+ "aria-label": title,
331
+ ...rest,
332
+ children: [
333
+ title && /* @__PURE__ */ jsxRuntime.jsx("title", { children: title }),
334
+ gradient && /* @__PURE__ */ jsxRuntime.jsx("defs", { children: renderGradientDef(gradId, gradient, gradientType, gradientAngle, gradientAnimation) }),
335
+ is3d && /* @__PURE__ */ jsxRuntime.jsx("defs", { children: render3dFilterDef(filterId) }),
336
+ isCutout && /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("mask", { id: maskId, children: [
337
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "0", y: "0", width: "24", height: "24", fill: "white" }),
338
+ /* @__PURE__ */ jsxRuntime.jsx("g", { transform: "translate(12,12) scale(0.8) translate(-12,-12)", children: paths.solid({
339
+ ...renderProps,
340
+ primaryColor: "black",
341
+ secondaryColor: "black",
342
+ accentColor: "white",
343
+ primaryOpacity: 1,
344
+ secondaryOpacity: 1,
345
+ accentOpacity: 1,
346
+ uid: `${uid}m`
347
+ }) })
348
+ ] }) }),
349
+ smilAnimation ? needsSmilScaleWrapper ? /* @__PURE__ */ jsxRuntime.jsxs(
350
+ "g",
351
+ {
352
+ transform: `translate(${center.x}, ${center.y})`,
353
+ filter: is3d ? `url(#${filterId})` : void 0,
354
+ children: [
355
+ /* @__PURE__ */ jsxRuntime.jsx("g", { transform: `translate(-${center.x}, -${center.y})`, children: iconContent }),
356
+ smilAnimationElements
357
+ ]
358
+ }
359
+ ) : /* @__PURE__ */ jsxRuntime.jsxs("g", { filter: is3d ? `url(#${filterId})` : void 0, children: [
360
+ iconContent,
361
+ smilAnimationElements
362
+ ] }) : is3d ? /* @__PURE__ */ jsxRuntime.jsx("g", { filter: `url(#${filterId})`, children: iconContent }) : iconContent
363
+ ]
198
364
  }
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;
365
+ );
366
+ }
367
+ );
368
+ Icon.displayName = displayName;
369
+ Icon[stacking.NTD_ICON_MARK] = true;
370
+ Icon[stacking.PERFECT_STACK] = perfect;
371
+ return Icon;
273
372
  }
274
-
275
373
  exports.createIcon = createIcon;