@nice2dev/icons 1.3.14 → 1.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/NiceDesktopIconExporter.js +688 -599
  3. package/dist/cjs/NiceFaviconGenerator.js +603 -417
  4. package/dist/cjs/NiceIconPicker.js +788 -508
  5. package/dist/cjs/NiceIconPreview.js +246 -188
  6. package/dist/cjs/NiceIconSetCreator.js +683 -552
  7. package/dist/cjs/NiceIconStacker.js +547 -171
  8. package/dist/cjs/NiceIconValue.js +27 -35
  9. package/dist/cjs/NtdIconBadge.js +384 -360
  10. package/dist/cjs/NtdIconMorph.js +419 -354
  11. package/dist/cjs/NtdStateMorph.js +150 -147
  12. package/dist/cjs/advancedIconSearch.js +373 -510
  13. package/dist/cjs/animationControls.js +518 -642
  14. package/dist/cjs/client.js +12 -15
  15. package/dist/cjs/createIcon.js +349 -251
  16. package/dist/cjs/design-tokens.js +324 -390
  17. package/dist/cjs/figmaExport.js +162 -257
  18. package/dist/cjs/figmaSync.js +234 -316
  19. package/dist/cjs/headless-ui.js +240 -368
  20. package/dist/cjs/iconAnalytics.js +337 -393
  21. package/dist/cjs/iconHtml.js +64 -86
  22. package/dist/cjs/iconMetadata.js +392 -472
  23. package/dist/cjs/iconParts.js +120 -90
  24. package/dist/cjs/iconStack.js +136 -155
  25. package/dist/cjs/iconStyles.js +1609 -504
  26. package/dist/cjs/iconValue.js +359 -430
  27. package/dist/cjs/icons/accessibility.js +1119 -134
  28. package/dist/cjs/icons/actions.js +1290 -330
  29. package/dist/cjs/icons/ai.js +1424 -144
  30. package/dist/cjs/icons/brand.js +1344 -172
  31. package/dist/cjs/icons/business.js +903 -193
  32. package/dist/cjs/icons/devtech.js +1656 -227
  33. package/dist/cjs/icons/ecommerce.js +802 -111
  34. package/dist/cjs/icons/education.js +1345 -199
  35. package/dist/cjs/icons/files.js +1597 -328
  36. package/dist/cjs/icons/fintech.js +793 -104
  37. package/dist/cjs/icons/food.js +1507 -153
  38. package/dist/cjs/icons/fun.js +786 -109
  39. package/dist/cjs/icons/gaming.js +916 -170
  40. package/dist/cjs/icons/health.js +623 -112
  41. package/dist/cjs/icons/index.js +34 -35
  42. package/dist/cjs/icons/input.js +282 -83
  43. package/dist/cjs/icons/legal.js +1065 -122
  44. package/dist/cjs/icons/media.js +1061 -267
  45. package/dist/cjs/icons/navigation.js +387 -122
  46. package/dist/cjs/icons/omniverk.js +747 -90
  47. package/dist/cjs/icons/realestate.js +1520 -193
  48. package/dist/cjs/icons/saas.js +867 -98
  49. package/dist/cjs/icons/science.js +1465 -165
  50. package/dist/cjs/icons/shapes.js +1316 -308
  51. package/dist/cjs/icons/smarthome.js +786 -90
  52. package/dist/cjs/icons/social.js +591 -59
  53. package/dist/cjs/icons/sports.js +1225 -133
  54. package/dist/cjs/icons/sustainability.js +1211 -139
  55. package/dist/cjs/icons/travel.js +1470 -148
  56. package/dist/cjs/icons/ui.js +1508 -315
  57. package/dist/cjs/icons/weather.js +1160 -173
  58. package/dist/cjs/index.js +566 -566
  59. package/dist/cjs/lottieIntegration.js +261 -266
  60. package/dist/cjs/nicetodev-icons.css +1 -1
  61. package/dist/cjs/particleEffects.js +270 -251
  62. package/dist/cjs/resolver.js +229 -284
  63. package/dist/cjs/rsc.js +175 -193
  64. package/dist/cjs/sharpen.js +73 -130
  65. package/dist/cjs/smilAnimations.js +371 -165
  66. package/dist/cjs/stacking.js +87 -122
  67. package/dist/cjs/tailwind-plugin.js +280 -320
  68. package/dist/cjs/types.js +46 -72
  69. package/dist/cjs/utilities.js +163 -324
  70. package/dist/cjs/variantProps.js +12 -52
  71. package/dist/esm/NiceDesktopIconExporter.js +671 -598
  72. package/dist/esm/NiceFaviconGenerator.js +583 -416
  73. package/dist/esm/NiceIconPicker.js +789 -507
  74. package/dist/esm/NiceIconPreview.js +247 -187
  75. package/dist/esm/NiceIconSetCreator.js +685 -551
  76. package/dist/esm/NiceIconStacker.js +549 -170
  77. package/dist/esm/NiceIconValue.js +29 -34
  78. package/dist/esm/NtdIconBadge.js +388 -359
  79. package/dist/esm/NtdIconMorph.js +423 -353
  80. package/dist/esm/NtdStateMorph.js +152 -146
  81. package/dist/esm/advancedIconSearch.js +391 -509
  82. package/dist/esm/animationControls.js +527 -641
  83. package/dist/esm/client.js +48 -10
  84. package/dist/esm/createIcon.js +350 -250
  85. package/dist/esm/design-tokens.js +334 -387
  86. package/dist/esm/figmaExport.js +170 -256
  87. package/dist/esm/figmaSync.js +237 -315
  88. package/dist/esm/headless-ui.js +254 -365
  89. package/dist/esm/iconAnalytics.js +342 -392
  90. package/dist/esm/iconHtml.js +67 -85
  91. package/dist/esm/iconMetadata.js +404 -471
  92. package/dist/esm/iconParts.js +125 -89
  93. package/dist/esm/iconStack.js +145 -154
  94. package/dist/esm/iconStyles.js +1620 -503
  95. package/dist/esm/iconValue.js +361 -429
  96. package/dist/esm/icons/accessibility.js +1133 -133
  97. package/dist/esm/icons/actions.js +1320 -329
  98. package/dist/esm/icons/ai.js +1441 -143
  99. package/dist/esm/icons/brand.js +1351 -171
  100. package/dist/esm/icons/business.js +931 -201
  101. package/dist/esm/icons/devtech.js +1687 -226
  102. package/dist/esm/icons/ecommerce.js +816 -110
  103. package/dist/esm/icons/education.js +1364 -198
  104. package/dist/esm/icons/files.js +1628 -327
  105. package/dist/esm/icons/fintech.js +807 -103
  106. package/dist/esm/icons/food.js +1524 -152
  107. package/dist/esm/icons/fun.js +801 -108
  108. package/dist/esm/icons/gaming.js +933 -169
  109. package/dist/esm/icons/health.js +636 -111
  110. package/dist/esm/icons/index.js +596 -32
  111. package/dist/esm/icons/input.js +326 -82
  112. package/dist/esm/icons/legal.js +1079 -121
  113. package/dist/esm/icons/media.js +1086 -266
  114. package/dist/esm/icons/navigation.js +401 -121
  115. package/dist/esm/icons/omniverk.js +759 -89
  116. package/dist/esm/icons/realestate.js +1544 -198
  117. package/dist/esm/icons/saas.js +880 -97
  118. package/dist/esm/icons/science.js +1482 -164
  119. package/dist/esm/icons/shapes.js +1343 -307
  120. package/dist/esm/icons/smarthome.js +799 -89
  121. package/dist/esm/icons/social.js +599 -58
  122. package/dist/esm/icons/sports.js +1240 -132
  123. package/dist/esm/icons/sustainability.js +1226 -138
  124. package/dist/esm/icons/travel.js +1486 -147
  125. package/dist/esm/icons/ui.js +1540 -314
  126. package/dist/esm/icons/weather.js +1181 -172
  127. package/dist/esm/index.js +756 -58
  128. package/dist/esm/lottieIntegration.js +264 -265
  129. package/dist/esm/nicetodev-icons.css +1 -1
  130. package/dist/esm/particleEffects.js +271 -250
  131. package/dist/esm/resolver.js +231 -283
  132. package/dist/esm/rsc.js +182 -192
  133. package/dist/esm/sharpen.js +78 -129
  134. package/dist/esm/smilAnimations.js +376 -164
  135. package/dist/esm/stacking.js +99 -121
  136. package/dist/esm/tailwind-plugin.js +282 -319
  137. package/dist/esm/types.js +50 -71
  138. package/dist/esm/utilities.js +177 -321
  139. package/dist/esm/variantProps.js +23 -52
  140. package/dist/types/icons/index.d.ts +1 -1
  141. package/dist/types/icons/science.d.ts +9 -0
  142. package/package.json +15 -22
