@nice2dev/icons 1.0.0 → 1.0.2

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 (152) hide show
  1. package/CHANGELOG.md +169 -7
  2. package/README.md +247 -2
  3. package/bin/ntd-icons.mjs +732 -0
  4. package/dist/cjs/NtdIconBadge.js +375 -0
  5. package/dist/cjs/NtdIconBadge.js.map +1 -0
  6. package/dist/cjs/NtdIconMorph.js +386 -0
  7. package/dist/cjs/NtdIconMorph.js.map +1 -0
  8. package/dist/cjs/NtdStateMorph.js +177 -0
  9. package/dist/cjs/NtdStateMorph.js.map +1 -0
  10. package/dist/cjs/createIcon.js +51 -4
  11. package/dist/cjs/createIcon.js.map +1 -1
  12. package/dist/cjs/figmaSync.js +308 -0
  13. package/dist/cjs/figmaSync.js.map +1 -0
  14. package/dist/cjs/iconAnalytics.js +189 -0
  15. package/dist/cjs/iconAnalytics.js.map +1 -0
  16. package/dist/cjs/iconMetadata.js +523 -0
  17. package/dist/cjs/iconMetadata.js.map +1 -0
  18. package/dist/cjs/iconStyles.js +597 -0
  19. package/dist/cjs/iconStyles.js.map +1 -0
  20. package/dist/cjs/icons/accessibility.js +168 -0
  21. package/dist/cjs/icons/accessibility.js.map +1 -0
  22. package/dist/cjs/icons/ai.js +191 -0
  23. package/dist/cjs/icons/ai.js.map +1 -0
  24. package/dist/cjs/icons/brand.js +70 -0
  25. package/dist/cjs/icons/brand.js.map +1 -1
  26. package/dist/cjs/icons/education.js +212 -0
  27. package/dist/cjs/icons/education.js.map +1 -0
  28. package/dist/cjs/icons/food.js +198 -0
  29. package/dist/cjs/icons/food.js.map +1 -0
  30. package/dist/cjs/icons/gaming.js +191 -0
  31. package/dist/cjs/icons/gaming.js.map +1 -0
  32. package/dist/cjs/icons/index.js +520 -0
  33. package/dist/cjs/icons/index.js.map +1 -0
  34. package/dist/cjs/icons/legal.js +168 -0
  35. package/dist/cjs/icons/legal.js.map +1 -0
  36. package/dist/cjs/icons/realestate.js +212 -0
  37. package/dist/cjs/icons/realestate.js.map +1 -0
  38. package/dist/cjs/icons/science.js +201 -0
  39. package/dist/cjs/icons/science.js.map +1 -0
  40. package/dist/cjs/icons/sports.js +176 -0
  41. package/dist/cjs/icons/sports.js.map +1 -0
  42. package/dist/cjs/icons/sustainability.js +193 -0
  43. package/dist/cjs/icons/sustainability.js.map +1 -0
  44. package/dist/cjs/icons/travel.js +184 -0
  45. package/dist/cjs/icons/travel.js.map +1 -0
  46. package/dist/cjs/index.js +265 -2
  47. package/dist/cjs/index.js.map +1 -1
  48. package/dist/cjs/lottieIntegration.js +286 -0
  49. package/dist/cjs/lottieIntegration.js.map +1 -0
  50. package/dist/cjs/nicetodev-icons.css +1 -1
  51. package/dist/cjs/particleEffects.js +259 -0
  52. package/dist/cjs/particleEffects.js.map +1 -0
  53. package/dist/cjs/resolver.js +224 -0
  54. package/dist/cjs/resolver.js.map +1 -0
  55. package/dist/cjs/tailwind-plugin.js +340 -0
  56. package/dist/cjs/tailwind-plugin.js.map +1 -0
  57. package/dist/cjs/types.js +38 -0
  58. package/dist/cjs/types.js.map +1 -1
  59. package/dist/cjs/variantProps.js +78 -0
  60. package/dist/cjs/variantProps.js.map +1 -0
  61. package/dist/esm/NtdIconBadge.js +370 -0
  62. package/dist/esm/NtdIconBadge.js.map +1 -0
  63. package/dist/esm/NtdIconMorph.js +381 -0
  64. package/dist/esm/NtdIconMorph.js.map +1 -0
  65. package/dist/esm/NtdStateMorph.js +174 -0
  66. package/dist/esm/NtdStateMorph.js.map +1 -0
  67. package/dist/esm/createIcon.js +53 -6
  68. package/dist/esm/createIcon.js.map +1 -1
  69. package/dist/esm/figmaSync.js +304 -0
  70. package/dist/esm/figmaSync.js.map +1 -0
  71. package/dist/esm/iconAnalytics.js +185 -0
  72. package/dist/esm/iconAnalytics.js.map +1 -0
  73. package/dist/esm/iconMetadata.js +510 -0
  74. package/dist/esm/iconMetadata.js.map +1 -0
  75. package/dist/esm/iconStyles.js +585 -0
  76. package/dist/esm/iconStyles.js.map +1 -0
  77. package/dist/esm/icons/accessibility.js +153 -0
  78. package/dist/esm/icons/accessibility.js.map +1 -0
  79. package/dist/esm/icons/ai.js +174 -0
  80. package/dist/esm/icons/ai.js.map +1 -0
  81. package/dist/esm/icons/brand.js +67 -1
  82. package/dist/esm/icons/brand.js.map +1 -1
  83. package/dist/esm/icons/education.js +193 -0
  84. package/dist/esm/icons/education.js.map +1 -0
  85. package/dist/esm/icons/food.js +180 -0
  86. package/dist/esm/icons/food.js.map +1 -0
  87. package/dist/esm/icons/gaming.js +174 -0
  88. package/dist/esm/icons/gaming.js.map +1 -0
  89. package/dist/esm/icons/index.js +31 -0
  90. package/dist/esm/icons/index.js.map +1 -0
  91. package/dist/esm/icons/legal.js +153 -0
  92. package/dist/esm/icons/legal.js.map +1 -0
  93. package/dist/esm/icons/realestate.js +193 -0
  94. package/dist/esm/icons/realestate.js.map +1 -0
  95. package/dist/esm/icons/science.js +183 -0
  96. package/dist/esm/icons/science.js.map +1 -0
  97. package/dist/esm/icons/sports.js +160 -0
  98. package/dist/esm/icons/sports.js.map +1 -0
  99. package/dist/esm/icons/sustainability.js +176 -0
  100. package/dist/esm/icons/sustainability.js.map +1 -0
  101. package/dist/esm/icons/travel.js +167 -0
  102. package/dist/esm/icons/travel.js.map +1 -0
  103. package/dist/esm/index.js +27 -5
  104. package/dist/esm/index.js.map +1 -1
  105. package/dist/esm/lottieIntegration.js +282 -0
  106. package/dist/esm/lottieIntegration.js.map +1 -0
  107. package/dist/esm/nicetodev-icons.css +1 -1
  108. package/dist/esm/particleEffects.js +257 -0
  109. package/dist/esm/particleEffects.js.map +1 -0
  110. package/dist/esm/resolver.js +221 -0
  111. package/dist/esm/resolver.js.map +1 -0
  112. package/dist/esm/tailwind-plugin.js +337 -0
  113. package/dist/esm/tailwind-plugin.js.map +1 -0
  114. package/dist/esm/types.js +37 -1
  115. package/dist/esm/types.js.map +1 -1
  116. package/dist/esm/variantProps.js +68 -0
  117. package/dist/esm/variantProps.js.map +1 -0
  118. package/dist/types/NtdIconBadge.d.ts +209 -0
  119. package/dist/types/NtdIconMorph.d.ts +183 -0
  120. package/dist/types/NtdStateMorph.d.ts +100 -0
  121. package/dist/types/client.d.ts +27 -0
  122. package/dist/types/design-tokens.d.ts +281 -0
  123. package/dist/types/figmaSync.d.ts +135 -0
  124. package/dist/types/headless-ui.d.ts +462 -0
  125. package/dist/types/iconAnalytics.d.ts +131 -0
  126. package/dist/types/iconMetadata.d.ts +123 -0
  127. package/dist/types/iconStyles.d.ts +104 -0
  128. package/dist/types/icons/accessibility.d.ts +39 -0
  129. package/dist/types/icons/ai.d.ts +43 -0
  130. package/dist/types/icons/brand.d.ts +4 -0
  131. package/dist/types/icons/education.d.ts +47 -0
  132. package/dist/types/icons/food.d.ts +45 -0
  133. package/dist/types/icons/gaming.d.ts +42 -0
  134. package/dist/types/icons/index.d.ts +12 -1
  135. package/dist/types/icons/legal.d.ts +39 -0
  136. package/dist/types/icons/realestate.d.ts +47 -0
  137. package/dist/types/icons/science.d.ts +45 -0
  138. package/dist/types/icons/sports.d.ts +41 -0
  139. package/dist/types/icons/sustainability.d.ts +43 -0
  140. package/dist/types/icons/travel.d.ts +43 -0
  141. package/dist/types/index.d.ts +28 -6
  142. package/dist/types/lottieIntegration.d.ts +173 -0
  143. package/dist/types/micro-interactions.d.ts +146 -0
  144. package/dist/types/microInteractions.d.ts +174 -0
  145. package/dist/types/particleEffects.d.ts +69 -0
  146. package/dist/types/resolver.d.ts +58 -0
  147. package/dist/types/rsc.d.ts +159 -0
  148. package/dist/types/tailwind-plugin.d.ts +100 -0
  149. package/dist/types/types.d.ts +100 -0
  150. package/dist/types/utilities.d.ts +221 -0
  151. package/dist/types/variantProps.d.ts +122 -0
  152. package/package.json +58 -5
