@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
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Scale.ts"],"sourcesContent":["import {\n motionTokens,\n PresenceMotionFn,\n createPresenceComponent,\n createPresenceComponentVariant,\n} from '@fluentui/react-motion';\n\n/** Define a presence motion for scale in/out */\nconst scaleMotion: PresenceMotionFn<{ animateOpacity?: boolean }> = ({ animateOpacity = true }) => {\n const fromOpacity = animateOpacity ? 0 : 1;\n const toOpacity = 1;\n const fromScale = 0.9; // Could be a custom param in the future\n const toScale = 1;\n\n const enterKeyframes = [\n { opacity: fromOpacity, transform: `scale3d(${fromScale}, ${fromScale}, 1)`, visibility: 'visible' },\n { opacity: toOpacity, transform: `scale3d(${toScale}, ${toScale}, 1)` },\n ];\n\n const exitKeyframes = [\n { opacity: toOpacity, transform: `scale3d(${toScale}, ${toScale}, 1)` },\n { opacity: fromOpacity, transform: `scale3d(${fromScale}, ${fromScale}, 1)`, visibility: 'hidden' },\n ];\n\n return {\n enter: {\n duration: motionTokens.durationGentle,\n easing: motionTokens.curveDecelerateMax,\n keyframes: enterKeyframes,\n },\n exit: { duration: motionTokens.durationNormal, easing: motionTokens.curveAccelerateMax, keyframes: exitKeyframes },\n };\n};\n\n/** A React component that applies scale in/out transitions to its children. */\nexport const Scale = createPresenceComponent(scaleMotion);\n\nexport const ScaleSnappy = createPresenceComponentVariant(Scale, {\n enter: { duration: motionTokens.durationNormal, easing: motionTokens.curveDecelerateMax },\n exit: { duration: motionTokens.durationFast, easing: motionTokens.curveAccelerateMax },\n});\n\nexport const
|
1
|
+
{"version":3,"sources":["../src/components/Scale/Scale.ts"],"sourcesContent":["import {\n motionTokens,\n PresenceMotionFn,\n createPresenceComponent,\n createPresenceComponentVariant,\n} from '@fluentui/react-motion';\n\n/** Define a presence motion for scale in/out */\nconst scaleMotion: PresenceMotionFn<{ animateOpacity?: boolean }> = ({ animateOpacity = true }) => {\n const fromOpacity = animateOpacity ? 0 : 1;\n const toOpacity = 1;\n const fromScale = 0.9; // Could be a custom param in the future\n const toScale = 1;\n\n const enterKeyframes = [\n { opacity: fromOpacity, transform: `scale3d(${fromScale}, ${fromScale}, 1)`, visibility: 'visible' },\n { opacity: toOpacity, transform: `scale3d(${toScale}, ${toScale}, 1)` },\n ];\n\n const exitKeyframes = [\n { opacity: toOpacity, transform: `scale3d(${toScale}, ${toScale}, 1)` },\n { opacity: fromOpacity, transform: `scale3d(${fromScale}, ${fromScale}, 1)`, visibility: 'hidden' },\n ];\n\n return {\n enter: {\n duration: motionTokens.durationGentle,\n easing: motionTokens.curveDecelerateMax,\n keyframes: enterKeyframes,\n },\n exit: { duration: motionTokens.durationNormal, easing: motionTokens.curveAccelerateMax, keyframes: exitKeyframes },\n };\n};\n\n/** A React component that applies scale in/out transitions to its children. */\nexport const Scale = createPresenceComponent(scaleMotion);\n\nexport const ScaleSnappy = createPresenceComponentVariant(Scale, {\n enter: { duration: motionTokens.durationNormal, easing: motionTokens.curveDecelerateMax },\n exit: { duration: motionTokens.durationFast, easing: motionTokens.curveAccelerateMax },\n});\n\nexport const ScaleRelaxed = createPresenceComponentVariant(Scale, {\n enter: { duration: motionTokens.durationSlow, easing: motionTokens.curveDecelerateMax },\n exit: { duration: motionTokens.durationGentle, easing: motionTokens.curveAccelerateMax },\n});\n"],"names":["motionTokens","createPresenceComponent","createPresenceComponentVariant","scaleMotion","animateOpacity","fromOpacity","toOpacity","fromScale","toScale","enterKeyframes","opacity","transform","visibility","exitKeyframes","enter","duration","durationGentle","easing","curveDecelerateMax","keyframes","exit","durationNormal","curveAccelerateMax","Scale","ScaleSnappy","durationFast","ScaleRelaxed","durationSlow"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SACEA,YAAY,EAEZC,uBAAuB,EACvBC,8BAA8B,QACzB,yBAAyB;AAEhC,8CAA8C,GAC9C,MAAMC,cAA8D,CAAC,EAAEC,iBAAiB,IAAI,EAAE;IAC5F,MAAMC,cAAcD,iBA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IAAC;AACzF,GAAG"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Scale';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,UAAU"}
|
1
|
+
{"version":3,"sources":["../src/components/Scale/index.ts"],"sourcesContent":["export * from './Scale';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,UAAU"}
|
package/lib/index.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
export { Collapse, CollapseSnappy,
|
2
|
-
export { Fade, FadeSnappy,
|
3
|
-
export { Scale, ScaleSnappy,
|
1
|
+
export { Collapse, CollapseSnappy, CollapseRelaxed, CollapseDelayed, createCollapsePresence, createCollapseDelayedPresence } from './components/Collapse';
|
2
|
+
export { Fade, FadeSnappy, FadeRelaxed, createFadePresence } from './components/Fade';
|
3
|
+
export { Scale, ScaleSnappy, ScaleRelaxed } from './components/Scale';
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export { Collapse
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Collapse,\n CollapseSnappy,\n CollapseRelaxed,\n CollapseDelayed,\n createCollapsePresence,\n createCollapseDelayedPresence,\n} from './components/Collapse';\nexport type { CollapseRuntimeParams } from './components/Collapse';\nexport { Fade, FadeSnappy, FadeRelaxed, createFadePresence } from './components/Fade';\nexport { Scale, ScaleSnappy, ScaleRelaxed } from './components/Scale';\n"],"names":["Collapse","CollapseSnappy","CollapseRelaxed","CollapseDelayed","createCollapsePresence","createCollapseDelayedPresence","Fade","FadeSnappy","FadeRelaxed","createFadePresence","Scale","ScaleSnappy","ScaleRelaxed"],"rangeMappings":";;","mappings":"AAAA,SACEA,QAAQ,EACRC,cAAc,EACdC,eAAe,EACfC,eAAe,EACfC,sBAAsB,EACtBC,6BAA6B,QACxB,wBAAwB;AAE/B,SAASC,IAAI,EAAEC,UAAU,EAAEC,WAAW,EAAEC,kBAAkB,QAAQ,oBAAoB;AACtF,SAASC,KAAK,EAAEC,WAAW,EAAEC,YAAY,QAAQ,qBAAqB"}
|
package/lib/types.js
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* This is a factory function that generates a motion function, which has variant params bound into it.
|
3
|
+
* The generated motion function accepts other runtime params that aren't locked into the variant, but supplied at runtime.
|
4
|
+
* This separation allows the variant to be defined once and reused with different runtime params which may be orthogonal to the variant params.
|
5
|
+
* For example, a variant may define the duration and easing of a transition, which are fixed for all instances of the variant,
|
6
|
+
* while the runtime params may give access to the target element, which is different for each instance.
|
7
|
+
*
|
8
|
+
* The generated motion function is also framework-independent, i.e. non-React.
|
9
|
+
* It can be turned into a React component using `createPresenceComponent`.
|
10
|
+
*/ // TODO: move to @fluentui/react-motion when stable
|
11
|
+
export { };
|
package/lib/types.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/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,81 +12,97 @@ _export(exports, {
|
|
12
12
|
Collapse: function() {
|
13
13
|
return Collapse;
|
14
14
|
},
|
15
|
-
|
16
|
-
return
|
15
|
+
CollapseDelayed: function() {
|
16
|
+
return CollapseDelayed;
|
17
|
+
},
|
18
|
+
CollapseRelaxed: function() {
|
19
|
+
return CollapseRelaxed;
|
17
20
|
},
|
18
21
|
CollapseSnappy: function() {
|
19
22
|
return CollapseSnappy;
|
23
|
+
},
|
24
|
+
createCollapseDelayedPresence: function() {
|
25
|
+
return createCollapseDelayedPresence;
|
26
|
+
},
|
27
|
+
createCollapsePresence: function() {
|
28
|
+
return createCollapsePresence;
|
20
29
|
}
|
21
30
|
});
|
22
31
|
const _reactmotion = require("@fluentui/react-motion");
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
overflow
|
32
|
+
const _collapseatoms = require("./collapse-atoms");
|
33
|
+
const createCollapseDelayedPresence = ({ // enter
|
34
|
+
enterSizeDuration = _reactmotion.motionTokens.durationNormal, enterOpacityDuration = enterSizeDuration, enterEasing = _reactmotion.motionTokens.curveEasyEaseMax, enterDelay = 0, // exit: durations and easing default to enter values for symmetry
|
35
|
+
exitSizeDuration = enterSizeDuration, exitOpacityDuration = enterOpacityDuration, exitEasing = enterEasing, exitDelay = 0 } = {})=>({ element, animateOpacity = true, orientation = 'vertical' })=>{
|
36
|
+
// ----- ENTER -----
|
37
|
+
// The enter transition is an array of up to 3 motion atoms: size, whitespace and opacity.
|
38
|
+
const enterAtoms = [
|
39
|
+
(0, _collapseatoms.sizeEnterAtom)({
|
40
|
+
orientation,
|
41
|
+
duration: enterSizeDuration,
|
42
|
+
easing: enterEasing,
|
43
|
+
element
|
44
|
+
}),
|
45
|
+
(0, _collapseatoms.whitespaceEnterAtom)({
|
46
|
+
orientation,
|
47
|
+
duration: enterSizeDuration,
|
48
|
+
easing: enterEasing
|
49
|
+
})
|
50
|
+
];
|
51
|
+
// Fade in only if animateOpacity is true. Otherwise, leave opacity unaffected.
|
52
|
+
if (animateOpacity) {
|
53
|
+
enterAtoms.push((0, _collapseatoms.opacityEnterAtom)({
|
54
|
+
duration: enterOpacityDuration,
|
55
|
+
easing: enterEasing,
|
56
|
+
delay: enterDelay
|
57
|
+
}));
|
50
58
|
}
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
maxHeight: fromHeight,
|
61
|
-
overflow
|
62
|
-
}
|
63
|
-
];
|
64
|
-
return {
|
65
|
-
enter: {
|
66
|
-
duration,
|
67
|
-
easing,
|
68
|
-
keyframes: enterKeyframes
|
69
|
-
},
|
70
|
-
exit: {
|
71
|
-
duration,
|
72
|
-
easing,
|
73
|
-
keyframes: exitKeyframes
|
59
|
+
// ----- EXIT -----
|
60
|
+
// The exit transition is an array of up to 3 motion atoms: opacity, size and whitespace.
|
61
|
+
const exitAtoms = [];
|
62
|
+
// Fade out only if animateOpacity is true. Otherwise, leave opacity unaffected.
|
63
|
+
if (animateOpacity) {
|
64
|
+
exitAtoms.push((0, _collapseatoms.opacityExitAtom)({
|
65
|
+
duration: exitOpacityDuration,
|
66
|
+
easing: exitEasing
|
67
|
+
}));
|
74
68
|
}
|
69
|
+
exitAtoms.push((0, _collapseatoms.sizeExitAtom)({
|
70
|
+
orientation,
|
71
|
+
duration: exitSizeDuration,
|
72
|
+
easing: exitEasing,
|
73
|
+
element,
|
74
|
+
delay: exitDelay
|
75
|
+
}));
|
76
|
+
exitAtoms.push((0, _collapseatoms.whitespaceExitAtom)({
|
77
|
+
orientation,
|
78
|
+
duration: exitSizeDuration,
|
79
|
+
easing: exitEasing,
|
80
|
+
delay: exitDelay
|
81
|
+
}));
|
82
|
+
return {
|
83
|
+
enter: enterAtoms,
|
84
|
+
exit: exitAtoms
|
85
|
+
};
|
75
86
|
};
|
76
|
-
}
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
87
|
+
const createCollapsePresence = ({ enterDuration = _reactmotion.motionTokens.durationNormal, enterEasing = _reactmotion.motionTokens.curveEasyEaseMax, exitDuration = enterDuration, exitEasing = enterEasing } = {})=>// Implement a regular collapse as a special case of the delayed collapse,
|
88
|
+
// where the delays are zero, and the size and opacity durations are equal.
|
89
|
+
createCollapseDelayedPresence({
|
90
|
+
enterSizeDuration: enterDuration,
|
91
|
+
enterEasing,
|
92
|
+
exitSizeDuration: exitDuration,
|
93
|
+
exitEasing
|
94
|
+
});
|
95
|
+
const Collapse = (0, _reactmotion.createPresenceComponent)(createCollapsePresence());
|
96
|
+
const CollapseSnappy = (0, _reactmotion.createPresenceComponent)(createCollapsePresence({
|
97
|
+
enterDuration: _reactmotion.motionTokens.durationFast
|
98
|
+
}));
|
99
|
+
const CollapseRelaxed = (0, _reactmotion.createPresenceComponent)(createCollapsePresence({
|
100
|
+
enterDuration: _reactmotion.motionTokens.durationSlower
|
101
|
+
}));
|
102
|
+
const CollapseDelayed = (0, _reactmotion.createPresenceComponent)(createCollapseDelayedPresence({
|
103
|
+
enterSizeDuration: _reactmotion.motionTokens.durationNormal,
|
104
|
+
enterOpacityDuration: _reactmotion.motionTokens.durationSlower,
|
105
|
+
enterDelay: _reactmotion.motionTokens.durationNormal,
|
106
|
+
exitDelay: _reactmotion.motionTokens.durationSlower,
|
107
|
+
enterEasing: _reactmotion.motionTokens.curveEasyEase
|
108
|
+
}));
|
@@ -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":["Collapse","CollapseDelayed","CollapseRelaxed","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,QAAQ;eAARA;;IAUAC,eAAe;eAAfA;;IAJAC,eAAe;eAAfA;;IAJAC,cAAc;eAAdA;;IAnGAC,6BAA6B;eAA7BA;;IAiFAC,sBAAsB;eAAtBA;;;6BA9FqD;+BAU3D;AAGA,MAAMD,gCAIX,CAAC,EACC,QAAQ;AACRE,oBAAoBC,yBAAY,CAACC,cAAc,EAC/CC,uBAAuBH,iBAAiB,EACxCI,cAAcH,yBAAY,CAACI,gBAAgB,EAC3CC,aAAa,CAAC,EAEd,kEAAkE;AAClEC,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,4BAAa,EAAC;gBACZF;gBACAG,UAAUhB;gBACViB,QAAQb;gBACRO;YACF;YACAO,IAAAA,kCAAmB,EAAC;gBAClBL;gBACAG,UAAUhB;gBACViB,QAAQb;YACV;SACD;Q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C+B,cAAc;IACjD1B,YAAYL,yBAAY,CAACC,cAAc;IACvCQ,WAAWT,yBAAY,CAAC+B,cAAc;IACtC5B,aAAaH,yBAAY,CAACgC,aAAa;AACzC"}
|
@@ -0,0 +1,149 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
function _export(target, all) {
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
7
|
+
enumerable: true,
|
8
|
+
get: all[name]
|
9
|
+
});
|
10
|
+
}
|
11
|
+
_export(exports, {
|
12
|
+
opacityEnterAtom: function() {
|
13
|
+
return opacityEnterAtom;
|
14
|
+
},
|
15
|
+
opacityExitAtom: function() {
|
16
|
+
return opacityExitAtom;
|
17
|
+
},
|
18
|
+
sizeEnterAtom: function() {
|
19
|
+
return sizeEnterAtom;
|
20
|
+
},
|
21
|
+
sizeExitAtom: function() {
|
22
|
+
return sizeExitAtom;
|
23
|
+
},
|
24
|
+
whitespaceEnterAtom: function() {
|
25
|
+
return whitespaceEnterAtom;
|
26
|
+
},
|
27
|
+
whitespaceExitAtom: function() {
|
28
|
+
return whitespaceExitAtom;
|
29
|
+
}
|
30
|
+
});
|
31
|
+
// ----- SIZE -----
|
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":["../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":["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":";;;;;;;;;;;IAwHaA,gBAAgB;eAAhBA;;IAoBAC,eAAe;eAAfA;;IA/HAC,aAAa;eAAbA;;IA0BAC,YAAY;eAAZA;;IAyCAC,mBAAmB;eAAnBA;;IAiBAC,kBAAkB;eAAlBA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@@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Collapse';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
1
|
+
{"version":3,"sources":["../src/components/Collapse/index.ts"],"sourcesContent":["export * from './Collapse';\nexport type { CollapseRuntimeParams } from './collapse-types';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
@@ -12,50 +12,47 @@ _export(exports, {
|
|
12
12
|
Fade: function() {
|
13
13
|
return Fade;
|
14
14
|
},
|
15
|
-
|
16
|
-
return
|
15
|
+
FadeRelaxed: function() {
|
16
|
+
return FadeRelaxed;
|
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 FadeRelaxed = (0, _reactmotion.createPresenceComponent)(createFadePresence({
|
57
|
+
enterDuration: _reactmotion.motionTokens.durationGentle
|
58
|
+
}));
|
@@ -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":["Fade","FadeRelaxed","FadeSnappy","createFadePresence","enterDuration","motionTokens","durationNormal","enterEasing","curveEasyEase","exitDuration","exitEasing","enter","duration","easing","keyframes","opacity","exit","createPresenceComponent","durationFast","durationGentle"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IA6BaA,IAAI;eAAJA;;IAIAC,WAAW;eAAXA;;IAFAC,UAAU;eAAVA;;IAbAC,kBAAkB;eAAlBA;;;6BAlByC;AAkB/C,MAAMA,qBAA+D,CAAC,EAC3EC,gBAAgBC,yBAAY,CAACC,cAAc,EAC3CC,cAAcF,yBAAY,CAACG,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,oCAAuB,EAACd;AAErC,MAAMD,aAAae,IAAAA,oCAAuB,EAACd,mBAAmB;IAAEC,eAAeC,yBAAY,CAACa,YAAY;AAAC;AAEzG,MAAMjB,cAAcgB,IAAAA,oCAAuB,EAACd,mBAAmB;IAAEC,eAAeC,yBAAY,CAACc,cAAc;AAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Fade';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
1
|
+
{"version":3,"sources":["../src/components/Fade/index.ts"],"sourcesContent":["export * from './Fade';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
@@ -12,8 +12,8 @@ _export(exports, {
|
|
12
12
|
Scale: function() {
|
13
13
|
return Scale;
|
14
14
|
},
|
15
|
-
|
16
|
-
return
|
15
|
+
ScaleRelaxed: function() {
|
16
|
+
return ScaleRelaxed;
|
17
17
|
},
|
18
18
|
ScaleSnappy: function() {
|
19
19
|
return ScaleSnappy;
|
@@ -71,7 +71,7 @@ const ScaleSnappy = (0, _reactmotion.createPresenceComponentVariant)(Scale, {
|
|
71
71
|
easing: _reactmotion.motionTokens.curveAccelerateMax
|
72
72
|
}
|
73
73
|
});
|
74
|
-
const
|
74
|
+
const ScaleRelaxed = (0, _reactmotion.createPresenceComponentVariant)(Scale, {
|
75
75
|
enter: {
|
76
76
|
duration: _reactmotion.motionTokens.durationSlow,
|
77
77
|
easing: _reactmotion.motionTokens.curveDecelerateMax
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Scale.ts"],"sourcesContent":["import {\n motionTokens,\n PresenceMotionFn,\n createPresenceComponent,\n createPresenceComponentVariant,\n} from '@fluentui/react-motion';\n\n/** Define a presence motion for scale in/out */\nconst scaleMotion: PresenceMotionFn<{ animateOpacity?: boolean }> = ({ animateOpacity = true }) => {\n const fromOpacity = animateOpacity ? 0 : 1;\n const toOpacity = 1;\n const fromScale = 0.9; // Could be a custom param in the future\n const toScale = 1;\n\n const enterKeyframes = [\n { opacity: fromOpacity, transform: `scale3d(${fromScale}, ${fromScale}, 1)`, visibility: 'visible' },\n { opacity: toOpacity, transform: `scale3d(${toScale}, ${toScale}, 1)` },\n ];\n\n const exitKeyframes = [\n { opacity: toOpacity, transform: `scale3d(${toScale}, ${toScale}, 1)` },\n { opacity: fromOpacity, transform: `scale3d(${fromScale}, ${fromScale}, 1)`, visibility: 'hidden' },\n ];\n\n return {\n enter: {\n duration: motionTokens.durationGentle,\n easing: motionTokens.curveDecelerateMax,\n keyframes: enterKeyframes,\n },\n exit: { duration: motionTokens.durationNormal, easing: motionTokens.curveAccelerateMax, keyframes: exitKeyframes },\n };\n};\n\n/** A React component that applies scale in/out transitions to its children. */\nexport const Scale = createPresenceComponent(scaleMotion);\n\nexport const ScaleSnappy = createPresenceComponentVariant(Scale, {\n enter: { duration: motionTokens.durationNormal, easing: motionTokens.curveDecelerateMax },\n exit: { duration: motionTokens.durationFast, easing: motionTokens.curveAccelerateMax },\n});\n\nexport const
|
1
|
+
{"version":3,"sources":["../src/components/Scale/Scale.ts"],"sourcesContent":["import {\n motionTokens,\n PresenceMotionFn,\n createPresenceComponent,\n createPresenceComponentVariant,\n} from '@fluentui/react-motion';\n\n/** Define a presence motion for scale in/out */\nconst scaleMotion: PresenceMotionFn<{ animateOpacity?: boolean }> = ({ animateOpacity = true }) => {\n const fromOpacity = animateOpacity ? 0 : 1;\n const toOpacity = 1;\n const fromScale = 0.9; // Could be a custom param in the future\n const toScale = 1;\n\n const enterKeyframes = [\n { opacity: fromOpacity, transform: `scale3d(${fromScale}, ${fromScale}, 1)`, visibility: 'visible' },\n { opacity: toOpacity, transform: `scale3d(${toScale}, ${toScale}, 1)` },\n ];\n\n const exitKeyframes = [\n { opacity: toOpacity, transform: `scale3d(${toScale}, ${toScale}, 1)` },\n { opacity: fromOpacity, transform: `scale3d(${fromScale}, ${fromScale}, 1)`, visibility: 'hidden' },\n ];\n\n return {\n enter: {\n duration: motionTokens.durationGentle,\n easing: motionTokens.curveDecelerateMax,\n keyframes: enterKeyframes,\n },\n exit: { duration: motionTokens.durationNormal, easing: motionTokens.curveAccelerateMax, keyframes: exitKeyframes },\n };\n};\n\n/** A React component that applies scale in/out transitions to its children. */\nexport const Scale = createPresenceComponent(scaleMotion);\n\nexport const ScaleSnappy = createPresenceComponentVariant(Scale, {\n enter: { duration: motionTokens.durationNormal, easing: motionTokens.curveDecelerateMax },\n exit: { duration: motionTokens.durationFast, easing: motionTokens.curveAccelerateMax },\n});\n\nexport const ScaleRelaxed = createPresenceComponentVariant(Scale, {\n enter: { duration: motionTokens.durationSlow, easing: motionTokens.curveDecelerateMax },\n exit: { duration: motionTokens.durationGentle, easing: motionTokens.curveAccelerateMax },\n});\n"],"names":["Scale","ScaleRelaxed","ScaleSnappy","scaleMotion","animateOpacity","fromOpacity","toOpacity","fromScale","toScale","enterKeyframes","opacity","transform","visibility","exitKeyframes","enter","duration","motionTokens","durationGentle","easing","curveDecelerateMax","keyframes","exit","durationNormal","curveAccelerateMax","createPresenceComponent","createPresenceComponentVariant","durationFast","durationSlow"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAmCaA,KAAK;eAALA;;IAOAC,YAAY;eAAZA;;IALAC,WAAW;eAAXA;;;6BAhCN;AAEP,8CAA8C,GAC9C,MAAMC,cAA8D,CAAC,EAAEC,iBAAiB,IAAI,EAAE;IAC5F,MAAMC,cAAcD,iBAAiB,IAAI;IACzC,MAAME,YAAY;IAClB,MAA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AY,CAACO,kBAAkB;IAAC;AACzF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Scale';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
1
|
+
{"version":3,"sources":["../src/components/Scale/index.ts"],"sourcesContent":["export * from './Scale';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|