@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,9 +1,6 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var React = require('react');
6
-
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const React = require("react");
7
4
  /**
8
5
  * @file headless-ui.tsx
9
6
  * @description Headless UI / shadcn/ui compatibility layer for @nice2dev/icons
@@ -31,395 +28,270 @@ var React = require('react');
31
28
  * @since 2026-03
32
29
  * @license MIT
33
30
  */
34
- /* ────────────────────────────────────────────────────────────────────────────
35
- SLOT IMPLEMENTATION
36
- ───────────────────────────────────────────────────────────────────────────── */
37
- /**
38
- * Simple Slot implementation for asChild pattern.
39
- * Compatible with Radix UI's Slot component behavior.
40
- */
41
31
  const Slot = /* @__PURE__ */ Object.assign(
42
- /* @__PURE__ */ React.forwardRef(({ children, ...props }, forwardedRef) => {
43
- if (!React.isValidElement(children)) {
32
+ /* @__PURE__ */ React.forwardRef(
33
+ ({ children, ...props }, forwardedRef) => {
34
+ if (!React.isValidElement(children)) {
44
35
  return null;
45
- }
46
- return React.cloneElement(children, {
36
+ }
37
+ return React.cloneElement(children, {
47
38
  ...props,
48
39
  ...children.props,
49
- ref: forwardedRef,
50
- });
51
- }), { displayName: 'Slot' });
52
- /* ────────────────────────────────────────────────────────────────────────────
53
- FORWARD REF WRAPPER
54
- ───────────────────────────────────────────────────────────────────────────── */
55
- /**
56
- * Wraps a NtdIcon component with forwardRef for Headless UI / Radix compatibility.
57
- * Supports the asChild pattern used by shadcn/ui and Radix primitives.
58
- *
59
- * @param IconComponent - The NtdIcon component to wrap
60
- * @param displayName - Optional display name for debugging
61
- * @returns A forwardRef-wrapped icon component
62
- *
63
- * @example
64
- * ```tsx
65
- * import { NtdUser, NtdSettings } from '@nice2dev/icons';
66
- * import { forwardRefIcon } from '@nice2dev/icons/headless-ui';
67
- *
68
- * // Create ref-compatible versions
69
- * const UserIcon = forwardRefIcon(NtdUser);
70
- * const SettingsIcon = forwardRefIcon(NtdSettings, 'SettingsIcon');
71
- *
72
- * // Use with Radix UI / shadcn
73
- * <DropdownMenu.Trigger asChild>
74
- * <SettingsIcon className="h-5 w-5" />
75
- * </DropdownMenu.Trigger>
76
- * ```
77
- */
40
+ ref: forwardedRef
41
+ });
42
+ }
43
+ ),
44
+ { displayName: "Slot" }
45
+ );
78
46
  function forwardRefIcon(IconComponent, displayName) {
79
- const WrappedIcon = React.forwardRef(({ asChild, children, ...props }, ref) => {
80
- if (asChild && React.isValidElement(children)) {
81
- return React.createElement(Slot, { ref, ...props }, children);
82
- }
83
- return React.createElement(IconComponent, { ...props, ref });
84
- });
85
- WrappedIcon.displayName = displayName || IconComponent.displayName || 'NtdIcon';
86
- return WrappedIcon;
47
+ const WrappedIcon = React.forwardRef(
48
+ ({ asChild, children, ...props }, ref) => {
49
+ if (asChild && React.isValidElement(children)) {
50
+ return React.createElement(Slot, { ref, ...props }, children);
51
+ }
52
+ return React.createElement(IconComponent, { ...props, ref });
53
+ }
54
+ );
55
+ WrappedIcon.displayName = displayName || IconComponent.displayName || "NtdIcon";
56
+ return WrappedIcon;
87
57
  }
88
- /* ────────────────────────────────────────────────────────────────────────────
89
- SHADCN/UI PRESET
90
- ───────────────────────────────────────────────────────────────────────────── */
91
- /**
92
- * shadcn/ui icon size presets matching their button sizes
93
- */
94
58
  const SHADCN_ICON_SIZES = {
95
- default: '1rem', // 16px - matches default button text
96
- sm: '0.875rem', // 14px - matches sm button
97
- lg: '1.125rem', // 18px - matches lg button
98
- icon: '1rem', // 16px - for icon-only buttons
59
+ default: "1rem",
60
+ // 16px - matches default button text
61
+ sm: "0.875rem",
62
+ // 14px - matches sm button
63
+ lg: "1.125rem",
64
+ // 18px - matches lg button
65
+ icon: "1rem"
66
+ // 16px - for icon-only buttons
99
67
  };