@@ -0,0 +1,462 @@
1
+ /**
2
+ * @file headless-ui.tsx
3
+ * @description Headless UI / shadcn/ui compatibility layer for @nice2dev/icons
4
+ *
5
+ * Provides seamless integration with:
6
+ * - Radix UI components (via asChild pattern)
7
+ * - Headless UI components
8
+ * - shadcn/ui design system
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * // With shadcn/ui Button
13
+ * import { Button } from '@/components/ui/button';
14
+ * import { NtdSettings } from '@nice2dev/icons';
15
+ * import { forwardRefIcon } from '@nice2dev/icons/headless-ui';
16
+ *
17
+ * const SettingsIcon = forwardRefIcon(NtdSettings);
18
+ *
19
+ * <Button variant="ghost" size="icon" asChild>
20
+ * <SettingsIcon className="h-4 w-4" />
21
+ * </Button>
22
+ * ```
23
+ *
24
+ * @version 1.0.0
25
+ * @since 2026-03
26
+ * @license MIT
27
+ */
28
+ import React, { type ComponentType, type SVGProps, type ForwardRefExoticComponent, type PropsWithoutRef, type RefAttributes } from 'react';
29
+ /**
30
+ * Base icon props interface
31
+ */
32
+ export interface IconProps extends SVGProps<SVGSVGElement> {
33
+ size?: number | string;
34
+ color?: string;
35
+ primaryColor?: string;
36
+ secondaryColor?: string;
37
+ strokeWidth?: number | string;
38
+ variant?: string;
39
+ animation?: string;
40
+ animated?: boolean;
41
+ [key: `data-${string}`]: string | boolean | undefined;
42
+ }
43
+ /**
44
+ * Props for Radix UI asChild pattern compatibility
45
+ */
46
+ export interface AsChildProps {
47
+ asChild?: boolean;
48
+ children?: React.ReactNode;
49
+ }
50
+ /**
51
+ * Combined props for headless-compatible icons
52
+ */
53
+ export type HeadlessIconProps = IconProps & AsChildProps & {
54
+ [key: `data-${string}`]: string | boolean | undefined;
55
+ };
56
+ /**
57
+ * Slot props for Radix UI Slot pattern
58
+ */
59
+ interface SlotProps {
60
+ children?: React.ReactNode;
61
+ }
62
+ /**
63
+ * ForwardRef icon component type
64
+ */
65
+ export type ForwardRefIcon = ForwardRefExoticComponent<PropsWithoutRef<HeadlessIconProps> & RefAttributes<SVGSVGElement>>;
66
+ /**
67
+ * Simple Slot implementation for asChild pattern.
68
+ * Compatible with Radix UI's Slot component behavior.
69
+ */
70
+ export declare const Slot: React.ForwardRefExoticComponent<Omit<SlotProps & Record<string, unknown>, "ref"> & React.RefAttributes<Element>>;
71
+ /**
72
+ * Wraps a NtdIcon component with forwardRef for Headless UI / Radix compatibility.
73
+ * Supports the asChild pattern used by shadcn/ui and Radix primitives.
74
+ *
75
+ * @param IconComponent - The NtdIcon component to wrap
76
+ * @param displayName - Optional display name for debugging
77
+ * @returns A forwardRef-wrapped icon component
78
+ *
79
+ * @example
80
+ * ```tsx
81
+ * import { NtdUser, NtdSettings } from '@nice2dev/icons';
82
+ * import { forwardRefIcon } from '@nice2dev/icons/headless-ui';
83
+ *
84
+ * // Create ref-compatible versions
85
+ * const UserIcon = forwardRefIcon(NtdUser);
86
+ * const SettingsIcon = forwardRefIcon(NtdSettings, 'SettingsIcon');
87
+ *
88
+ * // Use with Radix UI / shadcn
89
+ * <DropdownMenu.Trigger asChild>
90
+ * <SettingsIcon className="h-5 w-5" />
91
+ * </DropdownMenu.Trigger>
92
+ * ```
93
+ */
94
+ export declare function forwardRefIcon(IconComponent: ComponentType<any>, displayName?: string): ForwardRefIcon;
95
+ /**
96
+ * shadcn/ui icon size presets matching their button sizes
97
+ */
98
+ export declare const SHADCN_ICON_SIZES: {
99
+ readonly default: "1rem";
100
+ readonly sm: "0.875rem";
101
+ readonly lg: "1.125rem";
102
+ readonly icon: "1rem";
103
+ };
104
+ /**
105
+ * shadcn/ui color tokens mapping
106
+ */
107
+ export declare const SHADCN_COLOR_TOKENS: {
108
+ readonly foreground: "hsl(var(--foreground))";
109
+ readonly mutedForeground: "hsl(var(--muted-foreground))";
110
+ readonly primary: "hsl(var(--primary))";
111
+ readonly primaryForeground: "hsl(var(--primary-foreground))";
112
+ readonly secondary: "hsl(var(--secondary))";
113
+ readonly secondaryForeground: "hsl(var(--secondary-foreground))";
114
+ readonly accent: "hsl(var(--accent))";
115
+ readonly accentForeground: "hsl(var(--accent-foreground))";
116
+ readonly destructive: "hsl(var(--destructive))";
117
+ readonly destructiveForeground: "hsl(var(--destructive-foreground))";
118
+ };
119
+ /**
120
+ * Creates shadcn/ui themed icon props
121
+ *
122
+ * @param variant - shadcn button variant
123
+ * @param size - shadcn button size
124
+ * @returns Props object for the icon
125
+ */
126
+ export declare function getShadcnIconProps(variant?: 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link', size?: keyof typeof SHADCN_ICON_SIZES): Partial<IconProps>;
127
+ /**
128
+ * Preset shadcn/ui className utilities for icons
129
+ */
130
+ export declare const shadcnIconClasses: {
131
+ /** Standard icon in button */
132
+ readonly button: "h-4 w-4";
133
+ /** Icon with right margin (before text) */
134
+ readonly buttonLeft: "mr-2 h-4 w-4";
135
+ /** Icon with left margin (after text) */
136
+ readonly buttonRight: "ml-2 h-4 w-4";
137
+ /** Small icon */
138
+ readonly sm: "h-3.5 w-3.5";
139
+ /** Large icon */
140
+ readonly lg: "h-5 w-5";
141
+ /** Icon-only button */
142
+ readonly iconOnly: "h-4 w-4";
143
+ /** Navigation menu icon */
144
+ readonly nav: "h-4 w-4 shrink-0";
145
+ /** Dropdown menu icon */
146
+ readonly dropdown: "mr-2 h-4 w-4";
147
+ /** Alert/toast icon */
148
+ readonly alert: "h-4 w-4";
149
+ /** Badge icon */
150
+ readonly badge: "h-3 w-3";
151
+ /** Card header icon */
152
+ readonly card: "h-5 w-5 text-muted-foreground";
153
+ /** Spinner/loading */
154
+ readonly spinner: "h-4 w-4 animate-spin";
155
+ };
156
+ /**
157
+ * Creates an icon component compatible with Radix UI primitives.
158
+ * Automatically handles ref forwarding and asChild pattern.
159
+ *
160
+ * @param IconComponent - The NtdIcon component
161
+ * @param defaultProps - Default props to apply
162
+ * @returns Radix-compatible icon component
163
+ *
164
+ * @example
165
+ * ```tsx
166
+ * import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
167
+ * import { NtdChevronDown } from '@nice2dev/icons';
168
+ * import { createRadixIcon } from '@nice2dev/icons/headless-ui';
169
+ *
170
+ * const ChevronIcon = createRadixIcon(NtdChevronDown, {
171
+ * className: 'h-4 w-4 text-muted-foreground'
172
+ * });
173
+ *
174
+ * <DropdownMenu.Trigger>
175
+ * Options <ChevronIcon />
176
+ * </DropdownMenu.Trigger>
177
+ * ```
178
+ */
179
+ export declare function createRadixIcon(IconComponent: ComponentType<any>, defaultProps?: Partial<IconProps>): ForwardRefIcon;
180
+ /**
181
+ * HOC that adds Radix UI state-based styling to icons.
182
+ * Supports data-state attributes for open/closed states.
183
+ *
184
+ * @param IconComponent - The icon component to enhance
185
+ * @returns Enhanced icon with state-aware styling
186
+ *
187
+ * @example
188
+ * ```tsx
189
+ * const StateAwareChevron = withRadixState(NtdChevronDown);
190
+ *
191
+ * // Automatically rotates when parent has data-state="open"
192
+ * <Collapsible.Trigger>
193
+ * <StateAwareChevron />
194
+ * </Collapsible.Trigger>
195
+ * ```
196
+ */
197
+ export declare function withRadixState(IconComponent: ComponentType<any>): ForwardRefIcon;
198
+ /**
199
+ * Transition presets for Headless UI Transition component with icons.
200
+ */
201
+ export declare const headlessTransitions: {
202
+ /** Fade in/out */
203
+ readonly fade: {
204
+ readonly enter: "transition-opacity duration-150 ease-out";
205
+ readonly enterFrom: "opacity-0";
206
+ readonly enterTo: "opacity-100";
207
+ readonly leave: "transition-opacity duration-100 ease-in";
208
+ readonly leaveFrom: "opacity-100";
209
+ readonly leaveTo: "opacity-0";
210
+ };
211
+ /** Scale up/down */
212
+ readonly scale: {
213
+ readonly enter: "transition-transform duration-150 ease-out";
214
+ readonly enterFrom: "scale-75";
215
+ readonly enterTo: "scale-100";
216
+ readonly leave: "transition-transform duration-100 ease-in";
217
+ readonly leaveFrom: "scale-100";
218
+ readonly leaveTo: "scale-75";
219
+ };
220
+ /** Rotate */
221
+ readonly rotate: {
222
+ readonly enter: "transition-transform duration-200 ease-out";
223
+ readonly enterFrom: "rotate-0";
224
+ readonly enterTo: "rotate-180";
225
+ readonly leave: "transition-transform duration-200 ease-in";
226
+ readonly leaveFrom: "rotate-180";
227
+ readonly leaveTo: "rotate-0";
228
+ };
229
+ /** Spin (for loading) */
230
+ readonly spin: {
231
+ readonly enter: "animate-spin";
232
+ readonly enterFrom: "";
233
+ readonly enterTo: "";
234
+ readonly leave: "";
235
+ readonly leaveFrom: "";
236
+ readonly leaveTo: "";
237
+ };
238
+ };
239
+ /**
240
+ * Creates a Headless UI compatible icon with transition support.
241
+ *
242
+ * @param IconComponent - The icon component
243
+ * @param transition - Transition preset name
244
+ * @returns Icon component with transition classes
245
+ */
246
+ export declare function createHeadlessIcon(IconComponent: ComponentType<any>, transition?: keyof typeof headlessTransitions): ComponentType<IconProps & {
247
+ show?: boolean;
248
+ }>;
249
+ /**
250
+ * Props generator for common icon button patterns in shadcn/ui.
251
+ */
252
+ export declare const iconButtonPresets: {
253
+ /**
254
+ * Close button (X icon)
255
+ */
256
+ readonly close: {
257
+ readonly 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";
258
+ readonly size: 16;
259
+ };
260
+ /**
261
+ * Chevron (accordion, collapsible)
262
+ */
263
+ readonly chevron: {
264
+ readonly className: "h-4 w-4 shrink-0 transition-transform duration-200";
265
+ readonly 'data-chevron': true;
266
+ };
267
+ /**
268
+ * Menu trigger
269
+ */
270
+ readonly menuTrigger: {
271
+ readonly className: "h-5 w-5";
272
+ readonly strokeWidth: 1.5;
273
+ };
274
+ /**
275
+ * Navigation item icon
276
+ */
277
+ readonly navItem: {
278
+ readonly className: "mr-2 h-4 w-4 shrink-0";
279
+ };
280
+ /**
281
+ * Sidebar icon
282
+ */
283
+ readonly sidebar: {
284
+ readonly className: "h-4 w-4";
285
+ readonly strokeWidth: 2;
286
+ };
287
+ /**
288
+ * Toast icon
289
+ */
290
+ readonly toast: {
291
+ readonly className: "h-5 w-5";
292
+ };
293
+ /**
294
+ * Dialog icon
295
+ */
296
+ readonly dialog: {
297
+ readonly className: "h-4 w-4 opacity-70";
298
+ };
299
+ };
300
+ /**
301
+ * Merges icon props with shadcn/ui defaults.
302
+ *
303
+ * @param props - User-provided props
304
+ * @param preset - Preset name from iconButtonPresets
305
+ * @returns Merged props
306
+ */
307
+ export declare function mergeIconProps<T extends IconProps>(props: T, preset: keyof typeof iconButtonPresets): T & {
308
+ className: string;
309
+ };
310
+ /**
311
+ * Creates a className string for icons based on variant and size.
312
+ *
313
+ * @param options - Styling options
314
+ * @returns Tailwind className string
315
+ */
316
+ export declare function getIconClassName(options?: {
317
+ variant?: 'default' | 'muted' | 'primary' | 'destructive';
318
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
319
+ interactive?: boolean;
320
+ spinning?: boolean;
321
+ }): string;
322
+ declare const _default: {
323
+ forwardRefIcon: typeof forwardRefIcon;
324
+ createRadixIcon: typeof createRadixIcon;
325
+ withRadixState: typeof withRadixState;
326
+ createHeadlessIcon: typeof createHeadlessIcon;
327
+ getShadcnIconProps: typeof getShadcnIconProps;
328
+ mergeIconProps: typeof mergeIconProps;
329
+ getIconClassName: typeof getIconClassName;
330
+ Slot: React.ForwardRefExoticComponent<Omit<SlotProps & Record<string, unknown>, "ref"> & React.RefAttributes<Element>>;
331
+ SHADCN_ICON_SIZES: {
332
+ readonly default: "1rem";
333
+ readonly sm: "0.875rem";
334
+ readonly lg: "1.125rem";
335
+ readonly icon: "1rem";
336
+ };
337
+ SHADCN_COLOR_TOKENS: {
338
+ readonly foreground: "hsl(var(--foreground))";
339
+ readonly mutedForeground: "hsl(var(--muted-foreground))";
340
+ readonly primary: "hsl(var(--primary))";
341
+ readonly primaryForeground: "hsl(var(--primary-foreground))";
342
+ readonly secondary: "hsl(var(--secondary))";
343
+ readonly secondaryForeground: "hsl(var(--secondary-foreground))";
344
+ readonly accent: "hsl(var(--accent))";
345
+ readonly accentForeground: "hsl(var(--accent-foreground))";
346
+ readonly destructive: "hsl(var(--destructive))";
347
+ readonly destructiveForeground: "hsl(var(--destructive-foreground))";
348
+ };
349
+ shadcnIconClasses: {
350
+ /** Standard icon in button */
351
+ readonly button: "h-4 w-4";
352
+ /** Icon with right margin (before text) */
353
+ readonly buttonLeft: "mr-2 h-4 w-4";
354
+ /** Icon with left margin (after text) */
355
+ readonly buttonRight: "ml-2 h-4 w-4";
356
+ /** Small icon */
357
+ readonly sm: "h-3.5 w-3.5";
358
+ /** Large icon */
359
+ readonly lg: "h-5 w-5";
360
+ /** Icon-only button */
361
+ readonly iconOnly: "h-4 w-4";
362
+ /** Navigation menu icon */
363
+ readonly nav: "h-4 w-4 shrink-0";
364
+ /** Dropdown menu icon */
365
+ readonly dropdown: "mr-2 h-4 w-4";
366
+ /** Alert/toast icon */
367
+ readonly alert: "h-4 w-4";
368
+ /** Badge icon */
369
+ readonly badge: "h-3 w-3";
370
+ /** Card header icon */
371
+ readonly card: "h-5 w-5 text-muted-foreground";
372
+ /** Spinner/loading */
373
+ readonly spinner: "h-4 w-4 animate-spin";
374
+ };
375
+ headlessTransitions: {
376
+ /** Fade in/out */
377
+ readonly fade: {
378
+ readonly enter: "transition-opacity duration-150 ease-out";
379
+ readonly enterFrom: "opacity-0";
380
+ readonly enterTo: "opacity-100";
381
+ readonly leave: "transition-opacity duration-100 ease-in";
382
+ readonly leaveFrom: "opacity-100";
383
+ readonly leaveTo: "opacity-0";
384
+ };
385
+ /** Scale up/down */
386
+ readonly scale: {
387
+ readonly enter: "transition-transform duration-150 ease-out";
388
+ readonly enterFrom: "scale-75";
389
+ readonly enterTo: "scale-100";
390
+ readonly leave: "transition-transform duration-100 ease-in";
391
+ readonly leaveFrom: "scale-100";
392
+ readonly leaveTo: "scale-75";
393
+ };
394
+ /** Rotate */
395
+ readonly rotate: {
396
+ readonly enter: "transition-transform duration-200 ease-out";
397
+ readonly enterFrom: "rotate-0";
398
+ readonly enterTo: "rotate-180";
399
+ readonly leave: "transition-transform duration-200 ease-in";
400
+ readonly leaveFrom: "rotate-180";
401
+ readonly leaveTo: "rotate-0";
402
+ };
403
+ /** Spin (for loading) */
404
+ readonly spin: {
405
+ readonly enter: "animate-spin";
406
+ readonly enterFrom: "";
407
+ readonly enterTo: "";
408
+ readonly leave: "";
409
+ readonly leaveFrom: "";
410
+ readonly leaveTo: "";
411
+ };
412
+ };
413
+ iconButtonPresets: {
414
+ /**
415
+ * Close button (X icon)
416
+ */
417
+ readonly close: {
418
+ readonly 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";
419
+ readonly size: 16;
420
+ };
421
+ /**
422
+ * Chevron (accordion, collapsible)
423
+ */
424
+ readonly chevron: {
425
+ readonly className: "h-4 w-4 shrink-0 transition-transform duration-200";
426
+ readonly 'data-chevron': true;
427
+ };
428
+ /**
429
+ * Menu trigger
430
+ */
431
+ readonly menuTrigger: {
432
+ readonly className: "h-5 w-5";
433
+ readonly strokeWidth: 1.5;
434
+ };
435
+ /**
436
+ * Navigation item icon
437
+ */
438
+ readonly navItem: {
439
+ readonly className: "mr-2 h-4 w-4 shrink-0";
440
+ };
441
+ /**
442
+ * Sidebar icon
443
+ */
444
+ readonly sidebar: {
445
+ readonly className: "h-4 w-4";
446
+ readonly strokeWidth: 2;
447
+ };
448
+ /**
449
+ * Toast icon
450
+ */
451
+ readonly toast: {
452
+ readonly className: "h-5 w-5";
453
+ };
454
+ /**
455
+ * Dialog icon
456
+ */
457
+ readonly dialog: {
458
+ readonly className: "h-4 w-4 opacity-70";
459
+ };
460
+ };
461
+ };
462
+ export default _default;
@@ -0,0 +1,131 @@
1
+ /**
2
+ * @file iconAnalytics.tsx
3
+ * @description Optional icon usage analytics — tracks which icons are rendered,
4
+ * provides a dashboard component, and recommendations for unused icons.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * // 1. Wrap your app with the analytics provider
9
+ * const { AnalyticsProvider, useIconAnalytics } = createIconAnalyticsProvider();
10
+ *
11
+ * function App() {
12
+ * return (
13
+ * <AnalyticsProvider>
14
+ * <MyApp />
15
+ * <IconAnalyticsDashboard />
16
+ * </AnalyticsProvider>
17
+ * );
18
+ * }
19
+ *
20
+ * // 2. Use the hook inside icon wrappers or manually
21
+ * function TrackedIcon(props) {
22
+ * const analytics = useIconAnalytics();
23
+ * useEffect(() => { analytics.track('NtdHome'); }, []);
24
+ * return <NtdHome {...props} />;
25
+ * }
26
+ * ```
27
+ */
28
+ import React from 'react';
29
+ /** A single usage tracking event. */
30
+ export interface IconUsageEvent {
31
+ /** Icon component name (e.g. 'NtdHome') */
32
+ name: string;
33
+ /** Timestamp of last render */
34
+ lastSeen: number;
35
+ /** Total render count */
36
+ count: number;
37
+ /** Variant used (last) */
38
+ variant?: string;
39
+ /** Size used (last) */
40
+ size?: string | number;
41
+ /** Component path where the icon was rendered */
42
+ location?: string;
43
+ }
44
+ /** Configuration for the analytics system. */
45
+ export interface IconAnalyticsOptions {
46
+ /** Enable/disable tracking (default: true in dev, false in prod) */
47
+ enabled?: boolean;
48
+ /** Maximum events to retain in memory */
49
+ maxEvents?: number;
50
+ /** Callback when a new icon is tracked */
51
+ onTrack?: (event: IconUsageEvent) => void;
52
+ /** Persist to localStorage key (default: none) */
53
+ storageKey?: string;
54
+ }
55
+ /** Aggregated analytics report. */
56
+ export interface IconAnalyticsReport {
57
+ /** Total unique icons tracked */
58
+ totalUniqueIcons: number;
59
+ /** Total render count across all icons */
60
+ totalRenderCount: number;
61
+ /** Icons sorted by usage (most used first) */
62
+ mostUsed: IconUsageEvent[];
63
+ /** Icons that were rendered only once */
64
+ rarelyUsed: IconUsageEvent[];
65
+ /** Timestamp of report generation */
66
+ generatedAt: number;
67
+ }
68
+ declare class IconAnalyticsEngine {
69
+ private events;
70
+ private options;
71
+ constructor(options?: IconAnalyticsOptions);
72
+ track(name: string, meta?: {
73
+ variant?: string;
74
+ size?: string | number;
75
+ location?: string;
76
+ }): void;
77
+ getReport(): IconAnalyticsReport;
78
+ getAll(): IconUsageEvent[];
79
+ clear(): void;
80
+ private persist;
81
+ }
82
+ interface IconAnalyticsContextValue {
83
+ track: (name: string, meta?: {
84
+ variant?: string;
85
+ size?: string | number;
86
+ location?: string;
87
+ }) => void;
88
+ getReport: () => IconAnalyticsReport;
89
+ getAll: () => IconUsageEvent[];
90
+ clear: () => void;
91
+ }
92
+ /**
93
+ * Hook to access the icon analytics tracker.
94
+ *
95
+ * @returns Analytics functions: `track`, `getReport`, `getAll`, `clear`.
96
+ *
97
+ * @example
98
+ * ```tsx
99
+ * const analytics = useIconAnalytics();
100
+ * analytics.track('NtdHome', { variant: 'solid', size: 'lg' });
101
+ * const report = analytics.getReport();
102
+ * ```
103
+ */
104
+ export declare function useIconAnalytics(): IconAnalyticsContextValue;
105
+ /**
106
+ * Creates an analytics provider and hook pair.
107
+ *
108
+ * @param options - Analytics configuration
109
+ * @returns `{ AnalyticsProvider, useIconAnalytics }` to wrap your app.
110
+ */
111
+ export declare function createIconAnalyticsProvider(options?: IconAnalyticsOptions): {
112
+ AnalyticsProvider: React.FC<{
113
+ children: React.ReactNode;
114
+ }>;
115
+ useIconAnalytics: typeof useIconAnalytics;
116
+ engine: IconAnalyticsEngine;
117
+ };
118
+ export interface IconAnalyticsDashboardProps {
119
+ /** Max items to show in top list */
120
+ maxItems?: number;
121
+ /** Additional class */
122
+ className?: string;
123
+ /** Additional styles */
124
+ style?: React.CSSProperties;
125
+ }
126
+ /**
127
+ * Dashboard component showing icon usage analytics.
128
+ * Displays most-used icons, render counts, and recommendations.
129
+ */
130
+ export declare const IconAnalyticsDashboard: React.FC<IconAnalyticsDashboardProps>;
131
+ export {};