@fluentui/react-motion-components-preview 0.12.0 → 0.14.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +20 -2
  2. package/dist/index.d.ts +230 -0
  3. package/lib/choreography/Stagger/Stagger.js +189 -0
  4. package/lib/choreography/Stagger/Stagger.js.map +1 -0
  5. package/lib/choreography/Stagger/index.js +1 -0
  6. package/lib/choreography/Stagger/index.js.map +1 -0
  7. package/lib/choreography/Stagger/stagger-types.js +1 -0
  8. package/lib/choreography/Stagger/stagger-types.js.map +1 -0
  9. package/lib/choreography/Stagger/useStaggerItemsVisibility.js +176 -0
  10. package/lib/choreography/Stagger/useStaggerItemsVisibility.js.map +1 -0
  11. package/lib/choreography/Stagger/utils/constants.js +5 -0
  12. package/lib/choreography/Stagger/utils/constants.js.map +1 -0
  13. package/lib/choreography/Stagger/utils/getStaggerChildMapping.js +29 -0
  14. package/lib/choreography/Stagger/utils/getStaggerChildMapping.js.map +1 -0
  15. package/lib/choreography/Stagger/utils/index.js +4 -0
  16. package/lib/choreography/Stagger/utils/index.js.map +1 -0
  17. package/lib/choreography/Stagger/utils/motionComponentDetection.js +83 -0
  18. package/lib/choreography/Stagger/utils/motionComponentDetection.js.map +1 -0
  19. package/lib/choreography/Stagger/utils/stagger-calculations.js +71 -0
  20. package/lib/choreography/Stagger/utils/stagger-calculations.js.map +1 -0
  21. package/lib/index.js +7 -0
  22. package/lib/index.js.map +1 -1
  23. package/lib-commonjs/choreography/Stagger/Stagger.js +137 -0
  24. package/lib-commonjs/choreography/Stagger/Stagger.js.map +1 -0
  25. package/lib-commonjs/choreography/Stagger/index.js +11 -0
  26. package/lib-commonjs/choreography/Stagger/index.js.map +1 -0
  27. package/lib-commonjs/choreography/Stagger/stagger-types.js +6 -0
  28. package/lib-commonjs/choreography/Stagger/stagger-types.js.map +1 -0
  29. package/lib-commonjs/choreography/Stagger/useStaggerItemsVisibility.js +161 -0
  30. package/lib-commonjs/choreography/Stagger/useStaggerItemsVisibility.js.map +1 -0
  31. package/lib-commonjs/choreography/Stagger/utils/constants.js +23 -0
  32. package/lib-commonjs/choreography/Stagger/utils/constants.js.map +1 -0
  33. package/lib-commonjs/choreography/Stagger/utils/getStaggerChildMapping.js +27 -0
  34. package/lib-commonjs/choreography/Stagger/utils/getStaggerChildMapping.js.map +1 -0
  35. package/lib-commonjs/choreography/Stagger/utils/index.js +37 -0
  36. package/lib-commonjs/choreography/Stagger/utils/index.js.map +1 -0
  37. package/lib-commonjs/choreography/Stagger/utils/motionComponentDetection.js +48 -0
  38. package/lib-commonjs/choreography/Stagger/utils/motionComponentDetection.js.map +1 -0
  39. package/lib-commonjs/choreography/Stagger/utils/stagger-calculations.js +76 -0
  40. package/lib-commonjs/choreography/Stagger/utils/stagger-calculations.js.map +1 -0
  41. package/lib-commonjs/index.js +25 -0
  42. package/lib-commonjs/index.js.map +1 -1
  43. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -1,12 +1,30 @@
1
1
  # Change Log - @fluentui/react-motion-components-preview
2
2
 
