@fluentui/react-toast 0.0.0-nightly-20240605-0405.1 → 0.0.0-nightly-20240606-0726.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,28 +1,27 @@
1
1
  # Change Log - @fluentui/react-toast
2
2
 
3
- This log was last generated on Wed, 05 Jun 2024 04:19:39 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 06 Jun 2024 07:39:40 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20240605-0405.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-toast_v0.0.0-nightly-20240605-0405.1)
7
+ ## [0.0.0-nightly-20240606-0726.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-toast_v0.0.0-nightly-20240606-0726.1)
8
8
 
9
- Wed, 05 Jun 2024 04:19:39 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-toast_v9.3.44..@fluentui/react-toast_v0.0.0-nightly-20240605-0405.1)
9
+ Thu, 06 Jun 2024 07:39:40 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-toast_v9.3.44..@fluentui/react-toast_v0.0.0-nightly-20240606-0726.1)
11
11
 
12
12
  ### Changes
13
13
 
14
14
  - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
15
- - Bump @fluentui/react-motions-preview to v0.0.0-nightly-20240605-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/9616b9b950f32abdcef8fba325a70263d848c96a) by beachball)
16
- - Bump @fluentui/keyboard-keys to v0.0.0-nightly-20240605-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/9616b9b950f32abdcef8fba325a70263d848c96a) by beachball)
17
- - Bump @fluentui/react-aria to v0.0.0-nightly-20240605-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/9616b9b950f32abdcef8fba325a70263d848c96a) by beachball)
18
- - Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20240605-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/9616b9b950f32abdcef8fba325a70263d848c96a) by beachball)
19
- - Bump @fluentui/react-portal to v0.0.0-nightly-20240605-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/9616b9b950f32abdcef8fba325a70263d848c96a) by beachball)
20
- - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20240605-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/9616b9b950f32abdcef8fba325a70263d848c96a) by beachball)
21
- - Bump @fluentui/react-tabster to v0.0.0-nightly-20240605-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/9616b9b950f32abdcef8fba325a70263d848c96a) by beachball)
22
- - Bump @fluentui/react-theme to v0.0.0-nightly-20240605-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/9616b9b950f32abdcef8fba325a70263d848c96a) by beachball)
23
- - Bump @fluentui/react-utilities to v0.0.0-nightly-20240605-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/9616b9b950f32abdcef8fba325a70263d848c96a) by beachball)
24
- - Bump @fluentui/react-conformance to v0.0.0-nightly-20240605-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/9616b9b950f32abdcef8fba325a70263d848c96a) by beachball)
25
- - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20240605-0405.1 ([commit](https://github.com/microsoft/fluentui/commit/9616b9b950f32abdcef8fba325a70263d848c96a) by beachball)
15
+ - Bump @fluentui/keyboard-keys to v0.0.0-nightly-20240606-0726.1 ([commit](https://github.com/microsoft/fluentui/commit/adf018375418af333b8a4a6d5b88f6d283f5f46c) by beachball)
16
+ - Bump @fluentui/react-aria to v0.0.0-nightly-20240606-0726.1 ([commit](https://github.com/microsoft/fluentui/commit/adf018375418af333b8a4a6d5b88f6d283f5f46c) by beachball)
17
+ - Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20240606-0726.1 ([commit](https://github.com/microsoft/fluentui/commit/adf018375418af333b8a4a6d5b88f6d283f5f46c) by beachball)
18
+ - Bump @fluentui/react-portal to v0.0.0-nightly-20240606-0726.1 ([commit](https://github.com/microsoft/fluentui/commit/adf018375418af333b8a4a6d5b88f6d283f5f46c) by beachball)
19
+ - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20240606-0726.1 ([commit](https://github.com/microsoft/fluentui/commit/adf018375418af333b8a4a6d5b88f6d283f5f46c) by beachball)
20
+ - Bump @fluentui/react-tabster to v0.0.0-nightly-20240606-0726.1 ([commit](https://github.com/microsoft/fluentui/commit/adf018375418af333b8a4a6d5b88f6d283f5f46c) by beachball)
21
+ - Bump @fluentui/react-theme to v0.0.0-nightly-20240606-0726.1 ([commit](https://github.com/microsoft/fluentui/commit/adf018375418af333b8a4a6d5b88f6d283f5f46c) by beachball)
22
+ - Bump @fluentui/react-utilities to v0.0.0-nightly-20240606-0726.1 ([commit](https://github.com/microsoft/fluentui/commit/adf018375418af333b8a4a6d5b88f6d283f5f46c) by beachball)
23
+ - Bump @fluentui/react-conformance to v0.0.0-nightly-20240606-0726.1 ([commit](https://github.com/microsoft/fluentui/commit/adf018375418af333b8a4a6d5b88f6d283f5f46c) by beachball)
24
+ - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20240606-0726.1 ([commit](https://github.com/microsoft/fluentui/commit/adf018375418af333b8a4a6d5b88f6d283f5f46c) by beachball)
26
25
 
27
26
  ## [9.3.44](https://github.com/microsoft/fluentui/tree/@fluentui/react-toast_v9.3.44)
28
27
 
@@ -1 +1 @@
1
- {"version":3,"sources":["ToastContainer.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { Announce } from '../AriaLive/AriaLive.types';\nimport { Toast, ToastIntent } from '../../state';\nimport { ToastContainerContextValue } from '../../contexts/toastContainerContext';\nimport { TimerProps } from '../Timer/Timer';\n\nexport type ToastContainerContextValues = {\n toast: ToastContainerContextValue;\n};\n\nexport type ToastContainerSlots = {\n root: NonNullable<Slot<'div'>>;\n timer: NonNullable<Slot<TimerProps>>;\n};\n\n/**\n * ToastContainer Props\n */\nexport type ToastContainerProps = Omit<ComponentProps<Partial<ToastContainerSlots>>, 'content'> &\n Toast & {\n visible: boolean;\n announce: Announce;\n intent: ToastIntent | undefined;\n tryRestoreFocus: () => void;\n };\n\n/**\n * State used in rendering ToastContainer\n */\nexport type ToastContainerState = ComponentState<ToastContainerSlots> &\n Pick<ToastContainerProps, 'remove' | 'close' | 'updateId' | 'visible' | 'intent'> &\n Pick<ToastContainerContextValue, 'titleId' | 'bodyId'> & {\n /**\n * @deprecated Will be always \"0\".\n */\n transitionTimeout: number;\n timerTimeout: number;\n running: boolean;\n /**\n * @deprecated Will be always no-op.\n */\n onTransitionEntering: () => void;\n /**\n * @deprecated\n */\n nodeRef: React.Ref<HTMLDivElement>;\n\n onMotionFinish?: (event: null, data: { direction: 'enter' | 'exit' }) => void;\n };\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
1
+ {"version":3,"sources":["ToastContainer.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, ExtractSlotProps, Slot } from '@fluentui/react-utilities';\nimport { Announce } from '../AriaLive/AriaLive.types';\nimport { Toast, ToastIntent } from '../../state';\nimport { ToastContainerContextValue } from '../../contexts/toastContainerContext';\nimport { TimerProps } from '../Timer/Timer';\n\nexport type ToastContainerContextValues = {\n toast: ToastContainerContextValue;\n};\n\nexport type ToastContainerSlots = {\n root: NonNullable<ExtractSlotProps<Slot<'div'>>>;\n timer: NonNullable<Slot<TimerProps>>;\n};\n\n/**\n * ToastContainer Props\n */\nexport type ToastContainerProps = Omit<ComponentProps<Partial<ToastContainerSlots>>, 'content'> &\n Toast & {\n visible: boolean;\n announce: Announce;\n intent: ToastIntent | undefined;\n tryRestoreFocus: () => void;\n };\n\n/**\n * State used in rendering ToastContainer\n */\nexport type ToastContainerState = ComponentState<ToastContainerSlots> &\n Pick<ToastContainerProps, 'remove' | 'close' | 'updateId' | 'visible' | 'intent'> &\n Pick<ToastContainerContextValue, 'titleId' | 'bodyId'> & {\n transitionTimeout: number;\n timerTimeout: number;\n running: boolean;\n onTransitionEntering: () => void;\n nodeRef: React.Ref<HTMLDivElement>;\n };\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
@@ -1,25 +1,26 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
2
2
  import { assertSlots } from '@fluentui/react-utilities';
3
+ import { Transition } from 'react-transition-group';
3
4
  import { ToastContainerContextProvider } from '../../contexts/toastContainerContext';
4
- import { ToastContainerMotion } from './ToastContainerMotion';
5
5
  /**
6
6
  * Render the final JSX of ToastContainer
7
7
  */ export const renderToastContainer_unstable = (state, contextValues)=>{
8
- const { onMotionFinish, visible, updateId } = state;
8
+ const { onTransitionEntering, visible, transitionTimeout, remove, nodeRef, updateId } = state;
9
9
  assertSlots(state);
10
- return /*#__PURE__*/ _jsx(ToastContainerContextProvider, {
11
- value: contextValues.toast,
12
- children: /*#__PURE__*/ _jsx(ToastContainerMotion, {
13
- appear: true,
14
- onMotionFinish: onMotionFinish,
15
- visible: visible,
16
- unmountOnExit: true,
17
- children: /*#__PURE__*/ _jsxs(state.root, {
18
- children: [
19
- state.root.children,
20
- /*#__PURE__*/ _jsx(state.timer, {}, updateId)
21
- ]
22
- })
10
+ return /*#__PURE__*/ _jsx(Transition, {
11
+ in: visible,
12
+ appear: true,
13
+ unmountOnExit: true,
14
+ timeout: transitionTimeout,
15
+ onExited: remove,
16
+ onEntering: onTransitionEntering,
17
+ nodeRef: nodeRef,
18
+ children: /*#__PURE__*/ _jsxs(ToastContainerContextProvider, {
19
+ value: contextValues.toast,
20
+ children: [
21
+ /*#__PURE__*/ _jsx(state.root, {}),
22
+ /*#__PURE__*/ _jsx(state.timer, {}, updateId)
23
+ ]
23
24
  })
24
25
  });
25
26
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["renderToastContainer.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { ToastContainerState, ToastContainerSlots, ToastContainerContextValues } from './ToastContainer.types';\nimport { ToastContainerContextProvider } from '../../contexts/toastContainerContext';\nimport { ToastContainerMotion } from './ToastContainerMotion';\n\n/**\n * Render the final JSX of ToastContainer\n */\nexport const renderToastContainer_unstable = (\n state: ToastContainerState,\n contextValues: ToastContainerContextValues,\n) => {\n const { onMotionFinish, visible, updateId } = state;\n assertSlots<ToastContainerSlots>(state);\n\n return (\n <ToastContainerContextProvider value={contextValues.toast}>\n <ToastContainerMotion appear onMotionFinish={onMotionFinish} visible={visible} unmountOnExit>\n <state.root>\n {state.root.children}\n <state.timer key={updateId} />\n </state.root>\n </ToastContainerMotion>\n </ToastContainerContextProvider>\n );\n};\n"],"names":["assertSlots","ToastContainerContextProvider","ToastContainerMotion","renderToastContainer_unstable","state","contextValues","onMotionFinish","visible","updateId","value","toast","appear","unmountOnExit","root","children","timer"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AAExD,SAASC,6BAA6B,QAAQ,uCAAuC;AACrF,SAASC,oBAAoB,QAAQ,yBAAyB;AAE9D;;CAEC,GACD,OAAO,MAAMC,gCAAgC,CAC3CC,OACAC;IAEA,MAAM,EAAEC,cAAc,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGJ;IAC9CJ,YAAiCI;IAEjC,qBACE,KAACH;QAA8BQ,OAAOJ,cAAcK,KAAK;kBACvD,cAAA,KAACR;YAAqBS,MAAM;YAACL,gBAAgBA;YAAgBC,SAASA;YAASK,aAAa;sBAC1F,cAAA,MAACR,MAAMS,IAAI;;oBACRT,MAAMS,IAAI,CAACC,QAAQ;kCACpB,KAACV,MAAMW,KAAK,MAAMP;;;;;AAK5B,EAAE"}
1
+ {"version":3,"sources":["renderToastContainer.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { Transition } from 'react-transition-group';\nimport type { ToastContainerState, ToastContainerSlots, ToastContainerContextValues } from './ToastContainer.types';\nimport { ToastContainerContextProvider } from '../../contexts/toastContainerContext';\n\n/**\n * Render the final JSX of ToastContainer\n */\nexport const renderToastContainer_unstable = (\n state: ToastContainerState,\n contextValues: ToastContainerContextValues,\n) => {\n const { onTransitionEntering, visible, transitionTimeout, remove, nodeRef, updateId } = state;\n assertSlots<ToastContainerSlots>(state);\n\n return (\n <Transition\n in={visible}\n appear\n unmountOnExit\n timeout={transitionTimeout}\n onExited={remove}\n onEntering={onTransitionEntering}\n nodeRef={nodeRef}\n >\n <ToastContainerContextProvider value={contextValues.toast}>\n <state.root />\n <state.timer key={updateId} />\n </ToastContainerContextProvider>\n </Transition>\n );\n};\n"],"names":["assertSlots","Transition","ToastContainerContextProvider","renderToastContainer_unstable","state","contextValues","onTransitionEntering","visible","transitionTimeout","remove","nodeRef","updateId","in","appear","unmountOnExit","timeout","onExited","onEntering","value","toast","root","timer"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAASC,UAAU,QAAQ,yBAAyB;AAEpD,SAASC,6BAA6B,QAAQ,uCAAuC;AAErF;;CAEC,GACD,OAAO,MAAMC,gCAAgC,CAC3CC,OACAC;IAEA,MAAM,EAAEC,oBAAoB,EAAEC,OAAO,EAAEC,iBAAiB,EAAEC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGP;IACxFJ,YAAiCI;IAEjC,qBACE,KAACH;QACCW,IAAIL;QACJM,MAAM;QACNC,aAAa;QACbC,SAASP;QACTQ,UAAUP;QACVQ,YAAYX;QACZI,SAASA;kBAET,cAAA,MAACR;YAA8BgB,OAAOb,cAAcc,KAAK;;8BACvD,KAACf,MAAMgB,IAAI;8BACX,KAAChB,MAAMiB,KAAK,MAAMV;;;;AAI1B,EAAE"}
@@ -19,7 +19,7 @@ const intentPolitenessMap = {
19
19
  * @param props - props from this instance of ToastContainer
20
20
  * @param ref - reference to root HTMLElement of ToastContainer
21
21
  */ export const useToastContainer_unstable = (props, ref)=>{
22
- const { visible, children, close: closeProp, remove, updateId, announce, data, timeout: timerTimeout, politeness: desiredPoliteness, intent = 'info', pauseOnHover, pauseOnWindowBlur, imperativeRef, tryRestoreFocus, ...rest } = props;
22
+ const { visible, children, close: closeProp, remove, updateId, announce, data, timeout: timerTimeout, politeness: desiredPoliteness, intent = 'info', pauseOnHover, pauseOnWindowBlur, imperativeRef, tryRestoreFocus, content, ...rest } = props;
23
23
  const titleId = useId('toast-title');
24
24
  const bodyId = useId('toast-body');
25
25
  const toastRef = React.useRef(null);
@@ -109,21 +109,32 @@ const intentPolitenessMap = {
109
109
  play,
110
110
  pauseOnWindowBlur
111
111
  ]);
112
+ // It's impossible to animate to height: auto in CSS, the actual pixel value must be known
113
+ // Get the height of the toast before animation styles have been applied and set a CSS
114
+ // variable with its height. The CSS variable will be used by the styles
115
+ const onTransitionEntering = ()=>{
116
+ if (!toastRef.current) {
117
+ return;
118
+ }
119
+ const element = toastRef.current;
120
+ element.style.setProperty('--fui-toast-height', `${element.scrollHeight}px`);
121
+ };
112
122
  // Users never actually use ToastContainer as a JSX but imperatively through useToastContainerController
113
123
  const userRootSlot = data.root;
114
- const onMotionFinish = React.useCallback((_, { direction })=>{
115
- if (direction === 'exit') {
116
- remove();
117
- }
118
- if (direction === 'enter') {
119
- // start toast once it's fully animated in
120
- play();
121
- onStatusChange('visible');
124
+ // Using a ref callback here because addEventListener supports `once`
125
+ const toastAnimationRef = React.useCallback((el)=>{
126
+ if (el && toastRef.current) {
127
+ toastRef.current.addEventListener('animationend', ()=>{
128
+ // start toast once it's fully animated in
129
+ play();
130
+ onStatusChange('visible');
131
+ }, {
132
+ once: true
133
+ });
122
134
  }
123
135
  }, [
124
- onStatusChange,
125
136
  play,
126
- remove
137
+ onStatusChange
127
138
  ]);
128
139
  const onMouseEnter = useEventCallback((e)=>{
129
140
  var _userRootSlot_onMouseEnter;
@@ -198,7 +209,7 @@ const intentPolitenessMap = {
198
209
  // FIXME:
199
210
  // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
200
211
  // but since it would be a breaking change to fix it, we are casting ref to it's proper type
201
- ref: useMergedRefs(ref, toastRef),
212
+ ref: useMergedRefs(ref, toastRef, toastAnimationRef),
202
213
  children,
203
214
  tabIndex: 0,
204
215
  role: 'listitem',
@@ -214,18 +225,16 @@ const intentPolitenessMap = {
214
225
  elementType: 'div'
215
226
  }),
216
227
  timerTimeout,
217
- transitionTimeout: 0,
228
+ transitionTimeout: 500,
218
229
  running,
219
230
  visible,
220
231
  remove,
221
232
  close,
222
- onTransitionEntering: ()=>{
223
- /* no-op */ },
233
+ onTransitionEntering,
224
234
  updateId,
225
235
  nodeRef: toastRef,
226
236
  intent,
227
237
  titleId,
228
- bodyId,
229
- onMotionFinish
238
+ bodyId
230
239
  };
231
240
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["useToastContainer.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n useMergedRefs,\n ExtractSlotProps,\n Slot,\n useEventCallback,\n useId,\n slot,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { Delete, Tab } from '@fluentui/keyboard-keys';\nimport { useFocusableGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { ToastStatus } from '../../state';\nimport type { ToastContainerProps, ToastContainerState } from './ToastContainer.types';\nimport { Timer, TimerProps } from '../Timer/Timer';\n\nconst intentPolitenessMap = {\n success: 'assertive',\n warning: 'assertive',\n error: 'assertive',\n info: 'polite',\n} as const;\n\n/**\n * Create the state required to render ToastContainer.\n *\n * The returned state can be modified with hooks such as useToastContainerStyles_unstable,\n * before being passed to renderToastContainer_unstable.\n *\n * @param props - props from this instance of ToastContainer\n * @param ref - reference to root HTMLElement of ToastContainer\n */\nexport const useToastContainer_unstable = (\n props: ToastContainerProps,\n ref: React.Ref<HTMLElement>,\n): ToastContainerState => {\n const {\n visible,\n children,\n close: closeProp,\n remove,\n updateId,\n announce,\n data,\n timeout: timerTimeout,\n politeness: desiredPoliteness,\n intent = 'info',\n pauseOnHover,\n pauseOnWindowBlur,\n imperativeRef,\n tryRestoreFocus,\n ...rest\n } = props;\n const titleId = useId('toast-title');\n const bodyId = useId('toast-body');\n const toastRef = React.useRef<HTMLDivElement | null>(null);\n const { targetDocument } = useFluent_unstable();\n const [running, setRunning] = React.useState(false);\n const imperativePauseRef = React.useRef(false);\n const focusedToastBeforeClose = React.useRef(false);\n const focusableGroupAttribute = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n // Users should only use Tab to focus into the toast\n // Escape is already reserved to dismiss all toasts\n ignoreDefaultKeydown: { Tab: true, Escape: true, Enter: true },\n });\n\n const close = useEventCallback(() => {\n const activeElement = targetDocument?.activeElement;\n if (activeElement && toastRef.current?.contains(activeElement)) {\n focusedToastBeforeClose.current = true;\n }\n\n closeProp();\n });\n const onStatusChange = useEventCallback((status: ToastStatus) => props.onStatusChange?.(null, { status, ...props }));\n const pause = useEventCallback(() => setRunning(false));\n const play = useEventCallback(() => {\n if (imperativePauseRef.current) {\n return;\n }\n const containsActive = !!toastRef.current?.contains(targetDocument?.activeElement ?? null);\n if (timerTimeout < 0) {\n setRunning(true);\n return;\n }\n\n if (!containsActive) {\n setRunning(true);\n }\n });\n\n React.useImperativeHandle(imperativeRef, () => ({\n focus: () => {\n if (!toastRef.current) {\n return;\n }\n\n toastRef.current.focus();\n },\n\n play: () => {\n imperativePauseRef.current = false;\n play();\n },\n pause: () => {\n imperativePauseRef.current = true;\n pause();\n },\n }));\n\n React.useEffect(() => {\n return () => onStatusChange('unmounted');\n }, [onStatusChange]);\n\n React.useEffect(() => {\n if (!targetDocument) {\n return;\n }\n\n if (pauseOnWindowBlur) {\n targetDocument.defaultView?.addEventListener('focus', play);\n targetDocument.defaultView?.addEventListener('blur', pause);\n return () => {\n targetDocument.defaultView?.removeEventListener('focus', play);\n targetDocument.defaultView?.removeEventListener('blur', pause);\n };\n }\n }, [targetDocument, pause, play, pauseOnWindowBlur]);\n\n // Users never actually use ToastContainer as a JSX but imperatively through useToastContainerController\n const userRootSlot = (data as { root?: ExtractSlotProps<Slot<'div'>> }).root;\n const onMotionFinish: ToastContainerState['onMotionFinish'] = React.useCallback(\n (_, { direction }) => {\n if (direction === 'exit') {\n remove();\n }\n\n if (direction === 'enter') {\n // start toast once it's fully animated in\n play();\n onStatusChange('visible');\n }\n },\n [onStatusChange, play, remove],\n );\n\n const onMouseEnter = useEventCallback((e: React.MouseEvent<HTMLDivElement>) => {\n pause();\n userRootSlot?.onMouseEnter?.(e);\n });\n\n const onMouseLeave = useEventCallback((e: React.MouseEvent<HTMLDivElement>) => {\n play();\n userRootSlot?.onMouseEnter?.(e);\n });\n\n const { findFirstFocusable, findLastFocusable } = useFocusFinders();\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === Delete) {\n e.preventDefault();\n close();\n }\n\n if (e.key === Tab && e.currentTarget === e.target) {\n e.preventDefault();\n if (e.shiftKey) {\n findLastFocusable(e.currentTarget)?.focus();\n } else {\n findFirstFocusable(e.currentTarget)?.focus();\n }\n }\n\n userRootSlot?.onKeyDown?.(e);\n });\n\n React.useEffect(() => {\n if (!visible) {\n return;\n }\n\n const politeness = desiredPoliteness ?? intentPolitenessMap[intent];\n announce(toastRef.current?.textContent ?? '', { politeness });\n }, [announce, desiredPoliteness, toastRef, visible, updateId, intent]);\n\n React.useEffect(() => {\n return () => {\n if (focusedToastBeforeClose.current) {\n focusedToastBeforeClose.current = false;\n tryRestoreFocus();\n }\n };\n }, [tryRestoreFocus]);\n\n return {\n components: {\n timer: Timer,\n root: 'div',\n },\n timer: slot.always<TimerProps>({ onTimeout: close, running, timeout: timerTimeout ?? -1 }, { elementType: Timer }),\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, toastRef) as React.Ref<HTMLDivElement>,\n children,\n tabIndex: 0,\n role: 'listitem',\n 'aria-labelledby': titleId,\n 'aria-describedby': bodyId,\n ...rest,\n ...userRootSlot,\n ...focusableGroupAttribute,\n onMouseEnter,\n onMouseLeave,\n onKeyDown,\n }),\n { elementType: 'div' },\n ),\n timerTimeout,\n transitionTimeout: 0,\n running,\n visible,\n remove,\n close,\n onTransitionEntering: () => {\n /* no-op */\n },\n updateId,\n nodeRef: toastRef,\n intent,\n titleId,\n bodyId,\n onMotionFinish,\n };\n};\n"],"names":["React","getIntrinsicElementProps","useMergedRefs","useEventCallback","useId","slot","useFluent_unstable","Delete","Tab","useFocusableGroup","useFocusFinders","Timer","intentPolitenessMap","success","warning","error","info","useToastContainer_unstable","props","ref","visible","children","close","closeProp","remove","updateId","announce","data","timeout","timerTimeout","politeness","desiredPoliteness","intent","pauseOnHover","pauseOnWindowBlur","imperativeRef","tryRestoreFocus","rest","titleId","bodyId","toastRef","useRef","targetDocument","running","setRunning","useState","imperativePauseRef","focusedToastBeforeClose","focusableGroupAttribute","tabBehavior","ignoreDefaultKeydown","Escape","Enter","activeElement","current","contains","onStatusChange","status","pause","play","containsActive","useImperativeHandle","focus","useEffect","defaultView","addEventListener","removeEventListener","userRootSlot","root","onMotionFinish","useCallback","_","direction","onMouseEnter","e","onMouseLeave","findFirstFocusable","findLastFocusable","onKeyDown","key","preventDefault","currentTarget","target","shiftKey","textContent","components","timer","always","onTimeout","elementType","tabIndex","role","transitionTimeout","onTransitionEntering","nodeRef"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,wBAAwB,EACxBC,aAAa,EAGbC,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SAAS,GACX;QACApE;QACAqE,SAAStD;QACTR;QACAM;QACAC;QACA8B;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["useToastContainer.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n useMergedRefs,\n ExtractSlotProps,\n Slot,\n useEventCallback,\n useId,\n slot,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { Delete, Tab } from '@fluentui/keyboard-keys';\nimport { useFocusableGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { ToastStatus } from '../../state';\nimport type { ToastContainerProps, ToastContainerState } from './ToastContainer.types';\nimport { Timer, TimerProps } from '../Timer/Timer';\n\nconst intentPolitenessMap = {\n success: 'assertive',\n warning: 'assertive',\n error: 'assertive',\n info: 'polite',\n} as const;\n\n/**\n * Create the state required to render ToastContainer.\n *\n * The returned state can be modified with hooks such as useToastContainerStyles_unstable,\n * before being passed to renderToastContainer_unstable.\n *\n * @param props - props from this instance of ToastContainer\n * @param ref - reference to root HTMLElement of ToastContainer\n */\nexport const useToastContainer_unstable = (\n props: ToastContainerProps,\n ref: React.Ref<HTMLElement>,\n): ToastContainerState => {\n const {\n visible,\n children,\n close: closeProp,\n remove,\n updateId,\n announce,\n data,\n timeout: timerTimeout,\n politeness: desiredPoliteness,\n intent = 'info',\n pauseOnHover,\n pauseOnWindowBlur,\n imperativeRef,\n tryRestoreFocus,\n content,\n ...rest\n } = props;\n const titleId = useId('toast-title');\n const bodyId = useId('toast-body');\n const toastRef = React.useRef<HTMLDivElement | null>(null);\n const { targetDocument } = useFluent_unstable();\n const [running, setRunning] = React.useState(false);\n const imperativePauseRef = React.useRef(false);\n const focusedToastBeforeClose = React.useRef(false);\n const focusableGroupAttribute = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n // Users should only use Tab to focus into the toast\n // Escape is already reserved to dismiss all toasts\n ignoreDefaultKeydown: { Tab: true, Escape: true, Enter: true },\n });\n\n const close = useEventCallback(() => {\n const activeElement = targetDocument?.activeElement;\n if (activeElement && toastRef.current?.contains(activeElement)) {\n focusedToastBeforeClose.current = true;\n }\n\n closeProp();\n });\n const onStatusChange = useEventCallback((status: ToastStatus) => props.onStatusChange?.(null, { status, ...props }));\n const pause = useEventCallback(() => setRunning(false));\n const play = useEventCallback(() => {\n if (imperativePauseRef.current) {\n return;\n }\n const containsActive = !!toastRef.current?.contains(targetDocument?.activeElement ?? null);\n if (timerTimeout < 0) {\n setRunning(true);\n return;\n }\n\n if (!containsActive) {\n setRunning(true);\n }\n });\n\n React.useImperativeHandle(imperativeRef, () => ({\n focus: () => {\n if (!toastRef.current) {\n return;\n }\n\n toastRef.current.focus();\n },\n\n play: () => {\n imperativePauseRef.current = false;\n play();\n },\n pause: () => {\n imperativePauseRef.current = true;\n pause();\n },\n }));\n\n React.useEffect(() => {\n return () => onStatusChange('unmounted');\n }, [onStatusChange]);\n\n React.useEffect(() => {\n if (!targetDocument) {\n return;\n }\n\n if (pauseOnWindowBlur) {\n targetDocument.defaultView?.addEventListener('focus', play);\n targetDocument.defaultView?.addEventListener('blur', pause);\n return () => {\n targetDocument.defaultView?.removeEventListener('focus', play);\n targetDocument.defaultView?.removeEventListener('blur', pause);\n };\n }\n }, [targetDocument, pause, play, pauseOnWindowBlur]);\n\n // It's impossible to animate to height: auto in CSS, the actual pixel value must be known\n // Get the height of the toast before animation styles have been applied and set a CSS\n // variable with its height. The CSS variable will be used by the styles\n const onTransitionEntering = () => {\n if (!toastRef.current) {\n return;\n }\n\n const element = toastRef.current;\n element.style.setProperty('--fui-toast-height', `${element.scrollHeight}px`);\n };\n\n // Users never actually use ToastContainer as a JSX but imperatively through useToastContainerController\n const userRootSlot = (data as { root?: ExtractSlotProps<Slot<'div'>> }).root;\n\n // Using a ref callback here because addEventListener supports `once`\n const toastAnimationRef = React.useCallback(\n (el: HTMLDivElement | null) => {\n if (el && toastRef.current) {\n toastRef.current.addEventListener(\n 'animationend',\n () => {\n // start toast once it's fully animated in\n play();\n onStatusChange('visible');\n },\n { once: true },\n );\n }\n },\n [play, onStatusChange],\n );\n\n const onMouseEnter = useEventCallback((e: React.MouseEvent<HTMLDivElement>) => {\n pause();\n userRootSlot?.onMouseEnter?.(e);\n });\n\n const onMouseLeave = useEventCallback((e: React.MouseEvent<HTMLDivElement>) => {\n play();\n userRootSlot?.onMouseEnter?.(e);\n });\n\n const { findFirstFocusable, findLastFocusable } = useFocusFinders();\n const onKeyDown = useEventCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === Delete) {\n e.preventDefault();\n close();\n }\n\n if (e.key === Tab && e.currentTarget === e.target) {\n e.preventDefault();\n if (e.shiftKey) {\n findLastFocusable(e.currentTarget)?.focus();\n } else {\n findFirstFocusable(e.currentTarget)?.focus();\n }\n }\n\n userRootSlot?.onKeyDown?.(e);\n });\n\n React.useEffect(() => {\n if (!visible) {\n return;\n }\n\n const politeness = desiredPoliteness ?? intentPolitenessMap[intent];\n announce(toastRef.current?.textContent ?? '', { politeness });\n }, [announce, desiredPoliteness, toastRef, visible, updateId, intent]);\n\n React.useEffect(() => {\n return () => {\n if (focusedToastBeforeClose.current) {\n focusedToastBeforeClose.current = false;\n tryRestoreFocus();\n }\n };\n }, [tryRestoreFocus]);\n\n return {\n components: {\n timer: Timer,\n root: 'div',\n },\n timer: slot.always<TimerProps>({ onTimeout: close, running, timeout: timerTimeout ?? -1 }, { elementType: Timer }),\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, toastRef, toastAnimationRef) as React.Ref<HTMLDivElement>,\n children,\n tabIndex: 0,\n role: 'listitem',\n 'aria-labelledby': titleId,\n 'aria-describedby': bodyId,\n ...rest,\n ...userRootSlot,\n ...focusableGroupAttribute,\n onMouseEnter,\n onMouseLeave,\n onKeyDown,\n }),\n { elementType: 'div' },\n ),\n timerTimeout,\n transitionTimeout: 500,\n running,\n visible,\n remove,\n close,\n onTransitionEntering,\n updateId,\n nodeRef: toastRef,\n intent,\n titleId,\n bodyId,\n };\n};\n"],"names":["React","getIntrinsicElementProps","useMergedRefs","useEventCallback","useId","slot","useFluent_unstable","Delete","Tab","useFocusableGroup","useFocusFinders","Timer","intentPolitenessMap","success","warning","error","info","useToastContainer_unstable","props","ref","visible","children","close","closeProp","remove","updateId","announce","data","timeout","timerTimeout","politeness","desiredPoliteness","intent","pauseOnHover","pauseOnWindowBlur","imperativeRef","tryRestoreFocus","content","rest","titleId","bodyId","toastRef","useRef","targetDocument","running","setRunning","useState","imperativePauseRef","focusedToastBeforeClose","focusableGroupAttribute","tabBehavior","ignoreDefaultKeydown","Escape","Enter","activeElement","current","contains","onStatusChange","status","pause","play","containsActive","useImperativeHandle","focus","useEffect","defaultView","addEventListener","removeEventListener","onTransitionEntering","element","style","setProperty","scrollHeight","userRootSlot","root","toastAnimationRef","useCallback","el","once","onMouseEnter","e","onMouseLeave","findFirstFocusable","findLastFocusable","onKeyDown","key","preventDefault","currentTarget","target","shiftKey","textContent","components","timer","always","onTimeout","elementType","tabIndex","role","transitionTimeout","nodeRef"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,wBAAwB,EACxBC,aAAa,EAGbC,gBAAgB,EAChBC,KAAK,EACLC,IAAI,QACC,4BAA4B;AACnC,SAASC,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,MAAM,EAAEC,GAAG,QAAQ,0BAA0B;AACtD,SAASC,iBAAiB,EAAEC,eAAe,QAAQ,0BAA0B;AAG7E,SAASC,KAAK,QAAoB,iBAAiB;AAEnD,MAAMC,sBAAsB;IAC1BC,SAAS;IACTC,SAAS;IACTC,OAAO;IACPC,MAAM;AACR;AAEA;;;;;;;;CAQC,GACD,OAAO,MAAMC,6BAA6B,CACxCC,OACAC;IAEA,MAAM,EACJC,OAAO,EACPC,QAAQ,EACRC,OAAOC,SAAS,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/react';
1
+ import { __resetStyles, __styles, mergeClasses } from '@griffel/react';
2
2
  import { tokens } from '@fluentui/react-theme';
3
3
  import { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';
4
4
  export const toastContainerClassNames = {
5
5
  root: 'fui-ToastContainer',
6
6
  timer: 'fui-ToastContainer__timer'
7
7
  };
8
- const useRootBaseClassName = /*#__PURE__*/__resetStyles("r98b696", null, [".r98b696{box-sizing:border-box;margin-top:16px;pointer-events:all;border-radius:var(--borderRadiusMedium);}", ".r98b696[data-fui-focus-visible]{outline:var(--strokeWidthThick) solid var(--colorStrokeFocus2);}"]);
8
+ const useRootBaseClassName = /*#__PURE__*/__resetStyles("r14b3ftk", null, [".r14b3ftk{box-sizing:border-box;margin-top:16px;min-height:44px;pointer-events:all;border-radius:var(--borderRadiusMedium);--fui-toast-height:44px;}", ".r14b3ftk[data-fui-focus-visible]{outline:var(--strokeWidthThick) solid var(--colorStrokeFocus2);}"]);
9
+ /**
10
+ * Styles for the root slot
11
+ */
12
+ const useStyles = /*#__PURE__*/__styles({
13
+ enter: {
14
+ vin17d: "fayl5bc",
15
+ m1gqa9: "f17oyct0",
16
+ Bv12yb3: "fvv8lvk"
17
+ },
18
+ exit: {
19
+ vin17d: "f1tk3cza",
20
+ m1gqa9: "f1nx6yy9",
21
+ Bv12yb3: "f9wuypy"
22
+ }
23
+ }, {
24
+ d: [".fayl5bc{animation-duration:200ms,400ms;}", ".f17oyct0{animation-delay:0ms,200ms;}", ".fvv8lvk{animation-name:f1rp83na,f5j8bii;}", ".f1tk3cza{animation-duration:400ms,200ms;}", ".f1nx6yy9{animation-delay:0ms,400ms;}", ".f9wuypy{animation-name:fk0lfw7,f1n32sdh;}"],
25
+ k: ["@keyframes f1rp83na{from{max-height:0;opacity:0;margin-top:0;}to{margin-top:16px;opacity:0;max-height:var(--fui-toast-height);}}", "@keyframes f5j8bii{from{opacity:0;}to{opacity:1;}}", "@keyframes fk0lfw7{from{opacity:1;}to{opacity:0;}}", "@keyframes f1n32sdh{from{opacity:0;}to{opacity:0;margin-top:0;max-height:0;}}"]
26
+ });
9
27
  /**
10
28
  * Apply styling to the ToastContainer slots based on the state
11
29
  */
12
30
  export const useToastContainerStyles_unstable = state => {
13
31
  const rootBaseClassName = useRootBaseClassName();
14
- state.root.className = mergeClasses(toastContainerClassNames.root, rootBaseClassName, state.root.className);
32
+ const styles = useStyles();
33
+ state.root.className = mergeClasses(toastContainerClassNames.root, rootBaseClassName, state.visible ? styles.enter : styles.exit, state.root.className);
15
34
  return state;
16
35
  };
17
36
  //# sourceMappingURL=useToastContainerStyles.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__resetStyles","mergeClasses","tokens","createCustomFocusIndicatorStyle","toastContainerClassNames","root","timer","useRootBaseClassName","useToastContainerStyles_unstable","state","rootBaseClassName","className"],"sources":["useToastContainerStyles.styles.js"],"sourcesContent":["import { makeResetStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nexport const toastContainerClassNames = {\n root: 'fui-ToastContainer',\n timer: 'fui-ToastContainer__timer'\n};\nconst useRootBaseClassName = makeResetStyles({\n boxSizing: 'border-box',\n marginTop: '16px',\n pointerEvents: 'all',\n borderRadius: tokens.borderRadiusMedium,\n ...createCustomFocusIndicatorStyle({\n outline: `${tokens.strokeWidthThick} solid ${tokens.colorStrokeFocus2}`\n })\n});\n/**\n * Apply styling to the ToastContainer slots based on the state\n */ export const useToastContainerStyles_unstable = (state)=>{\n const rootBaseClassName = useRootBaseClassName();\n state.root.className = mergeClasses(toastContainerClassNames.root, rootBaseClassName, state.root.className);\n return state;\n};\n"],"mappings":"AAAA,SAAAA,aAAA,EAA0BC,YAAY,QAAQ,gBAAgB;AAC9D,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,+BAA+B,QAAQ,yBAAyB;AACzE,OAAO,MAAMC,wBAAwB,GAAG;EACpCC,IAAI,EAAE,oBAAoB;EAC1BC,KAAK,EAAE;AACX,CAAC;AACD,MAAMC,oBAAoB,gBAAGP,aAAA,sOAQ5B,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMQ,gCAAgC,GAAIC,KAAK,IAAG;EACzD,MAAMC,iBAAiB,GAAGH,oBAAoB,CAAC,CAAC;EAChDE,KAAK,CAACJ,IAAI,CAACM,SAAS,GAAGV,YAAY,CAACG,wBAAwB,CAACC,IAAI,EAAEK,iBAAiB,EAAED,KAAK,CAACJ,IAAI,CAACM,SAAS,CAAC;EAC3G,OAAOF,KAAK;AAChB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__resetStyles","__styles","mergeClasses","tokens","createCustomFocusIndicatorStyle","toastContainerClassNames","root","timer","useRootBaseClassName","useStyles","enter","vin17d","m1gqa9","Bv12yb3","exit","d","k","useToastContainerStyles_unstable","state","rootBaseClassName","styles","className","visible"],"sources":["useToastContainerStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nexport const toastContainerClassNames = {\n root: 'fui-ToastContainer',\n timer: 'fui-ToastContainer__timer'\n};\nconst useRootBaseClassName = makeResetStyles({\n boxSizing: 'border-box',\n marginTop: '16px',\n minHeight: '44px',\n pointerEvents: 'all',\n borderRadius: tokens.borderRadiusMedium,\n '--fui-toast-height': '44px',\n ...createCustomFocusIndicatorStyle({\n outline: `${tokens.strokeWidthThick} solid ${tokens.colorStrokeFocus2}`\n })\n});\n/**\n * Styles for the root slot\n */ const useStyles = makeStyles({\n enter: {\n animationDuration: '200ms, 400ms',\n animationDelay: '0ms, 200ms',\n animationName: [\n {\n from: {\n maxHeight: 0,\n opacity: 0,\n marginTop: 0\n },\n to: {\n marginTop: '16px',\n opacity: 0,\n maxHeight: 'var(--fui-toast-height)'\n }\n },\n {\n from: {\n opacity: 0\n },\n to: {\n opacity: 1\n }\n }\n ]\n },\n exit: {\n animationDuration: '400ms, 200ms',\n animationDelay: '0ms, 400ms',\n animationName: [\n {\n from: {\n opacity: 1\n },\n to: {\n opacity: 0\n }\n },\n {\n from: {\n opacity: 0\n },\n to: {\n opacity: 0,\n marginTop: 0,\n maxHeight: 0\n }\n }\n ]\n }\n});\n/**\n * Apply styling to the ToastContainer slots based on the state\n */ export const useToastContainerStyles_unstable = (state)=>{\n const rootBaseClassName = useRootBaseClassName();\n const styles = useStyles();\n state.root.className = mergeClasses(toastContainerClassNames.root, rootBaseClassName, state.visible ? styles.enter : styles.exit, 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,+BAA+B,QAAQ,yBAAyB;AACzE,OAAO,MAAMC,wBAAwB,GAAG;EACpCC,IAAI,EAAE,oBAAoB;EAC1BC,KAAK,EAAE;AACX,CAAC;AACD,MAAMC,oBAAoB,gBAAGR,aAAA,iRAU5B,CAAC;AACF;AACA;AACA;AAAI,MAAMS,SAAS,gBAAGR,QAAA;EAAAS,KAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAC,IAAA;IAAAH,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAE,CAAA;EAAAC,CAAA;AAAA,CAmDrB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,gCAAgC,GAAIC,KAAK,IAAG;EACzD,MAAMC,iBAAiB,GAAGX,oBAAoB,CAAC,CAAC;EAChD,MAAMY,MAAM,GAAGX,SAAS,CAAC,CAAC;EAC1BS,KAAK,CAACZ,IAAI,CAACe,SAAS,GAAGnB,YAAY,CAACG,wBAAwB,CAACC,IAAI,EAAEa,iBAAiB,EAAED,KAAK,CAACI,OAAO,GAAGF,MAAM,CAACV,KAAK,GAAGU,MAAM,CAACN,IAAI,EAAEI,KAAK,CAACZ,IAAI,CAACe,SAAS,CAAC;EACvJ,OAAOH,KAAK;AAChB,CAAC","ignoreList":[]}
@@ -10,24 +10,25 @@ Object.defineProperty(exports, "renderToastContainer_unstable", {
10
10
  });
11
11
  const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
12
12
  const _reactutilities = require("@fluentui/react-utilities");
13
+ const _reacttransitiongroup = require("react-transition-group");
13
14
  const _toastContainerContext = require("../../contexts/toastContainerContext");
14
- const _ToastContainerMotion = require("./ToastContainerMotion");
15
15
  const renderToastContainer_unstable = (state, contextValues)=>{
16
- const { onMotionFinish, visible, updateId } = state;
16
+ const { onTransitionEntering, visible, transitionTimeout, remove, nodeRef, updateId } = state;
17
17
  (0, _reactutilities.assertSlots)(state);
18
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_toastContainerContext.ToastContainerContextProvider, {
19
- value: contextValues.toast,
20
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ToastContainerMotion.ToastContainerMotion, {
21
- appear: true,
22
- onMotionFinish: onMotionFinish,
23
- visible: visible,
24
- unmountOnExit: true,
25
- children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.root, {
26
- children: [
27
- state.root.children,
28
- /*#__PURE__*/ (0, _jsxruntime.jsx)(state.timer, {}, updateId)
29
- ]
30
- })
18
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_reacttransitiongroup.Transition, {
19
+ in: visible,
20
+ appear: true,
21
+ unmountOnExit: true,
22
+ timeout: transitionTimeout,
23
+ onExited: remove,
24
+ onEntering: onTransitionEntering,
25
+ nodeRef: nodeRef,
26
+ children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_toastContainerContext.ToastContainerContextProvider, {
27
+ value: contextValues.toast,
28
+ children: [
29
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {}),
30
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(state.timer, {}, updateId)
31
+ ]
31
32
  })
32
33
  });
33
34
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["renderToastContainer.js"],"sourcesContent":[" import { jsx as _jsx, jsxs as _jsxs } from \"@fluentui/react-jsx-runtime/jsx-runtime\";\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { ToastContainerContextProvider } from '../../contexts/toastContainerContext';\nimport { ToastContainerMotion } from './ToastContainerMotion';\n/**\n * Render the final JSX of ToastContainer\n */ export const renderToastContainer_unstable = (state, contextValues)=>{\n const { onMotionFinish, visible, updateId } = state;\n assertSlots(state);\n return /*#__PURE__*/ _jsx(ToastContainerContextProvider, {\n value: contextValues.toast,\n children: /*#__PURE__*/ _jsx(ToastContainerMotion, {\n appear: true,\n onMotionFinish: onMotionFinish,\n visible: visible,\n unmountOnExit: true,\n children: /*#__PURE__*/ _jsxs(state.root, {\n children: [\n state.root.children,\n /*#__PURE__*/ _jsx(state.timer, {}, updateId)\n ]\n })\n })\n });\n};\n"],"names":["renderToastContainer_unstable","state","contextValues","onMotionFinish","visible","updateId","assertSlots","_jsx","ToastContainerContextProvider","value","toast","children","ToastContainerMotion","appear","unmountOnExit","_jsxs","root","timer"],"mappings":";;;;+BAMiBA;;;eAAAA;;;4BAN4B;gCACjB;uCACkB;sCACT;AAG1B,MAAMA,gCAAgC,CAACC,OAAOC;IACrD,MAAM,EAAEC,cAAc,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGJ;IAC9CK,IAAAA,2BAAW,EAACL;IACZ,OAAO,WAAW,GAAGM,IAAAA,eAAI,EAACC,oDAA6B,EAAE;QACrDC,OAAOP,cAAcQ,KAAK;QAC1BC,UAAU,WAAW,GAAGJ,IAAAA,eAAI,EAACK,0CAAoB,EAAE;YAC/CC,QAAQ;YACRV,gBAAgBA;YAChBC,SAASA;YACTU,eAAe;YACfH,UAAU,WAAW,GAAGI,IAAAA,gBAAK,EAACd,MAAMe,IAAI,EAAE;gBACtCL,UAAU;oBACNV,MAAMe,IAAI,CAACL,QAAQ;oBACnB,WAAW,GAAGJ,IAAAA,eAAI,EAACN,MAAMgB,KAAK,EAAE,CAAC,GAAGZ;iBACvC;YACL;QACJ;IACJ;AACJ"}
1
+ {"version":3,"sources":["renderToastContainer.js"],"sourcesContent":[" import { jsx as _jsx, jsxs as _jsxs } from \"@fluentui/react-jsx-runtime/jsx-runtime\";\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { Transition } from 'react-transition-group';\nimport { ToastContainerContextProvider } from '../../contexts/toastContainerContext';\n/**\n * Render the final JSX of ToastContainer\n */ export const renderToastContainer_unstable = (state, contextValues)=>{\n const { onTransitionEntering, visible, transitionTimeout, remove, nodeRef, updateId } = state;\n assertSlots(state);\n return /*#__PURE__*/ _jsx(Transition, {\n in: visible,\n appear: true,\n unmountOnExit: true,\n timeout: transitionTimeout,\n onExited: remove,\n onEntering: onTransitionEntering,\n nodeRef: nodeRef,\n children: /*#__PURE__*/ _jsxs(ToastContainerContextProvider, {\n value: contextValues.toast,\n children: [\n /*#__PURE__*/ _jsx(state.root, {}),\n /*#__PURE__*/ _jsx(state.timer, {}, updateId)\n ]\n })\n });\n};\n"],"names":["renderToastContainer_unstable","state","contextValues","onTransitionEntering","visible","transitionTimeout","remove","nodeRef","updateId","assertSlots","_jsx","Transition","in","appear","unmountOnExit","timeout","onExited","onEntering","children","_jsxs","ToastContainerContextProvider","value","toast","root","timer"],"mappings":";;;;+BAMiBA;;;eAAAA;;;4BAN4B;gCACjB;sCACD;uCACmB;AAGnC,MAAMA,gCAAgC,CAACC,OAAOC;IACrD,MAAM,EAAEC,oBAAoB,EAAEC,OAAO,EAAEC,iBAAiB,EAAEC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGP;IACxFQ,IAAAA,2BAAW,EAACR;IACZ,OAAO,WAAW,GAAGS,IAAAA,eAAI,EAACC,gCAAU,EAAE;QAClCC,IAAIR;QACJS,QAAQ;QACRC,eAAe;QACfC,SAASV;QACTW,UAAUV;QACVW,YAAYd;QACZI,SAASA;QACTW,UAAU,WAAW,GAAGC,IAAAA,gBAAK,EAACC,oDAA6B,EAAE;YACzDC,OAAOnB,cAAcoB,KAAK;YAC1BJ,UAAU;gBACN,WAAW,GAAGR,IAAAA,eAAI,EAACT,MAAMsB,IAAI,EAAE,CAAC;gBAChC,WAAW,GAAGb,IAAAA,eAAI,EAACT,MAAMuB,KAAK,EAAE,CAAC,GAAGhB;aACvC;QACL;IACJ;AACJ"}
@@ -22,7 +22,7 @@ const intentPolitenessMap = {
22
22
  info: 'polite'
23
23
  };
24
24
  const useToastContainer_unstable = (props, ref)=>{
25
- const { visible, children, close: closeProp, remove, updateId, announce, data, timeout: timerTimeout, politeness: desiredPoliteness, intent = 'info', pauseOnHover, pauseOnWindowBlur, imperativeRef, tryRestoreFocus, ...rest } = props;
25
+ const { visible, children, close: closeProp, remove, updateId, announce, data, timeout: timerTimeout, politeness: desiredPoliteness, intent = 'info', pauseOnHover, pauseOnWindowBlur, imperativeRef, tryRestoreFocus, content, ...rest } = props;
26
26
  const titleId = (0, _reactutilities.useId)('toast-title');
27
27
  const bodyId = (0, _reactutilities.useId)('toast-body');
28
28
  const toastRef = _react.useRef(null);
@@ -112,21 +112,32 @@ const useToastContainer_unstable = (props, ref)=>{
112
112
  play,
113
113
  pauseOnWindowBlur
114
114
  ]);
115
+ // It's impossible to animate to height: auto in CSS, the actual pixel value must be known
116
+ // Get the height of the toast before animation styles have been applied and set a CSS
117
+ // variable with its height. The CSS variable will be used by the styles
118
+ const onTransitionEntering = ()=>{
119
+ if (!toastRef.current) {
120
+ return;
121
+ }
122
+ const element = toastRef.current;
123
+ element.style.setProperty('--fui-toast-height', `${element.scrollHeight}px`);
124
+ };
115
125
  // Users never actually use ToastContainer as a JSX but imperatively through useToastContainerController
116
126
  const userRootSlot = data.root;
117
- const onMotionFinish = _react.useCallback((_, { direction })=>{
118
- if (direction === 'exit') {
119
- remove();
120
- }
121
- if (direction === 'enter') {
122
- // start toast once it's fully animated in
123
- play();
124
- onStatusChange('visible');
127
+ // Using a ref callback here because addEventListener supports `once`
128
+ const toastAnimationRef = _react.useCallback((el)=>{
129
+ if (el && toastRef.current) {
130
+ toastRef.current.addEventListener('animationend', ()=>{
131
+ // start toast once it's fully animated in
132
+ play();
133
+ onStatusChange('visible');
134
+ }, {
135
+ once: true
136
+ });
125
137
  }
126
138
  }, [
127
- onStatusChange,
128
139
  play,
129
- remove
140
+ onStatusChange
130
141
  ]);
131
142
  const onMouseEnter = (0, _reactutilities.useEventCallback)((e)=>{
132
143
  var _userRootSlot_onMouseEnter;
@@ -201,7 +212,7 @@ const useToastContainer_unstable = (props, ref)=>{
201
212
  // FIXME:
202
213
  // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
203
214
  // but since it would be a breaking change to fix it, we are casting ref to it's proper type
204
- ref: (0, _reactutilities.useMergedRefs)(ref, toastRef),
215
+ ref: (0, _reactutilities.useMergedRefs)(ref, toastRef, toastAnimationRef),
205
216
  children,
206
217
  tabIndex: 0,
207
218
  role: 'listitem',
@@ -217,18 +228,16 @@ const useToastContainer_unstable = (props, ref)=>{
217
228
  elementType: 'div'
218
229
  }),
219
230
  timerTimeout,
220
- transitionTimeout: 0,
231
+ transitionTimeout: 500,
221
232
  running,
222
233
  visible,
223
234
  remove,
224
235
  close,
225
- onTransitionEntering: ()=>{
226
- /* no-op */ },
236
+ onTransitionEntering,
227
237
  updateId,
228
238
  nodeRef: toastRef,
229
239
  intent,
230
240
  titleId,
231
- bodyId,
232
- onMotionFinish
241
+ bodyId
233
242
  };
234
243
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["useToastContainer.js"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, useMergedRefs, useEventCallback, useId, slot } from '@fluentui/react-utilities';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { Delete, Tab } from '@fluentui/keyboard-keys';\nimport { useFocusableGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { Timer } from '../Timer/Timer';\nconst intentPolitenessMap = {\n success: 'assertive',\n warning: 'assertive',\n error: 'assertive',\n info: 'polite'\n};\n/**\n * Create the state required to render ToastContainer.\n *\n * The returned state can be modified with hooks such as useToastContainerStyles_unstable,\n * before being passed to renderToastContainer_unstable.\n *\n * @param props - props from this instance of ToastContainer\n * @param ref - reference to root HTMLElement of ToastContainer\n */ export const useToastContainer_unstable = (props, ref)=>{\n const { visible, children, close: closeProp, remove, updateId, announce, data, timeout: timerTimeout, politeness: desiredPoliteness, intent = 'info', pauseOnHover, pauseOnWindowBlur, imperativeRef, tryRestoreFocus, ...rest } = props;\n const titleId = useId('toast-title');\n const bodyId = useId('toast-body');\n const toastRef = React.useRef(null);\n const { targetDocument } = useFluent_unstable();\n const [running, setRunning] = React.useState(false);\n const imperativePauseRef = React.useRef(false);\n const focusedToastBeforeClose = React.useRef(false);\n const focusableGroupAttribute = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n // Users should only use Tab to focus into the toast\n // Escape is already reserved to dismiss all toasts\n ignoreDefaultKeydown: {\n Tab: true,\n Escape: true,\n Enter: true\n }\n });\n const close = useEventCallback(()=>{\n var _toastRef_current;\n const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;\n if (activeElement && ((_toastRef_current = toastRef.current) === null || _toastRef_current === void 0 ? void 0 : _toastRef_current.contains(activeElement))) {\n focusedToastBeforeClose.current = true;\n }\n closeProp();\n });\n const onStatusChange = useEventCallback((status)=>{\n var _props_onStatusChange;\n return (_props_onStatusChange = props.onStatusChange) === null || _props_onStatusChange === void 0 ? void 0 : _props_onStatusChange.call(props, null, {\n status,\n ...props\n });\n });\n const pause = useEventCallback(()=>setRunning(false));\n const play = useEventCallback(()=>{\n var _toastRef_current;\n if (imperativePauseRef.current) {\n return;\n }\n var _targetDocument_activeElement;\n const containsActive = !!((_toastRef_current = toastRef.current) === null || _toastRef_current === void 0 ? void 0 : _toastRef_current.contains((_targetDocument_activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement) !== null && _targetDocument_activeElement !== void 0 ? _targetDocument_activeElement : null));\n if (timerTimeout < 0) {\n setRunning(true);\n return;\n }\n if (!containsActive) {\n setRunning(true);\n }\n });\n React.useImperativeHandle(imperativeRef, ()=>({\n focus: ()=>{\n if (!toastRef.current) {\n return;\n }\n toastRef.current.focus();\n },\n play: ()=>{\n imperativePauseRef.current = false;\n play();\n },\n pause: ()=>{\n imperativePauseRef.current = true;\n pause();\n }\n }));\n React.useEffect(()=>{\n return ()=>onStatusChange('unmounted');\n }, [\n onStatusChange\n ]);\n React.useEffect(()=>{\n if (!targetDocument) {\n return;\n }\n if (pauseOnWindowBlur) {\n var _targetDocument_defaultView, _targetDocument_defaultView1;\n (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.addEventListener('focus', play);\n (_targetDocument_defaultView1 = targetDocument.defaultView) === null || _targetDocument_defaultView1 === void 0 ? void 0 : _targetDocument_defaultView1.addEventListener('blur', pause);\n return ()=>{\n var _targetDocument_defaultView, _targetDocument_defaultView1;\n (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.removeEventListener('focus', play);\n (_targetDocument_defaultView1 = targetDocument.defaultView) === null || _targetDocument_defaultView1 === void 0 ? void 0 : _targetDocument_defaultView1.removeEventListener('blur', pause);\n };\n }\n }, [\n targetDocument,\n pause,\n play,\n pauseOnWindowBlur\n ]);\n // Users never actually use ToastContainer as a JSX but imperatively through useToastContainerController\n const userRootSlot = data.root;\n const onMotionFinish = React.useCallback((_, { direction })=>{\n if (direction === 'exit') {\n remove();\n }\n if (direction === 'enter') {\n // start toast once it's fully animated in\n play();\n onStatusChange('visible');\n }\n }, [\n onStatusChange,\n play,\n remove\n ]);\n const onMouseEnter = useEventCallback((e)=>{\n var _userRootSlot_onMouseEnter;\n pause();\n userRootSlot === null || userRootSlot === void 0 ? void 0 : (_userRootSlot_onMouseEnter = userRootSlot.onMouseEnter) === null || _userRootSlot_onMouseEnter === void 0 ? void 0 : _userRootSlot_onMouseEnter.call(userRootSlot, e);\n });\n const onMouseLeave = useEventCallback((e)=>{\n var _userRootSlot_onMouseEnter;\n play();\n userRootSlot === null || userRootSlot === void 0 ? void 0 : (_userRootSlot_onMouseEnter = userRootSlot.onMouseEnter) === null || _userRootSlot_onMouseEnter === void 0 ? void 0 : _userRootSlot_onMouseEnter.call(userRootSlot, e);\n });\n const { findFirstFocusable, findLastFocusable } = useFocusFinders();\n const onKeyDown = useEventCallback((e)=>{\n var _userRootSlot_onKeyDown;\n if (e.key === Delete) {\n e.preventDefault();\n close();\n }\n if (e.key === Tab && e.currentTarget === e.target) {\n e.preventDefault();\n if (e.shiftKey) {\n var _findLastFocusable;\n (_findLastFocusable = findLastFocusable(e.currentTarget)) === null || _findLastFocusable === void 0 ? void 0 : _findLastFocusable.focus();\n } else {\n var _findFirstFocusable;\n (_findFirstFocusable = findFirstFocusable(e.currentTarget)) === null || _findFirstFocusable === void 0 ? void 0 : _findFirstFocusable.focus();\n }\n }\n userRootSlot === null || userRootSlot === void 0 ? void 0 : (_userRootSlot_onKeyDown = userRootSlot.onKeyDown) === null || _userRootSlot_onKeyDown === void 0 ? void 0 : _userRootSlot_onKeyDown.call(userRootSlot, e);\n });\n React.useEffect(()=>{\n var _toastRef_current;\n if (!visible) {\n return;\n }\n const politeness = desiredPoliteness !== null && desiredPoliteness !== void 0 ? desiredPoliteness : intentPolitenessMap[intent];\n var _toastRef_current_textContent;\n announce((_toastRef_current_textContent = (_toastRef_current = toastRef.current) === null || _toastRef_current === void 0 ? void 0 : _toastRef_current.textContent) !== null && _toastRef_current_textContent !== void 0 ? _toastRef_current_textContent : '', {\n politeness\n });\n }, [\n announce,\n desiredPoliteness,\n toastRef,\n visible,\n updateId,\n intent\n ]);\n React.useEffect(()=>{\n return ()=>{\n if (focusedToastBeforeClose.current) {\n focusedToastBeforeClose.current = false;\n tryRestoreFocus();\n }\n };\n }, [\n tryRestoreFocus\n ]);\n return {\n components: {\n timer: Timer,\n root: 'div'\n },\n timer: slot.always({\n onTimeout: close,\n running,\n timeout: timerTimeout !== null && timerTimeout !== void 0 ? timerTimeout : -1\n }, {\n elementType: Timer\n }),\n root: slot.always(getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, toastRef),\n children,\n tabIndex: 0,\n role: 'listitem',\n 'aria-labelledby': titleId,\n 'aria-describedby': bodyId,\n ...rest,\n ...userRootSlot,\n ...focusableGroupAttribute,\n onMouseEnter,\n onMouseLeave,\n onKeyDown\n }), {\n elementType: 'div'\n }),\n timerTimeout,\n transitionTimeout: 0,\n running,\n visible,\n remove,\n close,\n onTransitionEntering: ()=>{\n /* no-op */ },\n updateId,\n nodeRef: toastRef,\n intent,\n titleId,\n bodyId,\n onMotionFinish\n };\n};\n"],"names":["useToastContainer_unstable","intentPolitenessMap","success","warning","error","info","props","ref","visible","children","close","closeProp","remove","updateId","announce","data","timeout","timerTimeout","politeness","desiredPoliteness","intent","pauseOnHover","pauseOnWindowBlur","imperativeRef","tryRestoreFocus","rest","titleId","useId","bodyId","toastRef","React","useRef","targetDocument","useFluent_unstable","running","setRunning","useState","imperativePauseRef","focusedToastBeforeClose","focusableGroupAttribute","useFocusableGroup","tabBehavior","ignoreDefaultKeydown","Tab","Escape","Enter","useEventCallback","_toastRef_current","activeElement","current","contains","onStatusChange","status","_props_onStatusChange","call","pause","play","_targetDocument_activeElement","containsActive","useImperativeHandle","focus","useEffect","_targetDocument_defaultView","_targetDocument_defaultView1","defaultView","addEventListener","removeEventListener","userRootSlot","root","onMotionFinish","useCallback","_","direction","onMouseEnter","e","_userRootSlot_onMouseEnter","onMouseLeave","findFirstFocusable","findLastFocusable","useFocusFinders","onKeyDown","_userRootSlot_onKeyDown","key","Delete","preventDefault","currentTarget","target","shiftKey","_findLastFocusable","_findFirstFocusable","_toastRef_current_textContent","textContent","components","timer","Timer","slot","always","onTimeout","elementType","getIntrinsicElementProps","useMergedRefs","tabIndex","role","transitionTimeout","onTransitionEntering","nodeRef"],"mappings":";;;;+BAoBiBA;;;eAAAA;;;;iEApBM;gCACgE;qCACpD;8BACP;8BACuB;uBAC7B;AACtB,MAAMC,sBAAsB;IACxBC,SAAS;IACTC,SAAS;IACTC,OAAO;IACPC,MAAM;AACV;AASW,MAAML,6BAA6B,CAACM,OAAOC;IAClD,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,OAAOC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,SAASC,YAAY,EAAEC,YAAYC,iBAAiB,EAAEC,SAAS,MAAM,EAAEC,YAAY,EAAEC,iBAAiB,EAAEC,aAAa,EAAEC,eAAe,EAAE,GAAGC,MAAM,GAAGnB;IACnO,MAAMoB,UAAUC,IAAAA,qBAAK,EAAC;IACtB,MAAMC,SAASD,IAAAA,qBAAK,EAAC;IACrB,MAAME,WAAWC,OAAMC,MAAM,CAAC;IAC9B,MAAM,EAAEC,cAAc,EAAE,GAAGC,IAAAA,uCAAkB;IAC7C,MAAM,CAACC,SAASC,WAAW,GAAGL,OAAMM,QAAQ,CAAC;IAC7C,MAAMC,qBAAqBP,OAAMC,MAAM,CAAC;IACxC,MAAMO,0BAA0BR,OAAMC,MAAM,CAAC;IAC7C,MAAMQ,0BAA0BC,IAAAA,+BAAiB,EAAC;QAC9CC,aAAa;QACb,oDAAoD;QACpD,mDAAmD;QACnDC,sBAAsB;YAClBC,KAAK;YACLC,QAAQ;YACRC,OAAO;QACX;IACJ;IACA,MAAMnC,QAAQoC,IAAAA,gCAAgB,EAAC;QAC3B,IAAIC;QACJ,MAAMC,gBAAgBhB,mBAAmB,QAAQA,mBAAmB,KAAK,IAAI,KAAK,IAAIA,eAAegB,aAAa;QAClH,IAAIA,iBAAkB,CAAA,AAACD,CAAAA,oBAAoBlB,SAASoB,OAAO,AAA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J"}
1
+ {"version":3,"sources":["useToastContainer.js"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, useMergedRefs, useEventCallback, useId, slot } from '@fluentui/react-utilities';\nimport { useFluent_unstable } from '@fluentui/react-shared-contexts';\nimport { Delete, Tab } from '@fluentui/keyboard-keys';\nimport { useFocusableGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { Timer } from '../Timer/Timer';\nconst intentPolitenessMap = {\n success: 'assertive',\n warning: 'assertive',\n error: 'assertive',\n info: 'polite'\n};\n/**\n * Create the state required to render ToastContainer.\n *\n * The returned state can be modified with hooks such as useToastContainerStyles_unstable,\n * before being passed to renderToastContainer_unstable.\n *\n * @param props - props from this instance of ToastContainer\n * @param ref - reference to root HTMLElement of ToastContainer\n */ export const useToastContainer_unstable = (props, ref)=>{\n const { visible, children, close: closeProp, remove, updateId, announce, data, timeout: timerTimeout, politeness: desiredPoliteness, intent = 'info', pauseOnHover, pauseOnWindowBlur, imperativeRef, tryRestoreFocus, content, ...rest } = props;\n const titleId = useId('toast-title');\n const bodyId = useId('toast-body');\n const toastRef = React.useRef(null);\n const { targetDocument } = useFluent_unstable();\n const [running, setRunning] = React.useState(false);\n const imperativePauseRef = React.useRef(false);\n const focusedToastBeforeClose = React.useRef(false);\n const focusableGroupAttribute = useFocusableGroup({\n tabBehavior: 'limited-trap-focus',\n // Users should only use Tab to focus into the toast\n // Escape is already reserved to dismiss all toasts\n ignoreDefaultKeydown: {\n Tab: true,\n Escape: true,\n Enter: true\n }\n });\n const close = useEventCallback(()=>{\n var _toastRef_current;\n const activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement;\n if (activeElement && ((_toastRef_current = toastRef.current) === null || _toastRef_current === void 0 ? void 0 : _toastRef_current.contains(activeElement))) {\n focusedToastBeforeClose.current = true;\n }\n closeProp();\n });\n const onStatusChange = useEventCallback((status)=>{\n var _props_onStatusChange;\n return (_props_onStatusChange = props.onStatusChange) === null || _props_onStatusChange === void 0 ? void 0 : _props_onStatusChange.call(props, null, {\n status,\n ...props\n });\n });\n const pause = useEventCallback(()=>setRunning(false));\n const play = useEventCallback(()=>{\n var _toastRef_current;\n if (imperativePauseRef.current) {\n return;\n }\n var _targetDocument_activeElement;\n const containsActive = !!((_toastRef_current = toastRef.current) === null || _toastRef_current === void 0 ? void 0 : _toastRef_current.contains((_targetDocument_activeElement = targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement) !== null && _targetDocument_activeElement !== void 0 ? _targetDocument_activeElement : null));\n if (timerTimeout < 0) {\n setRunning(true);\n return;\n }\n if (!containsActive) {\n setRunning(true);\n }\n });\n React.useImperativeHandle(imperativeRef, ()=>({\n focus: ()=>{\n if (!toastRef.current) {\n return;\n }\n toastRef.current.focus();\n },\n play: ()=>{\n imperativePauseRef.current = false;\n play();\n },\n pause: ()=>{\n imperativePauseRef.current = true;\n pause();\n }\n }));\n React.useEffect(()=>{\n return ()=>onStatusChange('unmounted');\n }, [\n onStatusChange\n ]);\n React.useEffect(()=>{\n if (!targetDocument) {\n return;\n }\n if (pauseOnWindowBlur) {\n var _targetDocument_defaultView, _targetDocument_defaultView1;\n (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.addEventListener('focus', play);\n (_targetDocument_defaultView1 = targetDocument.defaultView) === null || _targetDocument_defaultView1 === void 0 ? void 0 : _targetDocument_defaultView1.addEventListener('blur', pause);\n return ()=>{\n var _targetDocument_defaultView, _targetDocument_defaultView1;\n (_targetDocument_defaultView = targetDocument.defaultView) === null || _targetDocument_defaultView === void 0 ? void 0 : _targetDocument_defaultView.removeEventListener('focus', play);\n (_targetDocument_defaultView1 = targetDocument.defaultView) === null || _targetDocument_defaultView1 === void 0 ? void 0 : _targetDocument_defaultView1.removeEventListener('blur', pause);\n };\n }\n }, [\n targetDocument,\n pause,\n play,\n pauseOnWindowBlur\n ]);\n // It's impossible to animate to height: auto in CSS, the actual pixel value must be known\n // Get the height of the toast before animation styles have been applied and set a CSS\n // variable with its height. The CSS variable will be used by the styles\n const onTransitionEntering = ()=>{\n if (!toastRef.current) {\n return;\n }\n const element = toastRef.current;\n element.style.setProperty('--fui-toast-height', `${element.scrollHeight}px`);\n };\n // Users never actually use ToastContainer as a JSX but imperatively through useToastContainerController\n const userRootSlot = data.root;\n // Using a ref callback here because addEventListener supports `once`\n const toastAnimationRef = React.useCallback((el)=>{\n if (el && toastRef.current) {\n toastRef.current.addEventListener('animationend', ()=>{\n // start toast once it's fully animated in\n play();\n onStatusChange('visible');\n }, {\n once: true\n });\n }\n }, [\n play,\n onStatusChange\n ]);\n const onMouseEnter = useEventCallback((e)=>{\n var _userRootSlot_onMouseEnter;\n pause();\n userRootSlot === null || userRootSlot === void 0 ? void 0 : (_userRootSlot_onMouseEnter = userRootSlot.onMouseEnter) === null || _userRootSlot_onMouseEnter === void 0 ? void 0 : _userRootSlot_onMouseEnter.call(userRootSlot, e);\n });\n const onMouseLeave = useEventCallback((e)=>{\n var _userRootSlot_onMouseEnter;\n play();\n userRootSlot === null || userRootSlot === void 0 ? void 0 : (_userRootSlot_onMouseEnter = userRootSlot.onMouseEnter) === null || _userRootSlot_onMouseEnter === void 0 ? void 0 : _userRootSlot_onMouseEnter.call(userRootSlot, e);\n });\n const { findFirstFocusable, findLastFocusable } = useFocusFinders();\n const onKeyDown = useEventCallback((e)=>{\n var _userRootSlot_onKeyDown;\n if (e.key === Delete) {\n e.preventDefault();\n close();\n }\n if (e.key === Tab && e.currentTarget === e.target) {\n e.preventDefault();\n if (e.shiftKey) {\n var _findLastFocusable;\n (_findLastFocusable = findLastFocusable(e.currentTarget)) === null || _findLastFocusable === void 0 ? void 0 : _findLastFocusable.focus();\n } else {\n var _findFirstFocusable;\n (_findFirstFocusable = findFirstFocusable(e.currentTarget)) === null || _findFirstFocusable === void 0 ? void 0 : _findFirstFocusable.focus();\n }\n }\n userRootSlot === null || userRootSlot === void 0 ? void 0 : (_userRootSlot_onKeyDown = userRootSlot.onKeyDown) === null || _userRootSlot_onKeyDown === void 0 ? void 0 : _userRootSlot_onKeyDown.call(userRootSlot, e);\n });\n React.useEffect(()=>{\n var _toastRef_current;\n if (!visible) {\n return;\n }\n const politeness = desiredPoliteness !== null && desiredPoliteness !== void 0 ? desiredPoliteness : intentPolitenessMap[intent];\n var _toastRef_current_textContent;\n announce((_toastRef_current_textContent = (_toastRef_current = toastRef.current) === null || _toastRef_current === void 0 ? void 0 : _toastRef_current.textContent) !== null && _toastRef_current_textContent !== void 0 ? _toastRef_current_textContent : '', {\n politeness\n });\n }, [\n announce,\n desiredPoliteness,\n toastRef,\n visible,\n updateId,\n intent\n ]);\n React.useEffect(()=>{\n return ()=>{\n if (focusedToastBeforeClose.current) {\n focusedToastBeforeClose.current = false;\n tryRestoreFocus();\n }\n };\n }, [\n tryRestoreFocus\n ]);\n return {\n components: {\n timer: Timer,\n root: 'div'\n },\n timer: slot.always({\n onTimeout: close,\n running,\n timeout: timerTimeout !== null && timerTimeout !== void 0 ? timerTimeout : -1\n }, {\n elementType: Timer\n }),\n root: slot.always(getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, toastRef, toastAnimationRef),\n children,\n tabIndex: 0,\n role: 'listitem',\n 'aria-labelledby': titleId,\n 'aria-describedby': bodyId,\n ...rest,\n ...userRootSlot,\n ...focusableGroupAttribute,\n onMouseEnter,\n onMouseLeave,\n onKeyDown\n }), {\n elementType: 'div'\n }),\n timerTimeout,\n transitionTimeout: 500,\n running,\n visible,\n remove,\n close,\n onTransitionEntering,\n updateId,\n nodeRef: toastRef,\n intent,\n titleId,\n bodyId\n };\n};\n"],"names":["useToastContainer_unstable","intentPolitenessMap","success","warning","error","info","props","ref","visible","children","close","closeProp","remove","updateId","announce","data","timeout","timerTimeout","politeness","desiredPoliteness","intent","pauseOnHover","pauseOnWindowBlur","imperativeRef","tryRestoreFocus","content","rest","titleId","useId","bodyId","toastRef","React","useRef","targetDocument","useFluent_unstable","running","setRunning","useState","imperativePauseRef","focusedToastBeforeClose","focusableGroupAttribute","useFocusableGroup","tabBehavior","ignoreDefaultKeydown","Tab","Escape","Enter","useEventCallback","_toastRef_current","activeElement","current","contains","onStatusChange","status","_props_onStatusChange","call","pause","play","_targetDocument_activeElement","containsActive","useImperativeHandle","focus","useEffect","_targetDocument_defaultView","_targetDocument_defaultView1","defaultView","addEventListener","removeEventListener","onTransitionEntering","element","style","setProperty","scrollHeight","userRootSlot","root","toastAnimationRef","useCallback","el","once","onMouseEnter","e","_userRootSlot_onMouseEnter","onMouseLeave","findFirstFocusable","findLastFocusable","useFocusFinders","onKeyDown","_userRootSlot_onKeyDown","key","Delete","preventDefault","currentTarget","target","shiftKey","_findLastFocusable","_findFirstFocusable","_toastRef_current_textContent","textContent","components","timer","Timer","slot","always","onTimeout","elementType","getIntrinsicElementProps","useMergedRefs","tabIndex","role","transitionTimeout","nodeRef"],"mappings":";;;;+BAoBiBA;;;eAAAA;;;;iEApBM;gCACgE;qCACpD;8BACP;8BACuB;uBAC7B;AACtB,MAAMC,sBAAsB;IACxBC,SAAS;IACTC,SAAS;IACTC,OAAO;IACPC,MAAM;AACV;AASW,MAAML,6BAA6B,CAACM,OAAOC;IAClD,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,OAAOC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,SAASC,YAAY,EAAEC,YAAYC,iBAAiB,EAAEC,SAAS,MAAM,EAAEC,YAAY,EAAEC,iBAAiB,EAAEC,aAAa,EAAEC,eAAe,EAAEC,OAAO,EAAE,GAAGC,MAAM,GAAGpB;IAC5O,MAAMqB,UAAUC,IAAAA,qBAAK,EAAC;IACtB,MAAMC,SAASD,IAAAA,qBAAK,EAAC;IACrB,MAAME,WAAWC,OAAMC,MAAM,CAAC;IAC9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;IACDW,OAAM+B,SAAS,CAAC;QACZ,OAAO;YACH,IAAIvB,wBAAwBW,OAAO,EAAE;gBACjCX,wBAAwBW,OAAO,GAAG;gBAClC1B;YACJ;QACJ;IACJ,GAAG;QACCA;KACH;IACD,OAAO;QACH0E,YAAY;YACRC,OAAOC,YAAK;YACZ1B,MAAM;QACV;QACAyB,OAAOE,oBAAI,CAACC,MAAM,CAAC;YACfC,WAAW7F;YACXyB;YACAnB,SAASC,iBAAiB,QAAQA,iBAAiB,KAAK,IAAIA,eAAe,CAAC;QAChF,GAAG;YACCuF,aAAaJ,YAAK;QACtB;QACA1B,MAAM2B,oBAAI,CAACC,MAAM,CAACG,IAAAA,wCAAwB,EAAC,OAAO;YAC9C,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5FlG,KAAKmG,IAAAA,6BAAa,EAACnG,KAAKuB,UAAU6C;YAClClE;YACAkG,UAAU;YACVC,MAAM;YACN,mBAAmBjF;YACnB,oBAAoBE;YACpB,GAAGH,IAAI;YACP,GAAG+C,YAAY;YACf,GAAGjC,uBAAuB;YAC1BuC;YACAG;YACAI;QACJ,IAAI;YACAkB,aAAa;QACjB;QACAvF;QACA4F,mBAAmB;QACnB1E;QACA3B;QACAI;QACAF;QACA0D;QACAvD;QACAiG,SAAShF;QACTV;QACAO;QACAE;IACJ;AACJ"}
@@ -21,12 +21,42 @@ const toastContainerClassNames = {
21
21
  root: 'fui-ToastContainer',
22
22
  timer: 'fui-ToastContainer__timer'
23
23
  };
24
- const useRootBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("r98b696", null, [
25
- ".r98b696{box-sizing:border-box;margin-top:16px;pointer-events:all;border-radius:var(--borderRadiusMedium);}",
26
- ".r98b696[data-fui-focus-visible]{outline:var(--strokeWidthThick) solid var(--colorStrokeFocus2);}"
24
+ const useRootBaseClassName = /*#__PURE__*/ (0, _react.__resetStyles)("r14b3ftk", null, [
25
+ ".r14b3ftk{box-sizing:border-box;margin-top:16px;min-height:44px;pointer-events:all;border-radius:var(--borderRadiusMedium);--fui-toast-height:44px;}",
26
+ ".r14b3ftk[data-fui-focus-visible]{outline:var(--strokeWidthThick) solid var(--colorStrokeFocus2);}"
27
27
  ]);
28
+ /**
29
+ * Styles for the root slot
30
+ */ const useStyles = /*#__PURE__*/ (0, _react.__styles)({
31
+ enter: {
32
+ vin17d: "fayl5bc",
33
+ m1gqa9: "f17oyct0",
34
+ Bv12yb3: "fvv8lvk"
35
+ },
36
+ exit: {
37
+ vin17d: "f1tk3cza",
38
+ m1gqa9: "f1nx6yy9",
39
+ Bv12yb3: "f9wuypy"
40
+ }
41
+ }, {
42
+ d: [
43
+ ".fayl5bc{animation-duration:200ms,400ms;}",
44
+ ".f17oyct0{animation-delay:0ms,200ms;}",
45
+ ".fvv8lvk{animation-name:f1rp83na,f5j8bii;}",
46
+ ".f1tk3cza{animation-duration:400ms,200ms;}",
47
+ ".f1nx6yy9{animation-delay:0ms,400ms;}",
48
+ ".f9wuypy{animation-name:fk0lfw7,f1n32sdh;}"
49
+ ],
50
+ k: [
51
+ "@keyframes f1rp83na{from{max-height:0;opacity:0;margin-top:0;}to{margin-top:16px;opacity:0;max-height:var(--fui-toast-height);}}",
52
+ "@keyframes f5j8bii{from{opacity:0;}to{opacity:1;}}",
53
+ "@keyframes fk0lfw7{from{opacity:1;}to{opacity:0;}}",
54
+ "@keyframes f1n32sdh{from{opacity:0;}to{opacity:0;margin-top:0;max-height:0;}}"
55
+ ]
56
+ });
28
57
  const useToastContainerStyles_unstable = (state)=>{
29
58
  const rootBaseClassName = useRootBaseClassName();
30
- state.root.className = (0, _react.mergeClasses)(toastContainerClassNames.root, rootBaseClassName, state.root.className);
59
+ const styles = useStyles();
60
+ state.root.className = (0, _react.mergeClasses)(toastContainerClassNames.root, rootBaseClassName, state.visible ? styles.enter : styles.exit, state.root.className);
31
61
  return state;
32
62
  }; //# sourceMappingURL=useToastContainerStyles.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useToastContainerStyles.styles.js"],"sourcesContent":["import { __resetStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nexport const toastContainerClassNames = {\n root: 'fui-ToastContainer',\n timer: 'fui-ToastContainer__timer'\n};\nconst useRootBaseClassName = /*#__PURE__*/__resetStyles(\"r98b696\", null, [\".r98b696{box-sizing:border-box;margin-top:16px;pointer-events:all;border-radius:var(--borderRadiusMedium);}\", \".r98b696[data-fui-focus-visible]{outline:var(--strokeWidthThick) solid var(--colorStrokeFocus2);}\"]);\n/**\n * Apply styling to the ToastContainer slots based on the state\n */\nexport const useToastContainerStyles_unstable = state => {\n const rootBaseClassName = useRootBaseClassName();\n state.root.className = mergeClasses(toastContainerClassNames.root, rootBaseClassName, state.root.className);\n return state;\n};\n//# sourceMappingURL=useToastContainerStyles.styles.js.map"],"names":["toastContainerClassNames","useToastContainerStyles_unstable","root","timer","useRootBaseClassName","__resetStyles","state","rootBaseClassName","className","mergeClasses"],"mappings":";;;;;;;;;;;IAGaA,wBAAwB;eAAxBA;;IAQAC,gCAAgC;eAAhCA;;;uBAX+B;AAGrC,MAAMD,2BAA2B;IACtCE,MAAM;IACNC,OAAO;AACT;AACA,MAAMC,uBAAuB,WAAW,GAAEC,IAAAA,oBAAa,EAAC,WAAW,MAAM;IAAC;IAA+G;CAAoG;AAItR,MAAMJ,mCAAmCK,CAAAA;IAC9C,MAAMC,oBAAoBH;IAC1BE,MAAMJ,IAAI,CAACM,SAAS,GAAGC,IAAAA,mBAAY,EAACT,yBAAyBE,IAAI,EAAEK,mBAAmBD,MAAMJ,IAAI,CAACM,SAAS;IAC1G,OAAOF;AACT,GACA,0DAA0D"}
1
+ {"version":3,"sources":["useToastContainerStyles.styles.js"],"sourcesContent":["import { __resetStyles, __styles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nexport const toastContainerClassNames = {\n root: 'fui-ToastContainer',\n timer: 'fui-ToastContainer__timer'\n};\nconst useRootBaseClassName = /*#__PURE__*/__resetStyles(\"r14b3ftk\", null, [\".r14b3ftk{box-sizing:border-box;margin-top:16px;min-height:44px;pointer-events:all;border-radius:var(--borderRadiusMedium);--fui-toast-height:44px;}\", \".r14b3ftk[data-fui-focus-visible]{outline:var(--strokeWidthThick) solid var(--colorStrokeFocus2);}\"]);\n/**\n * Styles for the root slot\n */\nconst useStyles = /*#__PURE__*/__styles({\n enter: {\n vin17d: \"fayl5bc\",\n m1gqa9: \"f17oyct0\",\n Bv12yb3: \"fvv8lvk\"\n },\n exit: {\n vin17d: \"f1tk3cza\",\n m1gqa9: \"f1nx6yy9\",\n Bv12yb3: \"f9wuypy\"\n }\n}, {\n d: [\".fayl5bc{animation-duration:200ms,400ms;}\", \".f17oyct0{animation-delay:0ms,200ms;}\", \".fvv8lvk{animation-name:f1rp83na,f5j8bii;}\", \".f1tk3cza{animation-duration:400ms,200ms;}\", \".f1nx6yy9{animation-delay:0ms,400ms;}\", \".f9wuypy{animation-name:fk0lfw7,f1n32sdh;}\"],\n k: [\"@keyframes f1rp83na{from{max-height:0;opacity:0;margin-top:0;}to{margin-top:16px;opacity:0;max-height:var(--fui-toast-height);}}\", \"@keyframes f5j8bii{from{opacity:0;}to{opacity:1;}}\", \"@keyframes fk0lfw7{from{opacity:1;}to{opacity:0;}}\", \"@keyframes f1n32sdh{from{opacity:0;}to{opacity:0;margin-top:0;max-height:0;}}\"]\n});\n/**\n * Apply styling to the ToastContainer slots based on the state\n */\nexport const useToastContainerStyles_unstable = state => {\n const rootBaseClassName = useRootBaseClassName();\n const styles = useStyles();\n state.root.className = mergeClasses(toastContainerClassNames.root, rootBaseClassName, state.visible ? styles.enter : styles.exit, state.root.className);\n return state;\n};\n//# sourceMappingURL=useToastContainerStyles.styles.js.map"],"names":["toastContainerClassNames","useToastContainerStyles_unstable","root","timer","useRootBaseClassName","__resetStyles","useStyles","__styles","enter","vin17d","m1gqa9","Bv12yb3","exit","d","k","state","rootBaseClassName","styles","className","mergeClasses","visible"],"mappings":";;;;;;;;;;;IAGaA,wBAAwB;eAAxBA;;IA0BAC,gCAAgC;eAAhCA;;;uBA7ByC;AAG/C,MAAMD,2BAA2B;IACtCE,MAAM;IACNC,OAAO;AACT;AACA,MAAMC,uBAAuB,WAAW,GAAEC,IAAAA,oBAAa,EAAC,YAAY,MAAM;IAAC;IAAwJ;CAAqG;AACxU;;CAEC,GACD,MAAMC,YAAY,WAAW,GAAEC,IAAAA,eAAQ,EAAC;IACtCC,OAAO;QACLC,QAAQ;QACRC,QAAQ;QACRC,SAAS;IACX;IACAC,MAAM;QACJH,QAAQ;QACRC,QAAQ;QACRC,SAAS;IACX;AACF,GAAG;IACDE,GAAG;QAAC;QAA6C;QAAyC;QAA8C;QAA8C;QAAyC;KAA6C;IAC5QC,GAAG;QAAC;QAAoI;QAAsD;QAAsD;KAAgF;AACtU;AAIO,MAAMb,mCAAmCc,CAAAA;IAC9C,MAAMC,oBAAoBZ;IAC1B,MAAMa,SAASX;IACfS,MAAMb,IAAI,CAACgB,SAAS,GAAGC,IAAAA,mBAAY,EAACnB,yBAAyBE,IAAI,EAAEc,mBAAmBD,MAAMK,OAAO,GAAGH,OAAOT,KAAK,GAAGS,OAAOL,IAAI,EAAEG,MAAMb,IAAI,CAACgB,SAAS;IACtJ,OAAOH;AACT,GACA,0DAA0D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-toast",
3
- "version": "0.0.0-nightly-20240605-0405.1",
3
+ "version": "0.0.0-nightly-20240606-0726.1",
4
4
  "description": "Toast component for Fluent UI",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -29,22 +29,22 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@fluentui/eslint-plugin": "*",
32
- "@fluentui/react-conformance": "0.0.0-nightly-20240605-0405.1",
33
- "@fluentui/react-conformance-griffel": "0.0.0-nightly-20240605-0405.1",
32
+ "@fluentui/react-conformance": "0.0.0-nightly-20240606-0726.1",
33
+ "@fluentui/react-conformance-griffel": "0.0.0-nightly-20240606-0726.1",
34
34
  "@fluentui/scripts-api-extractor": "*",
35
35
  "@fluentui/scripts-tasks": "*"
36
36
  },
37
37
  "dependencies": {
38
- "@fluentui/react-motions-preview": "0.0.0-nightly-20240605-0405.1",
39
- "@fluentui/keyboard-keys": "0.0.0-nightly-20240605-0405.1",
40
- "@fluentui/react-aria": "0.0.0-nightly-20240605-0405.1",
38
+ "react-transition-group": "^4.4.1",
39
+ "@fluentui/keyboard-keys": "0.0.0-nightly-20240606-0726.1",
40
+ "@fluentui/react-aria": "0.0.0-nightly-20240606-0726.1",
41
41
  "@fluentui/react-icons": "^2.0.239",
42
- "@fluentui/react-jsx-runtime": "0.0.0-nightly-20240605-0405.1",
43
- "@fluentui/react-portal": "0.0.0-nightly-20240605-0405.1",
44
- "@fluentui/react-shared-contexts": "0.0.0-nightly-20240605-0405.1",
45
- "@fluentui/react-tabster": "0.0.0-nightly-20240605-0405.1",
46
- "@fluentui/react-theme": "0.0.0-nightly-20240605-0405.1",
47
- "@fluentui/react-utilities": "0.0.0-nightly-20240605-0405.1",
42
+ "@fluentui/react-jsx-runtime": "0.0.0-nightly-20240606-0726.1",
43
+ "@fluentui/react-portal": "0.0.0-nightly-20240606-0726.1",
44
+ "@fluentui/react-shared-contexts": "0.0.0-nightly-20240606-0726.1",
45
+ "@fluentui/react-tabster": "0.0.0-nightly-20240606-0726.1",
46
+ "@fluentui/react-theme": "0.0.0-nightly-20240606-0726.1",
47
+ "@fluentui/react-utilities": "0.0.0-nightly-20240606-0726.1",
48
48
  "@griffel/react": "^1.5.22",
49
49
  "@swc/helpers": "^0.5.1"
50
50
  },
@@ -1,63 +0,0 @@
1
- import { createPresenceComponent } from '@fluentui/react-motions-preview';
2
- export const ToastContainerMotion = createPresenceComponent(({ element })=>({
3
- enter: [
4
- {
5
- keyframes: [
6
- {
7
- marginTop: 0,
8
- minHeight: 0,
9
- maxHeight: 0,
10
- opacity: 0
11
- },
12
- {
13
- marginTop: '16px',
14
- minHeight: 44,
15
- maxHeight: `${element.scrollHeight}px`,
16
- opacity: 0
17
- }
18
- ],
19
- duration: 200
20
- },
21
- {
22
- keyframes: [
23
- {
24
- opacity: 0
25
- },
26
- {
27
- opacity: 1
28
- }
29
- ],
30
- delay: 200,
31
- duration: 400
32
- }
33
- ],
34
- exit: [
35
- {
36
- keyframes: [
37
- {
38
- marginTop: '16px',
39
- minHeight: 44,
40
- maxHeight: `${element.scrollHeight}px`
41
- },
42
- {
43
- marginTop: 0,
44
- minHeight: 0,
45
- maxHeight: 0
46
- }
47
- ],
48
- delay: 400,
49
- duration: 200
50
- },
51
- {
52
- keyframes: [
53
- {
54
- opacity: 1
55
- },
56
- {
57
- opacity: 0
58
- }
59
- ],
60
- duration: 400
61
- }
62
- ]
63
- }));
@@ -1 +0,0 @@
1
- {"version":3,"sources":["ToastContainerMotion.tsx"],"sourcesContent":["import { createPresenceComponent } from '@fluentui/react-motions-preview';\n\nexport const ToastContainerMotion = createPresenceComponent(({ element }) => ({\n enter: [\n {\n keyframes: [\n { marginTop: 0, minHeight: 0, maxHeight: 0, opacity: 0 },\n { marginTop: '16px', minHeight: 44, maxHeight: `${element.scrollHeight}px`, opacity: 0 },\n ],\n duration: 200,\n },\n {\n keyframes: [{ opacity: 0 }, { opacity: 1 }],\n delay: 200,\n duration: 400,\n },\n ],\n\n exit: [\n {\n keyframes: [\n { marginTop: '16px', minHeight: 44, maxHeight: `${element.scrollHeight}px` },\n { marginTop: 0, minHeight: 0, maxHeight: 0 },\n ],\n delay: 400,\n duration: 200,\n },\n {\n keyframes: [{ opacity: 1 }, { opacity: 0 }],\n duration: 400,\n },\n ],\n}));\n"],"names":["createPresenceComponent","ToastContainerMotion","element","enter","keyframes","marginTop","minHeight","maxHeight","opacity","scrollHeight","duration","delay","exit"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,kCAAkC;AAE1E,OAAO,MAAMC,uBAAuBD,wBAAwB,CAAC,EAAEE,OAAO,EAAE,GAAM,CAAA;QAC5EC,OAAO;YACL;gBACEC,WAAW;oBACT;wBAAEC,WAAW;wBAAGC,WAAW;wBAAGC,WAAW;wBAAGC,SAAS;oBAAE;oBACvD;wBAAEH,WAAW;wBAAQC,WAAW;wBAAIC,WAAW,CAAC,EAAEL,QAAQO,YAAY,CAAC,EAAE,CAAC;wBAAED,SAAS;oBAAE;iBACxF;gBACDE,UAAU;YACZ;YACA;gBACEN,WAAW;oBAAC;wBAAEI,SAAS;oBAAE;oBAAG;wBAAEA,SAAS;oBAAE;iBAAE;gBAC3CG,OAAO;gBACPD,UAAU;YACZ;SACD;QAEDE,MAAM;YACJ;gBACER,WAAW;oBACT;wBAAEC,WAAW;wBAAQC,WAAW;wBAAIC,WAAW,CAAC,EAAEL,QAAQO,YAAY,CAAC,EAAE,CAAC;oBAAC;oBAC3E;wBAAEJ,WAAW;wBAAGC,WAAW;wBAAGC,WAAW;oBAAE;iBAC5C;gBACDI,OAAO;gBACPD,UAAU;YACZ;YACA;gBACEN,WAAW;oBAAC;wBAAEI,SAAS;oBAAE;oBAAG;wBAAEA,SAAS;oBAAE;iBAAE;gBAC3CE,UAAU;YACZ;SACD;IACH,CAAA,GAAI"}
@@ -1,73 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "ToastContainerMotion", {
6
- enumerable: true,
7
- get: function() {
8
- return ToastContainerMotion;
9
- }
10
- });
11
- const _reactmotionspreview = require("@fluentui/react-motions-preview");
12
- const ToastContainerMotion = (0, _reactmotionspreview.createPresenceComponent)(({ element })=>({
13
- enter: [
14
- {
15
- keyframes: [
16
- {
17
- marginTop: 0,
18
- minHeight: 0,
19
- maxHeight: 0,
20
- opacity: 0
21
- },
22
- {
23
- marginTop: '16px',
24
- minHeight: 44,
25
- maxHeight: `${element.scrollHeight}px`,
26
- opacity: 0
27
- }
28
- ],
29
- duration: 200
30
- },
31
- {
32
- keyframes: [
33
- {
34
- opacity: 0
35
- },
36
- {
37
- opacity: 1
38
- }
39
- ],
40
- delay: 200,
41
- duration: 400
42
- }
43
- ],
44
- exit: [
45
- {
46
- keyframes: [
47
- {
48
- marginTop: '16px',
49
- minHeight: 44,
50
- maxHeight: `${element.scrollHeight}px`
51
- },
52
- {
53
- marginTop: 0,
54
- minHeight: 0,
55
- maxHeight: 0
56
- }
57
- ],
58
- delay: 400,
59
- duration: 200
60
- },
61
- {
62
- keyframes: [
63
- {
64
- opacity: 1
65
- },
66
- {
67
- opacity: 0
68
- }
69
- ],
70
- duration: 400
71
- }
72
- ]
73
- }));
@@ -1 +0,0 @@
1
- {"version":3,"sources":["ToastContainerMotion.js"],"sourcesContent":["import { createPresenceComponent } from '@fluentui/react-motions-preview';\nexport const ToastContainerMotion = createPresenceComponent(({ element })=>({\n enter: [\n {\n keyframes: [\n {\n marginTop: 0,\n minHeight: 0,\n maxHeight: 0,\n opacity: 0\n },\n {\n marginTop: '16px',\n minHeight: 44,\n maxHeight: `${element.scrollHeight}px`,\n opacity: 0\n }\n ],\n duration: 200\n },\n {\n keyframes: [\n {\n opacity: 0\n },\n {\n opacity: 1\n }\n ],\n delay: 200,\n duration: 400\n }\n ],\n exit: [\n {\n keyframes: [\n {\n marginTop: '16px',\n minHeight: 44,\n maxHeight: `${element.scrollHeight}px`\n },\n {\n marginTop: 0,\n minHeight: 0,\n maxHeight: 0\n }\n ],\n delay: 400,\n duration: 200\n },\n {\n keyframes: [\n {\n opacity: 1\n },\n {\n opacity: 0\n }\n ],\n duration: 400\n }\n ]\n }));\n"],"names":["ToastContainerMotion","createPresenceComponent","element","enter","keyframes","marginTop","minHeight","maxHeight","opacity","scrollHeight","duration","delay","exit"],"mappings":";;;;+BACaA;;;eAAAA;;;qCAD2B;AACjC,MAAMA,uBAAuBC,IAAAA,4CAAuB,EAAC,CAAC,EAAEC,OAAO,EAAE,GAAI,CAAA;QACpEC,OAAO;YACH;gBACIC,WAAW;oBACP;wBACIC,WAAW;wBACXC,WAAW;wBACXC,WAAW;wBACXC,SAAS;oBACb;oBACA;wBACIH,WAAW;wBACXC,WAAW;wBACXC,WAAW,CAAC,EAAEL,QAAQO,YAAY,CAAC,EAAE,CAAC;wBACtCD,SAAS;oBACb;iBACH;gBACDE,UAAU;YACd;YACA;gBACIN,WAAW;oBACP;wBACII,SAAS;oBACb;oBACA;wBACIA,SAAS;oBACb;iBACH;gBACDG,OAAO;gBACPD,UAAU;YACd;SACH;QACDE,MAAM;YACF;gBACIR,WAAW;oBACP;wBACIC,WAAW;wBACXC,WAAW;wBACXC,WAAW,CAAC,EAAEL,QAAQO,YAAY,CAAC,EAAE,CAAC;oBAC1C;oBACA;wBACIJ,WAAW;wBACXC,WAAW;wBACXC,WAAW;oBACf;iBACH;gBACDI,OAAO;gBACPD,UAAU;YACd;YACA;gBACIN,WAAW;oBACP;wBACII,SAAS;oBACb;oBACA;wBACIA,SAAS;oBACb;iBACH;gBACDE,UAAU;YACd;SACH;IACL,CAAA"}