@fluentui/react-motion 0.0.0-nightly-20240717-1138.1 → 0.0.0-nightly-20240718-0406.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,21 +1,21 @@
1
1
  # Change Log - @fluentui/react-motion
2
2
 
3
- This log was last generated on Wed, 17 Jul 2024 11:48:37 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 18 Jul 2024 04:16:36 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20240717-1138.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion_v0.0.0-nightly-20240717-1138.1)
7
+ ## [0.0.0-nightly-20240718-0406.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion_v0.0.0-nightly-20240718-0406.1)
8
8
 
9
- Wed, 17 Jul 2024 11:48:37 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-motion_v9.3.0..@fluentui/react-motion_v0.0.0-nightly-20240717-1138.1)
9
+ Thu, 18 Jul 2024 04:16:36 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-motion_v9.3.0..@fluentui/react-motion_v0.0.0-nightly-20240718-0406.1)
11
11
 
12
12
  ### Changes
13
13
 
14
14
  - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
15
- - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20240717-1138.1 ([commit](https://github.com/microsoft/fluentui/commit/3e0ff456654a7259ce6bf87deddcc71ec6e32688) by beachball)
16
- - Bump @fluentui/react-utilities to v0.0.0-nightly-20240717-1138.1 ([commit](https://github.com/microsoft/fluentui/commit/3e0ff456654a7259ce6bf87deddcc71ec6e32688) by beachball)
17
- - Bump @fluentui/react-conformance to v0.0.0-nightly-20240717-1138.1 ([commit](https://github.com/microsoft/fluentui/commit/3e0ff456654a7259ce6bf87deddcc71ec6e32688) by beachball)
18
- - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20240717-1138.1 ([commit](https://github.com/microsoft/fluentui/commit/3e0ff456654a7259ce6bf87deddcc71ec6e32688) by beachball)
15
+ - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20240718-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/b1a4d8ac03b366fccb627d383ab98bab9819acdd) by beachball)
16
+ - Bump @fluentui/react-utilities to v0.0.0-nightly-20240718-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/b1a4d8ac03b366fccb627d383ab98bab9819acdd) by beachball)
17
+ - Bump @fluentui/react-conformance to v0.0.0-nightly-20240718-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/b1a4d8ac03b366fccb627d383ab98bab9819acdd) by beachball)
18
+ - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20240718-0406.1 ([commit](https://github.com/microsoft/fluentui/commit/b1a4d8ac03b366fccb627d383ab98bab9819acdd) by beachball)
19
19
 
20
20
  ## [9.3.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-motion_v9.3.0)
21
21
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import * as React_2 from 'react';
2
+ import { SlotComponentType } from '@fluentui/react-utilities';
3
+ import { SlotRenderFunction } from '@fluentui/react-utilities';
2
4
 
3
5
  export declare type AtomMotion = {
4
6
  keyframes: Keyframe[];
@@ -202,6 +204,28 @@ export declare type PresenceMotionFn<MotionParams extends Record<string, MotionP
202
204
  element: HTMLElement;
203
205
  } & MotionParams) => PresenceMotion;
204
206
 
207
+ export declare function presenceMotionSlot<MotionParams extends Record<string, MotionParam> = {}>(motion: PresenceMotionSlotProps<MotionParams> | null | undefined, options: {
208
+ elementType: React_2.FC<PresenceComponentProps & MotionParams>;
209
+ defaultProps: PresenceMotionSlotRenderProps & MotionParams;
210
+ }): SlotComponentType<PresenceMotionSlotRenderProps & MotionParams>;
211
+
212
+ export declare type PresenceMotionSlotProps<MotionParams extends Record<string, MotionParam> = {}> = Pick<PresenceComponentProps, 'imperativeRef' | 'onMotionFinish' | 'onMotionStart'> & {
213
+ /**
214
+ * @deprecated Do not use. Presence Motion Slots do not support intrinsic elements.
215
+ *
216
+ * If you want to override the animation, use the children render function instead.
217
+ */
218
+ as?: keyof JSX.IntrinsicElements;
219
+ children?: SlotRenderFunction<PresenceMotionSlotRenderProps & MotionParams & {
220
+ children: React_2.ReactElement;
221
+ }>;
222
+ };
223
+
224
+ /**
225
+ * @internal
226
+ */
227
+ declare type PresenceMotionSlotRenderProps = Pick<PresenceComponentProps, 'appear' | 'onMotionFinish' | 'onMotionStart' | 'unmountOnExit' | 'visible'>;
228
+
205
229
  /**
206
230
  * @internal
207
231
  *
package/lib/index.js CHANGED
@@ -3,3 +3,4 @@ export { createMotionComponent } from './factories/createMotionComponent';
3
3
  export { createPresenceComponent } from './factories/createPresenceComponent';
4
4
  export { createPresenceComponentVariant } from './factories/createPresenceComponentVariant';
5
5
  export { PresenceGroup } from './components/PresenceGroup';
6
+ export { presenceMotionSlot } from './slots/presenceMotionSlot';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export { motionTokens, durations, curves } from './motions/motionTokens';\n\nexport { createMotionComponent, type MotionComponentProps } from './factories/createMotionComponent';\nexport {\n createPresenceComponent,\n type PresenceComponentProps,\n type PresenceComponent,\n} from './factories/createPresenceComponent';\nexport { createPresenceComponentVariant } from './factories/createPresenceComponentVariant';\n\nexport { PresenceGroup } from './components/PresenceGroup';\n\nexport type {\n AtomMotion,\n AtomMotionFn,\n PresenceMotion,\n PresenceMotionFn,\n PresenceDirection,\n MotionImperativeRef,\n} from './types';\n"],"names":["motionTokens","durations","curves","createMotionComponent","createPresenceComponent","createPresenceComponentVariant","PresenceGroup"],"rangeMappings":";;;;","mappings":"AAAA,SAASA,YAAY,EAAEC,SAAS,EAAEC,MAAM,QAAQ,yBAAyB;AAEzE,SAASC,qBAAqB,QAAmC,oCAAoC;AACrG,SACEC,uBAAuB,QAGlB,sCAAsC;AAC7C,SAASC,8BAA8B,QAAQ,6CAA6C;AAE5F,SAASC,aAAa,QAAQ,6BAA6B"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export { motionTokens, durations, curves } from './motions/motionTokens';\n\nexport { createMotionComponent, type MotionComponentProps } from './factories/createMotionComponent';\nexport {\n createPresenceComponent,\n type PresenceComponentProps,\n type PresenceComponent,\n} from './factories/createPresenceComponent';\nexport { createPresenceComponentVariant } from './factories/createPresenceComponentVariant';\n\nexport { PresenceGroup } from './components/PresenceGroup';\n\nexport { presenceMotionSlot, type PresenceMotionSlotProps } from './slots/presenceMotionSlot';\n\nexport type {\n AtomMotion,\n AtomMotionFn,\n PresenceMotion,\n PresenceMotionFn,\n PresenceDirection,\n MotionImperativeRef,\n} from './types';\n"],"names":["motionTokens","durations","curves","createMotionComponent","createPresenceComponent","createPresenceComponentVariant","PresenceGroup","presenceMotionSlot"],"rangeMappings":";;;;;","mappings":"AAAA,SAASA,YAAY,EAAEC,SAAS,EAAEC,MAAM,QAAQ,yBAAyB;AAEzE,SAASC,qBAAqB,QAAmC,oCAAoC;AACrG,SACEC,uBAAuB,QAGlB,sCAAsC;AAC7C,SAASC,8BAA8B,QAAQ,6CAA6C;AAE5F,SAASC,aAAa,QAAQ,6BAA6B;AAE3D,SAASC,kBAAkB,QAAsC,6BAA6B"}
@@ -0,0 +1,40 @@
1
+ import { SLOT_ELEMENT_TYPE_SYMBOL, SLOT_RENDER_FUNCTION_SYMBOL } from '@fluentui/react-utilities';
2
+ import * as React from 'react';
3
+ export function presenceMotionSlot(motion, options) {
4
+ // eslint-disable-next-line deprecation/deprecation
5
+ const { as, children, ...rest } = motion !== null && motion !== void 0 ? motion : {};
6
+ if (process.env.NODE_ENV !== 'production') {
7
+ if (typeof as !== 'undefined') {
8
+ throw new Error(`@fluentui/react-motion: "as" property is not supported on motion slots.`);
9
+ }
10
+ }
11
+ if (motion === null) {
12
+ // Heads up!
13
+ // Render function is used there to avoid rendering a motion component and handle unmounting logic
14
+ const isUnmounted = !options.defaultProps.visible && options.defaultProps.unmountOnExit;
15
+ const renderFn = (_, props)=>isUnmounted ? null : /*#__PURE__*/ React.createElement(React.Fragment, null, props.children);
16
+ /**
17
+ * Casting is required here as SlotComponentType is a function, not an object.
18
+ * Although SlotComponentType has a function signature, it is still just an object.
19
+ * This is required to make a slot callable (JSX compatible), this is the exact same approach
20
+ * that is used on `@types/react` components
21
+ */ return {
22
+ [SLOT_RENDER_FUNCTION_SYMBOL]: renderFn,
23
+ [SLOT_ELEMENT_TYPE_SYMBOL]: options.elementType
24
+ };
25
+ }
26
+ /**
27
+ * Casting is required here as SlotComponentType is a function, not an object.
28
+ * Although SlotComponentType has a function signature, it is still just an object.
29
+ * This is required to make a slot callable (JSX compatible), this is the exact same approach
30
+ * that is used on `@types/react` components
31
+ */ const propsWithMetadata = {
32
+ ...options.defaultProps,
33
+ ...rest,
34
+ [SLOT_ELEMENT_TYPE_SYMBOL]: options.elementType
35
+ };
36
+ if (typeof children === 'function') {
37
+ propsWithMetadata[SLOT_RENDER_FUNCTION_SYMBOL] = children;
38
+ }
39
+ return propsWithMetadata;
40
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["presenceMotionSlot.tsx"],"sourcesContent":["import {\n SLOT_ELEMENT_TYPE_SYMBOL,\n SLOT_RENDER_FUNCTION_SYMBOL,\n type SlotComponentType,\n type SlotRenderFunction,\n} from '@fluentui/react-utilities';\nimport * as React from 'react';\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 // 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?: keyof JSX.IntrinsicElements;\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: React.ReactElement }>;\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 deprecation/deprecation\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<\n PresenceMotionSlotRenderProps & MotionParams & { children: React.ReactElement }\n > = (_, props) => (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":["SLOT_ELEMENT_TYPE_SYMBOL","SLOT_RENDER_FUNCTION_SYMBOL","React","presenceMotionSlot","motion","options","as","children","rest","process","env","NODE_ENV","Error","isUnmounted","defaultProps","visible","unmountOnExit","renderFn","_","props","elementType","propsWithMetadata"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SACEA,wBAAwB,EACxBC,2BAA2B,QAGtB,4BAA4B;AACnC,YAAYC,WAAW,QAAQ;AA+B/B,OAAO,SAASC,mBACdC,MAAgE,EAChEC,OAGC;IAED,mDAAmD;IACnD,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,WAEF,CAACC,GAAGC,QAAWN,cAAc,qBAAO,0CAAGM,MAAMZ,QAAQ;QAEzD;;;;;KAKC,GACD,OAAO;YACL,CAACN,4BAA4B,EAAEgB;YAC/B,CAACjB,yBAAyB,EAAEK,QAAQe,WAAW;QACjD;IACF;IAEA;;;;;GAKC,GACD,MAAMC,oBAAoB;QACxB,GAAGhB,QAAQS,YAAY;QACvB,GAAGN,IAAI;QACP,CAACR,yBAAyB,EAAEK,QAAQe,WAAW;IACjD;IAEA,IAAI,OAAOb,aAAa,YAAY;QAClCc,iBAAiB,CAACpB,4BAA4B,GAAGM;IAGnD;IAEA,OAAOc;AACT"}
@@ -29,6 +29,9 @@ _export(exports, {
29
29
  },
30
30
  motionTokens: function() {
31
31
  return _motionTokens.motionTokens;
32
+ },
33
+ presenceMotionSlot: function() {
34
+ return _presenceMotionSlot.presenceMotionSlot;
32
35
  }
33
36
  });
34
37
  const _motionTokens = require("./motions/motionTokens");
@@ -36,3 +39,4 @@ const _createMotionComponent = require("./factories/createMotionComponent");
36
39
  const _createPresenceComponent = require("./factories/createPresenceComponent");
37
40
  const _createPresenceComponentVariant = require("./factories/createPresenceComponentVariant");
38
41
  const _PresenceGroup = require("./components/PresenceGroup");
42
+ const _presenceMotionSlot = require("./slots/presenceMotionSlot");
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export { motionTokens, durations, curves } from './motions/motionTokens';\n\nexport { createMotionComponent, type MotionComponentProps } from './factories/createMotionComponent';\nexport {\n createPresenceComponent,\n type PresenceComponentProps,\n type PresenceComponent,\n} from './factories/createPresenceComponent';\nexport { createPresenceComponentVariant } from './factories/createPresenceComponentVariant';\n\nexport { PresenceGroup } from './components/PresenceGroup';\n\nexport type {\n AtomMotion,\n AtomMotionFn,\n PresenceMotion,\n PresenceMotionFn,\n PresenceDirection,\n MotionImperativeRef,\n} from './types';\n"],"names":["PresenceGroup","createMotionComponent","createPresenceComponent","createPresenceComponentVariant","curves","durations","motionTokens"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAUSA,aAAa;eAAbA,4BAAa;;IARbC,qBAAqB;eAArBA,4CAAqB;;IAE5BC,uBAAuB;eAAvBA,gDAAuB;;IAIhBC,8BAA8B;eAA9BA,8DAA8B;;IARLC,MAAM;eAANA,oBAAM;;IAAjBC,SAAS;eAATA,uBAAS;;IAAvBC,YAAY;eAAZA,0BAAY;;;8BAA2B;uCAEiB;yCAK1D;gDACwC;+BAEjB"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export { motionTokens, durations, curves } from './motions/motionTokens';\n\nexport { createMotionComponent, type MotionComponentProps } from './factories/createMotionComponent';\nexport {\n createPresenceComponent,\n type PresenceComponentProps,\n type PresenceComponent,\n} from './factories/createPresenceComponent';\nexport { createPresenceComponentVariant } from './factories/createPresenceComponentVariant';\n\nexport { PresenceGroup } from './components/PresenceGroup';\n\nexport { presenceMotionSlot, type PresenceMotionSlotProps } from './slots/presenceMotionSlot';\n\nexport type {\n AtomMotion,\n AtomMotionFn,\n PresenceMotion,\n PresenceMotionFn,\n PresenceDirection,\n MotionImperativeRef,\n} from './types';\n"],"names":["PresenceGroup","createMotionComponent","createPresenceComponent","createPresenceComponentVariant","curves","durations","motionTokens","presenceMotionSlot"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAUSA,aAAa;eAAbA,4BAAa;;IARbC,qBAAqB;eAArBA,4CAAqB;;IAE5BC,uBAAuB;eAAvBA,gDAAuB;;IAIhBC,8BAA8B;eAA9BA,8DAA8B;;IARLC,MAAM;eAANA,oBAAM;;IAAjBC,SAAS;eAATA,uBAAS;;IAAvBC,YAAY;eAAZA,0BAAY;;IAYZC,kBAAkB;eAAlBA,sCAAkB;;;8BAZqB;uCAEiB;yCAK1D;gDACwC;+BAEjB;oCAEmC"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "presenceMotionSlot", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return presenceMotionSlot;
9
+ }
10
+ });
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _reactutilities = require("@fluentui/react-utilities");
13
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
14
+ function presenceMotionSlot(motion, options) {
15
+ // eslint-disable-next-line deprecation/deprecation
16
+ const { as, children, ...rest } = motion !== null && motion !== void 0 ? motion : {};
17
+ if (process.env.NODE_ENV !== 'production') {
18
+ if (typeof as !== 'undefined') {
19
+ throw new Error(`@fluentui/react-motion: "as" property is not supported on motion slots.`);
20
+ }
21
+ }
22
+ if (motion === null) {
23
+ // Heads up!
24
+ // Render function is used there to avoid rendering a motion component and handle unmounting logic
25
+ const isUnmounted = !options.defaultProps.visible && options.defaultProps.unmountOnExit;
26
+ const renderFn = (_, props)=>isUnmounted ? null : /*#__PURE__*/ _react.createElement(_react.Fragment, null, props.children);
27
+ /**
28
+ * Casting is required here as SlotComponentType is a function, not an object.
29
+ * Although SlotComponentType has a function signature, it is still just an object.
30
+ * This is required to make a slot callable (JSX compatible), this is the exact same approach
31
+ * that is used on `@types/react` components
32
+ */ return {
33
+ [_reactutilities.SLOT_RENDER_FUNCTION_SYMBOL]: renderFn,
34
+ [_reactutilities.SLOT_ELEMENT_TYPE_SYMBOL]: options.elementType
35
+ };
36
+ }
37
+ /**
38
+ * Casting is required here as SlotComponentType is a function, not an object.
39
+ * Although SlotComponentType has a function signature, it is still just an object.
40
+ * This is required to make a slot callable (JSX compatible), this is the exact same approach
41
+ * that is used on `@types/react` components
42
+ */ const propsWithMetadata = {
43
+ ...options.defaultProps,
44
+ ...rest,
45
+ [_reactutilities.SLOT_ELEMENT_TYPE_SYMBOL]: options.elementType
46
+ };
47
+ if (typeof children === 'function') {
48
+ propsWithMetadata[_reactutilities.SLOT_RENDER_FUNCTION_SYMBOL] = children;
49
+ }
50
+ return propsWithMetadata;
51
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["presenceMotionSlot.tsx"],"sourcesContent":["import {\n SLOT_ELEMENT_TYPE_SYMBOL,\n SLOT_RENDER_FUNCTION_SYMBOL,\n type SlotComponentType,\n type SlotRenderFunction,\n} from '@fluentui/react-utilities';\nimport * as React from 'react';\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 // 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?: keyof JSX.IntrinsicElements;\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: React.ReactElement }>;\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 deprecation/deprecation\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<\n PresenceMotionSlotRenderProps & MotionParams & { children: React.ReactElement }\n > = (_, props) => (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","React","createElement","Fragment","SLOT_RENDER_FUNCTION_SYMBOL","SLOT_ELEMENT_TYPE_SYMBOL","elementType","propsWithMetadata"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAqCgBA;;;eAAAA;;;;gCAhCT;iEACgB;AA+BhB,SAASA,mBACdC,MAAgE,EAChEC,OAGC;IAED,mDAAmD;IACnD,MAAM,EAAEC,EAAE,EAAEC,QAAQ,EAAE,GAAGC,MAAM,GAAGJ,WAAAA,QAAAA,WAAAA,KAAAA,IAAAA,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,WAEF,CAACC,GAAGC,QAAWN,cAAc,OAAA,WAAA,GAAOO,OAAAC,aAAA,CAAAD,OAAAE,QAAA,EAAA,MAAGH,MAAMZ,QAAQ;QAEzD;;;;;KAKC,GACD,OAAO;YACL,CAACgB,2CAAAA,CAA4B,EAAEN;YAC/B,CAACO,wCAAAA,CAAyB,EAAEnB,QAAQoB,WAAW;QACjD;IACF;IAEA;;;;;GAKC,GACD,MAAMC,oBAAoB;QACxB,GAAGrB,QAAQS,YAAY;QACvB,GAAGN,IAAI;QACP,CAACgB,wCAAAA,CAAyB,EAAEnB,QAAQoB,WAAW;IACjD;IAEA,IAAI,OAAOlB,aAAa,YAAY;QAClCmB,iBAAiB,CAACH,2CAAAA,CAA4B,GAAGhB;IAGnD;IAEA,OAAOmB;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-motion",
3
- "version": "0.0.0-nightly-20240717-1138.1",
3
+ "version": "0.0.0-nightly-20240718-0406.1",
4
4
  "description": "A package with utilities & motion definitions using Web Animations API",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -32,15 +32,15 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@fluentui/eslint-plugin": "*",
35
- "@fluentui/react-conformance": "0.0.0-nightly-20240717-1138.1",
36
- "@fluentui/react-conformance-griffel": "0.0.0-nightly-20240717-1138.1",
35
+ "@fluentui/react-conformance": "0.0.0-nightly-20240718-0406.1",
36
+ "@fluentui/react-conformance-griffel": "0.0.0-nightly-20240718-0406.1",
37
37
  "@fluentui/scripts-api-extractor": "*",
38
38
  "@fluentui/scripts-tasks": "*",
39
39
  "@fluentui/scripts-cypress": "*"
40
40
  },
41
41
  "dependencies": {
42
- "@fluentui/react-shared-contexts": "0.0.0-nightly-20240717-1138.1",
43
- "@fluentui/react-utilities": "0.0.0-nightly-20240717-1138.1",
42
+ "@fluentui/react-shared-contexts": "0.0.0-nightly-20240718-0406.1",
43
+ "@fluentui/react-utilities": "0.0.0-nightly-20240718-0406.1",
44
44
  "@swc/helpers": "^0.5.1",
45
45
  "react-is": "^17.0.2"
46
46
  },