@fluentui/react-drawer 9.10.9 → 9.11.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +31 -2
  2. package/dist/index.d.ts +14 -2
  3. package/lib/components/InlineDrawer/InlineDrawer.types.js.map +1 -1
  4. package/lib/components/InlineDrawer/useInlineDrawer.js +15 -5
  5. package/lib/components/InlineDrawer/useInlineDrawer.js.map +1 -1
  6. package/lib/components/InlineDrawer/useInlineDrawerStyles.styles.js +80 -2
  7. package/lib/components/InlineDrawer/useInlineDrawerStyles.styles.js.map +1 -1
  8. package/lib/components/InlineDrawer/useInlineDrawerStyles.styles.raw.js +25 -1
  9. package/lib/components/InlineDrawer/useInlineDrawerStyles.styles.raw.js.map +1 -1
  10. package/lib/components/OverlayDrawer/OverlayDrawer.types.js.map +1 -1
  11. package/lib/components/OverlayDrawer/OverlayDrawerSurface/useOverlayDrawerSurfaceStyles.styles.js +13 -3
  12. package/lib/components/OverlayDrawer/OverlayDrawerSurface/useOverlayDrawerSurfaceStyles.styles.js.map +1 -1
  13. package/lib/components/OverlayDrawer/OverlayDrawerSurface/useOverlayDrawerSurfaceStyles.styles.raw.js +7 -2
  14. package/lib/components/OverlayDrawer/OverlayDrawerSurface/useOverlayDrawerSurfaceStyles.styles.raw.js.map +1 -1
  15. package/lib/components/OverlayDrawer/useOverlayDrawer.js +6 -6
  16. package/lib/components/OverlayDrawer/useOverlayDrawer.js.map +1 -1
  17. package/lib/shared/DrawerBase.types.js.map +1 -1
  18. package/lib/shared/drawerMotions.js.map +1 -1
  19. package/lib/shared/useDrawerDefaultProps.js +3 -2
  20. package/lib/shared/useDrawerDefaultProps.js.map +1 -1
  21. package/lib-commonjs/components/InlineDrawer/InlineDrawer.types.js.map +1 -1
  22. package/lib-commonjs/components/InlineDrawer/useInlineDrawer.js +15 -5
  23. package/lib-commonjs/components/InlineDrawer/useInlineDrawer.js.map +1 -1
  24. package/lib-commonjs/components/InlineDrawer/useInlineDrawerStyles.styles.js +94 -2
  25. package/lib-commonjs/components/InlineDrawer/useInlineDrawerStyles.styles.js.map +1 -1
  26. package/lib-commonjs/components/InlineDrawer/useInlineDrawerStyles.styles.raw.js +25 -1
  27. package/lib-commonjs/components/InlineDrawer/useInlineDrawerStyles.styles.raw.js.map +1 -1
  28. package/lib-commonjs/components/OverlayDrawer/OverlayDrawer.types.js.map +1 -1
  29. package/lib-commonjs/components/OverlayDrawer/OverlayDrawerSurface/useOverlayDrawerSurfaceStyles.styles.js +9 -3
  30. package/lib-commonjs/components/OverlayDrawer/OverlayDrawerSurface/useOverlayDrawerSurfaceStyles.styles.js.map +1 -1
  31. package/lib-commonjs/components/OverlayDrawer/OverlayDrawerSurface/useOverlayDrawerSurfaceStyles.styles.raw.js +7 -2
  32. package/lib-commonjs/components/OverlayDrawer/OverlayDrawerSurface/useOverlayDrawerSurfaceStyles.styles.raw.js.map +1 -1
  33. package/lib-commonjs/components/OverlayDrawer/useOverlayDrawer.js +6 -6
  34. package/lib-commonjs/components/OverlayDrawer/useOverlayDrawer.js.map +1 -1
  35. package/lib-commonjs/shared/DrawerBase.types.js.map +1 -1
  36. package/lib-commonjs/shared/drawerMotions.js.map +1 -1
  37. package/lib-commonjs/shared/useDrawerDefaultProps.js +3 -2
  38. package/lib-commonjs/shared/useDrawerDefaultProps.js.map +1 -1
  39. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/shared/drawerMotions.ts"],"sourcesContent":["import { createPresenceComponent, motionTokens } from '@fluentui/react-motion';\nimport { tokens } from '@fluentui/react-theme';\nimport { ProviderContextValue_unstable as FluentProviderContextValue } from '@fluentui/react-shared-contexts';\n\nimport type { DrawerBaseProps } from './DrawerBase.types';\nimport { drawerCSSVars } from './useDrawerBaseStyles.styles';\nimport { fadeAtom } from '@fluentui/react-motion-components-preview';\n\nexport type DrawerMotionParams = Required<\n Pick<DrawerBaseProps, 'size' | 'position'> & Pick<FluentProviderContextValue, 'dir'>\n>;\nexport type OverlayDrawerSurfaceMotionParams = Required<Pick<DrawerBaseProps, 'size'>>;\n\nconst durations: Record<NonNullable<DrawerBaseProps['size']>, number> = {\n small: motionTokens.durationGentle,\n medium: motionTokens.durationSlow,\n large: motionTokens.durationSlower,\n full: motionTokens.durationUltraSlow,\n};\n\n/**\n * @internal\n */\nexport function getPositionTransform(\n position: DrawerBaseProps['position'],\n sizeVar: string,\n dir: FluentProviderContextValue['dir'],\n): string {\n const leftToRightTransform = `translate3d(var(${sizeVar}), 0, 0)`;\n const rightToLeftTransform = `translate3d(calc(var(${sizeVar}) * -1), 0, 0)`;\n const bottomToTopTransform = `translate3d(0, var(${sizeVar}), 0)`;\n\n if (position === 'start') {\n return dir === 'ltr' ? rightToLeftTransform : leftToRightTransform;\n }\n\n if (position === 'end') {\n return dir === 'ltr' ? leftToRightTransform : rightToLeftTransform;\n }\n\n if (position === 'bottom') {\n return bottomToTopTransform;\n }\n\n return 'translate3d(0, 0, 0)';\n}\n\n/**\n * @internal\n */\nexport const InlineDrawerMotion = createPresenceComponent<DrawerMotionParams>(({ position, size, dir }) => {\n const keyframes: Keyframe[] = [\n {\n /**\n * TODO: Once the #31663 lands, we should update the RTL logic to use Motion APIs\n * The work will be done in the #32817\n */\n transform: getPositionTransform(position, drawerCSSVars.drawerSizeVar, dir),\n opacity: 0,\n },\n { transform: 'translate3d(0, 0, 0)', opacity: 1 },\n ];\n const duration = durations[size];\n\n return {\n enter: {\n keyframes,\n duration,\n easing: motionTokens.curveDecelerateMid,\n },\n exit: {\n keyframes: [...keyframes].reverse(),\n duration,\n easing: motionTokens.curveAccelerateMin,\n },\n };\n});\n\n/**\n * @internal\n */\nexport const OverlayDrawerMotion = createPresenceComponent<DrawerMotionParams>(({ position, size, dir }) => {\n const keyframes: Keyframe[] = [\n {\n /**\n * TODO: Once the #31663 lands, we should update the RTL logic to use Motion APIs\n * The work will be done in the #32817\n */\n transform: getPositionTransform(position, drawerCSSVars.drawerSizeVar, dir),\n boxShadow: `0px ${tokens.colorTransparentBackground}`,\n opacity: 0,\n },\n {\n transform: 'translate3d(0, 0, 0)',\n boxShadow: tokens.shadow64,\n opacity: 1,\n },\n ];\n const duration = durations[size];\n\n return {\n enter: {\n keyframes,\n duration,\n easing: motionTokens.curveDecelerateMid,\n },\n exit: {\n keyframes: [...keyframes].reverse(),\n duration,\n easing: motionTokens.curveAccelerateMin,\n },\n };\n});\n\n/**\n * @internal\n */\nexport const OverlaySurfaceBackdropMotion = createPresenceComponent(({ size }: OverlayDrawerSurfaceMotionParams) => {\n const duration = durations[size];\n const easing = motionTokens.curveLinear;\n\n return {\n enter: fadeAtom({ direction: 'enter', duration, easing }),\n exit: fadeAtom({ direction: 'exit', duration, easing }),\n };\n});\n"],"names":["createPresenceComponent","motionTokens","tokens","drawerCSSVars","fadeAtom","durations","small","durationGentle","medium","durationSlow","large","durationSlower","full","durationUltraSlow","getPositionTransform","position","sizeVar","dir","leftToRightTransform","rightToLeftTransform","bottomToTopTransform","InlineDrawerMotion","size","keyframes","transform","drawerSizeVar","opacity","duration","enter","easing","curveDecelerateMid","exit","reverse","curveAccelerateMin","OverlayDrawerMotion","boxShadow","colorTransparentBackground","shadow64","OverlaySurfaceBackdropMotion","curveLinear","direction"],"mappings":"AAAA,SAASA,uBAAuB,EAAEC,YAAY,QAAQ,yBAAyB;AAC/E,SAASC,MAAM,QAAQ,wBAAwB;AAI/C,SAASC,aAAa,QAAQ,+BAA+B;AAC7D,SAASC,QAAQ,QAAQ,4CAA4C;AAOrE,MAAMC,YAAkE;IACtEC,OAAOL,aAAaM,cAAc;IAClCC,QAAQP,aAAaQ,YAAY;IACjCC,OAAOT,aAAaU,cAAc;IAClCC,MAAMX,aAAaY,iBAAiB;AACtC;AAEA;;CAEC,GACD,OAAO,SAASC,qBACdC,QAAqC,EACrCC,OAAe,EACfC,GAAsC;IAEtC,MAAMC,uBAAuB,CAAC,gBAAgB,EAAEF,QAAQ,QAAQ,CAA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YACAE,QAAQ5B,aAAa6B,kBAAkB;QACzC;QACAC,MAAM;YACJR,WAAW;mBAAIA;aAAU,CAACS,OAAO;YACjCL;YACAE,QAAQ5B,aAAagC,kBAAkB;QACzC;IACF;AACF,GAAG;AAEH;;CAEC,GACD,OAAO,MAAMK,+BAA+BtC,wBAAwB,CAAC,EAAEsB,IAAI,EAAoC;IAC7G,MAAMK,WAAWtB,SAAS,CAACiB,KAAK;IAChC,MAAMO,SAAS5B,aAAasC,WAAW;IAEvC,OAAO;QACLX,OAAOxB,SAAS;YAAEoC,WAAW;YAASb;YAAUE;QAAO;QACvDE,MAAM3B,SAAS;YAAEoC,WAAW;YAAQb;YAAUE;QAAO;IACvD;AACF,GAAG"}
