@fluentui/react-motion-components-preview 0.10.0 → 0.11.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 +15 -2
- package/dist/index.d.ts +22 -17
- package/lib/atoms/blur-atom.js +1 -0
- package/lib/atoms/blur-atom.js.map +1 -1
- package/lib/atoms/rotate-atom.js +1 -0
- package/lib/atoms/rotate-atom.js.map +1 -1
- package/lib/atoms/scale-atom.js +1 -0
- package/lib/atoms/scale-atom.js.map +1 -1
- package/lib/atoms/slide-atom.js +1 -0
- package/lib/atoms/slide-atom.js.map +1 -1
- package/lib/components/Collapse/Collapse.js +56 -72
- package/lib/components/Collapse/Collapse.js.map +1 -1
- package/lib/components/Collapse/collapse-atoms.js +9 -10
- package/lib/components/Collapse/collapse-atoms.js.map +1 -1
- package/lib/components/Collapse/collapse-test-utils.js +137 -0
- package/lib/components/Collapse/collapse-test-utils.js.map +1 -0
- package/lib/components/Collapse/collapse-types.js.map +1 -1
- package/lib/components/Collapse/index.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/atoms/blur-atom.js.map +1 -1
- package/lib-commonjs/atoms/rotate-atom.js.map +1 -1
- package/lib-commonjs/atoms/scale-atom.js.map +1 -1
- package/lib-commonjs/atoms/slide-atom.js.map +1 -1
- package/lib-commonjs/components/Collapse/Collapse.js +56 -72
- package/lib-commonjs/components/Collapse/Collapse.js.map +1 -1
- package/lib-commonjs/components/Collapse/collapse-atoms.js +9 -10
- package/lib-commonjs/components/Collapse/collapse-atoms.js.map +1 -1
- package/lib-commonjs/components/Collapse/collapse-test-utils.js +155 -0
- package/lib-commonjs/components/Collapse/collapse-test-utils.js.map +1 -0
- package/lib-commonjs/components/Collapse/index.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-motion-components-preview
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 03 Oct 2025 14:18:15 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [0.11.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion-components-preview_v0.11.0)
|
|
8
|
+
|
|
9
|
+
Fri, 03 Oct 2025 14:18:15 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-motion-components-preview_v0.10.0..@fluentui/react-motion-components-preview_v0.11.0)
|
|
11
|
+
|
|
12
|
+
### Minor changes
|
|
13
|
+
|
|
14
|
+
- refactor(Collapse): simplify parameter types ([PR #35262](https://github.com/microsoft/fluentui/pull/35262) by robertpenner@microsoft.com)
|
|
15
|
+
|
|
16
|
+
### Patches
|
|
17
|
+
|
|
18
|
+
- fix(Collapse): make size animation work with delay ([PR #35269](https://github.com/microsoft/fluentui/pull/35269) by robertpenner@microsoft.com)
|
|
19
|
+
|
|
7
20
|
## [0.10.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion-components-preview_v0.10.0)
|
|
8
21
|
|
|
9
|
-
Mon, 08 Sep 2025 12:
|
|
22
|
+
Mon, 08 Sep 2025 12:51:10 GMT
|
|
10
23
|
[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
24
|
|
|
12
25
|
### Minor changes
|
package/dist/index.d.ts
CHANGED
|
@@ -26,35 +26,40 @@ export declare type BlurParams = BasePresenceParams & AnimateOpacity & {
|
|
|
26
26
|
/** A React component that applies collapse/expand transitions to its children. */
|
|
27
27
|
export declare const Collapse: PresenceComponent<CollapseParams>;
|
|
28
28
|
|
|
29
|
-
/** Common properties shared by all collapse components */
|
|
30
|
-
declare type CollapseBaseParams = PresenceEasing & PresenceDelay & AnimateOpacity & {
|
|
31
|
-
/** The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height. */
|
|
32
|
-
orientation?: CollapseOrientation;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
29
|
/** A React component that applies collapse/expand transitions with delayed fade to its children. */
|
|
36
|
-
export declare const CollapseDelayed: PresenceComponent<
|
|
30
|
+
export declare const CollapseDelayed: PresenceComponent<CollapseParams>;
|
|
37
31
|
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Duration properties for granular timing control in Collapse animations.
|
|
34
|
+
*/
|
|
35
|
+
export declare type CollapseDurations = {
|
|
36
|
+
/** Time (ms) for the size animation during enter. Defaults to `duration` for unified timing. */
|
|
40
37
|
sizeDuration?: number;
|
|
41
|
-
/** Time (ms) for the
|
|
38
|
+
/** Time (ms) for the opacity animation during enter. Defaults to `sizeDuration` for synchronized timing. */
|
|
42
39
|
opacityDuration?: number;
|
|
43
|
-
/** Time (ms) for the size
|
|
40
|
+
/** Time (ms) for the size animation during exit. Defaults to `exitDuration` for unified timing. */
|
|
44
41
|
exitSizeDuration?: number;
|
|
45
|
-
/** Time (ms) for the
|
|
42
|
+
/** Time (ms) for the opacity animation during exit. Defaults to `exitSizeDuration` for synchronized timing. */
|
|
46
43
|
exitOpacityDuration?: number;
|
|
47
|
-
/** Time (ms) between the size expand start and the fade-in start. Defaults to `0`. */
|
|
48
|
-
delay?: number;
|
|
49
|
-
/** Time (ms) between the fade-out start and the size collapse start. Defaults to `0`. */
|
|
50
|
-
exitDelay?: number;
|
|
51
44
|
};
|
|
52
45
|
|
|
53
46
|
declare type CollapseOrientation = 'horizontal' | 'vertical';
|
|
54
47
|
|
|
55
|
-
export declare type CollapseParams = BasePresenceParams & AnimateOpacity & {
|
|
48
|
+
export declare type CollapseParams = BasePresenceParams & AnimateOpacity & CollapseDurations & {
|
|
56
49
|
/** The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height. */
|
|
57
50
|
orientation?: CollapseOrientation;
|
|
51
|
+
/** The starting size for the expand animation. Defaults to `'0px'`. */
|
|
52
|
+
fromSize?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Time (ms) to delay the inner stagger between size and opacity animations.
|
|
55
|
+
* On enter this delays the opacity after size; on exit this delays the size after opacity.
|
|
56
|
+
* Defaults to 0.
|
|
57
|
+
*/
|
|
58
|
+
staggerDelay?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Time (ms) to delay the inner stagger during exit. Defaults to the `staggerDelay` param for symmetry.
|
|
61
|
+
*/
|
|
62
|
+
exitStaggerDelay?: number;
|
|
58
63
|
};
|
|
59
64
|
|
|
60
65
|
export declare const CollapseRelaxed: PresenceComponent<CollapseParams>;
|
package/lib/atoms/blur-atom.js
CHANGED
|
@@ -5,6 +5,7 @@ import { motionTokens } from '@fluentui/react-motion';
|
|
|
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 fromRadius - The blur radius value with units (e.g., '20px', '1rem'). Defaults to '20px'.
|
|
8
|
+
* @param delay - Time (ms) to delay the animation. Defaults to 0.
|
|
8
9
|
* @returns A motion atom object with filter blur keyframes and the supplied duration and easing.
|
|
9
10
|
*/ export const blurAtom = ({ direction, duration, easing = motionTokens.curveLinear, delay = 0, fromRadius = '10px' })=>{
|
|
10
11
|
const keyframes = [
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 * @param delay - Time (ms) to delay the animation. Defaults to 0.\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;;;;;;;;CAQC,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/rotate-atom.js
CHANGED
|
@@ -10,6 +10,7 @@ const createRotateValue = (axis, angle)=>{
|
|
|
10
10
|
* @param axis - The axis of rotation: 'x', 'y', or 'z'. Defaults to 'y'.
|
|
11
11
|
* @param angle - The starting rotation angle in degrees. Defaults to -90.
|
|
12
12
|
* @param exitAngle - The ending rotation angle in degrees. Defaults to the negation of `angle`.
|
|
13
|
+
* @param delay - Time (ms) to delay the animation. Defaults to 0.
|
|
13
14
|
* @returns A motion atom object with rotate keyframes and the supplied duration and easing.
|
|
14
15
|
*/ export const rotateAtom = ({ direction, duration, easing = motionTokens.curveLinear, delay = 0, axis = 'y', angle = -90, exitAngle = -angle })=>{
|
|
15
16
|
let fromAngle = angle;
|
|
@@ -1 +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
|
|
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 * @param delay - Time (ms) to delay the animation. Defaults to 0.\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;;;;;;;;;;CAUC,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
|
@@ -6,6 +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 fromScale - The starting scale value. Defaults to 0.9.
|
|
8
8
|
* @param toScale - The ending scale value. Defaults to 1.
|
|
9
|
+
* @param delay - Time (ms) to delay the animation. Defaults to 0.
|
|
9
10
|
* @returns A motion atom object with scale keyframes and the supplied duration and easing.
|
|
10
11
|
*/ export const scaleAtom = ({ direction, duration, easing = motionTokens.curveLinear, delay = 0, fromScale = 0.9, toScale = 1 })=>{
|
|
11
12
|
const keyframes = [
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 * @param delay - Time (ms) to delay the animation. Defaults to 0.\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;;;;;;;;;CASC,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
|
@@ -6,6 +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 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
|
+
* @param delay - Time (ms) to delay the animation. Defaults to 0.
|
|
9
10
|
* @returns A motion atom object with translate keyframes and the supplied duration and easing.
|
|
10
11
|
*/ export const slideAtom = ({ direction, duration, easing = motionTokens.curveLinear, delay = 0, fromX = '0px', fromY = '20px' })=>{
|
|
11
12
|
const keyframes = [
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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 * @param delay - Time (ms) to delay the animation. Defaults to 0.\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;;;;;;;;;CASC,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"}
|
|
@@ -1,46 +1,71 @@
|
|
|
1
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
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Define a presence motion for collapse/expand
|
|
6
|
+
*
|
|
7
|
+
* @param element - The element to apply the collapse motion to
|
|
8
|
+
* @param duration - Time (ms) for the enter transition (expand). Defaults to the `durationNormal` value (200 ms)
|
|
9
|
+
* @param easing - Easing curve for the enter transition. Defaults to the `curveEasyEaseMax` value
|
|
10
|
+
* @param delay - Time (ms) to delay the entire enter transition. Defaults to 0
|
|
11
|
+
* @param exitDuration - Time (ms) for the exit transition (collapse). Defaults to the `duration` param for symmetry
|
|
12
|
+
* @param exitEasing - Easing curve for the exit transition. Defaults to the `easing` param for symmetry
|
|
13
|
+
* @param exitDelay - Time (ms) to delay the entire exit transition. Defaults to the `delay` param for symmetry
|
|
14
|
+
* @param staggerDelay - Time (ms) offset between the size and opacity animations. Defaults to 0
|
|
15
|
+
* @param exitStaggerDelay - Time (ms) offset between the size and opacity animations on exit. Defaults to the `staggerDelay` param for symmetry
|
|
16
|
+
* @param sizeDuration - Time (ms) for the size animation during enter. Defaults to `duration` for unified timing
|
|
17
|
+
* @param opacityDuration - Time (ms) for the opacity animation during enter. Defaults to `sizeDuration` for synchronized timing
|
|
18
|
+
* @param exitSizeDuration - Time (ms) for the size animation during exit. Defaults to `exitDuration` for unified timing
|
|
19
|
+
* @param exitOpacityDuration - Time (ms) for the opacity animation during exit. Defaults to `exitSizeDuration` for synchronized timing
|
|
20
|
+
* @param animateOpacity - Whether to animate the opacity. Defaults to `true`
|
|
21
|
+
* @param orientation - The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height
|
|
22
|
+
* @param fromSize - The starting size for the expand animation. Defaults to `'0px'`
|
|
23
|
+
*/ const collapsePresenceFn = ({ element, // Primary duration controls (simple API)
|
|
24
|
+
duration = motionTokens.durationNormal, exitDuration = duration, // Granular duration controls with smart defaults (advanced API)
|
|
25
|
+
sizeDuration = duration, opacityDuration = sizeDuration, exitSizeDuration = exitDuration, exitOpacityDuration = exitSizeDuration, // Other timing controls
|
|
26
|
+
easing = motionTokens.curveEasyEaseMax, delay = 0, exitEasing = easing, exitDelay = delay, staggerDelay = 0, exitStaggerDelay = staggerDelay, // Animation controls
|
|
27
|
+
animateOpacity = true, orientation = 'vertical', fromSize = '0px' })=>{
|
|
7
28
|
// ----- ENTER -----
|
|
8
29
|
// The enter transition is an array of up to 3 motion atoms: size, whitespace and opacity.
|
|
30
|
+
// For enter: size expands first, then opacity fades in after staggerDelay
|
|
9
31
|
const enterAtoms = [
|
|
32
|
+
// Apply global delay to size atom - size expansion starts first
|
|
10
33
|
sizeEnterAtom({
|
|
11
34
|
orientation,
|
|
12
35
|
duration: sizeDuration,
|
|
13
36
|
easing,
|
|
14
|
-
element
|
|
37
|
+
element,
|
|
38
|
+
fromSize,
|
|
39
|
+
delay
|
|
15
40
|
}),
|
|
16
41
|
whitespaceAtom({
|
|
17
42
|
direction: 'enter',
|
|
18
43
|
orientation,
|
|
19
44
|
duration: sizeDuration,
|
|
20
|
-
easing
|
|
45
|
+
easing,
|
|
46
|
+
delay
|
|
21
47
|
})
|
|
22
48
|
];
|
|
23
49
|
// Fade in only if animateOpacity is true. Otherwise, leave opacity unaffected.
|
|
24
50
|
if (animateOpacity) {
|
|
25
|
-
enterAtoms.push({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
delay,
|
|
32
|
-
fill: 'both'
|
|
33
|
-
});
|
|
51
|
+
enterAtoms.push(fadeAtom({
|
|
52
|
+
direction: 'enter',
|
|
53
|
+
duration: opacityDuration,
|
|
54
|
+
easing,
|
|
55
|
+
delay: delay + staggerDelay
|
|
56
|
+
}));
|
|
34
57
|
}
|
|
35
58
|
// ----- EXIT -----
|
|
36
59
|
// The exit transition is an array of up to 3 motion atoms: opacity, size and whitespace.
|
|
60
|
+
// For exit: opacity fades out first, then size collapses after exitStaggerDelay
|
|
37
61
|
const exitAtoms = [];
|
|
38
62
|
// Fade out only if animateOpacity is true. Otherwise, leave opacity unaffected.
|
|
39
63
|
if (animateOpacity) {
|
|
40
64
|
exitAtoms.push(fadeAtom({
|
|
41
65
|
direction: 'exit',
|
|
42
66
|
duration: exitOpacityDuration,
|
|
43
|
-
easing: exitEasing
|
|
67
|
+
easing: exitEasing,
|
|
68
|
+
delay: exitDelay
|
|
44
69
|
}));
|
|
45
70
|
}
|
|
46
71
|
exitAtoms.push(sizeExitAtom({
|
|
@@ -48,72 +73,19 @@ exitSizeDuration, exitOpacityDuration = exitSizeDuration, exitEasing, exitDelay
|
|
|
48
73
|
duration: exitSizeDuration,
|
|
49
74
|
easing: exitEasing,
|
|
50
75
|
element,
|
|
51
|
-
delay: exitDelay
|
|
76
|
+
delay: exitDelay + exitStaggerDelay,
|
|
77
|
+
fromSize
|
|
52
78
|
}), whitespaceAtom({
|
|
53
79
|
direction: 'exit',
|
|
54
80
|
orientation,
|
|
55
81
|
duration: exitSizeDuration,
|
|
56
82
|
easing: exitEasing,
|
|
57
|
-
delay: exitDelay
|
|
83
|
+
delay: exitDelay + exitStaggerDelay
|
|
58
84
|
}));
|
|
59
85
|
return {
|
|
60
86
|
enter: enterAtoms,
|
|
61
87
|
exit: exitAtoms
|
|
62
88
|
};
|
|
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,
|
|
82
|
-
exitSizeDuration: exitDuration,
|
|
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
|
|
116
|
-
});
|
|
117
89
|
};
|
|
118
90
|
/** A React component that applies collapse/expand transitions to its children. */ export const Collapse = createPresenceComponent(collapsePresenceFn);
|
|
119
91
|
export const CollapseSnappy = createPresenceComponentVariant(Collapse, {
|
|
@@ -122,4 +94,16 @@ export const CollapseSnappy = createPresenceComponentVariant(Collapse, {
|
|
|
122
94
|
export const CollapseRelaxed = createPresenceComponentVariant(Collapse, {
|
|
123
95
|
duration: motionTokens.durationSlower
|
|
124
96
|
});
|
|
125
|
-
/** A React component that applies collapse/expand transitions with delayed fade to its children. */ export const CollapseDelayed =
|
|
97
|
+
/** A React component that applies collapse/expand transitions with delayed fade to its children. */ export const CollapseDelayed = createPresenceComponentVariant(Collapse, {
|
|
98
|
+
// Enter timing per motion design spec
|
|
99
|
+
sizeDuration: motionTokens.durationNormal,
|
|
100
|
+
opacityDuration: motionTokens.durationSlower,
|
|
101
|
+
staggerDelay: motionTokens.durationNormal,
|
|
102
|
+
// Exit timing per motion design spec
|
|
103
|
+
exitSizeDuration: motionTokens.durationNormal,
|
|
104
|
+
exitOpacityDuration: motionTokens.durationSlower,
|
|
105
|
+
exitStaggerDelay: motionTokens.durationSlower,
|
|
106
|
+
// Easing per motion design spec
|
|
107
|
+
easing: motionTokens.curveEasyEase,
|
|
108
|
+
exitEasing: motionTokens.curveEasyEase
|
|
109
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Collapse/Collapse.ts"],"sourcesContent":["import {\n motionTokens,\n createPresenceComponent,\n PresenceMotionFn,\n createPresenceComponentVariant,\n AtomMotion,\n} from '@fluentui/react-motion';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/Collapse/Collapse.ts"],"sourcesContent":["import {\n motionTokens,\n createPresenceComponent,\n PresenceMotionFn,\n createPresenceComponentVariant,\n AtomMotion,\n} from '@fluentui/react-motion';\nimport type { CollapseParams } from './collapse-types';\nimport { sizeEnterAtom, sizeExitAtom, whitespaceAtom } from './collapse-atoms';\nimport { fadeAtom } from '../../atoms/fade-atom';\n\n/**\n * Define a presence motion for collapse/expand\n *\n * @param element - The element to apply the collapse motion to\n * @param duration - Time (ms) for the enter transition (expand). Defaults to the `durationNormal` value (200 ms)\n * @param easing - Easing curve for the enter transition. Defaults to the `curveEasyEaseMax` value\n * @param delay - Time (ms) to delay the entire enter transition. Defaults to 0\n * @param exitDuration - Time (ms) for the exit transition (collapse). Defaults to the `duration` param for symmetry\n * @param exitEasing - Easing curve for the exit transition. Defaults to the `easing` param for symmetry\n * @param exitDelay - Time (ms) to delay the entire exit transition. Defaults to the `delay` param for symmetry\n * @param staggerDelay - Time (ms) offset between the size and opacity animations. Defaults to 0\n * @param exitStaggerDelay - Time (ms) offset between the size and opacity animations on exit. Defaults to the `staggerDelay` param for symmetry\n * @param sizeDuration - Time (ms) for the size animation during enter. Defaults to `duration` for unified timing\n * @param opacityDuration - Time (ms) for the opacity animation during enter. Defaults to `sizeDuration` for synchronized timing\n * @param exitSizeDuration - Time (ms) for the size animation during exit. Defaults to `exitDuration` for unified timing\n * @param exitOpacityDuration - Time (ms) for the opacity animation during exit. Defaults to `exitSizeDuration` for synchronized timing\n * @param animateOpacity - Whether to animate the opacity. Defaults to `true`\n * @param orientation - The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height\n * @param fromSize - The starting size for the expand animation. Defaults to `'0px'`\n */\nconst collapsePresenceFn: PresenceMotionFn<CollapseParams> = ({\n element,\n // Primary duration controls (simple API)\n duration = motionTokens.durationNormal,\n exitDuration = duration,\n\n // Granular duration controls with smart defaults (advanced API)\n sizeDuration = duration,\n opacityDuration = sizeDuration,\n exitSizeDuration = exitDuration,\n exitOpacityDuration = exitSizeDuration,\n\n // Other timing controls\n easing = motionTokens.curveEasyEaseMax,\n delay = 0,\n exitEasing = easing,\n exitDelay = delay,\n staggerDelay = 0,\n exitStaggerDelay = staggerDelay,\n\n // Animation controls\n animateOpacity = true,\n orientation = 'vertical',\n fromSize = '0px',\n}) => {\n // ----- ENTER -----\n // The enter transition is an array of up to 3 motion atoms: size, whitespace and opacity.\n // For enter: size expands first, then opacity fades in after staggerDelay\n const enterAtoms: AtomMotion[] = [\n // Apply global delay to size atom - size expansion starts first\n sizeEnterAtom({ orientation, duration: sizeDuration, easing, element, fromSize, delay }),\n whitespaceAtom({ direction: 'enter', orientation, duration: sizeDuration, easing, delay }),\n ];\n // Fade in only if animateOpacity is true. Otherwise, leave opacity unaffected.\n if (animateOpacity) {\n enterAtoms.push(fadeAtom({ direction: 'enter', duration: opacityDuration, easing, delay: delay + staggerDelay }));\n }\n\n // ----- EXIT -----\n // The exit transition is an array of up to 3 motion atoms: opacity, size and whitespace.\n // For exit: opacity fades out first, then size collapses after exitStaggerDelay\n const exitAtoms: AtomMotion[] = [];\n // Fade out only if animateOpacity is true. Otherwise, leave opacity unaffected.\n if (animateOpacity) {\n exitAtoms.push(\n fadeAtom({ direction: 'exit', duration: exitOpacityDuration, easing: exitEasing, delay: exitDelay }),\n );\n }\n\n exitAtoms.push(\n sizeExitAtom({\n orientation,\n duration: exitSizeDuration,\n easing: exitEasing,\n element,\n delay: exitDelay + exitStaggerDelay,\n fromSize,\n }),\n whitespaceAtom({\n direction: 'exit',\n orientation,\n duration: exitSizeDuration,\n easing: exitEasing,\n delay: exitDelay + exitStaggerDelay, // Size/whitespace collapse after opacity finishes fading out\n }),\n );\n\n return {\n enter: enterAtoms,\n exit: exitAtoms,\n };\n};\n\n/** A React component that applies collapse/expand transitions to its children. */\nexport const Collapse = createPresenceComponent(collapsePresenceFn);\n\nexport const CollapseSnappy = createPresenceComponentVariant(Collapse, {\n duration: motionTokens.durationFast,\n});\n\nexport const CollapseRelaxed = createPresenceComponentVariant(Collapse, {\n duration: motionTokens.durationSlower,\n});\n\n/** A React component that applies collapse/expand transitions with delayed fade to its children. */\nexport const CollapseDelayed = createPresenceComponentVariant(Collapse, {\n // Enter timing per motion design spec\n sizeDuration: motionTokens.durationNormal, // 200ms\n opacityDuration: motionTokens.durationSlower, // 400ms\n staggerDelay: motionTokens.durationNormal, // 200ms\n\n // Exit timing per motion design spec\n exitSizeDuration: motionTokens.durationNormal, // 200ms\n exitOpacityDuration: motionTokens.durationSlower, // 400ms\n exitStaggerDelay: motionTokens.durationSlower, // 400ms\n\n // Easing per motion design spec\n easing: motionTokens.curveEasyEase,\n exitEasing: motionTokens.curveEasyEase,\n});\n"],"names":["motionTokens","createPresenceComponent","createPresenceComponentVariant","sizeEnterAtom","sizeExitAtom","whitespaceAtom","fadeAtom","collapsePresenceFn","element","duration","durationNormal","exitDuration","sizeDuration","opacityDuration","exitSizeDuration","exitOpacityDuration","easing","curveEasyEaseMax","delay","exitEasing","exitDelay","staggerDelay","exitStaggerDelay","animateOpacity","orientation","fromSize","enterAtoms","direction","push","exitAtoms","enter","exit","Collapse","CollapseSnappy","durationFast","CollapseRelaxed","durationSlower","CollapseDelayed","curveEasyEase"],"mappings":"AAAA,SACEA,YAAY,EACZC,uBAAuB,EAEvBC,8BAA8B,QAEzB,yBAAyB;AAEhC,SAASC,aAAa,EAAEC,YAAY,EAAEC,cAAc,QAAQ,mBAAmB;AAC/E,SAASC,QAAQ,QAAQ,wBAAwB;AAEjD;;;;;;;;;;;;;;;;;;;CAmBC,GACD,MAAMC,qBAAuD,CAAC,EAC5DC,OAAO,EACP,yCAAyC;AACzCC,WAAWT,aAAaU,cAAc,EACtCC,eAAeF,QAAQ,EAEvB,gEAAgE;AAChEG,eAAeH,QAAQ,EACvBI,kBAAkBD,YAAY,EAC9BE,mBAAmBH,YAAY,EAC/BI,sBAAsBD,gBAAgB,EAEtC,wBAAwB;AACxBE,SAAShB,aAAaiB,gBAAgB,EACtCC,QAAQ,CAAC,EACTC,aAAaH,MAAM,EACnBI,YAAYF,KAAK,EACjBG,eAAe,CAAC,EAChBC,mBAAmBD,YAAY,EAE/B,qBAAqB;AACrBE,iBAAiB,IAAI,EACrBC,cAAc,UAAU,EACxBC,WAAW,KAAK,EACjB;IACC,oBAAoB;IACpB,0FAA0F;IAC1F,0EAA0E;IAC1E,MAAMC,aAA2B;QAC/B,gEAAgE;QAChEvB,cAAc;YAAEqB;YAAaf,UAAUG;YAAcI;YAAQR;YAASiB;YAAUP;QAAM;QACtFb,eAAe;YAAEsB,WAAW;YAASH;YAAaf,UAAUG;YAAcI;YAAQE;QAAM;KACzF;IACD,+EAA+E;IAC/E,IAAIK,gBAAgB;QAClBG,WAAWE,IAAI,CAACtB,SAAS;YAAEqB,WAAW;YAASlB,UAAUI;YAAiBG;YAAQE,OAAOA,QAAQG;QAAa;IAChH;IAEA,mBAAmB;IACnB,yFAAyF;IACzF,gFAAgF;IAChF,MAAMQ,YAA0B,EAAE;IAClC,gFAAgF;IAChF,IAAIN,gBAAgB;QAClBM,UAAUD,IAAI,CACZtB,SAAS;YAAEqB,WAAW;YAAQlB,UAAUM;YAAqBC,QAAQG;YAAYD,OAAOE;QAAU;IAEtG;IAEAS,UAAUD,IAAI,CACZxB,aAAa;QACXoB;QACAf,UAAUK;QACVE,QAAQG;QACRX;QACAU,OAAOE,YAAYE;QACnBG;IACF,IACApB,eAAe;QACbsB,WAAW;QACXH;QACAf,UAAUK;QACVE,QAAQG;QACRD,OAAOE,YAAYE;IACrB;IAGF,OAAO;QACLQ,OAAOJ;QACPK,MAAMF;IACR;AACF;AAEA,gFAAgF,GAChF,OAAO,MAAMG,WAAW/B,wBAAwBM,oBAAoB;AAEpE,OAAO,MAAM0B,iBAAiB/B,+BAA+B8B,UAAU;IACrEvB,UAAUT,aAAakC,YAAY;AACrC,GAAG;AAEH,OAAO,MAAMC,kBAAkBjC,+BAA+B8B,UAAU;IACtEvB,UAAUT,aAAaoC,cAAc;AACvC,GAAG;AAEH,kGAAkG,GAClG,OAAO,MAAMC,kBAAkBnC,+BAA+B8B,UAAU;IACtE,sCAAsC;IACtCpB,cAAcZ,aAAaU,cAAc;IACzCG,iBAAiBb,aAAaoC,cAAc;IAC5Cf,cAAcrB,aAAaU,cAAc;IAEzC,qCAAqC;IACrCI,kBAAkBd,aAAaU,cAAc;IAC7CK,qBAAqBf,aAAaoC,cAAc;IAChDd,kBAAkBtB,aAAaoC,cAAc;IAE7C,gCAAgC;IAChCpB,QAAQhB,aAAasC,aAAa;IAClCnB,YAAYnB,aAAasC,aAAa;AACxC,GAAG"}
|
|
@@ -10,7 +10,7 @@ const sizeValuesForOrientation = (orientation, element)=>{
|
|
|
10
10
|
toSize
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
export const sizeEnterAtom = ({ orientation, duration, easing, element, fromSize = '0' })=>{
|
|
13
|
+
export const sizeEnterAtom = ({ orientation, duration, easing, element, fromSize = '0', delay = 0 })=>{
|
|
14
14
|
const { sizeName, overflowName, toSize } = sizeValuesForOrientation(orientation, element);
|
|
15
15
|
return {
|
|
16
16
|
keyframes: [
|
|
@@ -29,7 +29,9 @@ export const sizeEnterAtom = ({ orientation, duration, easing, element, fromSize
|
|
|
29
29
|
}
|
|
30
30
|
],
|
|
31
31
|
duration,
|
|
32
|
-
easing
|
|
32
|
+
easing,
|
|
33
|
+
delay,
|
|
34
|
+
fill: 'both'
|
|
33
35
|
};
|
|
34
36
|
};
|
|
35
37
|
export const sizeExitAtom = ({ orientation, duration, easing, element, delay = 0, fromSize = '0' })=>{
|
|
@@ -47,8 +49,8 @@ export const sizeExitAtom = ({ orientation, duration, easing, element, delay = 0
|
|
|
47
49
|
],
|
|
48
50
|
duration,
|
|
49
51
|
easing,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
delay,
|
|
53
|
+
fill: 'both'
|
|
52
54
|
};
|
|
53
55
|
};
|
|
54
56
|
// ----- WHITESPACE -----
|
|
@@ -88,14 +90,11 @@ const whitespaceValuesForOrientation = (orientation)=>{
|
|
|
88
90
|
offset
|
|
89
91
|
}
|
|
90
92
|
];
|
|
91
|
-
|
|
93
|
+
return {
|
|
92
94
|
keyframes,
|
|
93
95
|
duration,
|
|
94
96
|
easing,
|
|
95
|
-
delay
|
|
97
|
+
delay,
|
|
98
|
+
fill: 'both'
|
|
96
99
|
};
|
|
97
|
-
if (direction === 'exit') {
|
|
98
|
-
atom.fill = 'forwards';
|
|
99
|
-
}
|
|
100
|
-
return atom;
|
|
101
100
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Collapse/collapse-atoms.ts"],"sourcesContent":["import { AtomMotion, PresenceDirection } from '@fluentui/react-motion';\nimport { CollapseOrientation } from './collapse-types';\n\n// ----- SIZE -----\n\nconst sizeValuesForOrientation = (orientation: CollapseOrientation, element: Element) => {\n const sizeName = orientation === 'horizontal' ? 'maxWidth' : 'maxHeight';\n const overflowName = orientation === 'horizontal' ? 'overflowX' : 'overflowY';\n const measuredSize = orientation === 'horizontal' ? element.scrollWidth : element.scrollHeight;\n const toSize = `${measuredSize}px`;\n return { sizeName, overflowName, toSize };\n};\n\ninterface SizeEnterAtomParams {\n orientation: CollapseOrientation;\n duration: number;\n easing: string;\n element: HTMLElement;\n fromSize?: string;\n}\n\nexport const sizeEnterAtom = ({\n orientation,\n duration,\n easing,\n element,\n fromSize = '0',\n}: SizeEnterAtomParams): AtomMotion => {\n const { sizeName, overflowName, toSize } = sizeValuesForOrientation(orientation, element);\n\n return {\n keyframes: [\n { [sizeName]: fromSize, [overflowName]: 'hidden' },\n { [sizeName]: toSize, offset: 0.9999, [overflowName]: 'hidden' },\n { [sizeName]: 'unset', [overflowName]: 'unset' },\n ],\n duration,\n easing,\n };\n};\n\ninterface SizeExitAtomParams extends SizeEnterAtomParams {\n delay?: number;\n}\n\nexport const sizeExitAtom = ({\n orientation,\n duration,\n easing,\n element,\n delay = 0,\n fromSize = '0',\n}: SizeExitAtomParams): AtomMotion => {\n const { sizeName, overflowName, toSize } = sizeValuesForOrientation(orientation, element);\n\n return {\n keyframes: [\n { [sizeName]: toSize, [overflowName]: 'hidden' },\n { [sizeName]: fromSize, [overflowName]: 'hidden' },\n ],\n duration,\n easing,\n fill: 'both',\n
|
|
1
|
+
{"version":3,"sources":["../src/components/Collapse/collapse-atoms.ts"],"sourcesContent":["import { AtomMotion, PresenceDirection } from '@fluentui/react-motion';\nimport { CollapseOrientation } from './collapse-types';\n\n// ----- SIZE -----\n\nconst sizeValuesForOrientation = (orientation: CollapseOrientation, element: Element) => {\n const sizeName = orientation === 'horizontal' ? 'maxWidth' : 'maxHeight';\n const overflowName = orientation === 'horizontal' ? 'overflowX' : 'overflowY';\n const measuredSize = orientation === 'horizontal' ? element.scrollWidth : element.scrollHeight;\n const toSize = `${measuredSize}px`;\n return { sizeName, overflowName, toSize };\n};\n\ninterface SizeEnterAtomParams {\n orientation: CollapseOrientation;\n duration: number;\n easing: string;\n element: HTMLElement;\n fromSize?: string;\n delay?: number;\n}\n\nexport const sizeEnterAtom = ({\n orientation,\n duration,\n easing,\n element,\n fromSize = '0',\n delay = 0,\n}: SizeEnterAtomParams): AtomMotion => {\n const { sizeName, overflowName, toSize } = sizeValuesForOrientation(orientation, element);\n\n return {\n keyframes: [\n { [sizeName]: fromSize, [overflowName]: 'hidden' },\n { [sizeName]: toSize, offset: 0.9999, [overflowName]: 'hidden' },\n { [sizeName]: 'unset', [overflowName]: 'unset' },\n ],\n duration,\n easing,\n delay,\n fill: 'both',\n };\n};\n\ninterface SizeExitAtomParams extends SizeEnterAtomParams {\n delay?: number;\n}\n\nexport const sizeExitAtom = ({\n orientation,\n duration,\n easing,\n element,\n delay = 0,\n fromSize = '0',\n}: SizeExitAtomParams): AtomMotion => {\n const { sizeName, overflowName, toSize } = sizeValuesForOrientation(orientation, element);\n\n return {\n keyframes: [\n { [sizeName]: toSize, [overflowName]: 'hidden' },\n { [sizeName]: fromSize, [overflowName]: 'hidden' },\n ],\n duration,\n easing,\n delay,\n fill: 'both',\n };\n};\n\n// ----- WHITESPACE -----\n\n// Whitespace animation includes padding and margin.\nconst whitespaceValuesForOrientation = (orientation: CollapseOrientation) => {\n // horizontal whitespace collapse\n if (orientation === 'horizontal') {\n return {\n paddingStart: 'paddingInlineStart',\n paddingEnd: 'paddingInlineEnd',\n marginStart: 'marginInlineStart',\n marginEnd: 'marginInlineEnd',\n };\n }\n // vertical whitespace collapse\n return {\n paddingStart: 'paddingBlockStart',\n paddingEnd: 'paddingBlockEnd',\n marginStart: 'marginBlockStart',\n marginEnd: 'marginBlockEnd',\n };\n};\n\ninterface WhitespaceAtomParams {\n direction: PresenceDirection;\n orientation: CollapseOrientation;\n duration: number;\n easing: string;\n delay?: number;\n}\n\n/**\n * A collapse animates an element's height to zero,\n but the zero height does not eliminate padding or margin in the box model.\n So here we generate keyframes to animate those whitespace properties to zero.\n */\nexport const whitespaceAtom = ({\n direction,\n orientation,\n duration,\n easing,\n delay = 0,\n}: WhitespaceAtomParams): AtomMotion => {\n const { paddingStart, paddingEnd, marginStart, marginEnd } = whitespaceValuesForOrientation(orientation);\n // The keyframe with zero whitespace is at the start for enter and at the end for exit.\n const offset = direction === 'enter' ? 0 : 1;\n const keyframes = [{ [paddingStart]: '0', [paddingEnd]: '0', [marginStart]: '0', [marginEnd]: '0', offset }];\n\n return {\n keyframes,\n duration,\n easing,\n delay,\n fill: 'both',\n };\n};\n"],"names":["sizeValuesForOrientation","orientation","element","sizeName","overflowName","measuredSize","scrollWidth","scrollHeight","toSize","sizeEnterAtom","duration","easing","fromSize","delay","keyframes","offset","fill","sizeExitAtom","whitespaceValuesForOrientation","paddingStart","paddingEnd","marginStart","marginEnd","whitespaceAtom","direction"],"mappings":"AAGA,mBAAmB;AAEnB,MAAMA,2BAA2B,CAACC,aAAkCC;IAClE,MAAMC,WAAWF,gBAAgB,eAAe,aAAa;IAC7D,MAAMG,eAAeH,gBAAgB,eAAe,cAAc;IAClE,MAAMI,eAAeJ,gBAAgB,eAAeC,QAAQI,WAAW,GAAGJ,QAAQK,YAAY;IAC9F,MAAMC,SAAS,GAAGH,aAAa,EAAE,CAAC;IAClC,OAAO;QAAEF;QAAUC;QAAcI;IAAO;AAC1C;AAWA,OAAO,MAAMC,gBAAgB,CAAC,EAC5BR,WAAW,EACXS,QAAQ,EACRC,MAAM,EACNT,OAAO,EACPU,WAAW,GAAG,EACdC,QAAQ,CAAC,EACW;IACpB,MAAM,EAAEV,QAAQ,EAAEC,YAAY,EAAEI,MAAM,EAAE,GAAGR,yBAAyBC,aAAaC;IAEjF,OAAO;QACLY,WAAW;YACT;gBAAE,CAACX,SAAS,EAAES;gBAAU,CAACR,aAAa,EAAE;YAAS;YACjD;gBAAE,CAACD,SAAS,EAAEK;gBAAQO,QAAQ;gBAAQ,CAACX,aAAa,EAAE;YAAS;YAC/D;gBAAE,CAACD,SAAS,EAAE;gBAAS,CAACC,aAAa,EAAE;YAAQ;SAChD;QACDM;QACAC;QACAE;QACAG,MAAM;IACR;AACF,EAAE;AAMF,OAAO,MAAMC,eAAe,CAAC,EAC3BhB,WAAW,EACXS,QAAQ,EACRC,MAAM,EACNT,OAAO,EACPW,QAAQ,CAAC,EACTD,WAAW,GAAG,EACK;IACnB,MAAM,EAAET,QAAQ,EAAEC,YAAY,EAAEI,MAAM,EAAE,GAAGR,yBAAyBC,aAAaC;IAEjF,OAAO;QACLY,WAAW;YACT;gBAAE,CAACX,SAAS,EAAEK;gBAAQ,CAACJ,aAAa,EAAE;YAAS;YAC/C;gBAAE,CAACD,SAAS,EAAES;gBAAU,CAACR,aAAa,EAAE;YAAS;SAClD;QACDM;QACAC;QACAE;QACAG,MAAM;IACR;AACF,EAAE;AAEF,yBAAyB;AAEzB,oDAAoD;AACpD,MAAME,iCAAiC,CAACjB;IACtC,iCAAiC;IACjC,IAAIA,gBAAgB,cAAc;QAChC,OAAO;YACLkB,cAAc;YACdC,YAAY;YACZC,aAAa;YACbC,WAAW;QACb;IACF;IACA,+BAA+B;IAC/B,OAAO;QACLH,cAAc;QACdC,YAAY;QACZC,aAAa;QACbC,WAAW;IACb;AACF;AAUA;;;;CAIC,GACD,OAAO,MAAMC,iBAAiB,CAAC,EAC7BC,SAAS,EACTvB,WAAW,EACXS,QAAQ,EACRC,MAAM,EACNE,QAAQ,CAAC,EACY;IACrB,MAAM,EAAEM,YAAY,EAAEC,UAAU,EAAEC,WAAW,EAAEC,SAAS,EAAE,GAAGJ,+BAA+BjB;IAC5F,uFAAuF;IACvF,MAAMc,SAASS,cAAc,UAAU,IAAI;IAC3C,MAAMV,YAAY;QAAC;YAAE,CAACK,aAAa,EAAE;YAAK,CAACC,WAAW,EAAE;YAAK,CAACC,YAAY,EAAE;YAAK,CAACC,UAAU,EAAE;YAAKP;QAAO;KAAE;IAE5G,OAAO;QACLD;QACAJ;QACAC;QACAE;QACAG,MAAM;IACR;AACF,EAAE"}
|