@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
package/CHANGELOG.md CHANGED
@@ -1,4 +1,37 @@
1
- # Changelog
1
+ # @nice2dev/icons — Changelog
2
+
3
+ All notable changes to the icon library.
4
+
5
+ ## [1.0.1] — 2026-03-25
6
+
7
+ ### Added (FAZA 1.4)
8
+
9
+ - **Decorative icon styles** — 6 icon wrapper components with SVG/CSS animations:
10
+ - `NtdIconFloral` 🌸 — botanical vines, leaves, flowers with draw + bloom animation
11
+ - `NtdIconFestive` 🎉 — confetti, stars, sparkles with burst-from-center + twinkle
12
+ - `NtdIconNeon` 💡 — multi-layer glow (CSS drop-shadow) with neon flicker
13
+ - `NtdIconSketch` ✏️ — hand-drawn effect (SVG feTurbulence) with scribble overlay
14
+ - `NtdIconWatercolor` 🎨 — soft paint blobs with aquarelle effect
15
+ - `NtdIconCosmic` ✨ — stars, nebula, constellation lines with slow rotation
16
+ - `NtdIconSteampunk` ⚙️ — gears, pipes, rivets with rotation + steam
17
+ - `NtdIconFrost` ❄️ — ice crystals, snowflakes, glow halo
18
+ - `NtdIconPixel` 👾 — pixel brackets, scanline sweep, glitch displacement
19
+ - `NtdIconOrganic` 🧀 — cell membranes, floating bubbles
20
+ - `NtdIconGeometric` 🔷 — rotating rings, diamond corners
21
+ - Each supports `animate`, `duration`, `intensity` (subtle/normal/dense), custom colors
22
+ - Storybook stories with interactive controls
23
+
24
+ ---
25
+
26
+ ## [1.0.0] — 2025-06-01
27
+
28
+ Initial production release.
29
+
30
+ - 300+ multi-color SVG icons across 28 categories
31
+ - 4 size variants (16/20/24/32)
32
+ - 65+ icon animations
33
+ - `NiceIconPicker` component
34
+ - Automatic icon sprite generation
2
35
 
3
36
  All notable changes to `@nice2dev/icons` will be documented in this file.
4
37
 
@@ -113,12 +146,141 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
113
146
 
114
147
  ---
115
148
 
