@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.
- package/CHANGELOG.md +169 -7
- package/README.md +247 -2
- package/bin/ntd-icons.mjs +732 -0
- package/dist/cjs/NtdIconBadge.js +375 -0
- package/dist/cjs/NtdIconBadge.js.map +1 -0
- package/dist/cjs/NtdIconMorph.js +386 -0
- package/dist/cjs/NtdIconMorph.js.map +1 -0
- package/dist/cjs/NtdStateMorph.js +177 -0
- package/dist/cjs/NtdStateMorph.js.map +1 -0
- package/dist/cjs/createIcon.js +51 -4
- package/dist/cjs/createIcon.js.map +1 -1
- package/dist/cjs/figmaSync.js +308 -0
- package/dist/cjs/figmaSync.js.map +1 -0
- package/dist/cjs/iconAnalytics.js +189 -0
- package/dist/cjs/iconAnalytics.js.map +1 -0
- package/dist/cjs/iconMetadata.js +523 -0
- package/dist/cjs/iconMetadata.js.map +1 -0
- package/dist/cjs/iconStyles.js +597 -0
- package/dist/cjs/iconStyles.js.map +1 -0
- package/dist/cjs/icons/accessibility.js +168 -0
- package/dist/cjs/icons/accessibility.js.map +1 -0
- package/dist/cjs/icons/ai.js +191 -0
- package/dist/cjs/icons/ai.js.map +1 -0
- package/dist/cjs/icons/brand.js +70 -0
- package/dist/cjs/icons/brand.js.map +1 -1
- package/dist/cjs/icons/education.js +212 -0
- package/dist/cjs/icons/education.js.map +1 -0
- package/dist/cjs/icons/food.js +198 -0
- package/dist/cjs/icons/food.js.map +1 -0
- package/dist/cjs/icons/gaming.js +191 -0
- package/dist/cjs/icons/gaming.js.map +1 -0
- package/dist/cjs/icons/index.js +520 -0
- package/dist/cjs/icons/index.js.map +1 -0
- package/dist/cjs/icons/legal.js +168 -0
- package/dist/cjs/icons/legal.js.map +1 -0
- package/dist/cjs/icons/realestate.js +212 -0
- package/dist/cjs/icons/realestate.js.map +1 -0
- package/dist/cjs/icons/science.js +201 -0
- package/dist/cjs/icons/science.js.map +1 -0
- package/dist/cjs/icons/sports.js +176 -0
- package/dist/cjs/icons/sports.js.map +1 -0
- package/dist/cjs/icons/sustainability.js +193 -0
- package/dist/cjs/icons/sustainability.js.map +1 -0
- package/dist/cjs/icons/travel.js +184 -0
- package/dist/cjs/icons/travel.js.map +1 -0
- package/dist/cjs/index.js +265 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lottieIntegration.js +286 -0
- package/dist/cjs/lottieIntegration.js.map +1 -0
- package/dist/cjs/nicetodev-icons.css +1 -1
- package/dist/cjs/particleEffects.js +259 -0
- package/dist/cjs/particleEffects.js.map +1 -0
- package/dist/cjs/resolver.js +224 -0
- package/dist/cjs/resolver.js.map +1 -0
- package/dist/cjs/tailwind-plugin.js +340 -0
- package/dist/cjs/tailwind-plugin.js.map +1 -0
- package/dist/cjs/types.js +38 -0
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/variantProps.js +78 -0
- package/dist/cjs/variantProps.js.map +1 -0
- package/dist/esm/NtdIconBadge.js +370 -0
- package/dist/esm/NtdIconBadge.js.map +1 -0
- package/dist/esm/NtdIconMorph.js +381 -0
- package/dist/esm/NtdIconMorph.js.map +1 -0
- package/dist/esm/NtdStateMorph.js +174 -0
- package/dist/esm/NtdStateMorph.js.map +1 -0
- package/dist/esm/createIcon.js +53 -6
- package/dist/esm/createIcon.js.map +1 -1
- package/dist/esm/figmaSync.js +304 -0
- package/dist/esm/figmaSync.js.map +1 -0
- package/dist/esm/iconAnalytics.js +185 -0
- package/dist/esm/iconAnalytics.js.map +1 -0
- package/dist/esm/iconMetadata.js +510 -0
- package/dist/esm/iconMetadata.js.map +1 -0
- package/dist/esm/iconStyles.js +585 -0
- package/dist/esm/iconStyles.js.map +1 -0
- package/dist/esm/icons/accessibility.js +153 -0
- package/dist/esm/icons/accessibility.js.map +1 -0
- package/dist/esm/icons/ai.js +174 -0
- package/dist/esm/icons/ai.js.map +1 -0
- package/dist/esm/icons/brand.js +67 -1
- package/dist/esm/icons/brand.js.map +1 -1
- package/dist/esm/icons/education.js +193 -0
- package/dist/esm/icons/education.js.map +1 -0
- package/dist/esm/icons/food.js +180 -0
- package/dist/esm/icons/food.js.map +1 -0
- package/dist/esm/icons/gaming.js +174 -0
- package/dist/esm/icons/gaming.js.map +1 -0
- package/dist/esm/icons/index.js +31 -0
- package/dist/esm/icons/index.js.map +1 -0
- package/dist/esm/icons/legal.js +153 -0
- package/dist/esm/icons/legal.js.map +1 -0
- package/dist/esm/icons/realestate.js +193 -0
- package/dist/esm/icons/realestate.js.map +1 -0
- package/dist/esm/icons/science.js +183 -0
- package/dist/esm/icons/science.js.map +1 -0
- package/dist/esm/icons/sports.js +160 -0
- package/dist/esm/icons/sports.js.map +1 -0
- package/dist/esm/icons/sustainability.js +176 -0
- package/dist/esm/icons/sustainability.js.map +1 -0
- package/dist/esm/icons/travel.js +167 -0
- package/dist/esm/icons/travel.js.map +1 -0
- package/dist/esm/index.js +27 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lottieIntegration.js +282 -0
- package/dist/esm/lottieIntegration.js.map +1 -0
- package/dist/esm/nicetodev-icons.css +1 -1
- package/dist/esm/particleEffects.js +257 -0
- package/dist/esm/particleEffects.js.map +1 -0
- package/dist/esm/resolver.js +221 -0
- package/dist/esm/resolver.js.map +1 -0
- package/dist/esm/tailwind-plugin.js +337 -0
- package/dist/esm/tailwind-plugin.js.map +1 -0
- package/dist/esm/types.js +37 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/variantProps.js +68 -0
- package/dist/esm/variantProps.js.map +1 -0
- package/dist/types/NtdIconBadge.d.ts +209 -0
- package/dist/types/NtdIconMorph.d.ts +183 -0
- package/dist/types/NtdStateMorph.d.ts +100 -0
- package/dist/types/client.d.ts +27 -0
- package/dist/types/design-tokens.d.ts +281 -0
- package/dist/types/figmaSync.d.ts +135 -0
- package/dist/types/headless-ui.d.ts +462 -0
- package/dist/types/iconAnalytics.d.ts +131 -0
- package/dist/types/iconMetadata.d.ts +123 -0
- package/dist/types/iconStyles.d.ts +104 -0
- package/dist/types/icons/accessibility.d.ts +39 -0
- package/dist/types/icons/ai.d.ts +43 -0
- package/dist/types/icons/brand.d.ts +4 -0
- package/dist/types/icons/education.d.ts +47 -0
- package/dist/types/icons/food.d.ts +45 -0
- package/dist/types/icons/gaming.d.ts +42 -0
- package/dist/types/icons/index.d.ts +12 -1
- package/dist/types/icons/legal.d.ts +39 -0
- package/dist/types/icons/realestate.d.ts +47 -0
- package/dist/types/icons/science.d.ts +45 -0
- package/dist/types/icons/sports.d.ts +41 -0
- package/dist/types/icons/sustainability.d.ts +43 -0
- package/dist/types/icons/travel.d.ts +43 -0
- package/dist/types/index.d.ts +28 -6
- package/dist/types/lottieIntegration.d.ts +173 -0
- package/dist/types/micro-interactions.d.ts +146 -0
- package/dist/types/microInteractions.d.ts +174 -0
- package/dist/types/particleEffects.d.ts +69 -0
- package/dist/types/resolver.d.ts +58 -0
- package/dist/types/rsc.d.ts +159 -0
- package/dist/types/tailwind-plugin.d.ts +100 -0
- package/dist/types/types.d.ts +100 -0
- package/dist/types/utilities.d.ts +221 -0
- package/dist/types/variantProps.d.ts +122 -0
- package/package.json +58 -5
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file NtdIconBadge.tsx
|
|
3
|
+
* @description Badge and status overlay system for icons
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - Numeric badges (notification counts)
|
|
7
|
+
* - Status dots (online, offline, busy, away)
|
|
8
|
+
* - Checkmark overlays for completion states
|
|
9
|
+
* - Custom badge renderers
|
|
10
|
+
* - Animated badge changes
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* // Numeric badge
|
|
15
|
+
* <NtdBadge icon={NtdBell} count={5} />
|
|
16
|
+
*
|
|
17
|
+
* // Status dot
|
|
18
|
+
* <NtdStatusDot icon={NtdUser} status="online" />
|
|
19
|
+
*
|
|
20
|
+
* // Custom overlay
|
|
21
|
+
* <NtdIconOverlay icon={NtdFolder} overlay={<NtdPlus size="xs" />} />
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @version 1.0.0
|
|
25
|
+
* @since 2026-03
|
|
26
|
+
* @license MIT
|
|
27
|
+
*/
|
|
28
|
+
import React, { ComponentType, ReactNode } from 'react';
|
|
29
|
+
import type { NtdIconProps, IconSize } from './types';
|
|
30
|
+
export type BadgePosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center' | 'center-right' | 'center-left';
|
|
31
|
+
export type StatusType = 'online' | 'offline' | 'busy' | 'away' | 'dnd' | 'invisible';
|
|
32
|
+
export type BadgeVariant = 'standard' | 'dot' | 'pill';
|
|
33
|
+
export interface NtdBadgeProps {
|
|
34
|
+
/** Icon component to wrap */
|
|
35
|
+
icon: ComponentType<NtdIconProps>;
|
|
36
|
+
/** Badge count (numbers or "99+") */
|
|
37
|
+
count?: number;
|
|
38
|
+
/** Maximum count to show (default: 99) */
|
|
39
|
+
maxCount?: number;
|
|
40
|
+
/** Show badge even when count is 0 */
|
|
41
|
+
showZero?: boolean;
|
|
42
|
+
/** Badge position */
|
|
43
|
+
position?: BadgePosition;
|
|
44
|
+
/** Badge variant style */
|
|
45
|
+
variant?: BadgeVariant;
|
|
46
|
+
/** Badge background color */
|
|
47
|
+
badgeColor?: string;
|
|
48
|
+
/** Badge text color */
|
|
49
|
+
textColor?: string;
|
|
50
|
+
/** Animate count changes */
|
|
51
|
+
animated?: boolean;
|
|
52
|
+
/** Pulse animation for attention */
|
|
53
|
+
pulse?: boolean;
|
|
54
|
+
/** Icon props passed to the wrapped icon */
|
|
55
|
+
iconProps?: NtdIconProps;
|
|
56
|
+
/** Additional class name */
|
|
57
|
+
className?: string;
|
|
58
|
+
/** Additional styles */
|
|
59
|
+
style?: React.CSSProperties;
|
|
60
|
+
/** Accessible label for badge */
|
|
61
|
+
'aria-label'?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface NtdStatusDotProps {
|
|
64
|
+
/** Icon component to wrap */
|
|
65
|
+
icon: ComponentType<NtdIconProps>;
|
|
66
|
+
/** Status type */
|
|
67
|
+
status: StatusType;
|
|
68
|
+
/** Custom status color (overrides default) */
|
|
69
|
+
statusColor?: string;
|
|
70
|
+
/** Dot position */
|
|
71
|
+
position?: BadgePosition;
|
|
72
|
+
/** Dot size (relative to icon) */
|
|
73
|
+
dotSize?: 'sm' | 'md' | 'lg';
|
|
74
|
+
/** Animate presence */
|
|
75
|
+
animated?: boolean;
|
|
76
|
+
/** Pulse for online status */
|
|
77
|
+
pulse?: boolean;
|
|
78
|
+
/** Icon props passed to the wrapped icon */
|
|
79
|
+
iconProps?: NtdIconProps;
|
|
80
|
+
/** Additional class name */
|
|
81
|
+
className?: string;
|
|
82
|
+
/** Additional styles */
|
|
83
|
+
style?: React.CSSProperties;
|
|
84
|
+
}
|
|
85
|
+
export interface NtdIconOverlayProps {
|
|
86
|
+
/** Base icon component */
|
|
87
|
+
icon: ComponentType<NtdIconProps>;
|
|
88
|
+
/** Overlay content (icon, text, or custom React node) */
|
|
89
|
+
overlay: ReactNode;
|
|
90
|
+
/** Overlay position */
|
|
91
|
+
position?: BadgePosition;
|
|
92
|
+
/** Overlay size relative to base icon */
|
|
93
|
+
overlayScale?: number;
|
|
94
|
+
/** Overlay background */
|
|
95
|
+
overlayBg?: string;
|
|
96
|
+
/** Add circular background to overlay */
|
|
97
|
+
circularBg?: boolean;
|
|
98
|
+
/** Icon props for base icon */
|
|
99
|
+
iconProps?: NtdIconProps;
|
|
100
|
+
/** Additional class name */
|
|
101
|
+
className?: string;
|
|
102
|
+
/** Additional styles */
|
|
103
|
+
style?: React.CSSProperties;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Badge overlay component for icons with notification counts.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```tsx
|
|
110
|
+
* // Basic notification badge
|
|
111
|
+
* <NtdBadge icon={NtdBell} count={3} />
|
|
112
|
+
*
|
|
113
|
+
* // Large count with max
|
|
114
|
+
* <NtdBadge icon={NtdInbox} count={150} maxCount={99} />
|
|
115
|
+
*
|
|
116
|
+
* // Pulsing badge
|
|
117
|
+
* <NtdBadge icon={NtdMessage} count={1} pulse />
|
|
118
|
+
*
|
|
119
|
+
* // Custom colors
|
|
120
|
+
* <NtdBadge
|
|
121
|
+
* icon={NtdHeart}
|
|
122
|
+
* count={5}
|
|
123
|
+
* badgeColor="#e91e63"
|
|
124
|
+
* textColor="white"
|
|
125
|
+
* />
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
export declare const NtdBadge: React.ForwardRefExoticComponent<NtdBadgeProps & React.RefAttributes<HTMLDivElement>>;
|
|
129
|
+
/**
|
|
130
|
+
* Status indicator dot overlay for icons.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```tsx
|
|
134
|
+
* // Online status
|
|
135
|
+
* <NtdStatusDot icon={NtdUser} status="online" />
|
|
136
|
+
*
|
|
137
|
+
* // Busy with pulse
|
|
138
|
+
* <NtdStatusDot icon={NtdUser} status="busy" pulse />
|
|
139
|
+
*
|
|
140
|
+
* // Custom position
|
|
141
|
+
* <NtdStatusDot icon={NtdUser} status="away" position="bottom-right" />
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
export declare const NtdStatusDot: React.ForwardRefExoticComponent<NtdStatusDotProps & React.RefAttributes<HTMLDivElement>>;
|
|
145
|
+
/**
|
|
146
|
+
* Generic overlay component for composing icons.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```tsx
|
|
150
|
+
* // Folder with plus
|
|
151
|
+
* <NtdIconOverlay
|
|
152
|
+
* icon={NtdFolder}
|
|
153
|
+
* overlay={<NtdPlus size="xs" />}
|
|
154
|
+
* position="bottom-right"
|
|
155
|
+
* />
|
|
156
|
+
*
|
|
157
|
+
* // With circular background
|
|
158
|
+
* <NtdIconOverlay
|
|
159
|
+
* icon={NtdUser}
|
|
160
|
+
* overlay={<NtdCheck size="xs" primaryColor="white" />}
|
|
161
|
+
* circularBg
|
|
162
|
+
* overlayBg="#22c55e"
|
|
163
|
+
* />
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
export declare const NtdIconOverlay: React.ForwardRefExoticComponent<NtdIconOverlayProps & React.RefAttributes<HTMLDivElement>>;
|
|
167
|
+
export interface NtdIconStackProps {
|
|
168
|
+
/** Base (background) icon */
|
|
169
|
+
base: ComponentType<NtdIconProps>;
|
|
170
|
+
/** Overlay (foreground) icon */
|
|
171
|
+
overlay: ComponentType<NtdIconProps>;
|
|
172
|
+
/** Base icon props */
|
|
173
|
+
baseProps?: NtdIconProps;
|
|
174
|
+
/** Overlay icon props */
|
|
175
|
+
overlayProps?: NtdIconProps;
|
|
176
|
+
/** Overlay position */
|
|
177
|
+
position?: BadgePosition;
|
|
178
|
+
/** Overlay scale relative to base */
|
|
179
|
+
overlayScale?: number;
|
|
180
|
+
/** Stack size override */
|
|
181
|
+
size?: IconSize;
|
|
182
|
+
/** Additional class name */
|
|
183
|
+
className?: string;
|
|
184
|
+
/** Additional styles */
|
|
185
|
+
style?: React.CSSProperties;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Stack two icons for composite imagery.
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```tsx
|
|
192
|
+
* // Folder with star
|
|
193
|
+
* <NtdIconStack
|
|
194
|
+
* base={NtdFolder}
|
|
195
|
+
* overlay={NtdStar}
|
|
196
|
+
* overlayProps={{ primaryColor: '#fbbf24' }}
|
|
197
|
+
* />
|
|
198
|
+
*
|
|
199
|
+
* // Ban overlay (slash through)
|
|
200
|
+
* <NtdIconStack
|
|
201
|
+
* base={NtdCamera}
|
|
202
|
+
* overlay={NtdSlash}
|
|
203
|
+
* overlayProps={{ primaryColor: '#ef4444' }}
|
|
204
|
+
* position="center"
|
|
205
|
+
* />
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
export declare const NtdIconStack: React.ForwardRefExoticComponent<NtdIconStackProps & React.RefAttributes<HTMLDivElement>>;
|
|
209
|
+
export default NtdBadge;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file NtdIconMorph.tsx
|
|
3
|
+
* @description Smooth morphing transitions between icons
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - SVG path morphing with interpolation
|
|
7
|
+
* - Predefined morph pairs (menu↔close, play↔pause, etc.)
|
|
8
|
+
* - Customizable duration, easing, direction
|
|
9
|
+
* - Trigger on hover/click/state change
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* // Basic morphing
|
|
14
|
+
* <NtdIconMorph from={NtdMenu} to={NtdClose} morphed={isOpen} />
|
|
15
|
+
*
|
|
16
|
+
* // With trigger
|
|
17
|
+
* <NtdIconMorph from={NtdPlay} to={NtdPause} trigger="click" />
|
|
18
|
+
*
|
|
19
|
+
* // Predefined pair
|
|
20
|
+
* <NtdIconMorphPair pair="menu-close" morphed={isOpen} />
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @version 1.0.0
|
|
24
|
+
* @since 2026-03
|
|
25
|
+
* @license MIT
|
|
26
|
+
*/
|
|
27
|
+
import React, { ComponentType } from 'react';
|
|
28
|
+
import type { NtdIconProps, IconSize, IconVariant } from './types';
|
|
29
|
+
export type MorphTrigger = 'none' | 'hover' | 'click' | 'focus';
|
|
30
|
+
export type MorphDirection = 'normal' | 'reverse' | 'alternate';
|
|
31
|
+
export type MorphEasing = 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'spring' | 'bounce' | string;
|
|
32
|
+
export interface NtdIconMorphProps {
|
|
33
|
+
/** Source icon component */
|
|
34
|
+
from: ComponentType<NtdIconProps>;
|
|
35
|
+
/** Target icon component */
|
|
36
|
+
to: ComponentType<NtdIconProps>;
|
|
37
|
+
/** Current morphed state (true = show 'to' icon) */
|
|
38
|
+
morphed?: boolean;
|
|
39
|
+
/** Auto-trigger morphing on interaction */
|
|
40
|
+
trigger?: MorphTrigger;
|
|
41
|
+
/** Animation duration in ms */
|
|
42
|
+
duration?: number;
|
|
43
|
+
/** Easing function */
|
|
44
|
+
easing?: MorphEasing;
|
|
45
|
+
/** Icon size */
|
|
46
|
+
size?: IconSize;
|
|
47
|
+
/** Icon variant */
|
|
48
|
+
variant?: IconVariant;
|
|
49
|
+
/** Primary color */
|
|
50
|
+
primaryColor?: string;
|
|
51
|
+
/** Secondary color (for duotone/flat) */
|
|
52
|
+
secondaryColor?: string;
|
|
53
|
+
/** Callback when morph starts */
|
|
54
|
+
onMorphStart?: (toMorphed: boolean) => void;
|
|
55
|
+
/** Callback when morph completes */
|
|
56
|
+
onMorphEnd?: (morphed: boolean) => void;
|
|
57
|
+
/** Additional class name */
|
|
58
|
+
className?: string;
|
|
59
|
+
/** Additional styles */
|
|
60
|
+
style?: React.CSSProperties;
|
|
61
|
+
/** Accessible label */
|
|
62
|
+
'aria-label'?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface NtdMorphPairProps extends Omit<NtdIconMorphProps, 'from' | 'to'> {
|
|
65
|
+
/** Predefined icon pair */
|
|
66
|
+
pair: MorphPairName;
|
|
67
|
+
}
|
|
68
|
+
export type MorphPairName = 'menu-close' | 'play-pause' | 'plus-minus' | 'check-cross' | 'chevron-up-down' | 'expand-collapse' | 'sun-moon' | 'volume-mute' | 'lock-unlock' | 'eye-hidden' | 'heart-broken' | 'star-empty';
|
|
69
|
+
/**
|
|
70
|
+
* Icon morphing component for smooth transitions between two icons.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```tsx
|
|
74
|
+
* // Controlled state
|
|
75
|
+
* <NtdIconMorph
|
|
76
|
+
* from={NtdMenu}
|
|
77
|
+
* to={NtdClose}
|
|
78
|
+
* morphed={isOpen}
|
|
79
|
+
* duration={300}
|
|
80
|
+
* />
|
|
81
|
+
*
|
|
82
|
+
* // Self-managed with trigger
|
|
83
|
+
* <NtdIconMorph
|
|
84
|
+
* from={NtdPlay}
|
|
85
|
+
* to={NtdPause}
|
|
86
|
+
* trigger="click"
|
|
87
|
+
* />
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export declare const NtdIconMorph: React.ForwardRefExoticComponent<NtdIconMorphProps & React.RefAttributes<HTMLDivElement>>;
|
|
91
|
+
export interface NtdPathMorphProps {
|
|
92
|
+
/** Predefined morph pair name */
|
|
93
|
+
pair: MorphPairName;
|
|
94
|
+
/** Current state (true = morphed to 'to' state) */
|
|
95
|
+
morphed?: boolean;
|
|
96
|
+
/** Auto-trigger on interaction */
|
|
97
|
+
trigger?: MorphTrigger;
|
|
98
|
+
/** Animation duration in ms */
|
|
99
|
+
duration?: number;
|
|
100
|
+
/** Easing function */
|
|
101
|
+
easing?: MorphEasing;
|
|
102
|
+
/** Icon size */
|
|
103
|
+
size?: IconSize;
|
|
104
|
+
/** Stroke/fill color */
|
|
105
|
+
color?: string;
|
|
106
|
+
/** Stroke width for outline style */
|
|
107
|
+
strokeWidth?: number;
|
|
108
|
+
/** Fill the path (default: false for stroke-based) */
|
|
109
|
+
filled?: boolean;
|
|
110
|
+
/** Callback when morph starts */
|
|
111
|
+
onMorphStart?: (toMorphed: boolean) => void;
|
|
112
|
+
/** Callback when morph completes */
|
|
113
|
+
onMorphEnd?: (morphed: boolean) => void;
|
|
114
|
+
/** Additional class name */
|
|
115
|
+
className?: string;
|
|
116
|
+
/** Additional styles */
|
|
117
|
+
style?: React.CSSProperties;
|
|
118
|
+
/** Accessible label */
|
|
119
|
+
'aria-label'?: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Path-based morphing using CSS transitions on SVG path data.
|
|
123
|
+
* Requires browser support for CSS `d` property transitions (modern browsers).
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```tsx
|
|
127
|
+
* <NtdPathMorph
|
|
128
|
+
* pair="menu-close"
|
|
129
|
+
* morphed={isOpen}
|
|
130
|
+
* duration={250}
|
|
131
|
+
* color="#333"
|
|
132
|
+
* />
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
export declare const NtdPathMorph: React.ForwardRefExoticComponent<NtdPathMorphProps & React.RefAttributes<SVGSVGElement>>;
|
|
136
|
+
/**
|
|
137
|
+
* Convenience component for predefined icon morph pairs.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```tsx
|
|
141
|
+
* <NtdMorphPair pair="menu-close" morphed={isMenuOpen} />
|
|
142
|
+
* <NtdMorphPair pair="sun-moon" trigger="click" />
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
export declare const NtdMorphPair: React.ForwardRefExoticComponent<NtdMorphPairProps & React.RefAttributes<HTMLDivElement>>;
|
|
146
|
+
export interface UseMorphStateOptions {
|
|
147
|
+
/** Initial morphed state */
|
|
148
|
+
initial?: boolean;
|
|
149
|
+
/** Duration for callbacks timing */
|
|
150
|
+
duration?: number;
|
|
151
|
+
/** Callback when state changes */
|
|
152
|
+
onChange?: (morphed: boolean) => void;
|
|
153
|
+
}
|
|
154
|
+
export interface UseMorphStateReturn {
|
|
155
|
+
/** Current morphed state */
|
|
156
|
+
morphed: boolean;
|
|
157
|
+
/** Toggle the state */
|
|
158
|
+
toggle: () => void;
|
|
159
|
+
/** Set to morphed (true) */
|
|
160
|
+
morph: () => void;
|
|
161
|
+
/** Set to unmorphed (false) */
|
|
162
|
+
unmorph: () => void;
|
|
163
|
+
/** Set specific state */
|
|
164
|
+
setMorphed: (value: boolean) => void;
|
|
165
|
+
/** Whether currently animating */
|
|
166
|
+
isAnimating: boolean;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Hook for managing morph state with animation awareness.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```tsx
|
|
173
|
+
* const { morphed, toggle, isAnimating } = useMorphState({ duration: 300 });
|
|
174
|
+
*
|
|
175
|
+
* return (
|
|
176
|
+
* <button onClick={toggle} disabled={isAnimating}>
|
|
177
|
+
* <NtdIconMorph from={NtdMenu} to={NtdClose} morphed={morphed} />
|
|
178
|
+
* </button>
|
|
179
|
+
* );
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
export declare function useMorphState(options?: UseMorphStateOptions): UseMorphStateReturn;
|
|
183
|
+
export default NtdIconMorph;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file NtdStateMorph.tsx
|
|
3
|
+
* @description State-based SVG path morphing for icons with multiple visual states.
|
|
4
|
+
*
|
|
5
|
+
* Unlike NtdIconMorph (which morphs between two different icon components),
|
|
6
|
+
* NtdStateMorph morphs a single icon between states — e.g., an empty heart
|
|
7
|
+
* filling up, a star being filled, a checkbox being checked.
|
|
8
|
+
*
|
|
9
|
+
* Supports liquid/fluid transitions via SVG path interpolation.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* // Heart with fill animation
|
|
14
|
+
* <NtdStateMorph
|
|
15
|
+
* states={{
|
|
16
|
+
* empty: "M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z",
|
|
17
|
+
* filled: "M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"
|
|
18
|
+
* }}
|
|
19
|
+
* fills={{ empty: 'none', filled: '#e74c3c' }}
|
|
20
|
+
* currentState="filled"
|
|
21
|
+
* duration={400}
|
|
22
|
+
* />
|
|
23
|
+
*
|
|
24
|
+
* // Checkbox morph
|
|
25
|
+
* <NtdStateMorph
|
|
26
|
+
* states={{
|
|
27
|
+
* unchecked: "M19 3H5a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2V5a2 2 0 00-2-2z",
|
|
28
|
+
* checked: "M19 3H5a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2V5a2 2 0 00-2-2zM9 17l-4-4 1.41-1.41L9 14.17l7.59-7.59L18 8l-9 9z"
|
|
29
|
+
* }}
|
|
30
|
+
* currentState={isChecked ? 'checked' : 'unchecked'}
|
|
31
|
+
* />
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
import React from 'react';
|
|
35
|
+
import type { IconSize } from './types';
|
|
36
|
+
/** Map of state name → SVG path data string. */
|
|
37
|
+
export type MorphStateMap = Record<string, string>;
|
|
38
|
+
export interface NtdStateMorphProps {
|
|
39
|
+
/** Map of named states to SVG path strings */
|
|
40
|
+
states: MorphStateMap;
|
|
41
|
+
/** Current state to display */
|
|
42
|
+
currentState: string;
|
|
43
|
+
/** Fill color per state (optional — defaults to currentColor for all) */
|
|
44
|
+
fills?: Record<string, string>;
|
|
45
|
+
/** Stroke color per state (optional) */
|
|
46
|
+
strokes?: Record<string, string>;
|
|
47
|
+
/** Stroke width (default: 2) */
|
|
48
|
+
strokeWidth?: number;
|
|
49
|
+
/** Animation duration in ms (default: 300) */
|
|
50
|
+
duration?: number;
|
|
51
|
+
/** Easing function (default: 'ease-in-out') */
|
|
52
|
+
easing?: string;
|
|
53
|
+
/** Size */
|
|
54
|
+
size?: IconSize;
|
|
55
|
+
/** ViewBox (default: '0 0 24 24') */
|
|
56
|
+
viewBox?: string;
|
|
57
|
+
/** Additional class */
|
|
58
|
+
className?: string;
|
|
59
|
+
/** Additional styles */
|
|
60
|
+
style?: React.CSSProperties;
|
|
61
|
+
/** Accessible label */
|
|
62
|
+
'aria-label'?: string;
|
|
63
|
+
/** Callback when morph transition completes */
|
|
64
|
+
onTransitionEnd?: (state: string) => void;
|
|
65
|
+
}
|
|
66
|
+
export interface StateMorphHandle {
|
|
67
|
+
/** Get current state */
|
|
68
|
+
getState: () => string;
|
|
69
|
+
/** Programmatically set state */
|
|
70
|
+
setState: (state: string) => void;
|
|
71
|
+
/** Get SVG element ref */
|
|
72
|
+
getSvgElement: () => SVGSVGElement | null;
|
|
73
|
+
}
|
|
74
|
+
export declare const NtdStateMorph: React.ForwardRefExoticComponent<NtdStateMorphProps & React.RefAttributes<StateMorphHandle>>;
|
|
75
|
+
/**
|
|
76
|
+
* Hook for managing morph state transitions.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```tsx
|
|
80
|
+
* const { state, setState, toggle, props } = useStateMorph(
|
|
81
|
+
* { empty: emptyPath, filled: filledPath },
|
|
82
|
+
* 'empty',
|
|
83
|
+
* { fills: { empty: 'none', filled: '#e74c3c' } },
|
|
84
|
+
* );
|
|
85
|
+
*
|
|
86
|
+
* <NtdStateMorph {...props} />
|
|
87
|
+
* <button onClick={toggle}>Toggle</button>
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export declare function useStateMorph(states: MorphStateMap, initialState: string, options?: {
|
|
91
|
+
fills?: Record<string, string>;
|
|
92
|
+
strokes?: Record<string, string>;
|
|
93
|
+
duration?: number;
|
|
94
|
+
}): {
|
|
95
|
+
state: string;
|
|
96
|
+
setState: React.Dispatch<React.SetStateAction<string>>;
|
|
97
|
+
toggle: () => void;
|
|
98
|
+
props: NtdStateMorphProps;
|
|
99
|
+
stateNames: string[];
|
|
100
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file client.tsx
|
|
3
|
+
* @description Client-only exports for @nice2dev/icons
|
|
4
|
+
*
|
|
5
|
+
* This module provides client-side features that require JavaScript:
|
|
6
|
+
* - Animation hooks and components
|
|
7
|
+
* - Interactive icons (hover/click effects)
|
|
8
|
+
* - Color scheme detection
|
|
9
|
+
* - Icon picker with state
|
|
10
|
+
*
|
|
11
|
+
* Use this module when you need client interactivity.
|
|
12
|
+
* For static icons in React Server Components, use '@nice2dev/icons/rsc'.
|
|
13
|
+
*
|
|
14
|
+
* @version 1.0.0
|
|
15
|
+
* @since 2026-03
|
|
16
|
+
* @license MIT
|
|
17
|
+
*/
|
|
18
|
+
export { AnimationController, InteractiveIcon, useAnimationSequence, createAnimationSequence, createHoverAnimation, createClickAnimation, createVisibilityAnimation, PRESET_SEQUENCES, PRESET_INTERACTIONS, } from './animationControls';
|
|
19
|
+
export type { AnimationStep, AnimationSequenceConfig, AnimationPlaybackState, AnimationTrigger, InteractiveAnimationConfig, AnimationControllerHandle, AnimationControllerProps, InteractiveIconProps, } from './animationControls';
|
|
20
|
+
export { NiceIconPicker } from './NiceIconPicker';
|
|
21
|
+
export type { NiceIconPickerProps, NiceIconPickerHandle, IconPickerEntry } from './NiceIconPicker';
|
|
22
|
+
export { NtdIconMorph, NtdPathMorph, NtdMorphPair, useMorphState, } from './NtdIconMorph';
|
|
23
|
+
export type { NtdIconMorphProps, NtdPathMorphProps, NtdMorphPairProps, MorphTrigger, } from './NtdIconMorph';
|
|
24
|
+
export { NtdBadge, NtdStatusDot, NtdIconOverlay, NtdIconStack, } from './NtdIconBadge';
|
|
25
|
+
export type { NtdBadgeProps, NtdStatusDotProps, NtdIconOverlayProps, NtdIconStackProps, BadgePosition, StatusType, } from './NtdIconBadge';
|
|
26
|
+
export { generateSmilAnimation, SmilAnimationWrapper, createSmilAnimationDef, isSmilSupported, SMIL_ANIMATION_TYPES, } from './smilAnimations';
|
|
27
|
+
export type { SmilAnimationType, SmilAnimationConfig, SmilAnimationWrapperProps, } from './smilAnimations';
|