@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.
Files changed (82) hide show
  1. package/api-schema.json +206 -0
  2. package/dist/components/CountUp.d.ts +84 -0
  3. package/dist/components/CountUp.d.ts.map +1 -0
  4. package/dist/components/CountUp.js +68 -0
  5. package/dist/components/CountUp.js.map +1 -0
  6. package/dist/components/MotionDiv.d.ts +159 -0
  7. package/dist/components/MotionDiv.d.ts.map +1 -0
  8. package/dist/components/MotionDiv.js +162 -0
  9. package/dist/components/MotionDiv.js.map +1 -0
  10. package/dist/components/StaggerContainer.d.ts +136 -0
  11. package/dist/components/StaggerContainer.d.ts.map +1 -0
  12. package/dist/components/StaggerContainer.js +166 -0
  13. package/dist/components/StaggerContainer.js.map +1 -0
  14. package/dist/hooks/use-component-animation.d.ts +156 -0
  15. package/dist/hooks/use-component-animation.d.ts.map +1 -0
  16. package/dist/hooks/use-component-animation.js +231 -0
  17. package/dist/hooks/use-component-animation.js.map +1 -0
  18. package/dist/hooks/use-count-up.d.ts +111 -0
  19. package/dist/hooks/use-count-up.d.ts.map +1 -0
  20. package/dist/hooks/use-count-up.js +246 -0
  21. package/dist/hooks/use-count-up.js.map +1 -0
  22. package/dist/hooks/use-draw-path.d.ts +96 -0
  23. package/dist/hooks/use-draw-path.d.ts.map +1 -0
  24. package/dist/hooks/use-draw-path.js +227 -0
  25. package/dist/hooks/use-draw-path.js.map +1 -0
  26. package/dist/hooks/use-motion-preset.d.ts.map +1 -1
  27. package/dist/hooks/use-motion-preset.js +17 -16
  28. package/dist/hooks/use-motion-preset.js.map +1 -1
  29. package/dist/hooks/use-stagger.d.ts +174 -0
  30. package/dist/hooks/use-stagger.d.ts.map +1 -0
  31. package/dist/hooks/use-stagger.js +256 -0
  32. package/dist/hooks/use-stagger.js.map +1 -0
  33. package/dist/index.d.ts +17 -1
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +2442 -26
  36. package/dist/index.js.map +1 -1
  37. package/dist/index.mjs +2335 -25
  38. package/dist/index.mjs.map +1 -1
  39. package/dist/presets/component-presets.d.ts +246 -0
  40. package/dist/presets/component-presets.d.ts.map +1 -0
  41. package/dist/presets/component-presets.js +472 -0
  42. package/dist/presets/component-presets.js.map +1 -0
  43. package/dist/presets/micro-interactions.d.ts +451 -0
  44. package/dist/presets/micro-interactions.d.ts.map +1 -0
  45. package/dist/presets/micro-interactions.js +856 -0
  46. package/dist/presets/micro-interactions.js.map +1 -0
  47. package/dist/presets/motion-presets.d.ts.map +1 -1
  48. package/dist/presets/motion-presets.js +0 -1
  49. package/dist/presets/motion-presets.js.map +1 -1
  50. package/dist/presets/motion-styles.d.ts +186 -0
  51. package/dist/presets/motion-styles.d.ts.map +1 -0
  52. package/dist/presets/motion-styles.js +204 -0
  53. package/dist/presets/motion-styles.js.map +1 -0
  54. package/dist/presets/stagger-presets.d.ts +378 -0
  55. package/dist/presets/stagger-presets.d.ts.map +1 -0
  56. package/dist/presets/stagger-presets.js +582 -0
  57. package/dist/presets/stagger-presets.js.map +1 -0
  58. package/dist/showcase/motion-presets.demo.d.ts +25 -0
  59. package/dist/showcase/motion-presets.demo.d.ts.map +1 -0
  60. package/dist/showcase/motion-presets.demo.js +96 -0
  61. package/dist/showcase/motion-presets.demo.js.map +1 -0
  62. package/dist/showcase/motion-presets.story.d.ts +37 -0
  63. package/dist/showcase/motion-presets.story.d.ts.map +1 -0
  64. package/dist/showcase/motion-presets.story.js +151 -0
  65. package/dist/showcase/motion-presets.story.js.map +1 -0
  66. package/dist/utils/easing.d.ts +294 -0
  67. package/dist/utils/easing.d.ts.map +1 -0
  68. package/dist/utils/easing.js +265 -0
  69. package/dist/utils/easing.js.map +1 -0
  70. package/dist/utils/reduced-motion.d.ts +322 -0
  71. package/dist/utils/reduced-motion.d.ts.map +1 -0
  72. package/dist/utils/reduced-motion.js +362 -0
  73. package/dist/utils/reduced-motion.js.map +1 -0
  74. package/dist/utils/select-preset.d.ts +186 -0
  75. package/dist/utils/select-preset.d.ts.map +1 -0
  76. package/dist/utils/select-preset.js +320 -0
  77. package/dist/utils/select-preset.js.map +1 -0
  78. package/dist/utils/spring-configs.d.ts +187 -0
  79. package/dist/utils/spring-configs.d.ts.map +1 -0
  80. package/dist/utils/spring-configs.js +169 -0
  81. package/dist/utils/spring-configs.js.map +1 -0
  82. package/package.json +4 -3
