@fluentui/react-drawer 9.5.5 → 9.5.7

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 (63) hide show
  1. package/CHANGELOG.md +26 -2
  2. package/dist/index.d.ts +22 -8
  3. package/lib/components/Drawer/Drawer.types.js.map +1 -1
  4. package/lib/components/Drawer/useDrawer.js +8 -6
  5. package/lib/components/Drawer/useDrawer.js.map +1 -1
  6. package/lib/components/InlineDrawer/InlineDrawer.types.js.map +1 -1
  7. package/lib/components/InlineDrawer/renderInlineDrawer.js +3 -4
  8. package/lib/components/InlineDrawer/renderInlineDrawer.js.map +1 -1
  9. package/lib/components/InlineDrawer/useInlineDrawer.js +31 -9
  10. package/lib/components/InlineDrawer/useInlineDrawer.js.map +1 -1
  11. package/lib/components/InlineDrawer/useInlineDrawerStyles.styles.js +4 -24
  12. package/lib/components/InlineDrawer/useInlineDrawerStyles.styles.js.map +1 -1
  13. package/lib/components/OverlayDrawer/OverlayDrawer.types.js.map +1 -1
  14. package/lib/components/OverlayDrawer/OverlayDrawerSurface/OverlayDrawerSurface.types.js.map +1 -1
  15. package/lib/components/OverlayDrawer/OverlayDrawerSurface/useOverlayDrawerSurfaceStyles.styles.js +0 -4
  16. package/lib/components/OverlayDrawer/OverlayDrawerSurface/useOverlayDrawerSurfaceStyles.styles.js.map +1 -1
  17. package/lib/components/OverlayDrawer/renderOverlayDrawer.js +0 -3
  18. package/lib/components/OverlayDrawer/renderOverlayDrawer.js.map +1 -1
  19. package/lib/components/OverlayDrawer/useOverlayDrawer.js +24 -10
  20. package/lib/components/OverlayDrawer/useOverlayDrawer.js.map +1 -1
  21. package/lib/components/OverlayDrawer/useOverlayDrawerStyles.styles.js +6 -47
  22. package/lib/components/OverlayDrawer/useOverlayDrawerStyles.styles.js.map +1 -1
  23. package/lib/e2e/DrawerShared.js.map +1 -1
  24. package/lib/shared/DrawerBase.types.js.map +1 -1
  25. package/lib/shared/drawerMotionUtils.js +24 -0
  26. package/lib/shared/drawerMotionUtils.js.map +1 -0
  27. package/lib/shared/drawerMotions.js +112 -0
  28. package/lib/shared/drawerMotions.js.map +1 -0
  29. package/lib/shared/useDrawerBaseStyles.styles.js +4 -34
  30. package/lib/shared/useDrawerBaseStyles.styles.js.map +1 -1
  31. package/lib-commonjs/components/Drawer/Drawer.types.js.map +1 -1
  32. package/lib-commonjs/components/Drawer/useDrawer.js +8 -6
  33. package/lib-commonjs/components/Drawer/useDrawer.js.map +1 -1
  34. package/lib-commonjs/components/InlineDrawer/InlineDrawer.types.js.map +1 -1
  35. package/lib-commonjs/components/InlineDrawer/renderInlineDrawer.js +3 -4
  36. package/lib-commonjs/components/InlineDrawer/renderInlineDrawer.js.map +1 -1
  37. package/lib-commonjs/components/InlineDrawer/useInlineDrawer.js +31 -9
  38. package/lib-commonjs/components/InlineDrawer/useInlineDrawer.js.map +1 -1
  39. package/lib-commonjs/components/InlineDrawer/useInlineDrawerStyles.styles.js +3 -32
  40. package/lib-commonjs/components/InlineDrawer/useInlineDrawerStyles.styles.js.map +1 -1
  41. package/lib-commonjs/components/OverlayDrawer/OverlayDrawer.types.js.map +1 -1
  42. package/lib-commonjs/components/OverlayDrawer/OverlayDrawerSurface/OverlayDrawerSurface.types.js.map +1 -1
  43. package/lib-commonjs/components/OverlayDrawer/OverlayDrawerSurface/useOverlayDrawerSurfaceStyles.styles.js +3 -15
  44. package/lib-commonjs/components/OverlayDrawer/OverlayDrawerSurface/useOverlayDrawerSurfaceStyles.styles.js.map +1 -1
  45. package/lib-commonjs/components/OverlayDrawer/renderOverlayDrawer.js +0 -3
  46. package/lib-commonjs/components/OverlayDrawer/renderOverlayDrawer.js.map +1 -1
  47. package/lib-commonjs/components/OverlayDrawer/useOverlayDrawer.js +24 -10
  48. package/lib-commonjs/components/OverlayDrawer/useOverlayDrawer.js.map +1 -1
  49. package/lib-commonjs/components/OverlayDrawer/useOverlayDrawerStyles.styles.js +4 -60
  50. package/lib-commonjs/components/OverlayDrawer/useOverlayDrawerStyles.styles.js.map +1 -1
  51. package/lib-commonjs/e2e/DrawerShared.js.map +1 -1
  52. package/lib-commonjs/shared/DrawerBase.types.js.map +1 -1
  53. package/lib-commonjs/shared/drawerMotionUtils.js +32 -0
  54. package/lib-commonjs/shared/drawerMotionUtils.js.map +1 -0
  55. package/lib-commonjs/shared/drawerMotions.js +127 -0
  56. package/lib-commonjs/shared/drawerMotions.js.map +1 -0
  57. package/lib-commonjs/shared/useDrawerBaseStyles.styles.js +2 -46
  58. package/lib-commonjs/shared/useDrawerBaseStyles.styles.js.map +1 -1
  59. package/package.json +7 -7
  60. package/lib/components/OverlayDrawer/OverlayDrawerDialog.js +0 -22
  61. package/lib/components/OverlayDrawer/OverlayDrawerDialog.js.map +0 -1
  62. package/lib-commonjs/components/OverlayDrawer/OverlayDrawerDialog.js +0 -28
  63. package/lib-commonjs/components/OverlayDrawer/OverlayDrawerDialog.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,12 +1,36 @@
1
1
  # Change Log - @fluentui/react-drawer
2
2
 