1
+ {"version":3,"sources":["../src/shared/drawerMotions.ts"],"sourcesContent":["import { createPresenceComponent, motionTokens } from '@fluentui/react-motion';\nimport { tokens } from '@fluentui/react-theme';\nimport { ProviderContextValue_unstable as FluentProviderContextValue } from '@fluentui/react-shared-contexts';\n\nimport type { DrawerBaseProps } from './DrawerBase.types';\nimport { drawerCSSVars } from './useDrawerBaseStyles.styles';\nimport { fadeAtom } from '@fluentui/react-motion-components-preview';\n\nexport type DrawerMotionParams = Required<\n Pick<DrawerBaseProps, 'size' | 'position'> & Pick<FluentProviderContextValue, 'dir'>\n>;\nexport type OverlayDrawerSurfaceMotionParams = Required<Pick<DrawerBaseProps, 'size'>>;\n\nconst durations: Record<NonNullable<DrawerBaseProps['size']>, number> = {\n small: motionTokens.durationGentle,\n medium: motionTokens.durationSlow,\n large: motionTokens.durationSlower,\n full: motionTokens.durationUltraSlow,\n};\n\n/**\n * @internal\n */\nexport function getPositionTransform(\n position: DrawerBaseProps['position'],\n sizeVar: string,\n dir: FluentProviderContextValue['dir'],\n): string {\n const leftToRightTransform = `translate3d(var(${sizeVar}), 0, 0)`;\n const rightToLeftTransform = `translate3d(calc(var(${sizeVar}) * -1), 0, 0)`;\n const bottomToTopTransform = `translate3d(0, var(${sizeVar}), 0)`;\n\n if (position === 'start') {\n return dir === 'ltr' ? rightToLeftTransform : leftToRightTransform;\n }\n\n if (position === 'end') {\n return dir === 'ltr' ? leftToRightTransform : rightToLeftTransform;\n }\n\n if (position === 'bottom') {\n return bottomToTopTransform;\n }\n\n return 'translate3d(0, 0, 0)';\n}\n\n/**\n * @internal\n */\nexport const InlineDrawerMotion = createPresenceComponent<DrawerMotionParams>(({ position, size, dir }) => {\n const keyframes: Keyframe[] = [\n {\n /**\n * TODO: Once the #31663 lands, we should update the RTL logic to use Motion APIs\n * The work will be done in the #32817\n */\n transform: getPositionTransform(position, drawerCSSVars.drawerSizeVar, dir),\n opacity: 0,\n },\n {\n transform: 'translate3d(0, 0, 0)',\n opacity: 1,\n },\n ];\n const duration = durations[size];\n\n return {\n enter: {\n keyframes,\n duration,\n easing: motionTokens.curveDecelerateMid,\n },\n exit: {\n keyframes: [...keyframes].reverse(),\n duration,\n easing: motionTokens.curveAccelerateMin,\n },\n };\n});\n\n/**\n * @internal\n */\nexport const OverlayDrawerMotion = createPresenceComponent<DrawerMotionParams>(({ position, size, dir }) => {\n const keyframes: Keyframe[] = [\n {\n /**\n * TODO: Once the #31663 lands, we should update the RTL logic to use Motion APIs\n * The work will be done in the #32817\n */\n transform: getPositionTransform(position, drawerCSSVars.drawerSizeVar, dir),\n boxShadow: `0px ${tokens.colorTransparentBackground}`,\n opacity: 0,\n },\n {\n transform: 'translate3d(0, 0, 0)',\n boxShadow: tokens.shadow64,\n opacity: 1,\n },\n ];\n const duration = durations[size];\n\n return {\n enter: {\n keyframes,\n duration,\n easing: motionTokens.curveDecelerateMid,\n },\n exit: {\n keyframes: [...keyframes].reverse(),\n duration,\n easing: motionTokens.curveAccelerateMin,\n },\n };\n});\n\n/**\n * @internal\n */\nexport const OverlaySurfaceBackdropMotion = createPresenceComponent(({ size }: OverlayDrawerSurfaceMotionParams) => {\n const duration = durations[size];\n const easing = motionTokens.curveLinear;\n\n return {\n enter: fadeAtom({ direction: 'enter', duration, easing }),\n exit: fadeAtom({ direction: 'exit', duration, easing }),\n };\n});\n"],"names":["createPresenceComponent","motionTokens","tokens","drawerCSSVars","fadeAtom","durations","small","durationGentle","medium","durationSlow","large","durationSlower","full","durationUltraSlow","getPositionTransform","position","sizeVar","dir","leftToRightTransform","rightToLeftTransform","bottomToTopTransform","InlineDrawerMotion","size","keyframes","transform","drawerSizeVar","opacity","duration","enter","easing","curveDecelerateMid","exit","reverse","curveAccelerateMin","OverlayDrawerMotion","boxShadow","colorTransparentBackground","shadow64","OverlaySurfaceBackdropMotion","curveLinear","direction"],"mappings":"AAAA,SAASA,uBAAuB,EAAEC,YAAY,QAAQ,yBAAyB;AAC/E,SAASC,MAAM,QAAQ,wBAAwB;AAI/C,SAASC,aAAa,QAAQ,+BAA+B;AAC7D,SAASC,QAAQ,QAAQ,4CAA4C;AAOrE,MAAMC,YAAkE;IACtEC,OAAOL,aAAaM,cAAc;IAClCC,QAAQP,aAAaQ,YAAY;IACjCC,OAAOT,aAAaU,cAAc;IAClCC,MAAMX,aAAaY,iBAAiB;AACtC;AAEA;;CAEC,GACD,OAAO,SAASC,qBACdC,QAAqC,EACrCC,OAAe,EACfC,GAAsC;IAEtC,MAAMC,uBAAuB,CAAC,gBAAgB,EAAEF,QAAQ,QAAQ,CAAC;IACjE,MAAMG,uBAAuB,CAAC,qBAAqB,EAAEH,QAAQ,cAAc,CAAC;IAC5E,MAAMI,uBAAuB,CAAC,mBAAmB,EAAEJ,QAAQ,KAAK,CAAC;IAEjE,IAAID,aAAa,SAAS;QACxB,OAAOE,QAAQ,QAAQE,uBAAuBD;IAChD;IAEA,IAAIH,aAAa,OAAO;QACtB,OAAOE,QAAQ,QAAQC,uBAAuBC;IAChD;IAEA,IAAIJ,aAAa,UAAU;QACzB,OAAOK;IACT;IAEA,OAAO;AACT;AAEA;;CAEC,GACD,OAAO,MAAMC,qBAAqBrB,wBAA4C,CAAC,EAAEe,QAAQ,EAAEO,IAAI,EAAEL,GAAG,EAAE;IACpG,MAA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@@ -1,8 +1,9 @@
1
1
  export function useDrawerDefaultProps(props) {
2
- const { open = false, size = 'small', position = 'start' } = props;
2
+ const { open = false, size = 'small', position = 'start', unmountOnClose = true } = props;
3
3
  return {
4
4
  size,
5
5
  position,
6
- open
6
+ open,
7
+ unmountOnClose
7
8
  };
8
9
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/shared/useDrawerDefaultProps.ts"],"sourcesContent":["import { DrawerBaseProps } from './DrawerBase.types';\n\nexport function useDrawerDefaultProps(props: DrawerBaseProps): {\n size: NonNullable<DrawerBaseProps['size']>;\n position: NonNullable<DrawerBaseProps['position']>;\n open: boolean;\n} {\n const { open = false, size = 'small', position = 'start' } = props;\n\n return {\n size,\n position,\n open,\n };\n}\n"],"names":["useDrawerDefaultProps","props","open","size","position"],"mappings":"AAEA,OAAO,SAASA,sBAAsBC,KAAsB;IAK1D,MAAM,EAAEC,OAAO,KAAK,EAAEC,OAAO,OAAO,EAAEC,WAAW,OAAO,EAAE,GAAGH;IAE7D,OAAO;QACLE;QACAC;QACAF;IACF;AACF"}
1
+ {"version":3,"sources":["../src/shared/useDrawerDefaultProps.ts"],"sourcesContent":["import { DrawerBaseProps } from './DrawerBase.types';\n\nexport function useDrawerDefaultProps(props: DrawerBaseProps): {\n size: NonNullable<DrawerBaseProps['size']>;\n position: NonNullable<DrawerBaseProps['position']>;\n open: boolean;\n unmountOnClose: boolean;\n} {\n const { open = false, size = 'small', position = 'start', unmountOnClose = true } = props;\n\n return {\n size,\n position,\n open,\n unmountOnClose,\n };\n}\n"],"names":["useDrawerDefaultProps","props","open","size","position","unmountOnClose"],"mappings":"AAEA,OAAO,SAASA,sBAAsBC,KAAsB;IAM1D,MAAM,EAAEC,OAAO,KAAK,EAAEC,OAAO,OAAO,EAAEC,WAAW,OAAO,EAAEC,iBAAiB,IAAI,EAAE,GAAGJ;IAEpF,OAAO;QACLE;QACAC;QACAF;QACAG;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/InlineDrawer/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":[],"mappings":"AA0BA;;CAEC,GACD,WAEE"}
1
+ {"version":3,"sources":["../src/components/InlineDrawer/InlineDrawer.types.ts"],"sourcesContent":["import type { PresenceDirection, 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>> &\n DrawerBaseState &\n Pick<InlineDrawerProps, 'separator'> & {\n animationDirection: PresenceDirection;\n }\n>;\n"],"names":[],"mappings":"AA0BA;;CAEC,GACD,WAME"}
@@ -23,10 +23,11 @@ const STATIC_MOTION = {
23
23
  type: 'idle'
24
24
  };
25
25
  const useInlineDrawer_unstable = (props, ref)=>{
26
- const { size, position, open } = (0, _useDrawerDefaultProps.useDrawerDefaultProps)(props);
26
+ const { size, position, open, unmountOnClose } = (0, _useDrawerDefaultProps.useDrawerDefaultProps)(props);
27
27
  const { separator = false, surfaceMotion } = props;
28
28
  const { dir } = (0, _reactsharedcontexts.useFluent_unstable)();
29
- const state = {
29
+ const [animationDirection, setAnimationDirection] = _react.useState(open ? 'enter' : 'exit');
30
+ return {
30
31
  components: {
31
32
  root: 'div',
32
33
  // casting from internal type that has required properties
@@ -36,7 +37,8 @@ const useInlineDrawer_unstable = (props, ref)=>{
36
37
  },
37
38
  root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
38
39
  ...props,
39
- ref
40
+ ref,
41
+ 'aria-hidden': !unmountOnClose && !open ? true : undefined
40
42
  }), {
41
43
  elementType: 'div'
42
44
  }),
@@ -44,6 +46,8 @@ const useInlineDrawer_unstable = (props, ref)=>{
44
46
  position,
45
47
  size,
46
48
  separator,
49
+ unmountOnClose,
50
+ animationDirection,
47
51
  surfaceMotion: (0, _reactmotion.presenceMotionSlot)(surfaceMotion, {
48
52
  elementType: _drawerMotions.InlineDrawerMotion,
49
53
  defaultProps: {
@@ -51,11 +55,17 @@ const useInlineDrawer_unstable = (props, ref)=>{
51
55
  size,
52
56
  dir,
53
57
  visible: open,
54
- unmountOnExit: true
58
+ appear: unmountOnClose,
59
+ unmountOnExit: unmountOnClose,
60
+ onMotionFinish: (_, { direction })=>setAnimationDirection(direction),
61
+ onMotionStart: (_, { direction })=>{
62
+ if (direction === 'enter') {
63
+ setAnimationDirection('enter');
64
+ }
65
+ }
55
66
  }
56
67
  }),
57
68
  // Deprecated props
58
69
  motion: STATIC_MOTION
59
70
  };
60
- return state;
61
71
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/InlineDrawer/useInlineDrawer.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { presenceMotionSlot } from '@fluentui/react-motion';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\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 const { dir } = useFluent();\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 dir,\n visible: open,\n unmountOnExit: true,\n },\n }),\n\n // Deprecated props\n motion: STATIC_MOTION,\n };\n\n return state;\n};\n"],"names":["React","presenceMotionSlot","getIntrinsicElementProps","slot","useFluent_unstable","useFluent","InlineDrawerMotion","useDrawerDefaultProps","STATIC_MOTION","active","canRender","ref","createRef","type","useInlineDrawer_unstable","props","size","position","open","separator","surfaceMotion","dir","state","components","root","always","elementType","defaultProps","visible","unmountOnExit","motion"],"mappings":"AAAA;;;;;;;;;;;;iEAEuB,QAAQ;6BACI,yBAAyB;gCACb,4BAA4B;qCAC3B,kCAAkC;+BAEtB,6BAA6B;uCACnD,qCAAqC;AAG3E,MAAMQ,gBAAgB;IACpBC,QAAQ;IACRC,WAAW;IACXC,mBAAKX,OAAMY,SAAS;IACpBC,MAAM;AACR;AAWO,MAAMC,2BAA2B,CAACC,OAA0BJ;IACjE,MAAM,EAAEK,IAAI,EAAEC,QAAQ,EAAEC,IAAI,EAAE,OAAGX,4CAAAA,EAAsBQ;IACvD,MAAM,EAAEI,YAAY,KAAK,EAAEC,aAAa,EAAE,GAAGL;IAC7C,MAAM,EAAEM,GAAG,EAAE,OAAGhB,uCAAAA;IAEhB,MAAMiB,QAA2B;QAC/BC,YAAY;YACVC,MAAM;YACN,0DAA0D;YAC1D,qDAAqD;YACrD,uFAAuF;YACvFJ,eAAed,iCAAAA;QACjB;QAEAkB,MAAMrB,oBAAAA,CAAKsB,MAAM,KACfvB,wCAAAA,EAAyB,OAAO;YAC9B,GAAGa,KAAK;YACRJ;QACF,IACA;YAAEe,aAAa;QAAM;QAGvBR;QACAD;QACAD;QACAG;QACAC,mBAAenB,+BAAAA,EAAuCmB,eAAe;YACnEM,aAAapB,iCAAAA;YACbqB,cAAc;gBACZV;gBACAD;gBACAK;gBACAO,SAASV;gBACTW,eAAe;YACjB;QACF;QAEA,mBAAmB;QACnBC,QAAQtB;IACV;IAEA,OAAOc;AACT,EAAE"}
1
+ {"version":3,"sources":["../src/components/InlineDrawer/useInlineDrawer.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { PresenceDirection, presenceMotionSlot } from '@fluentui/react-motion';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\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, unmountOnClose } = useDrawerDefaultProps(props);\n const { separator = false, surfaceMotion } = props;\n const { dir } = useFluent();\n const [animationDirection, setAnimationDirection] = React.useState<PresenceDirection>(open ? 'enter' : 'exit');\n\n return {\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 'aria-hidden': !unmountOnClose && !open ? true : undefined,\n }),\n { elementType: 'div' },\n ),\n\n open,\n position,\n size,\n separator,\n unmountOnClose,\n animationDirection,\n surfaceMotion: presenceMotionSlot<DrawerMotionParams>(surfaceMotion, {\n elementType: InlineDrawerMotion,\n defaultProps: {\n position,\n size,\n dir,\n visible: open,\n appear: unmountOnClose,\n unmountOnExit: unmountOnClose,\n onMotionFinish: (_, { direction }) => setAnimationDirection(direction),\n onMotionStart: (_, { direction }) => {\n if (direction === 'enter') {\n setAnimationDirection('enter');\n }\n },\n },\n }),\n\n // Deprecated props\n motion: STATIC_MOTION,\n } satisfies InlineDrawerState;\n};\n"],"names":["React","presenceMotionSlot","getIntrinsicElementProps","slot","useFluent_unstable","useFluent","InlineDrawerMotion","useDrawerDefaultProps","STATIC_MOTION","active","canRender","ref","createRef","type","useInlineDrawer_unstable","props","size","position","open","unmountOnClose","separator","surfaceMotion","dir","animationDirection","setAnimationDirection","useState","components","root","always","undefined","elementType","defaultProps","visible","appear","unmountOnExit","onMotionFinish","_","direction","onMotionStart","motion"],"mappings":"AAAA;;;;;+BA2Bac;;;;;;;iEAzBU,QAAQ;6BACuB,yBAAyB;gCAChC,4BAA4B;qCAC3B,kCAAkC;+BAEtB,6BAA6B;uCACnD,qCAAqC;AAG3E,MAAMN,gBAAgB;IACpBC,QAAQ;IACRC,WAAW;IACXC,mBAAKX,OAAMY,SAAS;IACpBC,MAAM;AACR;AAWO,iCAAiC,CAACE,OAA0BJ;IACjE,MAAM,EAAEK,IAAI,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,cAAc,EAAE,OAAGZ,4CAAAA,EAAsBQ;IACvE,MAAM,EAAEK,YAAY,KAAK,EAAEC,aAAa,EAAE,GAAGN;IAC7C,MAAM,EAAEO,GAAG,EAAE,OAAGjB,uCAAAA;IAChB,MAAM,CAACkB,oBAAoBC,sBAAsB,GAAGxB,OAAMyB,QAAQ,CAAoBP,OAAO,UAAU;IAEvG,OAAO;QACLQ,YAAY;YACVC,MAAM;YACN,0DAA0D;YAC1D,qDAAqD;YACrD,uFAAuF;YACvFN,eAAef,iCAAAA;QACjB;QAEAqB,MAAMxB,oBAAAA,CAAKyB,MAAM,KACf1B,wCAAAA,EAAyB,OAAO;YAC9B,GAAGa,KAAK;YACRJ;YACA,eAAe,CAACQ,kBAAkB,CAACD,OAAO,OAAOW;QACnD,IACA;YAAEC,aAAa;QAAM;QAGvBZ;QACAD;QACAD;QACAI;QACAD;QACAI;QACAF,mBAAepB,+BAAAA,EAAuCoB,eAAe;YACnES,aAAaxB,iCAAAA;YACbyB,cAAc;gBACZd;gBACAD;gBACAM;gBACAU,SAASd;gBACTe,QAAQd;gBACRe,eAAef;gBACfgB,gBAAgB,CAACC,GAAG,EAAEC,SAAS,EAAE,GAAKb,sBAAsBa;gBAC5DC,eAAe,CAACF,GAAG,EAAEC,SAAS,EAAE;oBAC9B,IAAIA,cAAc,SAAS;wBACzBb,sBAAsB;oBACxB;gBACF;YACF;QACF;QAEA,mBAAmB;QACnBe,QAAQ/B;IACV;AACF,EAAE"}
@@ -59,6 +59,66 @@ const useDrawerRootStyles = /*#__PURE__*/ (0, _react.__styles)({
59
59
  bottom: {
60
60
  a9b677: "fly5x3f",
61
61
  Bqenvij: "fub80nq"
62
+ },
63
+ animationExitStart: {
64
+ a9b677: "f3tsq5r",
65
+ Bgfg5da: 0,
66
+ B9xav0g: 0,
67
+ oivjwe: 0,
68
+ Bn0qgzm: 0,
69
+ B4g9neb: 0,
70
+ zhjwy3: 0,
71
+ wvpqe5: 0,
72
+ ibv6hh: 0,
73
+ u1mtju: 0,
74
+ h3c5rm: 0,
75
+ vrafjx: 0,
76
+ Bekrc4i: 0,
77
+ i8vvqc: 0,
78
+ g2u3we: 0,
79
+ icvyot: 0,
80
+ B4j52fo: 0,
81
+ irswps: "f3bhgqh"
82
+ },
83
+ animationExitEnd: {
84
+ a9b677: "f3tsq5r",
85
+ Bgfg5da: 0,
86
+ B9xav0g: 0,
87
+ oivjwe: 0,
88
+ Bn0qgzm: 0,
89
+ B4g9neb: 0,
90
+ zhjwy3: 0,
91
+ wvpqe5: 0,
92
+ ibv6hh: 0,
93
+ u1mtju: 0,
94
+ h3c5rm: 0,
95
+ vrafjx: 0,
96
+ Bekrc4i: 0,
97
+ i8vvqc: 0,
98
+ g2u3we: 0,
99
+ icvyot: 0,
100
+ B4j52fo: 0,
101
+ irswps: "f3bhgqh"
102
+ },
103
+ animationExitBottom: {
104
+ Bqenvij: "fniina8",
105
+ Bgfg5da: 0,
106
+ B9xav0g: 0,
107
+ oivjwe: 0,
108
+ Bn0qgzm: 0,
109
+ B4g9neb: 0,
110
+ zhjwy3: 0,
111
+ wvpqe5: 0,
112
+ ibv6hh: 0,
113
+ u1mtju: 0,
114
+ h3c5rm: 0,
115
+ vrafjx: 0,
116
+ Bekrc4i: 0,
117
+ i8vvqc: 0,
118
+ g2u3we: 0,
119
+ icvyot: 0,
120
+ B4j52fo: 0,
121
+ irswps: "f3bhgqh"
62
122
  }
63
123
  }, {
64
124
  d: [
@@ -93,7 +153,27 @@ const useDrawerRootStyles = /*#__PURE__*/ (0, _react.__styles)({
93
153
  }
94
154
  ],
95
155
  ".fly5x3f{width:100%;}",
96
- ".fub80nq{height:var(--fui-Drawer--size);}"
156
+ ".fub80nq{height:var(--fui-Drawer--size);}",
157
+ ".f3tsq5r{width:0;}",
158
+ [
159
+ ".f3bhgqh{border:none;}",
160
+ {
161
+ p: -2
162
+ }
163
+ ],
164
+ [
165
+ ".f3bhgqh{border:none;}",
166
+ {
167
+ p: -2
168
+ }
169
+ ],
170
+ ".fniina8{height:0;}",
171
+ [
172
+ ".f3bhgqh{border:none;}",
173
+ {
174
+ p: -2
175
+ }
176
+ ]
97
177
  ]
98
178
  });
99
179
  function getSeparatorClass(state, classNames) {
@@ -111,11 +191,23 @@ function getSeparatorClass(state, classNames) {
111
191
  return undefined;
112
192
  }
113
193
  }
194
+ function getAnimationExitClass(state, classNames) {
195
+ switch(state.position){
196
+ case 'start':
197
+ return classNames.animationExitStart;
198
+ case 'end':
199
+ return classNames.animationExitEnd;
200
+ case 'bottom':
201
+ return classNames.animationExitBottom;
202
+ default:
203
+ return undefined;
204
+ }
205
+ }
114
206
  const useInlineDrawerStyles_unstable = (state)=>{
115
207
  'use no memo';
116
208
  const resetStyles = useDrawerResetStyles();
117
209
  const baseClassNames = (0, _useDrawerBaseStylesstyles.useDrawerBaseClassNames)(state);
118
210
  const rootStyles = useDrawerRootStyles();
119
- state.root.className = (0, _react.mergeClasses)(inlineDrawerClassNames.root, resetStyles, baseClassNames, getSeparatorClass(state, rootStyles), rootStyles[state.position], state.root.className);
211
+ state.root.className = (0, _react.mergeClasses)(inlineDrawerClassNames.root, resetStyles, baseClassNames, getSeparatorClass(state, rootStyles), rootStyles[state.position], state.animationDirection === 'exit' && getAnimationExitClass(state, rootStyles), state.root.className);
120
212
  return state;
121
213
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["useInlineDrawerStyles.styles.js"],"sourcesContent":["'use client';\nimport { 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"],"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"],"mappings":"AAAA,YAAY;;;;;;;;;;;;IAICO,sBAAsB;;;IA4ClBkC,8BAA8B;;;;uBA/CW,gBAAgB;4BACnD,uBAAuB;2CAC8B,yCAAyC;AAC9G,+BAA+B;IAClCjC,IAAI,EAAE;AACV,CAAC;AACD,MAAMC,oBAAoB,GAAA,WAAA,OAAGT,oBAAA,EAAA,WAAA,MAAA;IAAA;CAG5B,CAAC;AACF;;CAEA,GAAI,MAAMU,WAAW,GAAG,CAAA,UAAA,EAAaP,kBAAM,CAACQ,uBAAuB,EAAE;AACrE,MAAMC,mBAAmB,GAAA,WAAA,OAAGX,eAAA,EAAA;IAAAY,cAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;YAAA;YAAA;SAAA;IAAA;IAAAC,YAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;YAAA;YAAA;SAAA;IAAA;IAAAC,eAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;IAAA;IAAAC,KAAA,EAAA,CAAA;IAAAC,GAAA,EAAA,CAAA;IAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;AAAA,GAAA;IAAAC,CAAA,EAAA;QAAA;YAAA;YAAA;gBAAAC,CAAA,EAAA,CAAA;YAAA;SAAA;QAAA;YAAA;YAAA;gBAAAA,CAAA,EAAA,CAAA;YAAA;SAAA;QAAA;YAAA;YAAA;gBAAAA,CAAA,EAAA,CAAA;YAAA;SAAA;QAAA;YAAA;YAAA;gBAAAA,CAAA,EAAA,CAAA;YAAA;SAAA;QAAA;YAAA;YAAA;gBAAAA,CAAA,EAAA,CAAA;YAAA;SAAA;QAAA;QAAA;KAAA;AAAA,CAgB3B,CAAC;AACF,SAASC,iBAAiBA,CAACC,KAAK,EAAEC,UAAU,EAAE;IAC1C,IAAI,CAACD,KAAK,CAACE,SAAS,EAAE;QAClB,OAAOC,SAAS;IACpB;IACA,OAAOH,KAAK,CAACI,QAAQ;QACjB,KAAK,OAAO;YACR,OAAOH,UAAU,CAACxB,cAAc;QACpC,KAAK,KAAK;YACN,OAAOwB,UAAU,CAACnB,YAAY;QAClC,KAAK,QAAQ;YACT,OAAOmB,UAAU,CAACd,eAAe;QACrC;YACI,OAAOgB,SAAS;IACxB;AACJ;AAGW,wCAAwCH,KAAK,IAAG;IACvD,aAAa;IACb,MAAMM,WAAW,GAAGjC,oBAAoB,CAAC,CAAC;IAC1C,MAAMkC,cAAc,OAAGrC,kDAAuB,EAAC8B,KAAK,CAAC;IACrD,MAAMQ,UAAU,GAAGhC,mBAAmB,CAAC,CAAC;IACxCwB,KAAK,CAAC5B,IAAI,CAACqC,SAAS,OAAG3C,mBAAY,EAACK,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;IACrL,OAAOT,KAAK;AAChB,CAAC"}
1
+ {"version":3,"sources":["useInlineDrawerStyles.styles.js"],"sourcesContent":["'use client';\nimport { 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 /* Animation exit states */ animationExitStart: {\n width: '0',\n border: 'none'\n },\n animationExitEnd: {\n width: '0',\n border: 'none'\n },\n animationExitBottom: {\n height: '0',\n border: 'none'\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}\nfunction getAnimationExitClass(state, classNames) {\n switch(state.position){\n case 'start':\n return classNames.animationExitStart;\n case 'end':\n return classNames.animationExitEnd;\n case 'bottom':\n return classNames.animationExitBottom;\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.animationDirection === 'exit' && getAnimationExitClass(state, rootStyles), state.root.className);\n return state;\n};\n"],"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","animationExitStart","Bgfg5da","B9xav0g","oivjwe","Bn0qgzm","irswps","animationExitEnd","animationExitBottom","d","p","getSeparatorClass","state","classNames","separator","undefined","position","getAnimationExitClass","useInlineDrawerStyles_unstable","resetStyles","baseClassNames","rootStyles","className","animationDirection"],"mappings":"AAAA,YAAY;;;;;;;;;;;;IAICO,sBAAsB;;;kCAoEY;eAA9B2C;;;uBAvEyC,gBAAgB;4BACnD,uBAAuB;2CAC8B,yCAAyC;AAC9G,+BAA+B;IAClC1C,IAAI,EAAE;AACV,CAAC;AACD,MAAMC,oBAAoB,GAAA,WAAA,OAAGT,oBAAA,EAAA,WAAA,MAAA;IAAA;CAG5B,CAAC;AACF;;CAEA,GAAI,MAAMU,WAAW,GAAG,CAAA,UAAA,EAAaP,kBAAM,CAACQ,uBAAuB,EAAE;AACrE,MAAMC,mBAAmB,GAAA,WAAA,OAAGX,eAAA,EAAA;IAAAY,cAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;YAAA;YAAA;SAAA;IAAA;IAAAC,YAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;YAAA;YAAA;SAAA;IAAA;IAAAC,eAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;IAAA;IAAAC,KAAA,EAAA,CAAA;IAAAC,GAAA,EAAA,CAAA;IAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;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C;IACxCgC,KAAK,CAACpC,IAAI,CAAC8C,SAAS,OAAGpD,mBAAY,EAACK,sBAAsB,CAACC,IAAI,EAAE2C,WAAW,EAAEC,cAAc,EAAET,iBAAiB,CAACC,KAAK,EAAES,UAAU,CAAC,EAAEA,UAAU,CAACT,KAAK,CAACI,QAAQ,CAAC,EAAEJ,KAAK,CAACW,kBAAkB,KAAK,MAAM,IAAIN,qBAAqB,CAACL,KAAK,EAAES,UAAU,CAAC,EAAET,KAAK,CAACpC,IAAI,CAAC8C,SAAS,CAAC;IACtQ,OAAOV,KAAK;AAChB,CAAC"}
@@ -45,6 +45,18 @@ const useDrawerRootStyles = (0, _react.makeStyles)({
45
45
  bottom: {
46
46
  width: '100%',
47
47
  height: `var(${_useDrawerBaseStylesstyles.drawerCSSVars.drawerSizeVar})`
48
+ },
49
+ /* Animation exit states */ animationExitStart: {
50
+ width: '0',
51
+ border: 'none'
52
+ },
53
+ animationExitEnd: {
54
+ width: '0',
55
+ border: 'none'
56
+ },
57
+ animationExitBottom: {
58
+ height: '0',
59
+ border: 'none'
48
60
  }
49
61
  });