@@ -0,0 +1,96 @@
1
+ // Copyright (c) 2026 Amsterdam Data Labs
2
+ "use client";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { AnimatePresence, motion } from "motion/react";
5
+ import { useState } from "react";
6
+ import { buttonPress, cardHover, fadeIn, pulse, scale, shake, slideDown, slideUp, useComponentAnimation, useStagger, } from "../index";
7
+ // =============================================================================
8
+ // Motion Style Showcase
9
+ // =============================================================================
10
+ /**
11
+ * Demonstrates all four motion styles with the same animation.
12
+ */
13
+ export const MotionStylesShowcase = () => {
14
+ const styles = ["subtle", "standard", "bold", "playful"];
15
+ const [key, setKey] = useState(0);
16
+ return (_jsxs("div", { className: "flex flex-col gap-8", children: [_jsx("div", { className: "flex gap-4", children: _jsx("button", { type: "button", onClick: () => setKey((k) => k + 1), className: "rounded-md bg-surface-brand px-4 py-2 text-sm text-content-on-brand hover:bg-surface-brand-emphasis", children: "Replay Animations" }) }), _jsx("div", { className: "grid grid-cols-4 gap-6", children: styles.map((style) => (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("h4", { className: "text-sm font-medium capitalize text-content-secondary", children: style }), _jsx(AnimatedCard, { preset: slideUp, style: style, animationKey: key })] }, `${style}-${key}`))) })] }));
17
+ };
18
+ const AnimatedCard = ({ preset, style, animationKey }) => {
19
+ const { prefersReducedMotion: _prm, isEnabled: _ie, ...animationProps } = useComponentAnimation(preset, style);
20
+ return (_jsxs(motion.div, { className: "rounded-lg border border-border-default bg-surface-raised p-4 shadow-sm", initial: animationProps.initial, animate: animationProps.animate, exit: animationProps.exit, transition: animationProps.transition, children: [_jsx("div", { className: "h-8 w-full rounded bg-surface-sunken" }), _jsx("div", { className: "mt-3 h-4 w-3/4 rounded bg-surface-sunken" }), _jsx("div", { className: "mt-2 h-4 w-1/2 rounded bg-surface-sunken" })] }, animationKey));
21
+ };
22
+ /**
23
+ * Demonstrates all component animation presets.
24
+ */
25
+ export const ComponentPresetsShowcase = () => {
26
+ const [selectedPreset, setSelectedPreset] = useState("fadeIn");
27
+ const [style, setStyle] = useState("standard");
28
+ const [key, setKey] = useState(0);
29
+ const presets = {
30
+ fadeIn,
31
+ slideUp,
32
+ slideDown,
33
+ scale,
34
+ };
35
+ const selectedPresetObj = presets[selectedPreset] ?? fadeIn;
36
+ const { prefersReducedMotion: _prm, isEnabled: _ie, ...animationProps } = useComponentAnimation(selectedPresetObj, style);
37
+ return (_jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex flex-wrap gap-4", children: [_jsxs("label", { className: "flex items-center gap-2 text-sm text-content-secondary", children: ["Preset:", _jsx("select", { value: selectedPreset, onChange: (e) => setSelectedPreset(e.target.value), className: "rounded-md border border-border-default bg-surface-base px-3 py-1 text-sm", children: Object.keys(presets).map((name) => (_jsx("option", { value: name, children: name }, name))) })] }), _jsxs("label", { className: "flex items-center gap-2 text-sm text-content-secondary", children: ["Style:", _jsxs("select", { value: style, onChange: (e) => setStyle(e.target.value), className: "rounded-md border border-border-default bg-surface-base px-3 py-1 text-sm", children: [_jsx("option", { value: "subtle", children: "Subtle" }), _jsx("option", { value: "standard", children: "Standard" }), _jsx("option", { value: "bold", children: "Bold" }), _jsx("option", { value: "playful", children: "Playful" })] })] }), _jsx("button", { type: "button", onClick: () => setKey((k) => k + 1), className: "rounded-md bg-surface-brand px-4 py-2 text-sm text-content-on-brand hover:bg-surface-brand-emphasis", children: "Replay" })] }), _jsx(AnimatePresence, { mode: "wait", children: _jsxs(motion.div, { className: "w-full max-w-sm rounded-lg border border-border-default bg-surface-raised p-6 shadow-sm", initial: animationProps.initial, animate: animationProps.animate, exit: animationProps.exit, transition: animationProps.transition, children: [_jsx("h3", { className: "text-lg font-semibold text-content-primary", children: selectedPreset }), _jsxs("p", { className: "mt-2 text-sm text-content-secondary", children: ["Motion style: ", style] }), _jsxs("p", { className: "mt-4 text-content-tertiary", children: ["This card demonstrates the ", selectedPreset, " animation preset with ", style, " motion style."] })] }, `${selectedPreset}-${style}-${key}`) })] }));
38
+ };
39
+ // =============================================================================
40
+ // Stagger Animation Showcase
41
+ // =============================================================================
42
+ /**
43
+ * Demonstrates staggered list animations.
44
+ */
45
+ export const StaggerShowcase = () => {
46
+ const [style, setStyle] = useState("standard");
47
+ const [key, setKey] = useState(0);
48
+ const items = Array.from({ length: 6 }, (_, i) => ({
49
+ id: i + 1,
50
+ title: `Item ${i + 1}`,
51
+ description: `Description for item ${i + 1}`,
52
+ }));
53
+ const { containerProps, getItemProps } = useStagger(style, {
54
+ direction: "forward",
55
+ totalItems: items.length,
56
+ });
57
+ return (_jsxs("div", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex flex-wrap gap-4", children: [_jsxs("label", { className: "flex items-center gap-2 text-sm text-content-secondary", children: ["Style:", _jsxs("select", { value: style, onChange: (e) => setStyle(e.target.value), className: "rounded-md border border-border-default bg-surface-base px-3 py-1 text-sm", children: [_jsx("option", { value: "subtle", children: "Subtle" }), _jsx("option", { value: "standard", children: "Standard" }), _jsx("option", { value: "bold", children: "Bold" }), _jsx("option", { value: "playful", children: "Playful" })] })] }), _jsx("button", { type: "button", onClick: () => setKey((k) => k + 1), className: "rounded-md bg-surface-brand px-4 py-2 text-sm text-content-on-brand hover:bg-surface-brand-emphasis", children: "Replay" })] }), _jsx(motion.ul, { className: "flex flex-col gap-3", initial: containerProps.initial, animate: containerProps.animate, exit: containerProps.exit ?? "hidden", variants: containerProps.variants, children: items.map((item, index) => {
58
+ const itemProps = getItemProps(index);
59
+ return (_jsxs(motion.li, { className: "rounded-lg border border-border-default bg-surface-raised p-4", variants: itemProps.variants, custom: itemProps.custom, children: [_jsx("h4", { className: "font-medium text-content-primary", children: item.title }), _jsx("p", { className: "text-sm text-content-secondary", children: item.description })] }, item.id));
60
+ }) }, key)] }));
61
+ };
62
+ // =============================================================================
63
+ // Micro-Interactions Showcase
64
+ // =============================================================================
65
+ /**
66
+ * Demonstrates micro-interaction presets.
67
+ */
68
+ export const MicroInteractionsShowcase = () => {
69
+ const [style, setStyle] = useState("standard");
70
+ const [shakeKey, setShakeKey] = useState(0);
71
+ const buttonPressProps = buttonPress.getProps(style);
72
+ const cardHoverProps = cardHover.getProps(style);
73
+ const pulseProps = pulse.getProps(style);
74
+ const shakeProps = shake.getProps(style);
75
+ return (_jsxs("div", { className: "flex flex-col gap-8", children: [_jsxs("label", { className: "flex items-center gap-2 text-sm text-content-secondary", children: ["Style:", _jsxs("select", { value: style, onChange: (e) => setStyle(e.target.value), className: "rounded-md border border-border-default bg-surface-base px-3 py-1 text-sm", children: [_jsx("option", { value: "subtle", children: "Subtle" }), _jsx("option", { value: "standard", children: "Standard" }), _jsx("option", { value: "bold", children: "Bold" }), _jsx("option", { value: "playful", children: "Playful" })] })] }), _jsxs("div", { className: "grid grid-cols-2 gap-8 md:grid-cols-4", children: [_jsxs("div", { className: "flex flex-col items-center gap-2", children: [_jsx("h4", { className: "text-sm font-medium text-content-secondary", children: "Button Press" }), _jsx(motion.button, { type: "button", className: "rounded-lg bg-surface-brand px-6 py-3 font-medium text-content-on-brand", whileTap: buttonPressProps.whileTap, transition: buttonPressProps.transition, children: "Click Me" })] }), _jsxs("div", { className: "flex flex-col items-center gap-2", children: [_jsx("h4", { className: "text-sm font-medium text-content-secondary", children: "Card Hover" }), _jsx(motion.div, { className: "rounded-lg border border-border-default bg-surface-raised p-4 cursor-pointer", whileHover: cardHoverProps.whileHover, transition: cardHoverProps.transition, children: _jsx("p", { className: "text-sm text-content-primary", children: "Hover me" }) })] }), _jsxs("div", { className: "flex flex-col items-center gap-2", children: [_jsx("h4", { className: "text-sm font-medium text-content-secondary", children: "Pulse" }), _jsx(motion.div, { className: "h-12 w-12 rounded-full bg-surface-success", animate: pulseProps.animate, transition: pulseProps.transition })] }), _jsxs("div", { className: "flex flex-col items-center gap-2", children: [_jsx("h4", { className: "text-sm font-medium text-content-secondary", children: "Shake" }), _jsx(motion.button, { type: "button", onClick: () => setShakeKey((k) => k + 1), className: "rounded-lg border border-border-error bg-surface-error px-4 py-2 text-sm text-content-error", animate: shakeProps.animate, transition: shakeProps.transition, children: "Trigger Error" }, shakeKey)] })] })] }));
76
+ };
77
+ // =============================================================================
78
+ // Reduced Motion Demo
79
+ // =============================================================================
80
+ /**
81
+ * Demonstrates how animations respect reduced motion preferences.
82
+ */
83
+ export const ReducedMotionDemo = () => {
84
+ const { prefersReducedMotion, isEnabled: _ie, ...animationProps } = useComponentAnimation(slideUp, "standard");
85
+ return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "rounded-lg border border-border-muted bg-surface-sunken p-4", children: [_jsxs("p", { className: "text-sm text-content-secondary", children: [_jsx("strong", { children: "Reduced Motion:" }), " ", prefersReducedMotion ? "Enabled" : "Disabled"] }), _jsx("p", { className: "mt-2 text-sm text-content-tertiary", children: "To test, enable \"Reduce motion\" in your system accessibility settings." })] }), _jsxs(motion.div, { className: "rounded-lg border border-border-default bg-surface-raised p-6", initial: animationProps.initial, animate: animationProps.animate, exit: animationProps.exit, transition: animationProps.transition, children: [_jsx("h3", { className: "text-lg font-semibold text-content-primary", children: "Accessible Animation" }), _jsx("p", { className: "mt-2 text-content-secondary", children: "This animation will use a simple fade when reduced motion is enabled, or the full slide-up effect when it's disabled." })] })] }));
86
+ };
87
+ // =============================================================================
88
+ // Combined Showcase
89
+ // =============================================================================
90
+ /**
91
+ * A comprehensive showcase of all motion preset features.
92
+ */
93
+ export const MotionPresetsPlayground = () => {
94
+ return (_jsxs("div", { className: "flex flex-col gap-12 p-8", children: [_jsxs("section", { children: [_jsx("h2", { className: "mb-4 text-xl font-bold text-content-primary", children: "Motion Styles" }), _jsx(MotionStylesShowcase, {})] }), _jsxs("section", { children: [_jsx("h2", { className: "mb-4 text-xl font-bold text-content-primary", children: "Component Presets" }), _jsx(ComponentPresetsShowcase, {})] }), _jsxs("section", { children: [_jsx("h2", { className: "mb-4 text-xl font-bold text-content-primary", children: "Stagger Animations" }), _jsx(StaggerShowcase, {})] }), _jsxs("section", { children: [_jsx("h2", { className: "mb-4 text-xl font-bold text-content-primary", children: "Micro-Interactions" }), _jsx(MicroInteractionsShowcase, {})] }), _jsxs("section", { children: [_jsx("h2", { className: "mb-4 text-xl font-bold text-content-primary", children: "Reduced Motion Support" }), _jsx(ReducedMotionDemo, {})] })] }));
95
+ };
96
+ //# sourceMappingURL=motion-presets.demo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"motion-presets.demo.js","sourceRoot":"","sources":["../../src/showcase/motion-presets.demo.tsx"],"names":[],"mappings":"AAAA,yCAAyC;AAEzC,YAAY,CAAC;;AAEb,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EACH,WAAW,EAEX,SAAS,EACT,MAAM,EAEN,KAAK,EACL,KAAK,EACL,KAAK,EACL,SAAS,EACT,OAAO,EACP,qBAAqB,EACrB,UAAU,GACb,MAAM,UAAU,CAAC;AAElB,gFAAgF;AAChF,wBAAwB;AACxB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACrC,MAAM,MAAM,GAAkB,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACxE,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAElC,OAAO,CACH,eAAK,SAAS,EAAC,qBAAqB,aAChC,cAAK,SAAS,EAAC,YAAY,YACvB,iBACI,IAA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AyB,KAAG,IACvB,EAEV,8BACI,aAAI,SAAS,EAAC,6CAA6C,uCAA4B,EACvF,KAAC,iBAAiB,KAAG,IACf,IACR,CACT,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { Meta, StoryObj } from "@storybook/nextjs-vite";
2
+ declare const meta: Meta;
3
+ export default meta;
4
+ type Story = StoryObj;
5
+ /**
6
+ * Complete playground showcasing all motion preset features.
7
+ * Includes motion styles, component presets, stagger animations,
8
+ * micro-interactions, and reduced motion support.
9
+ */
10
+ export declare const Playground: Story;
11
+ /**
12
+ * Demonstrates the four motion styles: subtle, standard, bold, and playful.
13
+ * Each style provides different timing, spring physics, and easing curves
14
+ * to match different UI contexts.
15
+ */
16
+ export declare const MotionStyles: Story;
17
+ /**
18
+ * Showcases component animation presets like fadeIn, slideUp, scale, etc.
19
+ * These presets provide ready-to-use entrance, exit, and transition animations.
20
+ */
21
+ export declare const ComponentPresets: Story;
22
+ /**
23
+ * Demonstrates staggered list animations with different patterns.
24
+ * Useful for animating lists, grids, and collections of items.
25
+ */
26
+ export declare const StaggerAnimations: Story;
27
+ /**
28
+ * Showcases micro-interaction presets for buttons, cards, and other
29
+ * interactive elements.
30
+ */
31
+ export declare const MicroInteractions: Story;
32
+ /**
33
+ * Demonstrates how animations respect the user's reduced motion preference.
34
+ * When enabled, animations are simplified or disabled for accessibility.
35
+ */
36
+ export declare const ReducedMotion: Story;
37
+ //# sourceMappingURL=motion-presets.story.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"motion-presets.story.d.ts","sourceRoot":"","sources":["../../src/showcase/motion-presets.story.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAU7D,QAAA,MAAM,IAAI,EAAE,IAYX,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC;AAEtB;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,KASxB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,KAkB1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAmB9B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAoB/B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAsB/B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,KAkB3B,CAAC"}
@@ -0,0 +1,151 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ComponentPresetsShowcase, MicroInteractionsShowcase, MotionPresetsPlayground, MotionStylesShowcase, ReducedMotionDemo, StaggerShowcase, } from "./motion-presets.demo";
3
+ const meta = {
4
+ title: "Animate/Motion Presets",
5
+ parameters: {
6
+ layout: "padded",
7
+ },
8
+ decorators: [
9
+ (Story) => (_jsx("div", { className: "min-h-screen bg-surface-base p-8", children: _jsx(Story, {}) })),
10
+ ],
11
+ };
12
+ export default meta;
13
+ /**
14
+ * Complete playground showcasing all motion preset features.
15
+ * Includes motion styles, component presets, stagger animations,
16
+ * micro-interactions, and reduced motion support.
17
+ */
18
+ export const Playground = {
19
+ render: () => _jsx(MotionPresetsPlayground, {}),
20
+ parameters: {
21
+ docs: {
22
+ description: {
23
+ story: "A comprehensive showcase of all motion preset features including motion styles, component presets, stagger animations, and micro-interactions.",
24
+ },
25
+ },
26
+ },
27
+ };
28
+ /**
29
+ * Demonstrates the four motion styles: subtle, standard, bold, and playful.
30
+ * Each style provides different timing, spring physics, and easing curves
31
+ * to match different UI contexts.
32
+ */
33
+ export const MotionStyles = {
34
+ render: () => _jsx(MotionStylesShowcase, {}),
35
+ parameters: {
36
+ docs: {
37
+ description: {
38
+ story: `
39
+ Motion styles control the overall feel of animations:
40
+
41
+ - **Subtle**: Minimal, professional animations for enterprise/productivity contexts
42
+ - **Standard**: Balanced animations suitable for most applications
43
+ - **Bold**: More pronounced animations for engaging experiences
44
+ - **Playful**: Bouncy, dynamic animations for fun, creative contexts
45
+
46
+ Each style adjusts duration, spring physics, and easing to create cohesive motion.
47
+ `,
48
+ },
49
+ },
50
+ },
51
+ };
52
+ /**
53
+ * Showcases component animation presets like fadeIn, slideUp, scale, etc.
54
+ * These presets provide ready-to-use entrance, exit, and transition animations.
55
+ */
56
+ export const ComponentPresets = {
57
+ render: () => _jsx(ComponentPresetsShowcase, {}),
58
+ parameters: {
59
+ docs: {
60
+ description: {
61
+ story: `
62
+ Component presets provide ready-to-use animations:
63
+
64
+ - **fadeIn/fadeOut**: Simple opacity transitions
65
+ - **slideUp/slideDown/slideLeft/slideRight**: Directional slide animations
66
+ - **scale/zoomIn/zoomOut**: Scale-based animations
67
+ - **rotate/flip**: Rotation animations
68
+ - **expand**: Height-based expansion
69
+
70
+ Each preset can be combined with any motion style for different intensities.
71
+ `,
72
+ },
73
+ },
74
+ },
75
+ };
76
+ /**
77
+ * Demonstrates staggered list animations with different patterns.
78
+ * Useful for animating lists, grids, and collections of items.
79
+ */
80
+ export const StaggerAnimations = {
81
+ render: () => _jsx(StaggerShowcase, {}),
82
+ parameters: {
83
+ docs: {
84
+ description: {
85
+ story: `
86
+ Stagger animations coordinate the timing of multiple elements:
87
+
88
+ - **Sequential**: Items animate one after another (forward or reverse)
89
+ - **Center**: Animation radiates from the center outward
90
+ - **Random**: Items animate in random order
91
+ - **Grid**: Optimized for grid layouts with row/column awareness
92
+ - **Wave**: Creates a wave-like effect across items
93
+ - **Cascade**: Items flow in a cascading pattern
94
+
95
+ Use the \`useStagger\` hook or \`StaggerContainer\` component to apply these patterns.
96
+ `,
97
+ },
98
+ },
99
+ },
100
+ };
101
+ /**
102
+ * Showcases micro-interaction presets for buttons, cards, and other
103
+ * interactive elements.
104
+ */
105
+ export const MicroInteractions = {
106
+ render: () => _jsx(MicroInteractionsShowcase, {}),
107
+ parameters: {
108
+ docs: {
109
+ description: {
110
+ story: `
111
+ Micro-interactions add polish to interactive elements:
112
+
113
+ - **buttonPress**: Satisfying press feedback for buttons
114
+ - **cardHover**: Lift and shadow effect for hoverable cards
115
+ - **pulse**: Continuous pulsing animation for attention
116
+ - **shake**: Error or warning shake animation
117
+ - **iconSpin**: Loading spinner rotation
118
+ - **wiggle**: Playful wiggle animation
119
+ - **heartbeat**: Heartbeat pulse effect
120
+ - **rubberBand**: Stretchy bounce animation
121
+
122
+ Apply these using the preset's \`getProps(style)\` method.
123
+ `,
124
+ },
125
+ },
126
+ },
127
+ };
128
+ /**
129
+ * Demonstrates how animations respect the user's reduced motion preference.
130
+ * When enabled, animations are simplified or disabled for accessibility.
131
+ */
132
+ export const ReducedMotion = {
133
+ render: () => _jsx(ReducedMotionDemo, {}),
134
+ parameters: {
135
+ docs: {
136
+ description: {
137
+ story: `
138
+ All animations automatically respect the user's \`prefers-reduced-motion\` setting:
139
+
140
+ - When reduced motion is enabled, complex animations fall back to simple fades
141
+ - Motion duration is shortened or eliminated
142
+ - The \`useReducedMotion\` hook provides access to the preference
143
+ - Components receive \`data-reduced-motion\` attribute for styling
144
+
145
+ This ensures animations are accessible to users who are sensitive to motion.
146
+ `,
147
+ },
148
+ },
149
+ },
150
+ };
151
+ //# sourceMappingURL=motion-presets.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"motion-presets.story.js","sourceRoot":"","sources":["../../src/showcase/motion-presets.story.tsx"],"names":[],"mappings":";AAGA,OAAO,EACH,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,GAClB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,IAAI,GAAS;IACf,KAAK,EAAE,wBAAwB;IAC/B,UAAU,EAAE;QACR,MAAM,EAAE,QAAQ;KACnB;IACD,UAAU,EAAE;QACR,CAAC,KAAK,EAAE,EAAE,CAAC,CACP,cAAK,SAAS,EAAC,kCAAkC,YAC7C,KAAC,KAAK,KAAG,GACP,CACT;KACJ;CACJ,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AE,CAAC,KAAC,iBAAiB,KAAG;IACnC,UAAU,EAAE;QACR,IAAI,EAAE;YACF,WAAW,EAAE;gBACT,KAAK,EAAE;;;;;;;;;KASlB;aACQ;SACJ;KACJ;CACJ,CAAC"}
@@ -0,0 +1,294 @@
1
+ /**
2
+ * @fileoverview Easing functions and tween configurations for Motion library.
3
+ *
4
+ * @ai-hint This module provides easing curves for duration-based (tween) animations.
5
+ * Use tweens when you need precise timing control or for CSS-property animations
6
+ * that don't work well with springs (e.g., color, opacity fades).
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * import { easeOutQuart, createTween, easeInOut } from './easing';
11
+ *
12
+ * // Use a preset curve
13
+ * <motion.div animate={{ opacity: 1 }} transition={{ duration: 0.3, ease: easeOutQuart }} />
14
+ *
15
+ * // Use the tween helper
16
+ * <motion.div animate={{ x: 100 }} transition={createTween(0.4, easeOutQuart)} />
17
+ * ```
18
+ */
19
+ /**
20
+ * Cubic bezier curve represented as four control points.
21
+ * Format: [x1, y1, x2, y2] matching CSS cubic-bezier().
22
+ *
23
+ * @ai-hint These values map directly to CSS cubic-bezier(x1, y1, x2, y2).
24
+ * x values must be between 0 and 1, y values can exceed that range for overshoot.
25
+ */
26
+ export type CubicBezier = readonly [number, number, number, number];
27
+ /**
28
+ * Configuration object for tween-based (duration) animations.
29
+ *
30
+ * @ai-hint TweenTransition provides predictable, time-based animations.
31
+ * Unlike springs, tweens always take exactly the specified duration.
32
+ */
33
+ export interface TweenTransition {
34
+ /** Animation type identifier */
35
+ readonly type: "tween";
36
+ /** Duration in seconds */
37
+ readonly duration: number;
38
+ /** Easing curve (cubic bezier or named easing) */
39
+ readonly ease?: CubicBezier | string;
40
+ }
41
+ /**
42
+ * Parameters for creating tween transitions.
43
+ */
44
+ export interface TweenParams {
45
+ /** Duration in seconds */
46
+ duration: number;
47
+ /** Optional easing curve */
48
+ ease?: CubicBezier | string;
49
+ /** Optional delay before animation starts */
50
+ delay?: number;
51
+ }
52
+ /**
53
+ * Linear easing - constant speed with no acceleration.
54
+ *
55
+ * @ai-hint Use for progress indicators, loading bars, or when you need
56
+ * mechanical, uniform motion. Rarely suitable for UI transitions.
57
+ *
58
+ * @example
59
+ * ```tsx
60
+ * <motion.div animate={{ width: "100%" }} transition={{ duration: 2, ease: linear }} />
61
+ * ```
62
+ */
63
+ export declare const linear: CubicBezier;
64
+ /**
65
+ * Ease-in - starts slow, accelerates toward end.
66
+ *
67
+ * @ai-hint Use for elements exiting the screen or fading out.
68
+ * Creates anticipation but can feel sluggish if overused.
69
+ *
70
+ * @example
71
+ * ```tsx
72
+ * <motion.div exit={{ opacity: 0, x: -100 }} transition={{ duration: 0.3, ease: easeIn }} />
73
+ * ```
74
+ */
75
+ export declare const easeIn: CubicBezier;
76
+ /**
77
+ * Ease-out - starts fast, decelerates toward end.
78
+ *
79
+ * @ai-hint The most natural-feeling easing for UI. Use for elements
80
+ * entering the screen or appearing. Mimics real-world deceleration.
81
+ *
82
+ * @example
83
+ * ```tsx
84
+ * <motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ duration: 0.3, ease: easeOut }} />
85
+ * ```
86
+ */
87
+ export declare const easeOut: CubicBezier;
88
+ /**
89
+ * Ease-in-out - slow start and end, fast middle.
90
+ *
91
+ * @ai-hint Good for elements that transform in place (scale, rotate)
92
+ * or move between two visible positions. Symmetric and balanced.
93
+ *
94
+ * @example
95
+ * ```tsx
96
+ * <motion.div animate={{ rotate: 180 }} transition={{ duration: 0.5, ease: easeInOut }} />
97
+ * ```
98
+ */
99
+ export declare const easeInOut: CubicBezier;
100
+ /**
101
+ * Quart ease-out - more dramatic deceleration than standard ease-out.
102
+ *
103
+ * @ai-hint Use for hero animations, page transitions, or anywhere you want
104
+ * motion to feel more dynamic and expressive. Popular in modern UI design.
105
+ *
106
+ * @example
107
+ * ```tsx
108
+ * <motion.section
109
+ * initial={{ y: 50, opacity: 0 }}
110
+ * animate={{ y: 0, opacity: 1 }}
111
+ * transition={{ duration: 0.6, ease: easeOutQuart }}
112
+ * />
113
+ * ```
114
+ */
115
+ export declare const easeOutQuart: CubicBezier;
116
+ /**
117
+ * Cubic ease-in-out - smooth acceleration and deceleration.
118
+ *
119
+ * @ai-hint A balanced, professional curve suitable for most transitions.
120
+ * Less aggressive than quart, more refined than standard ease-in-out.
121
+ *
122
+ * @example
123
+ * ```tsx
124
+ * <motion.div
125
+ * animate={{ height: isOpen ? "auto" : 0 }}
126
+ * transition={{ duration: 0.4, ease: easeInOutCubic }}
127
+ * />
128
+ * ```
129
+ */
130
+ export declare const easeInOutCubic: CubicBezier;
131
+ /**
132
+ * Back ease-out - slight overshoot before settling.
133
+ *
134
+ * @ai-hint Use for playful, attention-grabbing animations. The overshoot
135
+ * creates a "bounce back" effect. Use sparingly in professional UIs.
136
+ *
137
+ * @example
138
+ * ```tsx
139
+ * <motion.div
140
+ * initial={{ scale: 0 }}
141
+ * animate={{ scale: 1 }}
142
+ * transition={{ duration: 0.5, ease: easeOutBack }}
143
+ * />
144
+ * ```
145
+ */
146
+ export declare const easeOutBack: CubicBezier;
147
+ /**
148
+ * Expo ease-out - very fast start with long, smooth deceleration.
149
+ *
150
+ * @ai-hint Creates a snappy feel while maintaining smoothness.
151
+ * Great for modals, popovers, and navigation transitions.
152
+ *
153
+ * @example
154
+ * ```tsx
155
+ * <motion.dialog
156
+ * initial={{ scale: 0.95, opacity: 0 }}
157
+ * animate={{ scale: 1, opacity: 1 }}
158
+ * transition={{ duration: 0.3, ease: easeOutExpo }}
159
+ * />
160
+ * ```
161
+ */
162
+ export declare const easeOutExpo: CubicBezier;
163
+ /**
164
+ * Quint ease-in-out - dramatic but smooth transition.
165
+ *
166
+ * @ai-hint Use for large-scale transitions like page changes or
167
+ * full-screen reveals. The aggressive curve makes motion feel purposeful.
168
+ *
169
+ * @example
170
+ * ```tsx
171
+ * <motion.main
172
+ * initial={{ opacity: 0 }}
173
+ * animate={{ opacity: 1 }}
174
+ * transition={{ duration: 0.8, ease: easeInOutQuint }}
175
+ * />
176
+ * ```
177
+ */
178
+ export declare const easeInOutQuint: CubicBezier;
179
+ /**
180
+ * Creates a tween transition with specified duration and optional easing.
181
+ *
182
+ * @ai-hint Primary factory for duration-based animations. Provides
183
+ * consistent, predictable timing. Default easing is easeOut.
184
+ *
185
+ * @param duration - Animation duration in seconds
186
+ * @param ease - Optional cubic bezier curve or easing name
187
+ * @returns A TweenTransition configuration object
188
+ *
189
+ * @example
190
+ * ```tsx
191
+ * // Quick fade
192
+ * <motion.div animate={{ opacity: 1 }} transition={createTween(0.2)} />
193
+ *
194
+ * // Expressive entrance
195
+ * <motion.div animate={{ y: 0 }} transition={createTween(0.5, easeOutQuart)} />
196
+ *
197
+ * // Using named easing
198
+ * <motion.div animate={{ x: 100 }} transition={createTween(0.3, "easeInOut")} />
199
+ * ```
200
+ */
201
+ export declare function createTween(duration: number, ease?: CubicBezier | string): TweenTransition;
202
+ /**
203
+ * Creates a tween transition from a params object.
204
+ *
205
+ * @ai-hint Alternative factory accepting an object, useful when
206
+ * animation parameters come from configuration or are computed.
207
+ *
208
+ * @param params - Tween parameters object
209
+ * @returns A TweenTransition configuration object
210
+ *
211
+ * @example
212
+ * ```tsx
213
+ * const config = { duration: 0.4, ease: easeOutQuart };
214
+ * const tween = createTweenFromParams(config);
215
+ * ```
216
+ */
217
+ export declare function createTweenFromParams(params: TweenParams): TweenTransition;
218
+ /**
219
+ * Standard duration values for consistent timing across the application.
220
+ *
221
+ * @ai-hint Use these durations to maintain rhythm and consistency.
222
+ * Faster durations for small, frequent interactions; longer for emphasis.
223
+ */
224
+ export declare const durations: {
225
+ /** Micro-interactions: hover states, small toggles (100ms) */
226
+ readonly instant: 0.1;
227
+ /** Quick feedback: button clicks, checkboxes (200ms) */
228
+ readonly fast: 0.2;
229
+ /** Standard transitions: most UI elements (300ms) */
230
+ readonly normal: 0.3;
231
+ /** Emphasized transitions: modals, drawers (400ms) */
232
+ readonly slow: 0.4;
233
+ /** Dramatic transitions: page changes, reveals (600ms) */
234
+ readonly slower: 0.6;
235
+ };
236
+ /**
237
+ * Type representing valid duration preset names.
238
+ */
239
+ export type DurationPresetName = keyof typeof durations;
240
+ /**
241
+ * Collection of all easing curves for iteration or dynamic selection.
242
+ *
243
+ * @ai-hint Use this map when you need to select easings dynamically
244
+ * based on theme or user preferences.
245
+ *
246
+ * @example
247
+ * ```tsx
248
+ * const easingName = theme.animationEasing; // 'easeOutQuart' | 'easeInOut' | etc.
249
+ * const easing = easingPresets[easingName];
250
+ * ```
251
+ */
252
+ export declare const easingPresets: {
253
+ readonly linear: CubicBezier;
254
+ readonly easeIn: CubicBezier;
255
+ readonly easeOut: CubicBezier;
256
+ readonly easeInOut: CubicBezier;
257
+ readonly easeOutQuart: CubicBezier;
258
+ readonly easeInOutCubic: CubicBezier;
259
+ readonly easeOutBack: CubicBezier;
260
+ readonly easeOutExpo: CubicBezier;
261
+ readonly easeInOutQuint: CubicBezier;
262
+ };
263
+ /**
264
+ * Type representing valid easing preset names.
265
+ */
266
+ export type EasingPresetName = keyof typeof easingPresets;
267
+ /**
268
+ * Pre-configured tween transitions for common use cases.
269
+ *
270
+ * @ai-hint Ready-to-use transitions that combine duration and easing
271
+ * for typical scenarios. Use these for consistent animation behavior.
272
+ *
273
+ * @example
274
+ * ```tsx
275
+ * <motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }} transition={tweenPresets.fadeIn} />
276
+ * ```
277
+ */
278
+ export declare const tweenPresets: {
279
+ /** Quick fade for hover states and micro-interactions */
280
+ readonly instant: TweenTransition;
281
+ /** Snappy transition for interactive elements */
282
+ readonly fast: TweenTransition;
283
+ /** Balanced transition for most UI elements */
284
+ readonly normal: TweenTransition;
285
+ /** Smooth transition for modals and overlays */
286
+ readonly slow: TweenTransition;
287
+ /** Dramatic transition for page-level changes */
288
+ readonly slower: TweenTransition;
289
+ };
290
+ /**
291
+ * Type representing valid tween preset names.
292
+ */
293
+ export type TweenPresetName = keyof typeof tweenPresets;
294
+ //# sourceMappingURL=easing.d.ts.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