149
+ ## [1.1.0] - 2026-03-19
150
+
151
+ ### Added
152
+
153
+ #### New Icon Categories (~420 total icons)
154
+ - **Sustainability & Eco Icons** (15 icons in `sustainability.tsx`):
155
+ - Recycling: `NtdRecycle`, `NtdCompost`, `NtdTrashSort`
156
+ - Renewable Energy: `NtdSolarPanel`, `NtdWindTurbine`, `NtdEvCharger`, `NtdHydropower`
157
+ - Carbon & Climate: `NtdCarbonFootprint`, `NtdCo2`, `NtdNetZero`
158
+ - Eco Labels: `NtdEcoFriendly`, `NtdOrganic`, `NtdBiodegradable`
159
+ - Nature: `NtdPlantTree`, `NtdWildlife`
160
+
161
+ - **Accessibility Icons** (13 icons in `accessibility.tsx`):
162
+ - Universal: `NtdAccessibility`, `NtdWheelchair`, `NtdBlind`
163
+ - Sensory: `NtdDeaf`, `NtdSignLanguage`, `NtdBraille`, `NtdAudioDescription`, `NtdClosedCaptions`
164
+ - Cognitive: `NtdDyslexia`, `NtdEasyRead`
165
+ - Assistive Tech: `NtdScreenReader`, `NtdHearingAid`, `NtdAssistiveTech`
166
+
167
+ - **Legal & Compliance Icons** (13 icons in `legal.tsx`):
168
+ - Documents: `NtdContract`, `NtdLegalDocument`, `NtdTermsOfService`
169
+ - Privacy: `NtdPrivacyPolicy`, `NtdGdpr`, `NtdCcpa`, `NtdCookieConsent`
170
+ - IP: `NtdCopyright`, `NtdTrademark`, `NtdPatent`
171
+ - Compliance: `NtdCompliance`, `NtdCertified`, `NtdAudit`
172
+
173
+ #### Exports
174
+ - Grouped exports: `sustainabilityIcons`, `accessibilityIcons`, `legalIcons`
175
+
176
+ ---
177
+
178
+ ## [1.2.0] - 2026-03-20
179
+
180
+ ### Added
181
+
182
+ #### FAZA 4 — Developer Experience
183
+
184
+ - **TypeScript Autocomplete Enhancement** (`src/variantProps.ts`):
185
+ - Discriminated union type `VariantIconProps` with per-variant narrowing
186
+ - 8 strict prop types: `SolidIconProps`, `OutlineIconProps`, `DuotoneIconProps`, `FlatIconProps`, `SharpIconProps`, `RoundedIconProps`, `MiniIconProps`, `ThreeDIconProps`
187
+ - Type guard functions: `isSolidProps()`, `isOutlineProps()`, `isDuotoneProps()`, `isFlatProps()`, `isSharpProps()`, `isRoundedProps()`, `isMiniProps()`, `isThreeDProps()`
188
+ - `toIconProps()` — safe cast from discriminated union to `NtdIconProps`
189
+
190
+ - **Tree-shaking Audit & Report** (`scripts/tree-shaking-audit.mjs`):
191
+ - Circular dependency detection with graph traversal
192
+ - Per-icon ESM bundle size analysis
193
+ - Verbose mode with detailed breakdown
194
+ - JSON report output (`--output reports/treeshaking-report.json`)
195
+ - npm scripts: `audit:treeshaking`, `audit:treeshaking:verbose`
196
+
197
+ - **Icon Usage Analytics** (`src/iconAnalytics.tsx`):
198
+ - `createIconAnalyticsProvider()` — React context factory for usage tracking
199
+ - `useIconAnalytics()` — hook for tracking icon renders
200
+ - `IconAnalyticsDashboard` — built-in dashboard with top icons, usage stats, recommendations
201
+ - `IconAnalyticsReport` type with most-used, least-used, unused icon lists
202
+ - Optional per-icon `location` tracking
203
+
204
+ #### FAZA 5 — Advanced Animations
205
+
206
+ - **Path Morphing Animations** (`src/NtdStateMorph.tsx`):
207
+ - `<NtdStateMorph>` — stateful SVG morphing between named states (e.g. empty → filled)
208
+ - `MorphStateMap` — declarative state → path mapping
209
+ - `useStateMorph()` hook for programmatic control
210
+ - `StateMorphHandle` ref API (play, reverse, goTo)
211
+ - Configurable easing, duration, liquid/fluid transitions
212
+
213
+ - **Lottie Integration** (`src/lottieIntegration.tsx`):
214
+ - `<NtdLottieIcon>` — render Lottie JSON animations as icon-sized components
215
+ - `lottieToIcon()` — convert Lottie animation data to an `NtdIcon`-compatible component
216
+ - `exportToLottie()` — export SVG icon with animation to Lottie JSON format
217
+ - `LottieAnimationData`, `LottieExportOptions` types
218
+
219
+ - **Particle Effects** (`src/particleEffects.tsx`):
220
+ - `<NtdParticleIcon>` — canvas-based particle effects triggered by icon events
221
+ - Built-in presets: `confetti`, `sparkles`, `smoke`, `dust`
222
+ - `ParticleConfig` for custom effect tuning (count, velocity, gravity, colors, lifetime)
223
+ - Trigger modes: `click`, `hover`, `mount`, `manual`
224
+
225
+ #### FAZA 6 — Integrations
226
+
227
+ - **Figma Bidirectional Sync** (`src/figmaSync.ts`):
228
+ - `FigmaSyncManager` class for two-way Figma ↔ codebase sync
229
+ - `createFigmaSyncManager()` factory with `FigmaSyncConfig`
230
+ - `diffIconSets()` — detect added/removed/modified icons between Figma and codebase
231
+ - `FigmaIconDiff` type with change tracking
232
+ - `FigmaSyncDirection`: `push` (code → Figma), `pull` (Figma → code), `both`
233
+ - Version tracking and conflict detection
234
+
235
+ #### Infrastructure
236
+
237
+ - **Visual Regression Testing** (Chromatic):
238
+ - `chromatic.config.json` with auto-accept on main, onlyChanged optimization
239
+ - npm scripts: `test:visual`, `test:visual:ci`
240
+ - Azure DevOps pipeline integration (`chromatic` step in Build stage)
241
+
242
+ - **Changelog Generation** (conventional-changelog):
243
+ - `conventional-changelog-cli` + `conventional-changelog-angular` configured
244
+ - npm scripts: `changelog` (incremental), `changelog:first` (full), `version` (auto-update on version bump)
245
+
246
+ - **Auto-publish to npm** (Azure DevOps):
247
+ - Already handled by existing pipeline — publishes all changed `@nice2dev/*` packages on merge to main
248
+ - Change detection per-package via git diff
249
+
250
+ ---
251
+
252
+ ## [1.3.0] - 2026-06-16
253
+
254
+ ### Added
255
+
256
+ #### New Components
257
+ - `NtdIconBadge` — icon with notification/count badge overlay
258
+ - `NtdIconMorph` — icon-to-icon morphing transition component
259
+
260
+ #### Framework Integration
261
+ - `headless-ui.tsx` — headless (unstyled) icon component for custom styling
262
+ - `client.tsx` — client-side icon component with hydration support
263
+ - `rsc.tsx` — React Server Component compatible icon
264
+ - `tailwind-plugin.ts` — Tailwind CSS plugin for icon utilities (`icon-sm`, `icon-lg`, etc.)
265
+
266
+ #### Design System
267
+ - `design-tokens.ts` — design token definitions for icon sizing, spacing, and colors
268
+ - `resolver.ts` — icon resolver for dynamic icon loading by name
269
+ - `utilities.tsx` — icon utility components and helpers
270
+ - `micro-interactions.tsx` — micro-interaction presets for icon hover/click feedback
271
+
272
+ #### New Icon Categories
273
+ - `ai.tsx` — AI/ML icons (neural network, brain, robot, etc.)
274
+ - `brand.tsx` — brand/logo icons
275
+ - `education.tsx` — education icons (graduation, book, school, etc.)
276
+ - `fun.tsx` — fun/entertainment icons
277
+ - `gaming.tsx` — gaming icons (controller, dice, trophy, etc.)
278
+ - `realestate.tsx` — real estate icons (house, building, key, etc.)
279
+ - `science.tsx` — science icons (microscope, atom, flask, etc.)
280
+
281
+ ---
282
+
116
283
  ## [Unreleased]
