@fluentui/react-motion-components-preview 0.6.2 → 0.8.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 (81) hide show
  1. package/CHANGELOG.md +22 -2
  2. package/dist/index.d.ts +75 -77
  3. package/lib/atoms/blur-atom.js +26 -0
  4. package/lib/atoms/blur-atom.js.map +1 -0
  5. package/lib/atoms/fade-atom.js +3 -3
  6. package/lib/atoms/fade-atom.js.map +1 -1
  7. package/lib/atoms/scale-atom.js +5 -5
  8. package/lib/atoms/scale-atom.js.map +1 -1
  9. package/lib/atoms/slide-atom.js +27 -0
  10. package/lib/atoms/slide-atom.js.map +1 -0
  11. package/lib/components/Blur/Blur.js +48 -0
  12. package/lib/components/Blur/Blur.js.map +1 -0
  13. package/lib/components/Blur/blur-types.js +1 -0
  14. package/lib/components/Blur/blur-types.js.map +1 -0
  15. package/lib/components/Blur/index.js +1 -0
  16. package/lib/components/Blur/index.js.map +1 -0
  17. package/lib/components/Collapse/Collapse.js +117 -77
  18. package/lib/components/Collapse/Collapse.js.map +1 -1
  19. package/lib/components/Collapse/collapse-atoms.js.map +1 -1
  20. package/lib/components/Collapse/collapse-types.js.map +1 -1
  21. package/lib/components/Collapse/index.js +1 -1
  22. package/lib/components/Collapse/index.js.map +1 -1
  23. package/lib/components/Fade/Fade.js +8 -1
  24. package/lib/components/Fade/Fade.js.map +1 -1
  25. package/lib/components/Fade/fade-types.js +1 -0
  26. package/lib/components/Fade/fade-types.js.map +1 -0
  27. package/lib/components/Fade/index.js.map +1 -1
  28. package/lib/components/Scale/Scale.js +16 -5
  29. package/lib/components/Scale/Scale.js.map +1 -1
  30. package/lib/components/Scale/index.js.map +1 -1
  31. package/lib/components/Scale/scale-types.js +1 -0
  32. package/lib/components/Scale/scale-types.js.map +1 -0
  33. package/lib/components/Slide/Slide.js +58 -0
  34. package/lib/components/Slide/Slide.js.map +1 -0
  35. package/lib/components/Slide/index.js +1 -0
  36. package/lib/components/Slide/index.js.map +1 -0
  37. package/lib/components/Slide/slide-types.js +1 -0
  38. package/lib/components/Slide/slide-types.js.map +1 -0
  39. package/lib/index.js +3 -1
  40. package/lib/index.js.map +1 -1
  41. package/lib/types.js +2 -10
  42. package/lib/types.js.map +1 -1
  43. package/lib-commonjs/atoms/blur-atom.js +29 -0
  44. package/lib-commonjs/atoms/blur-atom.js.map +1 -0
  45. package/lib-commonjs/atoms/fade-atom.js +2 -2
  46. package/lib-commonjs/atoms/fade-atom.js.map +1 -1
  47. package/lib-commonjs/atoms/scale-atom.js +3 -3
  48. package/lib-commonjs/atoms/scale-atom.js.map +1 -1
  49. package/lib-commonjs/atoms/slide-atom.js +29 -0
  50. package/lib-commonjs/atoms/slide-atom.js.map +1 -0
  51. package/lib-commonjs/components/Blur/Blur.js +58 -0
  52. package/lib-commonjs/components/Blur/Blur.js.map +1 -0
  53. package/lib-commonjs/components/Blur/blur-types.js +4 -0
  54. package/lib-commonjs/components/Blur/blur-types.js.map +1 -0
  55. package/lib-commonjs/components/Blur/index.js +11 -0
  56. package/lib-commonjs/components/Blur/index.js.map +1 -0
  57. package/lib-commonjs/components/Collapse/Collapse.js +116 -82
  58. package/lib-commonjs/components/Collapse/Collapse.js.map +1 -1
  59. package/lib-commonjs/components/Collapse/collapse-atoms.js.map +1 -1
  60. package/lib-commonjs/components/Collapse/collapse-types.js.map +1 -1
  61. package/lib-commonjs/components/Collapse/index.js +0 -6
  62. package/lib-commonjs/components/Collapse/index.js.map +1 -1
  63. package/lib-commonjs/components/Fade/Fade.js.map +1 -1
  64. package/lib-commonjs/components/Fade/fade-types.js +4 -0
  65. package/lib-commonjs/components/Fade/fade-types.js.map +1 -0
  66. package/lib-commonjs/components/Fade/index.js.map +1 -1
  67. package/lib-commonjs/components/Scale/Scale.js +16 -5
  68. package/lib-commonjs/components/Scale/Scale.js.map +1 -1
  69. package/lib-commonjs/components/Scale/index.js.map +1 -1
  70. package/lib-commonjs/components/Scale/scale-types.js +4 -0
  71. package/lib-commonjs/components/Scale/scale-types.js.map +1 -0
  72. package/lib-commonjs/components/Slide/Slide.js +79 -0
  73. package/lib-commonjs/components/Slide/Slide.js.map +1 -0
  74. package/lib-commonjs/components/Slide/index.js +22 -0
  75. package/lib-commonjs/components/Slide/index.js.map +1 -0
  76. package/lib-commonjs/components/Slide/slide-types.js +4 -0
  77. package/lib-commonjs/components/Slide/slide-types.js.map +1 -0
  78. package/lib-commonjs/index.js +12 -4
  79. package/lib-commonjs/index.js.map +1 -1
  80. package/lib-commonjs/types.js.map +1 -1
  81. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,12 +1,32 @@
1
1
  # Change Log - @fluentui/react-motion-components-preview
2
2
 