100
- /**
101
- * shadcn/ui color tokens mapping.
102
- *
103
- * These names belong to the host application: shadcn declares them on :root as
104
- * HSL triplets (`--primary: 222 47% 11%`), which is why every value wraps them
105
- * in `hsl()`. They are deliberately not `--nice-*` tokens — ours hold hex, so
106
- * `hsl(#3b82f6)` would be invalid and the colour would be dropped. The token
107
- * audit skips this file for the same reason.
108
- */
109
68
  const SHADCN_COLOR_TOKENS = {
110
- foreground: 'hsl(var(--foreground))',
111
- mutedForeground: 'hsl(var(--muted-foreground))',
112
- primary: 'hsl(var(--primary))',
113
- primaryForeground: 'hsl(var(--primary-foreground))',
114
- secondary: 'hsl(var(--secondary))',
115
- secondaryForeground: 'hsl(var(--secondary-foreground))',
116
- accent: 'hsl(var(--accent))',
117
- accentForeground: 'hsl(var(--accent-foreground))',
118
- destructive: 'hsl(var(--destructive))',
119
- destructiveForeground: 'hsl(var(--destructive-foreground))',
69
+ foreground: "hsl(var(--foreground))",
70
+ mutedForeground: "hsl(var(--muted-foreground))",
71
+ primary: "hsl(var(--primary))",
72
+ primaryForeground: "hsl(var(--primary-foreground))",
73
+ secondary: "hsl(var(--secondary))",
74
+ secondaryForeground: "hsl(var(--secondary-foreground))",
75
+ accent: "hsl(var(--accent))",
76
+ accentForeground: "hsl(var(--accent-foreground))",
77
+ destructive: "hsl(var(--destructive))",
78
+ destructiveForeground: "hsl(var(--destructive-foreground))"
120
79
  };