@@ -1,689 +1,575 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import React, { useState, useRef, useMemo, useCallback, useEffect, forwardRef, useImperativeHandle } from 'react';
3
-
4
- /* ────────────────────────────────────────────────────────────────────────────
5
- 2. HELPER FUNCTIONS
6
- ───────────────────────────────────────────────────────────────────────────── */
7
- /**
8
- * Build CSS class for animation
9
- */
1
+ import { jsx } from "react/jsx-runtime";
2
+ import React, { useState, useRef, useMemo, useCallback, useEffect, forwardRef, useImperativeHandle } from "react";
10
3
  function getAnimationClass(animation) {
11
- return `ntd-anim-${animation}`;
4
+ return `ntd-anim-${animation}`;
12
5
  }
13
- /**
14
- * Build inline animation style
15
- */
16
- function getAnimationStyle(animation, duration = 1000, easing = 'ease-in-out', iterations = 1, delay = 0) {
17
- const iterationValue = iterations < 0 ? 'infinite' : iterations;
18
- return {
19
- animationName: `ntd-${animation}`,
20
- animationDuration: `${duration}ms`,
21
- animationTimingFunction: easing,
22
- animationIterationCount: iterationValue,
23
- animationDelay: `${delay}ms`,
24
- animationFillMode: 'forwards',
25
- };
6
+ function getAnimationStyle(animation, duration = 1e3, easing = "ease-in-out", iterations = 1, delay = 0) {
7
+ const iterationValue = iterations < 0 ? "infinite" : iterations;
8
+ return {
9
+ animationName: `ntd-${animation}`,
10
+ animationDuration: `${duration}ms`,
11
+ animationTimingFunction: easing,
12
+ animationIterationCount: iterationValue,
13
+ animationDelay: `${delay}ms`,
14
+ animationFillMode: "forwards"
15
+ };
26
16
  }
27
- /**
28
- * Check if config is a sequence
29
- */
30
17
  function isSequenceConfig(config) {
31
- return typeof config === 'object' && 'steps' in config;
18
+ return typeof config === "object" && "steps" in config;
32
19
  }
33
- /* ────────────────────────────────────────────────────────────────────────────
34
- 3. ANIMATION SEQUENCE HOOK
35
- ───────────────────────────────────────────────────────────────────────────── */
36
- /**
37
- * Hook to manage animation sequences
38
- */
39
20
  function useAnimationSequence(config) {
40
- const [currentStepIndex, setCurrentStepIndex] = useState(0);
41
- const [loopIteration, setLoopIteration] = useState(0);
42
- const [state, setState] = useState('idle');
43
- const [direction, setDirection] = useState('forward');
44
- const timeoutRef = useRef(null);
45
- const startTimeRef = useRef(0);
46
- const elapsedRef = useRef(0);
47
- const steps = useMemo(() => {
48
- if (config.direction === 'reverse') {
49
- return [...config.steps].reverse();
50
- }
51
- return config.steps;
52
- }, [config.steps, config.direction]);
53
- const currentStep = steps[currentStepIndex];
54
- const clearTimer = useCallback(() => {
55
- if (timeoutRef.current) {
56
- clearTimeout(timeoutRef.current);
57
- timeoutRef.current = null;
58
- }
59
- }, []);
60
- const play = useCallback(() => {
61
- if (state === 'finished') {
62
- // Reset if finished
63
- setCurrentStepIndex(0);
64
- setLoopIteration(0);
65
- elapsedRef.current = 0;
66
- }
67
- setState('playing');
68
- startTimeRef.current = Date.now();
69
- }, [state]);
70
- const pause = useCallback(() => {
71
- if (state === 'playing') {
72
- clearTimer();
73
- elapsedRef.current += Date.now() - startTimeRef.current;
74
- setState('paused');
75
- }
76
- }, [state, clearTimer]);
77
- const reset = useCallback(() => {
21
+ const [currentStepIndex, setCurrentStepIndex] = useState(0);
22
+ const [loopIteration, setLoopIteration] = useState(0);
23
+ const [state, setState] = useState("idle");
24
+ const [direction, setDirection] = useState("forward");
25
+ const timeoutRef = useRef(null);
26
+ const startTimeRef = useRef(0);
27
+ const elapsedRef = useRef(0);
28
+ const steps = useMemo(() => {
29
+ if (config.direction === "reverse") {
30
+ return [...config.steps].reverse();
31
+ }
32
+ return config.steps;
33
+ }, [config.steps, config.direction]);
34
+ const currentStep = steps[currentStepIndex];
35
+ const clearTimer = useCallback(() => {
36
+ if (timeoutRef.current) {
37
+ clearTimeout(timeoutRef.current);
38
+ timeoutRef.current = null;
39
+ }
40
+ }, []);
41
+ const play = useCallback(() => {
42
+ if (state === "finished") {
43
+ setCurrentStepIndex(0);
44
+ setLoopIteration(0);
45
+ elapsedRef.current = 0;
46
+ }
47
+ setState("playing");
48
+ startTimeRef.current = Date.now();
49
+ }, [state]);
50
+ const pause = useCallback(() => {
51
+ if (state === "playing") {
52
+ clearTimer();
53
+ elapsedRef.current += Date.now() - startTimeRef.current;
54
+ setState("paused");
55
+ }
56
+ }, [state, clearTimer]);
57
+ const reset = useCallback(() => {
58
+ clearTimer();
59
+ setCurrentStepIndex(0);
60
+ setLoopIteration(0);
61
+ setDirection("forward");
62
+ elapsedRef.current = 0;
63
+ setState("idle");
64
+ }, [clearTimer]);
65
+ const goToStep = useCallback(
66
+ (index) => {
67
+ if (index >= 0 && index < steps.length) {
78
68
  clearTimer();
79
- setCurrentStepIndex(0);
80
- setLoopIteration(0);
81
- setDirection('forward');
69
+ setCurrentStepIndex(index);
82
70
  elapsedRef.current = 0;
83
- setState('idle');
84
- }, [clearTimer]);
85
- const goToStep = useCallback((index) => {
86
- if (index >= 0 && index < steps.length) {
87
- clearTimer();
88
- setCurrentStepIndex(index);
89
- elapsedRef.current = 0;
90
- if (state === 'playing') {
91
- startTimeRef.current = Date.now();
92
- }
93
- }
94
- }, [steps.length, clearTimer, state]);
95
- const getProgress = useCallback(() => {
96
- if (state === 'idle') {
97
- return 0;
71
+ if (state === "playing") {
72
+ startTimeRef.current = Date.now();
98
73
  }
99
- if (state === 'finished') {
100
- return 1;
101
- }
102
- const stepProgress = currentStepIndex / steps.length;
103
- return stepProgress;
104
- }, [state, currentStepIndex, steps.length]);
105
- // Handle step progression
106
- useEffect(() => {
107
- if (state !== 'playing' || !currentStep) {
108
- return;
109
- }
110
- const stepDuration = (currentStep.duration || 1000) * (currentStep.iterations || 1);
111
- const remainingTime = stepDuration - elapsedRef.current;
112
- timeoutRef.current = setTimeout(() => {
113
- elapsedRef.current = 0;
114
- // Determine next step
115
- let nextStepIndex;
116
- if (config.direction === 'alternate') {
117
- if (direction === 'forward') {
118
- if (currentStepIndex >= steps.length - 1) {
119
- setDirection('backward');
120
- nextStepIndex = currentStepIndex - 1;
121
- }
122
- else {
123
- nextStepIndex = currentStepIndex + 1;
124
- }
125
- }
126
- else {
127
- if (currentStepIndex <= 0) {
128
- setDirection('forward');
129
- nextStepIndex = currentStepIndex + 1;
130
- }
131
- else {
132
- nextStepIndex = currentStepIndex - 1;
133
- }
134
- }
135
- }
136
- else {
137
- nextStepIndex = currentStepIndex + 1;
138
- }
139
- // Check if sequence complete
140
- if (nextStepIndex >= steps.length && config.direction !== 'alternate') {
141
- if (config.loop) {
142
- const newIteraton = loopIteration + 1;
143
- if (config.loopCount && newIteraton >= config.loopCount) {
144
- setState('finished');
145
- }
146
- else {
147
- setLoopIteration(newIteraton);
148
- setCurrentStepIndex(0);
149
- // Apply loop delay
150
- if (config.loopDelay) {
151
- setState('paused');
152
- timeoutRef.current = setTimeout(() => {
153
- setState('playing');
154
- startTimeRef.current = Date.now();
155
- }, config.loopDelay);
156
- }
157
- else {
158
- startTimeRef.current = Date.now();
159
- }
160
- }
161
- }
162
- else {
163
- setState('finished');
164
- }
165
- }
166
- else if (nextStepIndex >= 0 && nextStepIndex < steps.length) {
167
- setCurrentStepIndex(nextStepIndex);
168
- startTimeRef.current = Date.now();
169
- }
170
- }, remainingTime + (currentStep.delay || 0));
171
- return clearTimer;
172
- }, [
173
- state,
174
- currentStep,
175
- currentStepIndex,
176
- steps.length,
177
- direction,
178
- config.loop,
179
- config.loopCount,
180
- config.loopDelay,
181
- config.direction,
182
- loopIteration,
183
- clearTimer,
184
- ]);
185
- return {
186
- currentStep,
187
- currentStepIndex,
188
- state,
189
- loopIteration,
190
- play,
191
- pause,
192
- reset,
193
- goToStep,
194
- getProgress,
195
- };
196
- }
197
- /* ────────────────────────────────────────────────────────────────────────────
198
- 4. ANIMATION CONTROLLER COMPONENT
199
- ───────────────────────────────────────────────────────────────────────────── */
200
- /**
201
- * Animation Controller component
202
- *
203
- * Wraps an icon and provides play/pause/reset controls.
204
- *
205
- * @example
206
- * ```tsx
207
- * const ref = useRef<AnimationControllerHandle>(null);
208
- *
209
- * <AnimationController
210
- * ref={ref}
211
- * animation="spin"
212
- * autoPlay={false}
213
- * >
214
- * <NiceIcon name="loading" />
215
- * </AnimationController>
216
- *
217
- * <button onClick={() => ref.current?.play()}>Play</button>
218
- * <button onClick={() => ref.current?.pause()}>Pause</button>
219
- * <button onClick={() => ref.current?.reset()}>Reset</button>
220
- * ```
221
- *
222
- * @example Sequence
223
- * ```tsx
224
- * <AnimationController
225
- * animation={{
226
- * steps: [
227
- * { animation: 'bounce', duration: 500 },
228
- * { animation: 'spin', duration: 1000 },
229
- * { animation: 'pulse', duration: 800 },
230
- * ],
231
- * loop: true,
232
- * loopCount: 3
233
- * }}
234
- * autoPlay
235
- * >
236
- * <NiceIcon name="star" />
237
- * </AnimationController>
238
- * ```
239
- */
240
- const AnimationController = /* @__PURE__ */ forwardRef(function AnimationController(props, ref) {
241
- const { children, animation, autoPlay = false, playState: externalPlayState, onStart, onEnd, onStepChange, onPause, onResume, className, style, } = props;
242
- // Determine if sequence or single animation
243
- const isSequence = isSequenceConfig(animation);
244
- // For single animations
245
- const [singleState, setSingleState] = useState(autoPlay ? 'playing' : 'idle');
246
- const singleIterationRef = useRef(0);
247
- // For sequences
248
- const sequenceConfig = isSequence ? animation : { steps: [{ animation, duration: 1000 }] };
249
- const sequence = useAnimationSequence(sequenceConfig);
250
- // Unified state
251
- const state = isSequence ? sequence.state : singleState;
252
- const currentStepIndex = isSequence ? sequence.currentStepIndex : 0;
253
- // Handle external playState control
254
- useEffect(() => {
255
- if (externalPlayState !== undefined) {
256
- if (isSequence) {
257
- if (externalPlayState === 'playing') {
258
- sequence.play();
259
- }
260
- else if (externalPlayState === 'paused') {
261
- sequence.pause();
262
- }
263
- else if (externalPlayState === 'idle') {
264
- sequence.reset();
265
- }
266
- }
267
- else {
268
- setSingleState(externalPlayState);
269
- }
270
- }
271
- }, [externalPlayState, isSequence, sequence]);
272
- // Auto-play
273
- useEffect(() => {
274
- if (autoPlay) {
275
- if (isSequence) {
276
- sequence.play();
277
- }
278
- else {
279
- setSingleState('playing');
280
- }
281
- onStart === null || onStart === void 0 ? void 0 : onStart();
282
- }
283
- // eslint-disable-next-line react-hooks/exhaustive-deps
284
- }, []);
285
- // Step change callback
286
- const prevStepRef = useRef(currentStepIndex);
287
- useEffect(() => {
288
- if (prevStepRef.current !== currentStepIndex && isSequence) {
289
- const step = sequenceConfig.steps[currentStepIndex];
290
- onStepChange === null || onStepChange === void 0 ? void 0 : onStepChange(currentStepIndex, step);
291
- }
292
- prevStepRef.current = currentStepIndex;
293
- }, [currentStepIndex, isSequence, sequenceConfig.steps, onStepChange]);
294
- // State change callbacks
295
- const prevStateRef = useRef(state);
296
- useEffect(() => {
297
- if (prevStateRef.current !== state) {
298
- if (state === 'playing' && prevStateRef.current === 'paused') {
299
- onResume === null || onResume === void 0 ? void 0 : onResume();
300
- }
301
- else if (state === 'paused' && prevStateRef.current === 'playing') {
302
- onPause === null || onPause === void 0 ? void 0 : onPause();
303
- }
304
- else if (state === 'finished') {
305
- onEnd === null || onEnd === void 0 ? void 0 : onEnd();
74
+ }
75
+ },
76
+ [steps.length, clearTimer, state]
77
+ );
78
+ const getProgress = useCallback(() => {
79
+ if (state === "idle") {
80
+ return 0;
81
+ }
82
+ if (state === "finished") {
83
+ return 1;
84
+ }
85
+ const stepProgress = currentStepIndex / steps.length;
86
+ return stepProgress;
87
+ }, [state, currentStepIndex, steps.length]);
88
+ useEffect(() => {
89
+ if (state !== "playing" || !currentStep) {
90
+ return;
91
+ }
92
+ const stepDuration = (currentStep.duration || 1e3) * (currentStep.iterations || 1);
93
+ const remainingTime = stepDuration - elapsedRef.current;
94
+ timeoutRef.current = setTimeout(
95
+ () => {
96
+ elapsedRef.current = 0;
97
+ let nextStepIndex;
98
+ if (config.direction === "alternate") {
99
+ if (direction === "forward") {
100
+ if (currentStepIndex >= steps.length - 1) {
101
+ setDirection("backward");
102
+ nextStepIndex = currentStepIndex - 1;
103
+ } else {
104
+ nextStepIndex = currentStepIndex + 1;
306
105
  }
307
- else if (state === 'playing' && prevStateRef.current === 'idle') {
308
- onStart === null || onStart === void 0 ? void 0 : onStart();
106
+ } else {
107
+ if (currentStepIndex <= 0) {
108
+ setDirection("forward");
109
+ nextStepIndex = currentStepIndex + 1;
110
+ } else {
111
+ nextStepIndex = currentStepIndex - 1;
309
112
  }
113
+ }
114
+ } else {
115
+ nextStepIndex = currentStepIndex + 1;
310
116
  }
311
- prevStateRef.current = state;
312
- }, [state, onStart, onEnd, onPause, onResume]);
313
- // Imperative handle
314
- useImperativeHandle(ref, () => ({
315
- play: () => {
316
- if (isSequence) {
317
- sequence.play();
318
- }
319
- else {
320
- setSingleState('playing');
321
- singleIterationRef.current++;
322
- }
323
- onStart === null || onStart === void 0 ? void 0 : onStart();
324
- },
325
- pause: () => {
326
- if (isSequence) {
327
- sequence.pause();
328
- }
329
- else {
330
- setSingleState('paused');
331
- }
332
- onPause === null || onPause === void 0 ? void 0 : onPause();
333
- },
334
- reset: () => {
335
- if (isSequence) {
336
- sequence.reset();
337
- }
338
- else {
339
- setSingleState('idle');
340
- singleIterationRef.current++;
341
- }
342
- },
343
- goToStep: (index) => {
344
- if (isSequence) {
345
- sequence.goToStep(index);
346
- }
347
- },
348
- getState: () => state,
349
- getCurrentStep: () => currentStepIndex,
350
- getProgress: () => {
351
- if (isSequence) {
352
- return sequence.getProgress();
117
+ if (nextStepIndex >= steps.length && config.direction !== "alternate") {
118
+ if (config.loop) {
119
+ const newIteraton = loopIteration + 1;
120
+ if (config.loopCount && newIteraton >= config.loopCount) {
121
+ setState("finished");
122
+ } else {
123
+ setLoopIteration(newIteraton);
124
+ setCurrentStepIndex(0);
125
+ if (config.loopDelay) {
126
+ setState("paused");
127
+ timeoutRef.current = setTimeout(() => {
128
+ setState("playing");
129
+ startTimeRef.current = Date.now();
130
+ }, config.loopDelay);
131
+ } else {
132
+ startTimeRef.current = Date.now();
133
+ }
353
134
  }
354
- return state === 'playing' ? 0.5 : state === 'finished' ? 1 : 0;
355
- },
356
- }));
357
- // Build animation styles
358
- const animationStyles = useMemo(() => {
359
- if (state === 'idle') {
360
- return {};
361
- }
362
- if (state === 'paused') {
363
- return { animationPlayState: 'paused' };
135
+ } else {
136
+ setState("finished");
137
+ }
138
+ } else if (nextStepIndex >= 0 && nextStepIndex < steps.length) {
139
+ setCurrentStepIndex(nextStepIndex);
140
+ startTimeRef.current = Date.now();
364
141
  }
365
- if (isSequence && sequence.currentStep) {
366
- const step = sequence.currentStep;
367
- return getAnimationStyle(step.animation, step.duration, step.easing, step.iterations, step.delay);
368
- }
369
- if (!isSequence) {
370
- return getAnimationStyle(animation, 1000, 'ease-in-out', -1);
142
+ },
143
+ remainingTime + (currentStep.delay || 0)
144
+ );
145
+ return clearTimer;
146
+ }, [
147
+ state,
148
+ currentStep,
149
+ currentStepIndex,
150
+ steps.length,
151
+ direction,
152
+ config.loop,
153
+ config.loopCount,
154
+ config.loopDelay,
155
+ config.direction,
156
+ loopIteration,
157
+ clearTimer
158
+ ]);
159
+ return {
160
+ currentStep,
161
+ currentStepIndex,
162
+ state,
163
+ loopIteration,
164
+ play,
165
+ pause,
166
+ reset,
167
+ goToStep,
168
+ getProgress
169
+ };
170
+ }
171
+ const AnimationController = /* @__PURE__ */ forwardRef(function AnimationController2(props, ref) {
172
+ const {
173
+ children,
174
+ animation,
175
+ autoPlay = false,
176
+ playState: externalPlayState,
177
+ onStart,
178
+ onEnd,
179
+ onStepChange,
180
+ onPause,
181
+ onResume,
182
+ className,
183
+ style
184
+ } = props;
185
+ const isSequence = isSequenceConfig(animation);
186
+ const [singleState, setSingleState] = useState(
187
+ autoPlay ? "playing" : "idle"
188
+ );
189
+ const singleIterationRef = useRef(0);
190
+ const sequenceConfig = isSequence ? animation : { steps: [{ animation, duration: 1e3 }] };
191
+ const sequence = useAnimationSequence(sequenceConfig);
192
+ const state = isSequence ? sequence.state : singleState;
193
+ const currentStepIndex = isSequence ? sequence.currentStepIndex : 0;
194
+ useEffect(() => {
195
+ if (externalPlayState !== void 0) {
196
+ if (isSequence) {
197
+ if (externalPlayState === "playing") {
198
+ sequence.play();
199
+ } else if (externalPlayState === "paused") {
200
+ sequence.pause();
201
+ } else if (externalPlayState === "idle") {
202
+ sequence.reset();
371
203
  }
372
- return {};
373
- }, [state, isSequence, sequence.currentStep, animation]);
374
- // Animation class
375
- const animationClass = state === 'playing' || state === 'paused'
376
- ? isSequence && sequence.currentStep
377
- ? getAnimationClass(sequence.currentStep.animation)
378
- : getAnimationClass(animation)
379
- : '';
380
- // Clone child with animation props
381
- const animatedChild = React.cloneElement(children, {
382
- className: `${children.props.className || ''} ${animationClass}`.trim(),
383
- style: {
384
- ...children.props.style,
385
- ...animationStyles,
386
- },
387
- key: isSequence
388
- ? `seq-${currentStepIndex}-${sequence.loopIteration}`
389
- : `single-${singleIterationRef.current}`,
390
- });
391
- return (jsx("span", { className: `ntd-animation-controller ntd-animation-${state} ${className || ''}`.trim(), style: style, children: animatedChild }));
204
+ } else {
205
+ setSingleState(externalPlayState);
206
+ }
207
+ }
208
+ }, [externalPlayState, isSequence, sequence]);
209
+ useEffect(() => {
210
+ if (autoPlay) {
211
+ if (isSequence) {
212
+ sequence.play();
213
+ } else {
214
+ setSingleState("playing");
215
+ }
216
+ onStart?.();
217
+ }
218
+ }, []);
219
+ const prevStepRef = useRef(currentStepIndex);
220
+ useEffect(() => {
221
+ if (prevStepRef.current !== currentStepIndex && isSequence) {
222
+ const step = sequenceConfig.steps[currentStepIndex];
223
+ onStepChange?.(currentStepIndex, step);
224
+ }
225
+ prevStepRef.current = currentStepIndex;
226
+ }, [currentStepIndex, isSequence, sequenceConfig.steps, onStepChange]);
227
+ const prevStateRef = useRef(state);
228
+ useEffect(() => {
229
+ if (prevStateRef.current !== state) {
230
+ if (state === "playing" && prevStateRef.current === "paused") {
231
+ onResume?.();
232
+ } else if (state === "paused" && prevStateRef.current === "playing") {
233
+ onPause?.();
234
+ } else if (state === "finished") {
235
+ onEnd?.();
236
+ } else if (state === "playing" && prevStateRef.current === "idle") {
237
+ onStart?.();
238
+ }
239
+ }
240
+ prevStateRef.current = state;
241
+ }, [state, onStart, onEnd, onPause, onResume]);
242
+ useImperativeHandle(ref, () => ({
243
+ play: () => {
244
+ if (isSequence) {
245
+ sequence.play();
246
+ } else {
247
+ setSingleState("playing");
248
+ singleIterationRef.current++;
249
+ }
250
+ onStart?.();
251
+ },
252
+ pause: () => {
253
+ if (isSequence) {
254
+ sequence.pause();
255
+ } else {
256
+ setSingleState("paused");
257
+ }
258
+ onPause?.();
259
+ },
260
+ reset: () => {
261
+ if (isSequence) {
262
+ sequence.reset();
263
+ } else {
264
+ setSingleState("idle");
265
+ singleIterationRef.current++;
266
+ }
267
+ },
268
+ goToStep: (index) => {
269
+ if (isSequence) {
270
+ sequence.goToStep(index);
271
+ }
272
+ },
273
+ getState: () => state,
274
+ getCurrentStep: () => currentStepIndex,
275
+ getProgress: () => {
276
+ if (isSequence) {
277
+ return sequence.getProgress();
278
+ }
279
+ return state === "playing" ? 0.5 : state === "finished" ? 1 : 0;
280
+ }
281
+ }));
282
+ const animationStyles = useMemo(() => {
283
+ if (state === "idle") {
284
+ return {};
285
+ }
286
+ if (state === "paused") {
287
+ return { animationPlayState: "paused" };
288
+ }
289
+ if (isSequence && sequence.currentStep) {
290
+ const step = sequence.currentStep;
291
+ return getAnimationStyle(
292
+ step.animation,
293
+ step.duration,
294
+ step.easing,
295
+ step.iterations,
296
+ step.delay
297
+ );
298
+ }
299
+ if (!isSequence) {
300
+ return getAnimationStyle(animation, 1e3, "ease-in-out", -1);
301
+ }
302
+ return {};
303
+ }, [state, isSequence, sequence.currentStep, animation]);
304
+ const animationClass = state === "playing" || state === "paused" ? isSequence && sequence.currentStep ? getAnimationClass(sequence.currentStep.animation) : getAnimationClass(animation) : "";
305
+ const animatedChild = React.cloneElement(children, {
306
+ className: `${children.props.className || ""} ${animationClass}`.trim(),
307
+ style: {
308
+ ...children.props.style,
309
+ ...animationStyles
310
+ },
311
+ key: isSequence ? `seq-${currentStepIndex}-${sequence.loopIteration}` : `single-${singleIterationRef.current}`
312
+ });
313
+ return /* @__PURE__ */ jsx(
314
+ "span",
315
+ {
316
+ className: `ntd-animation-controller ntd-animation-${state} ${className || ""}`.trim(),
317
+ style,
318
+ children: animatedChild
319
+ }
320
+ );
392
321
  });
393
- /* ────────────────────────────────────────────────────────────────────────────
394
- 5. INTERACTIVE ICON COMPONENT
395
- ───────────────────────────────────────────────────────────────────────────── */
396
- /**
397
- * Interactive icon wrapper with hover/click/focus triggers
398
- *
399
- * @example
400
- * ```tsx
401
- * <InteractiveIcon
402
- * config={{
403
- * trigger: 'hover',
404
- * enterAnimation: 'bounce',
405
- * leaveAnimation: 'fadeOut',
406
- * }}
407
- * >
408
- * <NiceIcon name="heart" />
409
- * </InteractiveIcon>
410
- * ```
411
- *
412
- * @example Click
413
- * ```tsx
414
- * <InteractiveIcon
415
- * config={{
416
- * trigger: 'click',
417
- * enterAnimation: 'pulse',
418
- * once: true,
419
- * }}
420
- * >
421
- * <NiceIcon name="notification" />
422
- * </InteractiveIcon>
423
- * ```
424
- */
425
- const InteractiveIcon = /* @__PURE__ */ forwardRef(function InteractiveIcon(props, ref) {
426
- const { children, config, disabled = false, onInteractionStart, onInteractionEnd, className, style, } = props;
322
+ const InteractiveIcon = /* @__PURE__ */ forwardRef(
323
+ function InteractiveIcon2(props, ref) {
324
+ const {
325
+ children,
326
+ config,
327
+ disabled = false,
328
+ onInteractionStart,
329
+ onInteractionEnd,
330
+ className,
331
+ style
332
+ } = props;
427
333
  const [isActive, setIsActive] = useState(false);
428
334
  const [isLeaving, setIsLeaving] = useState(false);
429
335
  const [hasPlayed, setHasPlayed] = useState(false);
430
336
  const wrapperRef = useRef(null);
431
337
  const timeoutRef = useRef(null);
432
- // Merge refs
433
- const setRefs = useCallback((node) => {
338
+ const setRefs = useCallback(
339
+ (node) => {
434
340
  wrapperRef.current = node;
435
- if (typeof ref === 'function') {
436
- ref(node);
437
- }
438
- else if (ref) {
439
- ref.current = node;
341
+ if (typeof ref === "function") {
342
+ ref(node);
343
+ } else if (ref) {
344
+ ref.current = node;
440
345
  }
441
- }, [ref]);
442
- // Clear any pending timeouts
346
+ },
347
+ [ref]
348
+ );
443
349
  const clearTimer = useCallback(() => {
444
- if (timeoutRef.current) {
445
- clearTimeout(timeoutRef.current);
446
- timeoutRef.current = null;
447
- }
350
+ if (timeoutRef.current) {
351
+ clearTimeout(timeoutRef.current);
352
+ timeoutRef.current = null;
353
+ }
448
354
  }, []);
449
355
  useEffect(() => clearTimer, [clearTimer]);
450
- // Handle activation
451
356
  const activate = useCallback(() => {
452
- if (disabled) {
453
- return;
454
- }
455
- if (config.once && hasPlayed) {
456
- return;
457
- }
458
- clearTimer();
459
- setIsLeaving(false);
460
- if (config.delay) {
461
- timeoutRef.current = setTimeout(() => {
462
- setIsActive(true);
463
- setHasPlayed(true);
464
- onInteractionStart === null || onInteractionStart === void 0 ? void 0 : onInteractionStart();
465
- }, config.delay);
466
- }
467
- else {
468
- setIsActive(true);
469
- setHasPlayed(true);
470
- onInteractionStart === null || onInteractionStart === void 0 ? void 0 : onInteractionStart();
471
- }
357
+ if (disabled) {
358
+ return;
359
+ }
360
+ if (config.once && hasPlayed) {
361
+ return;
362
+ }
363
+ clearTimer();
364
+ setIsLeaving(false);
365
+ if (config.delay) {
366
+ timeoutRef.current = setTimeout(() => {
367
+ setIsActive(true);
368
+ setHasPlayed(true);
369
+ onInteractionStart?.();
370
+ }, config.delay);
371
+ } else {
372
+ setIsActive(true);
373
+ setHasPlayed(true);
374
+ onInteractionStart?.();
375
+ }
472
376
  }, [disabled, config.once, config.delay, hasPlayed, clearTimer, onInteractionStart]);
473
- // Handle deactivation
474
377
  const deactivate = useCallback(() => {
475
- if (!isActive) {
476
- return;
477
- }
478
- clearTimer();
479
- if (config.leaveAnimation) {
480
- setIsLeaving(true);
481
- setIsActive(false);
482
- timeoutRef.current = setTimeout(() => {
483
- setIsLeaving(false);
484
- onInteractionEnd === null || onInteractionEnd === void 0 ? void 0 : onInteractionEnd();
485
- }, config.leaveDuration || 300);
486
- }
487
- else {
488
- setIsActive(false);
489
- onInteractionEnd === null || onInteractionEnd === void 0 ? void 0 : onInteractionEnd();
490
- }
378
+ if (!isActive) {
379
+ return;
380
+ }
381
+ clearTimer();
382
+ if (config.leaveAnimation) {
383
+ setIsLeaving(true);
384
+ setIsActive(false);
385
+ timeoutRef.current = setTimeout(() => {
386
+ setIsLeaving(false);
387
+ onInteractionEnd?.();
388
+ }, config.leaveDuration || 300);
389
+ } else {
390
+ setIsActive(false);
391
+ onInteractionEnd?.();
392
+ }
491
393
  }, [isActive, config.leaveAnimation, config.leaveDuration, clearTimer, onInteractionEnd]);
492
- // Visibility observer
493
394
  useEffect(() => {
494
- var _a;
495
- if (config.trigger !== 'visible' || !wrapperRef.current) {
496
- return;
497
- }
498
- const threshold = (_a = config.visibilityThreshold) !== null && _a !== void 0 ? _a : 0.5;
499
- const observer = new IntersectionObserver(([entry]) => {
500
- if (entry.isIntersecting) {
501
- activate();
502
- }
503
- else if (!config.once) {
504
- deactivate();
505
- }
506
- }, { threshold });
507
- observer.observe(wrapperRef.current);
508
- return () => observer.disconnect();
395
+ if (config.trigger !== "visible" || !wrapperRef.current) {
396
+ return;
397
+ }
398
+ const threshold = config.visibilityThreshold ?? 0.5;
399
+ const observer = new IntersectionObserver(
400
+ ([entry]) => {
401
+ if (entry.isIntersecting) {
402
+ activate();
403
+ } else if (!config.once) {
404
+ deactivate();
405
+ }
406
+ },
407
+ { threshold }
408
+ );
409
+ observer.observe(wrapperRef.current);
410
+ return () => observer.disconnect();
509
411
  }, [config.trigger, config.visibilityThreshold, config.once, activate, deactivate]);
510
- // Event handlers
511
- const handleMouseEnter = config.trigger === 'hover' ? activate : undefined;
512
- const handleMouseLeave = config.trigger === 'hover' ? deactivate : undefined;
513
- const handleClick = config.trigger === 'click' ? activate : undefined;
514
- const handleFocus = config.trigger === 'focus' ? activate : undefined;
515
- const handleBlur = config.trigger === 'focus' ? deactivate : undefined;
516
- // Build animation props
517
- const currentAnimation = isActive
518
- ? config.enterAnimation
519
- : isLeaving
520
- ? config.leaveAnimation
521
- : undefined;
412
+ const handleMouseEnter = config.trigger === "hover" ? activate : void 0;
413
+ const handleMouseLeave = config.trigger === "hover" ? deactivate : void 0;
414
+ const handleClick = config.trigger === "click" ? activate : void 0;
415
+ const handleFocus = config.trigger === "focus" ? activate : void 0;
416
+ const handleBlur = config.trigger === "focus" ? deactivate : void 0;
417
+ const currentAnimation = isActive ? config.enterAnimation : isLeaving ? config.leaveAnimation : void 0;
522
418
  const animationDuration = isActive ? config.enterDuration : config.leaveDuration;
523
- const animationStyles = currentAnimation
524
- ? getAnimationStyle(currentAnimation, animationDuration || 300)
525
- : {};
526
- const animationClass = currentAnimation ? getAnimationClass(currentAnimation) : '';
527
- // Clone with animation
419
+ const animationStyles = currentAnimation ? getAnimationStyle(currentAnimation, animationDuration || 300) : {};
420
+ const animationClass = currentAnimation ? getAnimationClass(currentAnimation) : "";
528
421
  const animatedChild = React.cloneElement(children, {
529
- className: `${children.props.className || ''} ${animationClass}`.trim(),
422
+ className: `${children.props.className || ""} ${animationClass}`.trim(),
423
+ style: {
424
+ ...children.props.style,
425
+ ...animationStyles
426
+ }
427
+ });
428
+ return /* @__PURE__ */ jsx(
429
+ "span",
430
+ {
431
+ ref: setRefs,
432
+ className: `ntd-interactive-icon ${isActive ? "ntd-active" : ""} ${isLeaving ? "ntd-leaving" : ""} ${disabled ? "ntd-disabled" : ""} ${className || ""}`.trim(),
530
433
  style: {
531
- ...children.props.style,
532
- ...animationStyles,
434
+ display: "inline-flex",
435
+ cursor: disabled ? "default" : config.trigger === "click" ? "pointer" : void 0,
436
+ ...style
533
437
  },
534
- });
535
- return (jsx("span", { ref: setRefs, className: `ntd-interactive-icon ${isActive ? 'ntd-active' : ''} ${isLeaving ? 'ntd-leaving' : ''} ${disabled ? 'ntd-disabled' : ''} ${className || ''}`.trim(), style: {
536
- display: 'inline-flex',
537
- cursor: disabled ? 'default' : config.trigger === 'click' ? 'pointer' : undefined,
538
- ...style,
539
- }, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onClick: handleClick, onKeyDown: handleClick
540
- ? (e) => {
541
- if (e.key === 'Enter' || e.key === ' ') {
542
- e.preventDefault();
543
- handleClick();
544
- }
545
- }
546
- : undefined, onFocus: handleFocus, onBlur: handleBlur, tabIndex: config.trigger === 'focus' || config.trigger === 'click' ? 0 : undefined, role: config.trigger === 'click' ? 'button' : undefined, children: animatedChild }));
547
- });
548
- /* ────────────────────────────────────────────────────────────────────────────
549
- 6. UTILITY FUNCTIONS
550
- ───────────────────────────────────────────────────────────────────────────── */
551
- /**
552
- * Create an animation sequence configuration
553
- *
554
- * @example
555
- * ```tsx
556
- * const seq = createAnimationSequence([
557
- * { animation: 'shake', duration: 300 },
558
- * { animation: 'pulse', duration: 500 },
559
- * { animation: 'bounce', duration: 400 },
560
- * ], { loop: true, loopCount: 2 });
561
- * ```
562
- */
438
+ onMouseEnter: handleMouseEnter,
439
+ onMouseLeave: handleMouseLeave,
440
+ onClick: handleClick,
441
+ onKeyDown: handleClick ? (e) => {
442
+ if (e.key === "Enter" || e.key === " ") {
443
+ e.preventDefault();
444
+ handleClick();
445
+ }
446
+ } : void 0,
447
+ onFocus: handleFocus,
448
+ onBlur: handleBlur,
449
+ tabIndex: config.trigger === "focus" || config.trigger === "click" ? 0 : void 0,
450
+ role: config.trigger === "click" ? "button" : void 0,
451
+ children: animatedChild
452
+ }
453
+ );
454
+ }
455
+ );
563
456
  function createAnimationSequence(steps, options) {
564
- var _a, _b;
565
- return {
566
- steps,
567
- loop: (_a = options === null || options === void 0 ? void 0 : options.loop) !== null && _a !== void 0 ? _a : false,
568
- loopCount: options === null || options === void 0 ? void 0 : options.loopCount,
569
- loopDelay: options === null || options === void 0 ? void 0 : options.loopDelay,
570
- direction: (_b = options === null || options === void 0 ? void 0 : options.direction) !== null && _b !== void 0 ? _b : 'normal',
571
- };
457
+ return {
458
+ steps,
459
+ loop: options?.loop ?? false,
460
+ loopCount: options?.loopCount,
461
+ loopDelay: options?.loopDelay,
462
+ direction: options?.direction ?? "normal"
463
+ };
572
464
  }
573
- /**
574
- * Create an interactive config for hover effect
575
- */
576
465
  function createHoverAnimation(enterAnimation, leaveAnimation, options) {
577
- var _a, _b;
578
- return {
579
- trigger: 'hover',
580
- enterAnimation,
581
- leaveAnimation,
582
- enterDuration: (_a = options === null || options === void 0 ? void 0 : options.enterDuration) !== null && _a !== void 0 ? _a : 300,
583
- leaveDuration: (_b = options === null || options === void 0 ? void 0 : options.leaveDuration) !== null && _b !== void 0 ? _b : 200,
584
- delay: options === null || options === void 0 ? void 0 : options.delay,
585
- };
466
+ return {
467
+ trigger: "hover",
468
+ enterAnimation,
469
+ leaveAnimation,
470
+ enterDuration: options?.enterDuration ?? 300,
471
+ leaveDuration: options?.leaveDuration ?? 200,
472
+ delay: options?.delay
473
+ };
586
474
  }
587
- /**
588
- * Create an interactive config for click effect
589
- */
590
475
  function createClickAnimation(animation, options) {
591
- var _a, _b;
592
- return {
593
- trigger: 'click',
594
- enterAnimation: animation,
595
- enterDuration: (_a = options === null || options === void 0 ? void 0 : options.duration) !== null && _a !== void 0 ? _a : 500,
596
- once: (_b = options === null || options === void 0 ? void 0 : options.once) !== null && _b !== void 0 ? _b : false,
597
- delay: options === null || options === void 0 ? void 0 : options.delay,
598
- };
476
+ return {
477
+ trigger: "click",
478
+ enterAnimation: animation,
479
+ enterDuration: options?.duration ?? 500,
480
+ once: options?.once ?? false,
481
+ delay: options?.delay
482
+ };
599
483
  }
600
- /**
601
- * Create an interactive config for visibility trigger
602
- */
603
484
  function createVisibilityAnimation(animation, options) {
604
- var _a, _b, _c;
605
- return {
606
- trigger: 'visible',
607
- enterAnimation: animation,
608
- enterDuration: (_a = options === null || options === void 0 ? void 0 : options.duration) !== null && _a !== void 0 ? _a : 600,
609
- once: (_b = options === null || options === void 0 ? void 0 : options.once) !== null && _b !== void 0 ? _b : true,
610
- visibilityThreshold: (_c = options === null || options === void 0 ? void 0 : options.threshold) !== null && _c !== void 0 ? _c : 0.5,
611
- };
485
+ return {
486
+ trigger: "visible",
487
+ enterAnimation: animation,
488
+ enterDuration: options?.duration ?? 600,
489
+ once: options?.once ?? true,
490
+ visibilityThreshold: options?.threshold ?? 0.5
491
+ };
612
492
  }
613
- /* ────────────────────────────────────────────────────────────────────────────
614
- 7. PRESET SEQUENCES
615
- ───────────────────────────────────────────────────────────────────────────── */
616
- /**
617
- * Preset animation sequences for common use cases
618
- */
619
493
  const PRESET_SEQUENCES = {
620
- /** Attention grabber: bounce → shake → pulse */
621
- attention: createAnimationSequence([
622
- { animation: 'bounce', duration: 400 },
623
- { animation: 'shake', duration: 300 },
624
- { animation: 'pulse', duration: 500 },
625
- ]),
626
- /** Success animation: pop → bounce */
627
- success: createAnimationSequence([
628
- { animation: 'pop', duration: 200 },
629
- { animation: 'bounce', duration: 500 },
630
- ]),
631
- /** Error animation: shake → pulse */
632
- error: createAnimationSequence([
633
- { animation: 'shake', duration: 500, iterations: 2 },
634
- { animation: 'pulse', duration: 300 },
635
- ]),
636
- /** Loading sequence: spin → pulse (looping) */
637
- loading: createAnimationSequence([
638
- { animation: 'spin', duration: 1000 },
639
- { animation: 'pulse', duration: 500 },
640
- ], { loop: true }),
641
- /** Celebration: bounce → tada → heartbeat */
642
- celebrate: createAnimationSequence([
643
- { animation: 'bounce', duration: 500 },
644
- { animation: 'tada', duration: 800 },
645
- { animation: 'heartbeat', duration: 600 },
646
- ]),
647
- /** Notification: swing → bounce */
648
- notification: createAnimationSequence([
649
- { animation: 'swing', duration: 600 },
650
- { animation: 'bounce', duration: 400 },
651
- ]),
652
- /** Gentle: pulse → breathe */
653
- gentle: createAnimationSequence([
654
- { animation: 'pulse', duration: 800 },
655
- { animation: 'breathe', duration: 1500 },
656
- ], { loop: true }),
657
- /** Reveal: fade-in → pop */
658
- reveal: createAnimationSequence([
659
- { animation: 'fade-in', duration: 300 },
660
- { animation: 'pop', duration: 200 },
661
- ]),
494
+ /** Attention grabber: bounce → shake → pulse */
495
+ attention: createAnimationSequence([
496
+ { animation: "bounce", duration: 400 },
497
+ { animation: "shake", duration: 300 },
498
+ { animation: "pulse", duration: 500 }
499
+ ]),
500
+ /** Success animation: pop → bounce */
501
+ success: createAnimationSequence([
502
+ { animation: "pop", duration: 200 },
503
+ { animation: "bounce", duration: 500 }
504
+ ]),
505
+ /** Error animation: shake → pulse */
506
+ error: createAnimationSequence([
507
+ { animation: "shake", duration: 500, iterations: 2 },
508
+ { animation: "pulse", duration: 300 }
509
+ ]),
510
+ /** Loading sequence: spin → pulse (looping) */
511
+ loading: createAnimationSequence(
512
+ [
513
+ { animation: "spin", duration: 1e3 },
514
+ { animation: "pulse", duration: 500 }
515
+ ],
516
+ { loop: true }
517
+ ),
518
+ /** Celebration: bounce → tada → heartbeat */
519
+ celebrate: createAnimationSequence([
520
+ { animation: "bounce", duration: 500 },
521
+ { animation: "tada", duration: 800 },
522
+ { animation: "heartbeat", duration: 600 }
523
+ ]),
524
+ /** Notification: swing → bounce */
525
+ notification: createAnimationSequence([
526
+ { animation: "swing", duration: 600 },
527
+ { animation: "bounce", duration: 400 }
528
+ ]),
529
+ /** Gentle: pulse → breathe */
530
+ gentle: createAnimationSequence(
531
+ [
532
+ { animation: "pulse", duration: 800 },
533
+ { animation: "breathe", duration: 1500 }
534
+ ],
535
+ { loop: true }
536
+ ),
537
+ /** Reveal: fade-in → pop */
538
+ reveal: createAnimationSequence([
539
+ { animation: "fade-in", duration: 300 },
540
+ { animation: "pop", duration: 200 }
541
+ ])
662
542
  };
663
- /**
664
- * Preset interactive configs
665
- */
666
543
  const PRESET_INTERACTIONS = {
667
- /** Bounce on hover */
668
- hoverBounce: createHoverAnimation('bounce'),
669
- /** Pulse on hover */
670
- hoverPulse: createHoverAnimation('pulse'),
671
- /** Spin on hover */
672
- hoverSpin: createHoverAnimation('spin'),
673
- /** Shake on hover */
674
- hoverShake: createHoverAnimation('shake'),
675
- /** Pop on click */
676
- clickPop: createClickAnimation('pop', { once: true }),
677
- /** Bounce on click */
678
- clickBounce: createClickAnimation('bounce'),
679
- /** Tada on click */
680
- clickTada: createClickAnimation('tada'),
681
- /** FadeIn on visible */
682
- visibleFadeIn: createVisibilityAnimation('fade-in', { once: true }),
683
- /** Bounce on visible */
684
- visibleBounce: createVisibilityAnimation('bounce', { once: true }),
685
- /** Scale in on visible */
686
- visibleScaleIn: createVisibilityAnimation('scale-in', { once: true }),
544
+ /** Bounce on hover */
545
+ hoverBounce: createHoverAnimation("bounce"),
546
+ /** Pulse on hover */
547
+ hoverPulse: createHoverAnimation("pulse"),
548
+ /** Spin on hover */
549
+ hoverSpin: createHoverAnimation("spin"),
550
+ /** Shake on hover */
551
+ hoverShake: createHoverAnimation("shake"),
552
+ /** Pop on click */
553
+ clickPop: createClickAnimation("pop", { once: true }),
554
+ /** Bounce on click */
555
+ clickBounce: createClickAnimation("bounce"),
556
+ /** Tada on click */
557
+ clickTada: createClickAnimation("tada"),
558
+ /** FadeIn on visible */
559
+ visibleFadeIn: createVisibilityAnimation("fade-in", { once: true }),
560
+ /** Bounce on visible */
561
+ visibleBounce: createVisibilityAnimation("bounce", { once: true }),
562
+ /** Scale in on visible */
563
+ visibleScaleIn: createVisibilityAnimation("scale-in", { once: true })
564
+ };
565
+ export {
566
+ AnimationController,
567
+ InteractiveIcon,
568
+ PRESET_INTERACTIONS,
569
+ PRESET_SEQUENCES,
570
+ createAnimationSequence,
571
+ createClickAnimation,
572
+ createHoverAnimation,
573
+ createVisibilityAnimation,
574
+ useAnimationSequence
687
575
  };
688
-
689
- export { AnimationController, InteractiveIcon, PRESET_INTERACTIONS, PRESET_SEQUENCES, createAnimationSequence, createClickAnimation, createHoverAnimation, createVisibilityAnimation, useAnimationSequence };