3
- This log was last generated on Mon, 15 Jul 2024 17:20:12 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 30 Jul 2024 18:45:07 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.5.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-drawer_v9.5.7)
8
+
9
+ Tue, 30 Jul 2024 18:45:07 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-drawer_v9.5.6..@fluentui/react-drawer_v9.5.7)
11
+
12
+ ### Patches
13
+
14
+ - chore: migrate to stable motion APIs ([PR #31668](https://github.com/microsoft/fluentui/pull/31668) by olfedias@microsoft.com)
15
+ - Bump @fluentui/react-dialog to v9.11.7 ([PR #32157](https://github.com/microsoft/fluentui/pull/32157) by beachball)
16
+
17
+ ## [9.5.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-drawer_v9.5.6)
18
+
19
+ Tue, 23 Jul 2024 20:13:14 GMT
20
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-drawer_v9.5.5..@fluentui/react-drawer_v9.5.6)
21
+
22
+ ### Patches
23
+
24
+ - Bump @fluentui/react-dialog to v9.11.6 ([PR #32067](https://github.com/microsoft/fluentui/pull/32067) by beachball)
25
+ - Bump @fluentui/react-jsx-runtime to v9.0.42 ([PR #32067](https://github.com/microsoft/fluentui/pull/32067) by beachball)
26
+ - Bump @fluentui/react-motion-preview to v0.5.25 ([PR #32067](https://github.com/microsoft/fluentui/pull/32067) by beachball)
27
+ - Bump @fluentui/react-shared-contexts to v9.20.0 ([PR #32067](https://github.com/microsoft/fluentui/pull/32067) by beachball)
28
+ - Bump @fluentui/react-tabster to v9.22.3 ([PR #32067](https://github.com/microsoft/fluentui/pull/32067) by beachball)
29
+ - Bump @fluentui/react-utilities to v9.18.13 ([PR #32067](https://github.com/microsoft/fluentui/pull/32067) by beachball)
30
+
7
31
  ## [9.5.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-drawer_v9.5.5)
8
32
 
9
- Mon, 15 Jul 2024 17:20:12 GMT
33
+ Mon, 15 Jul 2024 17:25:28 GMT
10
34
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-drawer_v9.5.4..@fluentui/react-drawer_v9.5.5)
11
35
 
12
36
  ### Patches
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ import type { DialogProps } from '@fluentui/react-dialog';
6
6
  import type { DialogSurfaceProps } from '@fluentui/react-dialog';
7
7
  import type { DialogSurfaceSlots } from '@fluentui/react-dialog';
8
8
  import type { ForwardRefComponent } from '@fluentui/react-utilities';
9
+ import type { PresenceMotionSlotProps } from '@fluentui/react-motion';
9
10
  import * as React_2 from 'react';
10
11
  import type { Slot } from '@fluentui/react-utilities';
11
12
  import type { SlotClassNames } from '@fluentui/react-utilities';
@@ -44,7 +45,11 @@ declare type DrawerBaseProps = {
44
45
  };
45
46
 
46
47
  declare type DrawerBaseState = Required<Pick<DrawerBaseProps, 'position' | 'size'>> & {
48
+ /**
49
+ * @deprecated Passed values will be static.
50
+ */
47
51
  motion: MotionState<HTMLElement>;
52
+ open?: boolean;
48
53
  };
49
54
 
50
55
  /**
@@ -173,6 +178,8 @@ export declare type DrawerHeaderTitleSlots = {
173
178
  */
174
179
  export declare type DrawerHeaderTitleState = ComponentState<DrawerHeaderTitleSlots>;
175
180
 
181
+ declare type DrawerMotionParams = Required<Pick<DrawerBaseProps, 'size' | 'position'>>;
182
+
176
183
  /**
177
184
  * Drawer Props
178
185
  */
@@ -192,7 +199,7 @@ export declare const DrawerProvider: React_2.Provider<DrawerContextValue | undef
192
199
 
193
200
  declare type DrawerScrollState = 'none' | 'top' | 'middle' | 'bottom';
194
201
 
195
- export declare type DrawerSlots = OverlayDrawerSlots | InlineDrawerSlots;
202
+ export declare type DrawerSlots = Pick<OverlayDrawerSlots, 'root'> | Pick<InlineDrawerSlots, 'root'>;
196
203
 
197
204
  /**
198
205
  * State used in rendering Drawer
@@ -205,7 +212,7 @@ export declare type DrawerState = ComponentState<DrawerSlots>;
205
212
  */
206
213
  export declare const InlineDrawer: ForwardRefComponent<InlineDrawerProps>;
207
214
 
208
- export declare const inlineDrawerClassNames: SlotClassNames<InlineDrawerSlots>;
215
+ export declare const inlineDrawerClassNames: SlotClassNames<Omit<InlineDrawerSlots, 'surfaceMotion'>>;
209
216
 
210
217
  /**
211
218
  * InlineDrawer Props
@@ -221,12 +228,13 @@ export declare type InlineDrawerProps = ComponentProps<InlineDrawerSlots> & Draw
221
228
 
222
229
  export declare type InlineDrawerSlots = {
223
230
  root: Slot<'div', 'aside'>;
231
+ surfaceMotion?: Slot<SurfaceMotionSlotProps>;
224
232
  };
225
233
 
226
234
  /**
227
235
  * State used in rendering InlineDrawer
228
236
  */
229
- export declare type InlineDrawerState = Required<ComponentState<InlineDrawerSlots> & DrawerBaseState & Pick<InlineDrawerProps, 'separator'>>;
237
+ export declare type InlineDrawerState = Required<ComponentState<NonNullable<InlineDrawerSlots>> & DrawerBaseState & Pick<InlineDrawerProps, 'separator'>>;
230
238
 
231
239
  declare type MotionState<Element extends HTMLElement = HTMLElement> = {
232
240
  /**
@@ -263,12 +271,12 @@ declare type MotionType = 'entering' | 'entered' | 'idle' | 'exiting' | 'exited'
263
271
  */
264
272
  export declare const OverlayDrawer: ForwardRefComponent<OverlayDrawerProps>;
265
273
 
266
- export declare const overlayDrawerClassNames: SlotClassNames<OverlayDrawerSurfaceSlots>;
274
+ export declare const overlayDrawerClassNames: SlotClassNames<Omit<OverlayDrawerSurfaceSlots, 'backdropMotion'>>;
267
275
 
268
276
  /**
269
277
  * OverlayDrawer internal slots for when using with composition API
270
278
  */
271
- declare type OverlayDrawerInternalSlots = OverlayDrawerSlots & {
279
+ declare type OverlayDrawerInternalSlots = Pick<OverlayDrawerSlots, 'root'> & {
272
280
  /**
273
281
  * Slot for the dialog component that wraps the drawer.
274
282
  */
@@ -294,6 +302,8 @@ export declare type OverlayDrawerSlots = {
294
302
  * Slot for the root element.
295
303
  */
296
304
  root: Slot<OverlayDrawerSurfaceProps>;
305
+ backdropMotion?: Slot<PresenceMotionSlotProps<OverlayDrawerSurfaceMotionParams>>;
306
+ surfaceMotion?: Slot<PresenceMotionSlotProps<DrawerMotionParams>>;
297
307
  };
298
308
 
299
309
  /**
@@ -301,6 +311,8 @@ export declare type OverlayDrawerSlots = {
301
311
  */
302
312
  export declare type OverlayDrawerState = ComponentState<OverlayDrawerInternalSlots> & Required<DrawerBaseState>;
303
313
 
314
+ declare type OverlayDrawerSurfaceMotionParams = Required<Pick<DrawerBaseProps, 'size'>>;
315
+
304
316
  /**
305
317
  * OverlayDrawerSurface Props
306
318
  */
@@ -309,7 +321,7 @@ declare type OverlayDrawerSurfaceProps = ComponentProps<OverlayDrawerSurfaceSlot
309
321
  /**
310
322
  * OverlayDrawerSurface slots
311
323
  */
312
- declare type OverlayDrawerSurfaceSlots = Pick<DialogSurfaceSlots, 'backdrop'> & {
324
+ declare type OverlayDrawerSurfaceSlots = Partial<Pick<DialogSurfaceSlots, 'backdrop' | 'backdropMotion'>> & {
313
325
  root: Slot<'div', 'aside'>;
314
326
  };
315
327
 
@@ -346,12 +358,14 @@ export declare const renderDrawerHeaderTitle_unstable: (state: DrawerHeaderTitle
346
358
  /**
347
359
  * Render the final JSX of InlineDrawer
348
360
  */
349
- export declare const renderInlineDrawer_unstable: (state: InlineDrawerState, contextValue: DrawerContextValue) => JSX.Element | null;
361
+ export declare const renderInlineDrawer_unstable: (state: InlineDrawerState, contextValue: DrawerContextValue) => JSX.Element;
350
362
 
351
363
  /**
352
364
  * Render the final JSX of OverlayDrawer
353
365
  */
354
- export declare const renderOverlayDrawer_unstable: (state: OverlayDrawerState, contextValue: DrawerContextValue) => JSX.Element | null;
366
+ export declare const renderOverlayDrawer_unstable: (state: OverlayDrawerState, contextValue: DrawerContextValue) => JSX.Element;
367
+
368
+ declare type SurfaceMotionSlotProps = PresenceMotionSlotProps<DrawerMotionParams>;
355
369
 
356
370
  /**
357
371
  * Create the state required to render Drawer.
@@ -1 +1 @@
1
- {"version":3,"sources":["Drawer.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\n\nimport type { OverlayDrawerProps, OverlayDrawerSlots } from '../OverlayDrawer';\nimport type { InlineDrawerProps, InlineDrawerSlots } from '../InlineDrawer';\n\nexport type DrawerSlots = OverlayDrawerSlots | InlineDrawerSlots;\n\n/**\n * Drawer Props\n */\nexport type DrawerProps = ComponentProps<DrawerSlots> & {\n /**\n * Type of the drawer.\n *\n * - 'overlay' - Drawer is hidden by default and can be opened by clicking on the trigger.\n * - 'inline' - Drawer is stacked with the content\n *\n * @default overlay\n */\n type?: 'inline' | 'overlay';\n} & (OverlayDrawerProps | InlineDrawerProps);\n\n/**\n * State used in rendering Drawer\n */\nexport type DrawerState = ComponentState<DrawerSlots>;\n"],"names":[],"rangeMappings":";;","mappings":"AAsBA;;CAEC,GACD,WAAsD"}
1
+ {"version":3,"sources":["Drawer.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\n\nimport type { OverlayDrawerProps, OverlayDrawerSlots } from '../OverlayDrawer';\nimport type { InlineDrawerProps, InlineDrawerSlots } from '../InlineDrawer';\n\nexport type DrawerSlots = Pick<OverlayDrawerSlots, 'root'> | Pick<InlineDrawerSlots, 'root'>;\n\n/**\n * Drawer Props\n */\nexport type DrawerProps = ComponentProps<DrawerSlots> & {\n /**\n * Type of the drawer.\n *\n * - 'overlay' - Drawer is hidden by default and can be opened by clicking on the trigger.\n * - 'inline' - Drawer is stacked with the content\n *\n * @default overlay\n */\n type?: 'inline' | 'overlay';\n} & (OverlayDrawerProps | InlineDrawerProps);\n\n/**\n * State used in rendering Drawer\n */\nexport type DrawerState = ComponentState<DrawerSlots>;\n"],"names":[],"rangeMappings":";;","mappings":"AAsBA;;CAEC,GACD,WAAsD"}
@@ -11,16 +11,18 @@ import { InlineDrawer } from '../InlineDrawer';
11
11
  * @param props - props from this instance of Drawer
12
12
  * @param ref - reference to root HTMLElement of Drawer
13
13
  */ export const useDrawer_unstable = (props, ref)=>{
14
+ // casting here to convert a union of functions to a single function with the union of parameters
14
15
  const elementType = props.type === 'inline' ? InlineDrawer : OverlayDrawer;
16
+ const root = slot.always({
17
+ ref,
18
+ ...props
19
+ }, {
20
+ elementType
21
+ });
15
22
  return {
16
23
  components: {
17
24
  root: elementType
18
25
  },
19
- root: slot.always({
20
- ref,
21
- ...props
22
- }, {
23
- elementType
24
- })
26
+ root
25
27
  };
26
28
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["useDrawer.ts"],"sourcesContent":["import * as React from 'react';\nimport { slot } from '@fluentui/react-utilities';\n\nimport type { DrawerProps, DrawerState } from './Drawer.types';\nimport { OverlayDrawer } from '../OverlayDrawer';\nimport { InlineDrawer } from '../InlineDrawer';\n\n/**\n * Create the state required to render Drawer.\n *\n * The returned state can be modified with hooks such as useDrawerStyles_unstable,\n * before being passed to renderDrawer_unstable.\n *\n * @param props - props from this instance of Drawer\n * @param ref - reference to root HTMLElement of Drawer\n */\nexport const useDrawer_unstable = (props: DrawerProps, ref: React.Ref<HTMLElement>): DrawerState => {\n const elementType = props.type === 'inline' ? InlineDrawer : OverlayDrawer;\n\n return {\n components: {\n root: elementType,\n },\n\n root: slot.always(\n {\n ref,\n ...props,\n },\n {\n elementType,\n },\n ),\n };\n};\n"],"names":["React","slot","OverlayDrawer","InlineDrawer","useDrawer_unstable","props","ref","elementType","type","components","root","always"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,QAAQ,4BAA4B;AAGjD,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,YAAY,QAAQ,kBAAkB;AAE/C;;;;;;;;CAQC,GACD,OAAO,MAAMC,qBAAqB,CAACC,OAAoBC;IACrD,MAAMC,cAAcF,MAAMG,IAAI,KAAK,WAAWL,eAAeD;IAE7D,OAAO;QACLO,YAAY;YACVC,MAAMH;QACR;QAEAG,MAAMT,KAAKU,MAAM,CACf;YACEL;YACA,GAAGD,KAAK;QACV,GACA;YACEE;QACF;IAEJ;AACF,EAAE"}
1
+ {"version":3,"sources":["useDrawer.ts"],"sourcesContent":["import * as React from 'react';\nimport { slot } from '@fluentui/react-utilities';\n\nimport type { DrawerProps, DrawerState } from './Drawer.types';\nimport { OverlayDrawer, type OverlayDrawerProps } from '../OverlayDrawer';\nimport { InlineDrawer, type InlineDrawerProps } from '../InlineDrawer';\n\n/**\n * Create the state required to render Drawer.\n *\n * The returned state can be modified with hooks such as useDrawerStyles_unstable,\n * before being passed to renderDrawer_unstable.\n *\n * @param props - props from this instance of Drawer\n * @param ref - reference to root HTMLElement of Drawer\n */\nexport const useDrawer_unstable = (props: DrawerProps, ref: React.Ref<HTMLElement>): DrawerState => {\n // casting here to convert a union of functions to a single function with the union of parameters\n const elementType = (props.type === 'inline' ? InlineDrawer : OverlayDrawer) as React.FC<\n InlineDrawerProps | OverlayDrawerProps\n >;\n const root: InlineDrawerProps | OverlayDrawerProps = slot.always({ ref, ...props }, { elementType });\n\n return {\n components: { root: elementType },\n root,\n };\n};\n"],"names":["React","slot","OverlayDrawer","InlineDrawer","useDrawer_unstable","props","ref","elementType","type","root","always","components"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,QAAQ,4BAA4B;AAGjD,SAASC,aAAa,QAAiC,mBAAmB;AAC1E,SAASC,YAAY,QAAgC,kBAAkB;AAEvE;;;;;;;;CAQC,GACD,OAAO,MAAMC,qBAAqB,CAACC,OAAoBC;IACrD,iGAAiG;IACjG,MAAMC,cAAeF,MAAMG,IAAI,KAAK,WAAWL,eAAeD;IAG9D,MAAMO,OAA+CR,KAAKS,MAAM,CAAC;QAAEJ;QAAK,GAAGD,KAAK;IAAC,GAAG;QAAEE;IAAY;IAElG,OAAO;QACLI,YAAY;YAAEF,MAAMF;QAAY;QAChCE;IACF;AACF,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["InlineDrawer.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nimport { DrawerBaseProps, DrawerBaseState } from '../../shared/DrawerBase.types';\n\nexport type InlineDrawerSlots = {\n root: Slot<'div', 'aside'>;\n};\n\n/**\n * InlineDrawer Props\n */\nexport type InlineDrawerProps = ComponentProps<InlineDrawerSlots> &\n DrawerBaseProps & {\n /**\n * Whether the drawer has a separator line.\n *\n * @default false\n */\n separator?: boolean;\n };\n\n/**\n * State used in rendering InlineDrawer\n */\nexport type InlineDrawerState = Required<\n ComponentState<InlineDrawerSlots> & DrawerBaseState & Pick<InlineDrawerProps, 'separator'>\n>;\n"],"names":[],"rangeMappings":";;","mappings":"AAqBA;;CAEC,GACD,WAEE"}
1
+ {"version":3,"sources":["InlineDrawer.types.ts"],"sourcesContent":["import type { PresenceMotionSlotProps } from '@fluentui/react-motion';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nimport type { DrawerMotionParams } from '../../shared/drawerMotions';\nimport type { DrawerBaseProps, DrawerBaseState } from '../../shared/DrawerBase.types';\n\nexport type SurfaceMotionSlotProps = PresenceMotionSlotProps<DrawerMotionParams>;\n\nexport type InlineDrawerSlots = {\n root: Slot<'div', 'aside'>;\n surfaceMotion?: Slot<SurfaceMotionSlotProps>;\n};\n\n/**\n * InlineDrawer Props\n */\nexport type InlineDrawerProps = ComponentProps<InlineDrawerSlots> &\n DrawerBaseProps & {\n /**\n * Whether the drawer has a separator line.\n *\n * @default false\n */\n separator?: boolean;\n };\n\n/**\n * State used in rendering InlineDrawer\n */\nexport type InlineDrawerState = Required<\n ComponentState<NonNullable<InlineDrawerSlots>> & DrawerBaseState & Pick<InlineDrawerProps, 'separator'>\n>;\n"],"names":[],"rangeMappings":";;","mappings":"AA0BA;;CAEC,GACD,WAEE"}
@@ -4,12 +4,11 @@ import { DrawerProvider } from '../../contexts/drawerContext';
4
4
  /**
5
5
  * Render the final JSX of InlineDrawer
6
6
  */ export const renderInlineDrawer_unstable = (state, contextValue)=>{
7
- if (!state.motion.canRender) {
8
- return null;
9
- }
10
7
  assertSlots(state);
11
8
  return /*#__PURE__*/ _jsx(DrawerProvider, {
12
9
  value: contextValue,
13
- children: /*#__PURE__*/ _jsx(state.root, {})
10
+ children: /*#__PURE__*/ _jsx(state.surfaceMotion, {
11
+ children: /*#__PURE__*/ _jsx(state.root, {})
12
+ })
14
13
  });
15
14
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["renderInlineDrawer.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { DrawerContextValue, DrawerProvider } from '../../contexts/drawerContext';\n\nimport type { InlineDrawerState, InlineDrawerSlots } from './InlineDrawer.types';\n\n/**\n * Render the final JSX of InlineDrawer\n */\nexport const renderInlineDrawer_unstable = (state: InlineDrawerState, contextValue: DrawerContextValue) => {\n if (!state.motion.canRender) {\n return null;\n }\n\n assertSlots<InlineDrawerSlots>(state);\n\n return (\n <DrawerProvider value={contextValue}>\n <state.root />\n </DrawerProvider>\n );\n};\n"],"names":["assertSlots","DrawerProvider","renderInlineDrawer_unstable","state","contextValue","motion","canRender","value","root"],"rangeMappings":";;;;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAA6BC,cAAc,QAAQ,+BAA+B;AAIlF;;CAEC,GACD,OAAO,MAAMC,8BAA8B,CAACC,OAA0BC;IACpE,IAAI,CAACD,MAAME,MAAM,CAACC,SAAS,EAAE;QAC3B,OAAO;IACT;IAEAN,YAA+BG;IAE/B,qBACE,KAACF;QAAeM,OAAOH;kBACrB,cAAA,KAACD,MAAMK,IAAI;;AAGjB,EAAE"}
1
+ {"version":3,"sources":["renderInlineDrawer.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { DrawerContextValue, DrawerProvider } from '../../contexts/drawerContext';\n\nimport type { InlineDrawerState, InlineDrawerSlots } from './InlineDrawer.types';\n\n/**\n * Render the final JSX of InlineDrawer\n */\nexport const renderInlineDrawer_unstable = (state: InlineDrawerState, contextValue: DrawerContextValue) => {\n assertSlots<InlineDrawerSlots>(state);\n\n return (\n <DrawerProvider value={contextValue}>\n <state.surfaceMotion>\n <state.root />\n </state.surfaceMotion>\n </DrawerProvider>\n );\n};\n"],"names":["assertSlots","DrawerProvider","renderInlineDrawer_unstable","state","contextValue","value","surfaceMotion","root"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAA6BC,cAAc,QAAQ,+BAA+B;AAIlF;;CAEC,GACD,OAAO,MAAMC,8BAA8B,CAACC,OAA0BC;IACpEJ,YAA+BG;IAE/B,qBACE,KAACF;QAAeI,OAAOD;kBACrB,cAAA,KAACD,MAAMG,aAAa;sBAClB,cAAA,KAACH,MAAMI,IAAI;;;AAInB,EAAE"}
@@ -1,7 +1,14 @@
1
+ import { presenceMotionSlot } from '@fluentui/react-motion';
2
+ import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
1
3
  import * as React from 'react';
2
- import { getIntrinsicElementProps, slot, useMergedRefs } from '@fluentui/react-utilities';
3
- import { useMotion } from '@fluentui/react-motion-preview';
4
+ import { InlineDrawerMotion } from '../../shared/drawerMotions';
4
5
  import { useDrawerDefaultProps } from '../../shared/useDrawerDefaultProps';
6
+ const STATIC_MOTION = {
7
+ active: true,
8
+ canRender: true,
9
+ ref: React.createRef(),
10
+ type: 'idle'
11
+ };
5
12
  /**
6
13
  * Create the state required to render InlineDrawer.
7
14
  *
@@ -12,21 +19,36 @@ import { useDrawerDefaultProps } from '../../shared/useDrawerDefaultProps';
12
19
  * @param ref - reference to root HTMLElement of InlineDrawer
13
20
  */ export const useInlineDrawer_unstable = (props, ref)=>{
14
21
  const { size, position, open } = useDrawerDefaultProps(props);
15
- const { separator = false } = props;
16
- const motion = useMotion(open);
17
- return {
22
+ const { separator = false, surfaceMotion } = props;
23
+ const state = {
18
24
  components: {
19
- root: 'div'
25
+ root: 'div',
26
+ // casting from internal type that has required properties
27
+ // to external type that only has optional properties
28
+ // converting to unknown first as both Function component signatures are not compatible
29
+ surfaceMotion: InlineDrawerMotion
20
30
  },
21
31
  root: slot.always(getIntrinsicElementProps('div', {
22
32
  ...props,
23
- ref: useMergedRefs(ref, motion.ref)
33
+ ref
24
34
  }), {
25
35
  elementType: 'div'
26
36
  }),
27
- size,
37
+ open,
28
38
  position,
39
+ size,
29
40
  separator,
30
- motion
41
+ surfaceMotion: presenceMotionSlot(surfaceMotion, {
42
+ elementType: InlineDrawerMotion,
43
+ defaultProps: {
44
+ position,
45
+ size,
46
+ visible: open,
47
+ unmountOnExit: true
48
+ }
49
+ }),
50
+ // Deprecated props
51
+ motion: STATIC_MOTION
31
52
  };
53
+ return state;
32
54
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["useInlineDrawer.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot, useMergedRefs } from '@fluentui/react-utilities';\nimport { useMotion } from '@fluentui/react-motion-preview';\n\nimport type { InlineDrawerProps, InlineDrawerState } from './InlineDrawer.types';\nimport { useDrawerDefaultProps } from '../../shared/useDrawerDefaultProps';\n\n/**\n * Create the state required to render InlineDrawer.\n *\n * The returned state can be modified with hooks such as useInlineDrawerStyles_unstable,\n * before being passed to renderInlineDrawer_unstable.\n *\n * @param props - props from this instance of InlineDrawer\n * @param ref - reference to root HTMLElement of InlineDrawer\n */\nexport const useInlineDrawer_unstable = (props: InlineDrawerProps, ref: React.Ref<HTMLElement>): InlineDrawerState => {\n const { size, position, open } = useDrawerDefaultProps(props);\n const { separator = false } = props;\n\n const motion = useMotion<HTMLElement>(open);\n\n return {\n components: {\n root: 'div',\n },\n\n root: slot.always(\n getIntrinsicElementProps('div', {\n ...props,\n ref: useMergedRefs(ref, motion.ref),\n }),\n { elementType: 'div' },\n ),\n\n size,\n position,\n separator,\n motion,\n };\n};\n"],"names":["React","getIntrinsicElementProps","slot","useMergedRefs","useMotion","useDrawerDefaultProps","useInlineDrawer_unstable","props","ref","size","position","open","separator","motion","components","root","always","elementType"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,IAAI,EAAEC,aAAa,QAAQ,4BAA4B;AAC1F,SAASC,SAAS,QAAQ,iCAAiC;AAG3D,SAASC,qBAAqB,QAAQ,qCAAqC;AAE3E;;;;;;;;CAQC,GACD,OAAO,MAAMC,2BAA2B,CAACC,OAA0BC;IACjE,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGN,sBAAsBE;IACvD,MAAM,EAAEK,YAAY,KAAK,EAAE,GAAGL;IAE9B,MAAMM,SAAST,UAAuBO;IAEtC,OAAO;QACLG,YAAY;YACVC,MAAM;QACR;QAEAA,MAAMb,KAAKc,MAAM,CACff,yBAAyB,OAAO;YAC9B,GAAGM,KAAK;YACRC,KAAKL,cAAcK,KAAKK,OAAOL,GAAG;QACpC,IACA;YAAES,aAAa;QAAM;QAGvBR;QACAC;QACAE;QACAC;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["useInlineDrawer.ts"],"sourcesContent":["import { presenceMotionSlot } from '@fluentui/react-motion';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nimport { type DrawerMotionParams, InlineDrawerMotion } from '../../shared/drawerMotions';\nimport { useDrawerDefaultProps } from '../../shared/useDrawerDefaultProps';\nimport type { InlineDrawerProps, InlineDrawerState, SurfaceMotionSlotProps } from './InlineDrawer.types';\n\nconst STATIC_MOTION = {\n active: true,\n canRender: true,\n ref: React.createRef<HTMLDivElement>(),\n type: 'idle' as const,\n};\n\n/**\n * Create the state required to render InlineDrawer.\n *\n * The returned state can be modified with hooks such as useInlineDrawerStyles_unstable,\n * before being passed to renderInlineDrawer_unstable.\n *\n * @param props - props from this instance of InlineDrawer\n * @param ref - reference to root HTMLElement of InlineDrawer\n */\nexport const useInlineDrawer_unstable = (props: InlineDrawerProps, ref: React.Ref<HTMLElement>): InlineDrawerState => {\n const { size, position, open } = useDrawerDefaultProps(props);\n const { separator = false, surfaceMotion } = props;\n\n const state: InlineDrawerState = {\n components: {\n root: 'div',\n // casting from internal type that has required properties\n // to external type that only has optional properties\n // converting to unknown first as both Function component signatures are not compatible\n surfaceMotion: InlineDrawerMotion as unknown as React.FC<SurfaceMotionSlotProps>,\n },\n\n root: slot.always(\n getIntrinsicElementProps('div', {\n ...props,\n ref,\n }),\n { elementType: 'div' },\n ),\n\n open,\n position,\n size,\n separator,\n surfaceMotion: presenceMotionSlot<DrawerMotionParams>(surfaceMotion, {\n elementType: InlineDrawerMotion,\n defaultProps: {\n position,\n size,\n visible: open,\n unmountOnExit: true,\n },\n }),\n\n // Deprecated props\n motion: STATIC_MOTION,\n };\n\n return state;\n};\n"],"names":["presenceMotionSlot","getIntrinsicElementProps","slot","React","InlineDrawerMotion","useDrawerDefaultProps","STATIC_MOTION","active","canRender","ref","createRef","type","useInlineDrawer_unstable","props","size","position","open","separator","surfaceMotion","state","components","root","always","elementType","defaultProps","visible","unmountOnExit","motion"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAC3E,YAAYC,WAAW,QAAQ;AAE/B,SAAkCC,kBAAkB,QAAQ,6BAA6B;AACzF,SAASC,qBAAqB,QAAQ,qCAAqC;AAG3E,MAAMC,gBAAgB;IACpBC,QAAQ;IACRC,WAAW;IACXC,KAAKN,MAAMO,SAAS;IACpBC,MAAM;AACR;AAEA;;;;;;;;CAQC,GACD,OAAO,MAAMC,2BAA2B,CAACC,OAA0BJ;IACjE,MAAM,EAAEK,IAAI,EAAEC,QAAQ,EAAEC,IAAI,EAAE,GAAGX,sBAAsBQ;IACvD,MAAM,EAAEI,YAAY,KAAK,EAAEC,aAAa,EAAE,GAAGL;IAE7C,MAAMM,QAA2B;QAC/BC,YAAY;YACVC,MAAM;YACN,0DAA0D;YAC1D,qDAAqD;YACrD,uFAAuF;YACvFH,eAAed;QACjB;QAEAiB,MAAMnB,KAAKoB,MAAM,CACfrB,yBAAyB,OAAO;YAC9B,GAAGY,KAAK;YACRJ;QACF,IACA;YAAEc,aAAa;QAAM;QAGvBP;QACAD;QACAD;QACAG;QACAC,eAAelB,mBAAuCkB,eAAe;YACnEK,aAAanB;YACboB,cAAc;gBACZT;gBACAD;gBACAW,SAAST;gBACTU,eAAe;YACjB;QACF;QAEA,mBAAmB;QACnBC,QAAQrB;IACV;IAEA,OAAOa;AACT,EAAE"}
@@ -1,7 +1,6 @@
1
1
  import { __resetStyles, __styles, mergeClasses } from '@griffel/react';
2
2
  import { tokens } from '@fluentui/react-theme';
3
3
  import { drawerCSSVars, drawerDefaultStyles, useDrawerBaseClassNames } from '../../shared/useDrawerBaseStyles.styles';
4
- import { useMotionClassNames } from '@fluentui/react-motion-preview';
5
4
  export const inlineDrawerClassNames = {
6
5
  root: 'fui-InlineDrawer'
7
6
  };
@@ -29,14 +28,9 @@ const useDrawerRootStyles = /*#__PURE__*/__styles({
29
28
  B4j52fo: 0,
30
29
  i8vvqc: "f1n3kblk"
31
30
  },
32
- start: {
33
- Bz10aip: "f1d8gkik"
34
- },
35
- end: {
36
- Bz10aip: "f1h1g6jt"
37
- },
31
+ start: {},
32
+ end: {},
38
33
  bottom: {
39
- Bz10aip: "f1rdfgt8",
40
34
  a9b677: "fly5x3f",
41
35
  Bqenvij: "fub80nq"
42
36
  }
@@ -51,20 +45,7 @@ const useDrawerRootStyles = /*#__PURE__*/__styles({
51
45
  p: -1
52
46
  }], [".f1n3kblk{border-top:1px solid var(--colorNeutralBackground3);}", {
53
47
  p: -1
54
- }], ".f1d8gkik{transform:translate3D(calc(var(--fui-Drawer--size) * -1), 0, 0);}", ".f1h1g6jt{transform:translate3D(var(--fui-Drawer--size), 0, 0);}", ".f1rdfgt8{transform:translate3D(0, var(--fui-Drawer--size), 0);}", ".fly5x3f{width:100%;}", ".fub80nq{height:var(--fui-Drawer--size);}"]
55
- });
56
- const useDrawerMotionStyles = /*#__PURE__*/__styles({
57
- "default": {
58
- abs64n: "fk73vx1",
59
- Bmy1vo4: "f15rjlgw",
60
- Es3by: "f1blt7p"
61
- },
62
- enter: {
63
- abs64n: "f5p0z4x",
64
- Bz10aip: "f87uvqx"
65
- }
66
- }, {
67
- d: [".fk73vx1{opacity:0;}", ".f15rjlgw{transition-property:opacity,transform;}", ".f1blt7p{will-change:opacity,transform;}", ".f5p0z4x{opacity:1;}", ".f87uvqx{transform:translate3D(0, 0, 0);}"]
48
+ }], ".fly5x3f{width:100%;}", ".fub80nq{height:var(--fui-Drawer--size);}"]
68
49
  });
69
50
  function getSeparatorClass(state, classNames) {
70
51
  if (!state.separator) {
@@ -90,8 +71,7 @@ export const useInlineDrawerStyles_unstable = state => {
90
71
  const resetStyles = useDrawerResetStyles();
91
72
  const baseClassNames = useDrawerBaseClassNames(state);
92
73
  const rootStyles = useDrawerRootStyles();
93
- const motionClassNames = useMotionClassNames(state.motion, useDrawerMotionStyles());
94
- state.root.className = mergeClasses(inlineDrawerClassNames.root, resetStyles, baseClassNames, getSeparatorClass(state, rootStyles), rootStyles[state.position], motionClassNames, state.root.className);
74
+ state.root.className = mergeClasses(inlineDrawerClassNames.root, resetStyles, baseClassNames, getSeparatorClass(state, rootStyles), rootStyles[state.position], state.root.className);
95
75
  return state;
96
76
  };
97
77
  //# sourceMappingURL=useInlineDrawerStyles.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__resetStyles","__styles","mergeClasses","tokens","drawerCSSVars","drawerDefaultStyles","useDrawerBaseClassNames","useMotionClassNames","inlineDrawerClassNames","root","useDrawerResetStyles","borderValue","colorNeutralBackground3","useDrawerRootStyles","separatorStart","h3c5rm","vrafjx","Bekrc4i","u1mtju","separatorEnd","zhjwy3","wvpqe5","ibv6hh","B4g9neb","separatorBottom","g2u3we","icvyot","B4j52fo","i8vvqc","start","Bz10aip","end","bottom","a9b677","Bqenvij","d","p","useDrawerMotionStyles","abs64n","Bmy1vo4","Es3by","enter","getSeparatorClass","state","classNames","separator","undefined","position","useInlineDrawerStyles_unstable","resetStyles","baseClassNames","rootStyles","motionClassNames","motion","className"],"sources":["useInlineDrawerStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { drawerCSSVars, drawerDefaultStyles, useDrawerBaseClassNames } from '../../shared/useDrawerBaseStyles.styles';\nimport { useMotionClassNames } from '@fluentui/react-motion-preview';\nexport const inlineDrawerClassNames = {\n root: 'fui-InlineDrawer'\n};\nconst useDrawerResetStyles = makeResetStyles({\n ...drawerDefaultStyles,\n position: 'relative'\n});\n/**\n * Styles for the root slot\n */ const borderValue = `1px solid ${tokens.colorNeutralBackground3}`;\nconst useDrawerRootStyles = makeStyles({\n /* Separator */ separatorStart: {\n borderRight: borderValue\n },\n separatorEnd: {\n borderLeft: borderValue\n },\n separatorBottom: {\n borderTop: borderValue\n },\n /* Positioning */ start: {\n transform: `translate3D(calc(var(${drawerCSSVars.drawerSizeVar}) * -1), 0, 0)`\n },\n end: {\n transform: `translate3D(var(${drawerCSSVars.drawerSizeVar}), 0, 0)`\n },\n bottom: {\n transform: `translate3D(0, var(${drawerCSSVars.drawerSizeVar}), 0)`,\n width: '100%',\n height: `var(${drawerCSSVars.drawerSizeVar})`\n }\n});\nconst useDrawerMotionStyles = makeStyles({\n default: {\n opacity: 0,\n transitionProperty: 'opacity, transform',\n willChange: 'opacity, transform'\n },\n enter: {\n opacity: 1,\n transform: 'translate3D(0, 0, 0)'\n }\n});\nfunction getSeparatorClass(state, classNames) {\n if (!state.separator) {\n return undefined;\n }\n switch(state.position){\n case 'start':\n return classNames.separatorStart;\n case 'end':\n return classNames.separatorEnd;\n case 'bottom':\n return classNames.separatorBottom;\n default:\n return undefined;\n }\n}\n/**\n * Apply styling to the InlineDrawer slots based on the state\n */ export const useInlineDrawerStyles_unstable = (state)=>{\n 'use no memo';\n const resetStyles = useDrawerResetStyles();\n const baseClassNames = useDrawerBaseClassNames(state);\n const rootStyles = useDrawerRootStyles();\n const motionClassNames = useMotionClassNames(state.motion, useDrawerMotionStyles());\n state.root.className = mergeClasses(inlineDrawerClassNames.root, resetStyles, baseClassNames, getSeparatorClass(state, rootStyles), rootStyles[state.position], motionClassNames, state.root.className);\n return state;\n};\n"],"mappings":"AAAA,SAAAA,aAAA,EAAAC,QAAA,EAAsCC,YAAY,QAAQ,gBAAgB;AAC1E,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,aAAa,EAAEC,mBAAmB,EAAEC,uBAAuB,QAAQ,yCAAyC;AACrH,SAASC,mBAAmB,QAAQ,gCAAgC;AACpE,OAAO,MAAMC,sBAAsB,GAAG;EAClCC,IAAI,EAAE;AACV,CAAC;AACD,MAAMC,oBAAoB,gBAAGV,aAAA,6UAG5B,CAAC;AACF;AACA;AACA;AAAI,MAAMW,WAAW,GAAG,aAAaR,MAAM,CAACS,uBAAuB,EAAE;AACrE,MAAMC,mBAAmB,gBAAGZ,QAAA;EAAAa,cAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;EAAA;EAAAC,YAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAC,eAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;EAAA;EAAAC,KAAA;IAAAC,OAAA;EAAA;EAAAC,GAAA;IAAAD,OAAA;EAAA;EAAAE,MAAA;IAAAF,OAAA;IAAAG,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;IAAAC,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;AAAA,CAqB3B,CAAC;AACF,MAAMC,qBAAqB,gBAAGpC,QAAA;EAAA;IAAAqC,MAAA;IAAAC,OAAA;IAAAC,KAAA;EAAA;EAAAC,KAAA;IAAAH,MAAA;IAAAR,OAAA;EAAA;AAAA;EAAAK,CAAA;AAAA,CAU7B,CAAC;AACF,SAASO,iBAAiBA,CAACC,KAAK,EAAEC,UAAU,EAAE;EAC1C,IAAI,CAACD,KAAK,CAACE,SAAS,EAAE;IAClB,OAAOC,SAAS;EACpB;EACA,QAAOH,KAAK,CAACI,QAAQ;IACjB,KAAK,OAAO;MACR,OAAOH,UAAU,CAAC9B,cAAc;IACpC,KAAK,KAAK;MACN,OAAO8B,UAAU,CAACzB,YAAY;IAClC,KAAK,QAAQ;MACT,OAAOyB,UAAU,CAACpB,eAAe;IACrC;MACI,OAAOsB,SAAS;EACxB;AACJ;AACA;AACA;AACA;AAAI,OAAO,MAAME,8BAA8B,GAAIL,KAAK,IAAG;EACvD,aAAa;;EACb,MAAMM,WAAW,GAAGvC,oBAAoB,CAAC,CAAC;EAC1C,MAAMwC,cAAc,GAAG5C,uBAAuB,CAACqC,KAAK,CAAC;EACrD,MAAMQ,UAAU,GAAGtC,mBAAmB,CAAC,CAAC;EACxC,MAAMuC,gBAAgB,GAAG7C,mBAAmB,CAACoC,KAAK,CAACU,MAAM,EAAEhB,qBAAqB,CAAC,CAAC,CAAC;EACnFM,KAAK,CAAClC,IAAI,CAAC6C,SAAS,GAAGpD,YAAY,CAACM,sBAAsB,CAACC,IAAI,EAAEwC,WAAW,EAAEC,cAAc,EAAER,iBAAiB,CAACC,KAAK,EAAEQ,UAAU,CAAC,EAAEA,UAAU,CAACR,KAAK,CAACI,QAAQ,CAAC,EAAEK,gBAAgB,EAAET,KAAK,CAAClC,IAAI,CAAC6C,SAAS,CAAC;EACvM,OAAOX,KAAK;AAChB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__resetStyles","__styles","mergeClasses","tokens","drawerCSSVars","drawerDefaultStyles","useDrawerBaseClassNames","inlineDrawerClassNames","root","useDrawerResetStyles","borderValue","colorNeutralBackground3","useDrawerRootStyles","separatorStart","h3c5rm","vrafjx","Bekrc4i","u1mtju","separatorEnd","zhjwy3","wvpqe5","ibv6hh","B4g9neb","separatorBottom","g2u3we","icvyot","B4j52fo","i8vvqc","start","end","bottom","a9b677","Bqenvij","d","p","getSeparatorClass","state","classNames","separator","undefined","position","useInlineDrawerStyles_unstable","resetStyles","baseClassNames","rootStyles","className"],"sources":["useInlineDrawerStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { drawerCSSVars, drawerDefaultStyles, useDrawerBaseClassNames } from '../../shared/useDrawerBaseStyles.styles';\nexport const inlineDrawerClassNames = {\n root: 'fui-InlineDrawer'\n};\nconst useDrawerResetStyles = makeResetStyles({\n ...drawerDefaultStyles,\n position: 'relative'\n});\n/**\n * Styles for the root slot\n */ const borderValue = `1px solid ${tokens.colorNeutralBackground3}`;\nconst useDrawerRootStyles = makeStyles({\n /* Separator */ separatorStart: {\n borderRight: borderValue\n },\n separatorEnd: {\n borderLeft: borderValue\n },\n separatorBottom: {\n borderTop: borderValue\n },\n /* Positioning */ start: {},\n end: {},\n bottom: {\n width: '100%',\n height: `var(${drawerCSSVars.drawerSizeVar})`\n }\n});\nfunction getSeparatorClass(state, classNames) {\n if (!state.separator) {\n return undefined;\n }\n switch(state.position){\n case 'start':\n return classNames.separatorStart;\n case 'end':\n return classNames.separatorEnd;\n case 'bottom':\n return classNames.separatorBottom;\n default:\n return undefined;\n }\n}\n/**\n * Apply styling to the InlineDrawer slots based on the state\n */ export const useInlineDrawerStyles_unstable = (state)=>{\n 'use no memo';\n const resetStyles = useDrawerResetStyles();\n const baseClassNames = useDrawerBaseClassNames(state);\n const rootStyles = useDrawerRootStyles();\n state.root.className = mergeClasses(inlineDrawerClassNames.root, resetStyles, baseClassNames, getSeparatorClass(state, rootStyles), rootStyles[state.position], state.root.className);\n return state;\n};\n"],"mappings":"AAAA,SAAAA,aAAA,EAAAC,QAAA,EAAsCC,YAAY,QAAQ,gBAAgB;AAC1E,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,aAAa,EAAEC,mBAAmB,EAAEC,uBAAuB,QAAQ,yCAAyC;AACrH,OAAO,MAAMC,sBAAsB,GAAG;EAClCC,IAAI,EAAE;AACV,CAAC;AACD,MAAMC,oBAAoB,gBAAGT,aAAA,6UAG5B,CAAC;AACF;AACA;AACA;AAAI,MAAMU,WAAW,GAAG,aAAaP,MAAM,CAACQ,uBAAuB,EAAE;AACrE,MAAMC,mBAAmB,gBAAGX,QAAA;EAAAY,cAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;EAAA;EAAAC,YAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAC,eAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;EAAA;EAAAC,KAAA;EAAAC,GAAA;EAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;IAAAC,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;AAAA,CAgB3B,CAAC;AACF,SAASC,iBAAiBA,CAACC,KAAK,EAAEC,UAAU,EAAE;EAC1C,IAAI,CAACD,KAAK,CAACE,SAAS,EAAE;IAClB,OAAOC,SAAS;EACpB;EACA,QAAOH,KAAK,CAACI,QAAQ;IACjB,KAAK,OAAO;MACR,OAAOH,UAAU,CAACxB,cAAc;IACpC,KAAK,KAAK;MACN,OAAOwB,UAAU,CAACnB,YAAY;IAClC,KAAK,QAAQ;MACT,OAAOmB,UAAU,CAACd,eAAe;IACrC;MACI,OAAOgB,SAAS;EACxB;AACJ;AACA;AACA;AACA;AAAI,OAAO,MAAME,8BAA8B,GAAIL,KAAK,IAAG;EACvD,aAAa;;EACb,MAAMM,WAAW,GAAGjC,oBAAoB,CAAC,CAAC;EAC1C,MAAMkC,cAAc,GAAGrC,uBAAuB,CAAC8B,KAAK,CAAC;EACrD,MAAMQ,UAAU,GAAGhC,mBAAmB,CAAC,CAAC;EACxCwB,KAAK,CAAC5B,IAAI,CAACqC,SAAS,GAAG3C,YAAY,CAACK,sBAAsB,CAACC,IAAI,EAAEkC,WAAW,EAAEC,cAAc,EAAER,iBAAiB,CAACC,KAAK,EAAEQ,UAAU,CAAC,EAAEA,UAAU,CAACR,KAAK,CAACI,QAAQ,CAAC,EAAEJ,KAAK,CAAC5B,IAAI,CAACqC,SAAS,CAAC;EACrL,OAAOT,KAAK;AAChB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["OverlayDrawer.types.ts"],"sourcesContent":["import type { DialogProps } from '@fluentui/react-dialog';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nimport type { DrawerBaseProps, DrawerBaseState } from '../../shared/DrawerBase.types';\nimport { OverlayDrawerSurfaceProps } from './OverlayDrawerSurface';\n\n/**\n * OverlayDrawer slots\n */\nexport type OverlayDrawerSlots = {\n /**\n * Slot for the root element.\n */\n root: Slot<OverlayDrawerSurfaceProps>;\n};\n\n/**\n * OverlayDrawer internal slots for when using with composition API\n */\nexport type OverlayDrawerInternalSlots = OverlayDrawerSlots & {\n /**\n * Slot for the dialog component that wraps the drawer.\n */\n dialog: Slot<DialogProps>;\n};\n\n/**\n * OverlayDrawer Props\n */\nexport type OverlayDrawerProps = ComponentProps<OverlayDrawerSlots> &\n Pick<DialogProps, 'modalType' | 'onOpenChange' | 'inertTrapFocus'> &\n DrawerBaseProps & {\n /**\n * @deprecated OverlayDrawer can work only as a controlled component\n * and does not support uncontrolled mode i.e. defaultOpen prop\n */\n defaultOpen?: boolean;\n };\n\n/**\n * State used in rendering OverlayDrawer\n */\nexport type OverlayDrawerState = ComponentState<OverlayDrawerInternalSlots> & Required<DrawerBaseState>;\n"],"names":[],"rangeMappings":";;","mappings":"AAuCA;;CAEC,GACD,WAAwG"}
1
+ {"version":3,"sources":["OverlayDrawer.types.ts"],"sourcesContent":["import type { DialogProps } from '@fluentui/react-dialog';\nimport type { PresenceMotionSlotProps } from '@fluentui/react-motion';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nimport type { DrawerMotionParams, OverlayDrawerSurfaceMotionParams } from '../../shared/drawerMotions';\nimport type { DrawerBaseProps, DrawerBaseState } from '../../shared/DrawerBase.types';\nimport type { OverlayDrawerSurfaceProps } from './OverlayDrawerSurface';\n\n/**\n * OverlayDrawer slots\n */\nexport type OverlayDrawerSlots = {\n /**\n * Slot for the root element.\n */\n root: Slot<OverlayDrawerSurfaceProps>;\n\n backdropMotion?: Slot<PresenceMotionSlotProps<OverlayDrawerSurfaceMotionParams>>;\n surfaceMotion?: Slot<PresenceMotionSlotProps<DrawerMotionParams>>;\n};\n\n/**\n * OverlayDrawer internal slots for when using with composition API\n */\nexport type OverlayDrawerInternalSlots = Pick<OverlayDrawerSlots, 'root'> & {\n /**\n * Slot for the dialog component that wraps the drawer.\n */\n dialog: Slot<DialogProps>;\n};\n\n/**\n * OverlayDrawer Props\n */\nexport type OverlayDrawerProps = ComponentProps<OverlayDrawerSlots> &\n Pick<DialogProps, 'modalType' | 'onOpenChange' | 'inertTrapFocus'> &\n DrawerBaseProps & {\n /**\n * @deprecated OverlayDrawer can work only as a controlled component\n * and does not support uncontrolled mode i.e. defaultOpen prop\n */\n defaultOpen?: boolean;\n };\n\n/**\n * State used in rendering OverlayDrawer\n */\nexport type OverlayDrawerState = ComponentState<OverlayDrawerInternalSlots> & Required<DrawerBaseState>;\n"],"names":[],"rangeMappings":";;","mappings":"AA4CA;;CAEC,GACD,WAAwG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["OverlayDrawerSurface.types.ts"],"sourcesContent":["import type { DialogSurfaceProps, DialogSurfaceSlots } from '@fluentui/react-dialog';\nimport type { ComponentProps, Slot } from '@fluentui/react-utilities';\n\n/**\n * OverlayDrawerSurface slots\n */\nexport type OverlayDrawerSurfaceSlots = Pick<DialogSurfaceSlots, 'backdrop'> & {\n root: Slot<'div', 'aside'>;\n};\n\n/**\n * OverlayDrawerSurface Props\n */\nexport type OverlayDrawerSurfaceProps = ComponentProps<OverlayDrawerSurfaceSlots> &\n Pick<DialogSurfaceProps, 'mountNode'>;\n"],"names":[],"rangeMappings":";;","mappings":"AAUA;;CAEC,GACD,WACwC"}
1
+ {"version":3,"sources":["OverlayDrawerSurface.types.ts"],"sourcesContent":["import type { DialogSurfaceProps, DialogSurfaceSlots } from '@fluentui/react-dialog';\nimport type { ComponentProps, Slot } from '@fluentui/react-utilities';\n\n/**\n * OverlayDrawerSurface slots\n */\nexport type OverlayDrawerSurfaceSlots = Partial<Pick<DialogSurfaceSlots, 'backdrop' | 'backdropMotion'>> & {\n root: Slot<'div', 'aside'>;\n};\n\n/**\n * OverlayDrawerSurface Props\n */\nexport type OverlayDrawerSurfaceProps = ComponentProps<OverlayDrawerSurfaceSlots> &\n Pick<DialogSurfaceProps, 'mountNode'>;\n"],"names":[],"rangeMappings":";;","mappings":"AAUA;;CAEC,GACD,WACwC"}
@@ -1,9 +1,5 @@
1
1
  import { __resetStyles, __styles, mergeClasses } from '@griffel/react';
2
2
  import { tokens } from '@fluentui/react-theme';
3
- export const OverlayDrawerSurfaceClassNames = {
4
- root: 'fui-OverlayDrawerSurface',
5
- backdrop: 'fui-OverlayDrawerSurface__backdrop'
6
- };
7
3
  /**
8
4
  * Styles for the backdrop slot
9
5
  */
@@ -1 +1 @@
1
- {"version":3,"names":["__resetStyles","__styles","mergeClasses","tokens","OverlayDrawerSurfaceClassNames","root","backdrop","useBackdropResetStyles","useBackdropStyles","nested","De3pzq","d","useOverlayDrawerSurfaceStyles_unstable","state","backdropResetStyles","backdropStyles","className","isNestedDialog"],"sources":["useOverlayDrawerSurfaceStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const OverlayDrawerSurfaceClassNames = {\n root: 'fui-OverlayDrawerSurface',\n backdrop: 'fui-OverlayDrawerSurface__backdrop'\n};\n/**\n * Styles for the backdrop slot\n */ const useBackdropResetStyles = makeResetStyles({\n inset: '0px',\n position: 'fixed',\n backgroundColor: 'rgba(0, 0, 0, 0.4)'\n});\nconst useBackdropStyles = makeStyles({\n nested: {\n backgroundColor: tokens.colorTransparentBackground\n }\n});\n/**\n * Apply styling to the OverlayDrawerSurface slots based on the state\n */ export const useOverlayDrawerSurfaceStyles_unstable = (state)=>{\n 'use no memo';\n const backdropResetStyles = useBackdropResetStyles();\n const backdropStyles = useBackdropStyles();\n if (state.backdrop) {\n state.backdrop.className = mergeClasses(backdropResetStyles, state.isNestedDialog && backdropStyles.nested, state.backdrop.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAAAA,aAAA,EAAAC,QAAA,EAAsCC,YAAY,QAAQ,gBAAgB;AAC1E,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,OAAO,MAAMC,8BAA8B,GAAG;EAC1CC,IAAI,EAAE,0BAA0B;EAChCC,QAAQ,EAAE;AACd,CAAC;AACD;AACA;AACA;AAAI,MAAMC,sBAAsB,gBAAGP,aAAA,6FAIlC,CAAC;AACF,MAAMQ,iBAAiB,gBAAGP,QAAA;EAAAQ,MAAA;IAAAC,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAIzB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,sCAAsC,GAAIC,KAAK,IAAG;EAC/D,aAAa;;EACb,MAAMC,mBAAmB,GAAGP,sBAAsB,CAAC,CAAC;EACpD,MAAMQ,cAAc,GAAGP,iBAAiB,CAAC,CAAC;EAC1C,IAAIK,KAAK,CAACP,QAAQ,EAAE;IAChBO,KAAK,CAACP,QAAQ,CAACU,SAAS,GAAGd,YAAY,CAACY,mBAAmB,EAAED,KAAK,CAACI,cAAc,IAAIF,cAAc,CAACN,MAAM,EAAEI,KAAK,CAACP,QAAQ,CAACU,SAAS,CAAC;EACzI;EACA,OAAOH,KAAK;AAChB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__resetStyles","__styles","mergeClasses","tokens","useBackdropResetStyles","useBackdropStyles","nested","De3pzq","d","useOverlayDrawerSurfaceStyles_unstable","state","backdropResetStyles","backdropStyles","backdrop","className","isNestedDialog"],"sources":["useOverlayDrawerSurfaceStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\n/**\n * Styles for the backdrop slot\n */ const useBackdropResetStyles = makeResetStyles({\n inset: '0px',\n position: 'fixed',\n backgroundColor: 'rgba(0, 0, 0, 0.4)'\n});\nconst useBackdropStyles = makeStyles({\n nested: {\n backgroundColor: tokens.colorTransparentBackground\n }\n});\n/**\n * Apply styling to the OverlayDrawerSurface slots based on the state\n */ export const useOverlayDrawerSurfaceStyles_unstable = (state)=>{\n 'use no memo';\n const backdropResetStyles = useBackdropResetStyles();\n const backdropStyles = useBackdropStyles();\n if (state.backdrop) {\n state.backdrop.className = mergeClasses(backdropResetStyles, state.isNestedDialog && backdropStyles.nested, state.backdrop.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAAAA,aAAA,EAAAC,QAAA,EAAsCC,YAAY,QAAQ,gBAAgB;AAC1E,SAASC,MAAM,QAAQ,uBAAuB;AAC9C;AACA;AACA;AAAI,MAAMC,sBAAsB,gBAAGJ,aAAA,6FAIlC,CAAC;AACF,MAAMK,iBAAiB,gBAAGJ,QAAA;EAAAK,MAAA;IAAAC,MAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAIzB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,sCAAsC,GAAIC,KAAK,IAAG;EAC/D,aAAa;;EACb,MAAMC,mBAAmB,GAAGP,sBAAsB,CAAC,CAAC;EACpD,MAAMQ,cAAc,GAAGP,iBAAiB,CAAC,CAAC;EAC1C,IAAIK,KAAK,CAACG,QAAQ,EAAE;IAChBH,KAAK,CAACG,QAAQ,CAACC,SAAS,GAAGZ,YAAY,CAACS,mBAAmB,EAAED,KAAK,CAACK,cAAc,IAAIH,cAAc,CAACN,MAAM,EAAEI,KAAK,CAACG,QAAQ,CAACC,SAAS,CAAC;EACzI;EACA,OAAOJ,KAAK;AAChB,CAAC","ignoreList":[]}
@@ -4,9 +4,6 @@ import { DrawerProvider } from '../../contexts/drawerContext';
4
4
  /**
5
5
  * Render the final JSX of OverlayDrawer
6
6
  */ export const renderOverlayDrawer_unstable = (state, contextValue)=>{
7
- if (!state.motion.canRender) {
8
- return null;
9
- }
10
7
  assertSlots(state);
11
8
  return /*#__PURE__*/ _jsx(DrawerProvider, {
12
9
  value: contextValue,
@@ -1 +1 @@
1
- {"version":3,"sources":["renderOverlayDrawer.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { DrawerContextValue, DrawerProvider } from '../../contexts/drawerContext';\n\nimport type { OverlayDrawerState, OverlayDrawerInternalSlots } from './OverlayDrawer.types';\n\n/**\n * Render the final JSX of OverlayDrawer\n */\nexport const renderOverlayDrawer_unstable = (state: OverlayDrawerState, contextValue: DrawerContextValue) => {\n if (!state.motion.canRender) {\n return null;\n }\n\n assertSlots<OverlayDrawerInternalSlots>(state);\n\n return (\n <DrawerProvider value={contextValue}>\n <state.dialog>\n <state.root />\n </state.dialog>\n </DrawerProvider>\n );\n};\n"],"names":["assertSlots","DrawerProvider","renderOverlayDrawer_unstable","state","contextValue","motion","canRender","value","dialog","root"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAA6BC,cAAc,QAAQ,+BAA+B;AAIlF;;CAEC,GACD,OAAO,MAAMC,+BAA+B,CAACC,OAA2BC;IACtE,IAAI,CAACD,MAAME,MAAM,CAACC,SAAS,EAAE;QAC3B,OAAO;IACT;IAEAN,YAAwCG;IAExC,qBACE,KAACF;QAAeM,OAAOH;kBACrB,cAAA,KAACD,MAAMK,MAAM;sBACX,cAAA,KAACL,MAAMM,IAAI;;;AAInB,EAAE"}
1
+ {"version":3,"sources":["renderOverlayDrawer.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { DrawerContextValue, DrawerProvider } from '../../contexts/drawerContext';\n\nimport type { OverlayDrawerState, OverlayDrawerInternalSlots } from './OverlayDrawer.types';\n\n/**\n * Render the final JSX of OverlayDrawer\n */\nexport const renderOverlayDrawer_unstable = (state: OverlayDrawerState, contextValue: DrawerContextValue) => {\n assertSlots<OverlayDrawerInternalSlots>(state);\n\n return (\n <DrawerProvider value={contextValue}>\n <state.dialog>\n <state.root />\n </state.dialog>\n </DrawerProvider>\n );\n};\n"],"names":["assertSlots","DrawerProvider","renderOverlayDrawer_unstable","state","contextValue","value","dialog","root"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAA6BC,cAAc,QAAQ,+BAA+B;AAIlF;;CAEC,GACD,OAAO,MAAMC,+BAA+B,CAACC,OAA2BC;IACtEJ,YAAwCG;IAExC,qBACE,KAACF;QAAeI,OAAOD;kBACrB,cAAA,KAACD,MAAMG,MAAM;sBACX,cAAA,KAACH,MAAMI,IAAI;;;AAInB,EAAE"}
@@ -1,9 +1,16 @@
1
+ import { Dialog } from '@fluentui/react-dialog';
2
+ import { slot } from '@fluentui/react-utilities';
1
3
  import * as React from 'react';
2
- import { slot, useMergedRefs } from '@fluentui/react-utilities';
3
- import { useMotion } from '@fluentui/react-motion-preview';
4
+ import { OverlayDrawerMotion, OverlaySurfaceBackdropMotion } from '../../shared/drawerMotions';
4
5
  import { useDrawerDefaultProps } from '../../shared/useDrawerDefaultProps';
5
- import { OverlayDrawerDialog } from './OverlayDrawerDialog';
6
6
  import { OverlayDrawerSurface } from './OverlayDrawerSurface';
7
+ import { mergePresenceSlots } from '../../shared/drawerMotionUtils';
8
+ const STATIC_MOTION = {
9
+ active: true,
10
+ canRender: true,
11
+ ref: /*#__PURE__*/ React.createRef(),
12
+ type: 'idle'
13
+ };
7
14
  /**
8
15
  * Create the state required to render OverlayDrawer.
9
16
  *
@@ -14,16 +21,18 @@ import { OverlayDrawerSurface } from './OverlayDrawerSurface';
14
21
  * @param ref - reference to root HTMLElement of OverlayDrawer
15
22
  */ export const useOverlayDrawer_unstable = (props, ref)=>{
16
23
  const { open, size, position } = useDrawerDefaultProps(props);
17
- const { modalType = 'modal', inertTrapFocus, onOpenChange } = props;
18
- const motion = useMotion(open);
24
+ const { backdropMotion, modalType = 'modal', inertTrapFocus, onOpenChange, surfaceMotion } = props;
19
25
  const backdropProps = slot.resolveShorthand(props.backdrop);
20
26
  const hasCustomBackdrop = modalType !== 'non-modal' && backdropProps !== null;
21
27
  const root = slot.always({
22
28
  ...props,
23
- ref: useMergedRefs(ref, motion.ref),
29
+ ref,
24
30
  backdrop: hasCustomBackdrop ? {
25
31
  ...backdropProps
26
- } : null
32
+ } : null,
33
+ backdropMotion: mergePresenceSlots(backdropMotion, OverlaySurfaceBackdropMotion, {
34
+ size
35
+ })
27
36
  }, {
28
37
  /**
29
38
  * Drawer accepts a `div` or `aside` element type, but Dialog only accepts a `div` element type.
@@ -35,22 +44,27 @@ import { OverlayDrawerSurface } from './OverlayDrawerSurface';
35
44
  onOpenChange,
36
45
  inertTrapFocus,
37
46
  modalType,
47
+ surfaceMotion: mergePresenceSlots(surfaceMotion, OverlayDrawerMotion, {
48
+ position,
49
+ size
50
+ }),
38
51
  /**
39
52
  * children is not needed here because we construct the children in the render function,
40
53
  * but it's required by DialogProps
41
54
  */ children: null
42
55
  }, {
43
- elementType: OverlayDrawerDialog
56
+ elementType: Dialog
44
57
  });
45
58
  return {
46
59
  components: {
47
60
  root: OverlayDrawerSurface,
48
- dialog: OverlayDrawerDialog
61
+ dialog: Dialog
49
62
  },
50
63
  root,
51
64
  dialog,
65
+ open,
52
66
  size,
53
67
  position,
54
- motion
68
+ motion: STATIC_MOTION
55
69
  };
56
70
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["useOverlayDrawer.ts"],"sourcesContent":["import * as React from 'react';\nimport { slot, useMergedRefs } from '@fluentui/react-utilities';\nimport { useMotion } from '@fluentui/react-motion-preview';\n\nimport { useDrawerDefaultProps } from '../../shared/useDrawerDefaultProps';\nimport type { OverlayDrawerProps, OverlayDrawerState } from './OverlayDrawer.types';\nimport { OverlayDrawerDialog } from './OverlayDrawerDialog';\nimport { OverlayDrawerSurface } from './OverlayDrawerSurface';\n\n/**\n * Create the state required to render OverlayDrawer.\n *\n * The returned state can be modified with hooks such as useOverlayDrawerStyles_unstable,\n * before being passed to renderOverlayDrawer_unstable.\n *\n * @param props - props from this instance of OverlayDrawer\n * @param ref - reference to root HTMLElement of OverlayDrawer\n */\nexport const useOverlayDrawer_unstable = (\n props: OverlayDrawerProps,\n ref: React.Ref<HTMLElement>,\n): OverlayDrawerState => {\n const { open, size, position } = useDrawerDefaultProps(props);\n const { modalType = 'modal', inertTrapFocus, onOpenChange } = props;\n\n const motion = useMotion<HTMLElement>(open);\n\n const backdropProps = slot.resolveShorthand(props.backdrop);\n const hasCustomBackdrop = modalType !== 'non-modal' && backdropProps !== null;\n\n const root = slot.always(\n {\n ...props,\n ref: useMergedRefs(ref, motion.ref),\n backdrop: hasCustomBackdrop ? { ...backdropProps } : null,\n },\n {\n /**\n * Drawer accepts a `div` or `aside` element type, but Dialog only accepts a `div` element type.\n * We need to cast the ref to a `div` element type to not break Dialog's ref type.\n */\n elementType: OverlayDrawerSurface as unknown as 'div',\n },\n );\n\n const dialog = slot.always(\n {\n open,\n onOpenChange,\n inertTrapFocus,\n modalType,\n /**\n * children is not needed here because we construct the children in the render function,\n * but it's required by DialogProps\n */\n children: null as unknown as JSX.Element,\n },\n {\n elementType: OverlayDrawerDialog,\n },\n );\n\n return {\n components: {\n root: OverlayDrawerSurface,\n dialog: OverlayDrawerDialog,\n },\n\n root,\n dialog,\n\n size,\n position,\n motion,\n };\n};\n"],"names":["React","slot","useMergedRefs","useMotion","useDrawerDefaultProps","OverlayDrawerDialog","OverlayDrawerSurface","useOverlayDrawer_unstable","props","ref","open","size","position","modalType","inertTrapFocus","onOpenChange","motion","backdropProps","resolveShorthand","backdrop","hasCustomBackdrop","root","always","elementType","dialog","children","components"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,EAAEC,aAAa,QAAQ,4BAA4B;AAChE,SAASC,SAAS,QAAQ,iCAAiC;AAE3D,SAASC,qBAAqB,QAAQ,qCAAqC;AAE3E,SAASC,mBAAmB,QAAQ,wBAAwB;AAC5D,SAASC,oBAAoB,QAAQ,yBAAyB;AAE9D;;;;;;;;CAQC,GACD,OAAO,MAAMC,4BAA4B,CACvCC,OACAC;IAEA,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAE,GAAGR,sBAAsBI;IACvD,MAAM,EAAEK,YAAY,OAAO,EAAEC,cAAc,EAAEC,YAAY,EAAE,GAAGP;IAE9D,MAAMQ,SAASb,UAAuBO;IAEtC,MAAMO,gBAAgBhB,KAAKiB,gBAAgB,CAACV,MAAMW,QAAQ;IAC1D,MAAMC,oBAAoBP,cAAc,eAAeI,kBAAkB;IAEzE,MAAMI,OAAOpB,KAAKqB,MAAM,CACtB;QACE,GAAGd,KAAK;QACRC,KAAKP,cAAcO,KAAKO,OAAOP,GAAG;QAClCU,UAAUC,oBAAoB;YAAE,GAAGH,aAAa;QAAC,IAAI;IACvD,GACA;QACE;;;OAGC,GACDM,aAAajB;IACf;IAGF,MAAMkB,SAASvB,KAAKqB,MAAM,CACxB;QACEZ;QACAK;QACAD;QACAD;QACA;;;OAGC,GACDY,UAAU;IACZ,GACA;QACEF,aAAalB;IACf;IAGF,OAAO;QACLqB,YAAY;YACVL,MAAMf;YACNkB,QAAQnB;QACV;QAEAgB;QACAG;QAEAb;QACAC;QACAI;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["useOverlayDrawer.tsx"],"sourcesContent":["import { Dialog } from '@fluentui/react-dialog';\nimport { slot } from '@fluentui/react-utilities';\nimport * as React from 'react';\n\nimport { OverlayDrawerMotion, OverlaySurfaceBackdropMotion } from '../../shared/drawerMotions';\nimport { useDrawerDefaultProps } from '../../shared/useDrawerDefaultProps';\nimport type { OverlayDrawerProps, OverlayDrawerState } from './OverlayDrawer.types';\nimport { OverlayDrawerSurface } from './OverlayDrawerSurface';\nimport { mergePresenceSlots } from '../../shared/drawerMotionUtils';\n\nconst STATIC_MOTION = {\n active: true,\n canRender: true,\n ref: React.createRef<HTMLDivElement>(),\n type: 'idle' as const,\n};\n\n/**\n * Create the state required to render OverlayDrawer.\n *\n * The returned state can be modified with hooks such as useOverlayDrawerStyles_unstable,\n * before being passed to renderOverlayDrawer_unstable.\n *\n * @param props - props from this instance of OverlayDrawer\n * @param ref - reference to root HTMLElement of OverlayDrawer\n */\nexport const useOverlayDrawer_unstable = (\n props: OverlayDrawerProps,\n ref: React.Ref<HTMLElement>,\n): OverlayDrawerState => {\n const { open, size, position } = useDrawerDefaultProps(props);\n const { backdropMotion, modalType = 'modal', inertTrapFocus, onOpenChange, surfaceMotion } = props;\n\n const backdropProps = slot.resolveShorthand(props.backdrop);\n const hasCustomBackdrop = modalType !== 'non-modal' && backdropProps !== null;\n\n const root = slot.always(\n {\n ...props,\n ref,\n backdrop: hasCustomBackdrop ? { ...backdropProps } : null,\n backdropMotion: mergePresenceSlots(backdropMotion, OverlaySurfaceBackdropMotion, { size }),\n },\n {\n /**\n * Drawer accepts a `div` or `aside` element type, but Dialog only accepts a `div` element type.\n * We need to cast the ref to a `div` element type to not break Dialog's ref type.\n */\n elementType: OverlayDrawerSurface as unknown as 'div',\n },\n );\n\n const dialog = slot.always(\n {\n open,\n onOpenChange,\n inertTrapFocus,\n modalType,\n surfaceMotion: mergePresenceSlots(surfaceMotion, OverlayDrawerMotion, { position, size }),\n /**\n * children is not needed here because we construct the children in the render function,\n * but it's required by DialogProps\n */\n children: null as unknown as JSX.Element,\n },\n {\n elementType: Dialog,\n },\n );\n\n return {\n components: {\n root: OverlayDrawerSurface,\n dialog: Dialog,\n },\n\n root,\n dialog,\n\n open,\n size,\n position,\n motion: STATIC_MOTION,\n };\n};\n"],"names":["Dialog","slot","React","OverlayDrawerMotion","OverlaySurfaceBackdropMotion","useDrawerDefaultProps","OverlayDrawerSurface","mergePresenceSlots","STATIC_MOTION","active","canRender","ref","createRef","type","useOverlayDrawer_unstable","props","open","size","position","backdropMotion","modalType","inertTrapFocus","onOpenChange","surfaceMotion","backdropProps","resolveShorthand","backdrop","hasCustomBackdrop","root","always","elementType","dialog","children","components","motion"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,MAAM,QAAQ,yBAAyB;AAChD,SAASC,IAAI,QAAQ,4BAA4B;AACjD,YAAYC,WAAW,QAAQ;AAE/B,SAASC,mBAAmB,EAAEC,4BAA4B,QAAQ,6BAA6B;AAC/F,SAASC,qBAAqB,QAAQ,qCAAqC;AAE3E,SAASC,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,kBAAkB,QAAQ,iCAAiC;AAEpE,MAAMC,gBAAgB;IACpBC,QAAQ;IACRC,WAAW;IACXC,mBAAKT,MAAMU,SAAS;IACpBC,MAAM;AACR;AAEA;;;;;;;;CAQC,GACD,OAAO,MAAMC,4BAA4B,CACvCC,OACAJ;IAEA,MAAM,EAAEK,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAE,GAAGb,sBAAsBU;IACvD,MAAM,EAAEI,cAAc,EAAEC,YAAY,OAAO,EAAEC,cAAc,EAAEC,YAAY,EAAEC,aAAa,EAAE,GAAGR;IAE7F,MAAMS,gBAAgBvB,KAAKwB,gBAAgB,CAACV,MAAMW,QAAQ;IAC1D,MAAMC,oBAAoBP,cAAc,eAAeI,kBAAkB;IAEzE,MAAMI,OAAO3B,KAAK4B,MAAM,CACtB;QACE,GAAGd,KAAK;QACRJ;QACAe,UAAUC,oBAAoB;YAAE,GAAGH,aAAa;QAAC,IAAI;QACrDL,gBAAgBZ,mBAAmBY,gBAAgBf,8BAA8B;YAAEa;QAAK;IAC1F,GACA;QACE;;;OAGC,GACDa,aAAaxB;IACf;IAGF,MAAMyB,SAAS9B,KAAK4B,MAAM,CACxB;QACEb;QACAM;QACAD;QACAD;QACAG,eAAehB,mBAAmBgB,eAAepB,qBAAqB;YAAEe;YAAUD;QAAK;QACvF;;;OAGC,GACDe,UAAU;IACZ,GACA;QACEF,aAAa9B;IACf;IAGF,OAAO;QACLiC,YAAY;YACVL,MAAMtB;YACNyB,QAAQ/B;QACV;QAEA4B;QACAG;QAEAf;QACAC;QACAC;QACAgB,QAAQ1B;IACV;AACF,EAAE"}