@fluentui/react-motion-components-preview 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -2
- package/dist/index.d.ts +22 -17
- package/lib/atoms/blur-atom.js +1 -0
- package/lib/atoms/blur-atom.js.map +1 -1
- package/lib/atoms/rotate-atom.js +1 -0
- package/lib/atoms/rotate-atom.js.map +1 -1
- package/lib/atoms/scale-atom.js +1 -0
- package/lib/atoms/scale-atom.js.map +1 -1
- package/lib/atoms/slide-atom.js +1 -0
- package/lib/atoms/slide-atom.js.map +1 -1
- package/lib/components/Collapse/Collapse.js +56 -72
- package/lib/components/Collapse/Collapse.js.map +1 -1
- package/lib/components/Collapse/collapse-atoms.js +9 -10
- package/lib/components/Collapse/collapse-atoms.js.map +1 -1
- package/lib/components/Collapse/collapse-test-utils.js +137 -0
- package/lib/components/Collapse/collapse-test-utils.js.map +1 -0
- package/lib/components/Collapse/collapse-types.js.map +1 -1
- package/lib/components/Collapse/index.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/atoms/blur-atom.js.map +1 -1
- package/lib-commonjs/atoms/rotate-atom.js.map +1 -1
- package/lib-commonjs/atoms/scale-atom.js.map +1 -1
- package/lib-commonjs/atoms/slide-atom.js.map +1 -1
- package/lib-commonjs/components/Collapse/Collapse.js +56 -72
- package/lib-commonjs/components/Collapse/Collapse.js.map +1 -1
- package/lib-commonjs/components/Collapse/collapse-atoms.js +9 -10
- package/lib-commonjs/components/Collapse/collapse-atoms.js.map +1 -1
- package/lib-commonjs/components/Collapse/collapse-test-utils.js +155 -0
- package/lib-commonjs/components/Collapse/collapse-test-utils.js.map +1 -0
- package/lib-commonjs/components/Collapse/index.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /**
|
|
2
|
+
* Helper to validate the structure of a collapse motion object.
|
|
3
|
+
* Returns validation data that can be used with Jest expectations.
|
|
4
|
+
*/ export function getCollapseMotionValidation(motion) {
|
|
5
|
+
return {
|
|
6
|
+
enterCount: motion.enter.length,
|
|
7
|
+
exitCount: motion.exit.length,
|
|
8
|
+
hasEnterOpacity: motion.enter.length === 3 && 'opacity' in (motion.enter[2].keyframes[0] || {}),
|
|
9
|
+
hasExitOpacity: motion.exit.length === 3 && 'opacity' in (motion.exit[0].keyframes[0] || {}),
|
|
10
|
+
enterStructure: motion.enter.map((atom)=>({
|
|
11
|
+
hasKeyframes: Array.isArray(atom.keyframes),
|
|
12
|
+
hasDuration: typeof atom.duration === 'number',
|
|
13
|
+
hasEasing: typeof atom.easing === 'string',
|
|
14
|
+
hasDelay: typeof atom.delay === 'number'
|
|
15
|
+
})),
|
|
16
|
+
exitStructure: motion.exit.map((atom)=>({
|
|
17
|
+
hasKeyframes: Array.isArray(atom.keyframes),
|
|
18
|
+
hasDuration: typeof atom.duration === 'number',
|
|
19
|
+
hasEasing: typeof atom.easing === 'string',
|
|
20
|
+
hasDelay: typeof atom.delay === 'number'
|
|
21
|
+
}))
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Helper to extract timing information from collapse motion atoms.
|
|
26
|
+
*/ export function getCollapseTimingInfo(motion, animateOpacity = true) {
|
|
27
|
+
var _motion_enter_, _motion_enter_1, _motion_enter_2, _motion_exit_, _motion_exit_1, _motion_exit_2, _motion_exit_3, _motion_exit_4;
|
|
28
|
+
var _motion_enter__delay, _motion_enter__delay1, _motion_enter__delay2;
|
|
29
|
+
const enterDelays = {
|
|
30
|
+
size: (_motion_enter__delay = (_motion_enter_ = motion.enter[0]) === null || _motion_enter_ === void 0 ? void 0 : _motion_enter_.delay) !== null && _motion_enter__delay !== void 0 ? _motion_enter__delay : 0,
|
|
31
|
+
whitespace: (_motion_enter__delay1 = (_motion_enter_1 = motion.enter[1]) === null || _motion_enter_1 === void 0 ? void 0 : _motion_enter_1.delay) !== null && _motion_enter__delay1 !== void 0 ? _motion_enter__delay1 : 0,
|
|
32
|
+
opacity: animateOpacity ? (_motion_enter__delay2 = (_motion_enter_2 = motion.enter[2]) === null || _motion_enter_2 === void 0 ? void 0 : _motion_enter_2.delay) !== null && _motion_enter__delay2 !== void 0 ? _motion_enter__delay2 : 0 : undefined
|
|
33
|
+
};
|
|
34
|
+
var _motion_exit__delay, _motion_exit__delay1, _motion_exit__delay2, _motion_exit__delay3, _motion_exit__delay4;
|
|
35
|
+
const exitDelays = animateOpacity ? {
|
|
36
|
+
opacity: (_motion_exit__delay = (_motion_exit_ = motion.exit[0]) === null || _motion_exit_ === void 0 ? void 0 : _motion_exit_.delay) !== null && _motion_exit__delay !== void 0 ? _motion_exit__delay : 0,
|
|
37
|
+
size: (_motion_exit__delay1 = (_motion_exit_1 = motion.exit[1]) === null || _motion_exit_1 === void 0 ? void 0 : _motion_exit_1.delay) !== null && _motion_exit__delay1 !== void 0 ? _motion_exit__delay1 : 0,
|
|
38
|
+
whitespace: (_motion_exit__delay2 = (_motion_exit_2 = motion.exit[2]) === null || _motion_exit_2 === void 0 ? void 0 : _motion_exit_2.delay) !== null && _motion_exit__delay2 !== void 0 ? _motion_exit__delay2 : 0
|
|
39
|
+
} : {
|
|
40
|
+
size: (_motion_exit__delay3 = (_motion_exit_3 = motion.exit[0]) === null || _motion_exit_3 === void 0 ? void 0 : _motion_exit_3.delay) !== null && _motion_exit__delay3 !== void 0 ? _motion_exit__delay3 : 0,
|
|
41
|
+
whitespace: (_motion_exit__delay4 = (_motion_exit_4 = motion.exit[1]) === null || _motion_exit_4 === void 0 ? void 0 : _motion_exit_4.delay) !== null && _motion_exit__delay4 !== void 0 ? _motion_exit__delay4 : 0
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
enter: enterDelays,
|
|
45
|
+
exit: exitDelays
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Helper to extract duration information from collapse motion atoms.
|
|
50
|
+
*/ export function getCollapseDurationInfo(motion, animateOpacity = true) {
|
|
51
|
+
var _motion_enter_, _motion_enter_1, _motion_enter_2, _motion_exit_, _motion_exit_1, _motion_exit_2, _motion_exit_3, _motion_exit_4;
|
|
52
|
+
var _motion_enter__duration, _motion_enter__duration1, _motion_enter__duration2;
|
|
53
|
+
const enterDurations = {
|
|
54
|
+
size: (_motion_enter__duration = (_motion_enter_ = motion.enter[0]) === null || _motion_enter_ === void 0 ? void 0 : _motion_enter_.duration) !== null && _motion_enter__duration !== void 0 ? _motion_enter__duration : 0,
|
|
55
|
+
whitespace: (_motion_enter__duration1 = (_motion_enter_1 = motion.enter[1]) === null || _motion_enter_1 === void 0 ? void 0 : _motion_enter_1.duration) !== null && _motion_enter__duration1 !== void 0 ? _motion_enter__duration1 : 0,
|
|
56
|
+
opacity: animateOpacity ? (_motion_enter__duration2 = (_motion_enter_2 = motion.enter[2]) === null || _motion_enter_2 === void 0 ? void 0 : _motion_enter_2.duration) !== null && _motion_enter__duration2 !== void 0 ? _motion_enter__duration2 : 0 : undefined
|
|
57
|
+
};
|
|
58
|
+
var _motion_exit__duration, _motion_exit__duration1, _motion_exit__duration2, _motion_exit__duration3, _motion_exit__duration4;
|
|
59
|
+
const exitDurations = animateOpacity ? {
|
|
60
|
+
opacity: (_motion_exit__duration = (_motion_exit_ = motion.exit[0]) === null || _motion_exit_ === void 0 ? void 0 : _motion_exit_.duration) !== null && _motion_exit__duration !== void 0 ? _motion_exit__duration : 0,
|
|
61
|
+
size: (_motion_exit__duration1 = (_motion_exit_1 = motion.exit[1]) === null || _motion_exit_1 === void 0 ? void 0 : _motion_exit_1.duration) !== null && _motion_exit__duration1 !== void 0 ? _motion_exit__duration1 : 0,
|
|
62
|
+
whitespace: (_motion_exit__duration2 = (_motion_exit_2 = motion.exit[2]) === null || _motion_exit_2 === void 0 ? void 0 : _motion_exit_2.duration) !== null && _motion_exit__duration2 !== void 0 ? _motion_exit__duration2 : 0
|
|
63
|
+
} : {
|
|
64
|
+
size: (_motion_exit__duration3 = (_motion_exit_3 = motion.exit[0]) === null || _motion_exit_3 === void 0 ? void 0 : _motion_exit_3.duration) !== null && _motion_exit__duration3 !== void 0 ? _motion_exit__duration3 : 0,
|
|
65
|
+
whitespace: (_motion_exit__duration4 = (_motion_exit_4 = motion.exit[1]) === null || _motion_exit_4 === void 0 ? void 0 : _motion_exit_4.duration) !== null && _motion_exit__duration4 !== void 0 ? _motion_exit__duration4 : 0
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
enter: enterDurations,
|
|
69
|
+
exit: exitDurations
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Helper to analyze orientation-specific properties in collapse atoms.
|
|
74
|
+
*/ export function getCollapseOrientationInfo(motion, animateOpacity = true) {
|
|
75
|
+
const enterSizeAtom = motion.enter[0];
|
|
76
|
+
const enterWhitespaceAtom = motion.enter[1];
|
|
77
|
+
const exitOffset = animateOpacity ? 1 : 0;
|
|
78
|
+
const exitSizeAtom = motion.exit[exitOffset];
|
|
79
|
+
const exitWhitespaceAtom = motion.exit[exitOffset + 1];
|
|
80
|
+
return {
|
|
81
|
+
enter: {
|
|
82
|
+
sizeProperties: Object.keys((enterSizeAtom === null || enterSizeAtom === void 0 ? void 0 : enterSizeAtom.keyframes[0]) || {}),
|
|
83
|
+
whitespaceProperties: Object.keys((enterWhitespaceAtom === null || enterWhitespaceAtom === void 0 ? void 0 : enterWhitespaceAtom.keyframes[0]) || {})
|
|
84
|
+
},
|
|
85
|
+
exit: {
|
|
86
|
+
sizeProperties: Object.keys((exitSizeAtom === null || exitSizeAtom === void 0 ? void 0 : exitSizeAtom.keyframes[0]) || {}),
|
|
87
|
+
whitespaceProperties: Object.keys((exitWhitespaceAtom === null || exitWhitespaceAtom === void 0 ? void 0 : exitWhitespaceAtom.keyframes[0]) || {})
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Helper to analyze size atom keyframes for validation.
|
|
93
|
+
*/ export function getSizeAtomInfo(sizeAtom, direction) {
|
|
94
|
+
const keyframes = sizeAtom.keyframes;
|
|
95
|
+
const properties = Object.keys(keyframes[0] || {});
|
|
96
|
+
return {
|
|
97
|
+
keyframeCount: keyframes.length,
|
|
98
|
+
properties,
|
|
99
|
+
hasOffset: direction === 'enter' ? 'offset' in (keyframes[1] || {}) : false,
|
|
100
|
+
hasFill: 'fill' in sizeAtom,
|
|
101
|
+
fillValue: sizeAtom.fill,
|
|
102
|
+
firstFrameValues: keyframes[0] || {},
|
|
103
|
+
lastFrameValues: keyframes[keyframes.length - 1] || {}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Helper to analyze whitespace atom keyframes for validation.
|
|
108
|
+
*/ export function getWhitespaceAtomInfo(whitespaceAtom, direction) {
|
|
109
|
+
const keyframe = whitespaceAtom.keyframes[0] || {};
|
|
110
|
+
return {
|
|
111
|
+
properties: Object.keys(keyframe),
|
|
112
|
+
offset: keyframe.offset,
|
|
113
|
+
expectedOffset: direction === 'enter' ? 0 : 1,
|
|
114
|
+
hasFill: 'fill' in whitespaceAtom,
|
|
115
|
+
fillValue: whitespaceAtom.fill,
|
|
116
|
+
isVertical: 'paddingBlockStart' in keyframe,
|
|
117
|
+
isHorizontal: 'paddingInlineStart' in keyframe
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Helper to compare opacity handling between two motion objects.
|
|
122
|
+
*/ export function getOpacityComparisonInfo(withOpacity, withoutOpacity) {
|
|
123
|
+
return {
|
|
124
|
+
withOpacity: {
|
|
125
|
+
enterCount: withOpacity.enter.length,
|
|
126
|
+
exitCount: withOpacity.exit.length,
|
|
127
|
+
hasEnterOpacity: withOpacity.enter.length === 3,
|
|
128
|
+
hasExitOpacity: withOpacity.exit.length === 3
|
|
129
|
+
},
|
|
130
|
+
withoutOpacity: {
|
|
131
|
+
enterCount: withoutOpacity.enter.length,
|
|
132
|
+
exitCount: withoutOpacity.exit.length,
|
|
133
|
+
hasEnterOpacity: false,
|
|
134
|
+
hasExitOpacity: false
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Collapse/collapse-test-utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n\nimport type { AtomMotion } from '@fluentui/react-motion';\n\n/**\n * Collapse-specific test utilities for validating motion structure and behavior.\n * These utilities are meant to be used within Jest test files.\n */\n\nexport interface CollapseMotionCounts {\n enter: number;\n exit: number;\n}\n\nexport interface CollapseTimingExpectations {\n enter: { size: number; whitespace: number; opacity?: number };\n exit: { opacity?: number; size: number; whitespace: number };\n}\n\nexport interface CollapseDurationExpectations {\n enter: { size: number; whitespace: number; opacity?: number };\n exit: { opacity?: number; size: number; whitespace: number };\n}\n\n/**\n * Helper to validate the structure of a collapse motion object.\n * Returns validation data that can be used with Jest expectations.\n */\nexport function getCollapseMotionValidation(motion: { enter: AtomMotion[]; exit: AtomMotion[] }) {\n return {\n enterCount: motion.enter.length,\n exitCount: motion.exit.length,\n hasEnterOpacity: motion.enter.length === 3 && 'opacity' in (motion.enter[2].keyframes[0] || {}),\n hasExitOpacity: motion.exit.length === 3 && 'opacity' in (motion.exit[0].keyframes[0] || {}),\n enterStructure: motion.enter.map(atom => ({\n hasKeyframes: Array.isArray(atom.keyframes),\n hasDuration: typeof atom.duration === 'number',\n hasEasing: typeof atom.easing === 'string',\n hasDelay: typeof atom.delay === 'number',\n })),\n exitStructure: motion.exit.map(atom => ({\n hasKeyframes: Array.isArray(atom.keyframes),\n hasDuration: typeof atom.duration === 'number',\n hasEasing: typeof atom.easing === 'string',\n hasDelay: typeof atom.delay === 'number',\n })),\n };\n}\n\n/**\n * Helper to extract timing information from collapse motion atoms.\n */\nexport function getCollapseTimingInfo(\n motion: { enter: AtomMotion[]; exit: AtomMotion[] },\n animateOpacity: boolean = true,\n) {\n const enterDelays = {\n size: motion.enter[0]?.delay ?? 0,\n whitespace: motion.enter[1]?.delay ?? 0,\n opacity: animateOpacity ? motion.enter[2]?.delay ?? 0 : undefined,\n };\n\n const exitDelays = animateOpacity\n ? {\n opacity: motion.exit[0]?.delay ?? 0,\n size: motion.exit[1]?.delay ?? 0,\n whitespace: motion.exit[2]?.delay ?? 0,\n }\n : {\n size: motion.exit[0]?.delay ?? 0,\n whitespace: motion.exit[1]?.delay ?? 0,\n };\n\n return { enter: enterDelays, exit: exitDelays };\n}\n\n/**\n * Helper to extract duration information from collapse motion atoms.\n */\nexport function getCollapseDurationInfo(\n motion: { enter: AtomMotion[]; exit: AtomMotion[] },\n animateOpacity: boolean = true,\n) {\n const enterDurations = {\n size: motion.enter[0]?.duration ?? 0,\n whitespace: motion.enter[1]?.duration ?? 0,\n opacity: animateOpacity ? motion.enter[2]?.duration ?? 0 : undefined,\n };\n\n const exitDurations = animateOpacity\n ? {\n opacity: motion.exit[0]?.duration ?? 0,\n size: motion.exit[1]?.duration ?? 0,\n whitespace: motion.exit[2]?.duration ?? 0,\n }\n : {\n size: motion.exit[0]?.duration ?? 0,\n whitespace: motion.exit[1]?.duration ?? 0,\n };\n\n return { enter: enterDurations, exit: exitDurations };\n}\n\n/**\n * Helper to analyze orientation-specific properties in collapse atoms.\n */\nexport function getCollapseOrientationInfo(\n motion: { enter: AtomMotion[]; exit: AtomMotion[] },\n animateOpacity: boolean = true,\n) {\n const enterSizeAtom = motion.enter[0];\n const enterWhitespaceAtom = motion.enter[1];\n\n const exitOffset = animateOpacity ? 1 : 0;\n const exitSizeAtom = motion.exit[exitOffset];\n const exitWhitespaceAtom = motion.exit[exitOffset + 1];\n\n return {\n enter: {\n sizeProperties: Object.keys(enterSizeAtom?.keyframes[0] || {}),\n whitespaceProperties: Object.keys(enterWhitespaceAtom?.keyframes[0] || {}),\n },\n exit: {\n sizeProperties: Object.keys(exitSizeAtom?.keyframes[0] || {}),\n whitespaceProperties: Object.keys(exitWhitespaceAtom?.keyframes[0] || {}),\n },\n };\n}\n\n/**\n * Helper to analyze size atom keyframes for validation.\n */\nexport function getSizeAtomInfo(sizeAtom: AtomMotion, direction: 'enter' | 'exit') {\n const keyframes = sizeAtom.keyframes;\n const properties = Object.keys(keyframes[0] || {});\n\n return {\n keyframeCount: keyframes.length,\n properties,\n hasOffset: direction === 'enter' ? 'offset' in (keyframes[1] || {}) : false,\n hasFill: 'fill' in sizeAtom,\n fillValue: sizeAtom.fill,\n firstFrameValues: keyframes[0] || {},\n lastFrameValues: keyframes[keyframes.length - 1] || {},\n };\n}\n\n/**\n * Helper to analyze whitespace atom keyframes for validation.\n */\nexport function getWhitespaceAtomInfo(whitespaceAtom: AtomMotion, direction: 'enter' | 'exit') {\n const keyframe = whitespaceAtom.keyframes[0] || {};\n\n return {\n properties: Object.keys(keyframe),\n offset: keyframe.offset,\n expectedOffset: direction === 'enter' ? 0 : 1,\n hasFill: 'fill' in whitespaceAtom,\n fillValue: whitespaceAtom.fill,\n isVertical: 'paddingBlockStart' in keyframe,\n isHorizontal: 'paddingInlineStart' in keyframe,\n };\n}\n\n/**\n * Helper to compare opacity handling between two motion objects.\n */\nexport function getOpacityComparisonInfo(\n withOpacity: { enter: AtomMotion[]; exit: AtomMotion[] },\n withoutOpacity: { enter: AtomMotion[]; exit: AtomMotion[] },\n) {\n return {\n withOpacity: {\n enterCount: withOpacity.enter.length,\n exitCount: withOpacity.exit.length,\n hasEnterOpacity: withOpacity.enter.length === 3,\n hasExitOpacity: withOpacity.exit.length === 3,\n },\n withoutOpacity: {\n enterCount: withoutOpacity.enter.length,\n exitCount: withoutOpacity.exit.length,\n hasEnterOpacity: false,\n hasExitOpacity: false,\n },\n };\n}\n"],"names":["getCollapseMotionValidation","motion","enterCount","enter","length","exitCount","exit","hasEnterOpacity","keyframes","hasExitOpacity","enterStructure","map","atom","hasKeyframes","Array","isArray","hasDuration","duration","hasEasing","easing","hasDelay","delay","exitStructure","getCollapseTimingInfo","animateOpacity","enterDelays","size","whitespace","opacity","undefined","exitDelays","getCollapseDurationInfo","enterDurations","exitDurations","getCollapseOrientationInfo","enterSizeAtom","enterWhitespaceAtom","exitOffset","exitSizeAtom","exitWhitespaceAtom","sizeProperties","Object","keys","whitespaceProperties","getSizeAtomInfo","sizeAtom","direction","properties","keyframeCount","hasOffset","hasFill","fillValue","fill","firstFrameValues","lastFrameValues","getWhitespaceAtomInfo","whitespaceAtom","keyframe","offset","expectedOffset","isVertical","isHorizontal","getOpacityComparisonInfo","withOpacity","withoutOpacity"],"mappings":"AAAA,oEAAoE,GAwBpE;;;CAGC,GACD,OAAO,SAASA,4BAA4BC,MAAmD;IAC7F,OAAO;QACLC,YAAYD,OAAOE,KAAK,CAACC,MAAM;QAC/BC,WAAWJ,OAAOK,IAAI,CAACF,MAAM;QAC7BG,iBAAiBN,OAAOE,KAAK,CAACC,MAAM,KAAK,KAAK,aAAcH,CAAAA,OAAOE,KAAK,CAAC,EAAE,CAACK,SAAS,CAAC,EAAE,IAAI,CAAC,CAAA;QAC7FC,gBAAgBR,OAAOK,IAAI,CAACF,MAAM,KAAK,KAAK,aAAcH,CAAAA,OAAOK,IAAI,CAAC,EAAE,CAACE,SAAS,CAAC,EAAE,IAAI,CAAC,CAAA;QAC1FE,gBAAgBT,OAAOE,KAAK,CAACQ,GAAG,CAACC,CAAAA,OAAS,CAAA;gBACxCC,cAAcC,MAAMC,OAAO,CAACH,KAAKJ,SAAS;gBAC1CQ,aAAa,OAAOJ,KAAKK,QAAQ,KAAK;gBACtCC,WAAW,OAAON,KAAKO,MAAM,KAAK;gBAClCC,UAAU,OAAOR,KAAKS,KAAK,KAAK;YAClC,CAAA;QACAC,eAAerB,OAAOK,IAAI,CAACK,GAAG,CAACC,CAAAA,OAAS,CAAA;gBACtCC,cAAcC,MAAMC,OAAO,CAACH,KAAKJ,SAAS;gBAC1CQ,aAAa,OAAOJ,KAAKK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AAI,CAAClC,SAAS,CAAC,EAAE,IAAI,CAAC;IAEhD,OAAO;QACLwC,eAAexC,UAAUJ,MAAM;QAC/B2C;QACAE,WAAWH,cAAc,UAAU,YAAatC,CAAAA,SAAS,CAAC,EAAE,IAAI,CAAC,CAAA,IAAK;QACtE0C,SAAS,UAAUL;QACnBM,WAAWN,SAASO,IAAI;QACxBC,kBAAkB7C,SAAS,CAAC,EAAE,IAAI,CAAC;QACnC8C,iBAAiB9C,SAAS,CAACA,UAAUJ,MAAM,GAAG,EAAE,IAAI,CAAC;IACvD;AACF;AAEA;;CAEC,GACD,OAAO,SAASmD,sBAAsBC,cAA0B,EAAEV,SAA2B;IAC3F,MAAMW,WAAWD,eAAehD,SAAS,CAAC,EAAE,IAAI,CAAC;IAEjD,OAAO;QACLuC,YAAYN,OAAOC,IAAI,CAACe;QACxBC,QAAQD,SAASC,MAAM;QACvBC,gBAAgBb,cAAc,UAAU,IAAI;QAC5CI,SAAS,UAAUM;QACnBL,WAAWK,eAAeJ,IAAI;QAC9BQ,YAAY,uBAAuBH;QACnCI,cAAc,wBAAwBJ;IACxC;AACF;AAEA;;CAEC,GACD,OAAO,SAASK,yBACdC,WAAwD,EACxDC,cAA2D;IAE3D,OAAO;QACLD,aAAa;YACX7D,YAAY6D,YAAY5D,KAAK,CAACC,MAAM;YACpCC,WAAW0D,YAAYzD,IAAI,CAACF,MAAM;YAClCG,iBAAiBwD,YAAY5D,KAAK,CAACC,MAAM,KAAK;YAC9CK,gBAAgBsD,YAAYzD,IAAI,CAACF,MAAM,KAAK;QAC9C;QACA4D,gBAAgB;YACd9D,YAAY8D,eAAe7D,KAAK,CAACC,MAAM;YACvCC,WAAW2D,eAAe1D,IAAI,CAACF,MAAM;YACrCG,iBAAiB;YACjBE,gBAAgB;QAClB;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Collapse/collapse-types.ts"],"sourcesContent":["import type { BasePresenceParams,
|
|
1
|
+
{"version":3,"sources":["../src/components/Collapse/collapse-types.ts"],"sourcesContent":["import type { BasePresenceParams, AnimateOpacity } from '../../types';\n\nexport type CollapseOrientation = 'horizontal' | 'vertical';\n\n/**\n * Duration properties for granular timing control in Collapse animations.\n */\nexport type CollapseDurations = {\n /** Time (ms) for the size animation during enter. Defaults to `duration` for unified timing. */\n sizeDuration?: number;\n\n /** Time (ms) for the opacity animation during enter. Defaults to `sizeDuration` for synchronized timing. */\n opacityDuration?: number;\n\n /** Time (ms) for the size animation during exit. Defaults to `exitDuration` for unified timing. */\n exitSizeDuration?: number;\n\n /** Time (ms) for the opacity animation during exit. Defaults to `exitSizeDuration` for synchronized timing. */\n exitOpacityDuration?: number;\n};\n\nexport type CollapseParams = BasePresenceParams &\n AnimateOpacity &\n CollapseDurations & {\n /** The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height. */\n orientation?: CollapseOrientation;\n\n /** The starting size for the expand animation. Defaults to `'0px'`. */\n fromSize?: string;\n\n /**\n * Time (ms) to delay the inner stagger between size and opacity animations.\n * On enter this delays the opacity after size; on exit this delays the size after opacity.\n * Defaults to 0.\n */\n staggerDelay?: number;\n\n /**\n * Time (ms) to delay the inner stagger during exit. Defaults to the `staggerDelay` param for symmetry.\n */\n exitStaggerDelay?: number;\n };\n"],"names":[],"mappings":"AAqBA,WAoBI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Collapse/index.ts"],"sourcesContent":["export { Collapse, CollapseDelayed, CollapseRelaxed, CollapseSnappy } from './Collapse';\nexport type { CollapseParams,
|
|
1
|
+
{"version":3,"sources":["../src/components/Collapse/index.ts"],"sourcesContent":["export { Collapse, CollapseDelayed, CollapseRelaxed, CollapseSnappy } from './Collapse';\nexport type { CollapseParams, CollapseDurations } from './collapse-types';\n"],"names":["Collapse","CollapseDelayed","CollapseRelaxed","CollapseSnappy"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,eAAe,EAAEC,eAAe,EAAEC,cAAc,QAAQ,aAAa"}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Collapse,\n CollapseSnappy,\n CollapseRelaxed,\n CollapseDelayed,\n type CollapseParams,\n type
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Collapse,\n CollapseSnappy,\n CollapseRelaxed,\n CollapseDelayed,\n type CollapseParams,\n type CollapseDurations,\n} from './components/Collapse';\nexport { Fade, FadeSnappy, FadeRelaxed, type FadeParams } from './components/Fade';\nexport { Scale, ScaleSnappy, ScaleRelaxed, type ScaleParams } from './components/Scale';\nexport { Slide, SlideSnappy, SlideRelaxed, type SlideParams } from './components/Slide';\nexport { Blur, type BlurParams } from './components/Blur';\nexport { Rotate, type RotateParams } from './components/Rotate';\n"],"names":["Collapse","CollapseSnappy","CollapseRelaxed","CollapseDelayed","Fade","FadeSnappy","FadeRelaxed","Scale","ScaleSnappy","ScaleRelaxed","Slide","SlideSnappy","SlideRelaxed","Blur","Rotate"],"mappings":"AAAA,SACEA,QAAQ,EACRC,cAAc,EACdC,eAAe,EACfC,eAAe,QAGV,wBAAwB;AAC/B,SAASC,IAAI,EAAEC,UAAU,EAAEC,WAAW,QAAyB,oBAAoB;AACnF,SAASC,KAAK,EAAEC,WAAW,EAAEC,YAAY,QAA0B,qBAAqB;AACxF,SAASC,KAAK,EAAEC,WAAW,EAAEC,YAAY,QAA0B,qBAAqB;AACxF,SAASC,IAAI,QAAyB,oBAAoB;AAC1D,SAASC,MAAM,QAA2B,sBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/atoms/blur-atom.ts"],"sourcesContent":["import { AtomMotion, motionTokens } from '@fluentui/react-motion';\nimport { BaseAtomParams } from '../types';\n\ninterface BlurAtomParams extends BaseAtomParams {\n fromRadius?: string;\n}\n\n/**\n * Generates a motion atom object for a blur-in or blur-out.\n * @param direction - The functional direction of the motion: 'enter' or 'exit'.\n * @param duration - The duration of the motion in milliseconds.\n * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.\n * @param fromRadius - The blur radius value with units (e.g., '20px', '1rem'). Defaults to '20px'.\n * @returns A motion atom object with filter blur keyframes and the supplied duration and easing.\n */\nexport const blurAtom = ({\n direction,\n duration,\n easing = motionTokens.curveLinear,\n delay = 0,\n fromRadius = '10px',\n}: BlurAtomParams): AtomMotion => {\n const keyframes = [{ filter: `blur(${fromRadius})` }, { filter: 'blur(0px)' }];\n if (direction === 'exit') {\n keyframes.reverse();\n }\n return {\n keyframes,\n duration,\n easing,\n delay,\n };\n};\n"],"names":["blurAtom","direction","duration","easing","motionTokens","curveLinear","delay","fromRadius","keyframes","filter","reverse"],"mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["../src/atoms/blur-atom.ts"],"sourcesContent":["import { AtomMotion, motionTokens } from '@fluentui/react-motion';\nimport { BaseAtomParams } from '../types';\n\ninterface BlurAtomParams extends BaseAtomParams {\n fromRadius?: string;\n}\n\n/**\n * Generates a motion atom object for a blur-in or blur-out.\n * @param direction - The functional direction of the motion: 'enter' or 'exit'.\n * @param duration - The duration of the motion in milliseconds.\n * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.\n * @param fromRadius - The blur radius value with units (e.g., '20px', '1rem'). Defaults to '20px'.\n * @param delay - Time (ms) to delay the animation. Defaults to 0.\n * @returns A motion atom object with filter blur keyframes and the supplied duration and easing.\n */\nexport const blurAtom = ({\n direction,\n duration,\n easing = motionTokens.curveLinear,\n delay = 0,\n fromRadius = '10px',\n}: BlurAtomParams): AtomMotion => {\n const keyframes = [{ filter: `blur(${fromRadius})` }, { filter: 'blur(0px)' }];\n if (direction === 'exit') {\n keyframes.reverse();\n }\n return {\n keyframes,\n duration,\n easing,\n delay,\n };\n};\n"],"names":["blurAtom","direction","duration","easing","motionTokens","curveLinear","delay","fromRadius","keyframes","filter","reverse"],"mappings":";;;;+BAgBaA;;;eAAAA;;;6BAhB4B;AAgBlC,MAAMA,WAAW,CAAC,EACvBC,SAAS,EACTC,QAAQ,EACRC,SAASC,yBAAY,CAACC,WAAW,EACjCC,QAAQ,CAAC,EACTC,aAAa,MAAM,EACJ;IACf,MAAMC,YAAY;QAAC;YAAEC,QAAQ,CAAC,KAAK,EAAEF,WAAW,CAAC,CAAC;QAAC;QAAG;YAAEE,QAAQ;QAAY;KAAE;IAC9E,IAAIR,cAAc,QAAQ;QACxBO,UAAUE,OAAO;IACnB;IACA,OAAO;QACLF;QACAN;QACAC;QACAG;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/atoms/rotate-atom.ts"],"sourcesContent":["import { AtomMotion, motionTokens } from '@fluentui/react-motion';\nimport type { RotateParams } from '../components/Rotate/rotate-types';\nimport { BaseAtomParams } from '../types';\n\ntype Axis3D = NonNullable<RotateParams['axis']>;\n\ninterface RotateAtomParams extends BaseAtomParams {\n axis?: Axis3D;\n angle?: number;\n exitAngle?: number;\n}\n\nconst createRotateValue = (axis: Axis3D, angle: number): string => {\n return `${axis.toLowerCase()} ${angle}deg`;\n};\n\n/**\n * Generates a motion atom object for a rotation around a single axis.\n * @param direction - The functional direction of the motion: 'enter' or 'exit'.\n * @param duration - The duration of the motion in milliseconds.\n * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.\n * @param axis - The axis of rotation: 'x', 'y', or 'z'. Defaults to 'y'.\n * @param angle - The starting rotation angle in degrees. Defaults to -90.\n * @param exitAngle - The ending rotation angle in degrees. Defaults to the negation of `angle`.\n * @returns A motion atom object with rotate keyframes and the supplied duration and easing.\n */\nexport const rotateAtom = ({\n direction,\n duration,\n easing = motionTokens.curveLinear,\n delay = 0,\n axis = 'y',\n angle = -90,\n exitAngle = -angle,\n}: RotateAtomParams): AtomMotion => {\n let fromAngle = angle;\n let toAngle = 0;\n\n if (direction === 'exit') {\n fromAngle = 0;\n toAngle = exitAngle;\n }\n const keyframes = [{ rotate: createRotateValue(axis, fromAngle) }, { rotate: createRotateValue(axis, toAngle) }];\n\n return {\n keyframes,\n duration,\n easing,\n delay,\n };\n};\n"],"names":["rotateAtom","createRotateValue","axis","angle","toLowerCase","direction","duration","easing","motionTokens","curveLinear","delay","exitAngle","fromAngle","toAngle","keyframes","rotate"],"mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["../src/atoms/rotate-atom.ts"],"sourcesContent":["import { AtomMotion, motionTokens } from '@fluentui/react-motion';\nimport type { RotateParams } from '../components/Rotate/rotate-types';\nimport { BaseAtomParams } from '../types';\n\ntype Axis3D = NonNullable<RotateParams['axis']>;\n\ninterface RotateAtomParams extends BaseAtomParams {\n axis?: Axis3D;\n angle?: number;\n exitAngle?: number;\n}\n\nconst createRotateValue = (axis: Axis3D, angle: number): string => {\n return `${axis.toLowerCase()} ${angle}deg`;\n};\n\n/**\n * Generates a motion atom object for a rotation around a single axis.\n * @param direction - The functional direction of the motion: 'enter' or 'exit'.\n * @param duration - The duration of the motion in milliseconds.\n * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.\n * @param axis - The axis of rotation: 'x', 'y', or 'z'. Defaults to 'y'.\n * @param angle - The starting rotation angle in degrees. Defaults to -90.\n * @param exitAngle - The ending rotation angle in degrees. Defaults to the negation of `angle`.\n * @param delay - Time (ms) to delay the animation. Defaults to 0.\n * @returns A motion atom object with rotate keyframes and the supplied duration and easing.\n */\nexport const rotateAtom = ({\n direction,\n duration,\n easing = motionTokens.curveLinear,\n delay = 0,\n axis = 'y',\n angle = -90,\n exitAngle = -angle,\n}: RotateAtomParams): AtomMotion => {\n let fromAngle = angle;\n let toAngle = 0;\n\n if (direction === 'exit') {\n fromAngle = 0;\n toAngle = exitAngle;\n }\n const keyframes = [{ rotate: createRotateValue(axis, fromAngle) }, { rotate: createRotateValue(axis, toAngle) }];\n\n return {\n keyframes,\n duration,\n easing,\n delay,\n };\n};\n"],"names":["rotateAtom","createRotateValue","axis","angle","toLowerCase","direction","duration","easing","motionTokens","curveLinear","delay","exitAngle","fromAngle","toAngle","keyframes","rotate"],"mappings":";;;;+BA2BaA;;;eAAAA;;;6BA3B4B;AAYzC,MAAMC,oBAAoB,CAACC,MAAcC;IACvC,OAAO,GAAGD,KAAKE,WAAW,GAAG,CAAC,EAAED,MAAM,GAAG,CAAC;AAC5C;AAaO,MAAMH,aAAa,CAAC,EACzBK,SAAS,EACTC,QAAQ,EACRC,SAASC,yBAAY,CAACC,WAAW,EACjCC,QAAQ,CAAC,EACTR,OAAO,GAAG,EACVC,QAAQ,CAAC,EAAE,EACXQ,YAAY,CAACR,KAAK,EACD;IACjB,IAAIS,YAAYT;IAChB,IAAIU,UAAU;IAEd,IAAIR,cAAc,QAAQ;QACxBO,YAAY;QACZC,UAAUF;IACZ;IACA,MAAMG,YAAY;QAAC;YAAEC,QAAQd,kBAAkBC,MAAMU;QAAW;QAAG;YAAEG,QAAQd,kBAAkBC,MAAMW;QAAS;KAAE;IAEhH,OAAO;QACLC;QACAR;QACAC;QACAG;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/atoms/scale-atom.ts"],"sourcesContent":["import { AtomMotion, motionTokens } from '@fluentui/react-motion';\nimport { BaseAtomParams } from '../types';\n\ninterface ScaleAtomParams extends BaseAtomParams {\n fromScale?: number;\n toScale?: number;\n}\n\n/**\n * Generates a motion atom object for a scale in or scale out.\n * @param direction - The functional direction of the motion: 'enter' or 'exit'.\n * @param duration - The duration of the motion in milliseconds.\n * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.\n * @param fromScale - The starting scale value. Defaults to 0.9.\n * @param toScale - The ending scale value. Defaults to 1.\n * @returns A motion atom object with scale keyframes and the supplied duration and easing.\n */\nexport const scaleAtom = ({\n direction,\n duration,\n easing = motionTokens.curveLinear,\n delay = 0,\n fromScale = 0.9,\n toScale = 1,\n}: ScaleAtomParams): AtomMotion => {\n const keyframes = [{ scale: fromScale }, { scale: toScale }];\n if (direction === 'exit') {\n keyframes.reverse();\n }\n return {\n keyframes,\n duration,\n easing,\n delay,\n };\n};\n"],"names":["scaleAtom","direction","duration","easing","motionTokens","curveLinear","delay","fromScale","toScale","keyframes","scale","reverse"],"mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["../src/atoms/scale-atom.ts"],"sourcesContent":["import { AtomMotion, motionTokens } from '@fluentui/react-motion';\nimport { BaseAtomParams } from '../types';\n\ninterface ScaleAtomParams extends BaseAtomParams {\n fromScale?: number;\n toScale?: number;\n}\n\n/**\n * Generates a motion atom object for a scale in or scale out.\n * @param direction - The functional direction of the motion: 'enter' or 'exit'.\n * @param duration - The duration of the motion in milliseconds.\n * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.\n * @param fromScale - The starting scale value. Defaults to 0.9.\n * @param toScale - The ending scale value. Defaults to 1.\n * @param delay - Time (ms) to delay the animation. Defaults to 0.\n * @returns A motion atom object with scale keyframes and the supplied duration and easing.\n */\nexport const scaleAtom = ({\n direction,\n duration,\n easing = motionTokens.curveLinear,\n delay = 0,\n fromScale = 0.9,\n toScale = 1,\n}: ScaleAtomParams): AtomMotion => {\n const keyframes = [{ scale: fromScale }, { scale: toScale }];\n if (direction === 'exit') {\n keyframes.reverse();\n }\n return {\n keyframes,\n duration,\n easing,\n delay,\n };\n};\n"],"names":["scaleAtom","direction","duration","easing","motionTokens","curveLinear","delay","fromScale","toScale","keyframes","scale","reverse"],"mappings":";;;;+BAkBaA;;;eAAAA;;;6BAlB4B;AAkBlC,MAAMA,YAAY,CAAC,EACxBC,SAAS,EACTC,QAAQ,EACRC,SAASC,yBAAY,CAACC,WAAW,EACjCC,QAAQ,CAAC,EACTC,YAAY,GAAG,EACfC,UAAU,CAAC,EACK;IAChB,MAAMC,YAAY;QAAC;YAAEC,OAAOH;QAAU;QAAG;YAAEG,OAAOF;QAAQ;KAAE;IAC5D,IAAIP,cAAc,QAAQ;QACxBQ,UAAUE,OAAO;IACnB;IACA,OAAO;QACLF;QACAP;QACAC;QACAG;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/atoms/slide-atom.ts"],"sourcesContent":["import { AtomMotion, motionTokens } from '@fluentui/react-motion';\nimport { BaseAtomParams } from '../types';\n\ninterface SlideAtomParams extends BaseAtomParams {\n fromX?: string;\n fromY?: string;\n}\n\n/**\n * Generates a motion atom object for a slide-in or slide-out.\n * @param direction - The functional direction of the motion: 'enter' or 'exit'.\n * @param duration - The duration of the motion in milliseconds.\n * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.\n * @param fromX - The starting X translate value with units (e.g., '0px', '100%'). Defaults to '0px'.\n * @param fromY - The starting Y translate value with units (e.g., '-20px', '100%'). Defaults to '0px'.\n * @returns A motion atom object with translate keyframes and the supplied duration and easing.\n */\nexport const slideAtom = ({\n direction,\n duration,\n easing = motionTokens.curveLinear,\n delay = 0,\n fromX = '0px',\n fromY = '20px',\n}: SlideAtomParams): AtomMotion => {\n const keyframes = [{ translate: `${fromX} ${fromY}` }, { translate: '0px 0px' }];\n if (direction === 'exit') {\n keyframes.reverse();\n }\n return {\n keyframes,\n duration,\n easing,\n delay,\n };\n};\n"],"names":["slideAtom","direction","duration","easing","motionTokens","curveLinear","delay","fromX","fromY","keyframes","translate","reverse"],"mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["../src/atoms/slide-atom.ts"],"sourcesContent":["import { AtomMotion, motionTokens } from '@fluentui/react-motion';\nimport { BaseAtomParams } from '../types';\n\ninterface SlideAtomParams extends BaseAtomParams {\n fromX?: string;\n fromY?: string;\n}\n\n/**\n * Generates a motion atom object for a slide-in or slide-out.\n * @param direction - The functional direction of the motion: 'enter' or 'exit'.\n * @param duration - The duration of the motion in milliseconds.\n * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.\n * @param fromX - The starting X translate value with units (e.g., '0px', '100%'). Defaults to '0px'.\n * @param fromY - The starting Y translate value with units (e.g., '-20px', '100%'). Defaults to '0px'.\n * @param delay - Time (ms) to delay the animation. Defaults to 0.\n * @returns A motion atom object with translate keyframes and the supplied duration and easing.\n */\nexport const slideAtom = ({\n direction,\n duration,\n easing = motionTokens.curveLinear,\n delay = 0,\n fromX = '0px',\n fromY = '20px',\n}: SlideAtomParams): AtomMotion => {\n const keyframes = [{ translate: `${fromX} ${fromY}` }, { translate: '0px 0px' }];\n if (direction === 'exit') {\n keyframes.reverse();\n }\n return {\n keyframes,\n duration,\n easing,\n delay,\n };\n};\n"],"names":["slideAtom","direction","duration","easing","motionTokens","curveLinear","delay","fromX","fromY","keyframes","translate","reverse"],"mappings":";;;;+BAkBaA;;;eAAAA;;;6BAlB4B;AAkBlC,MAAMA,YAAY,CAAC,EACxBC,SAAS,EACTC,QAAQ,EACRC,SAASC,yBAAY,CAACC,WAAW,EACjCC,QAAQ,CAAC,EACTC,QAAQ,KAAK,EACbC,QAAQ,MAAM,EACE;IAChB,MAAMC,YAAY;QAAC;YAAEC,WAAW,GAAGH,MAAM,CAAC,EAAEC,OAAO;QAAC;QAAG;YAAEE,WAAW;QAAU;KAAE;IAChF,IAAIT,cAAc,QAAQ;QACxBQ,UAAUE,OAAO;IACnB;IACA,OAAO;QACLF;QACAP;QACAC;QACAG;IACF;AACF"}
|
|
@@ -25,46 +25,71 @@ _export(exports, {
|
|
|
25
25
|
const _reactmotion = require("@fluentui/react-motion");
|
|
26
26
|
const _collapseatoms = require("./collapse-atoms");
|
|
27
27
|
const _fadeatom = require("../../atoms/fade-atom");
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Define a presence motion for collapse/expand
|
|
30
|
+
*
|
|
31
|
+
* @param element - The element to apply the collapse motion to
|
|
32
|
+
* @param duration - Time (ms) for the enter transition (expand). Defaults to the `durationNormal` value (200 ms)
|
|
33
|
+
* @param easing - Easing curve for the enter transition. Defaults to the `curveEasyEaseMax` value
|
|
34
|
+
* @param delay - Time (ms) to delay the entire enter transition. Defaults to 0
|
|
35
|
+
* @param exitDuration - Time (ms) for the exit transition (collapse). Defaults to the `duration` param for symmetry
|
|
36
|
+
* @param exitEasing - Easing curve for the exit transition. Defaults to the `easing` param for symmetry
|
|
37
|
+
* @param exitDelay - Time (ms) to delay the entire exit transition. Defaults to the `delay` param for symmetry
|
|
38
|
+
* @param staggerDelay - Time (ms) offset between the size and opacity animations. Defaults to 0
|
|
39
|
+
* @param exitStaggerDelay - Time (ms) offset between the size and opacity animations on exit. Defaults to the `staggerDelay` param for symmetry
|
|
40
|
+
* @param sizeDuration - Time (ms) for the size animation during enter. Defaults to `duration` for unified timing
|
|
41
|
+
* @param opacityDuration - Time (ms) for the opacity animation during enter. Defaults to `sizeDuration` for synchronized timing
|
|
42
|
+
* @param exitSizeDuration - Time (ms) for the size animation during exit. Defaults to `exitDuration` for unified timing
|
|
43
|
+
* @param exitOpacityDuration - Time (ms) for the opacity animation during exit. Defaults to `exitSizeDuration` for synchronized timing
|
|
44
|
+
* @param animateOpacity - Whether to animate the opacity. Defaults to `true`
|
|
45
|
+
* @param orientation - The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height
|
|
46
|
+
* @param fromSize - The starting size for the expand animation. Defaults to `'0px'`
|
|
47
|
+
*/ const collapsePresenceFn = ({ element, // Primary duration controls (simple API)
|
|
48
|
+
duration = _reactmotion.motionTokens.durationNormal, exitDuration = duration, // Granular duration controls with smart defaults (advanced API)
|
|
49
|
+
sizeDuration = duration, opacityDuration = sizeDuration, exitSizeDuration = exitDuration, exitOpacityDuration = exitSizeDuration, // Other timing controls
|
|
50
|
+
easing = _reactmotion.motionTokens.curveEasyEaseMax, delay = 0, exitEasing = easing, exitDelay = delay, staggerDelay = 0, exitStaggerDelay = staggerDelay, // Animation controls
|
|
51
|
+
animateOpacity = true, orientation = 'vertical', fromSize = '0px' })=>{
|
|
31
52
|
// ----- ENTER -----
|
|
32
53
|
// The enter transition is an array of up to 3 motion atoms: size, whitespace and opacity.
|
|
54
|
+
// For enter: size expands first, then opacity fades in after staggerDelay
|
|
33
55
|
const enterAtoms = [
|
|
56
|
+
// Apply global delay to size atom - size expansion starts first
|
|
34
57
|
(0, _collapseatoms.sizeEnterAtom)({
|
|
35
58
|
orientation,
|
|
36
59
|
duration: sizeDuration,
|
|
37
60
|
easing,
|
|
38
|
-
element
|
|
61
|
+
element,
|
|
62
|
+
fromSize,
|
|
63
|
+
delay
|
|
39
64
|
}),
|
|
40
65
|
(0, _collapseatoms.whitespaceAtom)({
|
|
41
66
|
direction: 'enter',
|
|
42
67
|
orientation,
|
|
43
68
|
duration: sizeDuration,
|
|
44
|
-
easing
|
|
69
|
+
easing,
|
|
70
|
+
delay
|
|
45
71
|
})
|
|
46
72
|
];
|
|
47
73
|
// Fade in only if animateOpacity is true. Otherwise, leave opacity unaffected.
|
|
48
74
|
if (animateOpacity) {
|
|
49
|
-
enterAtoms.push({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
delay,
|
|
56
|
-
fill: 'both'
|
|
57
|
-
});
|
|
75
|
+
enterAtoms.push((0, _fadeatom.fadeAtom)({
|
|
76
|
+
direction: 'enter',
|
|
77
|
+
duration: opacityDuration,
|
|
78
|
+
easing,
|
|
79
|
+
delay: delay + staggerDelay
|
|
80
|
+
}));
|
|
58
81
|
}
|
|
59
82
|
// ----- EXIT -----
|
|
60
83
|
// The exit transition is an array of up to 3 motion atoms: opacity, size and whitespace.
|
|
84
|
+
// For exit: opacity fades out first, then size collapses after exitStaggerDelay
|
|
61
85
|
const exitAtoms = [];
|
|
62
86
|
// Fade out only if animateOpacity is true. Otherwise, leave opacity unaffected.
|
|
63
87
|
if (animateOpacity) {
|
|
64
88
|
exitAtoms.push((0, _fadeatom.fadeAtom)({
|
|
65
89
|
direction: 'exit',
|
|
66
90
|
duration: exitOpacityDuration,
|
|
67
|
-
easing: exitEasing
|
|
91
|
+
easing: exitEasing,
|
|
92
|
+
delay: exitDelay
|
|
68
93
|
}));
|
|
69
94
|
}
|
|
70
95
|
exitAtoms.push((0, _collapseatoms.sizeExitAtom)({
|
|
@@ -72,72 +97,19 @@ exitSizeDuration, exitOpacityDuration = exitSizeDuration, exitEasing, exitDelay
|
|
|
72
97
|
duration: exitSizeDuration,
|
|
73
98
|
easing: exitEasing,
|
|
74
99
|
element,
|
|
75
|
-
delay: exitDelay
|
|
100
|
+
delay: exitDelay + exitStaggerDelay,
|
|
101
|
+
fromSize
|
|
76
102
|
}), (0, _collapseatoms.whitespaceAtom)({
|
|
77
103
|
direction: 'exit',
|
|
78
104
|
orientation,
|
|
79
105
|
duration: exitSizeDuration,
|
|
80
106
|
easing: exitEasing,
|
|
81
|
-
delay: exitDelay
|
|
107
|
+
delay: exitDelay + exitStaggerDelay
|
|
82
108
|
}));
|
|
83
109
|
return {
|
|
84
110
|
enter: enterAtoms,
|
|
85
111
|
exit: exitAtoms
|
|
86
112
|
};
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Define a presence motion for collapse/expand
|
|
90
|
-
*
|
|
91
|
-
* @param element - The element to apply the collapse motion to
|
|
92
|
-
* @param duration - Time (ms) for the enter transition (expand). Defaults to the `durationNormal` value (200 ms)
|
|
93
|
-
* @param easing - Easing curve for the enter transition. Defaults to the `curveEasyEaseMax` value
|
|
94
|
-
* @param exitDuration - Time (ms) for the exit transition (collapse). Defaults to the `duration` param for symmetry
|
|
95
|
-
* @param exitEasing - Easing curve for the exit transition. Defaults to the `easing` param for symmetry
|
|
96
|
-
* @param animateOpacity - Whether to animate the opacity. Defaults to `true`
|
|
97
|
-
* @param orientation - The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height
|
|
98
|
-
*/ const collapsePresenceFn = ({ element, duration = _reactmotion.motionTokens.durationNormal, easing = _reactmotion.motionTokens.curveEasyEaseMax, exitDuration = duration, exitEasing = easing, animateOpacity = true, orientation = 'vertical' })=>{
|
|
99
|
-
return createCollapseAtoms({
|
|
100
|
-
element,
|
|
101
|
-
orientation,
|
|
102
|
-
animateOpacity,
|
|
103
|
-
sizeDuration: duration,
|
|
104
|
-
opacityDuration: duration,
|
|
105
|
-
easing,
|
|
106
|
-
exitSizeDuration: exitDuration,
|
|
107
|
-
exitOpacityDuration: exitDuration,
|
|
108
|
-
exitEasing,
|
|
109
|
-
delay: 0,
|
|
110
|
-
exitDelay: 0
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* Define a presence motion for collapse/expand that can stagger the size and opacity motions by a given delay
|
|
115
|
-
*
|
|
116
|
-
* @param element - The element to apply the collapse motion to
|
|
117
|
-
* @param sizeDuration - Time (ms) for the size expand. Defaults to the `durationNormal` value (200 ms)
|
|
118
|
-
* @param opacityDuration - Time (ms) for the fade-in. Defaults to the `durationSlower` value (400 ms)
|
|
119
|
-
* @param easing - Easing curve for the enter transition. Defaults to the `curveEasyEase` value
|
|
120
|
-
* @param delay - Time (ms) between the size expand start and the fade-in start. Defaults to the `durationNormal` value (200 ms)
|
|
121
|
-
* @param exitSizeDuration - Time (ms) for the size collapse. Defaults to the `sizeDuration` param for temporal symmetry
|
|
122
|
-
* @param exitOpacityDuration - Time (ms) for the fade-out. Defaults to the `opacityDuration` param for temporal symmetry
|
|
123
|
-
* @param exitEasing - Easing curve for the exit transition. Defaults to the `easing` param for symmetry
|
|
124
|
-
* @param exitDelay - Time (ms) between the fade-out start and the size collapse start. Defaults to the `durationSlower` value (400 ms)
|
|
125
|
-
* @param animateOpacity - Whether to animate the opacity. Defaults to `true`
|
|
126
|
-
* @param orientation - The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height
|
|
127
|
-
*/ const collapseDelayedPresenceFn = ({ element, sizeDuration = _reactmotion.motionTokens.durationNormal, opacityDuration = _reactmotion.motionTokens.durationSlower, easing = _reactmotion.motionTokens.curveEasyEase, delay = _reactmotion.motionTokens.durationNormal, exitSizeDuration = sizeDuration, exitOpacityDuration = opacityDuration, exitEasing = easing, exitDelay = _reactmotion.motionTokens.durationSlower, animateOpacity = true, orientation = 'vertical' })=>{
|
|
128
|
-
return createCollapseAtoms({
|
|
129
|
-
element,
|
|
130
|
-
orientation,
|
|
131
|
-
animateOpacity,
|
|
132
|
-
sizeDuration,
|
|
133
|
-
opacityDuration,
|
|
134
|
-
easing,
|
|
135
|
-
delay,
|
|
136
|
-
exitSizeDuration,
|
|
137
|
-
exitOpacityDuration,
|
|
138
|
-
exitEasing,
|
|
139
|
-
exitDelay
|
|
140
|
-
});
|
|
141
113
|
};
|
|
142
114
|
const Collapse = (0, _reactmotion.createPresenceComponent)(collapsePresenceFn);
|
|
143
115
|
const CollapseSnappy = (0, _reactmotion.createPresenceComponentVariant)(Collapse, {
|
|
@@ -146,4 +118,16 @@ const CollapseSnappy = (0, _reactmotion.createPresenceComponentVariant)(Collapse
|
|
|
146
118
|
const CollapseRelaxed = (0, _reactmotion.createPresenceComponentVariant)(Collapse, {
|
|
147
119
|
duration: _reactmotion.motionTokens.durationSlower
|
|
148
120
|
});
|
|
149
|
-
const CollapseDelayed = (0, _reactmotion.
|
|
121
|
+
const CollapseDelayed = (0, _reactmotion.createPresenceComponentVariant)(Collapse, {
|
|
122
|
+
// Enter timing per motion design spec
|
|
123
|
+
sizeDuration: _reactmotion.motionTokens.durationNormal,
|
|
124
|
+
opacityDuration: _reactmotion.motionTokens.durationSlower,
|
|
125
|
+
staggerDelay: _reactmotion.motionTokens.durationNormal,
|
|
126
|
+
// Exit timing per motion design spec
|
|
127
|
+
exitSizeDuration: _reactmotion.motionTokens.durationNormal,
|
|
128
|
+
exitOpacityDuration: _reactmotion.motionTokens.durationSlower,
|
|
129
|
+
exitStaggerDelay: _reactmotion.motionTokens.durationSlower,
|
|
130
|
+
// Easing per motion design spec
|
|
131
|
+
easing: _reactmotion.motionTokens.curveEasyEase,
|
|
132
|
+
exitEasing: _reactmotion.motionTokens.curveEasyEase
|
|
133
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Collapse/Collapse.ts"],"sourcesContent":["import {\n motionTokens,\n createPresenceComponent,\n PresenceMotionFn,\n createPresenceComponentVariant,\n AtomMotion,\n} from '@fluentui/react-motion';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/Collapse/Collapse.ts"],"sourcesContent":["import {\n motionTokens,\n createPresenceComponent,\n PresenceMotionFn,\n createPresenceComponentVariant,\n AtomMotion,\n} from '@fluentui/react-motion';\nimport type { CollapseParams } from './collapse-types';\nimport { sizeEnterAtom, sizeExitAtom, whitespaceAtom } from './collapse-atoms';\nimport { fadeAtom } from '../../atoms/fade-atom';\n\n/**\n * Define a presence motion for collapse/expand\n *\n * @param element - The element to apply the collapse motion to\n * @param duration - Time (ms) for the enter transition (expand). Defaults to the `durationNormal` value (200 ms)\n * @param easing - Easing curve for the enter transition. Defaults to the `curveEasyEaseMax` value\n * @param delay - Time (ms) to delay the entire enter transition. Defaults to 0\n * @param exitDuration - Time (ms) for the exit transition (collapse). Defaults to the `duration` param for symmetry\n * @param exitEasing - Easing curve for the exit transition. Defaults to the `easing` param for symmetry\n * @param exitDelay - Time (ms) to delay the entire exit transition. Defaults to the `delay` param for symmetry\n * @param staggerDelay - Time (ms) offset between the size and opacity animations. Defaults to 0\n * @param exitStaggerDelay - Time (ms) offset between the size and opacity animations on exit. Defaults to the `staggerDelay` param for symmetry\n * @param sizeDuration - Time (ms) for the size animation during enter. Defaults to `duration` for unified timing\n * @param opacityDuration - Time (ms) for the opacity animation during enter. Defaults to `sizeDuration` for synchronized timing\n * @param exitSizeDuration - Time (ms) for the size animation during exit. Defaults to `exitDuration` for unified timing\n * @param exitOpacityDuration - Time (ms) for the opacity animation during exit. Defaults to `exitSizeDuration` for synchronized timing\n * @param animateOpacity - Whether to animate the opacity. Defaults to `true`\n * @param orientation - The orientation of the size animation. Defaults to `'vertical'` to expand/collapse the height\n * @param fromSize - The starting size for the expand animation. Defaults to `'0px'`\n */\nconst collapsePresenceFn: PresenceMotionFn<CollapseParams> = ({\n element,\n // Primary duration controls (simple API)\n duration = motionTokens.durationNormal,\n exitDuration = duration,\n\n // Granular duration controls with smart defaults (advanced API)\n sizeDuration = duration,\n opacityDuration = sizeDuration,\n exitSizeDuration = exitDuration,\n exitOpacityDuration = exitSizeDuration,\n\n // Other timing controls\n easing = motionTokens.curveEasyEaseMax,\n delay = 0,\n exitEasing = easing,\n exitDelay = delay,\n staggerDelay = 0,\n exitStaggerDelay = staggerDelay,\n\n // Animation controls\n animateOpacity = true,\n orientation = 'vertical',\n fromSize = '0px',\n}) => {\n // ----- ENTER -----\n // The enter transition is an array of up to 3 motion atoms: size, whitespace and opacity.\n // For enter: size expands first, then opacity fades in after staggerDelay\n const enterAtoms: AtomMotion[] = [\n // Apply global delay to size atom - size expansion starts first\n sizeEnterAtom({ orientation, duration: sizeDuration, easing, element, fromSize, delay }),\n whitespaceAtom({ direction: 'enter', orientation, duration: sizeDuration, easing, delay }),\n ];\n // Fade in only if animateOpacity is true. Otherwise, leave opacity unaffected.\n if (animateOpacity) {\n enterAtoms.push(fadeAtom({ direction: 'enter', duration: opacityDuration, easing, delay: delay + staggerDelay }));\n }\n\n // ----- EXIT -----\n // The exit transition is an array of up to 3 motion atoms: opacity, size and whitespace.\n // For exit: opacity fades out first, then size collapses after exitStaggerDelay\n const exitAtoms: AtomMotion[] = [];\n // Fade out only if animateOpacity is true. Otherwise, leave opacity unaffected.\n if (animateOpacity) {\n exitAtoms.push(\n fadeAtom({ direction: 'exit', duration: exitOpacityDuration, easing: exitEasing, delay: exitDelay }),\n );\n }\n\n exitAtoms.push(\n sizeExitAtom({\n orientation,\n duration: exitSizeDuration,\n easing: exitEasing,\n element,\n delay: exitDelay + exitStaggerDelay,\n fromSize,\n }),\n whitespaceAtom({\n direction: 'exit',\n orientation,\n duration: exitSizeDuration,\n easing: exitEasing,\n delay: exitDelay + exitStaggerDelay, // Size/whitespace collapse after opacity finishes fading out\n }),\n );\n\n return {\n enter: enterAtoms,\n exit: exitAtoms,\n };\n};\n\n/** A React component that applies collapse/expand transitions to its children. */\nexport const Collapse = createPresenceComponent(collapsePresenceFn);\n\nexport const CollapseSnappy = createPresenceComponentVariant(Collapse, {\n duration: motionTokens.durationFast,\n});\n\nexport const CollapseRelaxed = createPresenceComponentVariant(Collapse, {\n duration: motionTokens.durationSlower,\n});\n\n/** A React component that applies collapse/expand transitions with delayed fade to its children. */\nexport const CollapseDelayed = createPresenceComponentVariant(Collapse, {\n // Enter timing per motion design spec\n sizeDuration: motionTokens.durationNormal, // 200ms\n opacityDuration: motionTokens.durationSlower, // 400ms\n staggerDelay: motionTokens.durationNormal, // 200ms\n\n // Exit timing per motion design spec\n exitSizeDuration: motionTokens.durationNormal, // 200ms\n exitOpacityDuration: motionTokens.durationSlower, // 400ms\n exitStaggerDelay: motionTokens.durationSlower, // 400ms\n\n // Easing per motion design spec\n easing: motionTokens.curveEasyEase,\n exitEasing: motionTokens.curveEasyEase,\n});\n"],"names":["Collapse","CollapseDelayed","CollapseRelaxed","CollapseSnappy","collapsePresenceFn","element","duration","motionTokens","durationNormal","exitDuration","sizeDuration","opacityDuration","exitSizeDuration","exitOpacityDuration","easing","curveEasyEaseMax","delay","exitEasing","exitDelay","staggerDelay","exitStaggerDelay","animateOpacity","orientation","fromSize","enterAtoms","sizeEnterAtom","whitespaceAtom","direction","push","fadeAtom","exitAtoms","sizeExitAtom","enter","exit","createPresenceComponent","createPresenceComponentVariant","durationFast","durationSlower","curveEasyEase"],"mappings":";;;;;;;;;;;IAyGaA,QAAQ;eAARA;;IAWAC,eAAe;eAAfA;;IALAC,eAAe;eAAfA;;IAJAC,cAAc;eAAdA;;;6BArGN;+BAEqD;0BACnC;AAEzB;;;;;;;;;;;;;;;;;;;CAmBC,GACD,MAAMC,qBAAuD,CAAC,EAC5DC,OAAO,EACP,yCAAyC;AACzCC,WAAWC,yBAAY,CAACC,cAAc,EACtCC,eAAeH,QAAQ,EAEvB,gEAAgE;AAChEI,eAAeJ,QAAQ,EACvBK,kBAAkBD,YAAY,EAC9BE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,MAAMD,iBAAiBgC,IAAAA,2CAA8B,EAACnC,UAAU;IACrEM,UAAUC,yBAAY,CAAC6B,YAAY;AACrC;AAEO,MAAMlC,kBAAkBiC,IAAAA,2CAA8B,EAACnC,UAAU;IACtEM,UAAUC,yBAAY,CAAC8B,cAAc;AACvC;AAGO,MAAMpC,kBAAkBkC,IAAAA,2CAA8B,EAACnC,UAAU;IACtE,sCAAsC;IACtCU,cAAcH,yBAAY,CAACC,cAAc;IACzCG,iBAAiBJ,yBAAY,CAAC8B,cAAc;IAC5ClB,cAAcZ,yBAAY,CAACC,cAAc;IAEzC,qCAAqC;IACrCI,kBAAkBL,yBAAY,CAACC,cAAc;IAC7CK,qBAAqBN,yBAAY,CAAC8B,cAAc;IAChDjB,kBAAkBb,yBAAY,CAAC8B,cAAc;IAE7C,gCAAgC;IAChCvB,QAAQP,yBAAY,CAAC+B,aAAa;IAClCrB,YAAYV,yBAAY,CAAC+B,aAAa;AACxC"}
|
|
@@ -31,7 +31,7 @@ const sizeValuesForOrientation = (orientation, element)=>{
|
|
|
31
31
|
toSize
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
|
-
const sizeEnterAtom = ({ orientation, duration, easing, element, fromSize = '0' })=>{
|
|
34
|
+
const sizeEnterAtom = ({ orientation, duration, easing, element, fromSize = '0', delay = 0 })=>{
|
|
35
35
|
const { sizeName, overflowName, toSize } = sizeValuesForOrientation(orientation, element);
|
|
36
36
|
return {
|
|
37
37
|
keyframes: [
|
|
@@ -50,7 +50,9 @@ const sizeEnterAtom = ({ orientation, duration, easing, element, fromSize = '0'
|
|
|
50
50
|
}
|
|
51
51
|
],
|
|
52
52
|
duration,
|
|
53
|
-
easing
|
|
53
|
+
easing,
|
|
54
|
+
delay,
|
|
55
|
+
fill: 'both'
|
|
54
56
|
};
|
|
55
57
|
};
|
|
56
58
|
const sizeExitAtom = ({ orientation, duration, easing, element, delay = 0, fromSize = '0' })=>{
|
|
@@ -68,8 +70,8 @@ const sizeExitAtom = ({ orientation, duration, easing, element, delay = 0, fromS
|
|
|
68
70
|
],
|
|
69
71
|
duration,
|
|
70
72
|
easing,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
delay,
|
|
74
|
+
fill: 'both'
|
|
73
75
|
};
|
|
74
76
|
};
|
|
75
77
|
// ----- WHITESPACE -----
|
|
@@ -105,14 +107,11 @@ const whitespaceAtom = ({ direction, orientation, duration, easing, delay = 0 })
|
|
|
105
107
|
offset
|
|
106
108
|
}
|
|
107
109
|
];
|
|
108
|
-
|
|
110
|
+
return {
|
|
109
111
|
keyframes,
|
|
110
112
|
duration,
|
|
111
113
|
easing,
|
|
112
|
-
delay
|
|
114
|
+
delay,
|
|
115
|
+
fill: 'both'
|
|
113
116
|
};
|
|
114
|
-
if (direction === 'exit') {
|
|
115
|
-
atom.fill = 'forwards';
|
|
116
|
-
}
|
|
117
|
-
return atom;
|
|
118
117
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Collapse/collapse-atoms.ts"],"sourcesContent":["import { AtomMotion, PresenceDirection } from '@fluentui/react-motion';\nimport { CollapseOrientation } from './collapse-types';\n\n// ----- SIZE -----\n\nconst sizeValuesForOrientation = (orientation: CollapseOrientation, element: Element) => {\n const sizeName = orientation === 'horizontal' ? 'maxWidth' : 'maxHeight';\n const overflowName = orientation === 'horizontal' ? 'overflowX' : 'overflowY';\n const measuredSize = orientation === 'horizontal' ? element.scrollWidth : element.scrollHeight;\n const toSize = `${measuredSize}px`;\n return { sizeName, overflowName, toSize };\n};\n\ninterface SizeEnterAtomParams {\n orientation: CollapseOrientation;\n duration: number;\n easing: string;\n element: HTMLElement;\n fromSize?: string;\n}\n\nexport const sizeEnterAtom = ({\n orientation,\n duration,\n easing,\n element,\n fromSize = '0',\n}: SizeEnterAtomParams): AtomMotion => {\n const { sizeName, overflowName, toSize } = sizeValuesForOrientation(orientation, element);\n\n return {\n keyframes: [\n { [sizeName]: fromSize, [overflowName]: 'hidden' },\n { [sizeName]: toSize, offset: 0.9999, [overflowName]: 'hidden' },\n { [sizeName]: 'unset', [overflowName]: 'unset' },\n ],\n duration,\n easing,\n };\n};\n\ninterface SizeExitAtomParams extends SizeEnterAtomParams {\n delay?: number;\n}\n\nexport const sizeExitAtom = ({\n orientation,\n duration,\n easing,\n element,\n delay = 0,\n fromSize = '0',\n}: SizeExitAtomParams): AtomMotion => {\n const { sizeName, overflowName, toSize } = sizeValuesForOrientation(orientation, element);\n\n return {\n keyframes: [\n { [sizeName]: toSize, [overflowName]: 'hidden' },\n { [sizeName]: fromSize, [overflowName]: 'hidden' },\n ],\n duration,\n easing,\n fill: 'both',\n
|
|
1
|
+
{"version":3,"sources":["../src/components/Collapse/collapse-atoms.ts"],"sourcesContent":["import { AtomMotion, PresenceDirection } from '@fluentui/react-motion';\nimport { CollapseOrientation } from './collapse-types';\n\n// ----- SIZE -----\n\nconst sizeValuesForOrientation = (orientation: CollapseOrientation, element: Element) => {\n const sizeName = orientation === 'horizontal' ? 'maxWidth' : 'maxHeight';\n const overflowName = orientation === 'horizontal' ? 'overflowX' : 'overflowY';\n const measuredSize = orientation === 'horizontal' ? element.scrollWidth : element.scrollHeight;\n const toSize = `${measuredSize}px`;\n return { sizeName, overflowName, toSize };\n};\n\ninterface SizeEnterAtomParams {\n orientation: CollapseOrientation;\n duration: number;\n easing: string;\n element: HTMLElement;\n fromSize?: string;\n delay?: number;\n}\n\nexport const sizeEnterAtom = ({\n orientation,\n duration,\n easing,\n element,\n fromSize = '0',\n delay = 0,\n}: SizeEnterAtomParams): AtomMotion => {\n const { sizeName, overflowName, toSize } = sizeValuesForOrientation(orientation, element);\n\n return {\n keyframes: [\n { [sizeName]: fromSize, [overflowName]: 'hidden' },\n { [sizeName]: toSize, offset: 0.9999, [overflowName]: 'hidden' },\n { [sizeName]: 'unset', [overflowName]: 'unset' },\n ],\n duration,\n easing,\n delay,\n fill: 'both',\n };\n};\n\ninterface SizeExitAtomParams extends SizeEnterAtomParams {\n delay?: number;\n}\n\nexport const sizeExitAtom = ({\n orientation,\n duration,\n easing,\n element,\n delay = 0,\n fromSize = '0',\n}: SizeExitAtomParams): AtomMotion => {\n const { sizeName, overflowName, toSize } = sizeValuesForOrientation(orientation, element);\n\n return {\n keyframes: [\n { [sizeName]: toSize, [overflowName]: 'hidden' },\n { [sizeName]: fromSize, [overflowName]: 'hidden' },\n ],\n duration,\n easing,\n delay,\n fill: 'both',\n };\n};\n\n// ----- WHITESPACE -----\n\n// Whitespace animation includes padding and margin.\nconst whitespaceValuesForOrientation = (orientation: CollapseOrientation) => {\n // horizontal whitespace collapse\n if (orientation === 'horizontal') {\n return {\n paddingStart: 'paddingInlineStart',\n paddingEnd: 'paddingInlineEnd',\n marginStart: 'marginInlineStart',\n marginEnd: 'marginInlineEnd',\n };\n }\n // vertical whitespace collapse\n return {\n paddingStart: 'paddingBlockStart',\n paddingEnd: 'paddingBlockEnd',\n marginStart: 'marginBlockStart',\n marginEnd: 'marginBlockEnd',\n };\n};\n\ninterface WhitespaceAtomParams {\n direction: PresenceDirection;\n orientation: CollapseOrientation;\n duration: number;\n easing: string;\n delay?: number;\n}\n\n/**\n * A collapse animates an element's height to zero,\n but the zero height does not eliminate padding or margin in the box model.\n So here we generate keyframes to animate those whitespace properties to zero.\n */\nexport const whitespaceAtom = ({\n direction,\n orientation,\n duration,\n easing,\n delay = 0,\n}: WhitespaceAtomParams): AtomMotion => {\n const { paddingStart, paddingEnd, marginStart, marginEnd } = whitespaceValuesForOrientation(orientation);\n // The keyframe with zero whitespace is at the start for enter and at the end for exit.\n const offset = direction === 'enter' ? 0 : 1;\n const keyframes = [{ [paddingStart]: '0', [paddingEnd]: '0', [marginStart]: '0', [marginEnd]: '0', offset }];\n\n return {\n keyframes,\n duration,\n easing,\n delay,\n fill: 'both',\n };\n};\n"],"names":["sizeEnterAtom","sizeExitAtom","whitespaceAtom","sizeValuesForOrientation","orientation","element","sizeName","overflowName","measuredSize","scrollWidth","scrollHeight","toSize","duration","easing","fromSize","delay","keyframes","offset","fill","whitespaceValuesForOrientation","paddingStart","paddingEnd","marginStart","marginEnd","direction"],"mappings":";;;;;;;;;;;IAsBaA,aAAa;eAAbA;;IA2BAC,YAAY;eAAZA;;IAyDAC,cAAc;eAAdA;;;AAvGb,mBAAmB;AAEnB,MAAMC,2BAA2B,CAACC,aAAkCC;IAClE,MAAMC,WAAWF,gBAAgB,eAAe,aAAa;IAC7D,MAAMG,eAAeH,gBAAgB,eAAe,cAAc;IAClE,MAAMI,eAAeJ,gBAAgB,eAAeC,QAAQI,WAAW,GAAGJ,QAAQK,YAAY;IAC9F,MAAMC,SAAS,GAAGH,aAAa,EAAE,CAAC;IAClC,OAAO;QAAEF;QAAUC;QAAcI;IAAO;AAC1C;AAWO,MAAMX,gBAAgB,CAAC,EAC5BI,WAAW,EACXQ,QAAQ,EACRC,MAAM,EACNR,OAAO,EACPS,WAAW,GAAG,EACdC,QAAQ,CAAC,EACW;IACpB,MAAM,EAAET,QAAQ,EAAEC,YAAY,EAAEI,MAAM,EAAE,GAAGR,yBAAyBC,aAAaC;IAEjF,OAAO;QACLW,WAAW;YACT;gBAAE,CAACV,SAAS,EAAEQ;gBAAU,CAACP,aAAa,EAAE;YAAS;YACjD;gBAAE,CAACD,SAAS,EAAEK;gBAAQM,QAAQ;gBAAQ,CAACV,aAAa,EAAE;YAAS;YAC/D;gBAAE,CAACD,SAAS,EAAE;gBAAS,CAACC,aAAa,EAAE;YAAQ;SAChD;QACDK;QACAC;QACAE;QACAG,MAAM;IACR;AACF;AAMO,MAAMjB,eAAe,CAAC,EAC3BG,WAAW,EACXQ,QAAQ,EACRC,MAAM,EACNR,OAAO,EACPU,QAAQ,CAAC,EACTD,WAAW,GAAG,EACK;IACnB,MAAM,EAAER,QAAQ,EAAEC,YAAY,EAAEI,MAAM,EAAE,GAAGR,yBAAyBC,aAAaC;IAEjF,OAAO;QACLW,WAAW;YACT;gBAAE,CAACV,SAAS,EAAEK;gBAAQ,CAACJ,aAAa,EAAE;Y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