@fluentui/react-motion 9.74.7-experimental.cli-api.20261006-ccaa611d58.0 → 9.75.0-experimental.css-modules.20261031-810ab07afb.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 +25 -7
- package/lib/components/MotionRefForwarder.js.map +1 -1
- package/lib/components/PresenceGroup.js.map +1 -1
- package/lib/components/PresenceGroupItemProvider.js.map +1 -1
- package/lib/contexts/MotionBehaviourContext.js.map +1 -1
- package/lib/contexts/PresenceGroupChildContext.js.map +1 -1
- package/lib/factories/createMotionComponent.js.map +1 -1
- package/lib/factories/createMotionComponentVariant.js.map +1 -1
- package/lib/factories/createPresenceComponent.js.map +1 -1
- package/lib/factories/createPresenceComponentVariant.js.map +1 -1
- package/lib/hooks/useAnimateAtoms.js +1 -1
- package/lib/hooks/useAnimateAtoms.js.map +1 -1
- package/lib/hooks/useIsReducedMotion.js +2 -2
- package/lib/hooks/useIsReducedMotion.js.map +1 -1
- package/lib/hooks/useMotionImperativeRef.js.map +1 -1
- package/lib/hooks/useMountedState.js.map +1 -1
- package/lib/motions/motionTokens.js.map +1 -1
- package/lib/slots/motionSlot.js.map +1 -1
- package/lib/slots/presenceMotionSlot.js.map +1 -1
- package/lib/utils/groups/getChildMapping.js.map +1 -1
- package/lib/utils/groups/getNextChildMapping.js.map +1 -1
- package/lib/utils/groups/mergeChildMappings.js.map +1 -1
- package/lib/utils/groups/types.js.map +1 -1
- package/lib/utils/isAnimationRunning.js +2 -3
- package/lib/utils/isAnimationRunning.js.map +1 -1
- package/lib/utils/useChildElement.js.map +1 -1
- package/lib-commonjs/components/MotionRefForwarder.cjs +4 -4
- package/lib-commonjs/components/MotionRefForwarder.cjs.map +1 -1
- package/lib-commonjs/components/PresenceGroup.cjs.map +1 -1
- package/lib-commonjs/components/PresenceGroupItemProvider.cjs.map +1 -1
- package/lib-commonjs/contexts/MotionBehaviourContext.cjs +3 -3
- package/lib-commonjs/contexts/MotionBehaviourContext.cjs.map +1 -1
- package/lib-commonjs/contexts/PresenceGroupChildContext.cjs +4 -4
- package/lib-commonjs/contexts/PresenceGroupChildContext.cjs.map +1 -1
- package/lib-commonjs/factories/createMotionComponent.cjs +3 -3
- package/lib-commonjs/factories/createMotionComponent.cjs.map +1 -1
- package/lib-commonjs/factories/createMotionComponentVariant.cjs +3 -3
- package/lib-commonjs/factories/createMotionComponentVariant.cjs.map +1 -1
- package/lib-commonjs/factories/createPresenceComponent.cjs +3 -3
- package/lib-commonjs/factories/createPresenceComponent.cjs.map +1 -1
- package/lib-commonjs/factories/createPresenceComponentVariant.cjs +3 -3
- package/lib-commonjs/factories/createPresenceComponentVariant.cjs.map +1 -1
- package/lib-commonjs/hooks/useAnimateAtoms.cjs +4 -4
- package/lib-commonjs/hooks/useAnimateAtoms.cjs.map +1 -1
- package/lib-commonjs/hooks/useIsReducedMotion.cjs +2 -2
- package/lib-commonjs/hooks/useIsReducedMotion.cjs.map +1 -1
- package/lib-commonjs/hooks/useMotionImperativeRef.cjs.map +1 -1
- package/lib-commonjs/hooks/useMountedState.cjs.map +1 -1
- package/lib-commonjs/index.cjs +17 -17
- package/lib-commonjs/index.cjs.map +1 -1
- package/lib-commonjs/motions/motionTokens.cjs +4 -4
- package/lib-commonjs/motions/motionTokens.cjs.map +1 -1
- package/lib-commonjs/slots/motionSlot.cjs.map +1 -1
- package/lib-commonjs/slots/presenceMotionSlot.cjs.map +1 -1
- package/lib-commonjs/utils/groups/getChildMapping.cjs.map +1 -1
- package/lib-commonjs/utils/groups/getNextChildMapping.cjs.map +1 -1
- package/lib-commonjs/utils/groups/mergeChildMappings.cjs.map +1 -1
- package/lib-commonjs/utils/isAnimationRunning.cjs +2 -3
- package/lib-commonjs/utils/isAnimationRunning.cjs.map +1 -1
- package/lib-commonjs/utils/useChildElement.cjs.map +1 -1
- package/package.json +5 -8
- package/dist/metadata/api/api-root.json +0 -1
- package/dist/metadata/index.json +0 -1
package/lib-commonjs/index.cjs
CHANGED
|
@@ -5,56 +5,56 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
MotionBehaviourProvider
|
|
12
|
+
get MotionBehaviourProvider () {
|
|
13
13
|
return _MotionBehaviourContext.MotionBehaviourProvider;
|
|
14
14
|
},
|
|
15
|
-
MotionRefForwarder
|
|
15
|
+
get MotionRefForwarder () {
|
|
16
16
|
return _MotionRefForwarder.MotionRefForwarder;
|
|
17
17
|
},
|
|
18
|
-
MotionRefForwarderReset
|
|
18
|
+
get MotionRefForwarderReset () {
|
|
19
19
|
return _MotionRefForwarder.MotionRefForwarderReset;
|
|
20
20
|
},
|
|
21
|
-
PresenceGroup
|
|
21
|
+
get PresenceGroup () {
|
|
22
22
|
return _PresenceGroup.PresenceGroup;
|
|
23
23
|
},
|
|
24
|
-
PresenceGroupChildProvider
|
|
24
|
+
get PresenceGroupChildProvider () {
|
|
25
25
|
return _PresenceGroupChildContext.PresenceGroupChildProvider;
|
|
26
26
|
},
|
|
27
|
-
createMotionComponent
|
|
27
|
+
get createMotionComponent () {
|
|
28
28
|
return _createMotionComponent.createMotionComponent;
|
|
29
29
|
},
|
|
30
|
-
createMotionComponentVariant
|
|
30
|
+
get createMotionComponentVariant () {
|
|
31
31
|
return _createMotionComponentVariant.createMotionComponentVariant;
|
|
32
32
|
},
|
|
33
|
-
createPresenceComponent
|
|
33
|
+
get createPresenceComponent () {
|
|
34
34
|
return _createPresenceComponent.createPresenceComponent;
|
|
35
35
|
},
|
|
36
|
-
createPresenceComponentVariant
|
|
36
|
+
get createPresenceComponentVariant () {
|
|
37
37
|
return _createPresenceComponentVariant.createPresenceComponentVariant;
|
|
38
38
|
},
|
|
39
|
-
curves
|
|
39
|
+
get curves () {
|
|
40
40
|
return _motionTokens.curves;
|
|
41
41
|
},
|
|
42
|
-
durations
|
|
42
|
+
get durations () {
|
|
43
43
|
return _motionTokens.durations;
|
|
44
44
|
},
|
|
45
|
-
motionSlot
|
|
45
|
+
get motionSlot () {
|
|
46
46
|
return _motionSlot.motionSlot;
|
|
47
47
|
},
|
|
48
|
-
motionTokens
|
|
48
|
+
get motionTokens () {
|
|
49
49
|
return _motionTokens.motionTokens;
|
|
50
50
|
},
|
|
51
|
-
presenceMotionSlot
|
|
51
|
+
get presenceMotionSlot () {
|
|
52
52
|
return _presenceMotionSlot.presenceMotionSlot;
|
|
53
53
|
},
|
|
54
|
-
useMotionForwardedRef
|
|
54
|
+
get useMotionForwardedRef () {
|
|
55
55
|
return _MotionRefForwarder.useMotionForwardedRef;
|
|
56
56
|
},
|
|
57
|
-
usePresenceGroupChildContext
|
|
57
|
+
get usePresenceGroupChildContext () {
|
|
58
58
|
return _PresenceGroupChildContext.usePresenceGroupChildContext;
|
|
59
59
|
}
|
|
60
60
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { motionTokens, durations, curves } from './motions/motionTokens';\n\nexport {\n createMotionComponent,\n type MotionComponentProps,\n type MotionComponent,\n} from './factories/createMotionComponent';\nexport { createMotionComponentVariant } from './factories/createMotionComponentVariant';\nexport {\n createPresenceComponent,\n type PresenceComponentProps,\n type PresenceComponent,\n} from './factories/createPresenceComponent';\nexport { createPresenceComponentVariant } from './factories/createPresenceComponentVariant';\n\nexport { PresenceGroup } from './components/PresenceGroup';\nexport { MotionRefForwarder, MotionRefForwarderReset, useMotionForwardedRef } from './components/MotionRefForwarder';\n\nexport { motionSlot, type MotionSlotProps } from './slots/motionSlot';\nexport { presenceMotionSlot, type PresenceMotionSlotProps } from './slots/presenceMotionSlot';\n\nexport {\n PresenceGroupChildProvider,\n usePresenceGroupChildContext,\n type PresenceGroupChildContextValue,\n} from './contexts/PresenceGroupChildContext';\n\nexport type {\n AtomMotion,\n AtomMotionFn,\n PresenceMotion,\n PresenceMotionFn,\n PresenceDirection,\n MotionImperativeRef,\n MotionParam,\n} from './types';\n\nexport { MotionBehaviourProvider } from './contexts/MotionBehaviourContext';\n"],"names":["MotionBehaviourProvider","MotionRefForwarder","MotionRefForwarderReset","PresenceGroup","PresenceGroupChildProvider","createMotionComponent","createMotionComponentVariant","createPresenceComponent","createPresenceComponentVariant","curves","durations","motionSlot","motionTokens","presenceMotionSlot","useMotionForwardedRef","usePresenceGroupChildContext"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { motionTokens, durations, curves } from './motions/motionTokens';\n\nexport {\n createMotionComponent,\n type MotionComponentProps,\n type MotionComponent,\n} from './factories/createMotionComponent';\nexport { createMotionComponentVariant } from './factories/createMotionComponentVariant';\nexport {\n createPresenceComponent,\n type PresenceComponentProps,\n type PresenceComponent,\n} from './factories/createPresenceComponent';\nexport { createPresenceComponentVariant } from './factories/createPresenceComponentVariant';\n\nexport { PresenceGroup } from './components/PresenceGroup';\nexport { MotionRefForwarder, MotionRefForwarderReset, useMotionForwardedRef } from './components/MotionRefForwarder';\n\nexport { motionSlot, type MotionSlotProps } from './slots/motionSlot';\nexport { presenceMotionSlot, type PresenceMotionSlotProps } from './slots/presenceMotionSlot';\n\nexport {\n PresenceGroupChildProvider,\n usePresenceGroupChildContext,\n type PresenceGroupChildContextValue,\n} from './contexts/PresenceGroupChildContext';\n\nexport type {\n AtomMotion,\n AtomMotionFn,\n PresenceMotion,\n PresenceMotionFn,\n PresenceDirection,\n MotionImperativeRef,\n MotionParam,\n} from './types';\n\nexport { MotionBehaviourProvider } from './contexts/MotionBehaviourContext';\n"],"names":["MotionBehaviourProvider","MotionRefForwarder","MotionRefForwarderReset","PresenceGroup","PresenceGroupChildProvider","createMotionComponent","createMotionComponentVariant","createPresenceComponent","createPresenceComponentVariant","curves","durations","motionSlot","motionTokens","presenceMotionSlot","useMotionForwardedRef","usePresenceGroupChildContext"],"mappings":";;;;;;;;;;;QAqCSA;eAAAA,+CAAuB;;QArBvBC;eAAAA,sCAAkB;;QAAEC;eAAAA,2CAAuB;;QAD3CC;eAAAA,4BAAa;;QAOpBC;eAAAA,qDAA0B;;QAnB1BC;eAAAA,4CAAqB;;QAIdC;eAAAA,0DAA4B;;QAEnCC;eAAAA,gDAAuB;;QAIhBC;eAAAA,8DAA8B;;QAbLC;eAAAA,oBAAM;;QAAjBC;eAAAA,uBAAS;;QAkBvBC;eAAAA,sBAAU;;QAlBVC;eAAAA,0BAAY;;QAmBZC;eAAAA,sCAAkB;;QAH2BC;eAAAA,yCAAqB;;QAOzEC;eAAAA,uDAA4B;;;8BAvBkB;uCAMzC;8CACsC;yCAKtC;gDACwC;+BAEjB;oCACqD;4BAElC;oCACgB;2CAM1D;wCAYiC"}
|
|
@@ -8,17 +8,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
function _export(target, all) {
|
|
9
9
|
for(var name in all)Object.defineProperty(target, name, {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: all
|
|
11
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
_export(exports, {
|
|
15
|
-
curves
|
|
15
|
+
get curves () {
|
|
16
16
|
return curves;
|
|
17
17
|
},
|
|
18
|
-
durations
|
|
18
|
+
get durations () {
|
|
19
19
|
return durations;
|
|
20
20
|
},
|
|
21
|
-
motionTokens
|
|
21
|
+
get motionTokens () {
|
|
22
22
|
return motionTokens;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/motions/motionTokens.ts"],"sourcesContent":["// Copied from packages/tokens/src/global/durations.ts\n// Values are numeric in milliseconds for ease of use in Web Animations API\n// (rather than parsing '__ms')\nexport const durations = {\n durationUltraFast: 50,\n durationFaster: 100,\n durationFast: 150,\n durationNormal: 200,\n durationGentle: 250,\n durationSlow: 300,\n durationSlower: 400,\n durationUltraSlow: 500,\n} as const;\n\n// Copied from packages/tokens/src/global/curves.ts\n// Names and values are preserved exactly\nexport const curves = {\n curveAccelerateMax: 'cubic-bezier(0.9,0.1,1,0.2)',\n curveAccelerateMid: 'cubic-bezier(1,0,1,1)',\n curveAccelerateMin: 'cubic-bezier(0.8,0,0.78,1)',\n curveDecelerateMax: 'cubic-bezier(0.1,0.9,0.2,1)',\n curveDecelerateMid: 'cubic-bezier(0,0,0,1)',\n curveDecelerateMin: 'cubic-bezier(0.33,0,0.1,1)',\n curveEasyEaseMax: 'cubic-bezier(0.8,0,0.2,1)',\n curveEasyEase: 'cubic-bezier(0.33,0,0.67,1)',\n curveLinear: 'cubic-bezier(0,0,1,1)',\n} as const;\n\n// A merged flat lookup for convenience\nexport const motionTokens = {\n ...durations,\n ...curves,\n};\n\n/*\nTODO: enforce naming conventions when TypeScript 4.4 features are supported in Fluent:\n\ntype DurationKey = `duration${Capitalize<string>}`;\ntype CurveKey = `curve${Capitalize<string>}`;\ntype CurveValue = `cubic-bezier(${number},${number},${number},${number})`;\n\ntype DurationTokens = Record<DurationKey, number>;\ntype CurveTokens = Record<CurveKey, CurveValue>;\n*/\n"],"names":["curves","durations","motionTokens","durationUltraFast","durationFaster","durationFast","durationNormal","durationGentle","durationSlow","durationSlower","durationUltraSlow","curveAccelerateMax","curveAccelerateMid","curveAccelerateMin","curveDecelerateMax","curveDecelerateMid","curveDecelerateMin","curveEasyEaseMax","curveEasyEase","curveLinear"],"mappings":"AAAA,sDAAsD;AACtD,2EAA2E;AAC3E,+BAA+B;;;;;;;;;;;;QAclBA;eAAAA;;QAbAC;eAAAA;;QA0BAC;eAAAA;;;AA1BN,MAAMD,YAAY;IACvBE,mBAAmB;IACnBC,gBAAgB;IAChBC,cAAc;IACdC,gBAAgB;IAChBC,gBAAgB;IAChBC,cAAc;IACdC,gBAAgB;IAChBC,mBAAmB;AACrB;AAIO,MAAMV,SAAS;IACpBW,oBAAoB;IACpBC,oBAAoB;IACpBC,oBAAoB;IACpBC,oBAAoB;IACpBC,oBAAoB;IACpBC,oBAAoB;IACpBC,kBAAkB;IAClBC,eAAe;IACfC,aAAa;AACf;AAGO,MAAMjB,eAAe;IAC1B,GAAGD,SAAS;IACZ,GAAGD,MAAM;AACX,GAEA;;;;;;;;;AASA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/slots/motionSlot.tsx"],"sourcesContent":["import * as React from 'react';\nimport { SLOT_ELEMENT_TYPE_SYMBOL, SLOT_RENDER_FUNCTION_SYMBOL } from '@fluentui/react-utilities';\nimport type {\n JSXElement,\n JSXIntrinsicElementKeys,\n SlotComponentType,\n SlotRenderFunction,\n} from '@fluentui/react-utilities';\n\nimport type { MotionComponentProps } from '../factories/createMotionComponent';\nimport type { MotionParam } from '../types';\n\n/**\n * @internal\n */\ntype MotionSlotRenderProps = Pick<MotionComponentProps, 'onMotionFinish' | 'onMotionStart' | 'onMotionCancel'>;\n\nexport type MotionSlotProps<MotionParams extends Record<string, MotionParam> = {}> = Pick<\n MotionComponentProps,\n 'imperativeRef' | 'onMotionFinish' | 'onMotionStart' | 'onMotionCancel'\n> &\n Partial<MotionParams> & {\n // FIXME: 'as' property is required by design on the slot AP but it does not support components, only intrinsic\n // elements motion slots do not support intrinsic elements, only custom components.\n /**\n * @deprecated Do not use. Motion Slots do not support intrinsic elements.\n *\n * If you want to override the animation, use the children render function instead.\n */\n as?: JSXIntrinsicElementKeys;\n\n // TODO: remove once React v18 slot API is modified ComponentProps is not properly adding render function as a\n // possible value for children\n children?: SlotRenderFunction<MotionSlotRenderProps & MotionParams & { children: JSXElement }>;\n };\n\nexport function motionSlot<MotionParams extends Record<string, MotionParam> = {}>(\n motion: MotionSlotProps<MotionParams> | null | undefined,\n options: {\n elementType: React.FC<MotionComponentProps & MotionParams>;\n defaultProps: MotionSlotRenderProps & MotionParams;\n },\n): SlotComponentType<MotionSlotRenderProps & MotionParams> {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const { as, children, ...rest } = motion ?? {};\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof as !== 'undefined') {\n throw new Error(`@fluentui/react-motion: \"as\" property is not supported on motion slots.`);\n }\n }\n\n if (motion === null) {\n // Heads up!\n // Render function is used there to avoid rendering a motion component and render children directly\n const renderFn: SlotRenderFunction<MotionSlotRenderProps & MotionParams & { children: JSXElement }> = (\n _,\n props,\n ) => <>{props.children}</>;\n\n /**\n * Casting is required here as SlotComponentType is a function, not an object.\n * Although SlotComponentType has a function signature, it is still just an object.\n * This is required to make a slot callable (JSX compatible), this is the exact same approach\n * that is used on `@types/react` components\n */\n return {\n [SLOT_RENDER_FUNCTION_SYMBOL]: renderFn,\n [SLOT_ELEMENT_TYPE_SYMBOL]: options.elementType,\n } as SlotComponentType<MotionSlotRenderProps & MotionParams>;\n }\n\n /**\n * Casting is required here as SlotComponentType is a function, not an object.\n * Although SlotComponentType has a function signature, it is still just an object.\n * This is required to make a slot callable (JSX compatible), this is the exact same approach\n * that is used on `@types/react` components\n */\n const propsWithMetadata = {\n ...options.defaultProps,\n ...rest,\n [SLOT_ELEMENT_TYPE_SYMBOL]: options.elementType,\n } as SlotComponentType<MotionSlotRenderProps & MotionParams>;\n\n if (typeof children === 'function') {\n propsWithMetadata[SLOT_RENDER_FUNCTION_SYMBOL] = children as SlotRenderFunction<\n MotionSlotRenderProps & MotionParams\n >;\n }\n\n return propsWithMetadata;\n}\n"],"names":["motionSlot","motion","options","as","children","rest","process","env","NODE_ENV","Error","renderFn","_","props","SLOT_RENDER_FUNCTION_SYMBOL","SLOT_ELEMENT_TYPE_SYMBOL","elementType","propsWithMetadata","defaultProps"],"mappings":";;;;+BAoCgBA;;;eAAAA;;;;iEApCO;gCAC+C;AAmC/D,SAASA,WACdC,MAAwD,EACxDC,OAGC;IAED,4DAA4D;IAC5D,MAAM,EAAEC,EAAE,EAAEC,QAAQ,EAAE,GAAGC,MAAM,GAAGJ,mBAAAA,oBAAAA,SAAU,CAAC;IAE7C,IAAIK,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,IAAI,OAAOL,OAAO,aAAa;YAC7B,MAAM,IAAIM,MAAM,CAAC,uEAAuE,CAAC;QAC3F;IACF;IAEA,IAAIR,WAAW,MAAM;QACnB,YAAY;QACZ,mGAAmG;QACnG,MAAMS,WAAgG,CACpGC,GACAC,sBACG,4CAAGA,MAAMR,QAAQ;QAEtB;;;;;KAKC,GACD,OAAO;YACL,CAACS,2CAA2B,CAAC,EAAEH;YAC/B,CAACI,wCAAwB,CAAC,EAAEZ,QAAQa,WAAW;QACjD;IACF;IAEA;;;;;GAKC,GACD,MAAMC,oBAAoB;QACxB,GAAGd,QAAQe,YAAY;QACvB,GAAGZ,IAAI;QACP,CAACS,wCAAwB,CAAC,EAAEZ,QAAQa,WAAW;IACjD;IAEA,IAAI,OAAOX,aAAa,YAAY;QAClCY,iBAAiB,CAACH,2CAA2B,CAAC,GAAGT;IAGnD;IAEA,OAAOY;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/slots/presenceMotionSlot.tsx"],"sourcesContent":["import * as React from 'react';\nimport { SLOT_ELEMENT_TYPE_SYMBOL, SLOT_RENDER_FUNCTION_SYMBOL } from '@fluentui/react-utilities';\nimport type {\n JSXElement,\n JSXIntrinsicElementKeys,\n SlotComponentType,\n SlotRenderFunction,\n} from '@fluentui/react-utilities';\n\nimport type { PresenceComponentProps } from '../factories/createPresenceComponent';\nimport type { MotionParam } from '../types';\n\n/**\n * @internal\n */\ntype PresenceMotionSlotRenderProps = Pick<\n PresenceComponentProps,\n 'appear' | 'onMotionFinish' | 'onMotionStart' | 'unmountOnExit' | 'visible'\n>;\n\nexport type PresenceMotionSlotProps<MotionParams extends Record<string, MotionParam> = {}> = Pick<\n PresenceComponentProps,\n 'imperativeRef' | 'onMotionFinish' | 'onMotionStart'\n> &\n Partial<MotionParams> & {\n // FIXME: 'as' property is required by design on the slot AP but it does not support components, only intrinsic\n // elements motion slots do not support intrinsic elements, only custom components.\n /**\n * @deprecated Do not use. Presence Motion Slots do not support intrinsic elements.\n *\n * If you want to override the animation, use the children render function instead.\n */\n as?: JSXIntrinsicElementKeys;\n\n // TODO: remove once React v18 slot API is modified ComponentProps is not properly adding render function as a\n // possible value for children\n children?: SlotRenderFunction<PresenceMotionSlotRenderProps & MotionParams & { children: JSXElement }>;\n };\n\nexport function presenceMotionSlot<MotionParams extends Record<string, MotionParam> = {}>(\n motion: PresenceMotionSlotProps<MotionParams> | null | undefined,\n options: {\n elementType: React.FC<PresenceComponentProps & MotionParams>;\n defaultProps: PresenceMotionSlotRenderProps & MotionParams;\n },\n): SlotComponentType<PresenceMotionSlotRenderProps & MotionParams> {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const { as, children, ...rest } = motion ?? {};\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof as !== 'undefined') {\n throw new Error(`@fluentui/react-motion: \"as\" property is not supported on motion slots.`);\n }\n }\n\n if (motion === null) {\n // Heads up!\n // Render function is used there to avoid rendering a motion component and handle unmounting logic\n const isUnmounted = !options.defaultProps.visible && options.defaultProps.unmountOnExit;\n const renderFn: SlotRenderFunction<PresenceMotionSlotRenderProps & MotionParams & { children: JSXElement }> = (\n _,\n props,\n ) => (isUnmounted ? null : <>{props.children}</>);\n\n /**\n * Casting is required here as SlotComponentType is a function, not an object.\n * Although SlotComponentType has a function signature, it is still just an object.\n * This is required to make a slot callable (JSX compatible), this is the exact same approach\n * that is used on `@types/react` components\n */\n return {\n [SLOT_RENDER_FUNCTION_SYMBOL]: renderFn,\n [SLOT_ELEMENT_TYPE_SYMBOL]: options.elementType,\n } as SlotComponentType<PresenceMotionSlotRenderProps & MotionParams>;\n }\n\n /**\n * Casting is required here as SlotComponentType is a function, not an object.\n * Although SlotComponentType has a function signature, it is still just an object.\n * This is required to make a slot callable (JSX compatible), this is the exact same approach\n * that is used on `@types/react` components\n */\n const propsWithMetadata = {\n ...options.defaultProps,\n ...rest,\n [SLOT_ELEMENT_TYPE_SYMBOL]: options.elementType,\n } as SlotComponentType<PresenceMotionSlotRenderProps & MotionParams>;\n\n if (typeof children === 'function') {\n propsWithMetadata[SLOT_RENDER_FUNCTION_SYMBOL] = children as SlotRenderFunction<\n PresenceMotionSlotRenderProps & MotionParams\n >;\n }\n\n return propsWithMetadata;\n}\n"],"names":["presenceMotionSlot","motion","options","as","children","rest","process","env","NODE_ENV","Error","isUnmounted","defaultProps","visible","unmountOnExit","renderFn","_","props","SLOT_RENDER_FUNCTION_SYMBOL","SLOT_ELEMENT_TYPE_SYMBOL","elementType","propsWithMetadata"],"mappings":";;;;+BAuCgBA;;;eAAAA;;;;iEAvCO;gCAC+C;AAsC/D,SAASA,mBACdC,MAAgE,EAChEC,OAGC;IAED,4DAA4D;IAC5D,MAAM,EAAEC,EAAE,EAAEC,QAAQ,EAAE,GAAGC,MAAM,GAAGJ,mBAAAA,oBAAAA,SAAU,CAAC;IAE7C,IAAIK,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,IAAI,OAAOL,OAAO,aAAa;YAC7B,MAAM,IAAIM,MAAM,CAAC,uEAAuE,CAAC;QAC3F;IACF;IAEA,IAAIR,WAAW,MAAM;QACnB,YAAY;QACZ,kGAAkG;QAClG,MAAMS,cAAc,CAACR,QAAQS,YAAY,CAACC,OAAO,IAAIV,QAAQS,YAAY,CAACE,aAAa;QACvF,MAAMC,WAAwG,CAC5GC,GACAC,QACIN,cAAc,qBAAO,4CAAGM,MAAMZ,QAAQ;QAE5C;;;;;KAKC,GACD,OAAO;YACL,CAACa,2CAA2B,CAAC,EAAEH;YAC/B,CAACI,wCAAwB,CAAC,EAAEhB,QAAQiB,WAAW;QACjD;IACF;IAEA;;;;;GAKC,GACD,MAAMC,oBAAoB;QACxB,GAAGlB,QAAQS,YAAY;QACvB,GAAGN,IAAI;QACP,CAACa,wCAAwB,CAAC,EAAEhB,QAAQiB,WAAW;IACjD;IAEA,IAAI,OAAOf,aAAa,YAAY;QAClCgB,iBAAiB,CAACH,2CAA2B,CAAC,GAAGb;IAGnD;IAEA,OAAOgB;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/groups/getChildMapping.ts"],"sourcesContent":["import * as React from 'react';\nimport type { PresenceGroupChildMapping } from './types';\n\n/**\n * Given `children`, return an object mapping key to child.\n */\nexport function getChildMapping(children: React.ReactNode | undefined): PresenceGroupChildMapping {\n const childMapping: PresenceGroupChildMapping = {};\n\n if (children) {\n React.Children.toArray(children).forEach(child => {\n if (React.isValidElement(child)) {\n childMapping[child.key ?? ''] = {\n appear: false,\n element: child,\n visible: true,\n unmountOnExit: true,\n };\n }\n });\n }\n\n return childMapping;\n}\n"],"names":["getChildMapping","children","childMapping","React","Children","toArray","forEach","child","isValidElement","key","appear","element","visible","unmountOnExit"],"mappings":";;;;+BAMgBA;;;eAAAA;;;;iEANO;AAMhB,SAASA,gBAAgBC,QAAqC;IACnE,MAAMC,eAA0C,CAAC;IAEjD,IAAID,UAAU;QACZE,OAAMC,QAAQ,CAACC,OAAO,CAACJ,UAAUK,OAAO,CAACC,CAAAA;YACvC,IAAIJ,OAAMK,cAAc,CAACD,QAAQ;oBAClBA;gBAAbL,YAAY,EAACK,aAAAA,MAAME,GAAG,cAATF,wBAAAA,aAAa,GAAG,GAAG;oBAC9BG,QAAQ;oBACRC,SAASJ;oBACTK,SAAS;oBACTC,eAAe;gBACjB;YACF;QACF;IACF;IAEA,OAAOX;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/groups/getNextChildMapping.ts"],"sourcesContent":["import { mergeChildMappings } from './mergeChildMappings';\nimport type { PresenceGroupChildMapping } from './types';\n\nexport function getNextChildMapping(\n prevChildMapping: PresenceGroupChildMapping,\n nextChildMapping: PresenceGroupChildMapping,\n): PresenceGroupChildMapping {\n const childrenMapping = mergeChildMappings(prevChildMapping, nextChildMapping);\n\n Object.entries(childrenMapping).forEach(([key, childDefinition]) => {\n const hasPrev = key in prevChildMapping;\n const hasNext = key in nextChildMapping;\n\n if (hasNext) {\n // Case 1: item hasn't changed transition states\n if (hasPrev) {\n childrenMapping[key] = { ...childDefinition };\n return;\n }\n\n // Case 2: item is new (entering)\n childrenMapping[key] = {\n ...childDefinition,\n appear: true,\n visible: true,\n };\n return;\n }\n\n // Case 3: item is leaving\n childrenMapping[key] = {\n ...childDefinition,\n visible: false,\n };\n });\n\n return childrenMapping;\n}\n"],"names":["getNextChildMapping","prevChildMapping","nextChildMapping","childrenMapping","mergeChildMappings","Object","entries","forEach","key","childDefinition","hasPrev","hasNext","appear","visible"],"mappings":";;;;+BAGgBA;;;eAAAA;;;oCAHmB;AAG5B,SAASA,oBACdC,gBAA2C,EAC3CC,gBAA2C;IAE3C,MAAMC,kBAAkBC,IAAAA,sCAAkB,EAACH,kBAAkBC;IAE7DG,OAAOC,OAAO,CAACH,iBAAiBI,OAAO,CAAC,CAAC,CAACC,KAAKC,gBAAgB;QAC7D,MAAMC,UAAUF,OAAOP;QACvB,MAAMU,UAAUH,OAAON;QAEvB,IAAIS,SAAS;YACX,gDAAgD;YAChD,IAAID,SAAS;gBACXP,eAAe,CAACK,IAAI,GAAG;oBAAE,GAAGC,eAAe;gBAAC;gBAC5C;YACF;YAEA,iCAAiC;YACjCN,eAAe,CAACK,IAAI,GAAG;gBACrB,GAAGC,eAAe;gBAClBG,QAAQ;gBACRC,SAAS;YACX;YACA;QACF;QAEA,0BAA0B;QAC1BV,eAAe,CAACK,IAAI,GAAG;YACrB,GAAGC,eAAe;YAClBI,SAAS;QACX;IACF;IAEA,OAAOV;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/groups/mergeChildMappings.ts"],"sourcesContent":["import type { PresenceGroupChildMapping } from './types';\n\n/**\n * When you're adding or removing children some may be added or removed in the same render pass. We want to show *both*\n * since we want to simultaneously animate elements in and out. This function takes a previous set of keys and a new set\n * of keys and merges them with its best guess of the correct ordering.\n */\nexport function mergeChildMappings(\n prevMapping: PresenceGroupChildMapping,\n nextMapping: PresenceGroupChildMapping,\n): PresenceGroupChildMapping {\n function getValueForKey(key: string) {\n return key in nextMapping ? nextMapping[key] : prevMapping[key];\n }\n\n // For each key of `next`, the list of keys to insert before that key in\n // the combined list\n const nextKeysPending: Record<string, string[]> = {};\n let pendingKeys: string[] = [];\n\n // eslint-disable-next-line guard-for-in\n for (const prevKey in prevMapping) {\n if (prevKey in nextMapping) {\n if (pendingKeys.length) {\n nextKeysPending[prevKey] = pendingKeys;\n pendingKeys = [];\n }\n\n continue;\n }\n\n pendingKeys.push(prevKey);\n }\n\n const childMapping: PresenceGroupChildMapping = {};\n\n // eslint-disable-next-line guard-for-in\n for (const nextKey in nextMapping) {\n if (nextKeysPending[nextKey]) {\n for (const pendingNextKey of nextKeysPending[nextKey]) {\n childMapping[pendingNextKey] = getValueForKey(pendingNextKey);\n }\n }\n\n childMapping[nextKey] = getValueForKey(nextKey);\n }\n\n // Finally, add the keys which didn't appear before any key in `next`\n for (const pendingKey of pendingKeys) {\n childMapping[pendingKey] = getValueForKey(pendingKey);\n }\n\n return childMapping;\n}\n"],"names":["mergeChildMappings","prevMapping","nextMapping","getValueForKey","key","nextKeysPending","pendingKeys","prevKey","length","push","childMapping","nextKey","pendingNextKey","pendingKey"],"mappings":";;;;+BAOgBA;;;eAAAA;;;AAAT,SAASA,mBACdC,WAAsC,EACtCC,WAAsC;IAEtC,SAASC,eAAeC,GAAW;QACjC,OAAOA,OAAOF,cAAcA,WAAW,CAACE,IAAI,GAAGH,WAAW,CAACG,IAAI;IACjE;IAEA,wEAAwE;IACxE,oBAAoB;IACpB,MAAMC,kBAA4C,CAAC;IACnD,IAAIC,cAAwB,EAAE;IAE9B,wCAAwC;IACxC,IAAK,MAAMC,WAAWN,YAAa;QACjC,IAAIM,WAAWL,aAAa;YAC1B,IAAII,YAAYE,MAAM,EAAE;gBACtBH,eAAe,CAACE,QAAQ,GAAGD;gBAC3BA,cAAc,EAAE;YAClB;YAEA;QACF;QAEAA,YAAYG,IAAI,CAACF;IACnB;IAEA,MAAMG,eAA0C,CAAC;IAEjD,wCAAwC;IACxC,IAAK,MAAMC,WAAWT,YAAa;QACjC,IAAIG,eAAe,CAACM,QAAQ,EAAE;YAC5B,KAAK,MAAMC,kBAAkBP,eAAe,CAACM,QAAQ,CAAE;gBACrDD,YAAY,CAACE,eAAe,GAAGT,eAAeS;YAChD;QACF;QAEAF,YAAY,CAACC,QAAQ,GAAGR,eAAeQ;IACzC;IAEA,qEAAqE;IACrE,KAAK,MAAME,cAAcP,YAAa;QACpCI,YAAY,CAACG,WAAW,GAAGV,eAAeU;IAC5C;IAEA,OAAOH;AACT"}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "isAnimationRunning", {
|
|
|
12
12
|
});
|
|
13
13
|
function isAnimationRunning(animation) {
|
|
14
14
|
if (animation.playState === 'running') {
|
|
15
|
+
var _animation_currentTime, _ref;
|
|
15
16
|
var _animation_effect;
|
|
16
17
|
// Heads up!
|
|
17
18
|
//
|
|
@@ -25,10 +26,8 @@ function isAnimationRunning(animation) {
|
|
|
25
26
|
const overallProgress = (_animation_overallProgress = animation.overallProgress) !== null && _animation_overallProgress !== void 0 ? _animation_overallProgress : 0;
|
|
26
27
|
return overallProgress > 0 && overallProgress < 1;
|
|
27
28
|
}
|
|
28
|
-
var _animation_currentTime;
|
|
29
29
|
const currentTime = Number((_animation_currentTime = animation.currentTime) !== null && _animation_currentTime !== void 0 ? _animation_currentTime : 0);
|
|
30
|
-
|
|
31
|
-
const totalTime = Number((_animation_effect_getTiming_duration = (_animation_effect = animation.effect) === null || _animation_effect === void 0 ? void 0 : _animation_effect.getTiming().duration) !== null && _animation_effect_getTiming_duration !== void 0 ? _animation_effect_getTiming_duration : 0);
|
|
30
|
+
const totalTime = Number((_ref = (_animation_effect = animation.effect) === null || _animation_effect === void 0 ? void 0 : _animation_effect.getTiming().duration) !== null && _ref !== void 0 ? _ref : 0);
|
|
32
31
|
return currentTime > 0 && currentTime < totalTime;
|
|
33
32
|
}
|
|
34
33
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/isAnimationRunning.ts"],"sourcesContent":["/**\n * Checks if the animation is running at the moment.\n */\nexport function isAnimationRunning(animation: Animation & { readonly overallProgress?: number | null }): boolean {\n if (animation.playState === 'running') {\n // Heads up!\n //\n // There is an edge case where the animation is running, but the overall progress is 0 or 1. In this case, we\n // consider the animation to be not running. If it will be reversed it will flip from 1 to 0, and we will observe a\n // glitch.\n\n // \"overallProgress\" is not supported in all browsers, so we need to check if it exists.\n // We will fall back to the currentTime and duration if \"overallProgress\" is not supported.\n if (animation.overallProgress !== undefined) {\n const overallProgress = animation.overallProgress ?? 0;\n\n return overallProgress > 0 && overallProgress < 1;\n }\n\n const currentTime = Number(animation.currentTime ?? 0);\n const totalTime = Number(animation.effect?.getTiming().duration ?? 0);\n\n return currentTime > 0 && currentTime < totalTime;\n }\n\n return false;\n}\n"],"names":["isAnimationRunning","animation","playState","overallProgress","undefined","currentTime","Number","totalTime","effect","getTiming","duration"],"mappings":"AAAA;;CAEC;;;;+BACeA;;;eAAAA;;;AAAT,SAASA,mBAAmBC,SAAmE;IACpG,IAAIA,UAAUC,SAAS,KAAK,WAAW;YAeVD;YACFA;QAfzB,YAAY;QACZ,EAAE;QACF,6GAA6G;QAC7G,mHAAmH;QACnH,UAAU;QAEV,wFAAwF;QACxF,2FAA2F;QAC3F,IAAIA,UAAUE,eAAe,KAAKC,WAAW;gBACnBH;YAAxB,MAAME,mBAAkBF,6BAAAA,UAAUE,eAAe,cAAzBF,wCAAAA,6BAA6B;YAErD,OAAOE,kBAAkB,KAAKA,kBAAkB;QAClD;QAEA,MAAME,cAAcC,QAAOL,yBAAAA,UAAUI,WAAW,cAArBJ,oCAAAA,yBAAyB;QACpD,MAAMM,YAAYD,gBAAOL,oBAAAA,UAAUO,MAAM,cAAhBP,wCAAAA,kBAAkBQ,SAAS,GAAGC,QAAQ,uCAAI;QAEnE,OAAOL,cAAc,KAAKA,cAAcE;IAC1C;IAEA,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../src/utils/useChildElement.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { getReactElementRef, useMergedRefs } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\n\nconst CHILD_ERROR_MESSAGE = [\n '@fluentui/react-motion: Invalid child element.',\n '\\n',\n 'Motion factories require a single child element to be passed. ',\n 'That element element should support ref forwarding i.e. it should be either an intrinsic element (e.g. div) or a component that uses React.forwardRef().',\n].join('');\n\n/**\n * Validates the child and returns a cloned child element with a ref.\n *\n * Throws an error if the child is not a valid React element, similar to \"React.Children.only\".\n * Logs a warning in development mode if the ref is not set as the component remains functional.\n */\nexport function useChildElement(\n children: JSXElement,\n mounted: boolean = true,\n): [JSXElement, React.RefObject<HTMLElement | null>] {\n const childRef = React.useRef<HTMLElement>(null);\n\n React.useEffect(() => {\n if (process.env.NODE_ENV !== 'production') {\n if (mounted && !childRef.current) {\n // eslint-disable-next-line no-console\n console.error(CHILD_ERROR_MESSAGE);\n }\n }\n }, [mounted]);\n\n try {\n const child = React.Children.only(children) as Parameters<typeof React.isValidElement>[0];\n\n if (React.isValidElement(child)) {\n return [\n React.cloneElement(child as React.ReactElement<{ ref: React.Ref<HTMLElement> }>, {\n ref: useMergedRefs(childRef, getReactElementRef(child)),\n }),\n childRef,\n ];\n }\n } catch {\n /* empty */\n }\n\n throw new Error(CHILD_ERROR_MESSAGE);\n}\n"],"names":["useChildElement","CHILD_ERROR_MESSAGE","join","children","mounted","childRef","React","useRef","useEffect","process","env","NODE_ENV","current","console","error","child","Children","only","isValidElement","cloneElement","ref","useMergedRefs","getReactElementRef","Error"],"mappings":"AAAA;;;;;+BAmBgBA;;;eAAAA;;;;iEAjBO;gCAC2B;AAGlD,MAAMC,sBAAsB;IAC1B;IACA;IACA;IACA;CACD,CAACC,IAAI,CAAC;AAQA,SAASF,gBACdG,QAAoB,EACpBC,UAAmB,IAAI;IAEvB,MAAMC,WAAWC,OAAMC,MAAM,CAAc;IAE3CD,OAAME,SAAS,CAAC;QACd,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YACzC,IAAIP,WAAW,CAACC,SAASO,OAAO,EAAE;gBAChC,sCAAsC;gBACtCC,QAAQC,KAAK,CAACb;YAChB;QACF;IACF,GAAG;QAACG;KAAQ;IAEZ,IAAI;QACF,MAAMW,QAAQT,OAAMU,QAAQ,CAACC,IAAI,CAACd;QAElC,IAAIG,OAAMY,cAAc,CAACH,QAAQ;YAC/B,OAAO;gBACLT,OAAMa,YAAY,CAACJ,OAA8D;oBAC/EK,KAAKC,IAAAA,6BAAa,EAAChB,UAAUiB,IAAAA,kCAAkB,EAACP;gBAClD;gBACAV;aACD;QACH;IACF,EAAE,OAAM;IACN,SAAS,GACX;IAEA,MAAM,IAAIkB,MAAMtB;AAClB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-motion",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
4
4
|
"description": "A package with utilities & motion definitions using Web Animations API",
|
|
5
5
|
"main": "lib-commonjs/index.cjs",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
"dist/*.d.ts",
|
|
12
12
|
"dist/*.d.cts",
|
|
13
13
|
"lib",
|
|
14
|
-
"lib-commonjs"
|
|
15
|
-
"dist/metadata"
|
|
14
|
+
"lib-commonjs"
|
|
16
15
|
],
|
|
17
16
|
"repository": {
|
|
18
17
|
"type": "git",
|
|
@@ -20,8 +19,8 @@
|
|
|
20
19
|
},
|
|
21
20
|
"license": "MIT",
|
|
22
21
|
"dependencies": {
|
|
23
|
-
"@fluentui/react-shared-contexts": "9.
|
|
24
|
-
"@fluentui/react-utilities": "9.
|
|
22
|
+
"@fluentui/react-shared-contexts": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
23
|
+
"@fluentui/react-utilities": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
25
24
|
"@swc/helpers": "^0.5.1"
|
|
26
25
|
},
|
|
27
26
|
"peerDependencies": {
|
|
@@ -44,10 +43,8 @@
|
|
|
44
43
|
"default": "./lib-commonjs/index.cjs"
|
|
45
44
|
}
|
|
46
45
|
},
|
|
47
|
-
"./metadata.json": "./dist/metadata/index.json",
|
|
48
46
|
"./package.json": "./package.json"
|
|
49
47
|
},
|
|
50
48
|
"beachball": {},
|
|
51
|
-
"type": "module"
|
|
52
|
-
"fluentuiCatalog": "./metadata.json"
|
|
49
|
+
"type": "module"
|
|
53
50
|
}
|