50
62
  function getSeparatorClass(state, classNames) {
@@ -62,11 +74,23 @@ function getSeparatorClass(state, classNames) {
62
74
  return undefined;
63
75
  }
64
76
  }
77
+ function getAnimationExitClass(state, classNames) {
78
+ switch(state.position){
79
+ case 'start':
80
+ return classNames.animationExitStart;
81
+ case 'end':
82
+ return classNames.animationExitEnd;
83
+ case 'bottom':
84
+ return classNames.animationExitBottom;
85
+ default:
86
+ return undefined;
87
+ }
88
+ }
65
89
  const useInlineDrawerStyles_unstable = (state)=>{
66
90
  'use no memo';
67
91
  const resetStyles = useDrawerResetStyles();
68
92
  const baseClassNames = (0, _useDrawerBaseStylesstyles.useDrawerBaseClassNames)(state);
69
93
  const rootStyles = useDrawerRootStyles();
70
- state.root.className = (0, _react.mergeClasses)(inlineDrawerClassNames.root, resetStyles, baseClassNames, getSeparatorClass(state, rootStyles), rootStyles[state.position], state.root.className);
94
+ state.root.className = (0, _react.mergeClasses)(inlineDrawerClassNames.root, resetStyles, baseClassNames, getSeparatorClass(state, rootStyles), rootStyles[state.position], state.animationDirection === 'exit' && getAnimationExitClass(state, rootStyles), state.root.className);
71
95
  return state;
72
96
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/InlineDrawer/useInlineDrawerStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { tokens } from '@fluentui/react-theme';\n\nimport type { InlineDrawerSlots, InlineDrawerState } from './InlineDrawer.types';\nimport { drawerCSSVars, drawerDefaultStyles, useDrawerBaseClassNames } from '../../shared/useDrawerBaseStyles.styles';\n\nexport const inlineDrawerClassNames: SlotClassNames<Omit<InlineDrawerSlots, 'surfaceMotion'>> = {\n root: 'fui-InlineDrawer',\n};\n\nconst useDrawerResetStyles = makeResetStyles({\n ...drawerDefaultStyles,\n position: 'relative',\n});\n\n/**\n * Styles for the root slot\n */\nconst borderValue = `1px solid ${tokens.colorNeutralBackground3}`;\nconst useDrawerRootStyles = makeStyles({\n /* Separator */\n separatorStart: { borderRight: borderValue },\n separatorEnd: { borderLeft: borderValue },\n separatorBottom: { borderTop: borderValue },\n\n /* Positioning */\n start: {},\n end: {},\n bottom: {\n width: '100%',\n height: `var(${drawerCSSVars.drawerSizeVar})`,\n },\n});\n\nfunction getSeparatorClass(state: InlineDrawerState, classNames: ReturnType<typeof useDrawerRootStyles>) {\n if (!state.separator) {\n return undefined;\n }\n\n switch (state.position) {\n case 'start':\n return classNames.separatorStart;\n\n case 'end':\n return classNames.separatorEnd;\n\n case 'bottom':\n return classNames.separatorBottom;\n\n default:\n return undefined;\n }\n}\n\n/**\n * Apply styling to the InlineDrawer slots based on the state\n */\nexport const useInlineDrawerStyles_unstable = (state: InlineDrawerState): InlineDrawerState => {\n 'use no memo';\n\n const resetStyles = useDrawerResetStyles();\n const baseClassNames = useDrawerBaseClassNames(state);\n const rootStyles = useDrawerRootStyles();\n\n state.root.className = mergeClasses(\n inlineDrawerClassNames.root,\n resetStyles,\n baseClassNames,\n getSeparatorClass(state, rootStyles),\n rootStyles[state.position],\n state.root.className,\n );\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","drawerCSSVars","drawerDefaultStyles","useDrawerBaseClassNames","inlineDrawerClassNames","root","useDrawerResetStyles","position","borderValue","colorNeutralBackground3","useDrawerRootStyles","separatorStart","borderRight","separatorEnd","borderLeft","separatorBottom","borderTop","start","end","bottom","width","height","drawerSizeVar","getSeparatorClass","state","classNames","separator","undefined","useInlineDrawerStyles_unstable","resetStyles","baseClassNames","rootStyles","className"],"mappings":"AAAA;;;;;;;;;;;;IASaO,sBAAAA;;;IAmDAwB,8BAAAA;;;;uBA1D6C,iBAAiB;4BAEpD,wBAAwB;2CAG6B,0CAA0C;AAE/G,+BAAyF;IAC9FvB,MAAM;AACR,EAAE;AAEF,MAAMC,2BAAuBT,sBAAAA,EAAgB;IAC3C,GAAGK,8CAAmB;IACtBK,UAAU;AACZ;AAEA;;CAEC,GACD,MAAMC,cAAc,CAAC,UAAU,EAAER,kBAAAA,CAAOS,uBAAuB,EAAE;AACjE,MAAMC,0BAAsBZ,iBAAAA,EAAW;IACrC,aAAa,GACba,gBAAgB;QAAEC,aAAaJ;IAAY;IAC3CK,cAAc;QAAEC,YAAYN;IAAY;IACxCO,iBAAiB;QAAEC,WAAWR;IAAY;IAE1C,eAAe,GACfS,OAAO,CAAC;IACRC,KAAK,CAAC;IACNC,QAAQ;QACNC,OAAO;QACPC,QAAQ,CAAC,IAAI,EAAEpB,wCAAAA,CAAcqB,aAAa,CAAC,CAAC,CAAC;IAC/C;AACF;AAEA,SAASC,kBAAkBC,KAAwB,EAAEC,UAAkD;IACrG,IAAI,CAACD,MAAME,SAAS,EAAE;QACpB,OAAOC;IACT;IAEA,OAAQH,MAAMjB,QAAQ;QACpB,KAAK;YACH,OAAOkB,WAAWd,cAAc;QAElC,KAAK;YACH,OAAOc,WAAWZ,YAAY;QAEhC,KAAK;YACH,OAAOY,WAAWV,eAAe;QAEnC;YACE,OAAOY;IACX;AACF;AAKO,uCAAuC,CAACH;IAC7C;IAEA,MAAMK,cAAcvB;IACpB,MAAMwB,qBAAiB3B,kDAAAA,EAAwBqB;IAC/C,MAAMO,aAAarB;IAEnBc,MAAMnB,IAAI,CAAC2B,SAAS,OAAGjC,mBAAAA,EACrBK,uBAAuBC,IAAI,EAC3BwB,aACAC,gBACAP,kBAAkBC,OAAOO,aACzBA,UAAU,CAACP,MAAMjB,QAAQ,CAAC,EAC1BiB,MAAMnB,IAAI,CAAC2B,SAAS;IAGtB,OAAOR;AACT,EAAE"}
1
+ {"version":3,"sources":["../src/components/InlineDrawer/useInlineDrawerStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { tokens } from '@fluentui/react-theme';\n\nimport type { InlineDrawerSlots, InlineDrawerState } from './InlineDrawer.types';\nimport { drawerCSSVars, drawerDefaultStyles, useDrawerBaseClassNames } from '../../shared/useDrawerBaseStyles.styles';\n\nexport const inlineDrawerClassNames: SlotClassNames<Omit<InlineDrawerSlots, 'surfaceMotion'>> = {\n root: 'fui-InlineDrawer',\n};\n\nconst useDrawerResetStyles = makeResetStyles({\n ...drawerDefaultStyles,\n position: 'relative',\n});\n\n/**\n * Styles for the root slot\n */\nconst borderValue = `1px solid ${tokens.colorNeutralBackground3}`;\nconst useDrawerRootStyles = makeStyles({\n /* Separator */\n separatorStart: { borderRight: borderValue },\n separatorEnd: { borderLeft: borderValue },\n separatorBottom: { borderTop: borderValue },\n\n /* Positioning */\n start: {},\n end: {},\n bottom: {\n width: '100%',\n height: `var(${drawerCSSVars.drawerSizeVar})`,\n },\n\n /* Animation exit states */\n animationExitStart: {\n width: '0',\n border: 'none',\n },\n animationExitEnd: {\n width: '0',\n border: 'none',\n },\n animationExitBottom: {\n height: '0',\n border: 'none',\n },\n});\n\nfunction getSeparatorClass(state: InlineDrawerState, classNames: ReturnType<typeof useDrawerRootStyles>) {\n if (!state.separator) {\n return undefined;\n }\n\n switch (state.position) {\n case 'start':\n return classNames.separatorStart;\n\n case 'end':\n return classNames.separatorEnd;\n\n case 'bottom':\n return classNames.separatorBottom;\n\n default:\n return undefined;\n }\n}\n\nfunction getAnimationExitClass(state: InlineDrawerState, classNames: ReturnType<typeof useDrawerRootStyles>) {\n switch (state.position) {\n case 'start':\n return classNames.animationExitStart;\n\n case 'end':\n return classNames.animationExitEnd;\n\n case 'bottom':\n return classNames.animationExitBottom;\n\n default:\n return undefined;\n }\n}\n\n/**\n * Apply styling to the InlineDrawer slots based on the state\n */\nexport const useInlineDrawerStyles_unstable = (state: InlineDrawerState): InlineDrawerState => {\n 'use no memo';\n\n const resetStyles = useDrawerResetStyles();\n const baseClassNames = useDrawerBaseClassNames(state);\n const rootStyles = useDrawerRootStyles();\n\n state.root.className = mergeClasses(\n inlineDrawerClassNames.root,\n resetStyles,\n baseClassNames,\n getSeparatorClass(state, rootStyles),\n rootStyles[state.position],\n state.animationDirection === 'exit' && getAnimationExitClass(state, rootStyles),\n state.root.className,\n );\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","drawerCSSVars","drawerDefaultStyles","useDrawerBaseClassNames","inlineDrawerClassNames","root","useDrawerResetStyles","position","borderValue","colorNeutralBackground3","useDrawerRootStyles","separatorStart","borderRight","separatorEnd","borderLeft","separatorBottom","borderTop","start","end","bottom","width","height","drawerSizeVar","animationExitStart","border","animationExitEnd","animationExitBottom","getSeparatorClass","state","classNames","separator","undefined","getAnimationExitClass","useInlineDrawerStyles_unstable","resetStyles","baseClassNames","rootStyles","className","animationDirection"],"mappings":"AAAA;;;;;;;;;;;;IASaO,sBAAAA;;;kCAiFA6B;;;;uBAxF6C,iBAAiB;4BAEpD,wBAAwB;2CAG6B,0CAA0C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IACpB,MAAM6B,qBAAiBhC,kDAAAA,EAAwByB;IAC/C,MAAMQ,aAAa1B;IAEnBkB,MAAMvB,IAAI,CAACgC,SAAS,OAAGtC,mBAAAA,EACrBK,uBAAuBC,IAAI,EAC3B6B,aACAC,gBACAR,kBAAkBC,OAAOQ,aACzBA,UAAU,CAACR,MAAMrB,QAAQ,CAAC,EAC1BqB,MAAMU,kBAAkB,KAAK,UAAUN,sBAAsBJ,OAAOQ,aACpER,MAAMvB,IAAI,CAACgC,SAAS;IAGtB,OAAOT;AACT,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/OverlayDrawer/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 * For more information refer to the [Motion docs page](https://react.fluentui.dev/?path=/docs/motion-motion-slot--docs).\n *\n */\n backdropMotion?: Slot<PresenceMotionSlotProps<OverlayDrawerSurfaceMotionParams>>;\n /**\n * For more information refer to the [Motion docs page](https://react.fluentui.dev/?path=/docs/motion-motion-slot--docs).\n *\n */\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: NonNullable<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> &\n Required<DrawerBaseState> &\n Pick<OverlayDrawerProps, 'mountNode'> & {\n hasMountNodeElement: boolean;\n };\n"],"names":[],"mappings":"AAmDA;;CAEC,GACD,WAII"}
1
+ {"version":3,"sources":["../src/components/OverlayDrawer/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 * For more information refer to the [Motion docs page](https://react.fluentui.dev/?path=/docs/motion-motion-slot--docs).\n *\n */\n backdropMotion?: Slot<PresenceMotionSlotProps<OverlayDrawerSurfaceMotionParams>>;\n /**\n * For more information refer to the [Motion docs page](https://react.fluentui.dev/?path=/docs/motion-motion-slot--docs).\n *\n */\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: NonNullable<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> &\n Required<DrawerBaseState> &\n Pick<OverlayDrawerProps, 'mountNode' | 'unmountOnClose'> & {\n hasMountNodeElement: boolean;\n };\n"],"names":[],"mappings":"AAmDA;;CAEC,GACD,WAII"}
@@ -18,18 +18,24 @@ const _react = require("@griffel/react");
18
18
  const useBackdropStyles = /*#__PURE__*/ (0, _react.__styles)({
19
19
  nested: {
20
20
  De3pzq: "f1c21dwh"
21
+ },
22
+ drawerHidden: {
23
+ Bkecrkj: "f1aehjj5"
21
24
  }
22
25
  }, {
23
26
  d: [
24
- ".f1c21dwh{background-color:var(--colorTransparentBackground);}"
27
+ ".f1c21dwh{background-color:var(--colorTransparentBackground);}",
28
+ ".f1aehjj5{pointer-events:none;}"
25
29
  ]
26
30
  });
27
31
  const useOverlayDrawerSurfaceStyles_unstable = (state)=>{
28
32
  'use no memo';
33
+ const { isNestedDialog, backdrop, open, unmountOnClose } = state;
29
34
  const backdropResetStyles = useBackdropResetStyles();
30
35
  const backdropStyles = useBackdropStyles();
31
- if (state.backdrop) {
32
- state.backdrop.className = (0, _react.mergeClasses)(backdropResetStyles, state.isNestedDialog && backdropStyles.nested, state.backdrop.className);
36
+ const mountedAndClosed = !unmountOnClose && !open;
37
+ if (backdrop) {
38
+ backdrop.className = (0, _react.mergeClasses)(backdropResetStyles, isNestedDialog && backdropStyles.nested, mountedAndClosed && backdropStyles.drawerHidden, backdrop.className);
33
39
  }
34
40
  return state;
35
41
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["useOverlayDrawerSurfaceStyles.styles.js"],"sourcesContent":["'use client';\nimport { 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: tokens.colorBackgroundOverlay\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"],"names":["__resetStyles","__styles","mergeClasses","tokens","useBackdropResetStyles","useBackdropStyles","nested","De3pzq","d","useOverlayDrawerSurfaceStyles_unstable","state","backdropResetStyles","backdropStyles","backdrop","className","isNestedDialog"],"mappings":"AAAA,YAAY;;;;;+BAiBKS,sCAAsC;;;;;;uBAhBG,gBAAgB;AAE1E;;CAEA,GAAI,MAAML,sBAAsB,GAAA,WAAA,OAAGJ,oBAAA,EAAA,WAAA,MAAA;IAAA;CAIlC,CAAC;AACF,MAAMK,iBAAiB,GAAA,WAAA,OAAGJ,eAAA,EAAA;IAAAK,MAAA,EAAA;QAAAC,MAAA,EAAA;IAAA;AAAA,GAAA;IAAAC,CAAA,EAAA;QAAA;KAAA;AAAA,CAIzB,CAAC;AAGS,gDAAgDE,KAAK,IAAG;IAC/D,aAAa;IACb,MAAMC,mBAAmB,GAAGP,sBAAsB,CAAC,CAAC;IACpD,MAAMQ,cAAc,GAAGP,iBAAiB,CAAC,CAAC;IAC1C,IAAIK,KAAK,CAACG,QAAQ,EAAE;QAChBH,KAAK,CAACG,QAAQ,CAACC,SAAS,OAAGZ,mBAAY,EAACS,mBAAmB,EAAED,KAAK,CAACK,cAAc,IAAIH,cAAc,CAACN,MAAM,EAAEI,KAAK,CAACG,QAAQ,CAACC,SAAS,CAAC;IACzI;IACA,OAAOJ,KAAK;AAChB,CAAC"}
1
+ {"version":3,"sources":["useOverlayDrawerSurfaceStyles.styles.js"],"sourcesContent":["'use client';\nimport { 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: tokens.colorBackgroundOverlay\n});\nconst useBackdropStyles = makeStyles({\n nested: {\n backgroundColor: tokens.colorTransparentBackground\n },\n drawerHidden: {\n pointerEvents: 'none'\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 { isNestedDialog, backdrop, open, unmountOnClose } = state;\n const backdropResetStyles = useBackdropResetStyles();\n const backdropStyles = useBackdropStyles();\n const mountedAndClosed = !unmountOnClose && !open;\n if (backdrop) {\n backdrop.className = mergeClasses(backdropResetStyles, isNestedDialog && backdropStyles.nested, mountedAndClosed && backdropStyles.drawerHidden, backdrop.className);\n }\n return state;\n};\n"],"names":["__resetStyles","__styles","mergeClasses","tokens","useBackdropResetStyles","useBackdropStyles","nested","De3pzq","drawerHidden","Bkecrkj","d","useOverlayDrawerSurfaceStyles_unstable","state","isNestedDialog","backdrop","open","unmountOnClose","backdropResetStyles","backdropStyles","mountedAndClosed","className"],"mappings":"AAAA,YAAY;;;;;+BAoBKW,sCAAsC;;;;;;uBAnBG,gBAAgB;AAE1E;;CAEA,GAAI,MAAMP,sBAAsB,GAAA,WAAA,OAAGJ,oBAAA,EAAA,WAAA,MAAA;IAAA;CAIlC,CAAC;AACF,MAAMK,iBAAiB,GAAA,WAAA,OAAGJ,eAAA,EAAA;IAAAK,MAAA,EAAA;QAAAC,MAAA,EAAA;IAAA;IAAAC,YAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;AAAA,GAAA;IAAAC,CAAA,EAAA;QAAA;QAAA;KAAA;AAAA,CAOzB,CAAC;AAGS,gDAAgDE,KAAK,IAAG;IAC/D,aAAa;IACb,MAAM,EAAEC,cAAc,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,cAAAA,EAAgB,GAAGJ,KAAK;IAChE,MAAMK,mBAAmB,GAAGb,sBAAsB,CAAC,CAAC;IACpD,MAAMc,cAAc,GAAGb,iBAAiB,CAAC,CAAC;IAC1C,MAAMc,gBAAgB,GAAG,CAACH,cAAc,IAAI,CAACD,IAAI;IACjD,IAAID,QAAQ,EAAE;QACVA,QAAQ,CAACM,SAAS,OAAGlB,mBAAY,EAACe,mBAAmB,EAAEJ,cAAc,IAAIK,cAAc,CAACZ,MAAM,EAAEa,gBAAgB,IAAID,cAAc,CAACV,YAAY,EAAEM,QAAQ,CAACM,SAAS,CAAC;IACxK;IACA,OAAOR,KAAK;AAChB,CAAC"}
@@ -21,14 +21,19 @@ const _reacttheme = require("@fluentui/react-theme");
21
21
  const useBackdropStyles = (0, _react.makeStyles)({
22
22
  nested: {
23
23
  backgroundColor: _reacttheme.tokens.colorTransparentBackground
24
+ },
25
+ drawerHidden: {
26
+ pointerEvents: 'none'
24
27
  }
25
28
  });
26
29
  const useOverlayDrawerSurfaceStyles_unstable = (state)=>{
27
30
  'use no memo';
31
+ const { isNestedDialog, backdrop, open, unmountOnClose } = state;
28
32
  const backdropResetStyles = useBackdropResetStyles();
29
33
  const backdropStyles = useBackdropStyles();
30
- if (state.backdrop) {
31
- state.backdrop.className = (0, _react.mergeClasses)(backdropResetStyles, state.isNestedDialog && backdropStyles.nested, state.backdrop.className);
34
+ const mountedAndClosed = !unmountOnClose && !open;
35
+ if (backdrop) {
36
+ backdrop.className = (0, _react.mergeClasses)(backdropResetStyles, isNestedDialog && backdropStyles.nested, mountedAndClosed && backdropStyles.drawerHidden, backdrop.className);
32
37
  }
33
38
  return state;
34
39
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/OverlayDrawer/OverlayDrawerSurface/useOverlayDrawerSurfaceStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { DialogSurfaceState } from '@fluentui/react-dialog';\n\n/**\n * Styles for the backdrop slot\n */\nconst useBackdropResetStyles = makeResetStyles({\n inset: '0px',\n position: 'fixed',\n backgroundColor: tokens.colorBackgroundOverlay,\n});\n\nconst useBackdropStyles = makeStyles({\n nested: {\n backgroundColor: tokens.colorTransparentBackground,\n },\n});\n\n/**\n * Apply styling to the OverlayDrawerSurface slots based on the state\n */\nexport const useOverlayDrawerSurfaceStyles_unstable = (state: DialogSurfaceState): DialogSurfaceState => {\n 'use no memo';\n\n const backdropResetStyles = useBackdropResetStyles();\n const backdropStyles = useBackdropStyles();\n\n if (state.backdrop) {\n state.backdrop.className = mergeClasses(\n backdropResetStyles,\n state.isNestedDialog && backdropStyles.nested,\n state.backdrop.className,\n );\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","useBackdropResetStyles","inset","position","backgroundColor","colorBackgroundOverlay","useBackdropStyles","nested","colorTransparentBackground","useOverlayDrawerSurfaceStyles_unstable","state","backdropResetStyles","backdropStyles","backdrop","className","isNestedDialog"],"mappings":"AAAA;;;;;+BAwBaY;;;;;;uBAtB6C,iBAAiB;4BACpD,wBAAwB;AAG/C;;CAEC,GACD,MAAMR,6BAAyBJ,sBAAAA,EAAgB;IAC7CK,OAAO;IACPC,UAAU;IACVC,iBAAiBJ,kBAAAA,CAAOK,sBAAsB;AAChD;AAEA,MAAMC,wBAAoBR,iBAAAA,EAAW;IACnCS,QAAQ;QACNH,iBAAiBJ,kBAAAA,CAAOQ,0BAA0B;IACpD;AACF;AAKO,+CAA+C,CAACE;IACrD;IAEA,MAAMC,sBAAsBV;IAC5B,MAAMW,iBAAiBN;IAEvB,IAAII,MAAMG,QAAQ,EAAE;QAClBH,MAAMG,QAAQ,CAACC,SAAS,OAAGf,mBAAAA,EACzBY,qBACAD,MAAMK,cAAc,IAAIH,eAAeL,MAAM,EAC7CG,MAAMG,QAAQ,CAACC,SAAS;IAE5B;IAEA,OAAOJ;AACT,EAAE"}
1
+ {"version":3,"sources":["../src/components/OverlayDrawer/OverlayDrawerSurface/useOverlayDrawerSurfaceStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { DialogSurfaceState } from '@fluentui/react-dialog';\n\n/**\n * Styles for the backdrop slot\n */\nconst useBackdropResetStyles = makeResetStyles({\n inset: '0px',\n position: 'fixed',\n backgroundColor: tokens.colorBackgroundOverlay,\n});\n\nconst useBackdropStyles = makeStyles({\n nested: {\n backgroundColor: tokens.colorTransparentBackground,\n },\n\n drawerHidden: {\n pointerEvents: 'none',\n },\n});\n\n/**\n * Apply styling to the OverlayDrawerSurface slots based on the state\n */\nexport const useOverlayDrawerSurfaceStyles_unstable = (state: DialogSurfaceState): DialogSurfaceState => {\n 'use no memo';\n\n const { isNestedDialog, backdrop, open, unmountOnClose } = state;\n\n const backdropResetStyles = useBackdropResetStyles();\n const backdropStyles = useBackdropStyles();\n\n const mountedAndClosed = !unmountOnClose && !open;\n\n if (backdrop) {\n backdrop.className = mergeClasses(\n backdropResetStyles,\n isNestedDialog && backdropStyles.nested,\n mountedAndClosed && backdropStyles.drawerHidden,\n backdrop.className,\n );\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","useBackdropResetStyles","inset","position","backgroundColor","colorBackgroundOverlay","useBackdropStyles","nested","colorTransparentBackground","drawerHidden","pointerEvents","useOverlayDrawerSurfaceStyles_unstable","state","isNestedDialog","backdrop","open","unmountOnClose","backdropResetStyles","backdropStyles","mountedAndClosed","className"],"mappings":"AAAA;;;;;+BA4Bac;;;;;;uBA1B6C,iBAAiB;4BACpD,wBAAwB;AAG/C;;CAEC,GACD,MAAMV,6BAAyBJ,sBAAAA,EAAgB;IAC7CK,OAAO;IACPC,UAAU;IACVC,iBAAiBJ,kBAAAA,CAAOK,sBAAsB;AAChD;AAEA,MAAMC,wBAAoBR,iBAAAA,EAAW;IACnCS,QAAQ;QACNH,iBAAiBJ,kBAAAA,CAAOQ,0BAA0B;IACpD;IAEAC,cAAc;QACZC,eAAe;IACjB;AACF;AAKO,+CAA+C,CAACE;IACrD;IAEA,MAAM,EAAEC,cAAc,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,cAAc,EAAE,GAAGJ;IAE3D,MAAMK,sBAAsBhB;IAC5B,MAAMiB,iBAAiBZ;IAEvB,MAAMa,mBAAmB,CAACH,kBAAkB,CAACD;IAE7C,IAAID,UAAU;QACZA,SAASM,SAAS,OAAGrB,mBAAAA,EACnBkB,qBACAJ,kBAAkBK,eAAeX,MAAM,EACvCY,oBAAoBD,eAAeT,YAAY,EAC/CK,SAASM,SAAS;IAEtB;IAEA,OAAOR;AACT,EAAE"}
@@ -26,8 +26,8 @@ const STATIC_MOTION = {
26
26
  type: 'idle'
27
27
  };
28
28
  const useOverlayDrawer_unstable = (props, ref)=>{
29
- const { open, size, position } = (0, _useDrawerDefaultProps.useDrawerDefaultProps)(props);
30
- const { backdropMotion, modalType = 'modal', inertTrapFocus, onOpenChange, surfaceMotion, mountNode } = props;
29
+ const { open, size, position, unmountOnClose } = (0, _useDrawerDefaultProps.useDrawerDefaultProps)(props);
30
+ const { modalType = 'modal', inertTrapFocus, onOpenChange, backdropMotion, surfaceMotion, mountNode } = props;
31
31
  const { dir, targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
32
32
  const { element: mountNodeElement } = (0, _reactportal.toMountNodeProps)(mountNode);
33
33
  const hasMountNodeElement = Boolean(mountNodeElement && (targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.body) !== mountNodeElement);
@@ -36,6 +36,7 @@ const useOverlayDrawer_unstable = (props, ref)=>{
36
36
  const root = _reactutilities.slot.always({
37
37
  ...props,
38
38
  ref,
39
+ unmountOnClose,
39
40
  backdrop: hasCustomBackdrop ? {
40
41
  ...backdropProps
41
42
  } : null,
@@ -43,16 +44,14 @@ const useOverlayDrawer_unstable = (props, ref)=>{
43
44
  size
44
45
  })
45
46
  }, {
46
- /**
47
- * Drawer accepts a `div` or `aside` element type, but Dialog only accepts a `div` element type.
48
- * We need to cast the ref to a `div` element type to not break Dialog's ref type.
49
- */ elementType: _OverlayDrawerSurface.OverlayDrawerSurface
47
+ elementType: _OverlayDrawerSurface.OverlayDrawerSurface
50
48
  });
51
49
  const dialog = _reactutilities.slot.always({
52
50
  open,
53
51
  onOpenChange,
54
52
  inertTrapFocus,
55
53
  modalType,
54
+ unmountOnClose,
56
55
  surfaceMotion: (0, _drawerMotionUtils.mergePresenceSlots)(surfaceMotion, _drawerMotions.OverlayDrawerMotion, {
57
56
  position,
58
57
  size,
@@ -76,6 +75,7 @@ const useOverlayDrawer_unstable = (props, ref)=>{
76
75
  size,
77
76
  position,
78
77
  hasMountNodeElement,
78
+ unmountOnClose,
79
79
  // Deprecated props
80
80
  mountNode,
81
81
  motion: STATIC_MOTION
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/OverlayDrawer/useOverlayDrawer.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Dialog } from '@fluentui/react-dialog';\nimport { slot } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { toMountNodeProps } from '@fluentui/react-portal';\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, mountNode } = props;\n const { dir, targetDocument } = useFluent();\n const { element: mountNodeElement } = toMountNodeProps(mountNode);\n const hasMountNodeElement = Boolean(mountNodeElement && targetDocument?.body !== mountNodeElement);\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, dir }),\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 JSXElement,\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 hasMountNodeElement,\n\n // Deprecated props\n mountNode,\n motion: STATIC_MOTION,\n };\n};\n"],"names":["React","Dialog","slot","useFluent_unstable","useFluent","toMountNodeProps","OverlayDrawerMotion","OverlaySurfaceBackdropMotion","useDrawerDefaultProps","OverlayDrawerSurface","mergePresenceSlots","STATIC_MOTION","active","canRender","ref","createRef","type","useOverlayDrawer_unstable","props","open","size","position","backdropMotion","modalType","inertTrapFocus","onOpenChange","surfaceMotion","mountNode","dir","targetDocument","element","mountNodeElement","hasMountNodeElement","Boolean","body","backdropProps","resolveShorthand","backdrop","hasCustomBackdrop","root","always","elementType","dialog","children","components","motion"],"mappings":"AAAA;;;;;+BA+BaiB;;;;;;;iEA7BU,QAAQ;6BACR,yBAAyB;gCAC3B,4BAA4B;qCAED,kCAAkC;6BACjD,yBAAyB;+BAEQ,6BAA6B;uCACzD,qCAAqC;sCAEtC,yBAAyB;mCAC3B,iCAAiC;AAEpE,MAAMN,gBAAgB;IACpBC,QAAQ;IACRC,WAAW;IACXC,KAAAA,WAAAA,GAAKd,OAAMe,SAAS;IACpBC,MAAM;AACR;AAWO,kCAAkC,CACvCE,OACAJ;IAEA,MAAM,EAAEK,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAE,OAAGb,4CAAAA,EAAsBU;IACvD,MAAM,EAAEI,cAAc,EAAEC,YAAY,OAAO,EAAEC,cAAc,EAAEC,YAAY,EAAEC,aAAa,EAAEC,SAAS,EAAE,GAAGT;IACxG,MAAM,EAAEU,GAAG,EAAEC,cAAc,EAAE,OAAGzB,uCAAAA;IAChC,MAAM,EAAE0B,SAASC,gBAAgB,EAAE,OAAG1B,6BAAAA,EAAiBsB;IACvD,MAAMK,sBAAsBC,QAAQF,oBAAoBF,oBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBK,IAAAA,AAAI,MAAKH;IAEjF,MAAMI,gBAAgBjC,oBAAAA,CAAKkC,gBAAgB,CAAClB,MAAMmB,QAAQ;IAC1D,MAAMC,oBAAoBf,cAAc,eAAeY,kBAAkB;IAEzE,MAAMI,OAAOrC,oBAAAA,CAAKsC,MAAM,CACtB;QACE,GAAGtB,KAAK;QACRJ;QACAuB,UAAUC,oBAAoB;YAAE,GAAGH,aAAa;QAAC,IAAI;QACrDb,oBAAgBZ,qCAAAA,EAAmBY,gBAAgBf,2CAAAA,EAA8B;YAAEa;QAAK;IAC1F,GACA;QACE;;;OAGC,GACDqB,aAAahC,0CAAAA;IACf;IAGF,MAAMiC,SAASxC,oBAAAA,CAAKsC,MAAM,CACxB;QACErB;QACAM;QACAD;QACAD;QACAG,mBAAehB,qCAAAA,EAAmBgB,eAAepB,kCAAAA,EAAqB;YAAEe;YAAUD;YAAMQ;QAAI;QAC5F;;;OAGC,GACDe,UAAU;IACZ,GACA;QACEF,aAAaxC,mBAAAA;IACf;IAGF,OAAO;QACL2C,YAAY;YACVL,MAAM9B,0CAAAA;YACNiC,QAAQzC,mBAAAA;QACV;QAEAsC;QACAG;QAEAvB;QACAC;QACAC;QACAW;QAEA,mBAAmB;QACnBL;QACAkB,QAAQlC;IACV;AACF,EAAE"}
1
+ {"version":3,"sources":["../src/components/OverlayDrawer/useOverlayDrawer.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Dialog } from '@fluentui/react-dialog';\nimport { slot } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { toMountNodeProps } from '@fluentui/react-portal';\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, unmountOnClose } = useDrawerDefaultProps(props);\n const { modalType = 'modal', inertTrapFocus, onOpenChange, backdropMotion, surfaceMotion, mountNode } = props;\n const { dir, targetDocument } = useFluent();\n const { element: mountNodeElement } = toMountNodeProps(mountNode);\n const hasMountNodeElement = Boolean(mountNodeElement && targetDocument?.body !== mountNodeElement);\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 unmountOnClose,\n backdrop: hasCustomBackdrop ? { ...backdropProps } : null,\n backdropMotion: mergePresenceSlots(backdropMotion, OverlaySurfaceBackdropMotion, { size }),\n },\n {\n elementType: OverlayDrawerSurface,\n },\n );\n\n const dialog = slot.always(\n {\n open,\n onOpenChange,\n inertTrapFocus,\n modalType,\n unmountOnClose,\n surfaceMotion: mergePresenceSlots(surfaceMotion, OverlayDrawerMotion, { position, size, dir }),\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 JSXElement,\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 hasMountNodeElement,\n unmountOnClose,\n\n // Deprecated props\n mountNode,\n motion: STATIC_MOTION,\n };\n};\n"],"names":["React","Dialog","slot","useFluent_unstable","useFluent","toMountNodeProps","OverlayDrawerMotion","OverlaySurfaceBackdropMotion","useDrawerDefaultProps","OverlayDrawerSurface","mergePresenceSlots","STATIC_MOTION","active","canRender","ref","createRef","type","useOverlayDrawer_unstable","props","open","size","position","unmountOnClose","modalType","inertTrapFocus","onOpenChange","backdropMotion","surfaceMotion","mountNode","dir","targetDocument","element","mountNodeElement","hasMountNodeElement","Boolean","body","backdropProps","resolveShorthand","backdrop","hasCustomBackdrop","root","always","elementType","dialog","children","components","motion"],"mappings":"AAAA;;;;;+BA+BaiB;;;;;;;iEA7BU,QAAQ;6BACR,yBAAyB;gCAC3B,4BAA4B;qCAED,kCAAkC;6BACjD,yBAAyB;+BAEQ,6BAA6B;uCACzD,qCAAqC;sCAEtC,yBAAyB;mCAC3B,iCAAiC;AAEpE,MAAMN,gBAAgB;IACpBC,QAAQ;IACRC,WAAW;IACXC,KAAAA,WAAAA,GAAKd,OAAMe,SAAS;IACpBC,MAAM;AACR;AAWO,kCAAkC,CACvCE,OACAJ;IAEA,MAAM,EAAEK,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,cAAc,EAAE,OAAGd,4CAAAA,EAAsBU;IACvE,MAAM,EAAEK,YAAY,OAAO,EAAEC,cAAc,EAAEC,YAAY,EAAEC,cAAc,EAAEC,aAAa,EAAEC,SAAS,EAAE,GAAGV;IACxG,MAAM,EAAEW,GAAG,EAAEC,cAAc,EAAE,OAAG1B,uCAAAA;IAChC,MAAM,EAAE2B,SAASC,gBAAgB,EAAE,OAAG3B,6BAAAA,EAAiBuB;IACvD,MAAMK,sBAAsBC,QAAQF,oBAAoBF,CAAAA,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBK,IAAAA,AAAI,MAAKH;IAEjF,MAAMI,gBAAgBlC,oBAAAA,CAAKmC,gBAAgB,CAACnB,MAAMoB,QAAQ;IAC1D,MAAMC,oBAAoBhB,cAAc,eAAea,kBAAkB;IAEzE,MAAMI,OAAOtC,oBAAAA,CAAKuC,MAAM,CACtB;QACE,GAAGvB,KAAK;QACRJ;QACAQ;QACAgB,UAAUC,oBAAoB;YAAE,GAAGH,aAAa;QAAC,IAAI;QACrDV,oBAAgBhB,qCAAAA,EAAmBgB,gBAAgBnB,2CAAAA,EAA8B;YAAEa;QAAK;IAC1F,GACA;QACEsB,aAAajC,0CAAAA;IACf;IAGF,MAAMkC,SAASzC,oBAAAA,CAAKuC,MAAM,CACxB;QACEtB;QACAM;QACAD;QACAD;QACAD;QACAK,mBAAejB,qCAAAA,EAAmBiB,eAAerB,kCAAAA,EAAqB;YAAEe;YAAUD;YAAMS;QAAI;QAC5F;;;OAGC,GACDe,UAAU;IACZ,GACA;QACEF,aAAazC,mBAAAA;IACf;IAGF,OAAO;QACL4C,YAAY;YACVL,MAAM/B,0CAAAA;YACNkC,QAAQ1C,mBAAAA;QACV;QAEAuC;QACAG;QAEAxB;QACAC;QACAC;QACAY;QACAX;QAEA,mBAAmB;QACnBM;QACAkB,QAAQnC;IACV;AACF,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/shared/DrawerBase.types.ts"],"sourcesContent":["import * as React from 'react';\n\ntype MotionType = 'entering' | 'entered' | 'idle' | 'exiting' | 'exited' | 'unmounted';\n\ntype MotionState<Element extends HTMLElement = HTMLElement> = {\n /**\n * Ref to the element.\n */\n ref: React.Ref<Element>;\n\n /**\n * Current state of the element.\n *\n * - `unmounted` - The element is not yet rendered or can be safely removed from the DOM.\n * - `entering` - The element is performing enter animation.\n * - `entered` - The element has finished enter animation.\n * - `idle` - The element is currently not animating, but rendered on screen.\n * - `exiting` - The element is performing exit animation.\n * - `exited` - The element has finished exit animation.\n */\n type: MotionType;\n\n /**\n * Indicates whether the component can be rendered.\n * Useful to render the element before animating it or to remove it from the DOM after exit animation.\n */\n canRender: boolean;\n\n /**\n * Indicates whether the component is ready to receive a CSS transition className.\n * Useful to apply CSS transitions when the element is mounted and ready to be animated.\n */\n active: boolean;\n};\n\nexport type DrawerBaseProps = {\n /**\n * Position of the drawer.\n *\n * Note: 'bottom' does not supports size, but it supports customized height.\n *\n * @default 'start'\n */\n position?: 'start' | 'end' | 'bottom';\n\n /**\n * Size of the drawer.\n *\n * - 'small' - Drawer is 320px wide.\n * - 'medium' - Drawer is 592px wide.\n * - 'large' - Drawer is 940px wide.\n * - 'full' - Drawer is 100vw wide.\n *\n * @default 'small'\n */\n size?: 'small' | 'medium' | 'large' | 'full';\n\n /**\n * Controls the open state of the Drawer\n *\n * @default false\n */\n open?: boolean;\n};\n\nexport type DrawerBaseState = Required<Pick<DrawerBaseProps, 'position' | 'size'>> & {\n /**\n * @deprecated Passed values will be static.\n */\n motion: MotionState<HTMLElement>;\n\n open?: boolean;\n};\n\nexport type DrawerScrollState = 'none' | 'top' | 'middle' | 'bottom';\n"],"names":["React"],"mappings":";;;;;iEAAuB,QAAQ"}
1
+ {"version":3,"sources":["../src/shared/DrawerBase.types.ts"],"sourcesContent":["import * as React from 'react';\n\ntype MotionType = 'entering' | 'entered' | 'idle' | 'exiting' | 'exited' | 'unmounted';\n\ntype MotionState<Element extends HTMLElement = HTMLElement> = {\n /**\n * Ref to the element.\n */\n ref: React.Ref<Element>;\n\n /**\n * Current state of the element.\n *\n * - `unmounted` - The element is not yet rendered or can be safely removed from the DOM.\n * - `entering` - The element is performing enter animation.\n * - `entered` - The element has finished enter animation.\n * - `idle` - The element is currently not animating, but rendered on screen.\n * - `exiting` - The element is performing exit animation.\n * - `exited` - The element has finished exit animation.\n */\n type: MotionType;\n\n /**\n * Indicates whether the component can be rendered.\n * Useful to render the element before animating it or to remove it from the DOM after exit animation.\n */\n canRender: boolean;\n\n /**\n * Indicates whether the component is ready to receive a CSS transition className.\n * Useful to apply CSS transitions when the element is mounted and ready to be animated.\n */\n active: boolean;\n};\n\nexport type DrawerBaseProps = {\n /**\n * Position of the drawer.\n *\n * Note: 'bottom' does not supports size, but it supports customized height.\n *\n * @default 'start'\n */\n position?: 'start' | 'end' | 'bottom';\n\n /**\n * Size of the drawer.\n *\n * - 'small' - Drawer is 320px wide.\n * - 'medium' - Drawer is 592px wide.\n * - 'large' - Drawer is 940px wide.\n * - 'full' - Drawer is 100vw wide.\n *\n * @default 'small'\n */\n size?: 'small' | 'medium' | 'large' | 'full';\n\n /**\n * Controls the open state of the Drawer\n *\n * @default false\n */\n open?: boolean;\n\n /**\n * Decides whether the drawer should be removed from the DOM tree when it is closed.\n * This can be useful when dealing with components that may contain state that should not\n * be reset when the drawer is closed.\n *\n * @default true\n */\n unmountOnClose?: boolean;\n};\n\nexport type DrawerBaseState = Required<Pick<DrawerBaseProps, 'position' | 'size'>> & {\n /**\n * @deprecated Passed values will be static.\n */\n motion: MotionState<HTMLElement>;\n\n open?: boolean;\n\n unmountOnClose?: boolean;\n};\n\nexport type DrawerScrollState = 'none' | 'top' | 'middle' | 'bottom';\n"],"names":["React"],"mappings":";;;;;iEAAuB,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/shared/drawerMotions.ts"],"sourcesContent":["import { createPresenceComponent, motionTokens } from '@fluentui/react-motion';\nimport { tokens } from '@fluentui/react-theme';\nimport { ProviderContextValue_unstable as FluentProviderContextValue } from '@fluentui/react-shared-contexts';\n\nimport type { DrawerBaseProps } from './DrawerBase.types';\nimport { drawerCSSVars } from './useDrawerBaseStyles.styles';\nimport { fadeAtom } from '@fluentui/react-motion-components-preview';\n\nexport type DrawerMotionParams = Required<\n Pick<DrawerBaseProps, 'size' | 'position'> & Pick<FluentProviderContextValue, 'dir'>\n>;\nexport type OverlayDrawerSurfaceMotionParams = Required<Pick<DrawerBaseProps, 'size'>>;\n\nconst durations: Record<NonNullable<DrawerBaseProps['size']>, number> = {\n small: motionTokens.durationGentle,\n medium: motionTokens.durationSlow,\n large: motionTokens.durationSlower,\n full: motionTokens.durationUltraSlow,\n};\n\n/**\n * @internal\n */\nexport function getPositionTransform(\n position: DrawerBaseProps['position'],\n sizeVar: string,\n dir: FluentProviderContextValue['dir'],\n): string {\n const leftToRightTransform = `translate3d(var(${sizeVar}), 0, 0)`;\n const rightToLeftTransform = `translate3d(calc(var(${sizeVar}) * -1), 0, 0)`;\n const bottomToTopTransform = `translate3d(0, var(${sizeVar}), 0)`;\n\n if (position === 'start') {\n return dir === 'ltr' ? rightToLeftTransform : leftToRightTransform;\n }\n\n if (position === 'end') {\n return dir === 'ltr' ? leftToRightTransform : rightToLeftTransform;\n }\n\n if (position === 'bottom') {\n return bottomToTopTransform;\n }\n\n return 'translate3d(0, 0, 0)';\n}\n\n/**\n * @internal\n */\nexport const InlineDrawerMotion = createPresenceComponent<DrawerMotionParams>(({ position, size, dir }) => {\n const keyframes: Keyframe[] = [\n {\n /**\n * TODO: Once the #31663 lands, we should update the RTL logic to use Motion APIs\n * The work will be done in the #32817\n */\n transform: getPositionTransform(position, drawerCSSVars.drawerSizeVar, dir),\n opacity: 0,\n },\n { transform: 'translate3d(0, 0, 0)', opacity: 1 },\n ];\n const duration = durations[size];\n\n return {\n enter: {\n keyframes,\n duration,\n easing: motionTokens.curveDecelerateMid,\n },\n exit: {\n keyframes: [...keyframes].reverse(),\n duration,\n easing: motionTokens.curveAccelerateMin,\n },\n };\n});\n\n/**\n * @internal\n */\nexport const OverlayDrawerMotion = createPresenceComponent<DrawerMotionParams>(({ position, size, dir }) => {\n const keyframes: Keyframe[] = [\n {\n /**\n * TODO: Once the #31663 lands, we should update the RTL logic to use Motion APIs\n * The work will be done in the #32817\n */\n transform: getPositionTransform(position, drawerCSSVars.drawerSizeVar, dir),\n boxShadow: `0px ${tokens.colorTransparentBackground}`,\n opacity: 0,\n },\n {\n transform: 'translate3d(0, 0, 0)',\n boxShadow: tokens.shadow64,\n opacity: 1,\n },\n ];\n const duration = durations[size];\n\n return {\n enter: {\n keyframes,\n duration,\n easing: motionTokens.curveDecelerateMid,\n },\n exit: {\n keyframes: [...keyframes].reverse(),\n duration,\n easing: motionTokens.curveAccelerateMin,\n },\n };\n});\n\n/**\n * @internal\n */\nexport const OverlaySurfaceBackdropMotion = createPresenceComponent(({ size }: OverlayDrawerSurfaceMotionParams) => {\n const duration = durations[size];\n const easing = motionTokens.curveLinear;\n\n return {\n enter: fadeAtom({ direction: 'enter', duration, easing }),\n exit: fadeAtom({ direction: 'exit', duration, easing }),\n };\n});\n"],"names":["createPresenceComponent","motionTokens","tokens","drawerCSSVars","fadeAtom","durations","small","durationGentle","medium","durationSlow","large","durationSlower","full","durationUltraSlow","getPositionTransform","position","sizeVar","dir","leftToRightTransform","rightToLeftTransform","bottomToTopTransform","InlineDrawerMotion","size","keyframes","transform","drawerSizeVar","opacity","duration","enter","easing","curveDecelerateMid","exit","reverse","curveAccelerateMin","OverlayDrawerMotion","boxShadow","colorTransparentBackground","shadow64","OverlaySurfaceBackdropMotion","curveLinear","direction"],"mappings":";;;;;;;;;;;IAkDaqB,kBAAAA;;;IA+BAa,mBAAAA;;;gCAoCAI;eAAAA;;wBA9FGxB;;;;6BAvBsC,yBAAyB;4BACxD,wBAAwB;2CAIjB,+BAA+B;8CACpC,4CAA4C;AAOrE,MAAMT,YAAkE;IACtEC,OAAOL,yBAAAA,CAAaM,cAAc;IAClCC,QAAQP,yBAAAA,CAAaQ,YAAY;IACjCC,OAAOT,yBAAAA,CAAaU,cAAc;IAClCC,MAAMX,yBAAAA,CAAaY,iBAAiB;AACtC;AAKO,SAASC,qBACdC,QAAqC,EACrCC,OAAe,EACfC,GAAsC;IAEtC,MAAMC,uBAAuB,CAAC,gBAAgB,EAAEF,QAAQ,QAAQ,CAAC;IACjE,MAAMG,uBAAuB,CAAC,qBAAqB,EAAEH,QAAQ,cAAc,CAAC;IAC5E,MAAMI,uBAAuB,CAAC,mBAAmB,EAAEJ,QAAQ,KAAK,CAAC;IAEjE,IAAID,aAAa,SAAS;QACxB,OAAOE,QAAQ,QAAQE,uBAAuBD;IAChD;IAEA,IAAIH,aAAa,OAAO;QACtB,OAAOE,QAAQ,QAAQC,uBAAuBC;IAChD;IAEA,IAAIJ,aAAa,UAAU;QACzB,OAAOK;IACT;IAEA,OAAO;AACT;AAKO,+BAA2BpB,oCAAAA,EAA4C,CAAC,EAAEe,QAAQ,EAAEO,IAAI,EAAEL,GAAG,EAAE;IACpG,MAAMM,YAAwB;QAC5B;YACE;;;OAGC,GACDC,W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AAO;IACvD;AACF,GAAG"}
1
+ {"version":3,"sources":["../src/shared/drawerMotions.ts"],"sourcesContent":["import { createPresenceComponent, motionTokens } from '@fluentui/react-motion';\nimport { tokens } from '@fluentui/react-theme';\nimport { ProviderContextValue_unstable as FluentProviderContextValue } from '@fluentui/react-shared-contexts';\n\nimport type { DrawerBaseProps } from './DrawerBase.types';\nimport { drawerCSSVars } from './useDrawerBaseStyles.styles';\nimport { fadeAtom } from '@fluentui/react-motion-components-preview';\n\nexport type DrawerMotionParams = Required<\n Pick<DrawerBaseProps, 'size' | 'position'> & Pick<FluentProviderContextValue, 'dir'>\n>;\nexport type OverlayDrawerSurfaceMotionParams = Required<Pick<DrawerBaseProps, 'size'>>;\n\nconst durations: Record<NonNullable<DrawerBaseProps['size']>, number> = {\n small: motionTokens.durationGentle,\n medium: motionTokens.durationSlow,\n large: motionTokens.durationSlower,\n full: motionTokens.durationUltraSlow,\n};\n\n/**\n * @internal\n */\nexport function getPositionTransform(\n position: DrawerBaseProps['position'],\n sizeVar: string,\n dir: FluentProviderContextValue['dir'],\n): string {\n const leftToRightTransform = `translate3d(var(${sizeVar}), 0, 0)`;\n const rightToLeftTransform = `translate3d(calc(var(${sizeVar}) * -1), 0, 0)`;\n const bottomToTopTransform = `translate3d(0, var(${sizeVar}), 0)`;\n\n if (position === 'start') {\n return dir === 'ltr' ? rightToLeftTransform : leftToRightTransform;\n }\n\n if (position === 'end') {\n return dir === 'ltr' ? leftToRightTransform : rightToLeftTransform;\n }\n\n if (position === 'bottom') {\n return bottomToTopTransform;\n }\n\n return 'translate3d(0, 0, 0)';\n}\n\n/**\n * @internal\n */\nexport const InlineDrawerMotion = createPresenceComponent<DrawerMotionParams>(({ position, size, dir }) => {\n const keyframes: Keyframe[] = [\n {\n /**\n * TODO: Once the #31663 lands, we should update the RTL logic to use Motion APIs\n * The work will be done in the #32817\n */\n transform: getPositionTransform(position, drawerCSSVars.drawerSizeVar, dir),\n opacity: 0,\n },\n {\n transform: 'translate3d(0, 0, 0)',\n opacity: 1,\n },\n ];\n const duration = durations[size];\n\n return {\n enter: {\n keyframes,\n duration,\n easing: motionTokens.curveDecelerateMid,\n },\n exit: {\n keyframes: [...keyframes].reverse(),\n duration,\n easing: motionTokens.curveAccelerateMin,\n },\n };\n});\n\n/**\n * @internal\n */\nexport const OverlayDrawerMotion = createPresenceComponent<DrawerMotionParams>(({ position, size, dir }) => {\n const keyframes: Keyframe[] = [\n {\n /**\n * TODO: Once the #31663 lands, we should update the RTL logic to use Motion APIs\n * The work will be done in the #32817\n */\n transform: getPositionTransform(position, drawerCSSVars.drawerSizeVar, dir),\n boxShadow: `0px ${tokens.colorTransparentBackground}`,\n opacity: 0,\n },\n {\n transform: 'translate3d(0, 0, 0)',\n boxShadow: tokens.shadow64,\n opacity: 1,\n },\n ];\n const duration = durations[size];\n\n return {\n enter: {\n keyframes,\n duration,\n easing: motionTokens.curveDecelerateMid,\n },\n exit: {\n keyframes: [...keyframes].reverse(),\n duration,\n easing: motionTokens.curveAccelerateMin,\n },\n };\n});\n\n/**\n * @internal\n */\nexport const OverlaySurfaceBackdropMotion = createPresenceComponent(({ size }: OverlayDrawerSurfaceMotionParams) => {\n const duration = durations[size];\n const easing = motionTokens.curveLinear;\n\n return {\n enter: fadeAtom({ direction: 'enter', duration, easing }),\n exit: fadeAtom({ direction: 'exit', duration, easing }),\n };\n});\n"],"names":["createPresenceComponent","motionTokens","tokens","drawerCSSVars","fadeAtom","durations","small","durationGentle","medium","durationSlow","large","durationSlower","full","durationUltraSlow","getPositionTransform","position","sizeVar","dir","leftToRightTransform","rightToLeftTransform","bottomToTopTransform","InlineDrawerMotion","size","keyframes","transform","drawerSizeVar","opacity","duration","enter","easing","curveDecelerateMid","exit","reverse","curveAccelerateMin","OverlayDrawerMotion","boxShadow","colorTransparentBackground","shadow64","OverlaySurfaceBackdropMotion","curveLinear","direction"],"mappings":";;;;;;;;;;;IAkDaqB,kBAAAA;;;IAkCAa,mBAAAA;;;gCAoCAI;eA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AEe,QAAQ,EAAEO,IAAI,EAAEL,GAAG,EAAE;IACrG,MAAMM,YAAwB;QAC5B;YACE;;;OAGC,GACDC,WAAWV,qBAAqBC,UAAUZ,wCAAAA,CAAcsB,aAAa,EAAER;YACvEkB,WAAW,CAAC,IAAI,EAAEjC,kBAAAA,CAAOkC,0BAA0B,EAAE;YACrDV,SAAS;QACX;QACA;YACEF,WAAW;YACXW,WAAWjC,kBAAAA,CAAOmC,QAAQ;YAC1BX,SAAS;QACX;KACD;IACD,MAAMC,WAAWtB,SAAS,CAACiB,KAAK;IAEhC,OAAO;QACLM,OAAO;YACLL;YACAI;YACAE,QAAQ5B,yBAAAA,CAAa6B,kBAAkB;QACzC;QACAC,MAAM;YACJR,WAAW;mBAAIA;aAAU,CAACS,OAAO;YACjCL;YACAE,QAAQ5B,yBAAAA,CAAagC,kBAAkB;QACzC;IACF;AACF,GAAG;AAKI,yCAAqCjC,oCAAAA,EAAwB,CAAC,EAAEsB,IAAI,EAAoC;IAC7G,MAAMK,WAAWtB,SAAS,CAACiB,KAAK;IAChC,MAAMO,SAAS5B,yBAAAA,CAAasC,WAAW;IAEvC,OAAO;QACLX,WAAOxB,sCAAAA,EAAS;YAAEoC,WAAW;YAASb;YAAUE;QAAO;QACvDE,UAAM3B,sCAAAA,EAAS;YAAEoC,WAAW;YAAQb;YAAUE;QAAO;IACvD;AACF,GAAG"}
@@ -9,10 +9,11 @@ Object.defineProperty(exports, "useDrawerDefaultProps", {
9
9
  }
10
10
  });
11
11
  function useDrawerDefaultProps(props) {
12
- const { open = false, size = 'small', position = 'start' } = props;
12
+ const { open = false, size = 'small', position = 'start', unmountOnClose = true } = props;
13
13
  return {
14
14
  size,
15
15
  position,
16
- open
16
+ open,
17
+ unmountOnClose
17
18
  };
18
19
  }