117
284
 
118
285
  ### Planned
119
- - Figma / Sketch export plugin
120
- - PNG sprite-sheet generation
121
- - Icon font generation (TTF/WOFF2)
122
- - Rollup plugin for tree-shaking analysis
123
- - CDN standalone build
124
- - Visual regression testing (Chromatic/Percy)
286
+ - Visual regression baseline capture (requires `CHROMATIC_PROJECT_TOKEN` in Azure DevOps)
package/README.md CHANGED
@@ -574,8 +574,253 @@ Entry points in `package.json`:
574
574
  - `types` → `dist/types/index.d.ts`
575
575
 
576
576
  ---
577
+ ## React Server Components (RSC)
577
578
 
578
- ## License
579
+ Use icons in Server Components without "use client":
580
+
581
+ ```tsx
582
+ // In a Server Component (app/page.tsx)
583
+ import { createIconRSC } from '@nice2dev/icons/rsc';
584
+
585
+ // Create RSC-compatible icon
586
+ const HomeIcon = createIconRSC({
587
+ displayName: 'HomeIcon',
588
+ paths: { /* ... */ }
589
+ });
590
+
591
+ export default function Page() {
592
+ return <HomeIcon size="md" primaryColor="#3b82f6" />;
593
+ }
594
+ ```
595
+
596
+ ### RSC vs Client Exports
597
+
598
+ | Import Path | Use Case |
599
+ |-------------|----------|
600
+ | `@nice2dev/icons` | Standard usage (includes animations, color scheme detection) |
601
+ | `@nice2dev/icons/rsc` | Server Components (no hooks, streaming-friendly) |
602
+ | `@nice2dev/icons/client` | Client-only features ("use client" directive) |
603
+
604
+ ### RSC Utilities
605
+
606
+ ```tsx
607
+ import { renderIconToString, isRSCIcon, wrapAsRSC } from '@nice2dev/icons/rsc';
608
+
609
+ // Render to SVG string (for SSR/email)
610
+ const svgString = renderIconToString(MyIcon, { size: 'lg' });
611
+
612
+ // Check if icon is RSC-compatible
613
+ isRSCIcon(MyIcon); // true/false
614
+
615
+ // Wrap existing icon for RSC
616
+ const MyIconRSC = wrapAsRSC(MyIcon);
617
+ ```
618
+
619
+ ---
620
+
621
+ ## Design Tokens
622
+
623
+ Generate Style Dictionary compatible design tokens for your design system:
624
+
625
+ ```tsx
626
+ import {
627
+ generateIconTokens,
628
+ generateCSSVariables,
629
+ generateTailwindConfig,
630
+ toFigmaTokens,
631
+ } from '@nice2dev/icons/design-tokens';
632
+
633
+ // Generate tokens with custom configuration
634
+ const tokens = generateIconTokens({
635
+ prefix: 'myapp',
636
+ namespace: 'icon',
637
+ colorTokens: {
638
+ primary: '#6366f1',
639
+ secondary: '#a5b4fc',
640
+ },
641
+ sizeTokens: {
642
+ sm: '14px',
643
+ md: '20px',
644
+ lg: '28px',
645
+ },
646
+ });
647
+
648
+ // Generate CSS variables
649
+ const css = generateCSSVariables(tokens);
650
+ // :root {
651
+ // --myapp-icon-size-sm: 14px;
652
+ // --myapp-icon-color-primary: #6366f1;
653
+ // ...
654
+ // }
655
+
656
+ // Generate Tailwind config
657
+ const tailwindConfig = generateTailwindConfig(tokens);
658
+
659
+ // Export for Figma Tokens plugin
660
+ const figmaTokens = toFigmaTokens(tokens);
661
+ ```
662
+
663
+ ### Default Token Values
664
+
665
+ | Category | Tokens |
666
+ |----------|--------|
667
+ | Sizes | `xs` (12px), `sm` (16px), `md` (24px), `lg` (32px), `xl` (48px), `2xl` (64px) |
668
+ | Colors | `primary`, `secondary`, `accent`, `success`, `warning`, `error`, `info`, `muted` |
669
+ | Strokes | `thin` (1), `normal` (1.5), `medium` (2), `thick` (2.5), `bold` (3) |
670
+
671
+ ---
672
+
673
+ ## Headless UI / shadcn/ui Integration
674
+
675
+ Seamless integration with Radix UI, Headless UI, and shadcn/ui:
676
+
677
+ ```tsx
678
+ import { NtdSettings, NtdChevronDown } from '@nice2dev/icons';
679
+ import {
680
+ forwardRefIcon,
681
+ createRadixIcon,
682
+ withRadixState,
683
+ shadcnIconClasses,
684
+ } from '@nice2dev/icons/headless-ui';
685
+
686
+ // Create ref-compatible icon for Radix asChild pattern
687
+ const SettingsIcon = forwardRefIcon(NtdSettings);
688
+
689
+ // Icon with Radix-compatible defaults
690
+ const SearchIcon = createRadixIcon(NtdSearch, {
691
+ className: 'text-muted-foreground',
692
+ });
693
+
694
+ // State-aware icon (rotates on data-state="open")
695
+ const ChevronIcon = withRadixState(NtdChevronDown);
696
+
697
+ // Use with shadcn/ui Button
698
+ <Button>
699
+ <SettingsIcon className={shadcnIconClasses.buttonLeft} />
700
+ Settings
701
+ </Button>
702
+ ```
703
+
704
+ ### shadcn/ui Class Presets
579
705
 
