@fluentui/react-motion-components-preview 0.1.4 → 0.3.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 +31 -1
- package/dist/index.d.ts +90 -11
- package/lib/components/Collapse/Collapse.js +75 -68
- 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/Collapse/index.js.map +1 -1
- package/lib/components/Fade/Fade.js +34 -40
- package/lib/components/Fade/Fade.js.map +1 -1
- package/lib/components/Fade/index.js.map +1 -1
- package/lib/components/Scale/Scale.js +1 -1
- package/lib/components/Scale/Scale.js.map +1 -1
- package/lib/components/Scale/index.js.map +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/types.js +11 -0
- package/lib/types.js.map +1 -0
- package/lib-commonjs/components/Collapse/Collapse.js +85 -69
- 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/Collapse/index.js.map +1 -1
- package/lib-commonjs/components/Fade/Fade.js +38 -41
- package/lib-commonjs/components/Fade/Fade.js.map +1 -1
- package/lib-commonjs/components/Fade/index.js.map +1 -1
- package/lib-commonjs/components/Scale/Scale.js +3 -3
- package/lib-commonjs/components/Scale/Scale.js.map +1 -1
- package/lib-commonjs/components/Scale/index.js.map +1 -1
- package/lib-commonjs/index.js +18 -6
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types.js +4 -0
- package/lib-commonjs/types.js.map +1 -0
- package/package.json +2 -13
package/CHANGELOG.md
CHANGED
@@ -1,9 +1,39 @@
|
|
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 Mon, 11 Nov 2024 09:55:11 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [0.3.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion-components-preview_v0.3.0)
|
8
|
+
|
9
|
+
Mon, 11 Nov 2024 09:55:11 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-motion-components-preview_v0.2.0..@fluentui/react-motion-components-preview_v0.3.0)
|
11
|
+
|
12
|
+
### Minor changes
|
13
|
+
|
14
|
+
- feat: add CollapseDelayed motion component variant ([PR #33069](https://github.com/microsoft/fluentui/pull/33069) by robertpenner@microsoft.com)
|
15
|
+
- Rename motion component variants ...Exaggerated to ...Relaxed ([PR #33182](https://github.com/microsoft/fluentui/pull/33182) by olkatruk@microsoft.com)
|
16
|
+
|
17
|
+
### Patches
|
18
|
+
|
19
|
+
- refactor: migrate Fade motion component to new variant structure ([PR #33080](https://github.com/microsoft/fluentui/pull/33080) by robertpenner@microsoft.com)
|
20
|
+
- fix: handle content padding in Collapse ([PR #33063](https://github.com/microsoft/fluentui/pull/33063) by robertpenner@microsoft.com)
|
21
|
+
- chore: replace npm-scripts and just-scrtips with nx inferred tasks ([PR #33074](https://github.com/microsoft/fluentui/pull/33074) by martinhochel@microsoft.com)
|
22
|
+
|
23
|
+
## [0.2.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion-components-preview_v0.2.0)
|
24
|
+
|
25
|
+
Tue, 15 Oct 2024 17:17:49 GMT
|
26
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-motion-components-preview_v0.1.1..@fluentui/react-motion-components-preview_v0.2.0)
|
27
|
+
|
28
|
+
### Minor changes
|
29
|
+
|
30
|
+
- refactor: simplify motion component variant creation ([PR #32939](https://github.com/microsoft/fluentui/pull/32939) by robertpenner@microsoft.com)
|
31
|
+
- feat: add Collapse orientation parameter & horizontal implementation ([PR #32998](https://github.com/microsoft/fluentui/pull/32998) by robertpenner@microsoft.com)
|
32
|
+
|
33
|
+
### Patches
|
34
|
+
|
35
|
+
- fix: Collapse should only effect opacity when animateOpacity is true ([PR #32999](https://github.com/microsoft/fluentui/pull/32999) by robertpenner@microsoft.com)
|
36
|
+
|
7
37
|
## [0.1.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion-components-preview_v0.1.1)
|
8
38
|
|
9
39
|
Tue, 23 Jul 2024 20:13:12 GMT
|
package/dist/index.d.ts
CHANGED
@@ -1,31 +1,110 @@
|
|
1
|
+
import type { MotionParam } from '@fluentui/react-motion';
|
1
2
|
import { PresenceComponent } from '@fluentui/react-motion';
|
3
|
+
import type { PresenceMotion } from '@fluentui/react-motion';
|
4
|
+
import type { PresenceMotionFn } from '@fluentui/react-motion';
|
2
5
|
|
3
6
|
/** A React component that applies collapse/expand transitions to its children. */
|
4
|
-
export declare const Collapse: PresenceComponent<
|
5
|
-
animateOpacity?: boolean | undefined;
|
6
|
-
}>;
|
7
|
+
export declare const Collapse: PresenceComponent<CollapseRuntimeParams>;
|
7
8
|
|
8
|
-
export declare const
|
9
|
-
animateOpacity?: boolean | undefined;
|
10
|
-
}>;
|
9
|
+
export declare const CollapseDelayed: PresenceComponent<CollapseRuntimeParams>;
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|
+
|
30
|
+
declare type CollapseOrientation = 'horizontal' | 'vertical';
|
31
|
+
|
32
|
+
export declare const CollapseRelaxed: PresenceComponent<CollapseRuntimeParams>;
|
33
|
+
|
34
|
+
export declare type CollapseRuntimeParams = {
|
35
|
+
/** Whether to animate the opacity. Defaults to `true`. */
|
36
|
+
animateOpacity?: boolean;
|
37
|
+
/** The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height. */
|
38
|
+
orientation?: CollapseOrientation;
|
39
|
+
};
|
40
|
+
|
41
|
+
export declare const CollapseSnappy: PresenceComponent<CollapseRuntimeParams>;
|
42
|
+
|
43
|
+
declare type CollapseVariantParams = {
|
44
|
+
/** Time (ms) for the enter transition (expand). Defaults to the `durationNormal` value (200 ms). */
|
45
|
+
enterDuration?: number;
|
46
|
+
/** Easing curve for the enter transition (expand). Defaults to the `easeEaseMax` value. */
|
47
|
+
enterEasing?: string;
|
48
|
+
/** Time (ms) for the exit transition (collapse). Defaults to the `enterDuration` param for symmetry. */
|
49
|
+
exitDuration?: number;
|
50
|
+
/** Easing curve for the exit transition (collapse). Defaults to the `enterEasing` param for symmetry. */
|
51
|
+
exitEasing?: string;
|
52
|
+
};
|
53
|
+
|
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. */
|
58
|
+
export declare const createCollapsePresence: PresenceMotionFnCreator<CollapseVariantParams, CollapseRuntimeParams>;
|
59
|
+
|
60
|
+
/** Define a presence motion for fade in/out */
|
61
|
+
export declare const createFadePresence: PresenceMotionCreator<FadeVariantParams>;
|
15
62
|
|
16
63
|
/** A React component that applies fade in/out transitions to its children. */
|
17
64
|
export declare const Fade: PresenceComponent< {}>;
|
18
65
|
|
19
|
-
export declare const
|
66
|
+
export declare const FadeRelaxed: PresenceComponent< {}>;
|
20
67
|
|
21
68
|
export declare const FadeSnappy: PresenceComponent< {}>;
|
22
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
|
+
|
90
|
+
/**
|
91
|
+
* This is a factory function that generates a motion function, which has variant params bound into it.
|
92
|
+
* The generated motion function accepts other runtime params that aren't locked into the variant, but supplied at runtime.
|
93
|
+
* This separation allows the variant to be defined once and reused with different runtime params which may be orthogonal to the variant params.
|
94
|
+
* For example, a variant may define the duration and easing of a transition, which are fixed for all instances of the variant,
|
95
|
+
* while the runtime params may give access to the target element, which is different for each instance.
|
96
|
+
*
|
97
|
+
* The generated motion function is also framework-independent, i.e. non-React.
|
98
|
+
* It can be turned into a React component using `createPresenceComponent`.
|
99
|
+
*/
|
100
|
+
declare type PresenceMotionFnCreator<MotionVariantParams extends Record<string, MotionParam> = {}, MotionRuntimeParams extends Record<string, MotionParam> = {}> = (variantParams?: MotionVariantParams) => PresenceMotionFn<MotionRuntimeParams>;
|
101
|
+
|
23
102
|
/** A React component that applies scale in/out transitions to its children. */
|
24
103
|
export declare const Scale: PresenceComponent< {
|
25
104
|
animateOpacity?: boolean | undefined;
|
26
105
|
}>;
|
27
106
|
|
28
|
-
export declare const
|
107
|
+
export declare const ScaleRelaxed: PresenceComponent< {
|
29
108
|
animateOpacity?: boolean | undefined;
|
30
109
|
}>;
|
31
110
|
|
@@ -1,71 +1,78 @@
|
|
1
|
-
import { motionTokens, createPresenceComponent
|
2
|
-
|
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
|
-
overflow
|
1
|
+
import { motionTokens, createPresenceComponent } from '@fluentui/react-motion';
|
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 -----
|
7
|
+
// The enter transition is an array of up to 3 motion atoms: size, whitespace and opacity.
|
8
|
+
const enterAtoms = [
|
9
|
+
sizeEnterAtom({
|
10
|
+
orientation,
|
11
|
+
duration: enterSizeDuration,
|
12
|
+
easing: enterEasing,
|
13
|
+
element
|
14
|
+
}),
|
15
|
+
whitespaceEnterAtom({
|
16
|
+
orientation,
|
17
|
+
duration: enterSizeDuration,
|
18
|
+
easing: enterEasing
|
19
|
+
})
|
20
|
+
];
|
21
|
+
// Fade in only if animateOpacity is true. Otherwise, leave opacity unaffected.
|
22
|
+
if (animateOpacity) {
|
23
|
+
enterAtoms.push(opacityEnterAtom({
|
24
|
+
duration: enterOpacityDuration,
|
25
|
+
easing: enterEasing,
|
26
|
+
delay: enterDelay
|
27
|
+
}));
|
29
28
|
}
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
maxHeight: fromHeight,
|
40
|
-
overflow
|
41
|
-
}
|
42
|
-
];
|
43
|
-
return {
|
44
|
-
enter: {
|
45
|
-
duration,
|
46
|
-
easing,
|
47
|
-
keyframes: enterKeyframes
|
48
|
-
},
|
49
|
-
exit: {
|
50
|
-
duration,
|
51
|
-
easing,
|
52
|
-
keyframes: exitKeyframes
|
29
|
+
// ----- EXIT -----
|
30
|
+
// The exit transition is an array of up to 3 motion atoms: opacity, size and whitespace.
|
31
|
+
const exitAtoms = [];
|
32
|
+
// Fade out only if animateOpacity is true. Otherwise, leave opacity unaffected.
|
33
|
+
if (animateOpacity) {
|
34
|
+
exitAtoms.push(opacityExitAtom({
|
35
|
+
duration: exitOpacityDuration,
|
36
|
+
easing: exitEasing
|
37
|
+
}));
|
53
38
|
}
|
39
|
+
exitAtoms.push(sizeExitAtom({
|
40
|
+
orientation,
|
41
|
+
duration: exitSizeDuration,
|
42
|
+
easing: exitEasing,
|
43
|
+
element,
|
44
|
+
delay: exitDelay
|
45
|
+
}));
|
46
|
+
exitAtoms.push(whitespaceExitAtom({
|
47
|
+
orientation,
|
48
|
+
duration: exitSizeDuration,
|
49
|
+
easing: exitEasing,
|
50
|
+
delay: exitDelay
|
51
|
+
}));
|
52
|
+
return {
|
53
|
+
enter: enterAtoms,
|
54
|
+
exit: exitAtoms
|
55
|
+
};
|
54
56
|
};
|
55
|
-
}
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
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
|
+
});
|
65
|
+
/** A React component that applies collapse/expand transitions to its children. */ export const Collapse = createPresenceComponent(createCollapsePresence());
|
66
|
+
export const CollapseSnappy = createPresenceComponent(createCollapsePresence({
|
67
|
+
enterDuration: motionTokens.durationFast
|
68
|
+
}));
|
69
|
+
export const CollapseRelaxed = createPresenceComponent(createCollapsePresence({
|
70
|
+
enterDuration: motionTokens.durationSlower
|
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 {\n
|
1
|
+
{"version":3,"sources":["../src/components/Collapse/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 CollapseRelaxed = 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","CollapseRelaxed","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,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/BpB,cAAc;gBACZmB;gBACAE,UAAUd;gBACVe,QAAQZ;gBACRO;YACF;YACAhB,oBAAoB;gBAClBkB;gBACAE,UAAUd;gBACVe,QAAQZ;YACV;SACD;QACD,+EAA+E;QAC/E,IAAIQ,gBAAgB;YAClBE,WAAWG,IAAI,CACbrB,iBAAiB;gBACfmB,UAAUZ;gBACVa,QAAQZ;gBACRc,OAAOZ;YACT;QAEJ;QAEA,mBAAmB;QACnB,yFAAyF;QACzF,MAAMa,YAA0B,EAAE;QAClC,gFAAgF;QAChF,IAAIP,gBAAgB;YAClBO,UAAUF,IAAI,CACZpB,gBAAgB;gBACdkB,UAAUP;gBACVQ,QAAQP;YACV;QAEJ;QACAU,UAAUF,IAAI,CACZnB,aAAa;YACXe;YACAE,UAAUR;YACVS,QAAQP;YACRE;YACAO,OAAOR;QACT;QAEFS,UAAUF,IAAI,CACZlB,mBAAmB;YACjBc;YACAE,UAAUR;YACVS,QAAQP;YACRS,OAAOR;QACT;QAGF,OAAO;YACLU,OAAON;YACPO,MAAMF;QACR;IACF,EAAE;AAEJ,mDAAmD,GACnD,OAAO,MAAMG,yBAAgG,CAAC,EAC5GC,gBAAgB/B,aAAaU,cAAc,EAC3CE,cAAcZ,aAAaa,gBAAgB,EAC3CmB,eAAeD,aAAa,EAC5Bd,aAAaL,WAAW,EACzB,GAAG,CAAC,CAAC,GACJ,0EAA0E;IAC1E,2EAA2E;IAC3EJ,8BAA8B;QAC5BC,mBAAmBsB;QACnBnB;QACAG,kBAAkBiB;QAClBf;IACF,GAAG;AAEL,gFAAgF,GAChF,OAAO,MAAMgB,WAAWhC,wBAAwB6B,0BAA0B;AAE1E,OAAO,MAAMI,iBAAiBjC,wBAC5B6B,uBAAuB;IAAEC,eAAe/B,aAAamC,YAAY;AAAC,IAClE;AAEF,OAAO,MAAMC,kBAAkBnC,wBAC7B6B,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":["../src/components/Collapse/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":"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"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { };
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/components/Collapse/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 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Collapse';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,aAAa"}
|
1
|
+
{"version":3,"sources":["../src/components/Collapse/index.ts"],"sourcesContent":["export * from './Collapse';\nexport type { CollapseRuntimeParams } from './collapse-types';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,aAAa"}
|
@@ -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 FadeRelaxed = createPresenceComponent(createFadePresence({
|
33
|
+
enterDuration: motionTokens.durationGentle
|
34
|
+
}));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Fade.ts"],"sourcesContent":["import {
|
1
|
+
{"version":3,"sources":["../src/components/Fade/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 FadeRelaxed = createPresenceComponent(createFadePresence({ enterDuration: motionTokens.durationGentle }));\n"],"names":["motionTokens","createPresenceComponent","createFadePresence","enterDuration","durationNormal","enterEasing","curveEasyEase","exitDuration","exitEasing","enter","duration","easing","keyframes","opacity","exit","Fade","FadeSnappy","durationFast","FadeRelaxed","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,cAAcjB,wBAAwBC,mBAAmB;IAAEC,eAAeH,aAAamB,cAAc;AAAC,IAAI"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Fade';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,SAAS"}
|
1
|
+
{"version":3,"sources":["../src/components/Fade/index.ts"],"sourcesContent":["export * from './Fade';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,SAAS"}
|
@@ -50,7 +50,7 @@ export const ScaleSnappy = createPresenceComponentVariant(Scale, {
|
|
50
50
|
easing: motionTokens.curveAccelerateMax
|
51
51
|
}
|
52
52
|
});
|
53
|
-
export const
|
53
|
+
export const ScaleRelaxed = createPresenceComponentVariant(Scale, {
|
54
54
|
enter: {
|
55
55
|
duration: motionTokens.durationSlow,
|
56
56
|
easing: motionTokens.curveDecelerateMax
|