@enact-ui/animate 0.1.0 → 0.2.0
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/api-schema.json +206 -0
- package/dist/components/CountUp.d.ts +84 -0
- package/dist/components/CountUp.d.ts.map +1 -0
- package/dist/components/CountUp.js +68 -0
- package/dist/components/CountUp.js.map +1 -0
- package/dist/components/MotionDiv.d.ts +159 -0
- package/dist/components/MotionDiv.d.ts.map +1 -0
- package/dist/components/MotionDiv.js +162 -0
- package/dist/components/MotionDiv.js.map +1 -0
- package/dist/components/StaggerContainer.d.ts +136 -0
- package/dist/components/StaggerContainer.d.ts.map +1 -0
- package/dist/components/StaggerContainer.js +166 -0
- package/dist/components/StaggerContainer.js.map +1 -0
- package/dist/hooks/use-component-animation.d.ts +156 -0
- package/dist/hooks/use-component-animation.d.ts.map +1 -0
- package/dist/hooks/use-component-animation.js +231 -0
- package/dist/hooks/use-component-animation.js.map +1 -0
- package/dist/hooks/use-count-up.d.ts +111 -0
- package/dist/hooks/use-count-up.d.ts.map +1 -0
- package/dist/hooks/use-count-up.js +246 -0
- package/dist/hooks/use-count-up.js.map +1 -0
- package/dist/hooks/use-draw-path.d.ts +96 -0
- package/dist/hooks/use-draw-path.d.ts.map +1 -0
- package/dist/hooks/use-draw-path.js +227 -0
- package/dist/hooks/use-draw-path.js.map +1 -0
- package/dist/hooks/use-motion-preset.d.ts.map +1 -1
- package/dist/hooks/use-motion-preset.js +17 -16
- package/dist/hooks/use-motion-preset.js.map +1 -1
- package/dist/hooks/use-stagger.d.ts +174 -0
- package/dist/hooks/use-stagger.d.ts.map +1 -0
- package/dist/hooks/use-stagger.js +256 -0
- package/dist/hooks/use-stagger.js.map +1 -0
- package/dist/index.d.ts +17 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2442 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2335 -25
- package/dist/index.mjs.map +1 -1
- package/dist/presets/component-presets.d.ts +246 -0
- package/dist/presets/component-presets.d.ts.map +1 -0
- package/dist/presets/component-presets.js +472 -0
- package/dist/presets/component-presets.js.map +1 -0
- package/dist/presets/micro-interactions.d.ts +451 -0
- package/dist/presets/micro-interactions.d.ts.map +1 -0
- package/dist/presets/micro-interactions.js +856 -0
- package/dist/presets/micro-interactions.js.map +1 -0
- package/dist/presets/motion-presets.d.ts.map +1 -1
- package/dist/presets/motion-presets.js +0 -1
- package/dist/presets/motion-presets.js.map +1 -1
- package/dist/presets/motion-styles.d.ts +186 -0
- package/dist/presets/motion-styles.d.ts.map +1 -0
- package/dist/presets/motion-styles.js +204 -0
- package/dist/presets/motion-styles.js.map +1 -0
- package/dist/presets/stagger-presets.d.ts +378 -0
- package/dist/presets/stagger-presets.d.ts.map +1 -0
- package/dist/presets/stagger-presets.js +582 -0
- package/dist/presets/stagger-presets.js.map +1 -0
- package/dist/showcase/motion-presets.demo.d.ts +25 -0
- package/dist/showcase/motion-presets.demo.d.ts.map +1 -0
- package/dist/showcase/motion-presets.demo.js +96 -0
- package/dist/showcase/motion-presets.demo.js.map +1 -0
- package/dist/showcase/motion-presets.story.d.ts +37 -0
- package/dist/showcase/motion-presets.story.d.ts.map +1 -0
- package/dist/showcase/motion-presets.story.js +151 -0
- package/dist/showcase/motion-presets.story.js.map +1 -0
- package/dist/utils/easing.d.ts +294 -0
- package/dist/utils/easing.d.ts.map +1 -0
- package/dist/utils/easing.js +265 -0
- package/dist/utils/easing.js.map +1 -0
- package/dist/utils/reduced-motion.d.ts +322 -0
- package/dist/utils/reduced-motion.d.ts.map +1 -0
- package/dist/utils/reduced-motion.js +362 -0
- package/dist/utils/reduced-motion.js.map +1 -0
- package/dist/utils/select-preset.d.ts +186 -0
- package/dist/utils/select-preset.d.ts.map +1 -0
- package/dist/utils/select-preset.js +320 -0
- package/dist/utils/select-preset.js.map +1 -0
- package/dist/utils/spring-configs.d.ts +187 -0
- package/dist/utils/spring-configs.d.ts.map +1 -0
- package/dist/utils/spring-configs.js +169 -0
- package/dist/utils/spring-configs.js.map +1 -0
- package/package.json +4 -3
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Micro-Interaction Animation Presets
|
|
3
|
+
*
|
|
4
|
+
* Provides a collection of reusable micro-interaction animations for common UI patterns.
|
|
5
|
+
* Each preset adapts to the chosen MotionStyle, respecting user preferences including
|
|
6
|
+
* reduced motion settings.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
import type { MotionStyle } from "./motion-styles";
|
|
11
|
+
/**
|
|
12
|
+
* Props returned by micro-interaction preset functions.
|
|
13
|
+
* Compatible with Motion library's component props.
|
|
14
|
+
*/
|
|
15
|
+
export interface MicroInteractionProps {
|
|
16
|
+
/** Animation values applied on hover */
|
|
17
|
+
whileHover?: Record<string, unknown>;
|
|
18
|
+
/** Animation values applied while pressed/tapped */
|
|
19
|
+
whileTap?: Record<string, unknown>;
|
|
20
|
+
/** Animation values applied while focused */
|
|
21
|
+
whileFocus?: Record<string, unknown>;
|
|
22
|
+
/** Transition configuration for the animation */
|
|
23
|
+
transition?: Record<string, unknown>;
|
|
24
|
+
/** Initial animation state */
|
|
25
|
+
initial?: Record<string, unknown>;
|
|
26
|
+
/** Target animation state */
|
|
27
|
+
animate?: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Definition for a micro-interaction preset.
|
|
31
|
+
* Includes metadata for documentation and AI-assisted selection.
|
|
32
|
+
*/
|
|
33
|
+
export interface MicroInteractionPreset {
|
|
34
|
+
/** Unique identifier for the preset */
|
|
35
|
+
name: string;
|
|
36
|
+
/** Human-readable description of the animation effect */
|
|
37
|
+
description: string;
|
|
38
|
+
/** Suggested use cases for this animation */
|
|
39
|
+
useCase: string[];
|
|
40
|
+
/** Function that generates Motion props based on the motion style */
|
|
41
|
+
getProps: (style: MotionStyle) => MicroInteractionProps;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Button Press Micro-Interaction
|
|
45
|
+
*
|
|
46
|
+
* Creates a subtle press effect where the element scales down slightly when clicked
|
|
47
|
+
* and springs back to its original size on release. Provides tactile feedback for
|
|
48
|
+
* interactive elements.
|
|
49
|
+
*
|
|
50
|
+
* @ai-hint Use buttonPress for clickable elements like buttons, cards, or list items
|
|
51
|
+
* that need tactile feedback. Best for primary actions and interactive controls.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```tsx
|
|
55
|
+
* import { motion } from "motion/react";
|
|
56
|
+
* import { buttonPress } from "@enact-ui/animate";
|
|
57
|
+
*
|
|
58
|
+
* function Button({ children }) {
|
|
59
|
+
* const props = buttonPress.getProps("standard");
|
|
60
|
+
* return <motion.button {...props}>{children}</motion.button>;
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare const buttonPress: MicroInteractionPreset;
|
|
65
|
+
/**
|
|
66
|
+
* Card Hover Micro-Interaction
|
|
67
|
+
*
|
|
68
|
+
* Creates a subtle lift effect with shadow enhancement when hovering over card-like
|
|
69
|
+
* elements. Provides visual depth and indicates interactivity.
|
|
70
|
+
*
|
|
71
|
+
* @ai-hint Use cardHover for cards, tiles, or panels that are clickable or expandable.
|
|
72
|
+
* Creates a "lifting" effect that suggests the element can be interacted with.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* import { motion } from "motion/react";
|
|
77
|
+
* import { cardHover } from "@enact-ui/animate";
|
|
78
|
+
*
|
|
79
|
+
* function Card({ children }) {
|
|
80
|
+
* const props = cardHover.getProps("standard");
|
|
81
|
+
* return <motion.article {...props}>{children}</motion.article>;
|
|
82
|
+
* }
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export declare const cardHover: MicroInteractionPreset;
|
|
86
|
+
/**
|
|
87
|
+
* Icon Spin Micro-Interaction
|
|
88
|
+
*
|
|
89
|
+
* Performs a full 360-degree rotation, ideal for refresh icons, loading indicators,
|
|
90
|
+
* or interactive feedback on icon clicks.
|
|
91
|
+
*
|
|
92
|
+
* @ai-hint Use iconSpin for refresh buttons, sync icons, or loading states.
|
|
93
|
+
* Good for indicating an action is in progress or for playful icon interactions.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```tsx
|
|
97
|
+
* import { motion } from "motion/react";
|
|
98
|
+
* import { iconSpin } from "@enact-ui/animate";
|
|
99
|
+
*
|
|
100
|
+
* function RefreshButton() {
|
|
101
|
+
* const props = iconSpin.getProps("standard");
|
|
102
|
+
* return (
|
|
103
|
+
* <motion.button {...props}>
|
|
104
|
+
* <RefreshIcon />
|
|
105
|
+
* </motion.button>
|
|
106
|
+
* );
|
|
107
|
+
* }
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
export declare const iconSpin: MicroInteractionPreset;
|
|
111
|
+
/**
|
|
112
|
+
* Pulse Micro-Interaction
|
|
113
|
+
*
|
|
114
|
+
* Creates a breathing/pulsing scale animation. Can be used for attention-grabbing
|
|
115
|
+
* elements, loading states, or to indicate something is active/live.
|
|
116
|
+
*
|
|
117
|
+
* @ai-hint Use pulse for notifications, live indicators, or elements needing attention.
|
|
118
|
+
* The breathing effect draws the eye without being too distracting.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```tsx
|
|
122
|
+
* import { motion } from "motion/react";
|
|
123
|
+
* import { pulse } from "@enact-ui/animate";
|
|
124
|
+
*
|
|
125
|
+
* function LiveIndicator() {
|
|
126
|
+
* const props = pulse.getProps("standard");
|
|
127
|
+
* return <motion.span {...props} className="live-dot" />;
|
|
128
|
+
* }
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
export declare const pulse: MicroInteractionPreset;
|
|
132
|
+
/**
|
|
133
|
+
* Shake Micro-Interaction
|
|
134
|
+
*
|
|
135
|
+
* Horizontal shake animation commonly used for error states, invalid input,
|
|
136
|
+
* or to indicate that an action cannot be completed.
|
|
137
|
+
*
|
|
138
|
+
* @ai-hint Use shake for error states, invalid form inputs, or denied actions.
|
|
139
|
+
* The horizontal movement mimics the "no" head shake gesture.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```tsx
|
|
143
|
+
* import { motion } from "motion/react";
|
|
144
|
+
* import { shake } from "@enact-ui/animate";
|
|
145
|
+
*
|
|
146
|
+
* function FormInput({ error }) {
|
|
147
|
+
* const props = error ? shake.getProps("standard") : {};
|
|
148
|
+
* return <motion.input {...props} />;
|
|
149
|
+
* }
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
export declare const shake: MicroInteractionPreset;
|
|
153
|
+
/**
|
|
154
|
+
* Wiggle Micro-Interaction
|
|
155
|
+
*
|
|
156
|
+
* Playful rotation wiggle animation. Great for drawing attention to elements
|
|
157
|
+
* in a fun, non-intrusive way. Often used in gamified interfaces or
|
|
158
|
+
* celebratory moments.
|
|
159
|
+
*
|
|
160
|
+
* @ai-hint Use wiggle for playful interfaces, gamification, or to draw attention
|
|
161
|
+
* to elements in a fun way. Works well for icons, badges, or decorative elements.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```tsx
|
|
165
|
+
* import { motion } from "motion/react";
|
|
166
|
+
* import { wiggle } from "@enact-ui/animate";
|
|
167
|
+
*
|
|
168
|
+
* function AchievementBadge() {
|
|
169
|
+
* const props = wiggle.getProps("playful");
|
|
170
|
+
* return <motion.div {...props}><BadgeIcon /></motion.div>;
|
|
171
|
+
* }
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
export declare const wiggle: MicroInteractionPreset;
|
|
175
|
+
/**
|
|
176
|
+
* Heartbeat Micro-Interaction
|
|
177
|
+
*
|
|
178
|
+
* Double-pulse heartbeat pattern that creates a realistic heartbeat effect.
|
|
179
|
+
* Perfect for health apps, like buttons, or emphasizing something "alive".
|
|
180
|
+
*
|
|
181
|
+
* @ai-hint Use heartbeat for health/fitness apps, like/love buttons, or to indicate
|
|
182
|
+
* something is active/alive. The double-pulse mimics a real heartbeat rhythm.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```tsx
|
|
186
|
+
* import { motion } from "motion/react";
|
|
187
|
+
* import { heartbeat } from "@enact-ui/animate";
|
|
188
|
+
*
|
|
189
|
+
* function LikeButton({ isLiked }) {
|
|
190
|
+
* const props = isLiked ? heartbeat.getProps("playful") : {};
|
|
191
|
+
* return <motion.button {...props}><HeartIcon /></motion.button>;
|
|
192
|
+
* }
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
export declare const heartbeat: MicroInteractionPreset;
|
|
196
|
+
/**
|
|
197
|
+
* Rubber Band Micro-Interaction
|
|
198
|
+
*
|
|
199
|
+
* Elastic stretch and snap back animation inspired by the classic rubber band effect.
|
|
200
|
+
* Creates a bouncy, playful feel that's perfect for attention-grabbing elements.
|
|
201
|
+
*
|
|
202
|
+
* @ai-hint Use rubberBand for emphasis animations, attention grabbers, or playful
|
|
203
|
+
* interfaces. The elastic effect creates a memorable, tactile impression.
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```tsx
|
|
207
|
+
* import { motion } from "motion/react";
|
|
208
|
+
* import { rubberBand } from "@enact-ui/animate";
|
|
209
|
+
*
|
|
210
|
+
* function BouncyButton({ children }) {
|
|
211
|
+
* const props = rubberBand.getProps("playful");
|
|
212
|
+
* return <motion.button {...props}>{children}</motion.button>;
|
|
213
|
+
* }
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
export declare const rubberBand: MicroInteractionPreset;
|
|
217
|
+
/**
|
|
218
|
+
* Scale Micro-Interaction
|
|
219
|
+
*
|
|
220
|
+
* Creates a scale animation effect for selection feedback. The element scales up
|
|
221
|
+
* briefly when activated, providing satisfying tactile feedback for toggles,
|
|
222
|
+
* checkboxes, and selection states.
|
|
223
|
+
*
|
|
224
|
+
* @ai-hint Use scale for checkboxes, toggles, radio buttons, or any selection
|
|
225
|
+
* feedback. The scale effect provides clear visual confirmation of state change.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```tsx
|
|
229
|
+
* import { motion } from "motion/react";
|
|
230
|
+
* import { scale } from "@enact-ui/animate";
|
|
231
|
+
*
|
|
232
|
+
* function Checkbox({ isSelected }) {
|
|
233
|
+
* const props = isSelected ? scale.getProps("standard") : {};
|
|
234
|
+
* return <motion.div {...props}>{isSelected && <Check />}</motion.div>;
|
|
235
|
+
* }
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
export declare const scale: MicroInteractionPreset;
|
|
239
|
+
/**
|
|
240
|
+
* Shimmer Micro-Interaction
|
|
241
|
+
*
|
|
242
|
+
* Creates a gradient shimmer effect that slides across the element.
|
|
243
|
+
* Perfect for loading skeletons, progress indicators, or placeholder content.
|
|
244
|
+
*
|
|
245
|
+
* @ai-hint Use shimmer for skeleton loading states, progress bars, or placeholder
|
|
246
|
+
* content. Creates a polished "loading" appearance that indicates content is coming.
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* ```tsx
|
|
250
|
+
* import { motion } from "motion/react";
|
|
251
|
+
* import { shimmer } from "@enact-ui/animate";
|
|
252
|
+
*
|
|
253
|
+
* function SkeletonCard() {
|
|
254
|
+
* const props = shimmer.getProps("standard");
|
|
255
|
+
* return (
|
|
256
|
+
* <motion.div
|
|
257
|
+
* {...props}
|
|
258
|
+
* className="h-20 bg-gray-200 rounded overflow-hidden relative"
|
|
259
|
+
* style={{
|
|
260
|
+
* background: "linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%)",
|
|
261
|
+
* backgroundSize: "200% 100%",
|
|
262
|
+
* }}
|
|
263
|
+
* />
|
|
264
|
+
* );
|
|
265
|
+
* }
|
|
266
|
+
* ```
|
|
267
|
+
*/
|
|
268
|
+
export declare const shimmer: MicroInteractionPreset;
|
|
269
|
+
/**
|
|
270
|
+
* Glow Pulse Micro-Interaction
|
|
271
|
+
*
|
|
272
|
+
* Creates a glowing pulse effect using box-shadow. Perfect for AI-generated
|
|
273
|
+
* content indicators, special items, or elements that need extra emphasis.
|
|
274
|
+
*
|
|
275
|
+
* @ai-hint Use glowPulse for AI content indicators, featured items, or elements
|
|
276
|
+
* needing premium emphasis. The glow effect creates a "magical" or "special" feel.
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* ```tsx
|
|
280
|
+
* import { motion } from "motion/react";
|
|
281
|
+
* import { glowPulse } from "@enact-ui/animate";
|
|
282
|
+
*
|
|
283
|
+
* function AIGeneratedBadge() {
|
|
284
|
+
* const props = glowPulse.getProps("standard");
|
|
285
|
+
* return <motion.span {...props} className="ai-badge">AI</motion.span>;
|
|
286
|
+
* }
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
export declare const glowPulse: MicroInteractionPreset;
|
|
290
|
+
/**
|
|
291
|
+
* Progress Fill Micro-Interaction
|
|
292
|
+
*
|
|
293
|
+
* Animates width from 0% to the target value. Perfect for progress bars,
|
|
294
|
+
* completion indicators, and skill bars.
|
|
295
|
+
*
|
|
296
|
+
* Note: This preset returns a function that takes the target percentage
|
|
297
|
+
* and returns animation props. Use with scaleX transform for best performance.
|
|
298
|
+
*
|
|
299
|
+
* @ai-hint Use progressFill for progress bars, skill meters, or completion
|
|
300
|
+
* indicators. Animates smoothly from 0 to the target percentage.
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* ```tsx
|
|
304
|
+
* import { motion } from "motion/react";
|
|
305
|
+
* import { progressFill } from "@enact-ui/animate";
|
|
306
|
+
*
|
|
307
|
+
* function ProgressBar({ value }: { value: number }) {
|
|
308
|
+
* const props = progressFill.getProps("standard");
|
|
309
|
+
* return (
|
|
310
|
+
* <div className="h-2 bg-gray-200 rounded overflow-hidden">
|
|
311
|
+
* <motion.div
|
|
312
|
+
* {...props}
|
|
313
|
+
* className="h-full bg-blue-500 origin-left"
|
|
314
|
+
* style={{ width: `${value}%` }}
|
|
315
|
+
* />
|
|
316
|
+
* </div>
|
|
317
|
+
* );
|
|
318
|
+
* }
|
|
319
|
+
* ```
|
|
320
|
+
*/
|
|
321
|
+
export declare const progressFill: MicroInteractionPreset;
|
|
322
|
+
/**
|
|
323
|
+
* All available micro-interaction presets indexed by name.
|
|
324
|
+
*
|
|
325
|
+
* @ai-hint Use this collection to iterate over all presets or to access
|
|
326
|
+
* presets by name dynamically. Each preset adapts to the motion style.
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* ```tsx
|
|
330
|
+
* import { microInteractions } from "@enact-ui/animate";
|
|
331
|
+
*
|
|
332
|
+
* // Get a specific preset by name
|
|
333
|
+
* const pressProps = microInteractions.buttonPress.getProps("standard");
|
|
334
|
+
*
|
|
335
|
+
* // List all available presets
|
|
336
|
+
* Object.keys(microInteractions).forEach(name => {
|
|
337
|
+
* console.log(microInteractions[name].description);
|
|
338
|
+
* });
|
|
339
|
+
* ```
|
|
340
|
+
*/
|
|
341
|
+
/**
|
|
342
|
+
* Checkmark Draw Micro-Interaction
|
|
343
|
+
*
|
|
344
|
+
* Animated checkmark draw effect, commonly used for success states,
|
|
345
|
+
* completed tasks, or confirmation feedback.
|
|
346
|
+
*
|
|
347
|
+
* @ai-hint Use checkmarkDraw for success confirmations, completed checkboxes,
|
|
348
|
+
* or any "done" state indication. The drawing animation provides satisfying feedback.
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```tsx
|
|
352
|
+
* import { motion } from "motion/react";
|
|
353
|
+
* import { checkmarkDraw } from "@enact-ui/animate";
|
|
354
|
+
*
|
|
355
|
+
* function SuccessIcon() {
|
|
356
|
+
* const props = checkmarkDraw.getProps("standard");
|
|
357
|
+
* return <motion.svg {...props}><path d="M5 13l4 4L19 7" /></motion.svg>;
|
|
358
|
+
* }
|
|
359
|
+
* ```
|
|
360
|
+
*/
|
|
361
|
+
export declare const checkmarkDraw: MicroInteractionPreset;
|
|
362
|
+
/**
|
|
363
|
+
* Success Flash Micro-Interaction
|
|
364
|
+
*
|
|
365
|
+
* Brief highlight flash animation for success feedback. Creates a quick
|
|
366
|
+
* visual confirmation without being distracting.
|
|
367
|
+
*
|
|
368
|
+
* @ai-hint Use successFlash for brief success highlights, toast notifications,
|
|
369
|
+
* or inline success messages. The flash draws attention without lingering.
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* ```tsx
|
|
373
|
+
* import { motion } from "motion/react";
|
|
374
|
+
* import { successFlash } from "@enact-ui/animate";
|
|
375
|
+
*
|
|
376
|
+
* function SuccessMessage() {
|
|
377
|
+
* const props = successFlash.getProps("standard");
|
|
378
|
+
* return <motion.div {...props}>Saved!</motion.div>;
|
|
379
|
+
* }
|
|
380
|
+
* ```
|
|
381
|
+
*/
|
|
382
|
+
export declare const successFlash: MicroInteractionPreset;
|
|
383
|
+
/**
|
|
384
|
+
* Badge Pop Micro-Interaction
|
|
385
|
+
*
|
|
386
|
+
* Pop animation for badge count changes. Provides satisfying feedback
|
|
387
|
+
* when numbers update, drawing attention to the change.
|
|
388
|
+
*
|
|
389
|
+
* @ai-hint Use badgePop for notification badges, count indicators, or any
|
|
390
|
+
* numeric value that changes. The pop effect highlights the update.
|
|
391
|
+
*
|
|
392
|
+
* @example
|
|
393
|
+
* ```tsx
|
|
394
|
+
* import { motion } from "motion/react";
|
|
395
|
+
* import { badgePop } from "@enact-ui/animate";
|
|
396
|
+
*
|
|
397
|
+
* function NotificationBadge({ count }) {
|
|
398
|
+
* const props = badgePop.getProps("standard");
|
|
399
|
+
* return <motion.span {...props} key={count}>{count}</motion.span>;
|
|
400
|
+
* }
|
|
401
|
+
* ```
|
|
402
|
+
*/
|
|
403
|
+
export declare const badgePop: MicroInteractionPreset;
|
|
404
|
+
export declare const microInteractions: Record<string, MicroInteractionPreset>;
|
|
405
|
+
/**
|
|
406
|
+
* Gets a micro-interaction preset by name.
|
|
407
|
+
*
|
|
408
|
+
* @param name - The name of the preset to retrieve
|
|
409
|
+
* @returns The micro-interaction preset, or undefined if not found
|
|
410
|
+
*
|
|
411
|
+
* @example
|
|
412
|
+
* ```ts
|
|
413
|
+
* const preset = getMicroInteraction("buttonPress");
|
|
414
|
+
* if (preset) {
|
|
415
|
+
* const props = preset.getProps("standard");
|
|
416
|
+
* }
|
|
417
|
+
* ```
|
|
418
|
+
*/
|
|
419
|
+
export declare function getMicroInteraction(name: string): MicroInteractionPreset | undefined;
|
|
420
|
+
/**
|
|
421
|
+
* Gets all micro-interaction preset names.
|
|
422
|
+
*
|
|
423
|
+
* @returns Array of all preset names
|
|
424
|
+
*
|
|
425
|
+
* @example
|
|
426
|
+
* ```ts
|
|
427
|
+
* const names = getMicroInteractionNames();
|
|
428
|
+
* // ["buttonPress", "cardHover", "iconSpin", ...]
|
|
429
|
+
* ```
|
|
430
|
+
*/
|
|
431
|
+
export declare function getMicroInteractionNames(): string[];
|
|
432
|
+
/**
|
|
433
|
+
* Finds micro-interaction presets suitable for a given use case.
|
|
434
|
+
*
|
|
435
|
+
* @param useCase - The use case to search for (case-insensitive)
|
|
436
|
+
* @returns Array of presets that match the use case
|
|
437
|
+
*
|
|
438
|
+
* @ai-hint Use this function to find appropriate presets based on your component's
|
|
439
|
+
* purpose. It searches the useCase arrays of all presets for matches.
|
|
440
|
+
*
|
|
441
|
+
* @example
|
|
442
|
+
* ```ts
|
|
443
|
+
* const errorPresets = findPresetsForUseCase("error");
|
|
444
|
+
* // Returns [shake] preset since it includes "error states" in its use cases
|
|
445
|
+
*
|
|
446
|
+
* const buttonPresets = findPresetsForUseCase("button");
|
|
447
|
+
* // Returns [buttonPress, rubberBand] presets
|
|
448
|
+
* ```
|
|
449
|
+
*/
|
|
450
|
+
export declare function findPresetsForUseCase(useCase: string): MicroInteractionPreset[];
|
|
451
|
+
//# sourceMappingURL=micro-interactions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"micro-interactions.d.ts","sourceRoot":"","sources":["../../src/presets/micro-interactions.ts"],"names":[],"mappings":"AAEA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