@fluentui/react-motion-components-preview 0.1.4 → 0.2.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 CHANGED
@@ -1,9 +1,23 @@
1
1
  # Change Log - @fluentui/react-motion-components-preview
2
2
 
3
- This log was last generated on Tue, 23 Jul 2024 20:13:12 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 15 Oct 2024 17:13:29 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [0.2.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion-components-preview_v0.2.0)
8
+
9
+ Tue, 15 Oct 2024 17:13:29 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-motion-components-preview_v0.1.1..@fluentui/react-motion-components-preview_v0.2.0)
11
+
12
+ ### Minor changes
13
+
14
+ - refactor: simplify motion component variant creation ([PR #32939](https://github.com/microsoft/fluentui/pull/32939) by robertpenner@microsoft.com)
15
+ - feat: add Collapse orientation parameter & horizontal implementation ([PR #32998](https://github.com/microsoft/fluentui/pull/32998) by robertpenner@microsoft.com)
16
+
17
+ ### Patches
18
+
19
+ - fix: Collapse should only effect opacity when animateOpacity is true ([PR #32999](https://github.com/microsoft/fluentui/pull/32999) by robertpenner@microsoft.com)
20
+
7
21
  ## [0.1.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion-components-preview_v0.1.1)
8
22
 
9
23
  Tue, 23 Jul 2024 20:13:12 GMT
package/dist/index.d.ts CHANGED
@@ -1,17 +1,36 @@
1
+ import type { MotionParam } from '@fluentui/react-motion';
1
2
  import { PresenceComponent } from '@fluentui/react-motion';
3
+ import type { PresenceMotionFn } from '@fluentui/react-motion';
2
4
 
3
5
  /** A React component that applies collapse/expand transitions to its children. */
4
- export declare const Collapse: PresenceComponent< {
5
- animateOpacity?: boolean | undefined;
6
- }>;
6
+ export declare const Collapse: PresenceComponent<CollapseRuntimeParams>;
7
7
 
8
- export declare const CollapseExaggerated: PresenceComponent< {
9
- animateOpacity?: boolean | undefined;
10
- }>;
8
+ export declare const CollapseExaggerated: PresenceComponent<CollapseRuntimeParams>;
11
9
 
12
- export declare const CollapseSnappy: PresenceComponent< {
13
- animateOpacity?: boolean | undefined;
14
- }>;
10
+ declare type CollapseOrientation = 'horizontal' | 'vertical';
11
+
12
+ declare type CollapseRuntimeParams = {
13
+ /** Whether to animate the opacity. Defaults to `true`. */
14
+ animateOpacity?: boolean;
15
+ /** The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height. */
16
+ orientation?: CollapseOrientation;
17
+ };
18
+
19
+ export declare const CollapseSnappy: PresenceComponent<CollapseRuntimeParams>;
20
+
21
+ declare type CollapseVariantParams = {
22
+ /** Time (ms) for the enter transition (expand). Defaults to the `durationNormal` value (200 ms). */
23
+ enterDuration?: number;
24
+ /** Easing curve for the enter transition (expand). Defaults to the `easeEaseMax` value. */
25
+ enterEasing?: string;
26
+ /** Time (ms) for the exit transition (collapse). Defaults to the `enterDuration` param for symmetry. */
27
+ exitDuration?: number;
28
+ /** Easing curve for the exit transition (collapse). Defaults to the `enterEasing` param for symmetry. */
29
+ exitEasing?: string;
30
+ };
31
+
32
+ /** Define a presence motion for collapse/expand */
33
+ export declare const createCollapsePresence: PresenceMotionFnCreator<CollapseVariantParams, CollapseRuntimeParams>;
15
34
 
16
35
  /** A React component that applies fade in/out transitions to its children. */
17
36
  export declare const Fade: PresenceComponent< {}>;
@@ -20,6 +39,18 @@ export declare const FadeExaggerated: PresenceComponent< {}>;
20
39
 
21
40
  export declare const FadeSnappy: PresenceComponent< {}>;
22
41
 
42
+ /**
43
+ * This is a factory function that generates a motion function, which has variant params bound into it.
44
+ * The generated motion function accepts other runtime params that aren't locked into the variant, but supplied at runtime.
45
+ * This separation allows the variant to be defined once and reused with different runtime params which may be orthogonal to the variant params.
46
+ * For example, a variant may define the duration and easing of a transition, which are fixed for all instances of the variant,
47
+ * while the runtime params may give access to the target element, which is different for each instance.
48
+ *
49
+ * The generated motion function is also framework-independent, i.e. non-React.
50
+ * It can be turned into a React component using `createPresenceComponent`.
51
+ */
52
+ declare type PresenceMotionFnCreator<MotionVariantParams extends Record<string, MotionParam> = {}, MotionRuntimeParams extends Record<string, MotionParam> = {}> = (variantParams?: MotionVariantParams) => PresenceMotionFn<MotionRuntimeParams>;
53
+
23
54
  /** A React component that applies scale in/out transitions to its children. */
24
55
  export declare const Scale: PresenceComponent< {
25
56
  animateOpacity?: boolean | undefined;
@@ -1,71 +1,94 @@
1
- import { motionTokens, createPresenceComponent, createPresenceComponentVariant } from '@fluentui/react-motion';
2
- /** Define a presence motion for collapse/expand */ const collapseMotion = ({ element, animateOpacity = true })=>{
3
- const fromOpacity = animateOpacity ? 0 : 1;
4
- const toOpacity = 1;
5
- const fromHeight = '0'; // Could be a custom param in the future: start partially expanded
6
- const toHeight = `${element.scrollHeight}px`;
7
- const overflow = 'hidden';
8
- const duration = motionTokens.durationNormal;
9
- const easing = motionTokens.curveEasyEaseMax;
10
- const enterKeyframes = [
11
- {
12
- opacity: fromOpacity,
13
- maxHeight: fromHeight,
14
- overflow
15
- },
16
- // Transition to the height of the content, at 99.99% of the duration.
17
- {
18
- opacity: toOpacity,
19
- maxHeight: toHeight,
20
- offset: 0.9999,
21
- overflow
22
- },
23
- // On completion, remove the maxHeight because the content might need to expand later.
24
- // This extra keyframe is simpler than firing a callback on completion.
25
- {
26
- opacity: toOpacity,
27
- maxHeight: 'unset',
28
- overflow
1
+ import { motionTokens, createPresenceComponent } from '@fluentui/react-motion';
2
+ /** Define a presence motion for collapse/expand */ export const createCollapsePresence = ({ enterDuration = motionTokens.durationNormal, enterEasing = motionTokens.curveEasyEaseMax, exitDuration = enterDuration, exitEasing = enterEasing } = {})=>({ element, animateOpacity = true, orientation = 'vertical' })=>{
3
+ const fromOpacity = 0;
4
+ const toOpacity = 1;
5
+ const fromSize = '0'; // Could be a custom param in the future to start with partially expanded width or height
6
+ const measuredSize = orientation === 'horizontal' ? element.scrollWidth : element.scrollHeight;
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
+ // The enter transition is an array of up to 2 motion atoms: size and opacity.
12
+ const enterAtoms = [
13
+ // Expand size (height or width)
14
+ {
15
+ keyframes: [
16
+ {
17
+ [sizeName]: fromSize,
18
+ [overflowName]: 'hidden'
19
+ },
20
+ {
21
+ [sizeName]: toSize,
22
+ offset: 0.9999,
23
+ [overflowName]: 'hidden'
24
+ },
25
+ {
26
+ [sizeName]: 'unset',
27
+ [overflowName]: 'unset'
28
+ }
29
+ ],
30
+ duration: enterDuration,
31
+ easing: enterEasing
32
+ }
33
+ ];
34
+ // Fade in only if animateOpacity is true. Otherwise, leave opacity unaffected.
35
+ if (animateOpacity) {
36
+ enterAtoms.push({
37
+ keyframes: [
38
+ {
39
+ opacity: fromOpacity
40
+ },
41
+ {
42
+ opacity: toOpacity
43
+ }
44
+ ],
45
+ duration: enterDuration,
46
+ easing: enterEasing,
47
+ fill: 'both'
48
+ });
29
49
  }
30
- ];
31
- const exitKeyframes = [
32
- {
33
- opacity: toOpacity,
34
- maxHeight: toHeight,
35
- overflow
36
- },
37
- {
38
- opacity: fromOpacity,
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
50
+ // The exit transition is an array of up to 2 motion atoms: opacity and size.
51
+ const exitAtoms = [];
52
+ // Fade out only if animateOpacity is false. Otherwise, leave opacity unaffected.
53
+ if (animateOpacity) {
54
+ exitAtoms.push({
55
+ keyframes: [
56
+ {
57
+ opacity: toOpacity
58
+ },
59
+ {
60
+ opacity: fromOpacity
61
+ }
62
+ ],
63
+ duration: exitDuration,
64
+ easing: exitEasing
65
+ });
53
66
  }
67
+ exitAtoms.push(// Collapse size (height or width)
68
+ {
69
+ keyframes: [
70
+ {
71
+ [sizeName]: toSize,
72
+ [overflowName]: 'hidden'
73
+ },
74
+ {
75
+ [sizeName]: fromSize,
76
+ [overflowName]: 'hidden'
77
+ }
78
+ ],
79
+ duration: exitDuration,
80
+ easing: exitEasing,
81
+ fill: 'both'
82
+ });
83
+ return {
84
+ enter: enterAtoms,
85
+ exit: exitAtoms
86
+ };
54
87
  };
55
- };
56
- /** A React component that applies collapse/expand transitions to its children. */ export const Collapse = createPresenceComponent(collapseMotion);
57
- export const CollapseSnappy = createPresenceComponentVariant(Collapse, {
58
- all: {
59
- duration: motionTokens.durationUltraFast
60
- }
61
- });
62
- export const CollapseExaggerated = createPresenceComponentVariant(Collapse, {
63
- enter: {
64
- duration: motionTokens.durationSlow,
65
- easing: motionTokens.curveEasyEaseMax
66
- },
67
- exit: {
68
- duration: motionTokens.durationNormal,
69
- easing: motionTokens.curveEasyEaseMax
70
- }
71
- });
88
+ /** A React component that applies collapse/expand transitions to its children. */ export const Collapse = createPresenceComponent(createCollapsePresence());
89
+ export const CollapseSnappy = createPresenceComponent(createCollapsePresence({
90
+ enterDuration: motionTokens.durationFast
91
+ }));
92
+ export const CollapseExaggerated = createPresenceComponent(createCollapsePresence({
93
+ enterDuration: motionTokens.durationSlower
94
+ }));
@@ -1 +1 @@
1
- {"version":3,"sources":["Collapse.ts"],"sourcesContent":["import {\n motionTokens,\n type PresenceMotionFn,\n createPresenceComponent,\n createPresenceComponentVariant,\n} from '@fluentui/react-motion';\n\n/** Define a presence motion for collapse/expand */\nconst collapseMotion: PresenceMotionFn<{ animateOpacity?: boolean }> = ({ element, animateOpacity = true }) => {\n const fromOpacity = animateOpacity ? 0 : 1;\n const toOpacity = 1;\n const fromHeight = '0'; // Could be a custom param in the future: start partially expanded\n const toHeight = `${element.scrollHeight}px`;\n const overflow = 'hidden';\n\n const duration = motionTokens.durationNormal;\n const easing = motionTokens.curveEasyEaseMax;\n\n const enterKeyframes = [\n { opacity: fromOpacity, maxHeight: fromHeight, overflow },\n // Transition to the height of the content, at 99.99% of the duration.\n { opacity: toOpacity, maxHeight: toHeight, offset: 0.9999, overflow },\n // On completion, remove the maxHeight because the content might need to expand later.\n // This extra keyframe is simpler than firing a callback on completion.\n { opacity: toOpacity, maxHeight: 'unset', overflow },\n ];\n\n const exitKeyframes = [\n { opacity: toOpacity, maxHeight: toHeight, overflow },\n { opacity: fromOpacity, maxHeight: fromHeight, overflow },\n ];\n\n return {\n enter: { duration, easing, keyframes: enterKeyframes },\n exit: { duration, easing, keyframes: exitKeyframes },\n };\n};\n\n/** A React component that applies collapse/expand transitions to its children. */\nexport const Collapse = createPresenceComponent(collapseMotion);\n\nexport const CollapseSnappy = createPresenceComponentVariant(Collapse, {\n all: { duration: motionTokens.durationUltraFast },\n});\n\nexport const CollapseExaggerated = createPresenceComponentVariant(Collapse, {\n enter: { duration: motionTokens.durationSlow, easing: motionTokens.curveEasyEaseMax },\n exit: { duration: motionTokens.durationNormal, easing: motionTokens.curveEasyEaseMax },\n});\n"],"names":["motionTokens","createPresenceComponent","createPresenceComponentVariant","collapseMotion","element","animateOpacity","fromOpacity","toOpacity","fromHeight","toHeight","scrollHeight","overflow","duration","durationNormal","easing","curveEasyEaseMax","enterKeyframes","opacity","maxHeight","offset","exitKeyframes","enter","keyframes","exit","Collapse","CollapseSnappy","all","durationUltraFast","CollapseExaggerated","durationSlow"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SACEA,YAAY,EAEZC,uBAAuB,EACvBC,8BAA8B,QACzB,yBAAyB;AAEhC,iDAAiD,GACjD,MAAMC,iBAAiE,CAAC,EAAEC,OAAO,EAAEC,iBAAiB,IAAI,EAAE;IACxG,MAAMC,cAAcD,iBAAiB,IAAI;IACzC,MAAME,YAAY;IAClB,MAAMC,aAAa,KAAK,kEAAkE;IAC1F,MAAMC,WAAW,CAAC,EAAEL,QAAQM,YAAY,CAAC,EAAE,CAAC;IAC5C,MAAMC,WAAW;IAEjB,MAAMC,WAAWZ,aAAaa,cAAc;IAC5C,MAAMC,SAASd,aAAae,gBAAgB;IAE5C,MAAMC,iBAAiB;QACrB;YAAEC,SAASX;YAAaY,WAAWV;YAAYG;QAAS;QACxD,sEAAsE;QACtE;YAAEM,SAASV;YAAWW,WAAWT;YAAUU,QAAQ;YAAQR;QAAS;QACpE,sFAAsF;QACtF,uEAAuE;QACvE;YAAEM,SAASV;YAAWW,WAAW;YAASP;QAAS;KACpD;IAED,MAAMS,gBAAgB;QACpB;YAAEH,SAASV;YAAWW,WAAWT;YAAUE;QAAS;QACpD;YAAEM,SAASX;YAAaY,WAAWV;YAAYG;QAAS;KACzD;IAED,OAAO;QACLU,OAAO;YAAET;YAAUE;YAAQQ,WAAWN;QAAe;QACrDO,MAAM;YAAEX;YAAUE;YAAQQ,WAAWF;QAAc;IACrD;AACF;AAEA,gFAAgF,GAChF,OAAO,MAAMI,WAAWvB,wBAAwBE,gBAAgB;AAEhE,OAAO,MAAMsB,iBAAiBvB,+BAA+BsB,UAAU;IACrEE,KAAK;QAAEd,UAAUZ,aAAa2B,iBAAiB;IAAC;AAClD,GAAG;AAEH,OAAO,MAAMC,sBAAsB1B,+BAA+BsB,UAAU;IAC1EH,OAAO;QAAET,UAAUZ,aAAa6B,YAAY;QAAEf,QAAQd,aAAae,gBAAgB;IAAC;IACpFQ,MAAM;QAAEX,UAAUZ,aAAaa,cAAc;QAAEC,QAAQd,aAAae,gBAAgB;IAAC;AACvF,GAAG"}
1
+ {"version":3,"sources":["Collapse.ts"],"sourcesContent":["import { motionTokens, createPresenceComponent, AtomMotion } from '@fluentui/react-motion';\nimport type { PresenceMotionFnCreator } from '../../types';\n\ntype CollapseOrientation = 'horizontal' | 'vertical';\n\ntype 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\ntype 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\n/** Define a presence motion for collapse/expand */\nexport const createCollapsePresence: PresenceMotionFnCreator<CollapseVariantParams, CollapseRuntimeParams> =\n ({\n enterDuration = motionTokens.durationNormal,\n enterEasing = motionTokens.curveEasyEaseMax,\n exitDuration = enterDuration,\n exitEasing = enterEasing,\n } = {}) =>\n ({ element, animateOpacity = true, orientation = 'vertical' }) => {\n const fromOpacity = 0;\n const toOpacity = 1;\n const fromSize = '0'; // Could be a custom param in the future to start with partially expanded width or height\n const measuredSize = orientation === 'horizontal' ? element.scrollWidth : element.scrollHeight;\n const toSize = `${measuredSize}px`;\n // use generic names for size and overflow, handling vertical or horizontal orientation\n const sizeName = orientation === 'horizontal' ? 'maxWidth' : 'maxHeight';\n const overflowName = orientation === 'horizontal' ? 'overflowX' : 'overflowY';\n\n // The enter transition is an array of up to 2 motion atoms: size and opacity.\n const enterAtoms: AtomMotion[] = [\n // Expand size (height or width)\n {\n keyframes: [\n {\n [sizeName]: fromSize,\n [overflowName]: 'hidden',\n },\n { [sizeName]: toSize, offset: 0.9999, [overflowName]: 'hidden' },\n { [sizeName]: 'unset', [overflowName]: 'unset' },\n ],\n duration: enterDuration,\n easing: enterEasing,\n },\n ];\n // Fade in only if animateOpacity is true. Otherwise, leave opacity unaffected.\n if (animateOpacity) {\n enterAtoms.push({\n keyframes: [{ opacity: fromOpacity }, { opacity: toOpacity }],\n duration: enterDuration,\n easing: enterEasing,\n fill: 'both',\n });\n }\n\n // The exit transition is an array of up to 2 motion atoms: opacity and size.\n const exitAtoms: AtomMotion[] = [];\n // Fade out only if animateOpacity is false. Otherwise, leave opacity unaffected.\n if (animateOpacity) {\n exitAtoms.push({\n keyframes: [{ opacity: toOpacity }, { opacity: fromOpacity }],\n duration: exitDuration,\n easing: exitEasing,\n });\n }\n exitAtoms.push(\n // Collapse size (height or width)\n {\n keyframes: [\n { [sizeName]: toSize, [overflowName]: 'hidden' },\n { [sizeName]: fromSize, [overflowName]: 'hidden' },\n ],\n duration: exitDuration,\n easing: exitEasing,\n fill: 'both',\n },\n );\n\n return {\n enter: enterAtoms,\n exit: exitAtoms,\n };\n };\n\n/** A React component that applies collapse/expand transitions to its children. */\nexport const Collapse = createPresenceComponent(createCollapsePresence());\n\nexport const CollapseSnappy = createPresenceComponent(\n createCollapsePresence({ enterDuration: motionTokens.durationFast }),\n);\n\nexport const CollapseExaggerated = createPresenceComponent(\n createCollapsePresence({ enterDuration: motionTokens.durationSlower }),\n);\n"],"names":["motionTokens","createPresenceComponent","createCollapsePresence","enterDuration","durationNormal","enterEasing","curveEasyEaseMax","exitDuration","exitEasing","element","animateOpacity","orientation","fromOpacity","toOpacity","fromSize","measuredSize","scrollWidth","scrollHeight","toSize","sizeName","overflowName","enterAtoms","keyframes","offset","duration","easing","push","opacity","fill","exitAtoms","enter","exit","Collapse","CollapseSnappy","durationFast","CollapseExaggerated","durationSlower"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,YAAY,EAAEC,uBAAuB,QAAoB,yBAAyB;AA2B3F,iDAAiD,GACjD,OAAO,MAAMC,yBACX,CAAC,EACCC,gBAAgBH,aAAaI,cAAc,EAC3CC,cAAcL,aAAaM,gBAAgB,EAC3CC,eAAeJ,aAAa,EA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;oBAAE,CAACH,SAAS,EAAED;oBAAQ,CAACE,aAAa,EAAE;gBAAS;gBAC/C;oBAAE,CAACD,SAAS,EAAEL;oBAAU,CAACM,aAAa,EAAE;gBAAS;aAClD;YACDI,UAAUjB;YACVkB,QAAQjB;YACRoB,MAAM;QACR;QAGF,OAAO;YACLE,OAAOT;YACPU,MAAMF;QACR;IACF,EAAE;AAEJ,gFAAgF,GAChF,OAAO,MAAMG,WAAW/B,wBAAwBC,0BAA0B;AAE1E,OAAO,MAAM+B,iBAAiBhC,wBAC5BC,uBAAuB;IAAEC,eAAeH,aAAakC,YAAY;AAAC,IAClE;AAEF,OAAO,MAAMC,sBAAsBlC,wBACjCC,uBAAuB;IAAEC,eAAeH,aAAaoC,cAAc;AAAC,IACpE"}
package/lib/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { Collapse, CollapseSnappy, CollapseExaggerated } from './components/Collapse';
1
+ export { Collapse, CollapseSnappy, CollapseExaggerated, createCollapsePresence } from './components/Collapse';
2
2
  export { Fade, FadeSnappy, FadeExaggerated } 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 { Collapse, CollapseSnappy, CollapseExaggerated } from './components/Collapse';\nexport { Fade, FadeSnappy, FadeExaggerated } from './components/Fade';\nexport { Scale, ScaleSnappy, ScaleExaggerated } from './components/Scale';\n"],"names":["Collapse","CollapseSnappy","CollapseExaggerated","Fade","FadeSnappy","FadeExaggerated","Scale","ScaleSnappy","ScaleExaggerated"],"rangeMappings":";;","mappings":"AAAA,SAASA,QAAQ,EAAEC,cAAc,EAAEC,mBAAmB,QAAQ,wBAAwB;AACtF,SAASC,IAAI,EAAEC,UAAU,EAAEC,eAAe,QAAQ,oBAAoB;AACtE,SAASC,KAAK,EAAEC,WAAW,EAAEC,gBAAgB,QAAQ,qBAAqB"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export { Collapse, CollapseSnappy, CollapseExaggerated, createCollapsePresence } from './components/Collapse';\nexport { Fade, FadeSnappy, FadeExaggerated } from './components/Fade';\nexport { Scale, ScaleSnappy, ScaleExaggerated } from './components/Scale';\n"],"names":["Collapse","CollapseSnappy","CollapseExaggerated","createCollapsePresence","Fade","FadeSnappy","FadeExaggerated","Scale","ScaleSnappy","ScaleExaggerated"],"rangeMappings":";;","mappings":"AAAA,SAASA,QAAQ,EAAEC,cAAc,EAAEC,mBAAmB,EAAEC,sBAAsB,QAAQ,wBAAwB;AAC9G,SAASC,IAAI,EAAEC,UAAU,EAAEC,eAAe,QAAQ,oBAAoB;AACtE,SAASC,KAAK,EAAEC,WAAW,EAAEC,gBAAgB,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 { };
@@ -0,0 +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":"AAEA;;;;;;;;;CASC,GACD,mDAAmD;AACnD,WAGmF"}
@@ -17,76 +17,101 @@ _export(exports, {
17
17
  },
18
18
  CollapseSnappy: function() {
19
19
  return CollapseSnappy;
20
+ },
21
+ createCollapsePresence: function() {
22
+ return createCollapsePresence;
20
23
  }
21
24
  });
22
25
  const _reactmotion = require("@fluentui/react-motion");
23
- /** Define a presence motion for collapse/expand */ const collapseMotion = ({ element, animateOpacity = true })=>{
24
- const fromOpacity = animateOpacity ? 0 : 1;
25
- const toOpacity = 1;
26
- const fromHeight = '0'; // Could be a custom param in the future: start partially expanded
27
- const toHeight = `${element.scrollHeight}px`;
28
- const overflow = 'hidden';
29
- const duration = _reactmotion.motionTokens.durationNormal;
30
- const easing = _reactmotion.motionTokens.curveEasyEaseMax;
31
- const enterKeyframes = [
32
- {
33
- opacity: fromOpacity,
34
- maxHeight: fromHeight,
35
- overflow
36
- },
37
- // Transition to the height of the content, at 99.99% of the duration.
38
- {
39
- opacity: toOpacity,
40
- maxHeight: toHeight,
41
- offset: 0.9999,
42
- overflow
43
- },
44
- // On completion, remove the maxHeight because the content might need to expand later.
45
- // This extra keyframe is simpler than firing a callback on completion.
46
- {
47
- opacity: toOpacity,
48
- maxHeight: 'unset',
49
- overflow
50
- }
51
- ];
52
- const exitKeyframes = [
53
- {
54
- opacity: toOpacity,
55
- maxHeight: toHeight,
56
- overflow
57
- },
58
- {
59
- opacity: fromOpacity,
60
- maxHeight: fromHeight,
61
- overflow
26
+ const createCollapsePresence = ({ enterDuration = _reactmotion.motionTokens.durationNormal, enterEasing = _reactmotion.motionTokens.curveEasyEaseMax, exitDuration = enterDuration, exitEasing = enterEasing } = {})=>({ element, animateOpacity = true, orientation = 'vertical' })=>{
27
+ const fromOpacity = 0;
28
+ const toOpacity = 1;
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
+ // The enter transition is an array of up to 2 motion atoms: size and opacity.
36
+ const enterAtoms = [
37
+ // Expand size (height or width)
38
+ {
39
+ keyframes: [
40
+ {
41
+ [sizeName]: fromSize,
42
+ [overflowName]: 'hidden'
43
+ },
44
+ {
45
+ [sizeName]: toSize,
46
+ offset: 0.9999,
47
+ [overflowName]: 'hidden'
48
+ },
49
+ {
50
+ [sizeName]: 'unset',
51
+ [overflowName]: 'unset'
52
+ }
53
+ ],
54
+ duration: enterDuration,
55
+ easing: enterEasing
56
+ }
57
+ ];
58
+ // Fade in only if animateOpacity is true. Otherwise, leave opacity unaffected.
59
+ if (animateOpacity) {
60
+ enterAtoms.push({
61
+ keyframes: [
62
+ {
63
+ opacity: fromOpacity
64
+ },
65
+ {
66
+ opacity: toOpacity
67
+ }
68
+ ],
69
+ duration: enterDuration,
70
+ easing: enterEasing,
71
+ fill: 'both'
72
+ });
62
73
  }
63
- ];
64
- return {
65
- enter: {
66
- duration,
67
- easing,
68
- keyframes: enterKeyframes
69
- },
70
- exit: {
71
- duration,
72
- easing,
73
- keyframes: exitKeyframes
74
+ // The exit transition is an array of up to 2 motion atoms: opacity and size.
75
+ const exitAtoms = [];
76
+ // Fade out only if animateOpacity is false. Otherwise, leave opacity unaffected.
77
+ if (animateOpacity) {
78
+ exitAtoms.push({
79
+ keyframes: [
80
+ {
81
+ opacity: toOpacity
82
+ },
83
+ {
84
+ opacity: fromOpacity
85
+ }
86
+ ],
87
+ duration: exitDuration,
88
+ easing: exitEasing
89
+ });
74
90
  }
91
+ exitAtoms.push({
92
+ keyframes: [
93
+ {
94
+ [sizeName]: toSize,
95
+ [overflowName]: 'hidden'
96
+ },
97
+ {
98
+ [sizeName]: fromSize,
99
+ [overflowName]: 'hidden'
100
+ }
101
+ ],
102
+ duration: exitDuration,
103
+ easing: exitEasing,
104
+ fill: 'both'
105
+ });
106
+ return {
107
+ enter: enterAtoms,
108
+ exit: exitAtoms
109
+ };
75
110
  };
76
- };
77
- const Collapse = (0, _reactmotion.createPresenceComponent)(collapseMotion);
78
- const CollapseSnappy = (0, _reactmotion.createPresenceComponentVariant)(Collapse, {
79
- all: {
80
- duration: _reactmotion.motionTokens.durationUltraFast
81
- }
82
- });
83
- const CollapseExaggerated = (0, _reactmotion.createPresenceComponentVariant)(Collapse, {
84
- enter: {
85
- duration: _reactmotion.motionTokens.durationSlow,
86
- easing: _reactmotion.motionTokens.curveEasyEaseMax
87
- },
88
- exit: {
89
- duration: _reactmotion.motionTokens.durationNormal,
90
- easing: _reactmotion.motionTokens.curveEasyEaseMax
91
- }
92
- });
111
+ const Collapse = (0, _reactmotion.createPresenceComponent)(createCollapsePresence());
112
+ const CollapseSnappy = (0, _reactmotion.createPresenceComponent)(createCollapsePresence({
113
+ enterDuration: _reactmotion.motionTokens.durationFast
114
+ }));
115
+ const CollapseExaggerated = (0, _reactmotion.createPresenceComponent)(createCollapsePresence({
116
+ enterDuration: _reactmotion.motionTokens.durationSlower
117
+ }));
@@ -1 +1 @@
1
- {"version":3,"sources":["Collapse.ts"],"sourcesContent":["import {\n motionTokens,\n type PresenceMotionFn,\n createPresenceComponent,\n createPresenceComponentVariant,\n} from '@fluentui/react-motion';\n\n/** Define a presence motion for collapse/expand */\nconst collapseMotion: PresenceMotionFn<{ animateOpacity?: boolean }> = ({ element, animateOpacity = true }) => {\n const fromOpacity = animateOpacity ? 0 : 1;\n const toOpacity = 1;\n const fromHeight = '0'; // Could be a custom param in the future: start partially expanded\n const toHeight = `${element.scrollHeight}px`;\n const overflow = 'hidden';\n\n const duration = motionTokens.durationNormal;\n const easing = motionTokens.curveEasyEaseMax;\n\n const enterKeyframes = [\n { opacity: fromOpacity, maxHeight: fromHeight, overflow },\n // Transition to the height of the content, at 99.99% of the duration.\n { opacity: toOpacity, maxHeight: toHeight, offset: 0.9999, overflow },\n // On completion, remove the maxHeight because the content might need to expand later.\n // This extra keyframe is simpler than firing a callback on completion.\n { opacity: toOpacity, maxHeight: 'unset', overflow },\n ];\n\n const exitKeyframes = [\n { opacity: toOpacity, maxHeight: toHeight, overflow },\n { opacity: fromOpacity, maxHeight: fromHeight, overflow },\n ];\n\n return {\n enter: { duration, easing, keyframes: enterKeyframes },\n exit: { duration, easing, keyframes: exitKeyframes },\n };\n};\n\n/** A React component that applies collapse/expand transitions to its children. */\nexport const Collapse = createPresenceComponent(collapseMotion);\n\nexport const CollapseSnappy = createPresenceComponentVariant(Collapse, {\n all: { duration: motionTokens.durationUltraFast },\n});\n\nexport const CollapseExaggerated = createPresenceComponentVariant(Collapse, {\n enter: { duration: motionTokens.durationSlow, easing: motionTokens.curveEasyEaseMax },\n exit: { duration: motionTokens.durationNormal, easing: motionTokens.curveEasyEaseMax },\n});\n"],"names":["Collapse","CollapseExaggerated","CollapseSnappy","collapseMotion","element","animateOpacity","fromOpacity","toOpacity","fromHeight","toHeight","scrollHeight","overflow","duration","motionTokens","durationNormal","easing","curveEasyEaseMax","enterKeyframes","opacity","maxHeight","offset","exitKeyframes","enter","keyframes","exit","createPresenceComponent","createPresenceComponentVariant","all","durationUltraFast","durationSlow"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAuCaA,QAAAA;eAAAA;;IAMAC,mBAAAA;eAAAA;;IAJAC,cAAAA;eAAAA;;;6BApCN;AAEP,iDAAiD,GACjD,MAAMC,iBAAiE,CAAC,E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import { motionTokens, createPresenceComponent, AtomMotion } from '@fluentui/react-motion';\nimport type { PresenceMotionFnCreator } from '../../types';\n\ntype CollapseOrientation = 'horizontal' | 'vertical';\n\ntype 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\ntype 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\n/** Define a presence motion for collapse/expand */\nexport const createCollapsePresence: PresenceMotionFnCreator<CollapseVariantParams, CollapseRuntimeParams> =\n ({\n enterDuration = motionTokens.durationNormal,\n enterEasing = motionTokens.curveEasyEaseMax,\n exitDuration = enterDuration,\n exitEasing = enterEasing,\n } = {}) =>\n ({ element, animateOpacity = true, orientation = 'vertical' }) => {\n const fromOpacity = 0;\n const toOpacity = 1;\n const fromSize = '0'; // Could be a custom param in the future to start with partially expanded width or height\n const measuredSize = orientation === 'horizontal' ? element.scrollWidth : element.scrollHeight;\n const toSize = `${measuredSize}px`;\n // use generic names for size and overflow, handling vertical or horizontal orientation\n const sizeName = orientation === 'horizontal' ? 'maxWidth' : 'maxHeight';\n const overflowName = orientation === 'horizontal' ? 'overflowX' : 'overflowY';\n\n // The enter transition is an array of up to 2 motion atoms: size and opacity.\n const enterAtoms: AtomMotion[] = [\n // Expand size (height or width)\n {\n keyframes: [\n {\n [sizeName]: fromSize,\n [overflowName]: 'hidden',\n },\n { [sizeName]: toSize, offset: 0.9999, [overflowName]: 'hidden' },\n { [sizeName]: 'unset', [overflowName]: 'unset' },\n ],\n duration: enterDuration,\n easing: enterEasing,\n },\n ];\n // Fade in only if animateOpacity is true. Otherwise, leave opacity unaffected.\n if (animateOpacity) {\n enterAtoms.push({\n keyframes: [{ opacity: fromOpacity }, { opacity: toOpacity }],\n duration: enterDuration,\n easing: enterEasing,\n fill: 'both',\n });\n }\n\n // The exit transition is an array of up to 2 motion atoms: opacity and size.\n const exitAtoms: AtomMotion[] = [];\n // Fade out only if animateOpacity is false. Otherwise, leave opacity unaffected.\n if (animateOpacity) {\n exitAtoms.push({\n keyframes: [{ opacity: toOpacity }, { opacity: fromOpacity }],\n duration: exitDuration,\n easing: exitEasing,\n });\n }\n exitAtoms.push(\n // Collapse size (height or width)\n {\n keyframes: [\n { [sizeName]: toSize, [overflowName]: 'hidden' },\n { [sizeName]: fromSize, [overflowName]: 'hidden' },\n ],\n duration: exitDuration,\n easing: exitEasing,\n fill: 'both',\n },\n );\n\n return {\n enter: enterAtoms,\n exit: exitAtoms,\n };\n };\n\n/** A React component that applies collapse/expand transitions to its children. */\nexport const Collapse = createPresenceComponent(createCollapsePresence());\n\nexport const CollapseSnappy = createPresenceComponent(\n createCollapsePresence({ enterDuration: motionTokens.durationFast }),\n);\n\nexport const CollapseExaggerated = createPresenceComponent(\n createCollapsePresence({ enterDuration: motionTokens.durationSlower }),\n);\n"],"names":["Collapse","CollapseExaggerated","CollapseSnappy","createCollapsePresence","enterDuration","motionTokens","durationNormal","enterEasing","curveEasyEaseMax","exitDuration","exitEasing","element","animateOpacity","orientation","fromOpacity","toOpacity","fromSize","measuredSize","scrollWidth","scrollHeight","toSize","sizeName","overflowName","enterAtoms","keyframes","offset","duration","easing","push","opacity","fill","exitAtoms","enter","exit","createPresenceComponent","durationFast","durationSlower"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;I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F;QACjF,IAAInB,gBAAgB;YAClBmB,UAAUH,IAAI,CAAC;gBACbJ,WAAW;oBAAC;wBAAEK,SAASd;oBAAU;oBAAG;wBAAEc,SAASf;oBAAY;iBAAE;gBAC7DY,UAAUjB;gBACVkB,QAAQjB;YACV;QACF;QACAqB,UAAUH,IAAI,CAEZ;YACEJ,WAAW;gBACT;oBAAE,CAACH,SAAS,EAAED;oBAAQ,CAACE,aAAa,EAAE;gBAAS;gBAC/C;oBAAE,CAACD,SAAS,EAAEL;oBAAU,CAACM,aAAa,EAAE;gBAAS;aAClD;YACDI,UAAUjB;YACVkB,QAAQjB;YACRoB,MAAM;QACR;QAGF,OAAO;YACLE,OAAOT;YACPU,MAAMF;QACR;IACF;AAGK,MAAM/B,WAAWkC,IAAAA,oCAAAA,EAAwB/B;AAEzC,MAAMD,iBAAiBgC,IAAAA,oCAAAA,EAC5B/B,uBAAuB;IAAEC,eAAeC,yBAAAA,CAAa8B,YAAY;AAAC;AAG7D,MAAMlC,sBAAsBiC,IAAAA,oCAAAA,EACjC/B,uBAAuB;IAAEC,eAAeC,yBAAAA,CAAa+B,cAAc;AAAC"}
@@ -35,6 +35,9 @@ _export(exports, {
35
35
  },
36
36
  ScaleSnappy: function() {
37
37
  return _Scale.ScaleSnappy;
38
+ },
39
+ createCollapsePresence: function() {
40
+ return _Collapse.createCollapsePresence;
38
41
  }
39
42
  });
40
43
  const _Collapse = require("./components/Collapse");
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export { Collapse, CollapseSnappy, CollapseExaggerated } from './components/Collapse';\nexport { Fade, FadeSnappy, FadeExaggerated } from './components/Fade';\nexport { Scale, ScaleSnappy, ScaleExaggerated } from './components/Scale';\n"],"names":["Collapse","CollapseExaggerated","CollapseSnappy","Fade","FadeExaggerated","FadeSnappy","Scale","ScaleExaggerated","ScaleSnappy"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,QAAQ;eAARA,kBAAQ;;IAAkBC,mBAAmB;eAAnBA,6BAAmB;;IAAnCC,cAAc;eAAdA,wBAAc;;IACxBC,IAAI;eAAJA,UAAI;;IAAcC,eAAe;eAAfA,qBAAe;;IAA3BC,UAAU;eAAVA,gBAAU;;IAChBC,KAAK;eAALA,YAAK;;IAAeC,gBAAgB;eAAhBA,uBAAgB;;IAA7BC,WAAW;eAAXA,kBAAW;;;0BAFmC;sBACZ;uBACG"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export { Collapse, CollapseSnappy, CollapseExaggerated, createCollapsePresence } from './components/Collapse';\nexport { Fade, FadeSnappy, FadeExaggerated } from './components/Fade';\nexport { Scale, ScaleSnappy, ScaleExaggerated } from './components/Scale';\n"],"names":["Collapse","CollapseExaggerated","CollapseSnappy","Fade","FadeExaggerated","FadeSnappy","Scale","ScaleExaggerated","ScaleSnappy","createCollapsePresence"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,QAAQ;eAARA,kBAAQ;;IAAkBC,mBAAmB;eAAnBA,6BAAmB;;IAAnCC,cAAc;eAAdA,wBAAc;;IACxBC,IAAI;eAAJA,UAAI;;IAAcC,eAAe;eAAfA,qBAAe;;IAA3BC,UAAU;eAAVA,gBAAU;;IAChBC,KAAK;eAALA,YAAK;;IAAeC,gBAAgB;eAAhBA,uBAAgB;;IAA7BC,WAAW;eAAXA,kBAAW;;IAF6BC,sBAAsB;eAAtBA,gCAAsB;;;0BAAQ;sBACpC;uBACG"}
@@ -0,0 +1,14 @@
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
+ "use strict";
12
+ Object.defineProperty(exports, "__esModule", {
13
+ value: true
14
+ });
@@ -0,0 +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":"AAEA;;;;;;;;;CASC,GACD,mDAAmD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-motion-components-preview",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
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",