@fluentui/react-motion-components-preview 0.0.0-nightly-20241018-0406.1 → 0.0.0-nightly-20241023-0407.1
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 +7 -7
- package/dist/index.d.ts +49 -1
- package/lib/components/Collapse/Collapse.js +50 -102
- package/lib/components/Collapse/Collapse.js.map +1 -1
- package/lib/components/Collapse/collapse-atoms.js +123 -0
- package/lib/components/Collapse/collapse-atoms.js.map +1 -0
- package/lib/components/Collapse/collapse-types.js +1 -0
- package/lib/components/Collapse/collapse-types.js.map +1 -0
- package/lib/components/Fade/Fade.js +34 -40
- package/lib/components/Fade/Fade.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib-commonjs/components/Collapse/Collapse.js +53 -100
- package/lib-commonjs/components/Collapse/Collapse.js.map +1 -1
- package/lib-commonjs/components/Collapse/collapse-atoms.js +149 -0
- package/lib-commonjs/components/Collapse/collapse-atoms.js.map +1 -0
- package/lib-commonjs/components/Collapse/collapse-types.js +4 -0
- package/lib-commonjs/components/Collapse/collapse-types.js.map +1 -0
- package/lib-commonjs/components/Fade/Fade.js +36 -39
- package/lib-commonjs/components/Fade/Fade.js.map +1 -1
- package/lib-commonjs/index.js +9 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
@@ -1,20 +1,20 @@
|
|
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 Wed, 23 Oct 2024 04:11:45 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-nightly-
|
7
|
+
## [0.0.0-nightly-20241023-0407.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion-components-preview_v0.0.0-nightly-20241023-0407.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-motion-components-preview_v0.2.0..@fluentui/react-motion-components-preview_v0.0.0-nightly-
|
9
|
+
Wed, 23 Oct 2024 04:11:45 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-motion-components-preview_v0.2.0..@fluentui/react-motion-components-preview_v0.0.0-nightly-20241023-0407.1)
|
11
11
|
|
12
12
|
### Changes
|
13
13
|
|
14
14
|
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
|
15
|
-
- Bump @fluentui/react-motion to v0.0.0-nightly-
|
16
|
-
- Bump @fluentui/react-conformance to v0.0.0-nightly-
|
17
|
-
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
15
|
+
- Bump @fluentui/react-motion to v0.0.0-nightly-20241023-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/2d148a24ef86132106a54676eb87418afe7b84b2) by beachball)
|
16
|
+
- Bump @fluentui/react-conformance to v0.0.0-nightly-20241023-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/2d148a24ef86132106a54676eb87418afe7b84b2) by beachball)
|
17
|
+
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20241023-0407.1 ([commit](https://github.com/microsoft/fluentui/commit/2d148a24ef86132106a54676eb87418afe7b84b2) by beachball)
|
18
18
|
|
19
19
|
## [0.2.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion-components-preview_v0.2.0)
|
20
20
|
|
package/dist/index.d.ts
CHANGED
@@ -1,10 +1,32 @@
|
|
1
1
|
import type { MotionParam } from '@fluentui/react-motion';
|
2
2
|
import { PresenceComponent } from '@fluentui/react-motion';
|
3
|
+
import type { PresenceMotion } from '@fluentui/react-motion';
|
3
4
|
import type { PresenceMotionFn } from '@fluentui/react-motion';
|
4
5
|
|
5
6
|
/** A React component that applies collapse/expand transitions to its children. */
|
6
7
|
export declare const Collapse: PresenceComponent<CollapseRuntimeParams>;
|
7
8
|
|
9
|
+
export declare const CollapseDelayed: PresenceComponent<CollapseRuntimeParams>;
|
10
|
+
|
11
|
+
declare type CollapseDelayedVariantParams = {
|
12
|
+
/** Time (ms) for the size expand. Defaults to the durationNormal value (200 ms). */
|
13
|
+
enterSizeDuration?: number;
|
14
|
+
/** Time (ms) for the fade-in. Defaults to the enterSizeDuration param, to sync fade-in with expand. */
|
15
|
+
enterOpacityDuration?: number;
|
16
|
+
/** Time (ms) for the size collapse. Defaults to the enterSizeDuration param, for temporal symmetry.. */
|
17
|
+
exitSizeDuration?: number;
|
18
|
+
/** Defaults to the exitSizeDuration param, to sync the fade-out with the collapse. */
|
19
|
+
exitOpacityDuration?: number;
|
20
|
+
/** Time (ms) between the size expand start and the fade-in start. Defaults to `0`. */
|
21
|
+
enterDelay?: number;
|
22
|
+
/** Time (ms) between the fade-out start and the size collapse start. Defaults to `0`. */
|
23
|
+
exitDelay?: number;
|
24
|
+
/** Easing curve for the enter transition, shared by size and opacity. Defaults to the easeEaseMax value. */
|
25
|
+
enterEasing?: string;
|
26
|
+
/** Easing curve for the exit transition, shared by size and opacity. Defaults to the enterEasing param. */
|
27
|
+
exitEasing?: string;
|
28
|
+
};
|
29
|
+
|
8
30
|
export declare const CollapseExaggerated: PresenceComponent<CollapseRuntimeParams>;
|
9
31
|
|
10
32
|
declare type CollapseOrientation = 'horizontal' | 'vertical';
|
@@ -29,9 +51,15 @@ declare type CollapseVariantParams = {
|
|
29
51
|
exitEasing?: string;
|
30
52
|
};
|
31
53
|
|
32
|
-
/** Define a presence motion for collapse/expand */
|
54
|
+
/** Define a presence motion for collapse/expand that can stagger the size and opacity motions by a given delay. */
|
55
|
+
export declare const createCollapseDelayedPresence: PresenceMotionFnCreator<CollapseDelayedVariantParams, CollapseRuntimeParams>;
|
56
|
+
|
57
|
+
/** Defines a presence motion for collapse/expand. */
|
33
58
|
export declare const createCollapsePresence: PresenceMotionFnCreator<CollapseVariantParams, CollapseRuntimeParams>;
|
34
59
|
|
60
|
+
/** Define a presence motion for fade in/out */
|
61
|
+
export declare const createFadePresence: PresenceMotionCreator<FadeVariantParams>;
|
62
|
+
|
35
63
|
/** A React component that applies fade in/out transitions to its children. */
|
36
64
|
export declare const Fade: PresenceComponent< {}>;
|
37
65
|
|
@@ -39,6 +67,26 @@ export declare const FadeExaggerated: PresenceComponent< {}>;
|
|
39
67
|
|
40
68
|
export declare const FadeSnappy: PresenceComponent< {}>;
|
41
69
|
|
70
|
+
declare type FadeVariantParams = {
|
71
|
+
/** Time (ms) for the enter transition (fade-in). Defaults to the `durationNormal` value (200 ms). */
|
72
|
+
enterDuration?: number;
|
73
|
+
/** Easing curve for the enter transition (fade-in). Defaults to the `easeEase` value. */
|
74
|
+
enterEasing?: string;
|
75
|
+
/** Time (ms) for the exit transition (fade-out). Defaults to the `enterDuration` param for symmetry. */
|
76
|
+
exitDuration?: number;
|
77
|
+
/** Easing curve for the exit transition (fade-out). Defaults to the `enterEasing` param for symmetry. */
|
78
|
+
exitEasing?: string;
|
79
|
+
};
|
80
|
+
|
81
|
+
/**
|
82
|
+
* This is a factory function that generates a motion object from variant params, e.g. duration, easing, etc.
|
83
|
+
* The generated object defines a presence motion with `enter` and `exit` transitions.
|
84
|
+
* This motion object is declarative, i.e. data without side effects,
|
85
|
+
* and it is framework-independent, i.e. non-React.
|
86
|
+
* It can be turned into a React component using `createPresenceComponent`.
|
87
|
+
*/
|
88
|
+
declare type PresenceMotionCreator<MotionVariantParams extends Record<string, MotionParam> = {}> = (variantParams?: MotionVariantParams) => PresenceMotion;
|
89
|
+
|
42
90
|
/**
|
43
91
|
* This is a factory function that generates a motion function, which has variant params bound into it.
|
44
92
|
* The generated motion function accepts other runtime params that aren't locked into the variant, but supplied at runtime.
|
@@ -1,126 +1,67 @@
|
|
1
1
|
import { motionTokens, createPresenceComponent } from '@fluentui/react-motion';
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
const toSize = `${measuredSize}px`;
|
8
|
-
// use generic names for size and overflow, handling vertical or horizontal orientation
|
9
|
-
const sizeName = orientation === 'horizontal' ? 'maxWidth' : 'maxHeight';
|
10
|
-
const overflowName = orientation === 'horizontal' ? 'overflowX' : 'overflowY';
|
11
|
-
// Because a height of zero does not eliminate padding,
|
12
|
-
// we will create keyframes to animate it to zero.
|
13
|
-
// TODO: consider collapsing margin, perhaps as an option.
|
14
|
-
const collapsedWhiteSpace = {};
|
15
|
-
if (orientation === 'horizontal') {
|
16
|
-
collapsedWhiteSpace.paddingLeft = '0';
|
17
|
-
collapsedWhiteSpace.paddingRight = '0';
|
18
|
-
} else {
|
19
|
-
collapsedWhiteSpace.paddingTop = '0';
|
20
|
-
collapsedWhiteSpace.paddingBottom = '0';
|
21
|
-
}
|
2
|
+
import { sizeEnterAtom, whitespaceEnterAtom, opacityEnterAtom, opacityExitAtom, sizeExitAtom, whitespaceExitAtom } from './collapse-atoms';
|
3
|
+
/** Define a presence motion for collapse/expand that can stagger the size and opacity motions by a given delay. */ export const createCollapseDelayedPresence = ({ // enter
|
4
|
+
enterSizeDuration = motionTokens.durationNormal, enterOpacityDuration = enterSizeDuration, enterEasing = motionTokens.curveEasyEaseMax, enterDelay = 0, // exit: durations and easing default to enter values for symmetry
|
5
|
+
exitSizeDuration = enterSizeDuration, exitOpacityDuration = enterOpacityDuration, exitEasing = enterEasing, exitDelay = 0 } = {})=>({ element, animateOpacity = true, orientation = 'vertical' })=>{
|
6
|
+
// ----- ENTER -----
|
22
7
|
// The enter transition is an array of up to 3 motion atoms: size, whitespace and opacity.
|
23
8
|
const enterAtoms = [
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
offset: 0.9999,
|
34
|
-
[overflowName]: 'hidden'
|
35
|
-
},
|
36
|
-
{
|
37
|
-
[sizeName]: 'unset',
|
38
|
-
[overflowName]: 'unset'
|
39
|
-
}
|
40
|
-
],
|
41
|
-
duration: enterDuration,
|
42
|
-
easing: enterEasing
|
43
|
-
},
|
44
|
-
// Expand whitespace (padding currently).
|
45
|
-
{
|
46
|
-
// Animate from zero values to the element's natural values (i.e. the missing other keyframe).
|
47
|
-
keyframes: [
|
48
|
-
{
|
49
|
-
...collapsedWhiteSpace,
|
50
|
-
offset: 0
|
51
|
-
}
|
52
|
-
],
|
53
|
-
duration: enterDuration,
|
9
|
+
sizeEnterAtom({
|
10
|
+
orientation,
|
11
|
+
duration: enterSizeDuration,
|
12
|
+
easing: enterEasing,
|
13
|
+
element
|
14
|
+
}),
|
15
|
+
whitespaceEnterAtom({
|
16
|
+
orientation,
|
17
|
+
duration: enterSizeDuration,
|
54
18
|
easing: enterEasing
|
55
|
-
}
|
19
|
+
})
|
56
20
|
];
|
57
21
|
// Fade in only if animateOpacity is true. Otherwise, leave opacity unaffected.
|
58
22
|
if (animateOpacity) {
|
59
|
-
enterAtoms.push({
|
60
|
-
|
61
|
-
{
|
62
|
-
opacity: fromOpacity
|
63
|
-
},
|
64
|
-
{
|
65
|
-
opacity: toOpacity
|
66
|
-
}
|
67
|
-
],
|
68
|
-
duration: enterDuration,
|
23
|
+
enterAtoms.push(opacityEnterAtom({
|
24
|
+
duration: enterOpacityDuration,
|
69
25
|
easing: enterEasing,
|
70
|
-
|
71
|
-
});
|
26
|
+
delay: enterDelay
|
27
|
+
}));
|
72
28
|
}
|
29
|
+
// ----- EXIT -----
|
73
30
|
// The exit transition is an array of up to 3 motion atoms: opacity, size and whitespace.
|
74
31
|
const exitAtoms = [];
|
75
|
-
// Fade out only if animateOpacity is
|
32
|
+
// Fade out only if animateOpacity is true. Otherwise, leave opacity unaffected.
|
76
33
|
if (animateOpacity) {
|
77
|
-
exitAtoms.push({
|
78
|
-
|
79
|
-
{
|
80
|
-
opacity: toOpacity
|
81
|
-
},
|
82
|
-
{
|
83
|
-
opacity: fromOpacity
|
84
|
-
}
|
85
|
-
],
|
86
|
-
duration: exitDuration,
|
34
|
+
exitAtoms.push(opacityExitAtom({
|
35
|
+
duration: exitOpacityDuration,
|
87
36
|
easing: exitEasing
|
88
|
-
});
|
37
|
+
}));
|
89
38
|
}
|
90
|
-
exitAtoms.push(
|
91
|
-
|
92
|
-
|
93
|
-
{
|
94
|
-
[sizeName]: toSize,
|
95
|
-
[overflowName]: 'hidden'
|
96
|
-
},
|
97
|
-
{
|
98
|
-
[sizeName]: fromSize,
|
99
|
-
[overflowName]: 'hidden'
|
100
|
-
}
|
101
|
-
],
|
102
|
-
duration: exitDuration,
|
39
|
+
exitAtoms.push(sizeExitAtom({
|
40
|
+
orientation,
|
41
|
+
duration: exitSizeDuration,
|
103
42
|
easing: exitEasing,
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
{
|
108
|
-
|
109
|
-
|
110
|
-
{
|
111
|
-
...collapsedWhiteSpace,
|
112
|
-
offset: 1
|
113
|
-
}
|
114
|
-
],
|
115
|
-
duration: exitDuration,
|
43
|
+
element,
|
44
|
+
delay: exitDelay
|
45
|
+
}));
|
46
|
+
exitAtoms.push(whitespaceExitAtom({
|
47
|
+
orientation,
|
48
|
+
duration: exitSizeDuration,
|
116
49
|
easing: exitEasing,
|
117
|
-
|
118
|
-
});
|
50
|
+
delay: exitDelay
|
51
|
+
}));
|
119
52
|
return {
|
120
53
|
enter: enterAtoms,
|
121
54
|
exit: exitAtoms
|
122
55
|
};
|
123
56
|
};
|
57
|
+
/** Defines a presence motion for collapse/expand. */ export const createCollapsePresence = ({ enterDuration = motionTokens.durationNormal, enterEasing = motionTokens.curveEasyEaseMax, exitDuration = enterDuration, exitEasing = enterEasing } = {})=>// Implement a regular collapse as a special case of the delayed collapse,
|
58
|
+
// where the delays are zero, and the size and opacity durations are equal.
|
59
|
+
createCollapseDelayedPresence({
|
60
|
+
enterSizeDuration: enterDuration,
|
61
|
+
enterEasing,
|
62
|
+
exitSizeDuration: exitDuration,
|
63
|
+
exitEasing
|
64
|
+
});
|
124
65
|
/** A React component that applies collapse/expand transitions to its children. */ export const Collapse = createPresenceComponent(createCollapsePresence());
|
125
66
|
export const CollapseSnappy = createPresenceComponent(createCollapsePresence({
|
126
67
|
enterDuration: motionTokens.durationFast
|
@@ -128,3 +69,10 @@ export const CollapseSnappy = createPresenceComponent(createCollapsePresence({
|
|
128
69
|
export const CollapseExaggerated = createPresenceComponent(createCollapsePresence({
|
129
70
|
enterDuration: motionTokens.durationSlower
|
130
71
|
}));
|
72
|
+
export const CollapseDelayed = createPresenceComponent(createCollapseDelayedPresence({
|
73
|
+
enterSizeDuration: motionTokens.durationNormal,
|
74
|
+
enterOpacityDuration: motionTokens.durationSlower,
|
75
|
+
enterDelay: motionTokens.durationNormal,
|
76
|
+
exitDelay: motionTokens.durationSlower,
|
77
|
+
enterEasing: motionTokens.curveEasyEase
|
78
|
+
}));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Collapse.ts"],"sourcesContent":["import { motionTokens, createPresenceComponent, AtomMotion } from '@fluentui/react-motion';\nimport type { PresenceMotionFnCreator } from '../../types';\
|
1
|
+
{"version":3,"sources":["Collapse.ts"],"sourcesContent":["import { motionTokens, createPresenceComponent, AtomMotion } from '@fluentui/react-motion';\nimport type { PresenceMotionFnCreator } from '../../types';\nimport type { CollapseDelayedVariantParams, CollapseRuntimeParams, CollapseVariantParams } from './collapse-types';\nimport {\n sizeEnterAtom,\n whitespaceEnterAtom,\n opacityEnterAtom,\n opacityExitAtom,\n sizeExitAtom,\n whitespaceExitAtom,\n} from './collapse-atoms';\n\n/** Define a presence motion for collapse/expand that can stagger the size and opacity motions by a given delay. */\nexport const createCollapseDelayedPresence: PresenceMotionFnCreator<\n CollapseDelayedVariantParams,\n CollapseRuntimeParams\n> =\n ({\n // enter\n enterSizeDuration = motionTokens.durationNormal,\n enterOpacityDuration = enterSizeDuration, // in sync with size duration by default\n enterEasing = motionTokens.curveEasyEaseMax,\n enterDelay = 0,\n\n // exit: durations and easing default to enter values for symmetry\n exitSizeDuration = enterSizeDuration,\n exitOpacityDuration = enterOpacityDuration,\n exitEasing = enterEasing,\n exitDelay = 0,\n } = {}) =>\n ({ element, animateOpacity = true, orientation = 'vertical' }) => {\n // ----- ENTER -----\n // The enter transition is an array of up to 3 motion atoms: size, whitespace and opacity.\n const enterAtoms: AtomMotion[] = [\n sizeEnterAtom({\n orientation,\n duration: enterSizeDuration,\n easing: enterEasing,\n element,\n }),\n whitespaceEnterAtom({\n orientation,\n duration: enterSizeDuration,\n easing: enterEasing,\n }),\n ];\n // Fade in only if animateOpacity is true. Otherwise, leave opacity unaffected.\n if (animateOpacity) {\n enterAtoms.push(\n opacityEnterAtom({\n duration: enterOpacityDuration,\n easing: enterEasing,\n delay: enterDelay,\n }),\n );\n }\n\n // ----- EXIT -----\n // The exit transition is an array of up to 3 motion atoms: opacity, size and whitespace.\n const exitAtoms: AtomMotion[] = [];\n // Fade out only if animateOpacity is true. Otherwise, leave opacity unaffected.\n if (animateOpacity) {\n exitAtoms.push(\n opacityExitAtom({\n duration: exitOpacityDuration,\n easing: exitEasing,\n }),\n );\n }\n exitAtoms.push(\n sizeExitAtom({\n orientation,\n duration: exitSizeDuration,\n easing: exitEasing,\n element,\n delay: exitDelay,\n }),\n );\n exitAtoms.push(\n whitespaceExitAtom({\n orientation,\n duration: exitSizeDuration,\n easing: exitEasing,\n delay: exitDelay,\n }),\n );\n\n return {\n enter: enterAtoms,\n exit: exitAtoms,\n };\n };\n\n/** Defines a presence motion for collapse/expand. */\nexport const createCollapsePresence: PresenceMotionFnCreator<CollapseVariantParams, CollapseRuntimeParams> = ({\n enterDuration = motionTokens.durationNormal,\n enterEasing = motionTokens.curveEasyEaseMax,\n exitDuration = enterDuration,\n exitEasing = enterEasing,\n} = {}) =>\n // Implement a regular collapse as a special case of the delayed collapse,\n // where the delays are zero, and the size and opacity durations are equal.\n createCollapseDelayedPresence({\n enterSizeDuration: enterDuration,\n enterEasing,\n exitSizeDuration: exitDuration,\n exitEasing,\n });\n\n/** A React component that applies collapse/expand transitions to its children. */\nexport const Collapse = createPresenceComponent(createCollapsePresence());\n\nexport const CollapseSnappy = createPresenceComponent(\n createCollapsePresence({ enterDuration: motionTokens.durationFast }),\n);\n\nexport const CollapseExaggerated = createPresenceComponent(\n createCollapsePresence({ enterDuration: motionTokens.durationSlower }),\n);\n\nexport const CollapseDelayed = createPresenceComponent(\n createCollapseDelayedPresence({\n enterSizeDuration: motionTokens.durationNormal,\n enterOpacityDuration: motionTokens.durationSlower,\n enterDelay: motionTokens.durationNormal,\n exitDelay: motionTokens.durationSlower,\n enterEasing: motionTokens.curveEasyEase,\n }),\n);\n"],"names":["motionTokens","createPresenceComponent","sizeEnterAtom","whitespaceEnterAtom","opacityEnterAtom","opacityExitAtom","sizeExitAtom","whitespaceExitAtom","createCollapseDelayedPresence","enterSizeDuration","durationNormal","enterOpacityDuration","enterEasing","curveEasyEaseMax","enterDelay","exitSizeDuration","exitOpacityDuration","exitEasing","exitDelay","element","animateOpacity","orientation","enterAtoms","duration","easing","push","delay","exitAtoms","enter","exit","createCollapsePresence","enterDuration","exitDuration","Collapse","CollapseSnappy","durationFast","CollapseExaggerated","durationSlower","CollapseDelayed","curveEasyEase"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,YAAY,EAAEC,uBAAuB,QAAoB,yBAAyB;AAG3F,SACEC,aAAa,EACbC,mBAAmB,EACnBC,gBAAgB,EAChBC,eAAe,EACfC,YAAY,EACZC,kBAAkB,QACb,mBAAmB;AAE1B,iHAAiH,GACjH,OAAO,MAAMC,gCAIX,CAAC,EACC,QAAQ;AACRC,oBAAoBT,aAAaU,cAAc,EAC/CC,uBAAuBF,iBAAiB,EACxCG,cAAcZ,aAAaa,gBAAgB,EAC3CC,aAAa,CAAC,EAEd,kEAAkE;AAClEC,mBAAmBN,iBAAiB,EACpCO,sBAAsBL,oBA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I,iBAAiBjC,wBAC5B6B,uBAAuB;IAAEC,eAAe/B,aAAamC,YAAY;AAAC,IAClE;AAEF,OAAO,MAAMC,sBAAsBnC,wBACjC6B,uBAAuB;IAAEC,eAAe/B,aAAaqC,cAAc;AAAC,IACpE;AAEF,OAAO,MAAMC,kBAAkBrC,wBAC7BO,8BAA8B;IAC5BC,mBAAmBT,aAAaU,cAAc;IAC9CC,sBAAsBX,aAAaqC,cAAc;IACjDvB,YAAYd,aAAaU,cAAc;IACvCQ,WAAWlB,aAAaqC,cAAc;IACtCzB,aAAaZ,aAAauC,aAAa;AACzC,IACA"}
|
@@ -0,0 +1,123 @@
|
|
1
|
+
// ----- SIZE -----
|
2
|
+
const sizeValuesForOrientation = (orientation, element)=>{
|
3
|
+
const sizeName = orientation === 'horizontal' ? 'maxWidth' : 'maxHeight';
|
4
|
+
const overflowName = orientation === 'horizontal' ? 'overflowX' : 'overflowY';
|
5
|
+
const measuredSize = orientation === 'horizontal' ? element.scrollWidth : element.scrollHeight;
|
6
|
+
const toSize = `${measuredSize}px`;
|
7
|
+
return {
|
8
|
+
sizeName,
|
9
|
+
overflowName,
|
10
|
+
toSize
|
11
|
+
};
|
12
|
+
};
|
13
|
+
export const sizeEnterAtom = ({ orientation, duration, easing, element, fromSize = '0' })=>{
|
14
|
+
const { sizeName, overflowName, toSize } = sizeValuesForOrientation(orientation, element);
|
15
|
+
return {
|
16
|
+
keyframes: [
|
17
|
+
{
|
18
|
+
[sizeName]: fromSize,
|
19
|
+
[overflowName]: 'hidden'
|
20
|
+
},
|
21
|
+
{
|
22
|
+
[sizeName]: toSize,
|
23
|
+
offset: 0.9999,
|
24
|
+
[overflowName]: 'hidden'
|
25
|
+
},
|
26
|
+
{
|
27
|
+
[sizeName]: 'unset',
|
28
|
+
[overflowName]: 'unset'
|
29
|
+
}
|
30
|
+
],
|
31
|
+
duration,
|
32
|
+
easing
|
33
|
+
};
|
34
|
+
};
|
35
|
+
export const sizeExitAtom = ({ orientation, duration, easing, element, delay = 0, fromSize = '0' })=>{
|
36
|
+
const { sizeName, overflowName, toSize } = sizeValuesForOrientation(orientation, element);
|
37
|
+
return {
|
38
|
+
keyframes: [
|
39
|
+
{
|
40
|
+
[sizeName]: toSize,
|
41
|
+
[overflowName]: 'hidden'
|
42
|
+
},
|
43
|
+
{
|
44
|
+
[sizeName]: fromSize,
|
45
|
+
[overflowName]: 'hidden'
|
46
|
+
}
|
47
|
+
],
|
48
|
+
duration,
|
49
|
+
easing,
|
50
|
+
fill: 'both',
|
51
|
+
delay
|
52
|
+
};
|
53
|
+
};
|
54
|
+
// ----- WHITESPACE -----
|
55
|
+
// Whitespace animation currently includes padding, but could be extended to handle margin.
|
56
|
+
const whitespaceValuesForOrientation = (orientation)=>{
|
57
|
+
const paddingStart = orientation === 'horizontal' ? 'paddingLeft' : 'paddingTop';
|
58
|
+
const paddingEnd = orientation === 'horizontal' ? 'paddingRight' : 'paddingBottom';
|
59
|
+
return {
|
60
|
+
paddingStart,
|
61
|
+
paddingEnd
|
62
|
+
};
|
63
|
+
};
|
64
|
+
// Because a height of zero does not eliminate padding,
|
65
|
+
// we will create keyframes to animate it to zero.
|
66
|
+
// TODO: consider collapsing margin, perhaps as an option.
|
67
|
+
export const whitespaceEnterAtom = ({ orientation, duration, easing })=>{
|
68
|
+
const { paddingStart, paddingEnd } = whitespaceValuesForOrientation(orientation);
|
69
|
+
return {
|
70
|
+
keyframes: [
|
71
|
+
{
|
72
|
+
[paddingStart]: '0',
|
73
|
+
[paddingEnd]: '0',
|
74
|
+
offset: 0
|
75
|
+
}
|
76
|
+
],
|
77
|
+
duration,
|
78
|
+
easing
|
79
|
+
};
|
80
|
+
};
|
81
|
+
export const whitespaceExitAtom = ({ orientation, duration, easing, delay = 0 })=>{
|
82
|
+
const { paddingStart, paddingEnd } = whitespaceValuesForOrientation(orientation);
|
83
|
+
return {
|
84
|
+
keyframes: [
|
85
|
+
{
|
86
|
+
[paddingStart]: '0',
|
87
|
+
[paddingEnd]: '0',
|
88
|
+
offset: 1
|
89
|
+
}
|
90
|
+
],
|
91
|
+
duration,
|
92
|
+
easing,
|
93
|
+
fill: 'forwards',
|
94
|
+
delay
|
95
|
+
};
|
96
|
+
};
|
97
|
+
// ----- OPACITY -----
|
98
|
+
export const opacityEnterAtom = ({ duration, easing, delay = 0, fromOpacity = 0, toOpacity = 1 })=>({
|
99
|
+
keyframes: [
|
100
|
+
{
|
101
|
+
opacity: fromOpacity
|
102
|
+
},
|
103
|
+
{
|
104
|
+
opacity: toOpacity
|
105
|
+
}
|
106
|
+
],
|
107
|
+
duration,
|
108
|
+
easing,
|
109
|
+
delay,
|
110
|
+
fill: 'both'
|
111
|
+
});
|
112
|
+
export const opacityExitAtom = ({ duration, easing, fromOpacity = 0, toOpacity = 1 })=>({
|
113
|
+
keyframes: [
|
114
|
+
{
|
115
|
+
opacity: toOpacity
|
116
|
+
},
|
117
|
+
{
|
118
|
+
opacity: fromOpacity
|
119
|
+
}
|
120
|
+
],
|
121
|
+
duration,
|
122
|
+
easing
|
123
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["collapse-atoms.ts"],"sourcesContent":["import { AtomMotion } from '@fluentui/react-motion/src/types';\nimport type { 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\nexport const sizeEnterAtom = ({\n orientation,\n duration,\n easing,\n element,\n fromSize = '0',\n}: {\n orientation: CollapseOrientation;\n duration: number;\n easing: string;\n element: HTMLElement;\n fromSize?: string;\n}): 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\nexport const sizeExitAtom = ({\n orientation,\n duration,\n easing,\n element,\n delay = 0,\n fromSize = '0',\n}: {\n orientation: CollapseOrientation;\n duration: number;\n easing: string;\n element: HTMLElement;\n delay?: number;\n fromSize?: string;\n}): 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 delay,\n };\n};\n\n// ----- WHITESPACE -----\n\n// Whitespace animation currently includes padding, but could be extended to handle margin.\nconst whitespaceValuesForOrientation = (orientation: CollapseOrientation) => {\n const paddingStart = orientation === 'horizontal' ? 'paddingLeft' : 'paddingTop';\n const paddingEnd = orientation === 'horizontal' ? 'paddingRight' : 'paddingBottom';\n return { paddingStart, paddingEnd };\n};\n\n// Because a height of zero does not eliminate padding,\n// we will create keyframes to animate it to zero.\n// TODO: consider collapsing margin, perhaps as an option.\nexport const whitespaceEnterAtom = ({\n orientation,\n duration,\n easing,\n}: {\n orientation: CollapseOrientation;\n duration: number;\n easing: string;\n}): AtomMotion => {\n const { paddingStart, paddingEnd } = whitespaceValuesForOrientation(orientation);\n return {\n keyframes: [{ [paddingStart]: '0', [paddingEnd]: '0', offset: 0 }],\n duration,\n easing,\n };\n};\n\nexport const whitespaceExitAtom = ({\n orientation,\n duration,\n easing,\n delay = 0,\n}: {\n orientation: CollapseOrientation;\n duration: number;\n easing: string;\n delay?: number;\n}): AtomMotion => {\n const { paddingStart, paddingEnd } = whitespaceValuesForOrientation(orientation);\n return {\n keyframes: [{ [paddingStart]: '0', [paddingEnd]: '0', offset: 1 }],\n duration,\n easing,\n fill: 'forwards',\n delay,\n };\n};\n\n// ----- OPACITY -----\n\nexport const opacityEnterAtom = ({\n duration,\n easing,\n delay = 0,\n fromOpacity = 0,\n toOpacity = 1,\n}: {\n duration: number;\n easing: string;\n delay?: number;\n fromOpacity?: number;\n toOpacity?: number;\n}): AtomMotion => ({\n keyframes: [{ opacity: fromOpacity }, { opacity: toOpacity }],\n duration,\n easing,\n delay,\n fill: 'both',\n});\n\nexport const opacityExitAtom = ({\n duration,\n easing,\n fromOpacity = 0,\n toOpacity = 1,\n}: {\n duration: number;\n easing: string;\n fromOpacity?: number;\n toOpacity?: number;\n}): AtomMotion => ({\n keyframes: [{ opacity: toOpacity }, { opacity: fromOpacity }],\n duration,\n easing,\n});\n"],"names":["sizeValuesForOrientation","orientation","element","sizeName","overflowName","measuredSize","scrollWidth","scrollHeight","toSize","sizeEnterAtom","duration","easing","fromSize","keyframes","offset","sizeExitAtom","delay","fill","whitespaceValuesForOrientation","paddingStart","paddingEnd","whitespaceEnterAtom","whitespaceExitAtom","opacityEnterAtom","fromOpacity","toOpacity","opacity","opacityExitAtom"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","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,CAAC,EAAEH,aAAa,EAAE,CAAC;IAClC,OAAO;QAAEF;QAAUC;QAAcI;IAAO;AAC1C;AAEA,OAAO,MAAMC,gBAAgB,CAAC,EAC5BR,WAAW,EACXS,QAAQ,EACRC,MAAM,EACNT,OAAO,EACPU,WAAW,GAAG,EAOf;IACC,MAAM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;QAClEJ;QACAC;IACF;AACF,EAAE;AAEF,OAAO,MAAMW,qBAAqB,CAAC,EACjCrB,WAAW,EACXS,QAAQ,EACRC,MAAM,EACNK,QAAQ,CAAC,EAMV;IACC,MAAM,EAAEG,YAAY,EAAEC,UAAU,EAAE,GAAGF,+BAA+BjB;IACpE,OAAO;QACLY,WAAW;YAAC;gBAAE,CAACM,aAAa,EAAE;gBAAK,CAACC,WAAW,EAAE;gBAAKN,QAAQ;YAAE;SAAE;QAClEJ;QACAC;QACAM,MAAM;QACND;IACF;AACF,EAAE;AAEF,sBAAsB;AAEtB,OAAO,MAAMO,mBAAmB,CAAC,EAC/Bb,QAAQ,EACRC,MAAM,EACNK,QAAQ,CAAC,EACTQ,cAAc,CAAC,EACfC,YAAY,CAAC,EAOd,GAAkB,CAAA;QACjBZ,WAAW;YAAC;gBAAEa,SAASF;YAAY;YAAG;gBAAEE,SAASD;YAAU;SAAE;QAC7Df;QACAC;QACAK;QACAC,MAAM;IACR,CAAA,EAAG;AAEH,OAAO,MAAMU,kBAAkB,CAAC,EAC9BjB,QAAQ,EACRC,MAAM,EACNa,cAAc,CAAC,EACfC,YAAY,CAAC,EAMd,GAAkB,CAAA;QACjBZ,WAAW;YAAC;gBAAEa,SAASD;YAAU;YAAG;gBAAEC,SAASF;YAAY;SAAE;QAC7Dd;QACAC;IACF,CAAA,EAAG"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { };
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["collapse-types.ts"],"sourcesContent":["export type CollapseOrientation = 'horizontal' | 'vertical';\n\n// TODO: reduce duplication between CollapseDelayedVariantParams and CollapseVariantParams\nexport type CollapseDelayedVariantParams = {\n /** Time (ms) for the size expand. Defaults to the durationNormal value (200 ms). */\n enterSizeDuration?: number;\n\n /** Time (ms) for the fade-in. Defaults to the enterSizeDuration param, to sync fade-in with expand. */\n enterOpacityDuration?: number;\n\n /** Time (ms) for the size collapse. Defaults to the enterSizeDuration param, for temporal symmetry.. */\n exitSizeDuration?: number;\n\n /** 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 enterDelay?: number;\n\n /** Time (ms) between the fade-out start and the size collapse start. Defaults to `0`. */\n exitDelay?: number;\n\n /** Easing curve for the enter transition, shared by size and opacity. Defaults to the easeEaseMax value. */\n enterEasing?: string;\n\n /** Easing curve for the exit transition, shared by size and opacity. Defaults to the enterEasing param. */\n exitEasing?: string;\n};\n\nexport type CollapseRuntimeParams = {\n /** Whether to animate the opacity. Defaults to `true`. */\n animateOpacity?: boolean;\n\n /** The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height. */\n orientation?: CollapseOrientation;\n};\n\nexport type CollapseVariantParams = {\n /** Time (ms) for the enter transition (expand). Defaults to the `durationNormal` value (200 ms). */\n enterDuration?: number;\n\n /** Easing curve for the enter transition (expand). Defaults to the `easeEaseMax` value. */\n enterEasing?: string;\n\n /** Time (ms) for the exit transition (collapse). Defaults to the `enterDuration` param for symmetry. */\n exitDuration?: number;\n\n /** Easing curve for the exit transition (collapse). Defaults to the `enterEasing` param for symmetry. */\n exitEasing?: string;\n};\n"],"names":[],"rangeMappings":"","mappings":"AAqCA,WAYE"}
|
@@ -1,40 +1,34 @@
|
|
1
|
-
import { motionTokens, createPresenceComponent
|
2
|
-
const
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
});
|
36
|
-
export const FadeExaggerated = createPresenceComponentVariant(Fade, {
|
37
|
-
all: {
|
38
|
-
duration: motionTokens.durationGentle
|
39
|
-
}
|
40
|
-
});
|
1
|
+
import { motionTokens, createPresenceComponent } from '@fluentui/react-motion';
|
2
|
+
/** Define a presence motion for fade in/out */ export const createFadePresence = ({ enterDuration = motionTokens.durationNormal, enterEasing = motionTokens.curveEasyEase, exitDuration = enterDuration, exitEasing = enterEasing } = {})=>({
|
3
|
+
enter: {
|
4
|
+
duration: enterDuration,
|
5
|
+
easing: enterEasing,
|
6
|
+
keyframes: [
|
7
|
+
{
|
8
|
+
opacity: 0
|
9
|
+
},
|
10
|
+
{
|
11
|
+
opacity: 1
|
12
|
+
}
|
13
|
+
]
|
14
|
+
},
|
15
|
+
exit: {
|
16
|
+
duration: exitDuration,
|
17
|
+
easing: exitEasing,
|
18
|
+
keyframes: [
|
19
|
+
{
|
20
|
+
opacity: 1
|
21
|
+
},
|
22
|
+
{
|
23
|
+
opacity: 0
|
24
|
+
}
|
25
|
+
]
|
26
|
+
}
|
27
|
+
});
|
28
|
+
/** A React component that applies fade in/out transitions to its children. */ export const Fade = createPresenceComponent(createFadePresence());
|
29
|
+
export const FadeSnappy = createPresenceComponent(createFadePresence({
|
30
|
+
enterDuration: motionTokens.durationFast
|
31
|
+
}));
|
32
|
+
export const FadeExaggerated = createPresenceComponent(createFadePresence({
|
33
|
+
enterDuration: motionTokens.durationGentle
|
34
|
+
}));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Fade.ts"],"sourcesContent":["import {
|
1
|
+
{"version":3,"sources":["Fade.ts"],"sourcesContent":["import { motionTokens, createPresenceComponent } from '@fluentui/react-motion';\nimport type { PresenceMotionCreator } from '../../types';\n\ntype FadeVariantParams = {\n /** Time (ms) for the enter transition (fade-in). Defaults to the `durationNormal` value (200 ms). */\n enterDuration?: number;\n\n /** Easing curve for the enter transition (fade-in). Defaults to the `easeEase` value. */\n enterEasing?: string;\n\n /** Time (ms) for the exit transition (fade-out). Defaults to the `enterDuration` param for symmetry. */\n exitDuration?: number;\n\n /** Easing curve for the exit transition (fade-out). Defaults to the `enterEasing` param for symmetry. */\n exitEasing?: string;\n};\n\n/** Define a presence motion for fade in/out */\nexport const createFadePresence: PresenceMotionCreator<FadeVariantParams> = ({\n enterDuration = motionTokens.durationNormal,\n enterEasing = motionTokens.curveEasyEase,\n exitDuration = enterDuration,\n exitEasing = enterEasing,\n} = {}) => ({\n enter: { duration: enterDuration, easing: enterEasing, keyframes: [{ opacity: 0 }, { opacity: 1 }] },\n exit: { duration: exitDuration, easing: exitEasing, keyframes: [{ opacity: 1 }, { opacity: 0 }] },\n});\n\n/** A React component that applies fade in/out transitions to its children. */\nexport const Fade = createPresenceComponent(createFadePresence());\n\nexport const FadeSnappy = createPresenceComponent(createFadePresence({ enterDuration: motionTokens.durationFast }));\n\nexport const FadeExaggerated = createPresenceComponent(\n createFadePresence({ enterDuration: motionTokens.durationGentle }),\n);\n"],"names":["motionTokens","createPresenceComponent","createFadePresence","enterDuration","durationNormal","enterEasing","curveEasyEase","exitDuration","exitEasing","enter","duration","easing","keyframes","opacity","exit","Fade","FadeSnappy","durationFast","FadeExaggerated","durationGentle"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,YAAY,EAAEC,uBAAuB,QAAQ,yBAAyB;AAiB/E,8CAA8C,GAC9C,OAAO,MAAMC,qBAA+D,CAAC,EAC3EC,gBAAgBH,aAAaI,cAAc,EAC3CC,cAAcL,aAAaM,aAAa,EACxCC,eAAeJ,aAAa,EAC5BK,aAAaH,WAAW,EACzB,GAAG,CAAC,CAAC,GAAM,CAAA;QACVI,OAAO;YAAEC,UAAUP;YAAeQ,QAAQN;YAAaO,WAAW;gBAAC;oBAAEC,SAAS;gBAAE;gBAAG;oBAAEA,SAAS;gBAAE;aAAE;QAAC;QACnGC,MAAM;YAAEJ,UAAUH;YAAcI,QAAQH;YAAYI,WAAW;gBAAC;oBAAEC,SAAS;gBAAE;gBAAG;oBAAEA,SAAS;gBAAE;aAAE;QAAC;IAClG,CAAA,EAAG;AAEH,4EAA4E,GAC5E,OAAO,MAAME,OAAOd,wBAAwBC,sBAAsB;AAElE,OAAO,MAAMc,aAAaf,wBAAwBC,mBAAmB;IAAEC,eAAeH,aAAaiB,YAAY;AAAC,IAAI;AAEpH,OAAO,MAAMC,kBAAkBjB,wBAC7BC,mBAAmB;IAAEC,eAAeH,aAAamB,cAAc;AAAC,IAChE"}
|
package/lib/index.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
export { Collapse, CollapseSnappy, CollapseExaggerated, createCollapsePresence } from './components/Collapse';
|
2
|
-
export { Fade, FadeSnappy, FadeExaggerated } from './components/Fade';
|
1
|
+
export { Collapse, CollapseSnappy, CollapseExaggerated, CollapseDelayed, createCollapsePresence, createCollapseDelayedPresence } from './components/Collapse';
|
2
|
+
export { Fade, FadeSnappy, FadeExaggerated, createFadePresence } from './components/Fade';
|
3
3
|
export { Scale, ScaleSnappy, ScaleExaggerated } from './components/Scale';
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export {
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export {\n Collapse,\n CollapseSnappy,\n CollapseExaggerated,\n CollapseDelayed,\n createCollapsePresence,\n createCollapseDelayedPresence,\n} from './components/Collapse';\nexport { Fade, FadeSnappy, FadeExaggerated, createFadePresence } from './components/Fade';\nexport { Scale, ScaleSnappy, ScaleExaggerated } from './components/Scale';\n"],"names":["Collapse","CollapseSnappy","CollapseExaggerated","CollapseDelayed","createCollapsePresence","createCollapseDelayedPresence","Fade","FadeSnappy","FadeExaggerated","createFadePresence","Scale","ScaleSnappy","ScaleExaggerated"],"rangeMappings":";;","mappings":"AAAA,SACEA,QAAQ,EACRC,cAAc,EACdC,mBAAmB,EACnBC,eAAe,EACfC,sBAAsB,EACtBC,6BAA6B,QACxB,wBAAwB;AAC/B,SAASC,IAAI,EAAEC,UAAU,EAAEC,eAAe,EAAEC,kBAAkB,QAAQ,oBAAoB;AAC1F,SAASC,KAAK,EAAEC,WAAW,EAAEC,gBAAgB,QAAQ,qBAAqB"}
|
package/lib/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["types.ts"],"sourcesContent":["import type { MotionParam, PresenceMotionFn } from '@fluentui/react-motion';\n\n/**\n * This is a factory function that generates a motion function, which has variant params bound into it.\n * The generated motion function accepts other runtime params that aren't locked into the variant, but supplied at runtime.\n * This separation allows the variant to be defined once and reused with different runtime params which may be orthogonal to the variant params.\n * For example, a variant may define the duration and easing of a transition, which are fixed for all instances of the variant,\n * while the runtime params may give access to the target element, which is different for each instance.\n *\n * The generated motion function is also framework-independent, i.e. non-React.\n * It can be turned into a React component using `createPresenceComponent`.\n */\n// TODO: move to @fluentui/react-motion when stable\nexport type PresenceMotionFnCreator<\n MotionVariantParams extends Record<string, MotionParam> = {},\n MotionRuntimeParams extends Record<string, MotionParam> = {},\n> = (variantParams?: MotionVariantParams) => PresenceMotionFn<MotionRuntimeParams>;\n"],"names":[],"rangeMappings":";;;;;;;;;;","mappings":"
|
1
|
+
{"version":3,"sources":["types.ts"],"sourcesContent":["import type { MotionParam, PresenceMotion, PresenceMotionFn } from '@fluentui/react-motion';\n\n/**\n * This is a factory function that generates a motion object from variant params, e.g. duration, easing, etc.\n * The generated object defines a presence motion with `enter` and `exit` transitions.\n * This motion object is declarative, i.e. data without side effects,\n * and it is framework-independent, i.e. non-React.\n * It can be turned into a React component using `createPresenceComponent`.\n */\n// TODO: move to @fluentui/react-motion when stable\nexport type PresenceMotionCreator<MotionVariantParams extends Record<string, MotionParam> = {}> = (\n variantParams?: MotionVariantParams,\n) => PresenceMotion;\n\n/**\n * This is a factory function that generates a motion function, which has variant params bound into it.\n * The generated motion function accepts other runtime params that aren't locked into the variant, but supplied at runtime.\n * This separation allows the variant to be defined once and reused with different runtime params which may be orthogonal to the variant params.\n * For example, a variant may define the duration and easing of a transition, which are fixed for all instances of the variant,\n * while the runtime params may give access to the target element, which is different for each instance.\n *\n * The generated motion function is also framework-independent, i.e. non-React.\n * It can be turned into a React component using `createPresenceComponent`.\n */\n// TODO: move to @fluentui/react-motion when stable\nexport type PresenceMotionFnCreator<\n MotionVariantParams extends Record<string, MotionParam> = {},\n MotionRuntimeParams extends Record<string, MotionParam> = {},\n> = (variantParams?: MotionVariantParams) => PresenceMotionFn<MotionRuntimeParams>;\n"],"names":[],"rangeMappings":";;;;;;;;;;","mappings":"AAcA;;;;;;;;;CASC,GACD,mDAAmD;AACnD,WAGmF"}
|
@@ -12,137 +12,83 @@ _export(exports, {
|
|
12
12
|
Collapse: function() {
|
13
13
|
return Collapse;
|
14
14
|
},
|
15
|
+
CollapseDelayed: function() {
|
16
|
+
return CollapseDelayed;
|
17
|
+
},
|
15
18
|
CollapseExaggerated: function() {
|
16
19
|
return CollapseExaggerated;
|
17
20
|
},
|
18
21
|
CollapseSnappy: function() {
|
19
22
|
return CollapseSnappy;
|
20
23
|
},
|
24
|
+
createCollapseDelayedPresence: function() {
|
25
|
+
return createCollapseDelayedPresence;
|
26
|
+
},
|
21
27
|
createCollapsePresence: function() {
|
22
28
|
return createCollapsePresence;
|
23
29
|
}
|
24
30
|
});
|
25
31
|
const _reactmotion = require("@fluentui/react-motion");
|
26
|
-
const
|
27
|
-
|
28
|
-
|
29
|
-
const fromSize = '0'; // Could be a custom param in the future to start with partially expanded width or height
|
30
|
-
const measuredSize = orientation === 'horizontal' ? element.scrollWidth : element.scrollHeight;
|
31
|
-
const toSize = `${measuredSize}px`;
|
32
|
-
// use generic names for size and overflow, handling vertical or horizontal orientation
|
33
|
-
const sizeName = orientation === 'horizontal' ? 'maxWidth' : 'maxHeight';
|
34
|
-
const overflowName = orientation === 'horizontal' ? 'overflowX' : 'overflowY';
|
35
|
-
// Because a height of zero does not eliminate padding,
|
36
|
-
// we will create keyframes to animate it to zero.
|
37
|
-
// TODO: consider collapsing margin, perhaps as an option.
|
38
|
-
const collapsedWhiteSpace = {};
|
39
|
-
if (orientation === 'horizontal') {
|
40
|
-
collapsedWhiteSpace.paddingLeft = '0';
|
41
|
-
collapsedWhiteSpace.paddingRight = '0';
|
42
|
-
} else {
|
43
|
-
collapsedWhiteSpace.paddingTop = '0';
|
44
|
-
collapsedWhiteSpace.paddingBottom = '0';
|
45
|
-
}
|
32
|
+
const _collapseatoms = require("./collapse-atoms");
|
33
|
+
const createCollapseDelayedPresence = ({ enterSizeDuration = _reactmotion.motionTokens.durationNormal, enterOpacityDuration = enterSizeDuration, enterEasing = _reactmotion.motionTokens.curveEasyEaseMax, enterDelay = 0, exitSizeDuration = enterSizeDuration, exitOpacityDuration = enterOpacityDuration, exitEasing = enterEasing, exitDelay = 0 } = {})=>({ element, animateOpacity = true, orientation = 'vertical' })=>{
|
34
|
+
// ----- ENTER -----
|
46
35
|
// The enter transition is an array of up to 3 motion atoms: size, whitespace and opacity.
|
47
36
|
const enterAtoms = [
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
offset: 0.9999,
|
58
|
-
[overflowName]: 'hidden'
|
59
|
-
},
|
60
|
-
{
|
61
|
-
[sizeName]: 'unset',
|
62
|
-
[overflowName]: 'unset'
|
63
|
-
}
|
64
|
-
],
|
65
|
-
duration: enterDuration,
|
66
|
-
easing: enterEasing
|
67
|
-
},
|
68
|
-
// Expand whitespace (padding currently).
|
69
|
-
{
|
70
|
-
// Animate from zero values to the element's natural values (i.e. the missing other keyframe).
|
71
|
-
keyframes: [
|
72
|
-
{
|
73
|
-
...collapsedWhiteSpace,
|
74
|
-
offset: 0
|
75
|
-
}
|
76
|
-
],
|
77
|
-
duration: enterDuration,
|
37
|
+
(0, _collapseatoms.sizeEnterAtom)({
|
38
|
+
orientation,
|
39
|
+
duration: enterSizeDuration,
|
40
|
+
easing: enterEasing,
|
41
|
+
element
|
42
|
+
}),
|
43
|
+
(0, _collapseatoms.whitespaceEnterAtom)({
|
44
|
+
orientation,
|
45
|
+
duration: enterSizeDuration,
|
78
46
|
easing: enterEasing
|
79
|
-
}
|
47
|
+
})
|
80
48
|
];
|
81
49
|
// Fade in only if animateOpacity is true. Otherwise, leave opacity unaffected.
|
82
50
|
if (animateOpacity) {
|
83
|
-
enterAtoms.push({
|
84
|
-
|
85
|
-
{
|
86
|
-
opacity: fromOpacity
|
87
|
-
},
|
88
|
-
{
|
89
|
-
opacity: toOpacity
|
90
|
-
}
|
91
|
-
],
|
92
|
-
duration: enterDuration,
|
51
|
+
enterAtoms.push((0, _collapseatoms.opacityEnterAtom)({
|
52
|
+
duration: enterOpacityDuration,
|
93
53
|
easing: enterEasing,
|
94
|
-
|
95
|
-
});
|
54
|
+
delay: enterDelay
|
55
|
+
}));
|
96
56
|
}
|
57
|
+
// ----- EXIT -----
|
97
58
|
// The exit transition is an array of up to 3 motion atoms: opacity, size and whitespace.
|
98
59
|
const exitAtoms = [];
|
99
|
-
// Fade out only if animateOpacity is
|
60
|
+
// Fade out only if animateOpacity is true. Otherwise, leave opacity unaffected.
|
100
61
|
if (animateOpacity) {
|
101
|
-
exitAtoms.push({
|
102
|
-
|
103
|
-
{
|
104
|
-
opacity: toOpacity
|
105
|
-
},
|
106
|
-
{
|
107
|
-
opacity: fromOpacity
|
108
|
-
}
|
109
|
-
],
|
110
|
-
duration: exitDuration,
|
62
|
+
exitAtoms.push((0, _collapseatoms.opacityExitAtom)({
|
63
|
+
duration: exitOpacityDuration,
|
111
64
|
easing: exitEasing
|
112
|
-
});
|
65
|
+
}));
|
113
66
|
}
|
114
|
-
exitAtoms.push({
|
115
|
-
|
116
|
-
|
117
|
-
[sizeName]: toSize,
|
118
|
-
[overflowName]: 'hidden'
|
119
|
-
},
|
120
|
-
{
|
121
|
-
[sizeName]: fromSize,
|
122
|
-
[overflowName]: 'hidden'
|
123
|
-
}
|
124
|
-
],
|
125
|
-
duration: exitDuration,
|
67
|
+
exitAtoms.push((0, _collapseatoms.sizeExitAtom)({
|
68
|
+
orientation,
|
69
|
+
duration: exitSizeDuration,
|
126
70
|
easing: exitEasing,
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
...collapsedWhiteSpace,
|
134
|
-
offset: 1
|
135
|
-
}
|
136
|
-
],
|
137
|
-
duration: exitDuration,
|
71
|
+
element,
|
72
|
+
delay: exitDelay
|
73
|
+
}));
|
74
|
+
exitAtoms.push((0, _collapseatoms.whitespaceExitAtom)({
|
75
|
+
orientation,
|
76
|
+
duration: exitSizeDuration,
|
138
77
|
easing: exitEasing,
|
139
|
-
|
140
|
-
});
|
78
|
+
delay: exitDelay
|
79
|
+
}));
|
141
80
|
return {
|
142
81
|
enter: enterAtoms,
|
143
82
|
exit: exitAtoms
|
144
83
|
};
|
145
84
|
};
|
85
|
+
const createCollapsePresence = ({ enterDuration = _reactmotion.motionTokens.durationNormal, enterEasing = _reactmotion.motionTokens.curveEasyEaseMax, exitDuration = enterDuration, exitEasing = enterEasing } = {})=>// where the delays are zero, and the size and opacity durations are equal.
|
86
|
+
createCollapseDelayedPresence({
|
87
|
+
enterSizeDuration: enterDuration,
|
88
|
+
enterEasing,
|
89
|
+
exitSizeDuration: exitDuration,
|
90
|
+
exitEasing
|
91
|
+
});
|
146
92
|
const Collapse = (0, _reactmotion.createPresenceComponent)(createCollapsePresence());
|
147
93
|
const CollapseSnappy = (0, _reactmotion.createPresenceComponent)(createCollapsePresence({
|
148
94
|
enterDuration: _reactmotion.motionTokens.durationFast
|
@@ -150,3 +96,10 @@ const CollapseSnappy = (0, _reactmotion.createPresenceComponent)(createCollapseP
|
|
150
96
|
const CollapseExaggerated = (0, _reactmotion.createPresenceComponent)(createCollapsePresence({
|
151
97
|
enterDuration: _reactmotion.motionTokens.durationSlower
|
152
98
|
}));
|
99
|
+
const CollapseDelayed = (0, _reactmotion.createPresenceComponent)(createCollapseDelayedPresence({
|
100
|
+
enterSizeDuration: _reactmotion.motionTokens.durationNormal,
|
101
|
+
enterOpacityDuration: _reactmotion.motionTokens.durationSlower,
|
102
|
+
enterDelay: _reactmotion.motionTokens.durationNormal,
|
103
|
+
exitDelay: _reactmotion.motionTokens.durationSlower,
|
104
|
+
enterEasing: _reactmotion.motionTokens.curveEasyEase
|
105
|
+
}));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Collapse.ts"],"sourcesContent":["import { motionTokens, createPresenceComponent, AtomMotion } from '@fluentui/react-motion';\nimport type { PresenceMotionFnCreator } from '../../types';\
|
1
|
+
{"version":3,"sources":["Collapse.ts"],"sourcesContent":["import { motionTokens, createPresenceComponent, AtomMotion } from '@fluentui/react-motion';\nimport type { PresenceMotionFnCreator } from '../../types';\nimport type { CollapseDelayedVariantParams, CollapseRuntimeParams, CollapseVariantParams } from './collapse-types';\nimport {\n sizeEnterAtom,\n whitespaceEnterAtom,\n opacityEnterAtom,\n opacityExitAtom,\n sizeExitAtom,\n whitespaceExitAtom,\n} from './collapse-atoms';\n\n/** Define a presence motion for collapse/expand that can stagger the size and opacity motions by a given delay. */\nexport const createCollapseDelayedPresence: PresenceMotionFnCreator<\n CollapseDelayedVariantParams,\n CollapseRuntimeParams\n> =\n ({\n // enter\n enterSizeDuration = motionTokens.durationNormal,\n enterOpacityDuration = enterSizeDuration, // in sync with size duration by default\n enterEasing = motionTokens.curveEasyEaseMax,\n enterDelay = 0,\n\n // exit: durations and easing default to enter values for symmetry\n exitSizeDuration = enterSizeDuration,\n exitOpacityDuration = enterOpacityDuration,\n exitEasing = enterEasing,\n exitDelay = 0,\n } = {}) =>\n ({ element, animateOpacity = true, orientation = 'vertical' }) => {\n // ----- ENTER -----\n // The enter transition is an array of up to 3 motion atoms: size, whitespace and opacity.\n const enterAtoms: AtomMotion[] = [\n sizeEnterAtom({\n orientation,\n duration: enterSizeDuration,\n easing: enterEasing,\n element,\n }),\n whitespaceEnterAtom({\n orientation,\n duration: enterSizeDuration,\n easing: enterEasing,\n }),\n ];\n // Fade in only if animateOpacity is true. Otherwise, leave opacity unaffected.\n if (animateOpacity) {\n enterAtoms.push(\n opacityEnterAtom({\n duration: enterOpacityDuration,\n easing: enterEasing,\n delay: enterDelay,\n }),\n );\n }\n\n // ----- EXIT -----\n // The exit transition is an array of up to 3 motion atoms: opacity, size and whitespace.\n const exitAtoms: AtomMotion[] = [];\n // Fade out only if animateOpacity is true. Otherwise, leave opacity unaffected.\n if (animateOpacity) {\n exitAtoms.push(\n opacityExitAtom({\n duration: exitOpacityDuration,\n easing: exitEasing,\n }),\n );\n }\n exitAtoms.push(\n sizeExitAtom({\n orientation,\n duration: exitSizeDuration,\n easing: exitEasing,\n element,\n delay: exitDelay,\n }),\n );\n exitAtoms.push(\n whitespaceExitAtom({\n orientation,\n duration: exitSizeDuration,\n easing: exitEasing,\n delay: exitDelay,\n }),\n );\n\n return {\n enter: enterAtoms,\n exit: exitAtoms,\n };\n };\n\n/** Defines a presence motion for collapse/expand. */\nexport const createCollapsePresence: PresenceMotionFnCreator<CollapseVariantParams, CollapseRuntimeParams> = ({\n enterDuration = motionTokens.durationNormal,\n enterEasing = motionTokens.curveEasyEaseMax,\n exitDuration = enterDuration,\n exitEasing = enterEasing,\n} = {}) =>\n // Implement a regular collapse as a special case of the delayed collapse,\n // where the delays are zero, and the size and opacity durations are equal.\n createCollapseDelayedPresence({\n enterSizeDuration: enterDuration,\n enterEasing,\n exitSizeDuration: exitDuration,\n exitEasing,\n });\n\n/** A React component that applies collapse/expand transitions to its children. */\nexport const Collapse = createPresenceComponent(createCollapsePresence());\n\nexport const CollapseSnappy = createPresenceComponent(\n createCollapsePresence({ enterDuration: motionTokens.durationFast }),\n);\n\nexport const CollapseExaggerated = createPresenceComponent(\n createCollapsePresence({ enterDuration: motionTokens.durationSlower }),\n);\n\nexport const CollapseDelayed = createPresenceComponent(\n createCollapseDelayedPresence({\n enterSizeDuration: motionTokens.durationNormal,\n enterOpacityDuration: motionTokens.durationSlower,\n enterDelay: motionTokens.durationNormal,\n exitDelay: motionTokens.durationSlower,\n enterEasing: motionTokens.curveEasyEase,\n }),\n);\n"],"names":["Collapse","CollapseDelayed","CollapseExaggerated","CollapseSnappy","createCollapseDelayedPresence","createCollapsePresence","enterSizeDuration","motionTokens","durationNormal","enterOpacityDuration","enterEasing","curveEasyEaseMax","enterDelay","exitSizeDuration","exitOpacityDuration","exitEasing","exitDelay","element","animateOpacity","orientation","enterAtoms","sizeEnterAtom","duration","easing","whitespaceEnterAtom","push","opacityEnterAtom","delay","exitAtoms","opacityExitAtom","sizeExitAtom","whitespaceExitAtom","enter","exit","enterDuration","exitDuration","createPresenceComponent","durationFast","durationSlower","curveEasyEase"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IA8GaA,QAAAA;eAAAA;;IAUAC,eAAAA;eAAAA;;IAJAC,mBAAAA;eAAAA;;IAJAC,cAAAA;eAAAA;;IAnGAC,6BAAAA;eAAAA;;IAiFAC,sBAAAA;eAAAA;;;6BA9FqD;+BAU3D;AAGA,MAAMD,gCAIX,CAAC,EAECE,oBAAoBC,yBAAAA,CAAaC,cAAc,EAC/CC,uBAAuBH,iBAAiB,EACxCI,cAAcH,yBAAAA,CAAaI,gBAAgB,EAC3CC,aAAa,CAAC,EAGdC,mBAAmBP,iBAAiB,EACpCQ,sBAAsBL,oBAAoB,EAC1CM,aAAaL,WAAW,EACxBM,YAAY,CAAC,EACd,GAAG,CAAC,CAAC,GACN,CAAC,EAAEC,OAAO,EAAEC,iBAAiB,IAAI,EAAEC,cAAc,UAAU,EAAE;QAC3D,oBAAoB;QACpB,0FAA0F;QAC1F,MAAMC,aAA2B;YAC/BC,IAAAA,4BAAAA,EAAc;gBACZF;gBACAG,UAAUhB;gBACViB,QAAQb;gBACRO;YACF;YACAO,IAAAA,kCAAAA,EAAoB;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BC,yBAAAA,CAAaC,cAAc;IAC9CC,sBAAsBF,yBAAAA,CAAa+B,cAAc;IACjD1B,YAAYL,yBAAAA,CAAaC,cAAc;IACvCQ,WAAWT,yBAAAA,CAAa+B,cAAc;IACtC5B,aAAaH,yBAAAA,CAAagC,aAAa;AACzC"}
|
@@ -0,0 +1,149 @@
|
|
1
|
+
// ----- SIZE -----
|
2
|
+
"use strict";
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
function _export(target, all) {
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
8
|
+
enumerable: true,
|
9
|
+
get: all[name]
|
10
|
+
});
|
11
|
+
}
|
12
|
+
_export(exports, {
|
13
|
+
opacityEnterAtom: function() {
|
14
|
+
return opacityEnterAtom;
|
15
|
+
},
|
16
|
+
opacityExitAtom: function() {
|
17
|
+
return opacityExitAtom;
|
18
|
+
},
|
19
|
+
sizeEnterAtom: function() {
|
20
|
+
return sizeEnterAtom;
|
21
|
+
},
|
22
|
+
sizeExitAtom: function() {
|
23
|
+
return sizeExitAtom;
|
24
|
+
},
|
25
|
+
whitespaceEnterAtom: function() {
|
26
|
+
return whitespaceEnterAtom;
|
27
|
+
},
|
28
|
+
whitespaceExitAtom: function() {
|
29
|
+
return whitespaceExitAtom;
|
30
|
+
}
|
31
|
+
});
|
32
|
+
const sizeValuesForOrientation = (orientation, element)=>{
|
33
|
+
const sizeName = orientation === 'horizontal' ? 'maxWidth' : 'maxHeight';
|
34
|
+
const overflowName = orientation === 'horizontal' ? 'overflowX' : 'overflowY';
|
35
|
+
const measuredSize = orientation === 'horizontal' ? element.scrollWidth : element.scrollHeight;
|
36
|
+
const toSize = `${measuredSize}px`;
|
37
|
+
return {
|
38
|
+
sizeName,
|
39
|
+
overflowName,
|
40
|
+
toSize
|
41
|
+
};
|
42
|
+
};
|
43
|
+
const sizeEnterAtom = ({ orientation, duration, easing, element, fromSize = '0' })=>{
|
44
|
+
const { sizeName, overflowName, toSize } = sizeValuesForOrientation(orientation, element);
|
45
|
+
return {
|
46
|
+
keyframes: [
|
47
|
+
{
|
48
|
+
[sizeName]: fromSize,
|
49
|
+
[overflowName]: 'hidden'
|
50
|
+
},
|
51
|
+
{
|
52
|
+
[sizeName]: toSize,
|
53
|
+
offset: 0.9999,
|
54
|
+
[overflowName]: 'hidden'
|
55
|
+
},
|
56
|
+
{
|
57
|
+
[sizeName]: 'unset',
|
58
|
+
[overflowName]: 'unset'
|
59
|
+
}
|
60
|
+
],
|
61
|
+
duration,
|
62
|
+
easing
|
63
|
+
};
|
64
|
+
};
|
65
|
+
const sizeExitAtom = ({ orientation, duration, easing, element, delay = 0, fromSize = '0' })=>{
|
66
|
+
const { sizeName, overflowName, toSize } = sizeValuesForOrientation(orientation, element);
|
67
|
+
return {
|
68
|
+
keyframes: [
|
69
|
+
{
|
70
|
+
[sizeName]: toSize,
|
71
|
+
[overflowName]: 'hidden'
|
72
|
+
},
|
73
|
+
{
|
74
|
+
[sizeName]: fromSize,
|
75
|
+
[overflowName]: 'hidden'
|
76
|
+
}
|
77
|
+
],
|
78
|
+
duration,
|
79
|
+
easing,
|
80
|
+
fill: 'both',
|
81
|
+
delay
|
82
|
+
};
|
83
|
+
};
|
84
|
+
// ----- WHITESPACE -----
|
85
|
+
// Whitespace animation currently includes padding, but could be extended to handle margin.
|
86
|
+
const whitespaceValuesForOrientation = (orientation)=>{
|
87
|
+
const paddingStart = orientation === 'horizontal' ? 'paddingLeft' : 'paddingTop';
|
88
|
+
const paddingEnd = orientation === 'horizontal' ? 'paddingRight' : 'paddingBottom';
|
89
|
+
return {
|
90
|
+
paddingStart,
|
91
|
+
paddingEnd
|
92
|
+
};
|
93
|
+
};
|
94
|
+
const whitespaceEnterAtom = ({ orientation, duration, easing })=>{
|
95
|
+
const { paddingStart, paddingEnd } = whitespaceValuesForOrientation(orientation);
|
96
|
+
return {
|
97
|
+
keyframes: [
|
98
|
+
{
|
99
|
+
[paddingStart]: '0',
|
100
|
+
[paddingEnd]: '0',
|
101
|
+
offset: 0
|
102
|
+
}
|
103
|
+
],
|
104
|
+
duration,
|
105
|
+
easing
|
106
|
+
};
|
107
|
+
};
|
108
|
+
const whitespaceExitAtom = ({ orientation, duration, easing, delay = 0 })=>{
|
109
|
+
const { paddingStart, paddingEnd } = whitespaceValuesForOrientation(orientation);
|
110
|
+
return {
|
111
|
+
keyframes: [
|
112
|
+
{
|
113
|
+
[paddingStart]: '0',
|
114
|
+
[paddingEnd]: '0',
|
115
|
+
offset: 1
|
116
|
+
}
|
117
|
+
],
|
118
|
+
duration,
|
119
|
+
easing,
|
120
|
+
fill: 'forwards',
|
121
|
+
delay
|
122
|
+
};
|
123
|
+
};
|
124
|
+
const opacityEnterAtom = ({ duration, easing, delay = 0, fromOpacity = 0, toOpacity = 1 })=>({
|
125
|
+
keyframes: [
|
126
|
+
{
|
127
|
+
opacity: fromOpacity
|
128
|
+
},
|
129
|
+
{
|
130
|
+
opacity: toOpacity
|
131
|
+
}
|
132
|
+
],
|
133
|
+
duration,
|
134
|
+
easing,
|
135
|
+
delay,
|
136
|
+
fill: 'both'
|
137
|
+
});
|
138
|
+
const opacityExitAtom = ({ duration, easing, fromOpacity = 0, toOpacity = 1 })=>({
|
139
|
+
keyframes: [
|
140
|
+
{
|
141
|
+
opacity: toOpacity
|
142
|
+
},
|
143
|
+
{
|
144
|
+
opacity: fromOpacity
|
145
|
+
}
|
146
|
+
],
|
147
|
+
duration,
|
148
|
+
easing
|
149
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["collapse-atoms.ts"],"sourcesContent":["import { AtomMotion } from '@fluentui/react-motion/src/types';\nimport type { 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\nexport const sizeEnterAtom = ({\n orientation,\n duration,\n easing,\n element,\n fromSize = '0',\n}: {\n orientation: CollapseOrientation;\n duration: number;\n easing: string;\n element: HTMLElement;\n fromSize?: string;\n}): 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\nexport const sizeExitAtom = ({\n orientation,\n duration,\n easing,\n element,\n delay = 0,\n fromSize = '0',\n}: {\n orientation: CollapseOrientation;\n duration: number;\n easing: string;\n element: HTMLElement;\n delay?: number;\n fromSize?: string;\n}): 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 delay,\n };\n};\n\n// ----- WHITESPACE -----\n\n// Whitespace animation currently includes padding, but could be extended to handle margin.\nconst whitespaceValuesForOrientation = (orientation: CollapseOrientation) => {\n const paddingStart = orientation === 'horizontal' ? 'paddingLeft' : 'paddingTop';\n const paddingEnd = orientation === 'horizontal' ? 'paddingRight' : 'paddingBottom';\n return { paddingStart, paddingEnd };\n};\n\n// Because a height of zero does not eliminate padding,\n// we will create keyframes to animate it to zero.\n// TODO: consider collapsing margin, perhaps as an option.\nexport const whitespaceEnterAtom = ({\n orientation,\n duration,\n easing,\n}: {\n orientation: CollapseOrientation;\n duration: number;\n easing: string;\n}): AtomMotion => {\n const { paddingStart, paddingEnd } = whitespaceValuesForOrientation(orientation);\n return {\n keyframes: [{ [paddingStart]: '0', [paddingEnd]: '0', offset: 0 }],\n duration,\n easing,\n };\n};\n\nexport const whitespaceExitAtom = ({\n orientation,\n duration,\n easing,\n delay = 0,\n}: {\n orientation: CollapseOrientation;\n duration: number;\n easing: string;\n delay?: number;\n}): AtomMotion => {\n const { paddingStart, paddingEnd } = whitespaceValuesForOrientation(orientation);\n return {\n keyframes: [{ [paddingStart]: '0', [paddingEnd]: '0', offset: 1 }],\n duration,\n easing,\n fill: 'forwards',\n delay,\n };\n};\n\n// ----- OPACITY -----\n\nexport const opacityEnterAtom = ({\n duration,\n easing,\n delay = 0,\n fromOpacity = 0,\n toOpacity = 1,\n}: {\n duration: number;\n easing: string;\n delay?: number;\n fromOpacity?: number;\n toOpacity?: number;\n}): AtomMotion => ({\n keyframes: [{ opacity: fromOpacity }, { opacity: toOpacity }],\n duration,\n easing,\n delay,\n fill: 'both',\n});\n\nexport const opacityExitAtom = ({\n duration,\n easing,\n fromOpacity = 0,\n toOpacity = 1,\n}: {\n duration: number;\n easing: string;\n fromOpacity?: number;\n toOpacity?: number;\n}): AtomMotion => ({\n keyframes: [{ opacity: toOpacity }, { opacity: fromOpacity }],\n duration,\n easing,\n});\n"],"names":["opacityEnterAtom","opacityExitAtom","sizeEnterAtom","sizeExitAtom","whitespaceEnterAtom","whitespaceExitAtom","sizeValuesForOrientation","orientation","element","sizeName","overflowName","measuredSize","scrollWidth","scrollHeight","toSize","duration","easing","fromSize","keyframes","offset","delay","fill","whitespaceValuesForOrientation","paddingStart","paddingEnd","fromOpacity","toOpacity","opacity"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,mBAAmB;;;;;;;;;;;;IAqHNA,gBAAAA;eAAAA;;IAoBAC,eAAAA;eAAAA;;IA/HAC,aAAAA;eAAAA;;IA0BAC,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,"sources":["collapse-types.ts"],"sourcesContent":["export type CollapseOrientation = 'horizontal' | 'vertical';\n\n// TODO: reduce duplication between CollapseDelayedVariantParams and CollapseVariantParams\nexport type CollapseDelayedVariantParams = {\n /** Time (ms) for the size expand. Defaults to the durationNormal value (200 ms). */\n enterSizeDuration?: number;\n\n /** Time (ms) for the fade-in. Defaults to the enterSizeDuration param, to sync fade-in with expand. */\n enterOpacityDuration?: number;\n\n /** Time (ms) for the size collapse. Defaults to the enterSizeDuration param, for temporal symmetry.. */\n exitSizeDuration?: number;\n\n /** 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 enterDelay?: number;\n\n /** Time (ms) between the fade-out start and the size collapse start. Defaults to `0`. */\n exitDelay?: number;\n\n /** Easing curve for the enter transition, shared by size and opacity. Defaults to the easeEaseMax value. */\n enterEasing?: string;\n\n /** Easing curve for the exit transition, shared by size and opacity. Defaults to the enterEasing param. */\n exitEasing?: string;\n};\n\nexport type CollapseRuntimeParams = {\n /** Whether to animate the opacity. Defaults to `true`. */\n animateOpacity?: boolean;\n\n /** The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height. */\n orientation?: CollapseOrientation;\n};\n\nexport type CollapseVariantParams = {\n /** Time (ms) for the enter transition (expand). Defaults to the `durationNormal` value (200 ms). */\n enterDuration?: number;\n\n /** Easing curve for the enter transition (expand). Defaults to the `easeEaseMax` value. */\n enterEasing?: string;\n\n /** Time (ms) for the exit transition (collapse). Defaults to the `enterDuration` param for symmetry. */\n exitDuration?: number;\n\n /** Easing curve for the exit transition (collapse). Defaults to the `enterEasing` param for symmetry. */\n exitEasing?: string;\n};\n"],"names":[],"rangeMappings":"","mappings":""}
|
@@ -17,45 +17,42 @@ _export(exports, {
|
|
17
17
|
},
|
18
18
|
FadeSnappy: function() {
|
19
19
|
return FadeSnappy;
|
20
|
-
}
|
21
|
-
});
|
22
|
-
const _reactmotion = require("@fluentui/react-motion");
|
23
|
-
const duration = _reactmotion.motionTokens.durationNormal;
|
24
|
-
const easing = _reactmotion.motionTokens.curveEasyEase;
|
25
|
-
/** Define a presence motion for fade in/out */ const fadeMotion = {
|
26
|
-
enter: {
|
27
|
-
duration,
|
28
|
-
easing,
|
29
|
-
keyframes: [
|
30
|
-
{
|
31
|
-
opacity: 0
|
32
|
-
},
|
33
|
-
{
|
34
|
-
opacity: 1
|
35
|
-
}
|
36
|
-
]
|
37
20
|
},
|
38
|
-
|
39
|
-
|
40
|
-
easing,
|
41
|
-
keyframes: [
|
42
|
-
{
|
43
|
-
opacity: 1
|
44
|
-
},
|
45
|
-
{
|
46
|
-
opacity: 0
|
47
|
-
}
|
48
|
-
]
|
49
|
-
}
|
50
|
-
};
|
51
|
-
const Fade = (0, _reactmotion.createPresenceComponent)(fadeMotion);
|
52
|
-
const FadeSnappy = (0, _reactmotion.createPresenceComponentVariant)(Fade, {
|
53
|
-
all: {
|
54
|
-
duration: _reactmotion.motionTokens.durationFast
|
55
|
-
}
|
56
|
-
});
|
57
|
-
const FadeExaggerated = (0, _reactmotion.createPresenceComponentVariant)(Fade, {
|
58
|
-
all: {
|
59
|
-
duration: _reactmotion.motionTokens.durationGentle
|
21
|
+
createFadePresence: function() {
|
22
|
+
return createFadePresence;
|
60
23
|
}
|
61
24
|
});
|
25
|
+
const _reactmotion = require("@fluentui/react-motion");
|
26
|
+
const createFadePresence = ({ enterDuration = _reactmotion.motionTokens.durationNormal, enterEasing = _reactmotion.motionTokens.curveEasyEase, exitDuration = enterDuration, exitEasing = enterEasing } = {})=>({
|
27
|
+
enter: {
|
28
|
+
duration: enterDuration,
|
29
|
+
easing: enterEasing,
|
30
|
+
keyframes: [
|
31
|
+
{
|
32
|
+
opacity: 0
|
33
|
+
},
|
34
|
+
{
|
35
|
+
opacity: 1
|
36
|
+
}
|
37
|
+
]
|
38
|
+
},
|
39
|
+
exit: {
|
40
|
+
duration: exitDuration,
|
41
|
+
easing: exitEasing,
|
42
|
+
keyframes: [
|
43
|
+
{
|
44
|
+
opacity: 1
|
45
|
+
},
|
46
|
+
{
|
47
|
+
opacity: 0
|
48
|
+
}
|
49
|
+
]
|
50
|
+
}
|
51
|
+
});
|
52
|
+
const Fade = (0, _reactmotion.createPresenceComponent)(createFadePresence());
|
53
|
+
const FadeSnappy = (0, _reactmotion.createPresenceComponent)(createFadePresence({
|
54
|
+
enterDuration: _reactmotion.motionTokens.durationFast
|
55
|
+
}));
|
56
|
+
const FadeExaggerated = (0, _reactmotion.createPresenceComponent)(createFadePresence({
|
57
|
+
enterDuration: _reactmotion.motionTokens.durationGentle
|
58
|
+
}));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Fade.ts"],"sourcesContent":["import {
|
1
|
+
{"version":3,"sources":["Fade.ts"],"sourcesContent":["import { motionTokens, createPresenceComponent } from '@fluentui/react-motion';\nimport type { PresenceMotionCreator } from '../../types';\n\ntype FadeVariantParams = {\n /** Time (ms) for the enter transition (fade-in). Defaults to the `durationNormal` value (200 ms). */\n enterDuration?: number;\n\n /** Easing curve for the enter transition (fade-in). Defaults to the `easeEase` value. */\n enterEasing?: string;\n\n /** Time (ms) for the exit transition (fade-out). Defaults to the `enterDuration` param for symmetry. */\n exitDuration?: number;\n\n /** Easing curve for the exit transition (fade-out). Defaults to the `enterEasing` param for symmetry. */\n exitEasing?: string;\n};\n\n/** Define a presence motion for fade in/out */\nexport const createFadePresence: PresenceMotionCreator<FadeVariantParams> = ({\n enterDuration = motionTokens.durationNormal,\n enterEasing = motionTokens.curveEasyEase,\n exitDuration = enterDuration,\n exitEasing = enterEasing,\n} = {}) => ({\n enter: { duration: enterDuration, easing: enterEasing, keyframes: [{ opacity: 0 }, { opacity: 1 }] },\n exit: { duration: exitDuration, easing: exitEasing, keyframes: [{ opacity: 1 }, { opacity: 0 }] },\n});\n\n/** A React component that applies fade in/out transitions to its children. */\nexport const Fade = createPresenceComponent(createFadePresence());\n\nexport const FadeSnappy = createPresenceComponent(createFadePresence({ enterDuration: motionTokens.durationFast }));\n\nexport const FadeExaggerated = createPresenceComponent(\n createFadePresence({ enterDuration: motionTokens.durationGentle }),\n);\n"],"names":["Fade","FadeExaggerated","FadeSnappy","createFadePresence","enterDuration","motionTokens","durationNormal","enterEasing","curveEasyEase","exitDuration","exitEasing","enter","duration","easing","keyframes","opacity","exit","createPresenceComponent","durationFast","durationGentle"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IA6BaA,IAAAA;eAAAA;;IAIAC,eAAAA;eAAAA;;IAFAC,UAAAA;eAAAA;;IAbAC,kBAAAA;eAAAA;;;6BAlByC;AAkB/C,MAAMA,qBAA+D,CAAC,EAC3EC,gBAAgBC,yBAAAA,CAAaC,cAAc,EAC3CC,cAAcF,yBAAAA,CAAaG,aAAa,EACxCC,eAAeL,aAAa,EAC5BM,aAAaH,WAAW,EACzB,GAAG,CAAC,CAAC,GAAM,CAAA;QACVI,OAAO;YAAEC,UAAUR;YAAeS,QAAQN;YAAaO,WAAW;gBAAC;oBAAEC,SAAS;gBAAE;gBAAG;oBAAEA,SAAS;gBAAE;aAAE;QAAC;QACnGC,MAAM;YAAEJ,UAAUH;YAAcI,QAAQH;YAAYI,WAAW;gBAAC;oBAAEC,SAAS;gBAAE;gBAAG;oBAAEA,SAAS;gBAAE;aAAE;QAAC;IAClG,CAAA;AAGO,MAAMf,OAAOiB,IAAAA,oCAAAA,EAAwBd;AAErC,MAAMD,aAAae,IAAAA,oCAAAA,EAAwBd,mBAAmB;IAAEC,eAAeC,yBAAAA,CAAaa,YAAY;AAAC;AAEzG,MAAMjB,kBAAkBgB,IAAAA,oCAAAA,EAC7Bd,mBAAmB;IAAEC,eAAeC,yBAAAA,CAAac,cAAc;AAAC"}
|
package/lib-commonjs/index.js
CHANGED
@@ -12,6 +12,9 @@ _export(exports, {
|
|
12
12
|
Collapse: function() {
|
13
13
|
return _Collapse.Collapse;
|
14
14
|
},
|
15
|
+
CollapseDelayed: function() {
|
16
|
+
return _Collapse.CollapseDelayed;
|
17
|
+
},
|
15
18
|
CollapseExaggerated: function() {
|
16
19
|
return _Collapse.CollapseExaggerated;
|
17
20
|
},
|
@@ -36,8 +39,14 @@ _export(exports, {
|
|
36
39
|
ScaleSnappy: function() {
|
37
40
|
return _Scale.ScaleSnappy;
|
38
41
|
},
|
42
|
+
createCollapseDelayedPresence: function() {
|
43
|
+
return _Collapse.createCollapseDelayedPresence;
|
44
|
+
},
|
39
45
|
createCollapsePresence: function() {
|
40
46
|
return _Collapse.createCollapsePresence;
|
47
|
+
},
|
48
|
+
createFadePresence: function() {
|
49
|
+
return _Fade.createFadePresence;
|
41
50
|
}
|
42
51
|
});
|
43
52
|
const _Collapse = require("./components/Collapse");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export {
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export {\n Collapse,\n CollapseSnappy,\n CollapseExaggerated,\n CollapseDelayed,\n createCollapsePresence,\n createCollapseDelayedPresence,\n} from './components/Collapse';\nexport { Fade, FadeSnappy, FadeExaggerated, createFadePresence } from './components/Fade';\nexport { Scale, ScaleSnappy, ScaleExaggerated } from './components/Scale';\n"],"names":["Collapse","CollapseDelayed","CollapseExaggerated","CollapseSnappy","Fade","FadeExaggerated","FadeSnappy","Scale","ScaleExaggerated","ScaleSnappy","createCollapseDelayedPresence","createCollapsePresence","createFadePresence"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IACEA,QAAQ;eAARA,kBAAQ;;IAGRC,eAAe;eAAfA,yBAAe;;IADfC,mBAAmB;eAAnBA,6BAAmB;;IADnBC,cAAc;eAAdA,wBAAc;;IAMPC,IAAI;eAAJA,UAAI;;IAAcC,eAAe;eAAfA,qBAAe;;IAA3BC,UAAU;eAAVA,gBAAU;;IAChBC,KAAK;eAALA,YAAK;;IAAeC,gBAAgB;eAAhBA,uBAAgB;;IAA7BC,WAAW;eAAXA,kBAAW;;IAHzBC,6BAA6B;eAA7BA,uCAA6B;;IAD7BC,sBAAsB;eAAtBA,gCAAsB;;IAGoBC,kBAAkB;eAAlBA,wBAAkB;;;0BADvD;sBAC+D;uBACjB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["types.ts"],"sourcesContent":["import type { MotionParam, PresenceMotionFn } from '@fluentui/react-motion';\n\n/**\n * This is a factory function that generates a motion function, which has variant params bound into it.\n * The generated motion function accepts other runtime params that aren't locked into the variant, but supplied at runtime.\n * This separation allows the variant to be defined once and reused with different runtime params which may be orthogonal to the variant params.\n * For example, a variant may define the duration and easing of a transition, which are fixed for all instances of the variant,\n * while the runtime params may give access to the target element, which is different for each instance.\n *\n * The generated motion function is also framework-independent, i.e. non-React.\n * It can be turned into a React component using `createPresenceComponent`.\n */\n// TODO: move to @fluentui/react-motion when stable\nexport type PresenceMotionFnCreator<\n MotionVariantParams extends Record<string, MotionParam> = {},\n MotionRuntimeParams extends Record<string, MotionParam> = {},\n> = (variantParams?: MotionVariantParams) => PresenceMotionFn<MotionRuntimeParams>;\n"],"names":[],"rangeMappings":";;;;;;;;;","mappings":"
|
1
|
+
{"version":3,"sources":["types.ts"],"sourcesContent":["import type { MotionParam, PresenceMotion, PresenceMotionFn } from '@fluentui/react-motion';\n\n/**\n * This is a factory function that generates a motion object from variant params, e.g. duration, easing, etc.\n * The generated object defines a presence motion with `enter` and `exit` transitions.\n * This motion object is declarative, i.e. data without side effects,\n * and it is framework-independent, i.e. non-React.\n * It can be turned into a React component using `createPresenceComponent`.\n */\n// TODO: move to @fluentui/react-motion when stable\nexport type PresenceMotionCreator<MotionVariantParams extends Record<string, MotionParam> = {}> = (\n variantParams?: MotionVariantParams,\n) => PresenceMotion;\n\n/**\n * This is a factory function that generates a motion function, which has variant params bound into it.\n * The generated motion function accepts other runtime params that aren't locked into the variant, but supplied at runtime.\n * This separation allows the variant to be defined once and reused with different runtime params which may be orthogonal to the variant params.\n * For example, a variant may define the duration and easing of a transition, which are fixed for all instances of the variant,\n * while the runtime params may give access to the target element, which is different for each instance.\n *\n * The generated motion function is also framework-independent, i.e. non-React.\n * It can be turned into a React component using `createPresenceComponent`.\n */\n// TODO: move to @fluentui/react-motion when stable\nexport type PresenceMotionFnCreator<\n MotionVariantParams extends Record<string, MotionParam> = {},\n MotionRuntimeParams extends Record<string, MotionParam> = {},\n> = (variantParams?: MotionVariantParams) => PresenceMotionFn<MotionRuntimeParams>;\n"],"names":[],"rangeMappings":";;;;;;;;;","mappings":"AAcA;;;;;;;;;CASC,GACD,mDAAmD"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-motion-components-preview",
|
3
|
-
"version": "0.0.0-nightly-
|
3
|
+
"version": "0.0.0-nightly-20241023-0407.1",
|
4
4
|
"description": "A preview package for Fluent UI motion components, providing a collection of components",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -29,13 +29,13 @@
|
|
29
29
|
},
|
30
30
|
"devDependencies": {
|
31
31
|
"@fluentui/eslint-plugin": "*",
|
32
|
-
"@fluentui/react-conformance": "0.0.0-nightly-
|
33
|
-
"@fluentui/react-conformance-griffel": "0.0.0-nightly-
|
32
|
+
"@fluentui/react-conformance": "0.0.0-nightly-20241023-0407.1",
|
33
|
+
"@fluentui/react-conformance-griffel": "0.0.0-nightly-20241023-0407.1",
|
34
34
|
"@fluentui/scripts-api-extractor": "*",
|
35
35
|
"@fluentui/scripts-tasks": "*"
|
36
36
|
},
|
37
37
|
"dependencies": {
|
38
|
-
"@fluentui/react-motion": "0.0.0-nightly-
|
38
|
+
"@fluentui/react-motion": "0.0.0-nightly-20241023-0407.1",
|
39
39
|
"@swc/helpers": "^0.5.1"
|
40
40
|
},
|
41
41
|
"peerDependencies": {
|