121
- /**
122
- * Creates shadcn/ui themed icon props
123
- *
124
- * @param variant - shadcn button variant
125
- * @param size - shadcn button size
126
- * @returns Props object for the icon
127
- */
128
- function getShadcnIconProps(variant = 'default', size = 'default') {
129
- const colorMap = {
130
- default: SHADCN_COLOR_TOKENS.primaryForeground,
131
- destructive: SHADCN_COLOR_TOKENS.destructiveForeground,
132
- outline: SHADCN_COLOR_TOKENS.foreground,
133
- secondary: SHADCN_COLOR_TOKENS.secondaryForeground,
134
- ghost: SHADCN_COLOR_TOKENS.foreground,
135
- link: SHADCN_COLOR_TOKENS.primary,
136
- };
137
- return {
138
- size: SHADCN_ICON_SIZES[size],
139
- color: colorMap[variant] || SHADCN_COLOR_TOKENS.foreground,
140
- };
80
+ function getShadcnIconProps(variant = "default", size = "default") {
81
+ const colorMap = {
82
+ default: SHADCN_COLOR_TOKENS.primaryForeground,
83
+ destructive: SHADCN_COLOR_TOKENS.destructiveForeground,
84
+ outline: SHADCN_COLOR_TOKENS.foreground,
85
+ secondary: SHADCN_COLOR_TOKENS.secondaryForeground,
86
+ ghost: SHADCN_COLOR_TOKENS.foreground,
87
+ link: SHADCN_COLOR_TOKENS.primary
88
+ };
89
+ return {
90
+ size: SHADCN_ICON_SIZES[size],
91
+ color: colorMap[variant] || SHADCN_COLOR_TOKENS.foreground
92
+ };
141
93
  }
142
- /**
143
- * Preset shadcn/ui className utilities for icons
144
- */
145
94
  const shadcnIconClasses = {
146
- /** Standard icon in button */
147
- button: 'h-4 w-4',
148
- /** Icon with right margin (before text) */
149
- buttonLeft: 'mr-2 h-4 w-4',
150
- /** Icon with left margin (after text) */
151
- buttonRight: 'ml-2 h-4 w-4',
152
- /** Small icon */
153
- sm: 'h-3.5 w-3.5',
154
- /** Large icon */
155
- lg: 'h-5 w-5',
156
- /** Icon-only button */
157
- iconOnly: 'h-4 w-4',
158
- /** Navigation menu icon */
159
- nav: 'h-4 w-4 shrink-0',
160
- /** Dropdown menu icon */
161
- dropdown: 'mr-2 h-4 w-4',
162
- /** Alert/toast icon */
163
- alert: 'h-4 w-4',
164
- /** Badge icon */
165
- badge: 'h-3 w-3',
166
- /** Card header icon */
167
- card: 'h-5 w-5 text-muted-foreground',
168
- /** Spinner/loading */
169
- spinner: 'h-4 w-4 animate-spin',
95
+ /** Standard icon in button */
96
+ button: "h-4 w-4",
97
+ /** Icon with right margin (before text) */
98
+ buttonLeft: "mr-2 h-4 w-4",
99
+ /** Icon with left margin (after text) */
100
+ buttonRight: "ml-2 h-4 w-4",
101
+ /** Small icon */
102
+ sm: "h-3.5 w-3.5",
103
+ /** Large icon */
104
+ lg: "h-5 w-5",
105
+ /** Icon-only button */
106
+ iconOnly: "h-4 w-4",
107
+ /** Navigation menu icon */
108
+ nav: "h-4 w-4 shrink-0",
109
+ /** Dropdown menu icon */
110
+ dropdown: "mr-2 h-4 w-4",
111
+ /** Alert/toast icon */
112
+ alert: "h-4 w-4",
113
+ /** Badge icon */
114
+ badge: "h-3 w-3",
115
+ /** Card header icon */
116
+ card: "h-5 w-5 text-muted-foreground",
117
+ /** Spinner/loading */
118
+ spinner: "h-4 w-4 animate-spin"
170
119
  };
171
- /* ────────────────────────────────────────────────────────────────────────────
172
- RADIX UI HELPERS
173
- ───────────────────────────────────────────────────────────────────────────── */
174
- /**
175
- * Creates an icon component compatible with Radix UI primitives.
176
- * Automatically handles ref forwarding and asChild pattern.
177
- *
178
- * @param IconComponent - The NtdIcon component
179
- * @param defaultProps - Default props to apply
180
- * @returns Radix-compatible icon component
181
- *
182
- * @example
183
- * ```tsx
184
- * import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
185
- * import { NtdChevronDown } from '@nice2dev/icons';
186
- * import { createRadixIcon } from '@nice2dev/icons/headless-ui';
187
- *
188
- * const ChevronIcon = createRadixIcon(NtdChevronDown, {
189
- * className: 'h-4 w-4 text-muted-foreground'
190
- * });
191
- *
192
- * <DropdownMenu.Trigger>
193
- * Options <ChevronIcon />
194
- * </DropdownMenu.Trigger>
195
- * ```
196
- */
197
120
  function createRadixIcon(IconComponent, defaultProps = {}) {
198
- const RadixIcon = React.forwardRef((props, ref) => {
199
- const mergedProps = { ...defaultProps, ...props };
200
- return React.createElement(IconComponent, { ...mergedProps, ref });
201
- });
202
- RadixIcon.displayName = `Radix${IconComponent.displayName || 'Icon'}`;
203
- return RadixIcon;
121
+ const RadixIcon = React.forwardRef((props, ref) => {
122
+ const mergedProps = { ...defaultProps, ...props };
123
+ return React.createElement(IconComponent, { ...mergedProps, ref });
124
+ });
125
+ RadixIcon.displayName = `Radix${IconComponent.displayName || "Icon"}`;
126
+ return RadixIcon;
204
127
  }
205
- /**
206
- * HOC that adds Radix UI state-based styling to icons.
207
- * Supports data-state attributes for open/closed states.
208
- *
209
- * @param IconComponent - The icon component to enhance
210
- * @returns Enhanced icon with state-aware styling
211
- *
212
- * @example
213
- * ```tsx
214
- * const StateAwareChevron = withRadixState(NtdChevronDown);
215
- *
216
- * // Automatically rotates when parent has data-state="open"
217
- * <Collapsible.Trigger>
218
- * <StateAwareChevron />
219
- * </Collapsible.Trigger>
220
- * ```
221
- */
222
128
  function withRadixState(IconComponent) {
223
- const StateIcon = React.forwardRef(({ className, style, ...props }, ref) => {
224
- const stateStyles = {
225
- transition: 'transform 200ms ease',
226
- ...style,
227
- };
228
- // Add CSS for data-state rotation
229
- const stateClassName = `${className || ''} data-[state=open]:rotate-180`.trim();
230
- return React.createElement(IconComponent, {
231
- ...props,
232
- ref,
233
- className: stateClassName,
234
- style: stateStyles,
235
- });
236
- });
237
- StateIcon.displayName = `StateAware${IconComponent.displayName || 'Icon'}`;
238
- return StateIcon;
129
+ const StateIcon = React.forwardRef(
130
+ ({ className, style, ...props }, ref) => {
131
+ const stateStyles = {
132
+ transition: "transform 200ms ease",
133
+ ...style
134
+ };
135
+ const stateClassName = `${className || ""} data-[state=open]:rotate-180`.trim();
136
+ return React.createElement(IconComponent, {
137
+ ...props,
138
+ ref,
139
+ className: stateClassName,
140
+ style: stateStyles
141
+ });
142
+ }
143
+ );
144
+ StateIcon.displayName = `StateAware${IconComponent.displayName || "Icon"}`;
145
+ return StateIcon;
239
146
  }
240
- /* ────────────────────────────────────────────────────────────────────────────
241
- HEADLESS UI HELPERS
242
- ───────────────────────────────────────────────────────────────────────────── */
243
- /**
244
- * Transition presets for Headless UI Transition component with icons.
245
- */
246
147
  const headlessTransitions = {
247
- /** Fade in/out */
248
- fade: {
249
- enter: 'transition-opacity duration-150 ease-out',
250
- enterFrom: 'opacity-0',
251
- enterTo: 'opacity-100',
252
- leave: 'transition-opacity duration-100 ease-in',
253
- leaveFrom: 'opacity-100',
254
- leaveTo: 'opacity-0',
255
- },
256
- /** Scale up/down */
257
- scale: {
258
- enter: 'transition-transform duration-150 ease-out',
259
- enterFrom: 'scale-75',
260
- enterTo: 'scale-100',
261
- leave: 'transition-transform duration-100 ease-in',
262
- leaveFrom: 'scale-100',
263
- leaveTo: 'scale-75',
264
- },
265
- /** Rotate */
266
- rotate: {
267
- enter: 'transition-transform duration-200 ease-out',
268
- enterFrom: 'rotate-0',
269
- enterTo: 'rotate-180',
270
- leave: 'transition-transform duration-200 ease-in',
271
- leaveFrom: 'rotate-180',
272
- leaveTo: 'rotate-0',
273
- },
274
- /** Spin (for loading) */
275
- spin: {
276
- enter: 'animate-spin',
277
- enterFrom: '',
278
- enterTo: '',
279
- leave: '',
280
- leaveFrom: '',
281
- leaveTo: '',
282
- },
148
+ /** Fade in/out */
149
+ fade: {
150
+ enter: "transition-opacity duration-150 ease-out",
151
+ enterFrom: "opacity-0",
152
+ enterTo: "opacity-100",
153
+ leave: "transition-opacity duration-100 ease-in",
154
+ leaveFrom: "opacity-100",
155
+ leaveTo: "opacity-0"
156
+ },
157
+ /** Scale up/down */
158
+ scale: {
159
+ enter: "transition-transform duration-150 ease-out",
160
+ enterFrom: "scale-75",
161
+ enterTo: "scale-100",
162
+ leave: "transition-transform duration-100 ease-in",
163
+ leaveFrom: "scale-100",
164
+ leaveTo: "scale-75"
165
+ },
166
+ /** Rotate */
167
+ rotate: {
168
+ enter: "transition-transform duration-200 ease-out",
169
+ enterFrom: "rotate-0",
170
+ enterTo: "rotate-180",
171
+ leave: "transition-transform duration-200 ease-in",
172
+ leaveFrom: "rotate-180",
173
+ leaveTo: "rotate-0"
174
+ },
175
+ /** Spin (for loading) */
176
+ spin: {
177
+ enter: "animate-spin",
178
+ enterFrom: "",
179
+ enterTo: "",
180
+ leave: "",
181
+ leaveFrom: "",
182
+ leaveTo: ""
183
+ }
283
184
  };
284
- /**
285
- * Creates a Headless UI compatible icon with transition support.
286
- *
287
- * @param IconComponent - The icon component
288
- * @param transition - Transition preset name
289
- * @returns Icon component with transition classes
290
- */
291
- function createHeadlessIcon(IconComponent, transition = 'fade') {
292
- const HeadlessIcon = ({ show = true, className, ...props }) => {
293
- const t = headlessTransitions[transition];
294
- const transitionClass = show ? `${t.enter} ${t.enterTo}` : `${t.leave} ${t.leaveTo}`;
295
- return React.createElement(IconComponent, {
296
- ...props,
297
- className: `${className || ''} ${transitionClass}`.trim(),
298
- });
299
- };
300
- HeadlessIcon.displayName = `Headless${IconComponent.displayName || 'Icon'}`;
301
- return HeadlessIcon;
185
+ function createHeadlessIcon(IconComponent, transition = "fade") {
186
+ const HeadlessIcon = ({
187
+ show = true,
188
+ className,
189
+ ...props
190
+ }) => {
191
+ const t = headlessTransitions[transition];
192
+ const transitionClass = show ? `${t.enter} ${t.enterTo}` : `${t.leave} ${t.leaveTo}`;
193
+ return React.createElement(IconComponent, {
194
+ ...props,
195
+ className: `${className || ""} ${transitionClass}`.trim()
196
+ });
197
+ };
198
+ HeadlessIcon.displayName = `Headless${IconComponent.displayName || "Icon"}`;
199
+ return HeadlessIcon;
302
200
  }
303
- /* ────────────────────────────────────────────────────────────────────────────
304
- ICON BUTTON PRESETS
305
- ───────────────────────────────────────────────────────────────────────────── */
306
- /**
307
- * Props generator for common icon button patterns in shadcn/ui.
308
- */
309
201
  const iconButtonPresets = {
310
- /**
311
- * Close button (X icon)
312
- */
313
- close: {
314
- className: 'rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground',
315
- size: 16,
316
- },
317
- /**
318
- * Chevron (accordion, collapsible)
319
- */
320
- chevron: {
321
- className: 'h-4 w-4 shrink-0 transition-transform duration-200',
322
- 'data-chevron': true,
323
- },
324
- /**
325
- * Menu trigger
326
- */
327
- menuTrigger: {
328
- className: 'h-5 w-5',
329
- strokeWidth: 1.5,
330
- },
331
- /**
332
- * Navigation item icon
333
- */
334
- navItem: {
335
- className: 'mr-2 h-4 w-4 shrink-0',
336
- },
337
- /**
338
- * Sidebar icon
339
- */
340
- sidebar: {
341
- className: 'h-4 w-4',
342
- strokeWidth: 2,
343
- },
344
- /**
345
- * Toast icon
346
- */
347
- toast: {
348
- className: 'h-5 w-5',
349
- },
350
- /**
351
- * Dialog icon
352
- */
353
- dialog: {
354
- className: 'h-4 w-4 opacity-70',
355
- },
202
+ /**
203
+ * Close button (X icon)
204
+ */
205
+ close: {
206
+ className: "rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
207
+ size: 16
208
+ },
209
+ /**
210
+ * Chevron (accordion, collapsible)
211
+ */
212
+ chevron: {
213
+ className: "h-4 w-4 shrink-0 transition-transform duration-200",
214
+ "data-chevron": true
215
+ },
216
+ /**
217
+ * Menu trigger
218
+ */
219
+ menuTrigger: {
220
+ className: "h-5 w-5",
221
+ strokeWidth: 1.5
222
+ },
223
+ /**
224
+ * Navigation item icon
225
+ */
226
+ navItem: {
227
+ className: "mr-2 h-4 w-4 shrink-0"
228
+ },
229
+ /**
230
+ * Sidebar icon
231
+ */
232
+ sidebar: {
233
+ className: "h-4 w-4",
234
+ strokeWidth: 2
235
+ },
236
+ /**
237
+ * Toast icon
238
+ */
239
+ toast: {
240
+ className: "h-5 w-5"
241
+ },
242
+ /**
243
+ * Dialog icon
244
+ */
245
+ dialog: {
246
+ className: "h-4 w-4 opacity-70"
247
+ }
356
248
  };
357
- /* ────────────────────────────────────────────────────────────────────────────
358
- UTILITY FUNCTIONS
359
- ───────────────────────────────────────────────────────────────────────────── */
360
- /**
361
- * Merges icon props with shadcn/ui defaults.
362
- *
363
- * @param props - User-provided props
364
- * @param preset - Preset name from iconButtonPresets
365
- * @returns Merged props
366
- */
367
249
  function mergeIconProps(props, preset) {
368
- const presetProps = iconButtonPresets[preset];
369
- return {
370
- ...presetProps,
371
- ...props,
372
- className: `${presetProps.className || ''} ${props.className || ''}`.trim(),
373
- };
250
+ const presetProps = iconButtonPresets[preset];
251
+ return {
252
+ ...presetProps,
253
+ ...props,
254
+ className: `${presetProps.className || ""} ${props.className || ""}`.trim()
255
+ };
374
256
  }
375
- /**
376
- * Creates a className string for icons based on variant and size.
377
- *
378
- * @param options - Styling options
379
- * @returns Tailwind className string
380
- */
381
257
  function getIconClassName(options = {}) {
382
- const { variant = 'default', size = 'md', interactive = false, spinning = false } = options;
383
- const sizeMap = {
384
- xs: 'h-3 w-3',
385
- sm: 'h-3.5 w-3.5',
386
- md: 'h-4 w-4',
387
- lg: 'h-5 w-5',
388
- xl: 'h-6 w-6',
389
- };
390
- const variantMap = {
391
- default: '',
392
- muted: 'text-muted-foreground',
393
- primary: 'text-primary',
394
- destructive: 'text-destructive',
395
- };
396
- const classes = [
397
- sizeMap[size],
398
- variantMap[variant],
399
- interactive && 'transition-colors hover:text-foreground cursor-pointer',
400
- spinning && 'animate-spin',
401
- ].filter(Boolean);
402
- return classes.join(' ');
258
+ const { variant = "default", size = "md", interactive = false, spinning = false } = options;
259
+ const sizeMap = {
260
+ xs: "h-3 w-3",
261
+ sm: "h-3.5 w-3.5",
262
+ md: "h-4 w-4",
263
+ lg: "h-5 w-5",
264
+ xl: "h-6 w-6"
265
+ };
266
+ const variantMap = {
267
+ default: "",
268
+ muted: "text-muted-foreground",
269
+ primary: "text-primary",
270
+ destructive: "text-destructive"
271
+ };
272
+ const classes = [
273
+ sizeMap[size],
274
+ variantMap[variant],
275
+ interactive && "transition-colors hover:text-foreground cursor-pointer",
276
+ spinning && "animate-spin"
277
+ ].filter(Boolean);
278
+ return classes.join(" ");
403
279
  }
404
- /* ────────────────────────────────────────────────────────────────────────────
405
- EXPORTS
406
- ───────────────────────────────────────────────────────────────────────────── */
407
- var headlessUi = {
408
- forwardRefIcon,
409
- createRadixIcon,
410
- withRadixState,
411
- createHeadlessIcon,
412
- getShadcnIconProps,
413
- mergeIconProps,
414
- getIconClassName,
415
- Slot,
416
- SHADCN_ICON_SIZES,
417
- SHADCN_COLOR_TOKENS,
418
- shadcnIconClasses,
419
- headlessTransitions,
420
- iconButtonPresets,
280
+ const headlessUi = {
281
+ forwardRefIcon,
282
+ createRadixIcon,
283
+ withRadixState,
284
+ createHeadlessIcon,
285
+ getShadcnIconProps,
286
+ mergeIconProps,
287
+ getIconClassName,
288
+ Slot,
289
+ SHADCN_ICON_SIZES,
290
+ SHADCN_COLOR_TOKENS,
291
+ shadcnIconClasses,
292
+ headlessTransitions,
293
+ iconButtonPresets
421
294
  };
422
-
423
295
  exports.SHADCN_COLOR_TOKENS = SHADCN_COLOR_TOKENS;
424
296
  exports.SHADCN_ICON_SIZES = SHADCN_ICON_SIZES;
425
297
  exports.Slot = Slot;