@fluentui/react-motion-components-preview 0.8.2 → 0.10.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/CHANGELOG.md +26 -1
- package/dist/index.d.ts +50 -10
- package/lib/atoms/blur-atom.js +3 -2
- package/lib/atoms/blur-atom.js.map +1 -1
- package/lib/atoms/fade-atom.js +8 -3
- package/lib/atoms/fade-atom.js.map +1 -1
- package/lib/atoms/rotate-atom.js +35 -0
- package/lib/atoms/rotate-atom.js.map +1 -0
- package/lib/atoms/scale-atom.js +3 -2
- package/lib/atoms/scale-atom.js.map +1 -1
- package/lib/atoms/slide-atom.js +3 -2
- package/lib/atoms/slide-atom.js.map +1 -1
- package/lib/components/Blur/Blur.js +11 -5
- package/lib/components/Blur/Blur.js.map +1 -1
- package/lib/components/Blur/blur-types.js.map +1 -1
- package/lib/components/Collapse/collapse-types.js.map +1 -1
- package/lib/components/Collapse/index.js.map +1 -1
- package/lib/components/Fade/Fade.js +7 -3
- package/lib/components/Fade/Fade.js.map +1 -1
- package/lib/components/Fade/fade-types.js.map +1 -1
- package/lib/components/Fade/index.js.map +1 -1
- package/lib/components/Rotate/Rotate.js +60 -0
- package/lib/components/Rotate/Rotate.js.map +1 -0
- package/lib/components/Rotate/index.js +1 -0
- package/lib/components/Rotate/index.js.map +1 -0
- package/lib/components/Rotate/rotate-types.js +1 -0
- package/lib/components/Rotate/rotate-types.js.map +1 -0
- package/lib/components/Scale/Scale.js +10 -4
- package/lib/components/Scale/Scale.js.map +1 -1
- package/lib/components/Scale/index.js.map +1 -1
- package/lib/components/Scale/scale-types.js.map +1 -1
- package/lib/components/Slide/Slide.js +9 -3
- package/lib/components/Slide/Slide.js.map +1 -1
- package/lib/components/Slide/index.js.map +1 -1
- package/lib/components/Slide/slide-types.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types.js +1 -1
- package/lib/types.js.map +1 -1
- package/lib-commonjs/atoms/blur-atom.js +3 -2
- package/lib-commonjs/atoms/blur-atom.js.map +1 -1
- package/lib-commonjs/atoms/fade-atom.js +6 -2
- package/lib-commonjs/atoms/fade-atom.js.map +1 -1
- package/lib-commonjs/atoms/rotate-atom.js +36 -0
- package/lib-commonjs/atoms/rotate-atom.js.map +1 -0
- package/lib-commonjs/atoms/scale-atom.js +3 -2
- package/lib-commonjs/atoms/scale-atom.js.map +1 -1
- package/lib-commonjs/atoms/slide-atom.js +3 -2
- package/lib-commonjs/atoms/slide-atom.js.map +1 -1
- package/lib-commonjs/components/Blur/Blur.js +11 -5
- package/lib-commonjs/components/Blur/Blur.js.map +1 -1
- package/lib-commonjs/components/Collapse/index.js.map +1 -1
- package/lib-commonjs/components/Fade/Fade.js +5 -3
- package/lib-commonjs/components/Fade/Fade.js.map +1 -1
- package/lib-commonjs/components/Fade/index.js.map +1 -1
- package/lib-commonjs/components/Rotate/Rotate.js +69 -0
- package/lib-commonjs/components/Rotate/Rotate.js.map +1 -0
- package/lib-commonjs/components/Rotate/index.js +11 -0
- package/lib-commonjs/components/Rotate/index.js.map +1 -0
- package/lib-commonjs/components/Rotate/rotate-types.js +4 -0
- package/lib-commonjs/components/Rotate/rotate-types.js.map +1 -0
- package/lib-commonjs/components/Scale/Scale.js +10 -4
- package/lib-commonjs/components/Scale/Scale.js.map +1 -1
- package/lib-commonjs/components/Scale/index.js.map +1 -1
- package/lib-commonjs/components/Slide/Slide.js +9 -3
- package/lib-commonjs/components/Slide/Slide.js.map +1 -1
- package/lib-commonjs/components/Slide/index.js.map +1 -1
- package/lib-commonjs/index.js +4 -0
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,34 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-motion-components-preview
|
|
2
2
|
|
|
3
|
-
This log was last generated on Mon,
|
|
3
|
+
This log was last generated on Mon, 08 Sep 2025 12:41:49 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [0.10.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion-components-preview_v0.10.0)
|
|
8
|
+
|
|
9
|
+
Mon, 08 Sep 2025 12:41:49 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-motion-components-preview_v0.9.0..@fluentui/react-motion-components-preview_v0.10.0)
|
|
11
|
+
|
|
12
|
+
### Minor changes
|
|
13
|
+
|
|
14
|
+
- feat(motion): add delay parameter to motion components ([PR #35077](https://github.com/microsoft/fluentui/pull/35077) by robertpenner@microsoft.com)
|
|
15
|
+
|
|
16
|
+
### Patches
|
|
17
|
+
|
|
18
|
+
- refactor(motion): normalize motion atom parameters & types ([PR #35076](https://github.com/microsoft/fluentui/pull/35076) by robertpenner@microsoft.com)
|
|
19
|
+
- fix(motion): apply opacity in animations using fill mode ([PR #35078](https://github.com/microsoft/fluentui/pull/35078) by robertpenner@microsoft.com)
|
|
20
|
+
- test(motion): expand motion atom testing ([PR #35079](https://github.com/microsoft/fluentui/pull/35079) by robertpenner@microsoft.com)
|
|
21
|
+
- chore: extend peer dependencies versions to support React 19 ([PR #35145](https://github.com/microsoft/fluentui/pull/35145) by dmytrokirpa@microsoft.com)
|
|
22
|
+
|
|
23
|
+
## [0.9.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion-components-preview_v0.9.0)
|
|
24
|
+
|
|
25
|
+
Thu, 21 Aug 2025 12:25:13 GMT
|
|
26
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-motion-components-preview_v0.8.1..@fluentui/react-motion-components-preview_v0.9.0)
|
|
27
|
+
|
|
28
|
+
### Minor changes
|
|
29
|
+
|
|
30
|
+
- feat(motion): add Rotate presence motion component ([PR #34928](https://github.com/microsoft/fluentui/pull/34928) by robertpenner@microsoft.com)
|
|
31
|
+
|
|
7
32
|
## [0.8.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion-components-preview_v0.8.0)
|
|
8
33
|
|
|
9
34
|
Mon, 28 Jul 2025 18:48:19 GMT
|
package/dist/index.d.ts
CHANGED
|
@@ -8,10 +8,17 @@ declare type AnimateOpacity = {
|
|
|
8
8
|
animateOpacity?: boolean;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
+
declare type Axis3D = 'x' | 'y' | 'z';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Base presence parameters combining duration, easing, and delay for motion components.
|
|
15
|
+
*/
|
|
16
|
+
declare type BasePresenceParams = PresenceDuration & PresenceEasing & PresenceDelay;
|
|
17
|
+
|
|
11
18
|
/** A React component that applies blur in/out transitions to its children. */
|
|
12
19
|
export declare const Blur: PresenceComponent<BlurParams>;
|
|
13
20
|
|
|
14
|
-
declare type BlurParams =
|
|
21
|
+
export declare type BlurParams = BasePresenceParams & AnimateOpacity & {
|
|
15
22
|
/** The radius of pixels to blend into the blur. A length string, defaulting to '20px'. */
|
|
16
23
|
fromRadius?: string;
|
|
17
24
|
};
|
|
@@ -20,7 +27,7 @@ declare type BlurParams = PresenceDuration & PresenceEasing & AnimateOpacity & {
|
|
|
20
27
|
export declare const Collapse: PresenceComponent<CollapseParams>;
|
|
21
28
|
|
|
22
29
|
/** Common properties shared by all collapse components */
|
|
23
|
-
declare type CollapseBaseParams = PresenceEasing & AnimateOpacity & {
|
|
30
|
+
declare type CollapseBaseParams = PresenceEasing & PresenceDelay & AnimateOpacity & {
|
|
24
31
|
/** The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height. */
|
|
25
32
|
orientation?: CollapseOrientation;
|
|
26
33
|
};
|
|
@@ -28,7 +35,7 @@ declare type CollapseBaseParams = PresenceEasing & AnimateOpacity & {
|
|
|
28
35
|
/** A React component that applies collapse/expand transitions with delayed fade to its children. */
|
|
29
36
|
export declare const CollapseDelayed: PresenceComponent<CollapseDelayedParams>;
|
|
30
37
|
|
|
31
|
-
declare type CollapseDelayedParams = CollapseBaseParams & {
|
|
38
|
+
export declare type CollapseDelayedParams = CollapseBaseParams & {
|
|
32
39
|
/** Time (ms) for the size expand. Defaults to the `durationNormal` value (200 ms). */
|
|
33
40
|
sizeDuration?: number;
|
|
34
41
|
/** Time (ms) for the fade-in. Defaults to the `sizeDuration` param, to sync fade-in with expand. */
|
|
@@ -45,20 +52,33 @@ declare type CollapseDelayedParams = CollapseBaseParams & {
|
|
|
45
52
|
|
|
46
53
|
declare type CollapseOrientation = 'horizontal' | 'vertical';
|
|
47
54
|
|
|
48
|
-
declare type CollapseParams =
|
|
55
|
+
export declare type CollapseParams = BasePresenceParams & AnimateOpacity & {
|
|
56
|
+
/** The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height. */
|
|
57
|
+
orientation?: CollapseOrientation;
|
|
58
|
+
};
|
|
49
59
|
|
|
50
60
|
export declare const CollapseRelaxed: PresenceComponent<CollapseParams>;
|
|
51
61
|
|
|
52
62
|
export declare const CollapseSnappy: PresenceComponent<CollapseParams>;
|
|
53
63
|
|
|
54
64
|
/** A React component that applies fade in/out transitions to its children. */
|
|
55
|
-
export declare const Fade: PresenceComponent<
|
|
65
|
+
export declare const Fade: PresenceComponent<BasePresenceParams>;
|
|
56
66
|
|
|
57
|
-
declare type FadeParams =
|
|
67
|
+
export declare type FadeParams = BasePresenceParams;
|
|
58
68
|
|
|
59
|
-
export declare const FadeRelaxed: PresenceComponent<
|
|
69
|
+
export declare const FadeRelaxed: PresenceComponent<BasePresenceParams>;
|
|
60
70
|
|
|
61
|
-
export declare const FadeSnappy: PresenceComponent<
|
|
71
|
+
export declare const FadeSnappy: PresenceComponent<BasePresenceParams>;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Common delay parameters for presence motion components.
|
|
75
|
+
*/
|
|
76
|
+
declare type PresenceDelay = {
|
|
77
|
+
/** Time (ms) to delay the enter transition. */
|
|
78
|
+
delay?: EffectTiming['delay'];
|
|
79
|
+
/** Time (ms) to delay the exit transition. Defaults to the `delay` param for symmetry. */
|
|
80
|
+
exitDelay?: EffectTiming['delay'];
|
|
81
|
+
};
|
|
62
82
|
|
|
63
83
|
/**
|
|
64
84
|
* Common duration parameters for presence motion components.
|
|
@@ -80,10 +100,30 @@ declare type PresenceEasing = {
|
|
|
80
100
|
exitEasing?: string;
|
|
81
101
|
};
|
|
82
102
|
|
|
103
|
+
export declare const Rotate: PresenceComponent<RotateParams>;
|
|
104
|
+
|
|
105
|
+
export declare type RotateParams = BasePresenceParams & AnimateOpacity & {
|
|
106
|
+
/**
|
|
107
|
+
* The axis of rotation: 'x', 'y', or 'z'.
|
|
108
|
+
* Defaults to 'y'.
|
|
109
|
+
*/
|
|
110
|
+
axis?: Axis3D;
|
|
111
|
+
/**
|
|
112
|
+
* The starting rotation angle in degrees.
|
|
113
|
+
* Defaults to -90.
|
|
114
|
+
*/
|
|
115
|
+
angle?: number;
|
|
116
|
+
/**
|
|
117
|
+
* The ending rotation angle in degrees.
|
|
118
|
+
* Defaults to the negation of `angle`.
|
|
119
|
+
*/
|
|
120
|
+
exitAngle?: number;
|
|
121
|
+
};
|
|
122
|
+
|
|
83
123
|
/** A React component that applies scale in/out transitions to its children. */
|
|
84
124
|
export declare const Scale: PresenceComponent<ScaleParams>;
|
|
85
125
|
|
|
86
|
-
declare type ScaleParams =
|
|
126
|
+
export declare type ScaleParams = BasePresenceParams & AnimateOpacity & {
|
|
87
127
|
/** The scale value to animate from. Defaults to `0.9`. */
|
|
88
128
|
fromScale?: number;
|
|
89
129
|
};
|
|
@@ -95,7 +135,7 @@ export declare const ScaleSnappy: PresenceComponent<ScaleParams>;
|
|
|
95
135
|
/** A React component that applies slide in/out transitions to its children. */
|
|
96
136
|
export declare const Slide: PresenceComponent<SlideParams>;
|
|
97
137
|
|
|
98
|
-
declare type SlideParams =
|
|
138
|
+
export declare type SlideParams = BasePresenceParams & AnimateOpacity & {
|
|
99
139
|
/** The X translate value with units to animate from. Defaults to `'0px'`. */
|
|
100
140
|
fromX?: string;
|
|
101
141
|
/** The Y translate value with units to animate from. Defaults to `'20px'`. */
|
package/lib/atoms/blur-atom.js
CHANGED
|
@@ -6,7 +6,7 @@ import { motionTokens } from '@fluentui/react-motion';
|
|
|
6
6
|
* @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.
|
|
7
7
|
* @param fromRadius - The blur radius value with units (e.g., '20px', '1rem'). Defaults to '20px'.
|
|
8
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' })=>{
|
|
9
|
+
*/ export const blurAtom = ({ direction, duration, easing = motionTokens.curveLinear, delay = 0, fromRadius = '10px' })=>{
|
|
10
10
|
const keyframes = [
|
|
11
11
|
{
|
|
12
12
|
filter: `blur(${fromRadius})`
|
|
@@ -21,6 +21,7 @@ import { motionTokens } from '@fluentui/react-motion';
|
|
|
21
21
|
return {
|
|
22
22
|
keyframes,
|
|
23
23
|
duration,
|
|
24
|
-
easing
|
|
24
|
+
easing,
|
|
25
|
+
delay
|
|
25
26
|
};
|
|
26
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/atoms/blur-atom.ts"],"sourcesContent":["import { AtomMotion,
|
|
1
|
+
{"version":3,"sources":["../src/atoms/blur-atom.ts"],"sourcesContent":["import { AtomMotion, motionTokens } from '@fluentui/react-motion';\nimport { BaseAtomParams } from '../types';\n\ninterface BlurAtomParams extends BaseAtomParams {\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 delay = 0,\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 delay,\n };\n};\n"],"names":["motionTokens","blurAtom","direction","duration","easing","curveLinear","delay","fromRadius","keyframes","filter","reverse"],"mappings":"AAAA,SAAqBA,YAAY,QAAQ,yBAAyB;AAOlE;;;;;;;CAOC,GACD,OAAO,MAAMC,WAAW,CAAC,EACvBC,SAAS,EACTC,QAAQ,EACRC,SAASJ,aAAaK,WAAW,EACjCC,QAAQ,CAAC,EACTC,aAAa,MAAM,EACJ;IACf,MAAMC,YAAY;QAAC;YAAEC,QAAQ,CAAC,KAAK,EAAEF,WAAW,CAAC,CAAC;QAAC;QAAG;YAAEE,QAAQ;QAAY;KAAE;IAC9E,IAAIP,cAAc,QAAQ;QACxBM,UAAUE,OAAO;IACnB;IACA,OAAO;QACLF;QACAL;QACAC;QACAE;IACF;AACF,EAAE"}
|
package/lib/atoms/fade-atom.js
CHANGED
|
@@ -4,9 +4,10 @@ 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
|
|
7
|
+
* @param delay - The delay before the motion starts. Defaults to 0.
|
|
8
|
+
* @param fromOpacity - The starting opacity value. Defaults to 0.
|
|
8
9
|
* @returns A motion atom object with opacity keyframes and the supplied duration and easing.
|
|
9
|
-
*/ export const fadeAtom = ({ direction, duration, easing = motionTokens.curveLinear, fromOpacity = 0 })=>{
|
|
10
|
+
*/ export const fadeAtom = ({ direction, duration, easing = motionTokens.curveLinear, delay = 0, fromOpacity = 0 })=>{
|
|
10
11
|
const keyframes = [
|
|
11
12
|
{
|
|
12
13
|
opacity: fromOpacity
|
|
@@ -21,6 +22,10 @@ import { motionTokens } from '@fluentui/react-motion';
|
|
|
21
22
|
return {
|
|
22
23
|
keyframes,
|
|
23
24
|
duration,
|
|
24
|
-
easing
|
|
25
|
+
easing,
|
|
26
|
+
delay,
|
|
27
|
+
// Applying opacity backwards and forwards in time is important
|
|
28
|
+
// to avoid a bug where a delayed animation is not hidden when it should be.
|
|
29
|
+
fill: 'both'
|
|
25
30
|
};
|
|
26
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/atoms/fade-atom.ts"],"sourcesContent":["import { AtomMotion,
|
|
1
|
+
{"version":3,"sources":["../src/atoms/fade-atom.ts"],"sourcesContent":["import { AtomMotion, motionTokens } from '@fluentui/react-motion';\nimport { BaseAtomParams } from '../types';\n\ninterface FadeAtomParams extends BaseAtomParams {\n /** Defines how values are applied before and after execution. Defaults to 'both'. */\n fill?: FillMode;\n\n /** The starting opacity value. Defaults to 0. */\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 delay - The delay before the motion starts. Defaults to 0.\n * @param fromOpacity - 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 delay = 0,\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 delay,\n // Applying opacity backwards and forwards in time is important\n // to avoid a bug where a delayed animation is not hidden when it should be.\n fill: 'both',\n };\n};\n"],"names":["motionTokens","fadeAtom","direction","duration","easing","curveLinear","delay","fromOpacity","keyframes","opacity","reverse","fill"],"mappings":"AAAA,SAAqBA,YAAY,QAAQ,yBAAyB;AAWlE;;;;;;;;CAQC,GACD,OAAO,MAAMC,WAAW,CAAC,EACvBC,SAAS,EACTC,QAAQ,EACRC,SAASJ,aAAaK,WAAW,EACjCC,QAAQ,CAAC,EACTC,cAAc,CAAC,EACA;IACf,MAAMC,YAAY;QAAC;YAAEC,SAASF;QAAY;QAAG;YAAEE,SAAS;QAAE;KAAE;IAC5D,IAAIP,cAAc,QAAQ;QACxBM,UAAUE,OAAO;IACnB;IACA,OAAO;QACLF;QACAL;QACAC;QACAE;QACA,+DAA+D;QAC/D,4EAA4E;QAC5EK,MAAM;IACR;AACF,EAAE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { motionTokens } from '@fluentui/react-motion';
|
|
2
|
+
const createRotateValue = (axis, angle)=>{
|
|
3
|
+
return `${axis.toLowerCase()} ${angle}deg`;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Generates a motion atom object for a rotation around a single axis.
|
|
7
|
+
* @param direction - The functional direction of the motion: 'enter' or 'exit'.
|
|
8
|
+
* @param duration - The duration of the motion in milliseconds.
|
|
9
|
+
* @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.
|
|
10
|
+
* @param axis - The axis of rotation: 'x', 'y', or 'z'. Defaults to 'y'.
|
|
11
|
+
* @param angle - The starting rotation angle in degrees. Defaults to -90.
|
|
12
|
+
* @param exitAngle - The ending rotation angle in degrees. Defaults to the negation of `angle`.
|
|
13
|
+
* @returns A motion atom object with rotate keyframes and the supplied duration and easing.
|
|
14
|
+
*/ export const rotateAtom = ({ direction, duration, easing = motionTokens.curveLinear, delay = 0, axis = 'y', angle = -90, exitAngle = -angle })=>{
|
|
15
|
+
let fromAngle = angle;
|
|
16
|
+
let toAngle = 0;
|
|
17
|
+
if (direction === 'exit') {
|
|
18
|
+
fromAngle = 0;
|
|
19
|
+
toAngle = exitAngle;
|
|
20
|
+
}
|
|
21
|
+
const keyframes = [
|
|
22
|
+
{
|
|
23
|
+
rotate: createRotateValue(axis, fromAngle)
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
rotate: createRotateValue(axis, toAngle)
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
return {
|
|
30
|
+
keyframes,
|
|
31
|
+
duration,
|
|
32
|
+
easing,
|
|
33
|
+
delay
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/atoms/rotate-atom.ts"],"sourcesContent":["import { AtomMotion, motionTokens } from '@fluentui/react-motion';\nimport type { RotateParams } from '../components/Rotate/rotate-types';\nimport { BaseAtomParams } from '../types';\n\ntype Axis3D = NonNullable<RotateParams['axis']>;\n\ninterface RotateAtomParams extends BaseAtomParams {\n axis?: Axis3D;\n angle?: number;\n exitAngle?: number;\n}\n\nconst createRotateValue = (axis: Axis3D, angle: number): string => {\n return `${axis.toLowerCase()} ${angle}deg`;\n};\n\n/**\n * Generates a motion atom object for a rotation around a single axis.\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 axis - The axis of rotation: 'x', 'y', or 'z'. Defaults to 'y'.\n * @param angle - The starting rotation angle in degrees. Defaults to -90.\n * @param exitAngle - The ending rotation angle in degrees. Defaults to the negation of `angle`.\n * @returns A motion atom object with rotate keyframes and the supplied duration and easing.\n */\nexport const rotateAtom = ({\n direction,\n duration,\n easing = motionTokens.curveLinear,\n delay = 0,\n axis = 'y',\n angle = -90,\n exitAngle = -angle,\n}: RotateAtomParams): AtomMotion => {\n let fromAngle = angle;\n let toAngle = 0;\n\n if (direction === 'exit') {\n fromAngle = 0;\n toAngle = exitAngle;\n }\n const keyframes = [{ rotate: createRotateValue(axis, fromAngle) }, { rotate: createRotateValue(axis, toAngle) }];\n\n return {\n keyframes,\n duration,\n easing,\n delay,\n };\n};\n"],"names":["motionTokens","createRotateValue","axis","angle","toLowerCase","rotateAtom","direction","duration","easing","curveLinear","delay","exitAngle","fromAngle","toAngle","keyframes","rotate"],"mappings":"AAAA,SAAqBA,YAAY,QAAQ,yBAAyB;AAYlE,MAAMC,oBAAoB,CAACC,MAAcC;IACvC,OAAO,GAAGD,KAAKE,WAAW,GAAG,CAAC,EAAED,MAAM,GAAG,CAAC;AAC5C;AAEA;;;;;;;;;CASC,GACD,OAAO,MAAME,aAAa,CAAC,EACzBC,SAAS,EACTC,QAAQ,EACRC,SAASR,aAAaS,WAAW,EACjCC,QAAQ,CAAC,EACTR,OAAO,GAAG,EACVC,QAAQ,CAAC,EAAE,EACXQ,YAAY,CAACR,KAAK,EACD;IACjB,IAAIS,YAAYT;IAChB,IAAIU,UAAU;IAEd,IAAIP,cAAc,QAAQ;QACxBM,YAAY;QACZC,UAAUF;IACZ;IACA,MAAMG,YAAY;QAAC;YAAEC,QAAQd,kBAAkBC,MAAMU;QAAW;QAAG;YAAEG,QAAQd,kBAAkBC,MAAMW;QAAS;KAAE;IAEhH,OAAO;QACLC;QACAP;QACAC;QACAE;IACF;AACF,EAAE"}
|
package/lib/atoms/scale-atom.js
CHANGED
|
@@ -7,7 +7,7 @@ import { motionTokens } from '@fluentui/react-motion';
|
|
|
7
7
|
* @param fromScale - The starting scale value. Defaults to 0.9.
|
|
8
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, fromScale = 0.9, toScale = 1 })=>{
|
|
10
|
+
*/ export const scaleAtom = ({ direction, duration, easing = motionTokens.curveLinear, delay = 0, fromScale = 0.9, toScale = 1 })=>{
|
|
11
11
|
const keyframes = [
|
|
12
12
|
{
|
|
13
13
|
scale: fromScale
|
|
@@ -22,6 +22,7 @@ import { motionTokens } from '@fluentui/react-motion';
|
|
|
22
22
|
return {
|
|
23
23
|
keyframes,
|
|
24
24
|
duration,
|
|
25
|
-
easing
|
|
25
|
+
easing,
|
|
26
|
+
delay
|
|
26
27
|
};
|
|
27
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/atoms/scale-atom.ts"],"sourcesContent":["import { AtomMotion,
|
|
1
|
+
{"version":3,"sources":["../src/atoms/scale-atom.ts"],"sourcesContent":["import { AtomMotion, motionTokens } from '@fluentui/react-motion';\nimport { BaseAtomParams } from '../types';\n\ninterface ScaleAtomParams extends BaseAtomParams {\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 delay = 0,\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 delay,\n };\n};\n"],"names":["motionTokens","scaleAtom","direction","duration","easing","curveLinear","delay","fromScale","toScale","keyframes","scale","reverse"],"mappings":"AAAA,SAAqBA,YAAY,QAAQ,yBAAyB;AAQlE;;;;;;;;CAQC,GACD,OAAO,MAAMC,YAAY,CAAC,EACxBC,SAAS,EACTC,QAAQ,EACRC,SAASJ,aAAaK,WAAW,EACjCC,QAAQ,CAAC,EACTC,YAAY,GAAG,EACfC,UAAU,CAAC,EACK;IAChB,MAAMC,YAAY;QAAC;YAAEC,OAAOH;QAAU;QAAG;YAAEG,OAAOF;QAAQ;KAAE;IAC5D,IAAIN,cAAc,QAAQ;QACxBO,UAAUE,OAAO;IACnB;IACA,OAAO;QACLF;QACAN;QACAC;QACAE;IACF;AACF,EAAE"}
|
package/lib/atoms/slide-atom.js
CHANGED
|
@@ -7,7 +7,7 @@ import { motionTokens } from '@fluentui/react-motion';
|
|
|
7
7
|
* @param fromX - The starting X translate value with units (e.g., '0px', '100%'). Defaults to '0px'.
|
|
8
8
|
* @param fromY - The starting Y translate value with units (e.g., '-20px', '100%'). Defaults to '0px'.
|
|
9
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' })=>{
|
|
10
|
+
*/ export const slideAtom = ({ direction, duration, easing = motionTokens.curveLinear, delay = 0, fromX = '0px', fromY = '20px' })=>{
|
|
11
11
|
const keyframes = [
|
|
12
12
|
{
|
|
13
13
|
translate: `${fromX} ${fromY}`
|
|
@@ -22,6 +22,7 @@ import { motionTokens } from '@fluentui/react-motion';
|
|
|
22
22
|
return {
|
|
23
23
|
keyframes,
|
|
24
24
|
duration,
|
|
25
|
-
easing
|
|
25
|
+
easing,
|
|
26
|
+
delay
|
|
26
27
|
};
|
|
27
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/atoms/slide-atom.ts"],"sourcesContent":["import { AtomMotion,
|
|
1
|
+
{"version":3,"sources":["../src/atoms/slide-atom.ts"],"sourcesContent":["import { AtomMotion, motionTokens } from '@fluentui/react-motion';\nimport { BaseAtomParams } from '../types';\n\ninterface SlideAtomParams extends BaseAtomParams {\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 delay = 0,\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 delay,\n };\n};\n"],"names":["motionTokens","slideAtom","direction","duration","easing","curveLinear","delay","fromX","fromY","keyframes","translate","reverse"],"mappings":"AAAA,SAAqBA,YAAY,QAAQ,yBAAyB;AAQlE;;;;;;;;CAQC,GACD,OAAO,MAAMC,YAAY,CAAC,EACxBC,SAAS,EACTC,QAAQ,EACRC,SAASJ,aAAaK,WAAW,EACjCC,QAAQ,CAAC,EACTC,QAAQ,KAAK,EACbC,QAAQ,MAAM,EACE;IAChB,MAAMC,YAAY;QAAC;YAAEC,WAAW,GAAGH,MAAM,CAAC,EAAEC,OAAO;QAAC;QAAG;YAAEE,WAAW;QAAU;KAAE;IAChF,IAAIR,cAAc,QAAQ;QACxBO,UAAUE,OAAO;IACnB;IACA,OAAO;QACLF;QACAN;QACAC;QACAE;IACF;AACF,EAAE"}
|
|
@@ -4,18 +4,21 @@ import { blurAtom } from '../../atoms/blur-atom';
|
|
|
4
4
|
/**
|
|
5
5
|
* Define a presence motion for blur in/out
|
|
6
6
|
*
|
|
7
|
-
* @param fromRadius - The radius of pixels to blend into the blur. A length string, defaulting to '10px'.
|
|
8
7
|
* @param duration - Time (ms) for the enter transition (blur-in). Defaults to the `durationSlow` value (300 ms).
|
|
9
8
|
* @param easing - Easing curve for the enter transition (blur-in). Defaults to the `curveDecelerateMin` value.
|
|
10
|
-
* @param
|
|
9
|
+
* @param delay - Time (ms) to delay the enter transition. Defaults to 0.
|
|
10
|
+
* @param exitDuration - Time (ms) for the exit transition (blur-out). Defaults to the `duration` param for symmetry.
|
|
11
11
|
* @param exitEasing - Easing curve for the exit transition (blur-out). Defaults to the `curveAccelerateMin` value.
|
|
12
|
+
* @param exitDelay - Time (ms) to delay the exit transition. Defaults to the `delay` param for symmetry.
|
|
13
|
+
* @param fromRadius - The blur radius with units to animate from. Defaults to `'10px'`.
|
|
12
14
|
* @param animateOpacity - Whether to animate the opacity. Defaults to `true`.
|
|
13
|
-
*/ const blurPresenceFn = ({
|
|
15
|
+
*/ const blurPresenceFn = ({ duration = motionTokens.durationSlow, easing = motionTokens.curveDecelerateMin, delay = 0, exitDuration = duration, exitEasing = motionTokens.curveAccelerateMin, exitDelay = delay, fromRadius = '10px', animateOpacity = true })=>{
|
|
14
16
|
const enterAtoms = [
|
|
15
17
|
blurAtom({
|
|
16
18
|
direction: 'enter',
|
|
17
19
|
duration,
|
|
18
20
|
easing,
|
|
21
|
+
delay,
|
|
19
22
|
fromRadius
|
|
20
23
|
})
|
|
21
24
|
];
|
|
@@ -24,6 +27,7 @@ import { blurAtom } from '../../atoms/blur-atom';
|
|
|
24
27
|
direction: 'exit',
|
|
25
28
|
duration: exitDuration,
|
|
26
29
|
easing: exitEasing,
|
|
30
|
+
delay: exitDelay,
|
|
27
31
|
fromRadius
|
|
28
32
|
})
|
|
29
33
|
];
|
|
@@ -32,12 +36,14 @@ import { blurAtom } from '../../atoms/blur-atom';
|
|
|
32
36
|
enterAtoms.push(fadeAtom({
|
|
33
37
|
direction: 'enter',
|
|
34
38
|
duration,
|
|
35
|
-
easing
|
|
39
|
+
easing,
|
|
40
|
+
delay
|
|
36
41
|
}));
|
|
37
42
|
exitAtoms.push(fadeAtom({
|
|
38
43
|
direction: 'exit',
|
|
39
44
|
duration: exitDuration,
|
|
40
|
-
easing: exitEasing
|
|
45
|
+
easing: exitEasing,
|
|
46
|
+
delay: exitDelay
|
|
41
47
|
}));
|
|
42
48
|
}
|
|
43
49
|
return {
|
|
@@ -1 +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
|
|
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 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 delay - Time (ms) to delay the enter transition. Defaults to 0.\n * @param exitDuration - Time (ms) for the exit transition (blur-out). Defaults to the `duration` param for symmetry.\n * @param exitEasing - Easing curve for the exit transition (blur-out). Defaults to the `curveAccelerateMin` value.\n * @param exitDelay - Time (ms) to delay the exit transition. Defaults to the `delay` param for symmetry.\n * @param fromRadius - The blur radius with units to animate from. Defaults to `'10px'`.\n * @param animateOpacity - Whether to animate the opacity. Defaults to `true`.\n */\nconst blurPresenceFn: PresenceMotionFn<BlurParams> = ({\n duration = motionTokens.durationSlow,\n easing = motionTokens.curveDecelerateMin,\n delay = 0,\n exitDuration = duration,\n exitEasing = motionTokens.curveAccelerateMin,\n exitDelay = delay,\n fromRadius = '10px',\n animateOpacity = true,\n}) => {\n const enterAtoms = [blurAtom({ direction: 'enter', duration, easing, delay, fromRadius })];\n const exitAtoms = [\n blurAtom({\n direction: 'exit',\n duration: exitDuration,\n easing: exitEasing,\n delay: exitDelay,\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, delay }));\n exitAtoms.push(fadeAtom({ direction: 'exit', duration: exitDuration, easing: exitEasing, delay: exitDelay }));\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","duration","durationSlow","easing","curveDecelerateMin","delay","exitDuration","exitEasing","curveAccelerateMin","exitDelay","fromRadius","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;;;;;;;;;;;CAWC,GACD,MAAMC,iBAA+C,CAAC,EACpDC,WAAWL,aAAaM,YAAY,EACpCC,SAASP,aAAaQ,kBAAkB,EACxCC,QAAQ,CAAC,EACTC,eAAeL,QAAQ,EACvBM,aAAaX,aAAaY,kBAAkB,EAC5CC,YAAYJ,KAAK,EACjBK,aAAa,MAAM,EACnBC,iBAAiB,IAAI,EACtB;IACC,MAAMC,aAAa;QAACb,SAAS;YAAEc,WAAW;YAASZ;YAAUE;YAAQE;YAAOK;QAAW;KAAG;IAC1F,MAAMI,YAAY;QAChBf,SAAS;YACPc,WAAW;YACXZ,UAAUK;YACVH,QAAQI;YACRF,OAAOI;YACPC;QACF;KACD;IAED,iDAAiD;IACjD,IAAIC,gBAAgB;QAClBC,WAAWG,IAAI,CAACjB,SAAS;YAAEe,WAAW;YAASZ;YAAUE;YAAQE;QAAM;QACvES,UAAUC,IAAI,CAACjB,SAAS;YAAEe,WAAW;YAAQZ,UAAUK;YAAcH,QAAQI;YAAYF,OAAOI;QAAU;IAC5G;IAEA,OAAO;QACLO,OAAOJ;QACPK,MAAMH;IACR;AACF;AAEA,4EAA4E,GAC5E,OAAO,MAAMI,OAAOrB,wBAAwBG,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Blur/blur-types.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../src/components/Blur/blur-types.ts"],"sourcesContent":["import type { BasePresenceParams, AnimateOpacity } from '../../types';\n\nexport type BlurParams = BasePresenceParams &\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,WAII"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Collapse/collapse-types.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../src/components/Collapse/collapse-types.ts"],"sourcesContent":["import type { BasePresenceParams, PresenceEasing, PresenceDelay, AnimateOpacity } from '../../types';\n\nexport type CollapseOrientation = 'horizontal' | 'vertical';\n\n/** Common properties shared by all collapse components */\ntype CollapseBaseParams = PresenceEasing &\n PresenceDelay &\n AnimateOpacity & {\n /** The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height. */\n orientation?: CollapseOrientation;\n };\n\nexport type CollapseParams = BasePresenceParams &\n AnimateOpacity & {\n /** The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height. */\n orientation?: CollapseOrientation;\n };\n\nexport type CollapseDelayedParams = CollapseBaseParams & {\n /** Time (ms) for the size expand. Defaults to the `durationNormal` value (200 ms). */\n sizeDuration?: number;\n\n /** Time (ms) for the fade-in. Defaults to the `sizeDuration` param, to sync fade-in with expand. */\n opacityDuration?: number;\n\n /** Time (ms) for the size collapse. Defaults to the `sizeDuration` param, for temporal symmetry. */\n exitSizeDuration?: number;\n\n /** Time (ms) for the fade-out. Defaults to the `exitSizeDuration` param, to sync the fade-out with the collapse. */\n exitOpacityDuration?: number;\n\n /** Time (ms) between the size expand start and the fade-in start. Defaults to `0`. */\n delay?: number;\n\n /** Time (ms) between the fade-out start and the size collapse start. Defaults to `0`. */\n exitDelay?: number;\n};\n"],"names":[],"mappings":"AAkBA,WAkBE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Collapse/index.ts"],"sourcesContent":["export { Collapse, CollapseDelayed, CollapseRelaxed, CollapseSnappy } from './Collapse';\n"],"names":["Collapse","CollapseDelayed","CollapseRelaxed","CollapseSnappy"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,eAAe,EAAEC,eAAe,EAAEC,cAAc,QAAQ,aAAa"}
|
|
1
|
+
{"version":3,"sources":["../src/components/Collapse/index.ts"],"sourcesContent":["export { Collapse, CollapseDelayed, CollapseRelaxed, CollapseSnappy } from './Collapse';\nexport type { CollapseParams, CollapseDelayedParams } from './collapse-types';\n"],"names":["Collapse","CollapseDelayed","CollapseRelaxed","CollapseSnappy"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,eAAe,EAAEC,eAAe,EAAEC,cAAc,QAAQ,aAAa"}
|
|
@@ -5,19 +5,23 @@ import { fadeAtom } from '../../atoms/fade-atom';
|
|
|
5
5
|
*
|
|
6
6
|
* @param duration - Time (ms) for the enter transition (fade-in). Defaults to the `durationNormal` value (200 ms).
|
|
7
7
|
* @param easing - Easing curve for the enter transition (fade-in). Defaults to the `curveEasyEase` value.
|
|
8
|
+
* @param delay - Time (ms) to delay the enter transition. Defaults to 0.
|
|
8
9
|
* @param exitDuration - Time (ms) for the exit transition (fade-out). Defaults to the `duration` param for symmetry.
|
|
9
10
|
* @param exitEasing - Easing curve for the exit transition (fade-out). Defaults to the `easing` param for symmetry.
|
|
10
|
-
|
|
11
|
+
* @param exitDelay - Time (ms) to delay the exit transition. Defaults to the `delay` param for symmetry.
|
|
12
|
+
*/ export const fadePresenceFn = ({ duration = motionTokens.durationNormal, easing = motionTokens.curveEasyEase, delay = 0, exitDuration = duration, exitEasing = easing, exitDelay = delay })=>{
|
|
11
13
|
return {
|
|
12
14
|
enter: fadeAtom({
|
|
13
15
|
direction: 'enter',
|
|
14
16
|
duration,
|
|
15
|
-
easing
|
|
17
|
+
easing,
|
|
18
|
+
delay
|
|
16
19
|
}),
|
|
17
20
|
exit: fadeAtom({
|
|
18
21
|
direction: 'exit',
|
|
19
22
|
duration: exitDuration,
|
|
20
|
-
easing: exitEasing
|
|
23
|
+
easing: exitEasing,
|
|
24
|
+
delay: exitDelay
|
|
21
25
|
})
|
|
22
26
|
};
|
|
23
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Fade/Fade.ts"],"sourcesContent":["import {\n motionTokens,\n createPresenceComponent,\n PresenceMotionFn,\n createPresenceComponentVariant,\n} from '@fluentui/react-motion';\nimport { fadeAtom } from '../../atoms/fade-atom';\nimport { FadeParams } from './fade-types';\n\n/**\n * Define a presence motion for fade in/out\n *\n * @param duration - Time (ms) for the enter transition (fade-in). Defaults to the `durationNormal` value (200 ms).\n * @param easing - Easing curve for the enter transition (fade-in). Defaults to the `curveEasyEase` value.\n * @param exitDuration - Time (ms) for the exit transition (fade-out). Defaults to the `duration` param for symmetry.\n * @param exitEasing - Easing curve for the exit transition (fade-out). Defaults to the `easing` param for symmetry.\n */\nexport const fadePresenceFn: PresenceMotionFn<FadeParams> = ({\n duration = motionTokens.durationNormal,\n easing = motionTokens.curveEasyEase,\n exitDuration = duration,\n exitEasing = easing,\n}) => {\n return {\n enter: fadeAtom({ direction: 'enter', duration, easing }),\n exit: fadeAtom({ direction: 'exit', duration: exitDuration, easing: exitEasing }),\n };\n};\n\n/** A React component that applies fade in/out transitions to its children. */\nexport const Fade = createPresenceComponent(fadePresenceFn);\n\nexport const FadeSnappy = createPresenceComponentVariant(Fade, { duration: motionTokens.durationFast });\n\nexport const FadeRelaxed = createPresenceComponentVariant(Fade, { duration: motionTokens.durationGentle });\n"],"names":["motionTokens","createPresenceComponent","createPresenceComponentVariant","fadeAtom","fadePresenceFn","duration","durationNormal","easing","curveEasyEase","exitDuration","exitEasing","enter","direction","exit","Fade","FadeSnappy","durationFast","FadeRelaxed","durationGentle"],"mappings":"AAAA,SACEA,YAAY,EACZC,uBAAuB,EAEvBC,8BAA8B,QACzB,yBAAyB;AAChC,SAASC,QAAQ,QAAQ,wBAAwB;AAGjD
|
|
1
|
+
{"version":3,"sources":["../src/components/Fade/Fade.ts"],"sourcesContent":["import {\n motionTokens,\n createPresenceComponent,\n PresenceMotionFn,\n createPresenceComponentVariant,\n} from '@fluentui/react-motion';\nimport { fadeAtom } from '../../atoms/fade-atom';\nimport { FadeParams } from './fade-types';\n\n/**\n * Define a presence motion for fade in/out\n *\n * @param duration - Time (ms) for the enter transition (fade-in). Defaults to the `durationNormal` value (200 ms).\n * @param easing - Easing curve for the enter transition (fade-in). Defaults to the `curveEasyEase` value.\n * @param delay - Time (ms) to delay the enter transition. Defaults to 0.\n * @param exitDuration - Time (ms) for the exit transition (fade-out). Defaults to the `duration` param for symmetry.\n * @param exitEasing - Easing curve for the exit transition (fade-out). Defaults to the `easing` param for symmetry.\n * @param exitDelay - Time (ms) to delay the exit transition. Defaults to the `delay` param for symmetry.\n */\nexport const fadePresenceFn: PresenceMotionFn<FadeParams> = ({\n duration = motionTokens.durationNormal,\n easing = motionTokens.curveEasyEase,\n delay = 0,\n exitDuration = duration,\n exitEasing = easing,\n exitDelay = delay,\n}) => {\n return {\n enter: fadeAtom({ direction: 'enter', duration, easing, delay }),\n exit: fadeAtom({ direction: 'exit', duration: exitDuration, easing: exitEasing, delay: exitDelay }),\n };\n};\n\n/** A React component that applies fade in/out transitions to its children. */\nexport const Fade = createPresenceComponent(fadePresenceFn);\n\nexport const FadeSnappy = createPresenceComponentVariant(Fade, { duration: motionTokens.durationFast });\n\nexport const FadeRelaxed = createPresenceComponentVariant(Fade, { duration: motionTokens.durationGentle });\n"],"names":["motionTokens","createPresenceComponent","createPresenceComponentVariant","fadeAtom","fadePresenceFn","duration","durationNormal","easing","curveEasyEase","delay","exitDuration","exitEasing","exitDelay","enter","direction","exit","Fade","FadeSnappy","durationFast","FadeRelaxed","durationGentle"],"mappings":"AAAA,SACEA,YAAY,EACZC,uBAAuB,EAEvBC,8BAA8B,QACzB,yBAAyB;AAChC,SAASC,QAAQ,QAAQ,wBAAwB;AAGjD;;;;;;;;;CASC,GACD,OAAO,MAAMC,iBAA+C,CAAC,EAC3DC,WAAWL,aAAaM,cAAc,EACtCC,SAASP,aAAaQ,aAAa,EACnCC,QAAQ,CAAC,EACTC,eAAeL,QAAQ,EACvBM,aAAaJ,MAAM,EACnBK,YAAYH,KAAK,EAClB;IACC,OAAO;QACLI,OAAOV,SAAS;YAAEW,WAAW;YAAST;YAAUE;YAAQE;QAAM;QAC9DM,MAAMZ,SAAS;YAAEW,WAAW;YAAQT,UAAUK;YAAcH,QAAQI;YAAYF,OAAOG;QAAU;IACnG;AACF,EAAE;AAEF,4EAA4E,GAC5E,OAAO,MAAMI,OAAOf,wBAAwBG,gBAAgB;AAE5D,OAAO,MAAMa,aAAaf,+BAA+Bc,MAAM;IAAEX,UAAUL,aAAakB,YAAY;AAAC,GAAG;AAExG,OAAO,MAAMC,cAAcjB,+BAA+Bc,MAAM;IAAEX,UAAUL,aAAaoB,cAAc;AAAC,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Fade/fade-types.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../src/components/Fade/fade-types.ts"],"sourcesContent":["import type { BasePresenceParams } from '../../types';\n\nexport type FadeParams = BasePresenceParams;\n"],"names":[],"mappings":"AAEA,WAA4C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Fade/index.ts"],"sourcesContent":["export { Fade, FadeRelaxed, FadeSnappy } from './Fade';\n"],"names":["Fade","FadeRelaxed","FadeSnappy"],"mappings":"AAAA,SAASA,IAAI,EAAEC,WAAW,EAAEC,UAAU,QAAQ,SAAS"}
|
|
1
|
+
{"version":3,"sources":["../src/components/Fade/index.ts"],"sourcesContent":["export { Fade, FadeRelaxed, FadeSnappy } from './Fade';\nexport type { FadeParams } from './fade-types';\n"],"names":["Fade","FadeRelaxed","FadeSnappy"],"mappings":"AAAA,SAASA,IAAI,EAAEC,WAAW,EAAEC,UAAU,QAAQ,SAAS"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { createPresenceComponent, motionTokens } from '@fluentui/react-motion';
|
|
2
|
+
import { fadeAtom } from '../../atoms/fade-atom';
|
|
3
|
+
import { rotateAtom } from '../../atoms/rotate-atom';
|
|
4
|
+
/**
|
|
5
|
+
* Define a presence motion for rotate in/out
|
|
6
|
+
*
|
|
7
|
+
* @param duration - Time (ms) for the enter transition (rotate-in). Defaults to the `durationGentle` value.
|
|
8
|
+
* @param easing - Easing curve for the enter transition (rotate-in). Defaults to the `curveDecelerateMax` value.
|
|
9
|
+
* @param delay - Time (ms) to delay the enter transition. Defaults to 0.
|
|
10
|
+
* @param exitDuration - Time (ms) for the exit transition (rotate-out). Defaults to the `duration` param for symmetry.
|
|
11
|
+
* @param exitEasing - Easing curve for the exit transition (rotate-out). Defaults to the `curveAccelerateMax` value.
|
|
12
|
+
* @param exitDelay - Time (ms) to delay the exit transition. Defaults to the `delay` param for symmetry.
|
|
13
|
+
* @param axis - The axis of rotation: 'x', 'y', or 'z'. Defaults to 'y'.
|
|
14
|
+
* @param angle - The starting rotation angle in degrees. Defaults to -90.
|
|
15
|
+
* @param exitAngle - The ending rotation angle in degrees. Defaults to the negation of `angle`.
|
|
16
|
+
* @param animateOpacity - Whether to animate the opacity during the rotation. Defaults to `true`.
|
|
17
|
+
*/ const rotatePresenceFn = ({ duration = motionTokens.durationGentle, easing = motionTokens.curveDecelerateMax, delay = 0, exitDuration = duration, exitEasing = motionTokens.curveAccelerateMax, exitDelay = delay, axis = 'y', angle = -90, exitAngle = -angle, animateOpacity = true })=>{
|
|
18
|
+
const enterAtoms = [
|
|
19
|
+
rotateAtom({
|
|
20
|
+
direction: 'enter',
|
|
21
|
+
duration,
|
|
22
|
+
easing,
|
|
23
|
+
delay,
|
|
24
|
+
axis,
|
|
25
|
+
angle,
|
|
26
|
+
exitAngle
|
|
27
|
+
})
|
|
28
|
+
];
|
|
29
|
+
const exitAtoms = [
|
|
30
|
+
rotateAtom({
|
|
31
|
+
direction: 'exit',
|
|
32
|
+
duration: exitDuration,
|
|
33
|
+
easing: exitEasing,
|
|
34
|
+
delay: exitDelay,
|
|
35
|
+
axis,
|
|
36
|
+
angle,
|
|
37
|
+
exitAngle
|
|
38
|
+
})
|
|
39
|
+
];
|
|
40
|
+
if (animateOpacity) {
|
|
41
|
+
enterAtoms.push(fadeAtom({
|
|
42
|
+
direction: 'enter',
|
|
43
|
+
duration,
|
|
44
|
+
easing,
|
|
45
|
+
delay
|
|
46
|
+
}));
|
|
47
|
+
exitAtoms.push(fadeAtom({
|
|
48
|
+
direction: 'exit',
|
|
49
|
+
duration: exitDuration,
|
|
50
|
+
easing: exitEasing,
|
|
51
|
+
delay: exitDelay
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
enter: enterAtoms,
|
|
56
|
+
exit: exitAtoms
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
// Create a presence motion component to rotate an element around a single axis (x, y, or z).
|
|
60
|
+
export const Rotate = createPresenceComponent(rotatePresenceFn);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Rotate/Rotate.ts"],"sourcesContent":["import { AtomMotion, createPresenceComponent, motionTokens, PresenceMotionFn } from '@fluentui/react-motion';\nimport { fadeAtom } from '../../atoms/fade-atom';\nimport { rotateAtom } from '../../atoms/rotate-atom';\nimport { RotateParams } from './rotate-types';\n\n/**\n * Define a presence motion for rotate in/out\n *\n * @param duration - Time (ms) for the enter transition (rotate-in). Defaults to the `durationGentle` value.\n * @param easing - Easing curve for the enter transition (rotate-in). Defaults to the `curveDecelerateMax` value.\n * @param delay - Time (ms) to delay the enter transition. Defaults to 0.\n * @param exitDuration - Time (ms) for the exit transition (rotate-out). Defaults to the `duration` param for symmetry.\n * @param exitEasing - Easing curve for the exit transition (rotate-out). Defaults to the `curveAccelerateMax` value.\n * @param exitDelay - Time (ms) to delay the exit transition. Defaults to the `delay` param for symmetry.\n * @param axis - The axis of rotation: 'x', 'y', or 'z'. Defaults to 'y'.\n * @param angle - The starting rotation angle in degrees. Defaults to -90.\n * @param exitAngle - The ending rotation angle in degrees. Defaults to the negation of `angle`.\n * @param animateOpacity - Whether to animate the opacity during the rotation. Defaults to `true`.\n */\nconst rotatePresenceFn: PresenceMotionFn<RotateParams> = ({\n duration = motionTokens.durationGentle,\n easing = motionTokens.curveDecelerateMax,\n delay = 0,\n exitDuration = duration,\n exitEasing = motionTokens.curveAccelerateMax,\n exitDelay = delay,\n axis = 'y',\n angle = -90,\n exitAngle = -angle,\n animateOpacity = true,\n}: RotateParams) => {\n const enterAtoms: AtomMotion[] = [\n rotateAtom({\n direction: 'enter',\n duration,\n easing,\n delay,\n axis,\n angle,\n exitAngle,\n }),\n ];\n\n const exitAtoms: AtomMotion[] = [\n rotateAtom({\n direction: 'exit',\n duration: exitDuration,\n easing: exitEasing,\n delay: exitDelay,\n axis,\n angle,\n exitAngle,\n }),\n ];\n\n if (animateOpacity) {\n enterAtoms.push(fadeAtom({ direction: 'enter', duration, easing, delay }));\n exitAtoms.push(fadeAtom({ direction: 'exit', duration: exitDuration, easing: exitEasing, delay: exitDelay }));\n }\n\n return {\n enter: enterAtoms,\n exit: exitAtoms,\n };\n};\n\n// Create a presence motion component to rotate an element around a single axis (x, y, or z).\nexport const Rotate = createPresenceComponent(rotatePresenceFn);\n"],"names":["createPresenceComponent","motionTokens","fadeAtom","rotateAtom","rotatePresenceFn","duration","durationGentle","easing","curveDecelerateMax","delay","exitDuration","exitEasing","curveAccelerateMax","exitDelay","axis","angle","exitAngle","animateOpacity","enterAtoms","direction","exitAtoms","push","enter","exit","Rotate"],"mappings":"AAAA,SAAqBA,uBAAuB,EAAEC,YAAY,QAA0B,yBAAyB;AAC7G,SAASC,QAAQ,QAAQ,wBAAwB;AACjD,SAASC,UAAU,QAAQ,0BAA0B;AAGrD;;;;;;;;;;;;;CAaC,GACD,MAAMC,mBAAmD,CAAC,EACxDC,WAAWJ,aAAaK,cAAc,EACtCC,SAASN,aAAaO,kBAAkB,EACxCC,QAAQ,CAAC,EACTC,eAAeL,QAAQ,EACvBM,aAAaV,aAAaW,kBAAkB,EAC5CC,YAAYJ,KAAK,EACjBK,OAAO,GAAG,EACVC,QAAQ,CAAC,EAAE,EACXC,YAAY,CAACD,KAAK,EAClBE,iBAAiB,IAAI,EACR;IACb,MAAMC,aAA2B;QAC/Bf,WAAW;YACTgB,WAAW;YACXd;YACAE;YACAE;YACAK;YACAC;YACAC;QACF;KACD;IAED,MAAMI,YAA0B;QAC9BjB,WAAW;YACTgB,WAAW;YACXd,UAAUK;YACVH,QAAQI;YACRF,OAAOI;YACPC;YACAC;YACAC;QACF;KACD;IAED,IAAIC,gBAAgB;QAClBC,WAAWG,IAAI,CAACnB,SAAS;YAAEiB,WAAW;YAASd;YAAUE;YAAQE;QAAM;QACvEW,UAAUC,IAAI,CAACnB,SAAS;YAAEiB,WAAW;YAAQd,UAAUK;YAAcH,QAAQI;YAAYF,OAAOI;QAAU;IAC5G;IAEA,OAAO;QACLS,OAAOJ;QACPK,MAAMH;IACR;AACF;AAEA,6FAA6F;AAC7F,OAAO,MAAMI,SAASxB,wBAAwBI,kBAAkB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Rotate } from './Rotate';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Rotate/index.ts"],"sourcesContent":["export { Rotate } from './Rotate';\nexport type { RotateParams } from './rotate-types';\n"],"names":["Rotate"],"mappings":"AAAA,SAASA,MAAM,QAAQ,WAAW"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Rotate/rotate-types.ts"],"sourcesContent":["import type { BasePresenceParams, AnimateOpacity } from '../../types';\n\ntype Axis3D = 'x' | 'y' | 'z';\n\nexport type RotateParams = BasePresenceParams &\n AnimateOpacity & {\n /**\n * The axis of rotation: 'x', 'y', or 'z'.\n * Defaults to 'y'.\n */\n axis?: Axis3D;\n\n /**\n * The starting rotation angle in degrees.\n * Defaults to -90.\n */\n angle?: number;\n\n /**\n * The ending rotation angle in degrees.\n * Defaults to the negation of `angle`.\n */\n exitAngle?: number;\n };\n"],"names":[],"mappings":"AAIA,WAmBI"}
|
|
@@ -6,17 +6,20 @@ import { scaleAtom } from '../../atoms/scale-atom';
|
|
|
6
6
|
*
|
|
7
7
|
* @param duration - Time (ms) for the enter transition (scale-in). Defaults to the `durationGentle` value (250 ms).
|
|
8
8
|
* @param easing - Easing curve for the enter transition (scale-in). Defaults to the `curveDecelerateMax` value.
|
|
9
|
+
* @param delay - Time (ms) to delay the enter transition. Defaults to 0.
|
|
9
10
|
* @param exitDuration - Time (ms) for the exit transition (scale-out). Defaults to the `durationNormal` value (200 ms).
|
|
10
11
|
* @param exitEasing - Easing curve for the exit transition (scale-out). Defaults to the `curveAccelerateMax` value.
|
|
12
|
+
* @param exitDelay - Time (ms) to delay the exit transition. Defaults to the `delay` param for symmetry.
|
|
11
13
|
* @param fromScale - The scale value to animate from. Defaults to `0.9`.
|
|
12
14
|
* @param animateOpacity - Whether to animate the opacity. Defaults to `true`.
|
|
13
|
-
*/ const scalePresenceFn = ({ duration = motionTokens.durationGentle, easing = motionTokens.curveDecelerateMax, exitDuration = motionTokens.durationNormal, exitEasing = motionTokens.curveAccelerateMax, fromScale = 0.9, animateOpacity = true })=>{
|
|
15
|
+
*/ const scalePresenceFn = ({ duration = motionTokens.durationGentle, easing = motionTokens.curveDecelerateMax, delay = 0, exitDuration = motionTokens.durationNormal, exitEasing = motionTokens.curveAccelerateMax, exitDelay = delay, fromScale = 0.9, animateOpacity = true })=>{
|
|
14
16
|
const enterAtoms = [
|
|
15
17
|
scaleAtom({
|
|
16
18
|
direction: 'enter',
|
|
17
19
|
duration,
|
|
18
20
|
easing,
|
|
19
|
-
|
|
21
|
+
delay,
|
|
22
|
+
fromScale
|
|
20
23
|
})
|
|
21
24
|
];
|
|
22
25
|
const exitAtoms = [
|
|
@@ -24,6 +27,7 @@ import { scaleAtom } from '../../atoms/scale-atom';
|
|
|
24
27
|
direction: 'exit',
|
|
25
28
|
duration: exitDuration,
|
|
26
29
|
easing: exitEasing,
|
|
30
|
+
delay: exitDelay,
|
|
27
31
|
fromScale
|
|
28
32
|
})
|
|
29
33
|
];
|
|
@@ -32,12 +36,14 @@ import { scaleAtom } from '../../atoms/scale-atom';
|
|
|
32
36
|
enterAtoms.push(fadeAtom({
|
|
33
37
|
direction: 'enter',
|
|
34
38
|
duration,
|
|
35
|
-
easing
|
|
39
|
+
easing,
|
|
40
|
+
delay
|
|
36
41
|
}));
|
|
37
42
|
exitAtoms.push(fadeAtom({
|
|
38
43
|
direction: 'exit',
|
|
39
44
|
duration: exitDuration,
|
|
40
|
-
easing: exitEasing
|
|
45
|
+
easing: exitEasing,
|
|
46
|
+
delay: exitDelay
|
|
41
47
|
}));
|
|
42
48
|
}
|
|
43
49
|
return {
|