3
- This log was last generated on Fri, 31 Oct 2025 16:17:37 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 06 Nov 2025 17:23:24 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [0.14.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion-components-preview_v0.14.0)
8
+
9
+ Thu, 06 Nov 2025 17:23:24 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-motion-components-preview_v0.13.0..@fluentui/react-motion-components-preview_v0.14.0)
11
+
12
+ ### Minor changes
13
+
14
+ - feat(motion): Add Stagger choreography component ([PR #34705](https://github.com/microsoft/fluentui/pull/34705) by robertpenner@microsoft.com)
15
+
16
+ ## [0.13.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion-components-preview_v0.13.0)
17
+
18
+ Thu, 06 Nov 2025 15:01:23 GMT
19
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-motion-components-preview_v0.12.0..@fluentui/react-motion-components-preview_v0.13.0)
20
+
21
+ ### Minor changes
22
+
23
+ - feat(motion): export standard motion atoms ([PR #35421](https://github.com/microsoft/fluentui/pull/35421) by robertpenner@microsoft.com)
24
+
7
25
  ## [0.12.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion-components-preview_v0.12.0)
8
26
 
9
- Fri, 31 Oct 2025 16:17:37 GMT
27
+ Fri, 31 Oct 2025 16:22:05 GMT
10
28
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-motion-components-preview_v0.11.0..@fluentui/react-motion-components-preview_v0.12.0)
11
29
 
12
30
  ### Minor changes
package/dist/index.d.ts CHANGED
@@ -1,4 +1,8 @@
1
+ import { AtomMotion } from '@fluentui/react-motion';
1
2
  import { PresenceComponent } from '@fluentui/react-motion';
3
+ import { PresenceComponentProps } from '@fluentui/react-motion';
4
+ import type { PresenceDirection } from '@fluentui/react-motion';
5
+ import * as React_2 from 'react';
2
6
 
3
7
  /**
4
8
  * Common opacity animation parameter for motion components.
@@ -10,6 +14,22 @@ declare type AnimateOpacity = {
10
14
 
11
15
  declare type Axis3D = 'x' | 'y' | 'z';
12
16
 
17
+ declare type Axis3D_2 = NonNullable<RotateParams['axis']>;
18
+
19
+ /**
20
+ * Common parameters shared by all atom functions.
21
+ */
22
+ declare type BaseAtomParams = {
23
+ /** The functional direction of the motion: 'enter' or 'exit'. */
24
+ direction: PresenceDirection;
25
+ /** The duration of the motion in milliseconds. */
26
+ duration: number;
27
+ /** The easing curve for the motion. */
28
+ easing?: EffectTiming['easing'];
29
+ /** Time (ms) to delay the animation. */
30
+ delay?: EffectTiming['delay'];
31
+ };
32
+
13
33
  /**
14
34
  * Base presence parameters combining duration, easing, and delay for motion components.
15
35
  */
@@ -18,6 +38,23 @@ declare type BasePresenceParams = PresenceDuration & PresenceEasing & PresenceDe
18
38
  /** A React component that applies blur in/out transitions to its children. */
19
39
  export declare const Blur: PresenceComponent<BlurParams>;
20
40
 
41
+ /**
42
+ * Generates a motion atom object for a blur-in or blur-out.
43
+ * @param direction - The functional direction of the motion: 'enter' or 'exit'.
44
+ * @param duration - The duration of the motion in milliseconds.
45
+ * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.
46
+ * @param fromRadius - The blur radius value with units (e.g., '20px', '1rem'). Defaults to '10px'.
47
+ * @param toRadius - The ending blur radius value with units (e.g., '0px', '5px'). Defaults to '0px'.
48
+ * @param delay - Time (ms) to delay the animation. Defaults to 0.
49
+ * @returns A motion atom object with filter blur keyframes and the supplied duration and easing.
50
+ */
51
+ export declare const blurAtom: ({ direction, duration, easing, delay, fromRadius, toRadius, }: BlurAtomParams) => AtomMotion;
52
+
53
+ declare interface BlurAtomParams extends BaseAtomParams {
54
+ fromRadius?: string;
55
+ toRadius?: string;
56
+ }
57
+
21
58
  export declare type BlurParams = BasePresenceParams & AnimateOpacity & {
22
59
  /** The blur radius with units to animate from. Defaults to '10px'. */
23
60
  fromRadius?: string;
@@ -71,6 +108,27 @@ export declare const CollapseSnappy: PresenceComponent<CollapseParams>;
71
108
  /** A React component that applies fade in/out transitions to its children. */
72
109
  export declare const Fade: PresenceComponent<FadeParams>;
73
110
 
111
+ /**
112
+ * Generates a motion atom object for a fade-in or fade-out.
113
+ * @param direction - The functional direction of the motion: 'enter' or 'exit'.
114
+ * @param duration - The duration of the motion in milliseconds.
115
+ * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.
116
+ * @param delay - The delay before the motion starts. Defaults to 0.
117
+ * @param fromOpacity - The starting opacity value. Defaults to 0.
118
+ * @param toOpacity - The ending opacity value. Defaults to 1.
119
+ * @returns A motion atom object with opacity keyframes and the supplied duration and easing.
120
+ */
121
+ export declare const fadeAtom: ({ direction, duration, easing, delay, fromOpacity, toOpacity, }: FadeAtomParams) => AtomMotion;
122
+
123
+ declare interface FadeAtomParams extends BaseAtomParams {
124
+ /** Defines how values are applied before and after execution. Defaults to 'both'. */
125
+ fill?: FillMode;
126
+ /** The starting opacity value. Defaults to 0. */
127
+ fromOpacity?: number;
128
+ /** The ending opacity value. Defaults to 1. */
129
+ toOpacity?: number;
130
+ }
131
+
74
132
  export declare type FadeParams = BasePresenceParams & {
75
133
  /** The starting opacity value. Defaults to 0. */
76
134
  fromOpacity?: number;
@@ -114,6 +172,25 @@ declare type PresenceEasing = {
114
172
 
115
173
  export declare const Rotate: PresenceComponent<RotateParams>;
116
174
 
175
+ /**
176
+ * Generates a motion atom object for a rotation around a single axis.
177
+ * @param direction - The functional direction of the motion: 'enter' or 'exit'.
178
+ * @param duration - The duration of the motion in milliseconds.
179
+ * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.
180
+ * @param axis - The axis of rotation: 'x', 'y', or 'z'. Defaults to 'y'.
181
+ * @param fromAngle - The starting rotation angle in degrees. Defaults to -90.
182
+ * @param toAngle - The ending rotation angle in degrees. Defaults to 0.
183
+ * @param delay - Time (ms) to delay the animation. Defaults to 0.
184
+ * @returns A motion atom object with rotate keyframes and the supplied duration and easing.
185
+ */
186
+ export declare const rotateAtom: ({ direction, duration, easing, delay, axis, fromAngle, toAngle, }: RotateAtomParams) => AtomMotion;
187
+
188
+ declare interface RotateAtomParams extends BaseAtomParams {
189
+ axis?: Axis3D_2;
190
+ fromAngle?: number;
191
+ toAngle?: number;
192
+ }
193
+
117
194
  export declare type RotateParams = BasePresenceParams & AnimateOpacity & {
118
195
  /**
119
196
  * The axis of rotation: 'x', 'y', or 'z'.
@@ -135,6 +212,23 @@ export declare type RotateParams = BasePresenceParams & AnimateOpacity & {
135
212
  /** A React component that applies scale in/out transitions to its children. */
136
213
  export declare const Scale: PresenceComponent<ScaleParams>;
137
214
 
215
+ /**
216
+ * Generates a motion atom object for a scale in or scale out.
217
+ * @param direction - The functional direction of the motion: 'enter' or 'exit'.
218
+ * @param duration - The duration of the motion in milliseconds.
219
+ * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.
220
+ * @param fromScale - The starting scale value. Defaults to 0.9.
221
+ * @param toScale - The ending scale value. Defaults to 1.
222
+ * @param delay - Time (ms) to delay the animation. Defaults to 0.
223
+ * @returns A motion atom object with scale keyframes and the supplied duration and easing.
224
+ */
225
+ export declare const scaleAtom: ({ direction, duration, easing, delay, fromScale, toScale, }: ScaleAtomParams) => AtomMotion;
226
+
227
+ declare interface ScaleAtomParams extends BaseAtomParams {
228
+ fromScale?: number;
229
+ toScale?: number;
230
+ }
231
+
138
232
  export declare type ScaleParams = BasePresenceParams & AnimateOpacity & {
139
233
  /** The scale value to animate from. Defaults to `0.9`. */
140
234
  fromScale?: number;
@@ -149,6 +243,27 @@ export declare const ScaleSnappy: PresenceComponent<ScaleParams>;
149
243
  /** A React component that applies slide in/out transitions to its children. */
150
244
  export declare const Slide: PresenceComponent<SlideParams>;
151
245
 
246
+ /**
247
+ * Generates a motion atom object for a slide-in or slide-out.
248
+ * @param direction - The functional direction of the motion: 'enter' or 'exit'.
249
+ * @param duration - The duration of the motion in milliseconds.
250
+ * @param easing - The easing curve for the motion. Defaults to `motionTokens.curveLinear`.
251
+ * @param fromX - The starting X translate value with units (e.g., '50px', '100%'). Defaults to '0px'.
252
+ * @param fromY - The starting Y translate value with units (e.g., '50px', '100%'). Defaults to '0px'.
253
+ * @param toX - The ending X translate value with units (e.g.'5px', '10%'). Defaults to '0px'.
254
+ * @param toY - The ending Y translate value with units (e.g., '5px', '10%'). Defaults to '0px'.
255
+ * @param delay - Time (ms) to delay the animation. Defaults to 0.
256
+ * @returns A motion atom object with translate keyframes and the supplied duration and easing.
257
+ */
258
+ export declare const slideAtom: ({ direction, duration, easing, delay, fromX, fromY, toX, toY, }: SlideAtomParams) => AtomMotion;
259
+
260
+ declare interface SlideAtomParams extends BaseAtomParams {
261
+ fromX?: string;
262
+ fromY?: string;
263
+ toX?: string;
264
+ toY?: string;
265
+ }
266
+
152
267
  export declare type SlideParams = BasePresenceParams & AnimateOpacity & {
153
268
  /** The X translate value with units to animate from. Defaults to `'0px'`. */
154
269
  fromX?: string;
@@ -164,4 +279,119 @@ export declare const SlideRelaxed: PresenceComponent<SlideParams>;
164
279
 
165
280
  export declare const SlideSnappy: PresenceComponent<SlideParams>;
166
281
 
282
+ /**
283
+ * Stagger is a component that manages the staggered entrance and exit of its children.
284
+ * Children are animated in sequence with configurable timing between each item.
285
+ * Stagger can be interactively toggled between entrance and exit animations using the `visible` prop.
286
+ *
287
+ * @param children - React elements to animate. Elements are cloned with animation props.
288
+ * @param visible - Controls animation direction. When `true`, the group is animating "enter" (items shown);
289
+ * when `false`, the group is animating "exit" (items hidden). Defaults to `false`.
290
+ * @param itemDelay - Milliseconds between each item's animation start.
291
+ * Defaults to the package's default delay (see `DEFAULT_ITEM_DELAY`).
292
+ * @param itemDuration - Milliseconds each item's animation lasts. Only used with `delayMode="timing"`.
293
+ * Defaults to the package's default item duration (see `DEFAULT_ITEM_DURATION`).
294
+ * @param reversed - Whether to reverse the stagger sequence (last item animates first). Defaults to `false`.
295
+ * @param hideMode - How children's visibility/mounting is managed. Auto-detects if not specified.
296
+ * @param delayMode - How staggering timing is implemented. Auto-detects if not specified.
297
+ * @param onMotionFinish - Callback invoked when the staggered animation sequence completes.
298
+ *
299
+ * **Auto-detection behavior:**
300
+ * - **hideMode**: Presence components use `'visibleProp'`, DOM elements use `'visibilityStyle'`
301
+ * - **delayMode**: Components with delay support use `'delayProp'` (most performant), others use `'timing'`
302
+ *
303
+ * **hideMode options:**
304
+ * - `'visibleProp'`: Children are presence components with `visible` prop (always rendered, visibility controlled via prop)
305
+ * - `'visibilityStyle'`: Children remain in DOM with inline style visibility: hidden/visible (preserves layout space)
306
+ * - `'unmount'`: Children are mounted/unmounted from DOM based on visibility
307
+ *
308
+ * **delayMode options:**
309
+ * - `'timing'`: Manages visibility over time using JavaScript timing
310
+ * - `'delayProp'`: Passes delay props to motion components to use native Web Animations API delays (most performant)
311
+ *
312
+ * **Static variants:**
313
+ * - `<Stagger.In>` - One-way stagger for entrance animations only (auto-detects optimal modes)
314
+ * - `<Stagger.Out>` - One-way stagger for exit animations only (auto-detects optimal modes)
315
+ *
316
+ * @example
317
+ * ```tsx
318
+ * import { Stagger, Fade, Scale, Rotate } from '@fluentui/react-motion-components-preview';
319
+ *
320
+ * // Auto-detects optimal modes for presence components (delayProp + visibleProp)
321
+ * <Stagger visible={isVisible} itemDelay={150}>
322
+ * <Fade><div>Item 2</div></Fade>
323
+ * <Scale><div>Item 1</div></Scale>
324
+ * <Rotate><div>Item 3</div></Rotate>
325
+ * </Stagger>
326
+ *
327
+ * // Auto-detects optimal modes for motion components (delayProp + unmount)
328
+ * <Stagger.In itemDelay={100}>
329
+ * <Scale.In><div>Item 1</div></Scale.In>
330
+ * <Fade.In><div>Item 2</div></Fade.In>
331
+ * </Stagger.In>
332
+ *
333
+ * // Auto-detects timing mode for DOM elements (timing + visibilityStyle)
334
+ * <Stagger visible={isVisible} itemDelay={150} onMotionFinish={handleComplete}>
335
+ * <div>Item 1</div>
336
+ * <div>Item 2</div>
337
+ * <div>Item 3</div>
338
+ * </Stagger>
339
+ *
340
+ * // Override auto-detection when needed
341
+ * <Stagger visible={isVisible} delayMode="timing" hideMode="unmount">
342
+ * <CustomComponent>Item 1</CustomComponent>
343
+ * </Stagger>
344
+ * ```
345
+ */
346
+ export declare const Stagger: React_2.FC<StaggerProps> & {
347
+ In: React_2.FC<Omit<StaggerProps, "visible">>;
348
+ Out: React_2.FC<Omit<StaggerProps, "visible">>;
349
+ };
350
+
351
+ /**
352
+ * Defines how Stagger implements the timing of staggered animations.
353
+ * - 'timing': Manages visibility over time using JavaScript timing (current behavior)
354
+ * - 'delayProp': Passes delay props to motion components to use native Web Animations API delays
355
+ */
356
+ declare type StaggerDelayMode = 'timing' | 'delayProp';
357
+
358
+ /**
359
+ * Defines how Stagger manages its children's visibility/mounting.
360
+ * - 'visibleProp': Children are components with a `visible` prop (e.g. motion components)
361
+ * - 'visibilityStyle': Children remain in DOM with inline style `visibility: hidden | visible`
362
+ * - 'unmount': Children are mounted/unmounted from DOM based on visibility
363
+ */
364
+ declare type StaggerHideMode = 'visibleProp' | 'visibilityStyle' | 'unmount';
365
+
366
+ /**
367
+ * Props for the Stagger component that manages staggered entrance and exit animations.
368
+ */
369
+ export declare interface StaggerProps {
370
+ /** React elements to animate. Elements are cloned with animation props. */
371
+ children: React_2.ReactNode;
372
+ /**
373
+ * Controls children animation direction. When `true`, the group is animating "enter" (items shown).
374
+ * When `false`, the group is animating "exit" (items hidden).
375
+ */
376
+ visible?: PresenceComponentProps['visible'];
377
+ /** Whether to reverse the stagger sequence (last item animates first). Defaults to `false`. */
378
+ reversed?: boolean;
379
+ /**
380
+ * Milliseconds between each child's animation start.
381
+ * Defaults to the package's default delay (see `DEFAULT_ITEM_DELAY`).
382
+ */
383
+ itemDelay?: number;
384
+ /**
385
+ * Milliseconds each child's animation lasts. Only used with `delayMode="timing"`.
386
+ * Defaults to the package's default duration (see `DEFAULT_ITEM_DURATION`).
387
+ */
388
+ itemDuration?: number;
389
+ /** How children's visibility/mounting is managed. Auto-detects if not specified. */
390
+ hideMode?: StaggerHideMode;
391
+ /** How staggering timing is implemented. Defaults to 'timing'. */
392
+ delayMode?: StaggerDelayMode;
393
+ /** Callback invoked when the staggered animation sequence completes. */
394
+ onMotionFinish?: () => void;
395
+ }
396
+
167
397
  export { }
@@ -0,0 +1,189 @@
1
+ 'use client';
2
+ import * as React from 'react';
3
+ import { useStaggerItemsVisibility } from './useStaggerItemsVisibility';
4
+ import { DEFAULT_ITEM_DURATION, DEFAULT_ITEM_DELAY, acceptsVisibleProp, acceptsDelayProps, getStaggerChildMapping } from './utils';
5
+ /**
6
+ * Shared utility to detect optimal stagger modes based on children components.
7
+ * Consolidates the auto-detection logic used by both StaggerMain and createStaggerDirection.
8
+ */ const detectStaggerModes = (children, options)=>{
9
+ const { hideMode, delayMode, fallbackHideMode = 'visibilityStyle' } = options;
10
+ const childMapping = getStaggerChildMapping(children);
11
+ const elements = Object.values(childMapping).map((item)=>item.element);
12
+ const hasVisiblePropSupport = elements.every((child)=>acceptsVisibleProp(child));
13
+ const hasDelayPropSupport = elements.every((child)=>acceptsDelayProps(child));
14
+ return {
15
+ hideMode: hideMode !== null && hideMode !== void 0 ? hideMode : hasVisiblePropSupport ? 'visibleProp' : fallbackHideMode,
16
+ delayMode: delayMode !== null && delayMode !== void 0 ? delayMode : hasDelayPropSupport ? 'delayProp' : 'timing'
17
+ };
18
+ };
19
+ const StaggerOneWay = ({ children, direction, itemDelay = DEFAULT_ITEM_DELAY, itemDuration = DEFAULT_ITEM_DURATION, reversed = false, hideMode, delayMode = 'timing', onMotionFinish })=>{
20
+ const childMapping = React.useMemo(()=>getStaggerChildMapping(children), [
21
+ children
22
+ ]);
23
+ // Always call hooks at the top level, regardless of delayMode
24
+ const { itemsVisibility } = useStaggerItemsVisibility({
25
+ childMapping,
26
+ itemDelay,
27
+ itemDuration,
28
+ direction,
29
+ reversed,
30
+ onMotionFinish,
31
+ hideMode
32
+ });
33
+ // For delayProp mode, pass delay props directly to motion components
34
+ if (delayMode === 'delayProp') {
35
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, Object.entries(childMapping).map(([key, { element, index }])=>{
36
+ const staggerIndex = reversed ? Object.keys(childMapping).length - 1 - index : index;
37
+ const delay = staggerIndex * itemDelay;
38
+ // Clone element with delay prop (for enter direction) or exitDelay prop (for exit direction)
39
+ const delayProp = direction === 'enter' ? {
40
+ delay
41
+ } : {
42
+ exitDelay: delay
43
+ };
44
+ // Only set visible prop if the component supports it
45
+ // Set visible based on direction: true for enter, false for exit
46
+ const visibleProp = acceptsVisibleProp(element) ? {
47
+ visible: direction === 'enter'
48
+ } : {};
49
+ return /*#__PURE__*/ React.cloneElement(element, {
50
+ key,
51
+ ...visibleProp,
52
+ ...delayProp
53
+ });
54
+ }));
55
+ }
56
+ // For timing mode, use the existing timing-based implementation
57
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, Object.entries(childMapping).map(([key, { element }])=>{
58
+ if (hideMode === 'visibleProp') {
59
+ // Use a generic record type for props to avoid `any` while still allowing unknown prop shapes.
60
+ return /*#__PURE__*/ React.cloneElement(element, {
61
+ key,
62
+ visible: itemsVisibility[key]
63
+ });
64
+ } else if (hideMode === 'visibilityStyle') {
65
+ const childProps = element.props;
66
+ const style = {
67
+ ...childProps === null || childProps === void 0 ? void 0 : childProps.style,
68
+ visibility: itemsVisibility[key] ? 'visible' : 'hidden'
69
+ };
70
+ return /*#__PURE__*/ React.cloneElement(element, {
71
+ key,
72
+ style
73
+ });
74
+ } else {
75
+ // unmount mode
76
+ return itemsVisibility[key] ? /*#__PURE__*/ React.cloneElement(element, {
77
+ key
78
+ }) : null;
79
+ }
80
+ }));
81
+ };
82
+ // Shared helper for StaggerIn and StaggerOut
83
+ const createStaggerDirection = (direction)=>{
84
+ const StaggerDirection = ({ hideMode, delayMode, children, ...props })=>{
85
+ // Auto-detect modes for better performance with motion components
86
+ const { hideMode: resolvedHideMode, delayMode: resolvedDelayMode } = detectStaggerModes(children, {
87
+ hideMode,
88
+ delayMode,
89
+ // One-way stagger falls back to visibilityStyle if it doesn't detect visibleProp support
90
+ fallbackHideMode: 'visibilityStyle'
91
+ });
92
+ return /*#__PURE__*/ React.createElement(StaggerOneWay, {
93
+ ...props,
94
+ children: children,
95
+ direction: direction,
96
+ hideMode: resolvedHideMode,
97
+ delayMode: resolvedDelayMode
98
+ });
99
+ };
100
+ return StaggerDirection;
101
+ };
102
+ const StaggerIn = createStaggerDirection('enter');
103
+ const StaggerOut = createStaggerDirection('exit');
104
+ // Main Stagger component with auto-detection or explicit modes
105
+ const StaggerMain = (props)=>{
106
+ const { children, visible = false, hideMode, delayMode, ...rest } = props;
107
+ // Auto-detect modes for bidirectional stagger
108
+ const { hideMode: resolvedHideMode, delayMode: resolvedDelayMode } = detectStaggerModes(children, {
109
+ hideMode,
110
+ delayMode,
111
+ // Bidirectional stagger falls back to visibilityStyle if it doesn't detect visibleProp support
112
+ fallbackHideMode: 'visibilityStyle'
113
+ });
114
+ const direction = visible ? 'enter' : 'exit';
115
+ return /*#__PURE__*/ React.createElement(StaggerOneWay, {
116
+ ...rest,
117
+ children: children,
118
+ hideMode: resolvedHideMode,
119
+ delayMode: resolvedDelayMode,
120
+ direction: direction
121
+ });
122
+ };
123
+ /**
124
+ * Stagger is a component that manages the staggered entrance and exit of its children.
125
+ * Children are animated in sequence with configurable timing between each item.
126
+ * Stagger can be interactively toggled between entrance and exit animations using the `visible` prop.
127
+ *
128
+ * @param children - React elements to animate. Elements are cloned with animation props.
129
+ * @param visible - Controls animation direction. When `true`, the group is animating "enter" (items shown);
130
+ * when `false`, the group is animating "exit" (items hidden). Defaults to `false`.
131
+ * @param itemDelay - Milliseconds between each item's animation start.
132
+ * Defaults to the package's default delay (see `DEFAULT_ITEM_DELAY`).
133
+ * @param itemDuration - Milliseconds each item's animation lasts. Only used with `delayMode="timing"`.
134
+ * Defaults to the package's default item duration (see `DEFAULT_ITEM_DURATION`).
135
+ * @param reversed - Whether to reverse the stagger sequence (last item animates first). Defaults to `false`.
136
+ * @param hideMode - How children's visibility/mounting is managed. Auto-detects if not specified.
137
+ * @param delayMode - How staggering timing is implemented. Auto-detects if not specified.
138
+ * @param onMotionFinish - Callback invoked when the staggered animation sequence completes.
139
+ *
140
+ * **Auto-detection behavior:**
141
+ * - **hideMode**: Presence components use `'visibleProp'`, DOM elements use `'visibilityStyle'`
142
+ * - **delayMode**: Components with delay support use `'delayProp'` (most performant), others use `'timing'`
143
+ *
144
+ * **hideMode options:**
145
+ * - `'visibleProp'`: Children are presence components with `visible` prop (always rendered, visibility controlled via prop)
146
+ * - `'visibilityStyle'`: Children remain in DOM with inline style visibility: hidden/visible (preserves layout space)
147
+ * - `'unmount'`: Children are mounted/unmounted from DOM based on visibility
148
+ *
149
+ * **delayMode options:**
150
+ * - `'timing'`: Manages visibility over time using JavaScript timing
151
+ * - `'delayProp'`: Passes delay props to motion components to use native Web Animations API delays (most performant)
152
+ *
153
+ * **Static variants:**
154
+ * - `<Stagger.In>` - One-way stagger for entrance animations only (auto-detects optimal modes)
155
+ * - `<Stagger.Out>` - One-way stagger for exit animations only (auto-detects optimal modes)
156
+ *
157
+ * @example
158
+ * ```tsx
159
+ * import { Stagger, Fade, Scale, Rotate } from '@fluentui/react-motion-components-preview';
160
+ *
161
+ * // Auto-detects optimal modes for presence components (delayProp + visibleProp)
162
+ * <Stagger visible={isVisible} itemDelay={150}>
163
+ * <Fade><div>Item 2</div></Fade>
164
+ * <Scale><div>Item 1</div></Scale>
165
+ * <Rotate><div>Item 3</div></Rotate>
166
+ * </Stagger>
167
+ *
168
+ * // Auto-detects optimal modes for motion components (delayProp + unmount)
169
+ * <Stagger.In itemDelay={100}>
170
+ * <Scale.In><div>Item 1</div></Scale.In>
171
+ * <Fade.In><div>Item 2</div></Fade.In>
172
+ * </Stagger.In>
173
+ *
174
+ * // Auto-detects timing mode for DOM elements (timing + visibilityStyle)
175
+ * <Stagger visible={isVisible} itemDelay={150} onMotionFinish={handleComplete}>
176
+ * <div>Item 1</div>
177
+ * <div>Item 2</div>
178
+ * <div>Item 3</div>
179
+ * </Stagger>
180
+ *
181
+ * // Override auto-detection when needed
182
+ * <Stagger visible={isVisible} delayMode="timing" hideMode="unmount">
183
+ * <CustomComponent>Item 1</CustomComponent>
184
+ * </Stagger>
185
+ * ```
186
+ */ export const Stagger = Object.assign(StaggerMain, {
187
+ In: StaggerIn,
188
+ Out: StaggerOut
189
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/choreography/Stagger/Stagger.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useStaggerItemsVisibility } from './useStaggerItemsVisibility';\nimport {\n DEFAULT_ITEM_DURATION,\n DEFAULT_ITEM_DELAY,\n acceptsVisibleProp,\n acceptsDelayProps,\n getStaggerChildMapping,\n} from './utils';\nimport { StaggerOneWayProps, StaggerProps, type StaggerHideMode, type StaggerDelayMode } from './stagger-types';\n\n/**\n * Shared utility to detect optimal stagger modes based on children components.\n * Consolidates the auto-detection logic used by both StaggerMain and createStaggerDirection.\n */\nconst detectStaggerModes = (\n children: React.ReactNode,\n options: {\n hideMode?: StaggerHideMode;\n delayMode?: StaggerDelayMode;\n fallbackHideMode?: StaggerHideMode;\n },\n): { hideMode: StaggerHideMode; delayMode: StaggerDelayMode } => {\n const { hideMode, delayMode, fallbackHideMode = 'visibilityStyle' } = options;\n\n const childMapping = getStaggerChildMapping(children);\n const elements = Object.values(childMapping).map(item => item.element);\n const hasVisiblePropSupport = elements.every(child => acceptsVisibleProp(child));\n const hasDelayPropSupport = elements.every(child => acceptsDelayProps(child));\n\n return {\n hideMode: hideMode ?? (hasVisiblePropSupport ? 'visibleProp' : fallbackHideMode),\n delayMode: delayMode ?? (hasDelayPropSupport ? 'delayProp' : 'timing'),\n };\n};\n\nconst StaggerOneWay: React.FC<StaggerOneWayProps> = ({\n children,\n direction,\n itemDelay = DEFAULT_ITEM_DELAY,\n itemDuration = DEFAULT_ITEM_DURATION,\n reversed = false,\n hideMode,\n delayMode = 'timing',\n onMotionFinish,\n}) => {\n const childMapping = React.useMemo(() => getStaggerChildMapping(children), [children]);\n\n // Always call hooks at the top level, regardless of delayMode\n const { itemsVisibility } = useStaggerItemsVisibility({\n childMapping,\n itemDelay,\n itemDuration,\n direction,\n reversed,\n onMotionFinish,\n hideMode,\n });\n\n // For delayProp mode, pass delay props directly to motion components\n if (delayMode === 'delayProp') {\n return (\n <>\n {Object.entries(childMapping).map(([key, { element, index }]) => {\n const staggerIndex = reversed ? Object.keys(childMapping).length - 1 - index : index;\n const delay = staggerIndex * itemDelay;\n\n // Clone element with delay prop (for enter direction) or exitDelay prop (for exit direction)\n const delayProp = direction === 'enter' ? { delay } : { exitDelay: delay };\n\n // Only set visible prop if the component supports it\n // Set visible based on direction: true for enter, false for exit\n const visibleProp = acceptsVisibleProp(element) ? { visible: direction === 'enter' } : {};\n\n return React.cloneElement(element, {\n key,\n ...visibleProp,\n ...delayProp,\n });\n })}\n </>\n );\n }\n\n // For timing mode, use the existing timing-based implementation\n\n return (\n <>\n {Object.entries(childMapping).map(([key, { element }]) => {\n if (hideMode === 'visibleProp') {\n // Use a generic record type for props to avoid `any` while still allowing unknown prop shapes.\n return React.cloneElement(element, {\n key,\n visible: itemsVisibility[key],\n } as Partial<Record<string, unknown>>);\n } else if (hideMode === 'visibilityStyle') {\n const childProps = element.props as Record<string, unknown> | undefined;\n const style = {\n ...(childProps?.style as Record<string, unknown> | undefined),\n visibility: itemsVisibility[key] ? 'visible' : 'hidden',\n };\n return React.cloneElement(element, { key, style } as Partial<Record<string, unknown>>);\n } else {\n // unmount mode\n return itemsVisibility[key] ? React.cloneElement(element, { key }) : null;\n }\n })}\n </>\n );\n};\n\n// Shared helper for StaggerIn and StaggerOut\nconst createStaggerDirection = (direction: 'enter' | 'exit') => {\n const StaggerDirection: React.FC<Omit<StaggerProps, 'visible'>> = ({ hideMode, delayMode, children, ...props }) => {\n // Auto-detect modes for better performance with motion components\n const { hideMode: resolvedHideMode, delayMode: resolvedDelayMode } = detectStaggerModes(children, {\n hideMode,\n delayMode,\n // One-way stagger falls back to visibilityStyle if it doesn't detect visibleProp support\n fallbackHideMode: 'visibilityStyle',\n });\n\n return (\n <StaggerOneWay\n {...props}\n children={children}\n direction={direction}\n hideMode={resolvedHideMode}\n delayMode={resolvedDelayMode}\n />\n );\n };\n\n return StaggerDirection;\n};\n\nconst StaggerIn = createStaggerDirection('enter');\nconst StaggerOut = createStaggerDirection('exit');\n\n// Main Stagger component with auto-detection or explicit modes\nconst StaggerMain: React.FC<StaggerProps> = props => {\n const { children, visible = false, hideMode, delayMode, ...rest } = props;\n\n // Auto-detect modes for bidirectional stagger\n const { hideMode: resolvedHideMode, delayMode: resolvedDelayMode } = detectStaggerModes(children, {\n hideMode,\n delayMode,\n // Bidirectional stagger falls back to visibilityStyle if it doesn't detect visibleProp support\n fallbackHideMode: 'visibilityStyle',\n });\n\n const direction = visible ? 'enter' : 'exit';\n\n return (\n <StaggerOneWay\n {...rest}\n children={children}\n hideMode={resolvedHideMode}\n delayMode={resolvedDelayMode}\n direction={direction}\n />\n );\n};\n\n/**\n * Stagger is a component that manages the staggered entrance and exit of its children.\n * Children are animated in sequence with configurable timing between each item.\n * Stagger can be interactively toggled between entrance and exit animations using the `visible` prop.\n *\n * @param children - React elements to animate. Elements are cloned with animation props.\n * @param visible - Controls animation direction. When `true`, the group is animating \"enter\" (items shown);\n * when `false`, the group is animating \"exit\" (items hidden). Defaults to `false`.\n * @param itemDelay - Milliseconds between each item's animation start.\n * Defaults to the package's default delay (see `DEFAULT_ITEM_DELAY`).\n * @param itemDuration - Milliseconds each item's animation lasts. Only used with `delayMode=\"timing\"`.\n * Defaults to the package's default item duration (see `DEFAULT_ITEM_DURATION`).\n * @param reversed - Whether to reverse the stagger sequence (last item animates first). Defaults to `false`.\n * @param hideMode - How children's visibility/mounting is managed. Auto-detects if not specified.\n * @param delayMode - How staggering timing is implemented. Auto-detects if not specified.\n * @param onMotionFinish - Callback invoked when the staggered animation sequence completes.\n *\n * **Auto-detection behavior:**\n * - **hideMode**: Presence components use `'visibleProp'`, DOM elements use `'visibilityStyle'`\n * - **delayMode**: Components with delay support use `'delayProp'` (most performant), others use `'timing'`\n *\n * **hideMode options:**\n * - `'visibleProp'`: Children are presence components with `visible` prop (always rendered, visibility controlled via prop)\n * - `'visibilityStyle'`: Children remain in DOM with inline style visibility: hidden/visible (preserves layout space)\n * - `'unmount'`: Children are mounted/unmounted from DOM based on visibility\n *\n * **delayMode options:**\n * - `'timing'`: Manages visibility over time using JavaScript timing\n * - `'delayProp'`: Passes delay props to motion components to use native Web Animations API delays (most performant)\n *\n * **Static variants:**\n * - `<Stagger.In>` - One-way stagger for entrance animations only (auto-detects optimal modes)\n * - `<Stagger.Out>` - One-way stagger for exit animations only (auto-detects optimal modes)\n *\n * @example\n * ```tsx\n * import { Stagger, Fade, Scale, Rotate } from '@fluentui/react-motion-components-preview';\n *\n * // Auto-detects optimal modes for presence components (delayProp + visibleProp)\n * <Stagger visible={isVisible} itemDelay={150}>\n * <Fade><div>Item 2</div></Fade>\n * <Scale><div>Item 1</div></Scale>\n * <Rotate><div>Item 3</div></Rotate>\n * </Stagger>\n *\n * // Auto-detects optimal modes for motion components (delayProp + unmount)\n * <Stagger.In itemDelay={100}>\n * <Scale.In><div>Item 1</div></Scale.In>\n * <Fade.In><div>Item 2</div></Fade.In>\n * </Stagger.In>\n *\n * // Auto-detects timing mode for DOM elements (timing + visibilityStyle)\n * <Stagger visible={isVisible} itemDelay={150} onMotionFinish={handleComplete}>\n * <div>Item 1</div>\n * <div>Item 2</div>\n * <div>Item 3</div>\n * </Stagger>\n *\n * // Override auto-detection when needed\n * <Stagger visible={isVisible} delayMode=\"timing\" hideMode=\"unmount\">\n * <CustomComponent>Item 1</CustomComponent>\n * </Stagger>\n * ```\n */\nexport const Stagger = Object.assign(StaggerMain, {\n In: StaggerIn,\n Out: StaggerOut,\n});\n"],"names":["React","useStaggerItemsVisibility","DEFAULT_ITEM_DURATION","DEFAULT_ITEM_DELAY","acceptsVisibleProp","acceptsDelayProps","getStaggerChildMapping","detectStaggerModes","children","options","hideMode","delayMode","fallbackHideMode","childMapping","elements","Object","values","map","item","element","hasVisiblePropSupport","every","child","hasDelayPropSupport","StaggerOneWay","direction","itemDelay","itemDuration","reversed","onMotionFinish","useMemo","itemsVisibility","entries","key","index","staggerIndex","keys","length","delay","delayProp","exitDelay","visibleProp","visible","cloneElement","childProps","props","style","visibility","createStaggerDirection","StaggerDirection","resolvedHideMode","resolvedDelayMode","StaggerIn","StaggerOut","StaggerMain","rest","Stagger","assign","In","Out"],"mappings":"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"}
@@ -0,0 +1 @@
1
+ export { Stagger } from './Stagger';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/choreography/Stagger/index.ts"],"sourcesContent":["export { Stagger } from './Stagger';\nexport type { StaggerProps } from './stagger-types';\n"],"names":["Stagger"],"mappings":"AAAA,SAASA,OAAO,QAAQ,YAAY"}
@@ -0,0 +1 @@
1
+ import * as React from 'react';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/choreography/Stagger/stagger-types.ts"],"sourcesContent":["import { PresenceComponentProps, PresenceDirection } from '@fluentui/react-motion';\nimport * as React from 'react';\n\n/**\n * Defines how Stagger manages its children's visibility/mounting.\n * - 'visibleProp': Children are components with a `visible` prop (e.g. motion components)\n * - 'visibilityStyle': Children remain in DOM with inline style `visibility: hidden | visible`\n * - 'unmount': Children are mounted/unmounted from DOM based on visibility\n */\nexport type StaggerHideMode = 'visibleProp' | 'visibilityStyle' | 'unmount';\n\n/**\n * Defines how Stagger implements the timing of staggered animations.\n * - 'timing': Manages visibility over time using JavaScript timing (current behavior)\n * - 'delayProp': Passes delay props to motion components to use native Web Animations API delays\n */\nexport type StaggerDelayMode = 'timing' | 'delayProp';\n\n/**\n * Props for the Stagger component that manages staggered entrance and exit animations.\n */\nexport interface StaggerProps {\n /** React elements to animate. Elements are cloned with animation props. */\n children: React.ReactNode;\n\n /**\n * Controls children animation direction. When `true`, the group is animating \"enter\" (items shown).\n * When `false`, the group is animating \"exit\" (items hidden).\n */\n visible?: PresenceComponentProps['visible'];\n\n /** Whether to reverse the stagger sequence (last item animates first). Defaults to `false`. */\n reversed?: boolean;\n\n /**\n * Milliseconds between each child's animation start.\n * Defaults to the package's default delay (see `DEFAULT_ITEM_DELAY`).\n */\n itemDelay?: number;\n\n /**\n * Milliseconds each child's animation lasts. Only used with `delayMode=\"timing\"`.\n * Defaults to the package's default duration (see `DEFAULT_ITEM_DURATION`).\n */\n itemDuration?: number;\n\n /** How children's visibility/mounting is managed. Auto-detects if not specified. */\n hideMode?: StaggerHideMode;\n\n /** How staggering timing is implemented. Defaults to 'timing'. */\n delayMode?: StaggerDelayMode;\n\n /** Callback invoked when the staggered animation sequence completes. */\n onMotionFinish?: () => void;\n}\n\nexport interface StaggerOneWayProps extends Omit<StaggerProps, 'visible' | 'hideMode' | 'delayMode'> {\n /** Animation direction: 'enter' or 'exit'. */\n direction: PresenceDirection;\n\n /** How children's visibility/mounting is managed. Required - provided by wrapper components. */\n hideMode: StaggerHideMode;\n\n /** How staggering timing is implemented. Required - provided by wrapper components. */\n delayMode: StaggerDelayMode;\n}\n"],"names":["React"],"mappings":"AACA,YAAYA,WAAW,QAAQ"}