3
- This log was last generated on Thu, 26 Jun 2025 14:07:52 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 28 Jul 2025 18:44:10 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [0.8.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion-components-preview_v0.8.0)
8
+
9
+ Mon, 28 Jul 2025 18:44:10 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-motion-components-preview_v0.7.0..@fluentui/react-motion-components-preview_v0.8.0)
11
+
12
+ ### Minor changes
13
+
14
+ - feat(motion): add Fade presence motion component ([PR #34839](https://github.com/microsoft/fluentui/pull/34839) by robertpenner@microsoft.com)
15
+
16
+ ## [0.7.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion-components-preview_v0.7.0)
17
+
18
+ Wed, 16 Jul 2025 13:52:47 GMT
19
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-motion-components-preview_v0.6.2..@fluentui/react-motion-components-preview_v0.7.0)
20
+
21
+ ### Minor changes
22
+
23
+ - refactor(Collapse): make consistent with other motion components ([PR #34831](https://github.com/microsoft/fluentui/pull/34831) by robertpenner@microsoft.com)
24
+ - feat(motion): add Slide presence motion component ([PR #34774](https://github.com/microsoft/fluentui/pull/34774) by robertpenner@microsoft.com)
25
+ - refactor(motion): apply consistent patterns across Fade and Scale ([PR #34830](https://github.com/microsoft/fluentui/pull/34830) by robertpenner@microsoft.com)
26
+
7
27
  ## [0.6.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion-components-preview_v0.6.2)
8
28
 
9
- Thu, 26 Jun 2025 14:07:52 GMT
29
+ Thu, 26 Jun 2025 14:11:54 GMT
10
30
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-motion-components-preview_v0.5.0..@fluentui/react-motion-components-preview_v0.6.2)
11
31
 
12
32
  ### Patches
package/dist/index.d.ts CHANGED
@@ -1,111 +1,109 @@
1
- import type { MotionParam } from '@fluentui/react-motion';
2
1
  import { PresenceComponent } from '@fluentui/react-motion';
3
- import type { PresenceMotionFn } from '@fluentui/react-motion';
4
2
 
5
- /** A React component that applies collapse/expand transitions to its children. */
6
- export declare const Collapse: PresenceComponent<CollapseRuntimeParams>;
3
+ /**
4
+ * Common opacity animation parameter for motion components.
5
+ */
6
+ declare type AnimateOpacity = {
7
+ /** Whether to animate the opacity. Defaults to `true`. */
8
+ animateOpacity?: boolean;
9
+ };
7
10
 
8
- export declare const CollapseDelayed: PresenceComponent<CollapseRuntimeParams>;
11
+ /** A React component that applies blur in/out transitions to its children. */
12
+ export declare const Blur: PresenceComponent<BlurParams>;
9
13
 
10
- declare type CollapseDelayedVariantParams = {
11
- /** Time (ms) for the size expand. Defaults to the durationNormal value (200 ms). */
12
- enterSizeDuration?: number;
13
- /** Time (ms) for the fade-in. Defaults to the enterSizeDuration param, to sync fade-in with expand. */
14
- enterOpacityDuration?: number;
15
- /** Time (ms) for the size collapse. Defaults to the enterSizeDuration param, for temporal symmetry.. */
16
- exitSizeDuration?: number;
17
- /** Defaults to the exitSizeDuration param, to sync the fade-out with the collapse. */
18
- exitOpacityDuration?: number;
19
- /** Time (ms) between the size expand start and the fade-in start. Defaults to `0`. */
20
- enterDelay?: number;
21
- /** Time (ms) between the fade-out start and the size collapse start. Defaults to `0`. */
22
- exitDelay?: number;
23
- /** Easing curve for the enter transition, shared by size and opacity. Defaults to the easeEaseMax value. */
24
- enterEasing?: string;
25
- /** Easing curve for the exit transition, shared by size and opacity. Defaults to the enterEasing param. */
26
- exitEasing?: string;
14
+ declare type BlurParams = PresenceDuration & PresenceEasing & AnimateOpacity & {
15
+ /** The radius of pixels to blend into the blur. A length string, defaulting to '20px'. */
16
+ fromRadius?: string;
27
17
  };
28
18
 
29
- declare type CollapseOrientation = 'horizontal' | 'vertical';
30
-
31
- export declare const CollapseRelaxed: PresenceComponent<CollapseRuntimeParams>;
19
+ /** A React component that applies collapse/expand transitions to its children. */
20
+ export declare const Collapse: PresenceComponent<CollapseParams>;
32
21
 
33
- export declare type CollapseRuntimeParams = {
34
- /** Whether to animate the opacity. Defaults to `true`. */
35
- animateOpacity?: boolean;
22
+ /** Common properties shared by all collapse components */
23
+ declare type CollapseBaseParams = PresenceEasing & AnimateOpacity & {
36
24
  /** The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height. */
37
25
  orientation?: CollapseOrientation;
38
26
  };
39
27
 
40
- export declare const CollapseSnappy: PresenceComponent<CollapseRuntimeParams>;
28
+ /** A React component that applies collapse/expand transitions with delayed fade to its children. */
29
+ export declare const CollapseDelayed: PresenceComponent<CollapseDelayedParams>;
41
30
 
42
- declare type CollapseVariantParams = {
43
- /** Time (ms) for the enter transition (expand). Defaults to the `durationNormal` value (200 ms). */
44
- enterDuration?: number;
45
- /** Easing curve for the enter transition (expand). Defaults to the `easeEaseMax` value. */
46
- enterEasing?: string;
47
- /** Time (ms) for the exit transition (collapse). Defaults to the `enterDuration` param for symmetry. */
48
- exitDuration?: number;
49
- /** Easing curve for the exit transition (collapse). Defaults to the `enterEasing` param for symmetry. */
50
- exitEasing?: string;
31
+ declare type CollapseDelayedParams = CollapseBaseParams & {
32
+ /** Time (ms) for the size expand. Defaults to the `durationNormal` value (200 ms). */
33
+ sizeDuration?: number;
34
+ /** Time (ms) for the fade-in. Defaults to the `sizeDuration` param, to sync fade-in with expand. */
35
+ opacityDuration?: number;
36
+ /** Time (ms) for the size collapse. Defaults to the `sizeDuration` param, for temporal symmetry. */
37
+ exitSizeDuration?: number;
38
+ /** Time (ms) for the fade-out. Defaults to the `exitSizeDuration` param, to sync the fade-out with the collapse. */
39
+ exitOpacityDuration?: number;
40
+ /** Time (ms) between the size expand start and the fade-in start. Defaults to `0`. */
41
+ delay?: number;
42
+ /** Time (ms) between the fade-out start and the size collapse start. Defaults to `0`. */
43
+ exitDelay?: number;
51
44
  };
52
45
 
53
- /** Define a presence motion for collapse/expand that can stagger the size and opacity motions by a given delay. */
54
- export declare const createCollapseDelayedPresence: PresenceMotionFnCreator<CollapseDelayedVariantParams, CollapseRuntimeParams>;
46
+ declare type CollapseOrientation = 'horizontal' | 'vertical';
47
+
48
+ declare type CollapseParams = CollapseBaseParams & PresenceDuration;
49
+
50
+ export declare const CollapseRelaxed: PresenceComponent<CollapseParams>;
55
51
 
56
- /** Defines a presence motion for collapse/expand. */
57
- export declare const createCollapsePresence: PresenceMotionFnCreator<CollapseVariantParams, CollapseRuntimeParams>;
52
+ export declare const CollapseSnappy: PresenceComponent<CollapseParams>;
58
53
 
59
54
  /** A React component that applies fade in/out transitions to its children. */
60
- export declare const Fade: PresenceComponent<FadeVariantParams>;
55
+ export declare const Fade: PresenceComponent<FadeParams>;
61
56
 
62
- export declare const FadeRelaxed: PresenceComponent<FadeVariantParams>;
57
+ declare type FadeParams = PresenceDuration & PresenceEasing;
63
58
 
64
- export declare const FadeSnappy: PresenceComponent<FadeVariantParams>;
59
+ export declare const FadeRelaxed: PresenceComponent<FadeParams>;
65
60
 
66
- declare type FadeVariantParams = {
67
- /** Time (ms) for the enter transition (fade-in). Defaults to the `durationNormal` value (200 ms). */
61
+ export declare const FadeSnappy: PresenceComponent<FadeParams>;
62
+
63
+ /**
64
+ * Common duration parameters for presence motion components.
65
+ */
66
+ declare type PresenceDuration = {
67
+ /** Time (ms) for the enter transition. */
68
68
  duration?: number;
69
- /** Easing curve for the enter transition (fade-in). Defaults to the `curveEasyEase` value. */
70
- easing?: string;
71
- /** Time (ms) for the exit transition (fade-out). Defaults to the `duration` param for symmetry. */
69
+ /** Time (ms) for the exit transition. Defaults to the `duration` param for symmetry. */
72
70
  exitDuration?: number;
73
- /** Easing curve for the exit transition (fade-out). Defaults to the `easing` param for symmetry. */
74
- exitEasing?: string;
75
71
  };
76
72
 
77
73
  /**
78
- * This is a factory function that generates a motion function, which has variant params bound into it.
79
- * The generated motion function accepts other runtime params that aren't locked into the variant, but supplied at runtime.
80
- * This separation allows the variant to be defined once and reused with different runtime params which may be orthogonal to the variant params.
81
- * For example, a variant may define the duration and easing of a transition, which are fixed for all instances of the variant,
82
- * while the runtime params may give access to the target element, which is different for each instance.
83
- *
84
- * The generated motion function is also framework-independent, i.e. non-React.
85
- * It can be turned into a React component using `createPresenceComponent`.
74
+ * Common easing parameters for presence motion components.
86
75
  */
87
- declare type PresenceMotionFnCreator<MotionVariantParams extends Record<string, MotionParam> = {}, MotionRuntimeParams extends Record<string, MotionParam> = {}> = (variantParams?: MotionVariantParams) => PresenceMotionFn<MotionRuntimeParams>;
76
+ declare type PresenceEasing = {
77
+ /** Easing curve for the enter transition. */
78
+ easing?: string;
79
+ /** Easing curve for the exit transition. Defaults to the `easing` param for symmetry. */
80
+ exitEasing?: string;
81
+ };
88
82
 
89
83
  /** A React component that applies scale in/out transitions to its children. */
90
- export declare const Scale: PresenceComponent<ScaleVariantParams>;
91
-
92
- export declare const ScaleRelaxed: PresenceComponent<ScaleVariantParams>;
84
+ export declare const Scale: PresenceComponent<ScaleParams>;
93
85
 
94
- export declare const ScaleSnappy: PresenceComponent<ScaleVariantParams>;
95
-
96
- declare type ScaleVariantParams = {
97
- /** Time (ms) for the enter transition (scale-in). Defaults to the `durationGentle` value (250 ms). */
98
- duration?: number;
99
- /** Easing curve for the enter transition (scale-in). Defaults to the `curveDecelerateMax` value. */
100
- easing?: string;
101
- /** Time (ms) for the exit transition (scale-out). Defaults to the `durationNormal` value (200 ms). */
102
- exitDuration?: number;
103
- /** Easing curve for the exit transition (scale-out). Defaults to the `curveAccelerateMax` value. */
104
- exitEasing?: string;
86
+ declare type ScaleParams = PresenceDuration & PresenceEasing & AnimateOpacity & {
105
87
  /** The scale value to animate from. Defaults to `0.9`. */
106
88
  fromScale?: number;
107
- /** Whether to animate the opacity. Defaults to `true`. */
108
- animateOpacity?: boolean;
109
89
  };
110
90
 
91
+ export declare const ScaleRelaxed: PresenceComponent<ScaleParams>;
92
+
93
+ export declare const ScaleSnappy: PresenceComponent<ScaleParams>;
94
+
95
+ /** A React component that applies slide in/out transitions to its children. */
96
+ export declare const Slide: PresenceComponent<SlideParams>;
97
+
98
+ declare type SlideParams = PresenceDuration & PresenceEasing & AnimateOpacity & {
99
+ /** The X translate value with units to animate from. Defaults to `'0px'`. */
100
+ fromX?: string;
101
+ /** The Y translate value with units to animate from. Defaults to `'20px'`. */
102
+ fromY?: string;
103
+ };
104
+
105
+ export declare const SlideRelaxed: PresenceComponent<SlideParams>;
106
+
107
+ export declare const SlideSnappy: PresenceComponent<SlideParams>;
108
+
111
109
  export { }
@@ -0,0 +1,26 @@
1
+ import { motionTokens } from '@fluentui/react-motion';
2
+ /**
3
+ * Generates a motion atom object for a blur-in or blur-out.
4
+ * @param direction - The functional direction of the motion: 'enter' or 'exit'.
5
+ * @param duration - The duration of the motion in milliseconds.
6
+ * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.
7
+ * @param fromRadius - The blur radius value with units (e.g., '20px', '1rem'). Defaults to '20px'.
8
+ * @returns A motion atom object with filter blur keyframes and the supplied duration and easing.
9
+ */ export const blurAtom = ({ direction, duration, easing = motionTokens.curveLinear, fromRadius = '10px' })=>{
10
+ const keyframes = [
11
+ {
12
+ filter: `blur(${fromRadius})`
13
+ },
14
+ {
15
+ filter: 'blur(0px)'
16
+ }
17
+ ];
18
+ if (direction === 'exit') {
19
+ keyframes.reverse();
20
+ }
21
+ return {
22
+ keyframes,
23
+ duration,
24
+ easing
25
+ };
26
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/atoms/blur-atom.ts"],"sourcesContent":["import { AtomMotion, PresenceDirection, motionTokens } from '@fluentui/react-motion';\n\ninterface BlurAtomParams {\n direction: PresenceDirection;\n duration: number;\n easing?: string;\n fromRadius?: string;\n}\n\n/**\n * Generates a motion atom object for a blur-in or blur-out.\n * @param direction - The functional direction of the motion: 'enter' or 'exit'.\n * @param duration - The duration of the motion in milliseconds.\n * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.\n * @param fromRadius - The blur radius value with units (e.g., '20px', '1rem'). Defaults to '20px'.\n * @returns A motion atom object with filter blur keyframes and the supplied duration and easing.\n */\nexport const blurAtom = ({\n direction,\n duration,\n easing = motionTokens.curveLinear,\n fromRadius = '10px',\n}: BlurAtomParams): AtomMotion => {\n const keyframes = [{ filter: `blur(${fromRadius})` }, { filter: 'blur(0px)' }];\n if (direction === 'exit') {\n keyframes.reverse();\n }\n return {\n keyframes,\n duration,\n easing,\n };\n};\n"],"names":["motionTokens","blurAtom","direction","duration","easing","curveLinear","fromRadius","keyframes","filter","reverse"],"mappings":"AAAA,SAAwCA,YAAY,QAAQ,yBAAyB;AASrF;;;;;;;CAOC,GACD,OAAO,MAAMC,WAAW,CAAC,EACvBC,SAAS,EACTC,QAAQ,EACRC,SAASJ,aAAaK,WAAW,EACjCC,aAAa,MAAM,EACJ;IACf,MAAMC,YAAY;QAAC;YAAEC,QAAQ,CAAC,KAAK,EAAEF,WAAW,CAAC,CAAC;QAAC;QAAG;YAAEE,QAAQ;QAAY;KAAE;IAC9E,IAAIN,cAAc,QAAQ;QACxBK,UAAUE,OAAO;IACnB;IACA,OAAO;QACLF;QACAJ;QACAC;IACF;AACF,EAAE"}
@@ -1,15 +1,15 @@
1
1
  import { motionTokens } from '@fluentui/react-motion';
2
2
  /**
3
- * Generates a motion atom object for a fade in or fade out.
3
+ * Generates a motion atom object for a fade-in or fade-out.
4
4
  * @param direction - The functional direction of the motion: 'enter' or 'exit'.
5
5
  * @param duration - The duration of the motion in milliseconds.
6
6
  * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.
7
7
  * @param fromValue - The starting opacity value. Defaults to 0.
8
8
  * @returns A motion atom object with opacity keyframes and the supplied duration and easing.
9
- */ export const fadeAtom = ({ direction, duration, easing = motionTokens.curveLinear, fromValue = 0 })=>{
9
+ */ export const fadeAtom = ({ direction, duration, easing = motionTokens.curveLinear, fromOpacity = 0 })=>{
10
10
  const keyframes = [
11
11
  {
12
- opacity: fromValue
12
+ opacity: fromOpacity
13
13
  },
14
14
  {
15
15
  opacity: 1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/atoms/fade-atom.ts"],"sourcesContent":["import { AtomMotion, PresenceDirection, motionTokens } from '@fluentui/react-motion';\n\ninterface FadeAtomParams {\n direction: PresenceDirection;\n duration: number;\n easing?: string;\n fromValue?: number;\n}\n\n/**\n * Generates a motion atom object for a fade in or fade out.\n * @param direction - The functional direction of the motion: 'enter' or 'exit'.\n * @param duration - The duration of the motion in milliseconds.\n * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.\n * @param fromValue - The starting opacity value. Defaults to 0.\n * @returns A motion atom object with opacity keyframes and the supplied duration and easing.\n */\nexport const fadeAtom = ({\n direction,\n duration,\n easing = motionTokens.curveLinear,\n fromValue = 0,\n}: FadeAtomParams): AtomMotion => {\n const keyframes = [{ opacity: fromValue }, { opacity: 1 }];\n if (direction === 'exit') {\n keyframes.reverse();\n }\n return {\n keyframes,\n duration,\n easing,\n };\n};\n"],"names":["motionTokens","fadeAtom","direction","duration","easing","curveLinear","fromValue","keyframes","opacity","reverse"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAAwCA,YAAY,QAAQ,yBAAyB;AASrF;;;;;;;CAOC,GACD,OAAO,MAAMC,WAAW,CAAC,EACvBC,SAAS,EACTC,QAAQ,EACRC,SAASJ,aAAaK,WAAW,EACjCC,YAAY,CAAC,EACE;IACf,MAAMC,YAAY;QAAC;YAAEC,SAASF;QAAU;QAAG;YAAEE,SAAS;QAAE;KAAE;IAC1D,IAAIN,cAAc,QAAQ;QACxBK,UAAUE,OAAO;IACnB;IACA,OAAO;QACLF;QACAJ;QACAC;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../src/atoms/fade-atom.ts"],"sourcesContent":["import { AtomMotion, PresenceDirection, motionTokens } from '@fluentui/react-motion';\n\ninterface FadeAtomParams {\n direction: PresenceDirection;\n duration: number;\n easing?: string;\n fromOpacity?: number;\n}\n\n/**\n * Generates a motion atom object for a fade-in or fade-out.\n * @param direction - The functional direction of the motion: 'enter' or 'exit'.\n * @param duration - The duration of the motion in milliseconds.\n * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.\n * @param fromValue - The starting opacity value. Defaults to 0.\n * @returns A motion atom object with opacity keyframes and the supplied duration and easing.\n */\nexport const fadeAtom = ({\n direction,\n duration,\n easing = motionTokens.curveLinear,\n fromOpacity = 0,\n}: FadeAtomParams): AtomMotion => {\n const keyframes = [{ opacity: fromOpacity }, { opacity: 1 }];\n if (direction === 'exit') {\n keyframes.reverse();\n }\n return {\n keyframes,\n duration,\n easing,\n };\n};\n"],"names":["motionTokens","fadeAtom","direction","duration","easing","curveLinear","fromOpacity","keyframes","opacity","reverse"],"mappings":"AAAA,SAAwCA,YAAY,QAAQ,yBAAyB;AASrF;;;;;;;CAOC,GACD,OAAO,MAAMC,WAAW,CAAC,EACvBC,SAAS,EACTC,QAAQ,EACRC,SAASJ,aAAaK,WAAW,EACjCC,cAAc,CAAC,EACA;IACf,MAAMC,YAAY;QAAC;YAAEC,SAASF;QAAY;QAAG;YAAEE,SAAS;QAAE;KAAE;IAC5D,IAAIN,cAAc,QAAQ;QACxBK,UAAUE,OAAO;IACnB;IACA,OAAO;QACLF;QACAJ;QACAC;IACF;AACF,EAAE"}
@@ -4,16 +4,16 @@ import { motionTokens } from '@fluentui/react-motion';
4
4
  * @param direction - The functional direction of the motion: 'enter' or 'exit'.
5
5
  * @param duration - The duration of the motion in milliseconds.
6
6
  * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.
7
- * @param fromValue - The starting scale value. Defaults to 0.9.
8
- * @param toValue - The ending scale value. Defaults to 1.
7
+ * @param fromScale - The starting scale value. Defaults to 0.9.
8
+ * @param toScale - The ending scale value. Defaults to 1.
9
9
  * @returns A motion atom object with scale keyframes and the supplied duration and easing.
10
- */ export const scaleAtom = ({ direction, duration, easing = motionTokens.curveLinear, fromValue = 0.9, toValue = 1 })=>{
10
+ */ export const scaleAtom = ({ direction, duration, easing = motionTokens.curveLinear, fromScale = 0.9, toScale = 1 })=>{
11
11
  const keyframes = [
12
12
  {
13
- scale: fromValue
13
+ scale: fromScale
14
14
  },
15
15
  {
16
- scale: toValue
16
+ scale: toScale
17
17
  }
18
18
  ];
19
19
  if (direction === 'exit') {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/atoms/scale-atom.ts"],"sourcesContent":["import { AtomMotion, PresenceDirection, motionTokens } from '@fluentui/react-motion';\n\ninterface ScaleAtomParams {\n direction: PresenceDirection;\n duration: number;\n easing?: string;\n fromValue?: number;\n toValue?: number;\n}\n\n/**\n * Generates a motion atom object for a scale in or scale out.\n * @param direction - The functional direction of the motion: 'enter' or 'exit'.\n * @param duration - The duration of the motion in milliseconds.\n * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.\n * @param fromValue - The starting scale value. Defaults to 0.9.\n * @param toValue - The ending scale value. Defaults to 1.\n * @returns A motion atom object with scale keyframes and the supplied duration and easing.\n */\nexport const scaleAtom = ({\n direction,\n duration,\n easing = motionTokens.curveLinear,\n fromValue = 0.9,\n toValue = 1,\n}: ScaleAtomParams): AtomMotion => {\n const keyframes = [{ scale: fromValue }, { scale: toValue }];\n if (direction === 'exit') {\n keyframes.reverse();\n }\n return {\n keyframes,\n duration,\n easing,\n };\n};\n"],"names":["motionTokens","scaleAtom","direction","duration","easing","curveLinear","fromValue","toValue","keyframes","scale","reverse"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAAwCA,YAAY,QAAQ,yBAAyB;AAUrF;;;;;;;;CAQC,GACD,OAAO,MAAMC,YAAY,CAAC,EACxBC,SAAS,EACTC,QAAQ,EACRC,SAASJ,aAAaK,WAAW,EACjCC,YAAY,GAAG,EACfC,UAAU,CAAC,EACK;IAChB,MAAMC,YAAY;QAAC;YAAEC,OAAOH;QAAU;QAAG;YAAEG,OAAOF;QAAQ;KAAE;IAC5D,IAAIL,cAAc,QAAQ;QACxBM,UAAUE,OAAO;IACnB;IACA,OAAO;QACLF;QACAL;QACAC;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../src/atoms/scale-atom.ts"],"sourcesContent":["import { AtomMotion, PresenceDirection, motionTokens } from '@fluentui/react-motion';\n\ninterface ScaleAtomParams {\n direction: PresenceDirection;\n duration: number;\n easing?: string;\n fromScale?: number;\n toScale?: number;\n}\n\n/**\n * Generates a motion atom object for a scale in or scale out.\n * @param direction - The functional direction of the motion: 'enter' or 'exit'.\n * @param duration - The duration of the motion in milliseconds.\n * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.\n * @param fromScale - The starting scale value. Defaults to 0.9.\n * @param toScale - The ending scale value. Defaults to 1.\n * @returns A motion atom object with scale keyframes and the supplied duration and easing.\n */\nexport const scaleAtom = ({\n direction,\n duration,\n easing = motionTokens.curveLinear,\n fromScale = 0.9,\n toScale = 1,\n}: ScaleAtomParams): AtomMotion => {\n const keyframes = [{ scale: fromScale }, { scale: toScale }];\n if (direction === 'exit') {\n keyframes.reverse();\n }\n return {\n keyframes,\n duration,\n easing,\n };\n};\n"],"names":["motionTokens","scaleAtom","direction","duration","easing","curveLinear","fromScale","toScale","keyframes","scale","reverse"],"mappings":"AAAA,SAAwCA,YAAY,QAAQ,yBAAyB;AAUrF;;;;;;;;CAQC,GACD,OAAO,MAAMC,YAAY,CAAC,EACxBC,SAAS,EACTC,QAAQ,EACRC,SAASJ,aAAaK,WAAW,EACjCC,YAAY,GAAG,EACfC,UAAU,CAAC,EACK;IAChB,MAAMC,YAAY;QAAC;YAAEC,OAAOH;QAAU;QAAG;YAAEG,OAAOF;QAAQ;KAAE;IAC5D,IAAIL,cAAc,QAAQ;QACxBM,UAAUE,OAAO;IACnB;IACA,OAAO;QACLF;QACAL;QACAC;IACF;AACF,EAAE"}
@@ -0,0 +1,27 @@
1
+ import { motionTokens } from '@fluentui/react-motion';
2
+ /**
3
+ * Generates a motion atom object for a slide-in or slide-out.
4
+ * @param direction - The functional direction of the motion: 'enter' or 'exit'.
5
+ * @param duration - The duration of the motion in milliseconds.
6
+ * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.
7
+ * @param fromX - The starting X translate value with units (e.g., '0px', '100%'). Defaults to '0px'.
8
+ * @param fromY - The starting Y translate value with units (e.g., '-20px', '100%'). Defaults to '0px'.
9
+ * @returns A motion atom object with translate keyframes and the supplied duration and easing.
10
+ */ export const slideAtom = ({ direction, duration, easing = motionTokens.curveLinear, fromX = '0px', fromY = '20px' })=>{
11
+ const keyframes = [
12
+ {
13
+ translate: `${fromX} ${fromY}`
14
+ },
15
+ {
16
+ translate: '0px 0px'
17
+ }
18
+ ];
19
+ if (direction === 'exit') {
20
+ keyframes.reverse();
21
+ }
22
+ return {
23
+ keyframes,
24
+ duration,
25
+ easing
26
+ };
27
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/atoms/slide-atom.ts"],"sourcesContent":["import { AtomMotion, PresenceDirection, motionTokens } from '@fluentui/react-motion';\n\ninterface SlideAtomParams {\n direction: PresenceDirection;\n duration: number;\n easing?: string;\n fromX?: string;\n fromY?: string;\n}\n\n/**\n * Generates a motion atom object for a slide-in or slide-out.\n * @param direction - The functional direction of the motion: 'enter' or 'exit'.\n * @param duration - The duration of the motion in milliseconds.\n * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.\n * @param fromX - The starting X translate value with units (e.g., '0px', '100%'). Defaults to '0px'.\n * @param fromY - The starting Y translate value with units (e.g., '-20px', '100%'). Defaults to '0px'.\n * @returns A motion atom object with translate keyframes and the supplied duration and easing.\n */\nexport const slideAtom = ({\n direction,\n duration,\n easing = motionTokens.curveLinear,\n fromX = '0px',\n fromY = '20px',\n}: SlideAtomParams): AtomMotion => {\n const keyframes = [{ translate: `${fromX} ${fromY}` }, { translate: '0px 0px' }];\n if (direction === 'exit') {\n keyframes.reverse();\n }\n return {\n keyframes,\n duration,\n easing,\n };\n};\n"],"names":["motionTokens","slideAtom","direction","duration","easing","curveLinear","fromX","fromY","keyframes","translate","reverse"],"mappings":"AAAA,SAAwCA,YAAY,QAAQ,yBAAyB;AAUrF;;;;;;;;CAQC,GACD,OAAO,MAAMC,YAAY,CAAC,EACxBC,SAAS,EACTC,QAAQ,EACRC,SAASJ,aAAaK,WAAW,EACjCC,QAAQ,KAAK,EACbC,QAAQ,MAAM,EACE;IAChB,MAAMC,YAAY;QAAC;YAAEC,WAAW,GAAGH,MAAM,CAAC,EAAEC,OAAO;QAAC;QAAG;YAAEE,WAAW;QAAU;KAAE;IAChF,IAAIP,cAAc,QAAQ;QACxBM,UAAUE,OAAO;IACnB;IACA,OAAO;QACLF;QACAL;QACAC;IACF;AACF,EAAE"}
@@ -0,0 +1,48 @@
1
+ import { motionTokens, createPresenceComponent } from '@fluentui/react-motion';
2
+ import { fadeAtom } from '../../atoms/fade-atom';
3
+ import { blurAtom } from '../../atoms/blur-atom';
4
+ /**
5
+ * Define a presence motion for blur in/out
6
+ *
7
+ * @param fromRadius - The radius of pixels to blend into the blur. A length string, defaulting to '10px'.
8
+ * @param duration - Time (ms) for the enter transition (blur-in). Defaults to the `durationSlow` value (300 ms).
9
+ * @param easing - Easing curve for the enter transition (blur-in). Defaults to the `curveDecelerateMin` value.
10
+ * @param exitDuration - Time (ms) for the exit transition (blur-out). Defaults to the enter duration.
11
+ * @param exitEasing - Easing curve for the exit transition (blur-out). Defaults to the `curveAccelerateMin` value.
12
+ * @param animateOpacity - Whether to animate the opacity. Defaults to `true`.
13
+ */ const blurPresenceFn = ({ fromRadius = '10px', duration = motionTokens.durationSlow, easing = motionTokens.curveDecelerateMin, exitDuration = duration, exitEasing = motionTokens.curveAccelerateMin, animateOpacity = true })=>{
14
+ const enterAtoms = [
15
+ blurAtom({
16
+ direction: 'enter',
17
+ duration,
18
+ easing,
19
+ fromRadius
20
+ })
21
+ ];
22
+ const exitAtoms = [
23
+ blurAtom({
24
+ direction: 'exit',
25
+ duration: exitDuration,
26
+ easing: exitEasing,
27
+ fromRadius
28
+ })
29
+ ];
30
+ // Only add fade atoms if animateOpacity is true.
31
+ if (animateOpacity) {
32
+ enterAtoms.push(fadeAtom({
33
+ direction: 'enter',
34
+ duration,
35
+ easing
36
+ }));
37
+ exitAtoms.push(fadeAtom({
38
+ direction: 'exit',
39
+ duration: exitDuration,
40
+ easing: exitEasing
41
+ }));
42
+ }
43
+ return {
44
+ enter: enterAtoms,
45
+ exit: exitAtoms
46
+ };
47
+ };
48
+ /** A React component that applies blur in/out transitions to its children. */ export const Blur = createPresenceComponent(blurPresenceFn);
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Blur/Blur.ts"],"sourcesContent":["import { motionTokens, createPresenceComponent, PresenceMotionFn } from '@fluentui/react-motion';\nimport { fadeAtom } from '../../atoms/fade-atom';\nimport { blurAtom } from '../../atoms/blur-atom';\nimport { BlurParams } from './blur-types';\n\n/**\n * Define a presence motion for blur in/out\n *\n * @param fromRadius - The radius of pixels to blend into the blur. A length string, defaulting to '10px'.\n * @param duration - Time (ms) for the enter transition (blur-in). Defaults to the `durationSlow` value (300 ms).\n * @param easing - Easing curve for the enter transition (blur-in). Defaults to the `curveDecelerateMin` value.\n * @param exitDuration - Time (ms) for the exit transition (blur-out). Defaults to the enter duration.\n * @param exitEasing - Easing curve for the exit transition (blur-out). Defaults to the `curveAccelerateMin` value.\n * @param animateOpacity - Whether to animate the opacity. Defaults to `true`.\n */\nconst blurPresenceFn: PresenceMotionFn<BlurParams> = ({\n fromRadius = '10px',\n duration = motionTokens.durationSlow,\n easing = motionTokens.curveDecelerateMin,\n exitDuration = duration,\n exitEasing = motionTokens.curveAccelerateMin,\n animateOpacity = true,\n}) => {\n const enterAtoms = [blurAtom({ direction: 'enter', duration, easing, fromRadius })];\n const exitAtoms = [\n blurAtom({\n direction: 'exit',\n duration: exitDuration,\n easing: exitEasing,\n fromRadius,\n }),\n ];\n\n // Only add fade atoms if animateOpacity is true.\n if (animateOpacity) {\n enterAtoms.push(fadeAtom({ direction: 'enter', duration, easing }));\n exitAtoms.push(fadeAtom({ direction: 'exit', duration: exitDuration, easing: exitEasing }));\n }\n\n return {\n enter: enterAtoms,\n exit: exitAtoms,\n };\n};\n\n/** A React component that applies blur in/out transitions to its children. */\nexport const Blur = createPresenceComponent(blurPresenceFn);\n"],"names":["motionTokens","createPresenceComponent","fadeAtom","blurAtom","blurPresenceFn","fromRadius","duration","durationSlow","easing","curveDecelerateMin","exitDuration","exitEasing","curveAccelerateMin","animateOpacity","enterAtoms","direction","exitAtoms","push","enter","exit","Blur"],"mappings":"AAAA,SAASA,YAAY,EAAEC,uBAAuB,QAA0B,yBAAyB;AACjG,SAASC,QAAQ,QAAQ,wBAAwB;AACjD,SAASC,QAAQ,QAAQ,wBAAwB;AAGjD;;;;;;;;;CASC,GACD,MAAMC,iBAA+C,CAAC,EACpDC,aAAa,MAAM,EACnBC,WAAWN,aAAaO,YAAY,EACpCC,SAASR,aAAaS,kBAAkB,EACxCC,eAAeJ,QAAQ,EACvBK,aAAaX,aAAaY,kBAAkB,EAC5CC,iBAAiB,IAAI,EACtB;IACC,MAAMC,aAAa;QAACX,SAAS;YAAEY,WAAW;YAAST;YAAUE;YAAQH;QAAW;KAAG;IACnF,MAAMW,YAAY;QAChBb,SAAS;YACPY,WAAW;YACXT,UAAUI;YACVF,QAAQG;YACRN;QACF;KACD;IAED,iDAAiD;IACjD,IAAIQ,gBAAgB;QAClBC,WAAWG,IAAI,CAACf,SAAS;YAAEa,WAAW;YAAST;YAAUE;QAAO;QAChEQ,UAAUC,IAAI,CAACf,SAAS;YAAEa,WAAW;YAAQT,UAAUI;YAAcF,QAAQG;QAAW;IAC1F;IAEA,OAAO;QACLO,OAAOJ;QACPK,MAAMH;IACR;AACF;AAEA,4EAA4E,GAC5E,OAAO,MAAMI,OAAOnB,wBAAwBG,gBAAgB"}
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Blur/blur-types.ts"],"sourcesContent":["import type { PresenceDuration, PresenceEasing, AnimateOpacity } from '../../types';\n\nexport type BlurParams = PresenceDuration &\n PresenceEasing &\n AnimateOpacity & {\n /** The radius of pixels to blend into the blur. A length string, defaulting to '20px'. */\n fromRadius?: string;\n };\n"],"names":[],"mappings":"AAEA,WAKI"}
@@ -0,0 +1 @@
1
+ export { Blur } from './Blur';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Blur/index.ts"],"sourcesContent":["export { Blur } from './Blur';\nexport type { BlurParams } from './blur-types';\n"],"names":["Blur"],"mappings":"AAAA,SAASA,IAAI,QAAQ,SAAS"}
@@ -1,85 +1,125 @@
1
- import { motionTokens, createPresenceComponent } from '@fluentui/react-motion';
1
+ import { motionTokens, createPresenceComponent, createPresenceComponentVariant } from '@fluentui/react-motion';
2
2
  import { sizeEnterAtom, sizeExitAtom, whitespaceAtom } from './collapse-atoms';
3
3
  import { fadeAtom } from '../../atoms/fade-atom';
4
- /** Define a presence motion for collapse/expand that can stagger the size and opacity motions by a given delay. */ export const createCollapseDelayedPresence = ({ // enter
5
- enterSizeDuration = motionTokens.durationNormal, enterOpacityDuration = enterSizeDuration, enterEasing = motionTokens.curveEasyEaseMax, enterDelay = 0, // exit: durations and easing default to enter values for symmetry
6
- exitSizeDuration = enterSizeDuration, exitOpacityDuration = enterOpacityDuration, exitEasing = enterEasing, exitDelay = 0 } = {})=>({ element, animateOpacity = true, orientation = 'vertical' })=>{
7
- // ----- ENTER -----
8
- // The enter transition is an array of up to 3 motion atoms: size, whitespace and opacity.
9
- const enterAtoms = [
10
- sizeEnterAtom({
11
- orientation,
12
- duration: enterSizeDuration,
13
- easing: enterEasing,
14
- element
15
- }),
16
- whitespaceAtom({
17
- direction: 'enter',
18
- orientation,
19
- duration: enterSizeDuration,
20
- easing: enterEasing
21
- })
22
- ];
23
- // Fade in only if animateOpacity is true. Otherwise, leave opacity unaffected.
24
- if (animateOpacity) {
25
- enterAtoms.push({
26
- ...fadeAtom({
27
- direction: 'enter',
28
- duration: enterOpacityDuration,
29
- easing: enterEasing
30
- }),
31
- delay: enterDelay,
32
- fill: 'both'
33
- });
34
- }
35
- // ----- EXIT -----
36
- // The exit transition is an array of up to 3 motion atoms: opacity, size and whitespace.
37
- const exitAtoms = [];
38
- // Fade out only if animateOpacity is true. Otherwise, leave opacity unaffected.
39
- if (animateOpacity) {
40
- exitAtoms.push(fadeAtom({
41
- direction: 'exit',
42
- duration: exitOpacityDuration,
43
- easing: exitEasing
44
- }));
45
- }
46
- exitAtoms.push(sizeExitAtom({
4
+ /** Internal helper to create collapse atoms with shared logic */ function createCollapseAtoms({ element, orientation, animateOpacity, // Enter params
5
+ sizeDuration, opacityDuration = sizeDuration, easing, delay, // Exit params
6
+ exitSizeDuration, exitOpacityDuration = exitSizeDuration, exitEasing, exitDelay }) {
7
+ // ----- ENTER -----
8
+ // The enter transition is an array of up to 3 motion atoms: size, whitespace and opacity.
9
+ const enterAtoms = [
10
+ sizeEnterAtom({
47
11
  orientation,
48
- duration: exitSizeDuration,
49
- easing: exitEasing,
50
- element,
51
- delay: exitDelay
52
- }), whitespaceAtom({
53
- direction: 'exit',
12
+ duration: sizeDuration,
13
+ easing,
14
+ element
15
+ }),
16
+ whitespaceAtom({
17
+ direction: 'enter',
54
18
  orientation,
55
- duration: exitSizeDuration,
56
- easing: exitEasing,
57
- delay: exitDelay
19
+ duration: sizeDuration,
20
+ easing
21
+ })
22
+ ];
23
+ // Fade in only if animateOpacity is true. Otherwise, leave opacity unaffected.
24
+ if (animateOpacity) {
25
+ enterAtoms.push({
26
+ ...fadeAtom({
27
+ direction: 'enter',
28
+ duration: opacityDuration,
29
+ easing
30
+ }),
31
+ delay,
32
+ fill: 'both'
33
+ });
34
+ }
35
+ // ----- EXIT -----
36
+ // The exit transition is an array of up to 3 motion atoms: opacity, size and whitespace.
37
+ const exitAtoms = [];
38
+ // Fade out only if animateOpacity is true. Otherwise, leave opacity unaffected.
39
+ if (animateOpacity) {
40
+ exitAtoms.push(fadeAtom({
41
+ direction: 'exit',
42
+ duration: exitOpacityDuration,
43
+ easing: exitEasing
58
44
  }));
59
- return {
60
- enter: enterAtoms,
61
- exit: exitAtoms
62
- };
45
+ }
46
+ exitAtoms.push(sizeExitAtom({
47
+ orientation,
48
+ duration: exitSizeDuration,
49
+ easing: exitEasing,
50
+ element,
51
+ delay: exitDelay
52
+ }), whitespaceAtom({
53
+ direction: 'exit',
54
+ orientation,
55
+ duration: exitSizeDuration,
56
+ easing: exitEasing,
57
+ delay: exitDelay
58
+ }));
59
+ return {
60
+ enter: enterAtoms,
61
+ exit: exitAtoms
63
62
  };
64
- /** Defines a presence motion for collapse/expand. */ export const createCollapsePresence = ({ enterDuration = motionTokens.durationNormal, enterEasing = motionTokens.curveEasyEaseMax, exitDuration = enterDuration, exitEasing = enterEasing } = {})=>// Implement a regular collapse as a special case of the delayed collapse,
65
- // where the delays are zero, and the size and opacity durations are equal.
66
- createCollapseDelayedPresence({
67
- enterSizeDuration: enterDuration,
68
- enterEasing,
63
+ }
64
+ /**
65
+ * Define a presence motion for collapse/expand
66
+ *
67
+ * @param element - The element to apply the collapse motion to
68
+ * @param duration - Time (ms) for the enter transition (expand). Defaults to the `durationNormal` value (200 ms)
69
+ * @param easing - Easing curve for the enter transition. Defaults to the `curveEasyEaseMax` value
70
+ * @param exitDuration - Time (ms) for the exit transition (collapse). Defaults to the `duration` param for symmetry
71
+ * @param exitEasing - Easing curve for the exit transition. Defaults to the `easing` param for symmetry
72
+ * @param animateOpacity - Whether to animate the opacity. Defaults to `true`
73
+ * @param orientation - The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height
74
+ */ const collapsePresenceFn = ({ element, duration = motionTokens.durationNormal, easing = motionTokens.curveEasyEaseMax, exitDuration = duration, exitEasing = easing, animateOpacity = true, orientation = 'vertical' })=>{
75
+ return createCollapseAtoms({
76
+ element,
77
+ orientation,
78
+ animateOpacity,
79
+ sizeDuration: duration,
80
+ opacityDuration: duration,
81
+ easing,
69
82
  exitSizeDuration: exitDuration,
70
- exitEasing
83
+ exitOpacityDuration: exitDuration,
84
+ exitEasing,
85
+ delay: 0,
86
+ exitDelay: 0
87
+ });
88
+ };
89
+ /**
90
+ * Define a presence motion for collapse/expand that can stagger the size and opacity motions by a given delay
91
+ *
92
+ * @param element - The element to apply the collapse motion to
93
+ * @param sizeDuration - Time (ms) for the size expand. Defaults to the `durationNormal` value (200 ms)
94
+ * @param opacityDuration - Time (ms) for the fade-in. Defaults to the `durationSlower` value (400 ms)
95
+ * @param easing - Easing curve for the enter transition. Defaults to the `curveEasyEase` value
96
+ * @param delay - Time (ms) between the size expand start and the fade-in start. Defaults to the `durationNormal` value (200 ms)
97
+ * @param exitSizeDuration - Time (ms) for the size collapse. Defaults to the `sizeDuration` param for temporal symmetry
98
+ * @param exitOpacityDuration - Time (ms) for the fade-out. Defaults to the `opacityDuration` param for temporal symmetry
99
+ * @param exitEasing - Easing curve for the exit transition. Defaults to the `easing` param for symmetry
100
+ * @param exitDelay - Time (ms) between the fade-out start and the size collapse start. Defaults to the `durationSlower` value (400 ms)
101
+ * @param animateOpacity - Whether to animate the opacity. Defaults to `true`
102
+ * @param orientation - The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height
103
+ */ const collapseDelayedPresenceFn = ({ element, sizeDuration = motionTokens.durationNormal, opacityDuration = motionTokens.durationSlower, easing = motionTokens.curveEasyEase, delay = motionTokens.durationNormal, exitSizeDuration = sizeDuration, exitOpacityDuration = opacityDuration, exitEasing = easing, exitDelay = motionTokens.durationSlower, animateOpacity = true, orientation = 'vertical' })=>{
104
+ return createCollapseAtoms({
105
+ element,
106
+ orientation,
107
+ animateOpacity,
108
+ sizeDuration,
109
+ opacityDuration,
110
+ easing,
111
+ delay,
112
+ exitSizeDuration,
113
+ exitOpacityDuration,
114
+ exitEasing,
115
+ exitDelay
71
116
  });
72
- /** A React component that applies collapse/expand transitions to its children. */ export const Collapse = createPresenceComponent(createCollapsePresence());
73
- export const CollapseSnappy = createPresenceComponent(createCollapsePresence({
74
- enterDuration: motionTokens.durationFast
75
- }));
76
- export const CollapseRelaxed = createPresenceComponent(createCollapsePresence({
77
- enterDuration: motionTokens.durationSlower
78
- }));
79
- export const CollapseDelayed = createPresenceComponent(createCollapseDelayedPresence({
80
- enterSizeDuration: motionTokens.durationNormal,
81
- enterOpacityDuration: motionTokens.durationSlower,
82
- enterDelay: motionTokens.durationNormal,
83
- exitDelay: motionTokens.durationSlower,
84
- enterEasing: motionTokens.curveEasyEase
85
- }));
117
+ };
118
+ /** A React component that applies collapse/expand transitions to its children. */ export const Collapse = createPresenceComponent(collapsePresenceFn);
119
+ export const CollapseSnappy = createPresenceComponentVariant(Collapse, {
120
+ duration: motionTokens.durationFast
121
+ });
122
+ export const CollapseRelaxed = createPresenceComponentVariant(Collapse, {
123
+ duration: motionTokens.durationSlower
124
+ });
125
+ /** A React component that applies collapse/expand transitions with delayed fade to its children. */ export const CollapseDelayed = createPresenceComponent(collapseDelayedPresenceFn);