580
- MIT © NiceToDev
706
+ ```ts
707
+ shadcnIconClasses = {
708
+ button: 'h-4 w-4',
709
+ buttonLeft: 'mr-2 h-4 w-4',
710
+ buttonRight: 'ml-2 h-4 w-4',
711
+ sm: 'h-3.5 w-3.5',
712
+ lg: 'h-5 w-5',
713
+ iconOnly: 'h-4 w-4',
714
+ nav: 'h-4 w-4 shrink-0',
715
+ dropdown: 'mr-2 h-4 w-4',
716
+ spinner: 'h-4 w-4 animate-spin',
717
+ // ...
718
+ }
719
+ ```
720
+
721
+ ### Dynamic Class Generation
722
+
723
+ ```tsx
724
+ import { getIconClassName } from '@nice2dev/icons/headless-ui';
725
+
726
+ getIconClassName({ size: 'lg', variant: 'muted' });
727
+ // → 'h-5 w-5 text-muted-foreground'
728
+
729
+ getIconClassName({ interactive: true, spinning: true });
730
+ // → 'h-4 w-4 transition-colors hover:text-foreground cursor-pointer animate-spin'
731
+ ```
732
+
733
+ ---
734
+
735
+ ## Utilities & Hooks
736
+
737
+ Powerful utilities for advanced icon management:
738
+
739
+ ```tsx
740
+ import {
741
+ useIcon,
742
+ useReducedMotion,
743
+ preloadIcons,
744
+ registerIcon,
745
+ getIconFromRegistry,
746
+ withReducedMotionProps,
747
+ createAccessibleIconProps,
748
+ isIconComponent,
749
+ isValidIconName,
750
+ useBatchIcons
751
+ } from '@nice2dev/icons/utilities';
752
+
753
+ // Dynamic icon loading with suspense support
754
+ function DynamicIcon({ name }: { name: string }) {
755
+ const { icon: Icon, loading, error } = useIcon(name);
756
+
757
+ if (loading) return <span>Loading...</span>;
758
+ if (error) return <span>Icon not found</span>;
759
+ if (!Icon) return null;
760
+
761
+ return <Icon className="w-6 h-6" />;
762
+ }
763
+
764
+ // Respect user's reduced motion preference
765
+ function AnimatedIcon() {
766
+ const prefersReducedMotion = useReducedMotion();
767
+
768
+ return (
769
+ <NtdSpinner
770
+ className={prefersReducedMotion ? '' : 'animate-spin'}
771
+ />
772
+ );
773
+ }
774
+
775
+ // Preload icons for better performance
776
+ useEffect(() => {
777
+ preloadIcons(['NtdHome', 'NtdUser', 'NtdSettings']);
778
+ }, []);
779
+
780
+ // Icon registry for custom icons
781
+ registerIcon('MyCustomIcon', MyCustomIconComponent);
782
+ const CustomIcon = getIconFromRegistry('MyCustomIcon');
783
+
784
+ // Accessibility helpers
785
+ const a11yProps = createAccessibleIconProps('Search', true);
786
+ // → { role: 'img', 'aria-label': 'Search' }
787
+
788
+ // Type guards
789
+ if (isIconComponent(SomeComponent)) {
790
+ // TypeScript knows it's an icon
791
+ }
792
+
793
+ // Batch loading multiple icons
794
+ const { icons, loading, errors } = useBatchIcons(['NtdHome', 'NtdUser']);
795
+ ```
796
+
797
+ ---
798
+
799
+ ## CLI Tool
800
+
801
+ Preview, list, search and export icons from the command line:
802
+
803
+ ```bash
804
+ # Preview icon in browser
805
+ npx @nice2dev/icons preview NtdHome
806
+
807
+ # List all icons
808
+ npx @nice2dev/icons list
809
+
810
+ # List icons in a category
811
+ npx @nice2dev/icons list --category=ui
812
+
813
+ # Search icons
814
+ npx @nice2dev/icons search "arrow"
815
+
816
+ # Export icons
817
+ npx @nice2dev/icons export --format=svg --icons=NtdHome,NtdUser
818
+
819
+ # Show icon info
820
+ npx @nice2dev/icons info NtdHeart
821
+ ```
822
+
823
+ ---
824
+ ## License
581
825
 
826
+ MIT © NiceToDev