@radix-ui/react-toast 0.1.2-rc.46 → 0.1.2-rc.49

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.
@@ -1 +1 @@
1
- {"mappings":";;;;AAuBA,sBAAsB,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAgBvD,OAAA,uFAA0E,CAAC;AAI3E;IACE,QAAQ,CAAC,EAAE,MAAM,SAAS,CAAC;IAC3B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,OAAA,MAAM,eAAe,MAAM,EAAE,CAAC,kBAAkB,CA+B/C,CAAC;AAcF,iCAAiC,MAAM,wBAAwB,CAAC,OAAO,UAAU,EAAE,CAAC,CAAC;AACrF,mCAA6B,SAAQ,yBAAyB;IAC5D;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,OAAA,MAAM,0GA2GL,CAAC;AAcF,oBAAoB,gBAAgB,CAAC;AACrC,2BAAqB,SAAQ,IAAI,CAAC,cAAc,EAAE,MAAM,qBAAqB,CAAC;IAC5E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IACnC;;;OAGG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC;CACnB;AAED,OAAA,MAAM,uFA4CL,CAAC;AAMF,kBAAkB;IAAE,aAAa,EAAE,WAAW,GAAG,YAAY,CAAA;CAAE,GAAG,IAAI,CACpE,WAAW,CAAC;IAAE,aAAa,EAAE,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AO,UAAU,MAAM,CAAC,CAAC;AACpF,gCAA0B,SAAQ,oBAAoB;CAAG;AAEzD,OAAA,MAAM,qGAaL,CAAC;AAsDF,OAAA,MAAM,sCAAwB,CAAC;AAC/B,OAAA,MAAM,qGAAwB,CAAC;AAC/B,OAAA,MAAM,sFAAY,CAAC;AACnB,OAAA,MAAM,6FAAkB,CAAC;AACzB,OAAA,MAAM,yGAA8B,CAAC;AACrC,OAAA,MAAM,kGAAoB,CAAC;AAC3B,OAAA,MAAM,gGAAkB,CAAC","sources":["packages/react/toast/src/packages/react/toast/src/Toast.tsx","packages/react/toast/src/packages/react/toast/src/index.ts","packages/react/toast/src/index.ts"],"sourcesContent":[null,null,"export * from './Toast';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
1
+ {"mappings":";;;;AAuBA,sBAAsB,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAgBvD,OAAA,uFAA0E,CAAC;AAI3E;IACE,QAAQ,CAAC,EAAE,MAAM,SAAS,CAAC;IAC3B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,OAAA,MAAM,eAAe,MAAM,EAAE,CAAC,kBAAkB,CA+B/C,CAAC;AAwBF,iCAAiC,MAAM,wBAAwB,CAAC,OAAO,UAAU,EAAE,CAAC,CAAC;AACrF,mCAA6B,SAAQ,yBAAyB;IAC5D;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,OAAA,MAAM,0GA2GL,CAAC;AAcF,oBAAoB,gBAAgB,CAAC;AACrC,2BAAqB,SAAQ,IAAI,CAAC,cAAc,EAAE,MAAM,qBAAq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,MAAM,wBAAwB,CAAC,OAAO,UAAU,GAAG,CAAC,CAAC;AAC9E,gCAA0B,SAAQ,iBAAiB;CAAG;AAEtD,OAAA,MAAM,kGAKL,CAAC;AAWF,sCAAgC,SAAQ,iBAAiB;CAAG;AAE5D,OAAA,MAAM,8GAKL,CAAC;AAWF,iCAA2B,SAAQ,eAAe;IAChD;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,OAAA,MAAM,uGAWL,CAAC;AAoBF,4BAA4B,MAAM,wBAAwB,CAAC,OAAO,UAAU,MAAM,CAAC,CAAC;AACpF,gCAA0B,SAAQ,oBAAoB;CAAG;AAEzD,OAAA,MAAM,qGAaL,CAAC;AAsDF,OAAA,MAAM,sCAAwB,CAAC;AAC/B,OAAA,MAAM,qGAAwB,CAAC;AAC/B,OAAA,MAAM,sFAAY,CAAC;AACnB,OAAA,MAAM,6FAAkB,CAAC;AACzB,OAAA,MAAM,yGAA8B,CAAC;AACrC,OAAA,MAAM,kGAAoB,CAAC;AAC3B,OAAA,MAAM,gGAAkB,CAAC","sources":["packages/react/toast/src/packages/react/toast/src/Toast.tsx","packages/react/toast/src/packages/react/toast/src/index.ts","packages/react/toast/src/index.ts"],"sourcesContent":[null,null,"export * from './Toast';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
package/dist/index.js CHANGED
@@ -5,9 +5,9 @@ var $iTyic$radixuiprimitive = require("@radix-ui/primitive");
5
5
  var $iTyic$radixuireactcomposerefs = require("@radix-ui/react-compose-refs");
6
6
  var $iTyic$radixuireactcontext = require("@radix-ui/react-context");
7
7
  var $iTyic$radixuireactdismissablelayer = require("@radix-ui/react-dismissable-layer");
8
- var $iTyic$radixuireactportal = require("@radix-ui/react-portal");
9
8
  var $iTyic$radixuireactpresence = require("@radix-ui/react-presence");
10
9
  var $iTyic$radixuireactprimitive = require("@radix-ui/react-primitive");
10
+ var $iTyic$radixuireactslot = require("@radix-ui/react-slot");
11
11
  var $iTyic$radixuireactusecallbackref = require("@radix-ui/react-use-callback-ref");
12
12
  var $iTyic$radixuireactusecontrollablestate = require("@radix-ui/react-use-controllable-state");
13
13
  var $iTyic$radixuireactuselayouteffect = require("@radix-ui/react-use-layout-effect");
@@ -96,6 +96,15 @@ const $9208a85b3e79d33f$export$f5d03d415824e0e = (props)=>{
96
96
  isClosePausedRef: isClosePausedRef
97
97
  }, children);
98
98
  };
99
+ $9208a85b3e79d33f$export$f5d03d415824e0e.propTypes = {
100
+ label (props) {
101
+ if (props.label && typeof props.label === 'string' && !props.label.trim()) {
102
+ const error = `Invalid prop \`label\` supplied to \`${$9208a85b3e79d33f$var$PROVIDER_NAME}\`. Expected non-empty \`string\`.`;
103
+ return new Error(error);
104
+ }
105
+ return null;
106
+ }
107
+ };
99
108
  /*#__PURE__*/ Object.assign($9208a85b3e79d33f$export$f5d03d415824e0e, {
100
109
  displayName: $9208a85b3e79d33f$var$PROVIDER_NAME
101
110
  });
@@ -264,7 +273,7 @@ const $9208a85b3e79d33f$export$8d8dc7d5f743331b = /*#__PURE__*/ $iTyic$react.for
264
273
  onClose () {}
265
274
  });
266
275
  const $9208a85b3e79d33f$var$ToastImpl = /*#__PURE__*/ $iTyic$react.forwardRef((props, forwardedRef)=>{
267
- const { __scopeToast: __scopeToast , type: type = 'foreground' , duration: durationProp , open: open , onClose: onClose , onEscapeKeyDown: onEscapeKeyDown , onSwipeStart: onSwipeStart , onSwipeMove: onSwipeMove , onSwipeCancel: onSwipeCancel , onSwipeEnd: onSwipeEnd , ...toastProps } = props;
276
+ const { __scopeToast: __scopeToast , children: children , type: type = 'foreground' , duration: durationProp , open: open , onClose: onClose , onEscapeKeyDown: onEscapeKeyDown , onSwipeStart: onSwipeStart , onSwipeMove: onSwipeMove , onSwipeCancel: onSwipeCancel , onSwipeEnd: onSwipeEnd , ...toastProps } = props;
268
277
  const context = $9208a85b3e79d33f$var$useToastProviderContext($9208a85b3e79d33f$var$TOAST_NAME, __scopeToast);
269
278
  const ref = $iTyic$react.useRef(null);
270
279
  const composedRefs = $iTyic$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref);
@@ -274,6 +283,7 @@ const $9208a85b3e79d33f$var$ToastImpl = /*#__PURE__*/ $iTyic$react.forwardRef((p
274
283
  const closeTimerStartTimeRef = $iTyic$react.useRef(0);
275
284
  const closeTimerRemainingTimeRef = $iTyic$react.useRef(duration1);
276
285
  const closeTimerRef = $iTyic$react.useRef(0);
286
+ const [renderLabel, setRenderLabel] = $iTyic$react.useState(false);
277
287
  const { onToastAdd: onToastAdd , onToastRemove: onToastRemove } = context;
278
288
  const handleClose = $iTyic$radixuireactusecallbackref.useCallbackRef(()=>{
279
289
  var _ref$current2, _context$viewport;
@@ -331,15 +341,11 @@ const $9208a85b3e79d33f$var$ToastImpl = /*#__PURE__*/ $iTyic$react.forwardRef((p
331
341
  }, [
332
342
  onToastAdd,
333
343
  onToastRemove
334
- ]);
344
+ ]); // render label in the next frame to trigger toast announcement in NVDA
345
+ $9208a85b3e79d33f$var$useNextFrame(()=>setRenderLabel(true)
346
+ );
335
347
  if (!context.viewport) return null;
336
- return /*#__PURE__*/ $iTyic$react.createElement($iTyic$react.Fragment, null, /*#__PURE__*/ $iTyic$react.createElement($9208a85b3e79d33f$var$ToastAnnounce, {
337
- __scopeToast: __scopeToast // Toasts are always role=status to avoid stuttering issues with role=alert in SRs.
338
- ,
339
- role: "status",
340
- "aria-live": type === 'foreground' ? 'assertive' : 'polite',
341
- "aria-atomic": true
342
- }, props.children), /*#__PURE__*/ $iTyic$react.createElement($9208a85b3e79d33f$var$ToastInteractiveProvider, {
348
+ return /*#__PURE__*/ $iTyic$react.createElement($iTyic$react.Fragment, null, /*#__PURE__*/ $iTyic$react.createElement($9208a85b3e79d33f$var$ToastInteractiveProvider, {
343
349
  scope: __scopeToast,
344
350
  isInteractive: true,
345
351
  onClose: handleClose
@@ -351,8 +357,10 @@ const $9208a85b3e79d33f$var$ToastImpl = /*#__PURE__*/ $iTyic$react.forwardRef((p
351
357
  })
352
358
  }, /*#__PURE__*/ $iTyic$react.createElement($iTyic$radixuireactprimitive.Primitive.li, ($parcel$interopDefault($iTyic$babelruntimehelpersextends))({
353
359
  role: "status",
354
- "aria-live": "off",
355
- "aria-atomic": true,
360
+ "aria-live": type === 'foreground' ? 'assertive' : 'polite',
361
+ "aria-atomic": true // Prevent voice over from announcing before the label is rendered
362
+ ,
363
+ "aria-hidden": !renderLabel || undefined,
356
364
  tabIndex: 0,
357
365
  "data-state": open ? 'open' : 'closed',
358
366
  "data-swipe-direction": context.swipeDirection
@@ -442,7 +450,7 @@ const $9208a85b3e79d33f$var$ToastImpl = /*#__PURE__*/ $iTyic$react.forwardRef((p
442
450
  });
443
451
  }
444
452
  })
445
- }))), context.viewport)));
453
+ }), /*#__PURE__*/ $iTyic$react.createElement($iTyic$radixuireactvisuallyhidden.VisuallyHidden, null, renderLabel && context.label), /*#__PURE__*/ $iTyic$react.createElement($iTyic$radixuireactslot.Slottable, null, children))), context.viewport)));
446
454
  });
447
455
  $9208a85b3e79d33f$var$ToastImpl.propTypes = {
448
456
  type (props) {
@@ -451,30 +459,11 @@ $9208a85b3e79d33f$var$ToastImpl.propTypes = {
451
459
  'background'
452
460
  ].includes(props.type)) {
453
461
  const error = `Invalid prop \`type\` supplied to \`${$9208a85b3e79d33f$var$TOAST_NAME}\`. Expected \`foreground | background\`.`;
454
- throw new Error(error);
462
+ return new Error(error);
455
463
  }
456
464
  return null;
457
465
  }
458
466
  };
459
- /* -----------------------------------------------------------------------------------------------*/ const $9208a85b3e79d33f$var$ToastAnnounce = (props)=>{
460
- const { __scopeToast: __scopeToast , ...announceProps } = props;
461
- const context = $9208a85b3e79d33f$var$useToastProviderContext($9208a85b3e79d33f$var$TOAST_NAME, __scopeToast);
462
- const [renderChildren, setRenderChildren] = $iTyic$react.useState(false);
463
- const [isAnnounced, setIsAnnounced] = $iTyic$react.useState(false); // render children in the next frame to ensure toast is announced in NVDA
464
- $9208a85b3e79d33f$var$useNextFrame(()=>setRenderChildren(true)
465
- );
466
- $iTyic$react.useEffect(()=>{
467
- const timer = window.setTimeout(()=>setIsAnnounced(true)
468
- , 1000);
469
- return ()=>window.clearTimeout(timer)
470
- ;
471
- }, []);
472
- return isAnnounced ? null : /*#__PURE__*/ $iTyic$react.createElement($iTyic$radixuireactportal.UnstablePortal, {
473
- asChild: true
474
- }, /*#__PURE__*/ $iTyic$react.createElement($iTyic$radixuireactvisuallyhidden.VisuallyHidden, {
475
- asChild: true
476
- }, /*#__PURE__*/ $iTyic$react.createElement("div", announceProps, renderChildren && /*#__PURE__*/ $iTyic$react.createElement($iTyic$react.Fragment, null, context.label, " ", props.children))));
477
- };
478
467
  /* -------------------------------------------------------------------------------------------------
479
468
  * ToastTitle
480
469
  * -----------------------------------------------------------------------------------------------*/ const $9208a85b3e79d33f$var$TITLE_NAME = 'ToastTitle';
@@ -512,7 +501,7 @@ const $9208a85b3e79d33f$export$3019feecfda683d2 = /*#__PURE__*/ $iTyic$react.for
512
501
  });
513
502
  $9208a85b3e79d33f$export$3019feecfda683d2.propTypes = {
514
503
  altText (props) {
515
- if (!props.altText) throw new Error(`Missing prop \`altText\` expected on \`${$9208a85b3e79d33f$var$ACTION_NAME}\``);
504
+ if (!props.altText) return new Error(`Missing prop \`altText\` expected on \`${$9208a85b3e79d33f$var$ACTION_NAME}\``);
516
505
  return null;
517
506
  }
518
507
  };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A;;;;;;;;;;;;;;ACiBA;;oGAEA,CAEA,MAAMc,mCAAa,GAAG,eAAtB,AAAA;AAkBA,MAAM,CAACC,wCAAD,EAAqBC,yCAArB,CAAA,GAAyCZ,6CAAkB,CAAC,OAAD,CAAjE,AAAA;AACA,MAAM,CAACa,2CAAD,EAAwBC,6CAAxB,CAAA,GACJH,wCAAkB,CAA4BD,mCAA5B,CADpB,AAAA;AA4BA,MAAMK,wCAA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AAO,CAACG,QAAD,IAAaD,MAAM,GAAGF,SAA7B,CAAA;CAXJ,AAaC;AAED,SAAStB,kCAAT,CAAsB0B,QAAQ,GAAG,IAAM,EAAvC,EAA2C;IACzC,MAAMC,EAAE,GAAGzN,gDAAc,CAACwN,QAAD,CAAzB,AAAA;IACAtN,kDAAe,CAAC,IAAM;QACpB,IAAIwN,IAAI,GAAG,CAAX,AAAA;QACA,IAAIC,IAAI,GAAG,CAAX,AAAA;QACAD,IAAI,GAAG3J,MAAM,CAAC6J,qBAAP,CAA6B,IAAOD,IAAI,GAAG5J,MAAM,CAAC6J,qBAAP,CAA6BH,EAA7B,CAA3C;QAAA,CAAP,CAAAC;QACA,OAAO,IAAM;YACX3J,MAAM,CAAC8J,oBAAP,CAA4BH,IAA5B,CAAA3J,CAAAA;YACAA,MAAM,CAAC8J,oBAAP,CAA4BF,IAA5B,CAAA5J,CAAAA;SAFF,CAGC;KAPY,EAQZ;QAAC0J,EAAD;KARY,CAAf,CAQC;CACF;AAED,MAAMK,yCAAQ,GAAGrN,wCAAjB,AAAA;AACA,MAAMsN,wCAAQ,GAAGhM,yCAAjB,AAAA;AACA,MAAMiM,yCAAI,GAAGlI,yCAAb,AAAA;AACA,MAAMmI,yCAAK,GAAGhC,wCAAd,AAAA;AACA,MAAMiC,yCAAW,GAAG9B,yCAApB,AAAA;AACA,MAAM+B,yCAAM,GAAG5B,yCAAf,AAAA;AACA,MAAM6B,yCAAK,GAAGzB,yCAAd,AAAA;;AD1tBA","sources":["packages/react/toast/src/index.ts","packages/react/toast/src/Toast.tsx"],"sourcesContent":["export * from './Toast';\n","import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport * as DismissableLayer from '@radix-ui/react-dismissable-layer';\nimport { UnstablePortal } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive, dispatchDiscreteCustomEvent } from '@radix-ui/react-primitive';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { VisuallyHidden } from '@radix-ui/react-visually-hidden';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * ToastProvider\n * -----------------------------------------------------------------------------------------------*/\n\nconst PROVIDER_NAME = 'ToastProvider';\n\ntype SwipeDirection = 'up' | 'down' | 'left' | 'right';\ntype ToastProviderContextValue = {\n label: string;\n duration: number;\n swipeDirection: SwipeDirection;\n swipeThreshold: number;\n toastCount: number;\n viewport: ToastViewportElement | null;\n onViewportChange(viewport: ToastViewportElement): void;\n onToastAdd(): void;\n onToastRemove(): void;\n isFocusedToastEscapeKeyDownRef: React.MutableRefObject<boolean>;\n isClosePausedRef: React.MutableRefObject<boolean>;\n};\n\ntype ScopedProps<P> = P & { __scopeToast?: Scope };\nconst [createToastContext, createToastScope] = createContextScope('Toast');\nconst [ToastProviderProvider, useToastProviderContext] =\n createToastContext<ToastProviderContextValue>(PROVIDER_NAME);\n\ninterface ToastProviderProps {\n children?: React.ReactNode;\n /**\n * An author-localized label for each toast. Used to help screen reader users\n * associate the interruption with a toast.\n * @defaultValue 'Notification'\n */\n label?: string;\n /**\n * Time in milliseconds that each toast should remain visible for.\n * @defaultValue 5000\n */\n duration?: number;\n /**\n * Direction of pointer swipe that should close the toast.\n * @defaultValue 'right'\n */\n swipeDirection?: SwipeDirection;\n /**\n * Distance in pixels that the swipe must pass before a close is triggered.\n * @defaultValue 50\n */\n swipeThreshold?: number;\n}\n\nconst ToastProvider: React.FC<ToastProviderProps> = (props: ScopedProps<ToastProviderProps>) => {\n const {\n __scopeToast,\n label = 'Notification',\n duration = 5000,\n swipeDirection = 'right',\n swipeThreshold = 50,\n children,\n } = props;\n const [viewport, setViewport] = React.useState<ToastViewportElement | null>(null);\n const [toastCount, setToastCount] = React.useState(0);\n const isFocusedToastEscapeKeyDownRef = React.useRef(false);\n const isClosePausedRef = React.useRef(false);\n return (\n <ToastProviderProvider\n scope={__scopeToast}\n label={label}\n duration={duration}\n swipeDirection={swipeDirection}\n swipeThreshold={swipeThreshold}\n toastCount={toastCount}\n viewport={viewport}\n onViewportChange={setViewport}\n onToastAdd={React.useCallback(() => setToastCount((prevCount) => prevCount + 1), [])}\n onToastRemove={React.useCallback(() => setToastCount((prevCount) => prevCount - 1), [])}\n isFocusedToastEscapeKeyDownRef={isFocusedToastEscapeKeyDownRef}\n isClosePausedRef={isClosePausedRef}\n >\n {children}\n </ToastProviderProvider>\n );\n};\n\nToastProvider.displayName = PROVIDER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToastViewport\n * -----------------------------------------------------------------------------------------------*/\n\nconst VIEWPORT_NAME = 'ToastViewport';\nconst VIEWPORT_DEFAULT_HOTKEY = ['F8'];\nconst VIEWPORT_PAUSE = 'toast.viewportPause';\nconst VIEWPORT_RESUME = 'toast.viewportResume';\n\ntype ToastViewportElement = React.ElementRef<typeof Primitive.ol>;\ntype PrimitiveOrderedListProps = Radix.ComponentPropsWithoutRef<typeof Primitive.ol>;\ninterface ToastViewportProps extends PrimitiveOrderedListProps {\n /**\n * The keys to use as the keyboard shortcut that will move focus to the toast viewport.\n * @defaultValue ['F8']\n */\n hotkey?: string[];\n /**\n * An author-localized label for the toast viewport to provide context for screen reader users\n * when navigating page landmarks. The available `{hotkey}` placeholder will be replaced for you.\n * @defaultValue 'Notifications ({hotkey})'\n */\n label?: string;\n}\n\nconst ToastViewport = React.forwardRef<ToastViewportElement, ToastViewportProps>(\n (props: ScopedProps<ToastViewportProps>, forwardedRef) => {\n const {\n __scopeToast,\n hotkey = VIEWPORT_DEFAULT_HOTKEY,\n label = 'Notifications ({hotkey})',\n ...viewportProps\n } = props;\n const context = useToastProviderContext(VIEWPORT_NAME, __scopeToast);\n const wrapperRef = React.useRef<HTMLDivElement>(null);\n const ref = React.useRef<ToastViewportElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref, context.onViewportChange);\n const hotkeyLabel = hotkey.join('+').replace(/Key/g, '').replace(/Digit/g, '');\n\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n // we use `event.code` as it is consistent regardless of meta keys that were pressed.\n // for example, `event.key` for `Control+Alt+t` is `†` and `t !== †`\n const isHotkeyPressed = hotkey.every((key) => (event as any)[key] || event.code === key);\n if (isHotkeyPressed) ref.current?.focus();\n };\n document.addEventListener('keydown', handleKeyDown);\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [hotkey]);\n\n React.useEffect(() => {\n const wrapper = wrapperRef.current;\n const viewport = ref.current;\n if (wrapper && viewport) {\n const handlePause = () => {\n const pauseEvent = new CustomEvent(VIEWPORT_PAUSE);\n viewport.dispatchEvent(pauseEvent);\n context.isClosePausedRef.current = true;\n };\n\n const handleResume = () => {\n const resumeEvent = new CustomEvent(VIEWPORT_RESUME);\n viewport.dispatchEvent(resumeEvent);\n context.isClosePausedRef.current = false;\n };\n\n // Toasts are not in the viewport React tree so we need to bind DOM events\n wrapper.addEventListener('focusin', handlePause);\n wrapper.addEventListener('focusout', handleResume);\n wrapper.addEventListener('pointerenter', handlePause);\n wrapper.addEventListener('pointerleave', handleResume);\n window.addEventListener('blur', handlePause);\n window.addEventListener('focus', handleResume);\n return () => {\n wrapper.removeEventListener('focusin', handlePause);\n wrapper.removeEventListener('focusout', handleResume);\n wrapper.removeEventListener('pointerenter', handlePause);\n wrapper.removeEventListener('pointerleave', handleResume);\n window.removeEventListener('blur', handlePause);\n window.removeEventListener('focus', handleResume);\n };\n }\n }, [context.isClosePausedRef]);\n\n React.useEffect(() => {\n const viewport = ref.current;\n // Re-order DOM so most recent toasts are at top of DOM structure to improve tab order\n if (viewport) {\n const prepended: Set<Node> = new Set();\n const observer = new MutationObserver((mutations) => {\n const addedNodes = mutations\n .map((mutation) => Array.from(mutation.addedNodes))\n .reduce((a, b) => a.concat(b));\n\n addedNodes.forEach((node) => {\n // mutation will immediately fire again when we prepend so we only prepend if\n // it hasn't just prepended.\n if (!prepended.has(node)) {\n viewport.prepend(node);\n prepended.add(node);\n } else {\n // this else catches the case where the mutation fires immediately after prepend.\n // we remove from cache after it prepends to allow observer to catch future updates\n // to DOM order, e.g. if `key` changes for a toast and is reportalled to bottom.\n prepended.delete(node);\n }\n });\n });\n observer.observe(viewport, { childList: true });\n return () => observer.disconnect();\n }\n }, []);\n\n return (\n <DismissableLayer.Branch\n ref={wrapperRef}\n role=\"region\"\n aria-label={label.replace('{hotkey}', hotkeyLabel)}\n // Ensure virtual cursor from landmarks menus triggers focus/blur for pause/resume\n tabIndex={-1}\n // incase list has size when empty (e.g. padding), we remove pointer events so\n // it doesn't prevent interactions with page elements that it overlays\n style={{ pointerEvents: context.toastCount > 0 ? undefined : 'none' }}\n >\n {/**\n * tabindex on the the list so that it can be focused when items are removed. we focus\n * the list instead of the viewport so it announces number of items remaining.\n */}\n <Primitive.ol tabIndex={-1} {...viewportProps} ref={composedRefs} />\n </DismissableLayer.Branch>\n );\n }\n);\n\nToastViewport.displayName = VIEWPORT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * Toast\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOAST_NAME = 'Toast';\nconst TOAST_SWIPE_START = 'toast.swipeStart';\nconst TOAST_SWIPE_MOVE = 'toast.swipeMove';\nconst TOAST_SWIPE_CANCEL = 'toast.swipeCancel';\nconst TOAST_SWIPE_END = 'toast.swipeEnd';\n\ntype ToastElement = ToastImplElement;\ninterface ToastProps extends Omit<ToastImplProps, keyof ToastImplPrivateProps> {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst Toast = React.forwardRef<ToastElement, ToastProps>(\n (props: ScopedProps<ToastProps>, forwardedRef) => {\n const { forceMount, open: openProp, defaultOpen, onOpenChange, ...toastProps } = props;\n const [open = true, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n return (\n <Presence present={forceMount || open}>\n <ToastImpl\n open={open}\n {...toastProps}\n ref={forwardedRef}\n onClose={() => setOpen(false)}\n onSwipeStart={composeEventHandlers(props.onSwipeStart, (event) => {\n event.currentTarget.setAttribute('data-swipe', 'start');\n })}\n onSwipeMove={composeEventHandlers(props.onSwipeMove, (event) => {\n const { x, y } = event.detail.delta;\n event.currentTarget.setAttribute('data-swipe', 'move');\n event.currentTarget.style.setProperty('--radix-toast-swipe-move-x', `${x}px`);\n event.currentTarget.style.setProperty('--radix-toast-swipe-move-y', `${y}px`);\n })}\n onSwipeCancel={composeEventHandlers(props.onSwipeCancel, (event) => {\n event.currentTarget.setAttribute('data-swipe', 'cancel');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-move-x');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-move-y');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-end-x');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-end-y');\n })}\n onSwipeEnd={composeEventHandlers(props.onSwipeEnd, (event) => {\n const { x, y } = event.detail.delta;\n event.currentTarget.setAttribute('data-swipe', 'end');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-move-x');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-move-y');\n event.currentTarget.style.setProperty('--radix-toast-swipe-end-x', `${x}px`);\n event.currentTarget.style.setProperty('--radix-toast-swipe-end-y', `${y}px`);\n setOpen(false);\n })}\n />\n </Presence>\n );\n }\n);\n\nToast.displayName = TOAST_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype SwipeEvent = { currentTarget: EventTarget & ToastElement } & Omit<\n CustomEvent<{ originalEvent: React.PointerEvent; delta: { x: number; y: number } }>,\n 'currentTarget'\n>;\n\nconst [ToastInteractiveProvider, useToastInteractiveContext] = createToastContext(TOAST_NAME, {\n isInteractive: false,\n onClose() {},\n});\n\ntype ToastImplElement = React.ElementRef<typeof Primitive.li>;\ntype DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer.Root>;\ntype ToastImplPrivateProps = { open: boolean; onClose(): void };\ntype PrimitiveListItemProps = Radix.ComponentPropsWithoutRef<typeof Primitive.li>;\ninterface ToastImplProps extends ToastImplPrivateProps, PrimitiveListItemProps {\n type?: 'foreground' | 'background';\n /**\n * Time in milliseconds that toast should remain visible for. Overrides value\n * given to `ToastProvider`.\n */\n duration?: number;\n onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];\n onSwipeStart?(event: SwipeEvent): void;\n onSwipeMove?(event: SwipeEvent): void;\n onSwipeCancel?(event: SwipeEvent): void;\n onSwipeEnd?(event: SwipeEvent): void;\n}\n\nconst ToastImpl = React.forwardRef<ToastImplElement, ToastImplProps>(\n (props: ScopedProps<ToastImplProps>, forwardedRef) => {\n const {\n __scopeToast,\n type = 'foreground',\n duration: durationProp,\n open,\n onClose,\n onEscapeKeyDown,\n onSwipeStart,\n onSwipeMove,\n onSwipeCancel,\n onSwipeEnd,\n ...toastProps\n } = props;\n const context = useToastProviderContext(TOAST_NAME, __scopeToast);\n const ref = React.useRef<ToastImplElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const pointerStartRef = React.useRef<{ x: number; y: number } | null>(null);\n const swipeDeltaRef = React.useRef<{ x: number; y: number } | null>(null);\n const duration = durationProp || context.duration;\n const closeTimerStartTimeRef = React.useRef(0);\n const closeTimerRemainingTimeRef = React.useRef(duration);\n const closeTimerRef = React.useRef(0);\n const { onToastAdd, onToastRemove } = context;\n const handleClose = useCallbackRef(() => {\n // focus viewport if focus is within toast to read the remaining toast\n // count to SR users and ensure focus isn't lost\n const isFocusInToast = ref.current?.contains(document.activeElement);\n if (isFocusInToast) context.viewport?.focus();\n onClose();\n });\n\n const startTimer = React.useCallback(\n (duration: number) => {\n if (!duration || duration === Infinity) return;\n window.clearTimeout(closeTimerRef.current);\n closeTimerStartTimeRef.current = new Date().getTime();\n closeTimerRef.current = window.setTimeout(handleClose, duration);\n },\n [handleClose]\n );\n\n React.useEffect(() => {\n const viewport = context.viewport;\n if (viewport) {\n const handleResume = () => {\n startTimer(closeTimerRemainingTimeRef.current);\n };\n const handlePause = () => {\n const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.current;\n closeTimerRemainingTimeRef.current = closeTimerRemainingTimeRef.current - elapsedTime;\n window.clearTimeout(closeTimerRef.current);\n };\n viewport.addEventListener(VIEWPORT_PAUSE, handlePause);\n viewport.addEventListener(VIEWPORT_RESUME, handleResume);\n return () => {\n viewport.removeEventListener(VIEWPORT_PAUSE, handlePause);\n viewport.removeEventListener(VIEWPORT_RESUME, handleResume);\n };\n }\n }, [context.viewport, duration, startTimer]);\n\n // start timer when toast opens or duration changes.\n // we include `open` in deps because closed !== unmounted when animating\n // so it could reopen before being completely unmounted\n React.useEffect(() => {\n if (open && !context.isClosePausedRef.current) startTimer(duration);\n }, [open, duration, context.isClosePausedRef, startTimer]);\n\n React.useEffect(() => {\n onToastAdd();\n return () => onToastRemove();\n }, [onToastAdd, onToastRemove]);\n\n if (!context.viewport) return null;\n\n return (\n <>\n <ToastAnnounce\n __scopeToast={__scopeToast}\n // Toasts are always role=status to avoid stuttering issues with role=alert in SRs.\n role=\"status\"\n aria-live={type === 'foreground' ? 'assertive' : 'polite'}\n aria-atomic\n >\n {props.children}\n </ToastAnnounce>\n\n <ToastInteractiveProvider scope={__scopeToast} isInteractive onClose={handleClose}>\n {ReactDOM.createPortal(\n <DismissableLayer.Root\n asChild\n onEscapeKeyDown={composeEventHandlers(onEscapeKeyDown, () => {\n if (!context.isFocusedToastEscapeKeyDownRef.current) handleClose();\n context.isFocusedToastEscapeKeyDownRef.current = false;\n })}\n >\n <Primitive.li\n role=\"status\"\n aria-live=\"off\"\n aria-atomic\n tabIndex={0}\n data-state={open ? 'open' : 'closed'}\n data-swipe-direction={context.swipeDirection}\n {...toastProps}\n ref={composedRefs}\n style={{ userSelect: 'none', touchAction: 'none', ...props.style }}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key !== 'Escape') return;\n onEscapeKeyDown?.(event.nativeEvent);\n if (!event.nativeEvent.defaultPrevented) {\n context.isFocusedToastEscapeKeyDownRef.current = true;\n handleClose();\n }\n })}\n onPointerDown={composeEventHandlers(props.onPointerDown, (event) => {\n if (event.button !== 0) return;\n pointerStartRef.current = { x: event.clientX, y: event.clientY };\n })}\n onPointerMove={composeEventHandlers(props.onPointerMove, (event) => {\n if (!pointerStartRef.current) return;\n const x = event.clientX - pointerStartRef.current.x;\n const y = event.clientY - pointerStartRef.current.y;\n const hasSwipeMoveStarted = Boolean(swipeDeltaRef.current);\n const isHorizontalSwipe = ['left', 'right'].includes(context.swipeDirection);\n const clamp = ['left', 'up'].includes(context.swipeDirection)\n ? Math.min\n : Math.max;\n const clampedX = isHorizontalSwipe ? clamp(0, x) : 0;\n const clampedY = !isHorizontalSwipe ? clamp(0, y) : 0;\n const moveStartBuffer = event.pointerType === 'touch' ? 10 : 2;\n const delta = { x: clampedX, y: clampedY };\n const eventDetail = { originalEvent: event, delta };\n if (hasSwipeMoveStarted) {\n swipeDeltaRef.current = delta;\n handleAndDispatchCustomEvent(TOAST_SWIPE_MOVE, onSwipeMove, eventDetail, {\n discrete: false,\n });\n } else if (isDeltaInDirection(delta, context.swipeDirection, moveStartBuffer)) {\n swipeDeltaRef.current = delta;\n handleAndDispatchCustomEvent(TOAST_SWIPE_START, onSwipeStart, eventDetail, {\n discrete: false,\n });\n (event.target as HTMLElement).setPointerCapture(event.pointerId);\n } else if (Math.abs(x) > moveStartBuffer || Math.abs(y) > moveStartBuffer) {\n // User is swiping in wrong direction so we disable swipe gesture\n // for the current pointer down interaction\n pointerStartRef.current = null;\n }\n })}\n onPointerUp={composeEventHandlers(props.onPointerUp, (event) => {\n const delta = swipeDeltaRef.current;\n (event.target as HTMLElement).releasePointerCapture(event.pointerId);\n swipeDeltaRef.current = null;\n pointerStartRef.current = null;\n if (delta) {\n const toast = event.currentTarget;\n const eventDetail = { originalEvent: event, delta };\n if (isDeltaInDirection(delta, context.swipeDirection, context.swipeThreshold)) {\n handleAndDispatchCustomEvent(TOAST_SWIPE_END, onSwipeEnd, eventDetail, {\n discrete: true,\n });\n } else {\n handleAndDispatchCustomEvent(TOAST_SWIPE_CANCEL, onSwipeCancel, eventDetail, {\n discrete: true,\n });\n }\n // Prevent click event from triggering on items within the toast when\n // pointer up is part of a swipe gesture\n toast.addEventListener('click', (event) => event.preventDefault(), {\n once: true,\n });\n }\n })}\n />\n </DismissableLayer.Root>,\n context.viewport\n )}\n </ToastInteractiveProvider>\n </>\n );\n }\n);\n\nToastImpl.propTypes = {\n type(props) {\n if (props.type && !['foreground', 'background'].includes(props.type)) {\n const error = `Invalid prop \\`type\\` supplied to \\`${TOAST_NAME}\\`. Expected \\`foreground | background\\`.`;\n throw new Error(error);\n }\n return null;\n },\n};\n\n/* -----------------------------------------------------------------------------------------------*/\n\ninterface ToastAnnounceProps\n extends React.ComponentPropsWithoutRef<'div'>,\n ScopedProps<{ children?: ToastImplProps['children'] }> {}\n\nconst ToastAnnounce: React.FC<ToastAnnounceProps> = (props: ScopedProps<ToastAnnounceProps>) => {\n const { __scopeToast, ...announceProps } = props;\n const context = useToastProviderContext(TOAST_NAME, __scopeToast);\n const [renderChildren, setRenderChildren] = React.useState(false);\n const [isAnnounced, setIsAnnounced] = React.useState(false);\n\n // render children in the next frame to ensure toast is announced in NVDA\n useNextFrame(() => setRenderChildren(true));\n\n React.useEffect(() => {\n const timer = window.setTimeout(() => setIsAnnounced(true), 1000);\n return () => window.clearTimeout(timer);\n }, []);\n\n return isAnnounced ? null : (\n <UnstablePortal asChild>\n <VisuallyHidden asChild>\n <div {...announceProps}>\n {renderChildren && (\n <>\n {context.label} {props.children}\n </>\n )}\n </div>\n </VisuallyHidden>\n </UnstablePortal>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ToastTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'ToastTitle';\n\ntype ToastTitleElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface ToastTitleProps extends PrimitiveDivProps {}\n\nconst ToastTitle = React.forwardRef<ToastTitleElement, ToastTitleProps>(\n (props: ScopedProps<ToastTitleProps>, forwardedRef) => {\n const { __scopeToast, ...titleProps } = props;\n return <Primitive.div {...titleProps} ref={forwardedRef} />;\n }\n);\n\nToastTitle.displayName = TITLE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToastDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'ToastDescription';\n\ntype ToastDescriptionElement = React.ElementRef<typeof Primitive.div>;\ninterface ToastDescriptionProps extends PrimitiveDivProps {}\n\nconst ToastDescription = React.forwardRef<ToastDescriptionElement, ToastDescriptionProps>(\n (props: ScopedProps<ToastDescriptionProps>, forwardedRef) => {\n const { __scopeToast, ...descriptionProps } = props;\n return <Primitive.div {...descriptionProps} ref={forwardedRef} />;\n }\n);\n\nToastDescription.displayName = DESCRIPTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToastAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACTION_NAME = 'ToastAction';\n\ntype ToastActionElement = ToastCloseElement;\ninterface ToastActionProps extends ToastCloseProps {\n /**\n * A short description for an alternate way to carry out the action. For screen reader users\n * who will not be able to navigate to the button easily/quickly.\n * @example <ToastAction altText=\"Goto account settings to updgrade\">Upgrade</ToastAction>\n * @example <ToastAction altText=\"Undo (Alt+U)\">Undo</ToastAction>\n */\n altText: string;\n}\n\nconst ToastAction = React.forwardRef<ToastActionElement, ToastActionProps>(\n (props: ScopedProps<ToastActionProps>, forwardedRef) => {\n const { altText, ...actionProps } = props;\n const context = useToastInteractiveContext(ACTION_NAME, props.__scopeToast);\n if (!altText) return null;\n return context.isInteractive ? (\n <ToastClose {...actionProps} ref={forwardedRef} />\n ) : (\n <span>{altText}</span>\n );\n }\n);\n\nToastAction.propTypes = {\n altText(props) {\n if (!props.altText) {\n throw new Error(`Missing prop \\`altText\\` expected on \\`${ACTION_NAME}\\``);\n }\n return null;\n },\n};\n\nToastAction.displayName = ACTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToastClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'ToastClose';\n\ntype ToastCloseElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface ToastCloseProps extends PrimitiveButtonProps {}\n\nconst ToastClose = React.forwardRef<ToastCloseElement, ToastCloseProps>(\n (props: ScopedProps<ToastCloseProps>, forwardedRef) => {\n const { __scopeToast, ...closeProps } = props;\n const interactiveContext = useToastInteractiveContext(CLOSE_NAME, __scopeToast);\n return interactiveContext.isInteractive ? (\n <Primitive.button\n type=\"button\"\n {...closeProps}\n ref={forwardedRef}\n onClick={composeEventHandlers(props.onClick, interactiveContext.onClose)}\n />\n ) : null;\n }\n);\n\nToastClose.displayName = CLOSE_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\nfunction handleAndDispatchCustomEvent<\n E extends CustomEvent,\n ReactEvent extends React.SyntheticEvent\n>(\n name: string,\n handler: ((event: E) => void) | undefined,\n detail: { originalEvent: ReactEvent } & (E extends CustomEvent<infer D> ? D : never),\n { discrete }: { discrete: boolean }\n) {\n const currentTarget = detail.originalEvent.currentTarget as HTMLElement;\n const event = new CustomEvent(name, { bubbles: true, cancelable: true, detail });\n if (handler) currentTarget.addEventListener(name, handler as EventListener, { once: true });\n\n if (discrete) {\n dispatchDiscreteCustomEvent(currentTarget, event);\n } else {\n currentTarget.dispatchEvent(event);\n }\n}\n\nconst isDeltaInDirection = (\n delta: { x: number; y: number },\n direction: SwipeDirection,\n threshold = 0\n) => {\n const deltaX = Math.abs(delta.x);\n const deltaY = Math.abs(delta.y);\n const isDeltaX = deltaX > deltaY;\n if (direction === 'left' || direction === 'right') {\n return isDeltaX && deltaX > threshold;\n } else {\n return !isDeltaX && deltaY > threshold;\n }\n};\n\nfunction useNextFrame(callback = () => {}) {\n const fn = useCallbackRef(callback);\n useLayoutEffect(() => {\n let raf1 = 0;\n let raf2 = 0;\n raf1 = window.requestAnimationFrame(() => (raf2 = window.requestAnimationFrame(fn)));\n return () => {\n window.cancelAnimationFrame(raf1);\n window.cancelAnimationFrame(raf2);\n };\n }, [fn]);\n}\n\nconst Provider = ToastProvider;\nconst Viewport = ToastViewport;\nconst Root = Toast;\nconst Title = ToastTitle;\nconst Description = ToastDescription;\nconst Action = ToastAction;\nconst Close = ToastClose;\n\nexport {\n createToastScope,\n //\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastAction,\n ToastClose,\n //\n Provider,\n Viewport,\n Root,\n Title,\n Description,\n Action,\n Close,\n};\nexport type {\n ToastProviderProps,\n ToastViewportProps,\n ToastProps,\n ToastTitleProps,\n ToastDescriptionProps,\n ToastActionProps,\n ToastCloseProps,\n};\n"],"names":["React","ReactDOM","composeEventHandlers","useComposedRefs","createContextScope","DismissableLayer","UnstablePortal","Presence","Primitive","dispatchDiscreteCustomEvent","useCallbackRef","useControllableState","useLayoutEffect","VisuallyHidden","PROVIDER_NAME","createToastContext","createToastScope","ToastProviderProvider","useToastProviderContext","ToastProvider","props","__scopeToast","label","duration","swipeDirection","swipeThreshold","children","viewport","setViewport","useState","toastCount","setToastCount","isFocusedToastEscapeKeyDownRef","useRef","isClosePausedRef","useCallback","prevCount","VIEWPORT_NAME","VIEWPORT_DEFAULT_HOTKEY","VIEWPORT_PAUSE","VIEWPORT_RESUME","ToastViewport","forwardRef","forwardedRef","hotkey","viewportProps","context","wrapperRef","ref","composedRefs","onViewportChange","hotkeyLabel","join","replace","useEffect","handleKeyDown","event","isHotkeyPressed","every","key","code","current","focus","document","addEventListener","removeEventListener","wrapper","handlePause","pauseEvent","CustomEvent","dispatchEvent","handleResume","resumeEvent","window","prepended","Set","observer","MutationObserver","mutations","addedNodes","map","mutation","Array","from","reduce","a","b","concat","forEach","node","has","prepend","add","delete","observe","childList","disconnect","pointerEvents","undefined","TOAST_NAME","TOAST_SWIPE_START","TOAST_SWIPE_MOVE","TOAST_SWIPE_CANCEL","TOAST_SWIPE_END","Toast","forceMount","open","openProp","defaultOpen","onOpenChange","toastProps","setOpen","prop","defaultProp","onChange","onSwipeStart","currentTarget","setAttribute","onSwipeMove","x","y","detail","delta","style","setProperty","onSwipeCancel","removeProperty","onSwipeEnd","ToastInteractiveProvider","useToastInteractiveContext","isInteractive","onClose","ToastImpl","type","durationProp","onEscapeKeyDown","pointerStartRef","swipeDeltaRef","closeTimerStartTimeRef","closeTimerRemainingTimeRef","closeTimerRef","onToastAdd","onToastRemove","handleClose","isFocusInToast","contains","activeElement","startTimer","Infinity","clearTimeout","Date","getTime","setTimeout","elapsedTime","createPortal","userSelect","touchAction","onKeyDown","nativeEvent","defaultPrevented","onPointerDown","button","clientX","clientY","onPointerMove","hasSwipeMoveStarted","Boolean","isHorizontalSwipe","includes","clamp","Math","min","max","clampedX","clampedY","moveStartBuffer","pointerType","eventDetail","originalEvent","handleAndDispatchCustomEvent","discrete","isDeltaInDirection","target","setPointerCapture","pointerId","abs","onPointerUp","releasePointerCapture","toast","preventDefault","once","propTypes","error","Error","ToastAnnounce","announceProps","renderChildren","setRenderChildren","isAnnounced","setIsAnnounced","useNextFrame","timer","TITLE_NAME","ToastTitle","titleProps","DESCRIPTION_NAME","ToastDescription","descriptionProps","ACTION_NAME","ToastAction","altText","actionProps","CLOSE_NAME","ToastClose","closeProps","interactiveContext","onClick","name","handler","bubbles","cancelable","direction","threshold","deltaX","deltaY","isDeltaX","callback","fn","raf1","raf2","requestAnimationFrame","cancelAnimationFrame","Provider","Viewport","Root","Title","Description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AvC,EAA2C;IACzC,MAAMC,EAAE,GAAGrN,gDAAc,CAACoN,QAAD,CAAzB,AAAA;IACAlN,kDAAe,CAAC,IAAM;QACpB,IAAIoN,IAAI,GAAG,CAAX,AAAA;QACA,IAAIC,IAAI,GAAG,CAAX,AAAA;QACAD,IAAI,GAAGnJ,MAAM,CAACqJ,qBAAP,CAA6B,IAAOD,IAAI,GAAGpJ,MAAM,CAACqJ,qBAAP,CAA6BH,EAA7B,CAA3C;QAAA,CAAP,CAAAC;QACA,OAAO,IAAM;YACXnJ,MAAM,CAACsJ,oBAAP,CAA4BH,IAA5B,CAAAnJ,CAAAA;YACAA,MAAM,CAACsJ,oBAAP,CAA4BF,IAA5B,CAAApJ,CAAAA;SAFF,CAGC;KAPY,EAQZ;QAACkJ,EAAD;KARY,CAAf,CAQC;CACF;AAED,MAAMK,yCAAQ,GAAGjN,wCAAjB,AAAA;AACA,MAAMkN,wCAAQ,GAAGxL,yCAAjB,AAAA;AACA,MAAMyL,yCAAI,GAAG1H,yCAAb,AAAA;AACA,MAAM2H,yCAAK,GAAGhC,wCAAd,AAAA;AACA,MAAMiC,yCAAW,GAAG9B,yCAApB,AAAA;AACA,MAAM+B,yCAAM,GAAG5B,yCAAf,AAAA;AACA,MAAM6B,yCAAK,GAAGzB,yCAAd,AAAA;;ADjsBA","sources":["packages/react/toast/src/index.ts","packages/react/toast/src/Toast.tsx"],"sourcesContent":["export * from './Toast';\n","import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport * as DismissableLayer from '@radix-ui/react-dismissable-layer';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive, dispatchDiscreteCustomEvent } from '@radix-ui/react-primitive';\nimport { Slottable } from '@radix-ui/react-slot';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { VisuallyHidden } from '@radix-ui/react-visually-hidden';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * ToastProvider\n * -----------------------------------------------------------------------------------------------*/\n\nconst PROVIDER_NAME = 'ToastProvider';\n\ntype SwipeDirection = 'up' | 'down' | 'left' | 'right';\ntype ToastProviderContextValue = {\n label: string;\n duration: number;\n swipeDirection: SwipeDirection;\n swipeThreshold: number;\n toastCount: number;\n viewport: ToastViewportElement | null;\n onViewportChange(viewport: ToastViewportElement): void;\n onToastAdd(): void;\n onToastRemove(): void;\n isFocusedToastEscapeKeyDownRef: React.MutableRefObject<boolean>;\n isClosePausedRef: React.MutableRefObject<boolean>;\n};\n\ntype ScopedProps<P> = P & { __scopeToast?: Scope };\nconst [createToastContext, createToastScope] = createContextScope('Toast');\nconst [ToastProviderProvider, useToastProviderContext] =\n createToastContext<ToastProviderContextValue>(PROVIDER_NAME);\n\ninterface ToastProviderProps {\n children?: React.ReactNode;\n /**\n * An author-localized label for each toast. Used to help screen reader users\n * associate the interruption with a toast.\n * @defaultValue 'Notification'\n */\n label?: string;\n /**\n * Time in milliseconds that each toast should remain visible for.\n * @defaultValue 5000\n */\n duration?: number;\n /**\n * Direction of pointer swipe that should close the toast.\n * @defaultValue 'right'\n */\n swipeDirection?: SwipeDirection;\n /**\n * Distance in pixels that the swipe must pass before a close is triggered.\n * @defaultValue 50\n */\n swipeThreshold?: number;\n}\n\nconst ToastProvider: React.FC<ToastProviderProps> = (props: ScopedProps<ToastProviderProps>) => {\n const {\n __scopeToast,\n label = 'Notification',\n duration = 5000,\n swipeDirection = 'right',\n swipeThreshold = 50,\n children,\n } = props;\n const [viewport, setViewport] = React.useState<ToastViewportElement | null>(null);\n const [toastCount, setToastCount] = React.useState(0);\n const isFocusedToastEscapeKeyDownRef = React.useRef(false);\n const isClosePausedRef = React.useRef(false);\n return (\n <ToastProviderProvider\n scope={__scopeToast}\n label={label}\n duration={duration}\n swipeDirection={swipeDirection}\n swipeThreshold={swipeThreshold}\n toastCount={toastCount}\n viewport={viewport}\n onViewportChange={setViewport}\n onToastAdd={React.useCallback(() => setToastCount((prevCount) => prevCount + 1), [])}\n onToastRemove={React.useCallback(() => setToastCount((prevCount) => prevCount - 1), [])}\n isFocusedToastEscapeKeyDownRef={isFocusedToastEscapeKeyDownRef}\n isClosePausedRef={isClosePausedRef}\n >\n {children}\n </ToastProviderProvider>\n );\n};\n\nToastProvider.propTypes = {\n label(props) {\n if (props.label && typeof props.label === 'string' && !props.label.trim()) {\n const error = `Invalid prop \\`label\\` supplied to \\`${PROVIDER_NAME}\\`. Expected non-empty \\`string\\`.`;\n return new Error(error);\n }\n return null;\n },\n};\n\nToastProvider.displayName = PROVIDER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToastViewport\n * -----------------------------------------------------------------------------------------------*/\n\nconst VIEWPORT_NAME = 'ToastViewport';\nconst VIEWPORT_DEFAULT_HOTKEY = ['F8'];\nconst VIEWPORT_PAUSE = 'toast.viewportPause';\nconst VIEWPORT_RESUME = 'toast.viewportResume';\n\ntype ToastViewportElement = React.ElementRef<typeof Primitive.ol>;\ntype PrimitiveOrderedListProps = Radix.ComponentPropsWithoutRef<typeof Primitive.ol>;\ninterface ToastViewportProps extends PrimitiveOrderedListProps {\n /**\n * The keys to use as the keyboard shortcut that will move focus to the toast viewport.\n * @defaultValue ['F8']\n */\n hotkey?: string[];\n /**\n * An author-localized label for the toast viewport to provide context for screen reader users\n * when navigating page landmarks. The available `{hotkey}` placeholder will be replaced for you.\n * @defaultValue 'Notifications ({hotkey})'\n */\n label?: string;\n}\n\nconst ToastViewport = React.forwardRef<ToastViewportElement, ToastViewportProps>(\n (props: ScopedProps<ToastViewportProps>, forwardedRef) => {\n const {\n __scopeToast,\n hotkey = VIEWPORT_DEFAULT_HOTKEY,\n label = 'Notifications ({hotkey})',\n ...viewportProps\n } = props;\n const context = useToastProviderContext(VIEWPORT_NAME, __scopeToast);\n const wrapperRef = React.useRef<HTMLDivElement>(null);\n const ref = React.useRef<ToastViewportElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref, context.onViewportChange);\n const hotkeyLabel = hotkey.join('+').replace(/Key/g, '').replace(/Digit/g, '');\n\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n // we use `event.code` as it is consistent regardless of meta keys that were pressed.\n // for example, `event.key` for `Control+Alt+t` is `†` and `t !== †`\n const isHotkeyPressed = hotkey.every((key) => (event as any)[key] || event.code === key);\n if (isHotkeyPressed) ref.current?.focus();\n };\n document.addEventListener('keydown', handleKeyDown);\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [hotkey]);\n\n React.useEffect(() => {\n const wrapper = wrapperRef.current;\n const viewport = ref.current;\n if (wrapper && viewport) {\n const handlePause = () => {\n const pauseEvent = new CustomEvent(VIEWPORT_PAUSE);\n viewport.dispatchEvent(pauseEvent);\n context.isClosePausedRef.current = true;\n };\n\n const handleResume = () => {\n const resumeEvent = new CustomEvent(VIEWPORT_RESUME);\n viewport.dispatchEvent(resumeEvent);\n context.isClosePausedRef.current = false;\n };\n\n // Toasts are not in the viewport React tree so we need to bind DOM events\n wrapper.addEventListener('focusin', handlePause);\n wrapper.addEventListener('focusout', handleResume);\n wrapper.addEventListener('pointerenter', handlePause);\n wrapper.addEventListener('pointerleave', handleResume);\n window.addEventListener('blur', handlePause);\n window.addEventListener('focus', handleResume);\n return () => {\n wrapper.removeEventListener('focusin', handlePause);\n wrapper.removeEventListener('focusout', handleResume);\n wrapper.removeEventListener('pointerenter', handlePause);\n wrapper.removeEventListener('pointerleave', handleResume);\n window.removeEventListener('blur', handlePause);\n window.removeEventListener('focus', handleResume);\n };\n }\n }, [context.isClosePausedRef]);\n\n React.useEffect(() => {\n const viewport = ref.current;\n // Re-order DOM so most recent toasts are at top of DOM structure to improve tab order\n if (viewport) {\n const prepended: Set<Node> = new Set();\n const observer = new MutationObserver((mutations) => {\n const addedNodes = mutations\n .map((mutation) => Array.from(mutation.addedNodes))\n .reduce((a, b) => a.concat(b));\n\n addedNodes.forEach((node) => {\n // mutation will immediately fire again when we prepend so we only prepend if\n // it hasn't just prepended.\n if (!prepended.has(node)) {\n viewport.prepend(node);\n prepended.add(node);\n } else {\n // this else catches the case where the mutation fires immediately after prepend.\n // we remove from cache after it prepends to allow observer to catch future updates\n // to DOM order, e.g. if `key` changes for a toast and is reportalled to bottom.\n prepended.delete(node);\n }\n });\n });\n observer.observe(viewport, { childList: true });\n return () => observer.disconnect();\n }\n }, []);\n\n return (\n <DismissableLayer.Branch\n ref={wrapperRef}\n role=\"region\"\n aria-label={label.replace('{hotkey}', hotkeyLabel)}\n // Ensure virtual cursor from landmarks menus triggers focus/blur for pause/resume\n tabIndex={-1}\n // incase list has size when empty (e.g. padding), we remove pointer events so\n // it doesn't prevent interactions with page elements that it overlays\n style={{ pointerEvents: context.toastCount > 0 ? undefined : 'none' }}\n >\n {/**\n * tabindex on the the list so that it can be focused when items are removed. we focus\n * the list instead of the viewport so it announces number of items remaining.\n */}\n <Primitive.ol tabIndex={-1} {...viewportProps} ref={composedRefs} />\n </DismissableLayer.Branch>\n );\n }\n);\n\nToastViewport.displayName = VIEWPORT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * Toast\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOAST_NAME = 'Toast';\nconst TOAST_SWIPE_START = 'toast.swipeStart';\nconst TOAST_SWIPE_MOVE = 'toast.swipeMove';\nconst TOAST_SWIPE_CANCEL = 'toast.swipeCancel';\nconst TOAST_SWIPE_END = 'toast.swipeEnd';\n\ntype ToastElement = ToastImplElement;\ninterface ToastProps extends Omit<ToastImplProps, keyof ToastImplPrivateProps> {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst Toast = React.forwardRef<ToastElement, ToastProps>(\n (props: ScopedProps<ToastProps>, forwardedRef) => {\n const { forceMount, open: openProp, defaultOpen, onOpenChange, ...toastProps } = props;\n const [open = true, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n return (\n <Presence present={forceMount || open}>\n <ToastImpl\n open={open}\n {...toastProps}\n ref={forwardedRef}\n onClose={() => setOpen(false)}\n onSwipeStart={composeEventHandlers(props.onSwipeStart, (event) => {\n event.currentTarget.setAttribute('data-swipe', 'start');\n })}\n onSwipeMove={composeEventHandlers(props.onSwipeMove, (event) => {\n const { x, y } = event.detail.delta;\n event.currentTarget.setAttribute('data-swipe', 'move');\n event.currentTarget.style.setProperty('--radix-toast-swipe-move-x', `${x}px`);\n event.currentTarget.style.setProperty('--radix-toast-swipe-move-y', `${y}px`);\n })}\n onSwipeCancel={composeEventHandlers(props.onSwipeCancel, (event) => {\n event.currentTarget.setAttribute('data-swipe', 'cancel');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-move-x');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-move-y');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-end-x');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-end-y');\n })}\n onSwipeEnd={composeEventHandlers(props.onSwipeEnd, (event) => {\n const { x, y } = event.detail.delta;\n event.currentTarget.setAttribute('data-swipe', 'end');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-move-x');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-move-y');\n event.currentTarget.style.setProperty('--radix-toast-swipe-end-x', `${x}px`);\n event.currentTarget.style.setProperty('--radix-toast-swipe-end-y', `${y}px`);\n setOpen(false);\n })}\n />\n </Presence>\n );\n }\n);\n\nToast.displayName = TOAST_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype SwipeEvent = { currentTarget: EventTarget & ToastElement } & Omit<\n CustomEvent<{ originalEvent: React.PointerEvent; delta: { x: number; y: number } }>,\n 'currentTarget'\n>;\n\nconst [ToastInteractiveProvider, useToastInteractiveContext] = createToastContext(TOAST_NAME, {\n isInteractive: false,\n onClose() {},\n});\n\ntype ToastImplElement = React.ElementRef<typeof Primitive.li>;\ntype DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer.Root>;\ntype ToastImplPrivateProps = { open: boolean; onClose(): void };\ntype PrimitiveListItemProps = Radix.ComponentPropsWithoutRef<typeof Primitive.li>;\ninterface ToastImplProps extends ToastImplPrivateProps, PrimitiveListItemProps {\n type?: 'foreground' | 'background';\n /**\n * Time in milliseconds that toast should remain visible for. Overrides value\n * given to `ToastProvider`.\n */\n duration?: number;\n onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];\n onSwipeStart?(event: SwipeEvent): void;\n onSwipeMove?(event: SwipeEvent): void;\n onSwipeCancel?(event: SwipeEvent): void;\n onSwipeEnd?(event: SwipeEvent): void;\n}\n\nconst ToastImpl = React.forwardRef<ToastImplElement, ToastImplProps>(\n (props: ScopedProps<ToastImplProps>, forwardedRef) => {\n const {\n __scopeToast,\n children,\n type = 'foreground',\n duration: durationProp,\n open,\n onClose,\n onEscapeKeyDown,\n onSwipeStart,\n onSwipeMove,\n onSwipeCancel,\n onSwipeEnd,\n ...toastProps\n } = props;\n const context = useToastProviderContext(TOAST_NAME, __scopeToast);\n const ref = React.useRef<ToastImplElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const pointerStartRef = React.useRef<{ x: number; y: number } | null>(null);\n const swipeDeltaRef = React.useRef<{ x: number; y: number } | null>(null);\n const duration = durationProp || context.duration;\n const closeTimerStartTimeRef = React.useRef(0);\n const closeTimerRemainingTimeRef = React.useRef(duration);\n const closeTimerRef = React.useRef(0);\n const [renderLabel, setRenderLabel] = React.useState(false);\n const { onToastAdd, onToastRemove } = context;\n const handleClose = useCallbackRef(() => {\n // focus viewport if focus is within toast to read the remaining toast\n // count to SR users and ensure focus isn't lost\n const isFocusInToast = ref.current?.contains(document.activeElement);\n if (isFocusInToast) context.viewport?.focus();\n onClose();\n });\n\n const startTimer = React.useCallback(\n (duration: number) => {\n if (!duration || duration === Infinity) return;\n window.clearTimeout(closeTimerRef.current);\n closeTimerStartTimeRef.current = new Date().getTime();\n closeTimerRef.current = window.setTimeout(handleClose, duration);\n },\n [handleClose]\n );\n\n React.useEffect(() => {\n const viewport = context.viewport;\n if (viewport) {\n const handleResume = () => {\n startTimer(closeTimerRemainingTimeRef.current);\n };\n const handlePause = () => {\n const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.current;\n closeTimerRemainingTimeRef.current = closeTimerRemainingTimeRef.current - elapsedTime;\n window.clearTimeout(closeTimerRef.current);\n };\n viewport.addEventListener(VIEWPORT_PAUSE, handlePause);\n viewport.addEventListener(VIEWPORT_RESUME, handleResume);\n return () => {\n viewport.removeEventListener(VIEWPORT_PAUSE, handlePause);\n viewport.removeEventListener(VIEWPORT_RESUME, handleResume);\n };\n }\n }, [context.viewport, duration, startTimer]);\n\n // start timer when toast opens or duration changes.\n // we include `open` in deps because closed !== unmounted when animating\n // so it could reopen before being completely unmounted\n React.useEffect(() => {\n if (open && !context.isClosePausedRef.current) startTimer(duration);\n }, [open, duration, context.isClosePausedRef, startTimer]);\n\n React.useEffect(() => {\n onToastAdd();\n return () => onToastRemove();\n }, [onToastAdd, onToastRemove]);\n\n // render label in the next frame to trigger toast announcement in NVDA\n useNextFrame(() => setRenderLabel(true));\n\n if (!context.viewport) return null;\n\n return (\n <>\n <ToastInteractiveProvider scope={__scopeToast} isInteractive onClose={handleClose}>\n {ReactDOM.createPortal(\n <DismissableLayer.Root\n asChild\n onEscapeKeyDown={composeEventHandlers(onEscapeKeyDown, () => {\n if (!context.isFocusedToastEscapeKeyDownRef.current) handleClose();\n context.isFocusedToastEscapeKeyDownRef.current = false;\n })}\n >\n <Primitive.li\n role=\"status\"\n aria-live={type === 'foreground' ? 'assertive' : 'polite'}\n aria-atomic\n // Prevent voice over from announcing before the label is rendered\n aria-hidden={!renderLabel || undefined}\n tabIndex={0}\n data-state={open ? 'open' : 'closed'}\n data-swipe-direction={context.swipeDirection}\n {...toastProps}\n ref={composedRefs}\n style={{ userSelect: 'none', touchAction: 'none', ...props.style }}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key !== 'Escape') return;\n onEscapeKeyDown?.(event.nativeEvent);\n if (!event.nativeEvent.defaultPrevented) {\n context.isFocusedToastEscapeKeyDownRef.current = true;\n handleClose();\n }\n })}\n onPointerDown={composeEventHandlers(props.onPointerDown, (event) => {\n if (event.button !== 0) return;\n pointerStartRef.current = { x: event.clientX, y: event.clientY };\n })}\n onPointerMove={composeEventHandlers(props.onPointerMove, (event) => {\n if (!pointerStartRef.current) return;\n const x = event.clientX - pointerStartRef.current.x;\n const y = event.clientY - pointerStartRef.current.y;\n const hasSwipeMoveStarted = Boolean(swipeDeltaRef.current);\n const isHorizontalSwipe = ['left', 'right'].includes(context.swipeDirection);\n const clamp = ['left', 'up'].includes(context.swipeDirection)\n ? Math.min\n : Math.max;\n const clampedX = isHorizontalSwipe ? clamp(0, x) : 0;\n const clampedY = !isHorizontalSwipe ? clamp(0, y) : 0;\n const moveStartBuffer = event.pointerType === 'touch' ? 10 : 2;\n const delta = { x: clampedX, y: clampedY };\n const eventDetail = { originalEvent: event, delta };\n if (hasSwipeMoveStarted) {\n swipeDeltaRef.current = delta;\n handleAndDispatchCustomEvent(TOAST_SWIPE_MOVE, onSwipeMove, eventDetail, {\n discrete: false,\n });\n } else if (isDeltaInDirection(delta, context.swipeDirection, moveStartBuffer)) {\n swipeDeltaRef.current = delta;\n handleAndDispatchCustomEvent(TOAST_SWIPE_START, onSwipeStart, eventDetail, {\n discrete: false,\n });\n (event.target as HTMLElement).setPointerCapture(event.pointerId);\n } else if (Math.abs(x) > moveStartBuffer || Math.abs(y) > moveStartBuffer) {\n // User is swiping in wrong direction so we disable swipe gesture\n // for the current pointer down interaction\n pointerStartRef.current = null;\n }\n })}\n onPointerUp={composeEventHandlers(props.onPointerUp, (event) => {\n const delta = swipeDeltaRef.current;\n (event.target as HTMLElement).releasePointerCapture(event.pointerId);\n swipeDeltaRef.current = null;\n pointerStartRef.current = null;\n if (delta) {\n const toast = event.currentTarget;\n const eventDetail = { originalEvent: event, delta };\n if (isDeltaInDirection(delta, context.swipeDirection, context.swipeThreshold)) {\n handleAndDispatchCustomEvent(TOAST_SWIPE_END, onSwipeEnd, eventDetail, {\n discrete: true,\n });\n } else {\n handleAndDispatchCustomEvent(TOAST_SWIPE_CANCEL, onSwipeCancel, eventDetail, {\n discrete: true,\n });\n }\n // Prevent click event from triggering on items within the toast when\n // pointer up is part of a swipe gesture\n toast.addEventListener('click', (event) => event.preventDefault(), {\n once: true,\n });\n }\n })}\n >\n <VisuallyHidden>{renderLabel && context.label}</VisuallyHidden>\n <Slottable>{children}</Slottable>\n </Primitive.li>\n </DismissableLayer.Root>,\n context.viewport\n )}\n </ToastInteractiveProvider>\n </>\n );\n }\n);\n\nToastImpl.propTypes = {\n type(props) {\n if (props.type && !['foreground', 'background'].includes(props.type)) {\n const error = `Invalid prop \\`type\\` supplied to \\`${TOAST_NAME}\\`. Expected \\`foreground | background\\`.`;\n return new Error(error);\n }\n return null;\n },\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ToastTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'ToastTitle';\n\ntype ToastTitleElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface ToastTitleProps extends PrimitiveDivProps {}\n\nconst ToastTitle = React.forwardRef<ToastTitleElement, ToastTitleProps>(\n (props: ScopedProps<ToastTitleProps>, forwardedRef) => {\n const { __scopeToast, ...titleProps } = props;\n return <Primitive.div {...titleProps} ref={forwardedRef} />;\n }\n);\n\nToastTitle.displayName = TITLE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToastDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'ToastDescription';\n\ntype ToastDescriptionElement = React.ElementRef<typeof Primitive.div>;\ninterface ToastDescriptionProps extends PrimitiveDivProps {}\n\nconst ToastDescription = React.forwardRef<ToastDescriptionElement, ToastDescriptionProps>(\n (props: ScopedProps<ToastDescriptionProps>, forwardedRef) => {\n const { __scopeToast, ...descriptionProps } = props;\n return <Primitive.div {...descriptionProps} ref={forwardedRef} />;\n }\n);\n\nToastDescription.displayName = DESCRIPTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToastAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACTION_NAME = 'ToastAction';\n\ntype ToastActionElement = ToastCloseElement;\ninterface ToastActionProps extends ToastCloseProps {\n /**\n * A short description for an alternate way to carry out the action. For screen reader users\n * who will not be able to navigate to the button easily/quickly.\n * @example <ToastAction altText=\"Goto account settings to updgrade\">Upgrade</ToastAction>\n * @example <ToastAction altText=\"Undo (Alt+U)\">Undo</ToastAction>\n */\n altText: string;\n}\n\nconst ToastAction = React.forwardRef<ToastActionElement, ToastActionProps>(\n (props: ScopedProps<ToastActionProps>, forwardedRef) => {\n const { altText, ...actionProps } = props;\n const context = useToastInteractiveContext(ACTION_NAME, props.__scopeToast);\n if (!altText) return null;\n return context.isInteractive ? (\n <ToastClose {...actionProps} ref={forwardedRef} />\n ) : (\n <span>{altText}</span>\n );\n }\n);\n\nToastAction.propTypes = {\n altText(props) {\n if (!props.altText) {\n return new Error(`Missing prop \\`altText\\` expected on \\`${ACTION_NAME}\\``);\n }\n return null;\n },\n};\n\nToastAction.displayName = ACTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToastClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'ToastClose';\n\ntype ToastCloseElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface ToastCloseProps extends PrimitiveButtonProps {}\n\nconst ToastClose = React.forwardRef<ToastCloseElement, ToastCloseProps>(\n (props: ScopedProps<ToastCloseProps>, forwardedRef) => {\n const { __scopeToast, ...closeProps } = props;\n const interactiveContext = useToastInteractiveContext(CLOSE_NAME, __scopeToast);\n return interactiveContext.isInteractive ? (\n <Primitive.button\n type=\"button\"\n {...closeProps}\n ref={forwardedRef}\n onClick={composeEventHandlers(props.onClick, interactiveContext.onClose)}\n />\n ) : null;\n }\n);\n\nToastClose.displayName = CLOSE_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\nfunction handleAndDispatchCustomEvent<\n E extends CustomEvent,\n ReactEvent extends React.SyntheticEvent\n>(\n name: string,\n handler: ((event: E) => void) | undefined,\n detail: { originalEvent: ReactEvent } & (E extends CustomEvent<infer D> ? D : never),\n { discrete }: { discrete: boolean }\n) {\n const currentTarget = detail.originalEvent.currentTarget as HTMLElement;\n const event = new CustomEvent(name, { bubbles: true, cancelable: true, detail });\n if (handler) currentTarget.addEventListener(name, handler as EventListener, { once: true });\n\n if (discrete) {\n dispatchDiscreteCustomEvent(currentTarget, event);\n } else {\n currentTarget.dispatchEvent(event);\n }\n}\n\nconst isDeltaInDirection = (\n delta: { x: number; y: number },\n direction: SwipeDirection,\n threshold = 0\n) => {\n const deltaX = Math.abs(delta.x);\n const deltaY = Math.abs(delta.y);\n const isDeltaX = deltaX > deltaY;\n if (direction === 'left' || direction === 'right') {\n return isDeltaX && deltaX > threshold;\n } else {\n return !isDeltaX && deltaY > threshold;\n }\n};\n\nfunction useNextFrame(callback = () => {}) {\n const fn = useCallbackRef(callback);\n useLayoutEffect(() => {\n let raf1 = 0;\n let raf2 = 0;\n raf1 = window.requestAnimationFrame(() => (raf2 = window.requestAnimationFrame(fn)));\n return () => {\n window.cancelAnimationFrame(raf1);\n window.cancelAnimationFrame(raf2);\n };\n }, [fn]);\n}\n\nconst Provider = ToastProvider;\nconst Viewport = ToastViewport;\nconst Root = Toast;\nconst Title = ToastTitle;\nconst Description = ToastDescription;\nconst Action = ToastAction;\nconst Close = ToastClose;\n\nexport {\n createToastScope,\n //\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastAction,\n ToastClose,\n //\n Provider,\n Viewport,\n Root,\n Title,\n Description,\n Action,\n Close,\n};\nexport type {\n ToastProviderProps,\n ToastViewportProps,\n ToastProps,\n ToastTitleProps,\n ToastDescriptionProps,\n ToastActionProps,\n ToastCloseProps,\n};\n"],"names":["React","ReactDOM","composeEventHandlers","useComposedRefs","createContextScope","DismissableLayer","Presence","Primitive","dispatchDiscreteCustomEvent","Slottable","useCallbackRef","useControllableState","useLayoutEffect","VisuallyHidden","PROVIDER_NAME","createToastContext","createToastScope","ToastProviderProvider","useToastProviderContext","ToastProvider","props","__scopeToast","label","duration","swipeDirection","swipeThreshold","children","viewport","setViewport","useState","toastCount","setToastCount","isFocusedToastEscapeKeyDownRef","useRef","isClosePausedRef","useCallback","prevCount","propTypes","trim","error","Error","VIEWPORT_NAME","VIEWPORT_DEFAULT_HOTKEY","VIEWPORT_PAUSE","VIEWPORT_RESUME","ToastViewport","forwardRef","forwardedRef","hotkey","viewportProps","context","wrapperRef","ref","composedRefs","onViewportChange","hotkeyLabel","join","replace","useEffect","handleKeyDown","event","isHotkeyPressed","every","key","code","current","focus","document","addEventListener","removeEventListener","wrapper","handlePause","pauseEvent","CustomEvent","dispatchEvent","handleResume","resumeEvent","window","prepended","Set","observer","MutationObserver","mutations","addedNodes","map","mutation","Array","from","reduce","a","b","concat","forEach","node","has","prepend","add","delete","observe","childList","disconnect","pointerEvents","undefined","TOAST_NAME","TOAST_SWIPE_START","TOAST_SWIPE_MOVE","TOAST_SWIPE_CANCEL","TOAST_SWIPE_END","Toast","forceMount","open","openProp","defaultOpen","onOpenChange","toastProps","setOpen","prop","defaultProp","onChange","onSwipeStart","currentTarget","setAttribute","onSwipeMove","x","y","detail","delta","style","setProperty","onSwipeCancel","removeProperty","onSwipeEnd","ToastInteractiveProvider","useToastInteractiveContext","isInteractive","onClose","ToastImpl","type","durationProp","onEscapeKeyDown","pointerStartRef","swipeDeltaRef","closeTimerStartTimeRef","closeTimerRemainingTimeRef","closeTimerRef","renderLabel","setRenderLabel","onToastAdd","onToastRemove","handleClose","isFocusInToast","contains","activeElement","startTimer","Infinity","clearTimeout","Date","getTime","setTimeout","elapsedTime","useNextFrame","createPortal","userSelect","touchAction","onKeyDown","nativeEvent","defaultPrevented","onPointerDown","button","clientX","clientY","onPointerMove","hasSwipeMoveStarted","Boolean","isHorizontalSwipe","includes","clamp","Math","min","max","clampedX","clampedY","moveStartBuffer","pointerType","eventDetail","originalEvent","handleAndDispatchCustomEvent","discrete","isDeltaInDirection","target","setPointerCapture","pointerId","abs","onPointerUp","releasePointerCapture","toast","preventDefault","once","TITLE_NAME","ToastTitle","titleProps","DESCRIPTION_NAME","ToastDescription","descriptionProps","ACTION_NAME","ToastAction","altText","actionProps","CLOSE_NAME","ToastClose","closeProps","interactiveContext","onClick","name","handler","bubbles","cancelable","direction","threshold","deltaX","deltaY","isDeltaX","callback","fn","raf1","raf2","requestAnimationFrame","cancelAnimationFrame","Provider","Viewport","Root","Title","Description","Action","Close"],"version":3,"file":"index.js.map"}
@@ -5,9 +5,9 @@ import {composeEventHandlers as $eyrYI$composeEventHandlers} from "@radix-ui/pri
5
5
  import {useComposedRefs as $eyrYI$useComposedRefs} from "@radix-ui/react-compose-refs";
6
6
  import {createContextScope as $eyrYI$createContextScope} from "@radix-ui/react-context";
7
7
  import {Branch as $eyrYI$Branch, Root as $eyrYI$Root} from "@radix-ui/react-dismissable-layer";
8
- import {UnstablePortal as $eyrYI$UnstablePortal} from "@radix-ui/react-portal";
9
8
  import {Presence as $eyrYI$Presence} from "@radix-ui/react-presence";
10
9
  import {Primitive as $eyrYI$Primitive, dispatchDiscreteCustomEvent as $eyrYI$dispatchDiscreteCustomEvent} from "@radix-ui/react-primitive";
10
+ import {Slottable as $eyrYI$Slottable} from "@radix-ui/react-slot";
11
11
  import {useCallbackRef as $eyrYI$useCallbackRef} from "@radix-ui/react-use-callback-ref";
12
12
  import {useControllableState as $eyrYI$useControllableState} from "@radix-ui/react-use-controllable-state";
13
13
  import {useLayoutEffect as $eyrYI$useLayoutEffect} from "@radix-ui/react-use-layout-effect";
@@ -77,6 +77,15 @@ const $054eb8030ebde76e$export$f5d03d415824e0e = (props)=>{
77
77
  isClosePausedRef: isClosePausedRef
78
78
  }, children);
79
79
  };
80
+ $054eb8030ebde76e$export$f5d03d415824e0e.propTypes = {
81
+ label (props) {
82
+ if (props.label && typeof props.label === 'string' && !props.label.trim()) {
83
+ const error = `Invalid prop \`label\` supplied to \`${$054eb8030ebde76e$var$PROVIDER_NAME}\`. Expected non-empty \`string\`.`;
84
+ return new Error(error);
85
+ }
86
+ return null;
87
+ }
88
+ };
80
89
  /*#__PURE__*/ Object.assign($054eb8030ebde76e$export$f5d03d415824e0e, {
81
90
  displayName: $054eb8030ebde76e$var$PROVIDER_NAME
82
91
  });
@@ -245,7 +254,7 @@ const $054eb8030ebde76e$export$8d8dc7d5f743331b = /*#__PURE__*/ $eyrYI$forwardRe
245
254
  onClose () {}
246
255
  });
247
256
  const $054eb8030ebde76e$var$ToastImpl = /*#__PURE__*/ $eyrYI$forwardRef((props, forwardedRef)=>{
248
- const { __scopeToast: __scopeToast , type: type = 'foreground' , duration: durationProp , open: open , onClose: onClose , onEscapeKeyDown: onEscapeKeyDown , onSwipeStart: onSwipeStart , onSwipeMove: onSwipeMove , onSwipeCancel: onSwipeCancel , onSwipeEnd: onSwipeEnd , ...toastProps } = props;
257
+ const { __scopeToast: __scopeToast , children: children , type: type = 'foreground' , duration: durationProp , open: open , onClose: onClose , onEscapeKeyDown: onEscapeKeyDown , onSwipeStart: onSwipeStart , onSwipeMove: onSwipeMove , onSwipeCancel: onSwipeCancel , onSwipeEnd: onSwipeEnd , ...toastProps } = props;
249
258
  const context = $054eb8030ebde76e$var$useToastProviderContext($054eb8030ebde76e$var$TOAST_NAME, __scopeToast);
250
259
  const ref = $eyrYI$useRef(null);
251
260
  const composedRefs = $eyrYI$useComposedRefs(forwardedRef, ref);
@@ -255,6 +264,7 @@ const $054eb8030ebde76e$var$ToastImpl = /*#__PURE__*/ $eyrYI$forwardRef((props,
255
264
  const closeTimerStartTimeRef = $eyrYI$useRef(0);
256
265
  const closeTimerRemainingTimeRef = $eyrYI$useRef(duration1);
257
266
  const closeTimerRef = $eyrYI$useRef(0);
267
+ const [renderLabel, setRenderLabel] = $eyrYI$useState(false);
258
268
  const { onToastAdd: onToastAdd , onToastRemove: onToastRemove } = context;
259
269
  const handleClose = $eyrYI$useCallbackRef(()=>{
260
270
  var _ref$current2, _context$viewport;
@@ -312,15 +322,11 @@ const $054eb8030ebde76e$var$ToastImpl = /*#__PURE__*/ $eyrYI$forwardRef((props,
312
322
  }, [
313
323
  onToastAdd,
314
324
  onToastRemove
315
- ]);
325
+ ]); // render label in the next frame to trigger toast announcement in NVDA
326
+ $054eb8030ebde76e$var$useNextFrame(()=>setRenderLabel(true)
327
+ );
316
328
  if (!context.viewport) return null;
317
- return /*#__PURE__*/ $eyrYI$createElement($eyrYI$Fragment, null, /*#__PURE__*/ $eyrYI$createElement($054eb8030ebde76e$var$ToastAnnounce, {
318
- __scopeToast: __scopeToast // Toasts are always role=status to avoid stuttering issues with role=alert in SRs.
319
- ,
320
- role: "status",
321
- "aria-live": type === 'foreground' ? 'assertive' : 'polite',
322
- "aria-atomic": true
323
- }, props.children), /*#__PURE__*/ $eyrYI$createElement($054eb8030ebde76e$var$ToastInteractiveProvider, {
329
+ return /*#__PURE__*/ $eyrYI$createElement($eyrYI$Fragment, null, /*#__PURE__*/ $eyrYI$createElement($054eb8030ebde76e$var$ToastInteractiveProvider, {
324
330
  scope: __scopeToast,
325
331
  isInteractive: true,
326
332
  onClose: handleClose
@@ -332,8 +338,10 @@ const $054eb8030ebde76e$var$ToastImpl = /*#__PURE__*/ $eyrYI$forwardRef((props,
332
338
  })
333
339
  }, /*#__PURE__*/ $eyrYI$createElement($eyrYI$Primitive.li, $eyrYI$babelruntimehelpersesmextends({
334
340
  role: "status",
335
- "aria-live": "off",
336
- "aria-atomic": true,
341
+ "aria-live": type === 'foreground' ? 'assertive' : 'polite',
342
+ "aria-atomic": true // Prevent voice over from announcing before the label is rendered
343
+ ,
344
+ "aria-hidden": !renderLabel || undefined,
337
345
  tabIndex: 0,
338
346
  "data-state": open ? 'open' : 'closed',
339
347
  "data-swipe-direction": context.swipeDirection
@@ -423,7 +431,7 @@ const $054eb8030ebde76e$var$ToastImpl = /*#__PURE__*/ $eyrYI$forwardRef((props,
423
431
  });
424
432
  }
425
433
  })
426
- }))), context.viewport)));
434
+ }), /*#__PURE__*/ $eyrYI$createElement($eyrYI$VisuallyHidden, null, renderLabel && context.label), /*#__PURE__*/ $eyrYI$createElement($eyrYI$Slottable, null, children))), context.viewport)));
427
435
  });
428
436
  $054eb8030ebde76e$var$ToastImpl.propTypes = {
429
437
  type (props) {
@@ -432,30 +440,11 @@ $054eb8030ebde76e$var$ToastImpl.propTypes = {
432
440
  'background'
433
441
  ].includes(props.type)) {
434
442
  const error = `Invalid prop \`type\` supplied to \`${$054eb8030ebde76e$var$TOAST_NAME}\`. Expected \`foreground | background\`.`;
435
- throw new Error(error);
443
+ return new Error(error);
436
444
  }
437
445
  return null;
438
446
  }
439
447
  };
440
- /* -----------------------------------------------------------------------------------------------*/ const $054eb8030ebde76e$var$ToastAnnounce = (props)=>{
441
- const { __scopeToast: __scopeToast , ...announceProps } = props;
442
- const context = $054eb8030ebde76e$var$useToastProviderContext($054eb8030ebde76e$var$TOAST_NAME, __scopeToast);
443
- const [renderChildren, setRenderChildren] = $eyrYI$useState(false);
444
- const [isAnnounced, setIsAnnounced] = $eyrYI$useState(false); // render children in the next frame to ensure toast is announced in NVDA
445
- $054eb8030ebde76e$var$useNextFrame(()=>setRenderChildren(true)
446
- );
447
- $eyrYI$useEffect(()=>{
448
- const timer = window.setTimeout(()=>setIsAnnounced(true)
449
- , 1000);
450
- return ()=>window.clearTimeout(timer)
451
- ;
452
- }, []);
453
- return isAnnounced ? null : /*#__PURE__*/ $eyrYI$createElement($eyrYI$UnstablePortal, {
454
- asChild: true
455
- }, /*#__PURE__*/ $eyrYI$createElement($eyrYI$VisuallyHidden, {
456
- asChild: true
457
- }, /*#__PURE__*/ $eyrYI$createElement("div", announceProps, renderChildren && /*#__PURE__*/ $eyrYI$createElement($eyrYI$Fragment, null, context.label, " ", props.children))));
458
- };
459
448
  /* -------------------------------------------------------------------------------------------------
460
449
  * ToastTitle
461
450
  * -----------------------------------------------------------------------------------------------*/ const $054eb8030ebde76e$var$TITLE_NAME = 'ToastTitle';
@@ -493,7 +482,7 @@ const $054eb8030ebde76e$export$3019feecfda683d2 = /*#__PURE__*/ $eyrYI$forwardRe
493
482
  });
494
483
  $054eb8030ebde76e$export$3019feecfda683d2.propTypes = {
495
484
  altText (props) {
496
- if (!props.altText) throw new Error(`Missing prop \`altText\` expected on \`${$054eb8030ebde76e$var$ACTION_NAME}\``);
485
+ if (!props.altText) return new Error(`Missing prop \`altText\` expected on \`${$054eb8030ebde76e$var$ACTION_NAME}\``);
497
486
  return null;
498
487
  }
499
488
  };
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A;;;;;;;;;;;;;;ACiBA;;oGAEA,CAEA,MAAMc,mCAAa,GAAG,eAAtB,AAAA;AAkBA,MAAM,CAACC,wCAAD,EAAqBC,yCAArB,CAAA,GAAyCZ,yBAAkB,CAAC,OAAD,CAAjE,AAAA;AACA,MAAM,CAACa,2CAAD,EAAwBC,6CAAxB,CAAA,GACJH,wCAAkB,CAA4BD,mCAA5B,CADpB,AAAA;AA4BA,MAAMK,wCAA2C,GAAIC,CAAAA,KAAD,GAA4C;IAC9F,MAAM,E,cACJC,YADI,CAAA,SAEJC,KAAK,GAAG,cAFJ,aAGJC,QAAQ,GAAG,IAHP,mBAIJC,cAAc,GAAG,OAJb,mBAKJC,cAAc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B,AAAA;IACAtN,sBAAe,CAAC,IAAM;QACpB,IAAIwN,IAAI,GAAG,CAAX,AAAA;QACA,IAAIC,IAAI,GAAG,CAAX,AAAA;QACAD,IAAI,GAAG3J,MAAM,CAAC6J,qBAAP,CAA6B,IAAOD,IAAI,GAAG5J,MAAM,CAAC6J,qBAAP,CAA6BH,EAA7B,CAA3C;QAAA,CAAP,CAAAC;QACA,OAAO,IAAM;YACX3J,MAAM,CAAC8J,oBAAP,CAA4BH,IAA5B,CAAA3J,CAAAA;YACAA,MAAM,CAAC8J,oBAAP,CAA4BF,IAA5B,CAAA5J,CAAAA;SAFF,CAGC;KAPY,EAQZ;QAAC0J,EAAD;KARY,CAAf,CAQC;CACF;AAED,MAAMK,yCAAQ,GAAGrN,wCAAjB,AAAA;AACA,MAAMsN,wCAAQ,GAAGhM,yCAAjB,AAAA;AACA,MAAMiM,yCAAI,GAAGlI,yCAAb,AAAA;AACA,MAAMmI,yCAAK,GAAGhC,wCAAd,AAAA;AACA,MAAMiC,yCAAW,GAAG9B,yCAApB,AAAA;AACA,MAAM+B,yCAAM,GAAG5B,yCAAf,AAAA;AACA,MAAM6B,yCAAK,GAAGzB,yCAAd,AAAA;;AD1tBA","sources":["packages/react/toast/src/index.ts","packages/react/toast/src/Toast.tsx"],"sourcesContent":["export * from './Toast';\n","import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport * as DismissableLayer from '@radix-ui/react-dismissable-layer';\nimport { UnstablePortal } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive, dispatchDiscreteCustomEvent } from '@radix-ui/react-primitive';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { VisuallyHidden } from '@radix-ui/react-visually-hidden';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * ToastProvider\n * -----------------------------------------------------------------------------------------------*/\n\nconst PROVIDER_NAME = 'ToastProvider';\n\ntype SwipeDirection = 'up' | 'down' | 'left' | 'right';\ntype ToastProviderContextValue = {\n label: string;\n duration: number;\n swipeDirection: SwipeDirection;\n swipeThreshold: number;\n toastCount: number;\n viewport: ToastViewportElement | null;\n onViewportChange(viewport: ToastViewportElement): void;\n onToastAdd(): void;\n onToastRemove(): void;\n isFocusedToastEscapeKeyDownRef: React.MutableRefObject<boolean>;\n isClosePausedRef: React.MutableRefObject<boolean>;\n};\n\ntype ScopedProps<P> = P & { __scopeToast?: Scope };\nconst [createToastContext, createToastScope] = createContextScope('Toast');\nconst [ToastProviderProvider, useToastProviderContext] =\n createToastContext<ToastProviderContextValue>(PROVIDER_NAME);\n\ninterface ToastProviderProps {\n children?: React.ReactNode;\n /**\n * An author-localized label for each toast. Used to help screen reader users\n * associate the interruption with a toast.\n * @defaultValue 'Notification'\n */\n label?: string;\n /**\n * Time in milliseconds that each toast should remain visible for.\n * @defaultValue 5000\n */\n duration?: number;\n /**\n * Direction of pointer swipe that should close the toast.\n * @defaultValue 'right'\n */\n swipeDirection?: SwipeDirection;\n /**\n * Distance in pixels that the swipe must pass before a close is triggered.\n * @defaultValue 50\n */\n swipeThreshold?: number;\n}\n\nconst ToastProvider: React.FC<ToastProviderProps> = (props: ScopedProps<ToastProviderProps>) => {\n const {\n __scopeToast,\n label = 'Notification',\n duration = 5000,\n swipeDirection = 'right',\n swipeThreshold = 50,\n children,\n } = props;\n const [viewport, setViewport] = React.useState<ToastViewportElement | null>(null);\n const [toastCount, setToastCount] = React.useState(0);\n const isFocusedToastEscapeKeyDownRef = React.useRef(false);\n const isClosePausedRef = React.useRef(false);\n return (\n <ToastProviderProvider\n scope={__scopeToast}\n label={label}\n duration={duration}\n swipeDirection={swipeDirection}\n swipeThreshold={swipeThreshold}\n toastCount={toastCount}\n viewport={viewport}\n onViewportChange={setViewport}\n onToastAdd={React.useCallback(() => setToastCount((prevCount) => prevCount + 1), [])}\n onToastRemove={React.useCallback(() => setToastCount((prevCount) => prevCount - 1), [])}\n isFocusedToastEscapeKeyDownRef={isFocusedToastEscapeKeyDownRef}\n isClosePausedRef={isClosePausedRef}\n >\n {children}\n </ToastProviderProvider>\n );\n};\n\nToastProvider.displayName = PROVIDER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToastViewport\n * -----------------------------------------------------------------------------------------------*/\n\nconst VIEWPORT_NAME = 'ToastViewport';\nconst VIEWPORT_DEFAULT_HOTKEY = ['F8'];\nconst VIEWPORT_PAUSE = 'toast.viewportPause';\nconst VIEWPORT_RESUME = 'toast.viewportResume';\n\ntype ToastViewportElement = React.ElementRef<typeof Primitive.ol>;\ntype PrimitiveOrderedListProps = Radix.ComponentPropsWithoutRef<typeof Primitive.ol>;\ninterface ToastViewportProps extends PrimitiveOrderedListProps {\n /**\n * The keys to use as the keyboard shortcut that will move focus to the toast viewport.\n * @defaultValue ['F8']\n */\n hotkey?: string[];\n /**\n * An author-localized label for the toast viewport to provide context for screen reader users\n * when navigating page landmarks. The available `{hotkey}` placeholder will be replaced for you.\n * @defaultValue 'Notifications ({hotkey})'\n */\n label?: string;\n}\n\nconst ToastViewport = React.forwardRef<ToastViewportElement, ToastViewportProps>(\n (props: ScopedProps<ToastViewportProps>, forwardedRef) => {\n const {\n __scopeToast,\n hotkey = VIEWPORT_DEFAULT_HOTKEY,\n label = 'Notifications ({hotkey})',\n ...viewportProps\n } = props;\n const context = useToastProviderContext(VIEWPORT_NAME, __scopeToast);\n const wrapperRef = React.useRef<HTMLDivElement>(null);\n const ref = React.useRef<ToastViewportElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref, context.onViewportChange);\n const hotkeyLabel = hotkey.join('+').replace(/Key/g, '').replace(/Digit/g, '');\n\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n // we use `event.code` as it is consistent regardless of meta keys that were pressed.\n // for example, `event.key` for `Control+Alt+t` is `†` and `t !== †`\n const isHotkeyPressed = hotkey.every((key) => (event as any)[key] || event.code === key);\n if (isHotkeyPressed) ref.current?.focus();\n };\n document.addEventListener('keydown', handleKeyDown);\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [hotkey]);\n\n React.useEffect(() => {\n const wrapper = wrapperRef.current;\n const viewport = ref.current;\n if (wrapper && viewport) {\n const handlePause = () => {\n const pauseEvent = new CustomEvent(VIEWPORT_PAUSE);\n viewport.dispatchEvent(pauseEvent);\n context.isClosePausedRef.current = true;\n };\n\n const handleResume = () => {\n const resumeEvent = new CustomEvent(VIEWPORT_RESUME);\n viewport.dispatchEvent(resumeEvent);\n context.isClosePausedRef.current = false;\n };\n\n // Toasts are not in the viewport React tree so we need to bind DOM events\n wrapper.addEventListener('focusin', handlePause);\n wrapper.addEventListener('focusout', handleResume);\n wrapper.addEventListener('pointerenter', handlePause);\n wrapper.addEventListener('pointerleave', handleResume);\n window.addEventListener('blur', handlePause);\n window.addEventListener('focus', handleResume);\n return () => {\n wrapper.removeEventListener('focusin', handlePause);\n wrapper.removeEventListener('focusout', handleResume);\n wrapper.removeEventListener('pointerenter', handlePause);\n wrapper.removeEventListener('pointerleave', handleResume);\n window.removeEventListener('blur', handlePause);\n window.removeEventListener('focus', handleResume);\n };\n }\n }, [context.isClosePausedRef]);\n\n React.useEffect(() => {\n const viewport = ref.current;\n // Re-order DOM so most recent toasts are at top of DOM structure to improve tab order\n if (viewport) {\n const prepended: Set<Node> = new Set();\n const observer = new MutationObserver((mutations) => {\n const addedNodes = mutations\n .map((mutation) => Array.from(mutation.addedNodes))\n .reduce((a, b) => a.concat(b));\n\n addedNodes.forEach((node) => {\n // mutation will immediately fire again when we prepend so we only prepend if\n // it hasn't just prepended.\n if (!prepended.has(node)) {\n viewport.prepend(node);\n prepended.add(node);\n } else {\n // this else catches the case where the mutation fires immediately after prepend.\n // we remove from cache after it prepends to allow observer to catch future updates\n // to DOM order, e.g. if `key` changes for a toast and is reportalled to bottom.\n prepended.delete(node);\n }\n });\n });\n observer.observe(viewport, { childList: true });\n return () => observer.disconnect();\n }\n }, []);\n\n return (\n <DismissableLayer.Branch\n ref={wrapperRef}\n role=\"region\"\n aria-label={label.replace('{hotkey}', hotkeyLabel)}\n // Ensure virtual cursor from landmarks menus triggers focus/blur for pause/resume\n tabIndex={-1}\n // incase list has size when empty (e.g. padding), we remove pointer events so\n // it doesn't prevent interactions with page elements that it overlays\n style={{ pointerEvents: context.toastCount > 0 ? undefined : 'none' }}\n >\n {/**\n * tabindex on the the list so that it can be focused when items are removed. we focus\n * the list instead of the viewport so it announces number of items remaining.\n */}\n <Primitive.ol tabIndex={-1} {...viewportProps} ref={composedRefs} />\n </DismissableLayer.Branch>\n );\n }\n);\n\nToastViewport.displayName = VIEWPORT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * Toast\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOAST_NAME = 'Toast';\nconst TOAST_SWIPE_START = 'toast.swipeStart';\nconst TOAST_SWIPE_MOVE = 'toast.swipeMove';\nconst TOAST_SWIPE_CANCEL = 'toast.swipeCancel';\nconst TOAST_SWIPE_END = 'toast.swipeEnd';\n\ntype ToastElement = ToastImplElement;\ninterface ToastProps extends Omit<ToastImplProps, keyof ToastImplPrivateProps> {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst Toast = React.forwardRef<ToastElement, ToastProps>(\n (props: ScopedProps<ToastProps>, forwardedRef) => {\n const { forceMount, open: openProp, defaultOpen, onOpenChange, ...toastProps } = props;\n const [open = true, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n return (\n <Presence present={forceMount || open}>\n <ToastImpl\n open={open}\n {...toastProps}\n ref={forwardedRef}\n onClose={() => setOpen(false)}\n onSwipeStart={composeEventHandlers(props.onSwipeStart, (event) => {\n event.currentTarget.setAttribute('data-swipe', 'start');\n })}\n onSwipeMove={composeEventHandlers(props.onSwipeMove, (event) => {\n const { x, y } = event.detail.delta;\n event.currentTarget.setAttribute('data-swipe', 'move');\n event.currentTarget.style.setProperty('--radix-toast-swipe-move-x', `${x}px`);\n event.currentTarget.style.setProperty('--radix-toast-swipe-move-y', `${y}px`);\n })}\n onSwipeCancel={composeEventHandlers(props.onSwipeCancel, (event) => {\n event.currentTarget.setAttribute('data-swipe', 'cancel');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-move-x');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-move-y');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-end-x');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-end-y');\n })}\n onSwipeEnd={composeEventHandlers(props.onSwipeEnd, (event) => {\n const { x, y } = event.detail.delta;\n event.currentTarget.setAttribute('data-swipe', 'end');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-move-x');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-move-y');\n event.currentTarget.style.setProperty('--radix-toast-swipe-end-x', `${x}px`);\n event.currentTarget.style.setProperty('--radix-toast-swipe-end-y', `${y}px`);\n setOpen(false);\n })}\n />\n </Presence>\n );\n }\n);\n\nToast.displayName = TOAST_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype SwipeEvent = { currentTarget: EventTarget & ToastElement } & Omit<\n CustomEvent<{ originalEvent: React.PointerEvent; delta: { x: number; y: number } }>,\n 'currentTarget'\n>;\n\nconst [ToastInteractiveProvider, useToastInteractiveContext] = createToastContext(TOAST_NAME, {\n isInteractive: false,\n onClose() {},\n});\n\ntype ToastImplElement = React.ElementRef<typeof Primitive.li>;\ntype DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer.Root>;\ntype ToastImplPrivateProps = { open: boolean; onClose(): void };\ntype PrimitiveListItemProps = Radix.ComponentPropsWithoutRef<typeof Primitive.li>;\ninterface ToastImplProps extends ToastImplPrivateProps, PrimitiveListItemProps {\n type?: 'foreground' | 'background';\n /**\n * Time in milliseconds that toast should remain visible for. Overrides value\n * given to `ToastProvider`.\n */\n duration?: number;\n onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];\n onSwipeStart?(event: SwipeEvent): void;\n onSwipeMove?(event: SwipeEvent): void;\n onSwipeCancel?(event: SwipeEvent): void;\n onSwipeEnd?(event: SwipeEvent): void;\n}\n\nconst ToastImpl = React.forwardRef<ToastImplElement, ToastImplProps>(\n (props: ScopedProps<ToastImplProps>, forwardedRef) => {\n const {\n __scopeToast,\n type = 'foreground',\n duration: durationProp,\n open,\n onClose,\n onEscapeKeyDown,\n onSwipeStart,\n onSwipeMove,\n onSwipeCancel,\n onSwipeEnd,\n ...toastProps\n } = props;\n const context = useToastProviderContext(TOAST_NAME, __scopeToast);\n const ref = React.useRef<ToastImplElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const pointerStartRef = React.useRef<{ x: number; y: number } | null>(null);\n const swipeDeltaRef = React.useRef<{ x: number; y: number } | null>(null);\n const duration = durationProp || context.duration;\n const closeTimerStartTimeRef = React.useRef(0);\n const closeTimerRemainingTimeRef = React.useRef(duration);\n const closeTimerRef = React.useRef(0);\n const { onToastAdd, onToastRemove } = context;\n const handleClose = useCallbackRef(() => {\n // focus viewport if focus is within toast to read the remaining toast\n // count to SR users and ensure focus isn't lost\n const isFocusInToast = ref.current?.contains(document.activeElement);\n if (isFocusInToast) context.viewport?.focus();\n onClose();\n });\n\n const startTimer = React.useCallback(\n (duration: number) => {\n if (!duration || duration === Infinity) return;\n window.clearTimeout(closeTimerRef.current);\n closeTimerStartTimeRef.current = new Date().getTime();\n closeTimerRef.current = window.setTimeout(handleClose, duration);\n },\n [handleClose]\n );\n\n React.useEffect(() => {\n const viewport = context.viewport;\n if (viewport) {\n const handleResume = () => {\n startTimer(closeTimerRemainingTimeRef.current);\n };\n const handlePause = () => {\n const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.current;\n closeTimerRemainingTimeRef.current = closeTimerRemainingTimeRef.current - elapsedTime;\n window.clearTimeout(closeTimerRef.current);\n };\n viewport.addEventListener(VIEWPORT_PAUSE, handlePause);\n viewport.addEventListener(VIEWPORT_RESUME, handleResume);\n return () => {\n viewport.removeEventListener(VIEWPORT_PAUSE, handlePause);\n viewport.removeEventListener(VIEWPORT_RESUME, handleResume);\n };\n }\n }, [context.viewport, duration, startTimer]);\n\n // start timer when toast opens or duration changes.\n // we include `open` in deps because closed !== unmounted when animating\n // so it could reopen before being completely unmounted\n React.useEffect(() => {\n if (open && !context.isClosePausedRef.current) startTimer(duration);\n }, [open, duration, context.isClosePausedRef, startTimer]);\n\n React.useEffect(() => {\n onToastAdd();\n return () => onToastRemove();\n }, [onToastAdd, onToastRemove]);\n\n if (!context.viewport) return null;\n\n return (\n <>\n <ToastAnnounce\n __scopeToast={__scopeToast}\n // Toasts are always role=status to avoid stuttering issues with role=alert in SRs.\n role=\"status\"\n aria-live={type === 'foreground' ? 'assertive' : 'polite'}\n aria-atomic\n >\n {props.children}\n </ToastAnnounce>\n\n <ToastInteractiveProvider scope={__scopeToast} isInteractive onClose={handleClose}>\n {ReactDOM.createPortal(\n <DismissableLayer.Root\n asChild\n onEscapeKeyDown={composeEventHandlers(onEscapeKeyDown, () => {\n if (!context.isFocusedToastEscapeKeyDownRef.current) handleClose();\n context.isFocusedToastEscapeKeyDownRef.current = false;\n })}\n >\n <Primitive.li\n role=\"status\"\n aria-live=\"off\"\n aria-atomic\n tabIndex={0}\n data-state={open ? 'open' : 'closed'}\n data-swipe-direction={context.swipeDirection}\n {...toastProps}\n ref={composedRefs}\n style={{ userSelect: 'none', touchAction: 'none', ...props.style }}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key !== 'Escape') return;\n onEscapeKeyDown?.(event.nativeEvent);\n if (!event.nativeEvent.defaultPrevented) {\n context.isFocusedToastEscapeKeyDownRef.current = true;\n handleClose();\n }\n })}\n onPointerDown={composeEventHandlers(props.onPointerDown, (event) => {\n if (event.button !== 0) return;\n pointerStartRef.current = { x: event.clientX, y: event.clientY };\n })}\n onPointerMove={composeEventHandlers(props.onPointerMove, (event) => {\n if (!pointerStartRef.current) return;\n const x = event.clientX - pointerStartRef.current.x;\n const y = event.clientY - pointerStartRef.current.y;\n const hasSwipeMoveStarted = Boolean(swipeDeltaRef.current);\n const isHorizontalSwipe = ['left', 'right'].includes(context.swipeDirection);\n const clamp = ['left', 'up'].includes(context.swipeDirection)\n ? Math.min\n : Math.max;\n const clampedX = isHorizontalSwipe ? clamp(0, x) : 0;\n const clampedY = !isHorizontalSwipe ? clamp(0, y) : 0;\n const moveStartBuffer = event.pointerType === 'touch' ? 10 : 2;\n const delta = { x: clampedX, y: clampedY };\n const eventDetail = { originalEvent: event, delta };\n if (hasSwipeMoveStarted) {\n swipeDeltaRef.current = delta;\n handleAndDispatchCustomEvent(TOAST_SWIPE_MOVE, onSwipeMove, eventDetail, {\n discrete: false,\n });\n } else if (isDeltaInDirection(delta, context.swipeDirection, moveStartBuffer)) {\n swipeDeltaRef.current = delta;\n handleAndDispatchCustomEvent(TOAST_SWIPE_START, onSwipeStart, eventDetail, {\n discrete: false,\n });\n (event.target as HTMLElement).setPointerCapture(event.pointerId);\n } else if (Math.abs(x) > moveStartBuffer || Math.abs(y) > moveStartBuffer) {\n // User is swiping in wrong direction so we disable swipe gesture\n // for the current pointer down interaction\n pointerStartRef.current = null;\n }\n })}\n onPointerUp={composeEventHandlers(props.onPointerUp, (event) => {\n const delta = swipeDeltaRef.current;\n (event.target as HTMLElement).releasePointerCapture(event.pointerId);\n swipeDeltaRef.current = null;\n pointerStartRef.current = null;\n if (delta) {\n const toast = event.currentTarget;\n const eventDetail = { originalEvent: event, delta };\n if (isDeltaInDirection(delta, context.swipeDirection, context.swipeThreshold)) {\n handleAndDispatchCustomEvent(TOAST_SWIPE_END, onSwipeEnd, eventDetail, {\n discrete: true,\n });\n } else {\n handleAndDispatchCustomEvent(TOAST_SWIPE_CANCEL, onSwipeCancel, eventDetail, {\n discrete: true,\n });\n }\n // Prevent click event from triggering on items within the toast when\n // pointer up is part of a swipe gesture\n toast.addEventListener('click', (event) => event.preventDefault(), {\n once: true,\n });\n }\n })}\n />\n </DismissableLayer.Root>,\n context.viewport\n )}\n </ToastInteractiveProvider>\n </>\n );\n }\n);\n\nToastImpl.propTypes = {\n type(props) {\n if (props.type && !['foreground', 'background'].includes(props.type)) {\n const error = `Invalid prop \\`type\\` supplied to \\`${TOAST_NAME}\\`. Expected \\`foreground | background\\`.`;\n throw new Error(error);\n }\n return null;\n },\n};\n\n/* -----------------------------------------------------------------------------------------------*/\n\ninterface ToastAnnounceProps\n extends React.ComponentPropsWithoutRef<'div'>,\n ScopedProps<{ children?: ToastImplProps['children'] }> {}\n\nconst ToastAnnounce: React.FC<ToastAnnounceProps> = (props: ScopedProps<ToastAnnounceProps>) => {\n const { __scopeToast, ...announceProps } = props;\n const context = useToastProviderContext(TOAST_NAME, __scopeToast);\n const [renderChildren, setRenderChildren] = React.useState(false);\n const [isAnnounced, setIsAnnounced] = React.useState(false);\n\n // render children in the next frame to ensure toast is announced in NVDA\n useNextFrame(() => setRenderChildren(true));\n\n React.useEffect(() => {\n const timer = window.setTimeout(() => setIsAnnounced(true), 1000);\n return () => window.clearTimeout(timer);\n }, []);\n\n return isAnnounced ? null : (\n <UnstablePortal asChild>\n <VisuallyHidden asChild>\n <div {...announceProps}>\n {renderChildren && (\n <>\n {context.label} {props.children}\n </>\n )}\n </div>\n </VisuallyHidden>\n </UnstablePortal>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ToastTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'ToastTitle';\n\ntype ToastTitleElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface ToastTitleProps extends PrimitiveDivProps {}\n\nconst ToastTitle = React.forwardRef<ToastTitleElement, ToastTitleProps>(\n (props: ScopedProps<ToastTitleProps>, forwardedRef) => {\n const { __scopeToast, ...titleProps } = props;\n return <Primitive.div {...titleProps} ref={forwardedRef} />;\n }\n);\n\nToastTitle.displayName = TITLE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToastDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'ToastDescription';\n\ntype ToastDescriptionElement = React.ElementRef<typeof Primitive.div>;\ninterface ToastDescriptionProps extends PrimitiveDivProps {}\n\nconst ToastDescription = React.forwardRef<ToastDescriptionElement, ToastDescriptionProps>(\n (props: ScopedProps<ToastDescriptionProps>, forwardedRef) => {\n const { __scopeToast, ...descriptionProps } = props;\n return <Primitive.div {...descriptionProps} ref={forwardedRef} />;\n }\n);\n\nToastDescription.displayName = DESCRIPTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToastAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACTION_NAME = 'ToastAction';\n\ntype ToastActionElement = ToastCloseElement;\ninterface ToastActionProps extends ToastCloseProps {\n /**\n * A short description for an alternate way to carry out the action. For screen reader users\n * who will not be able to navigate to the button easily/quickly.\n * @example <ToastAction altText=\"Goto account settings to updgrade\">Upgrade</ToastAction>\n * @example <ToastAction altText=\"Undo (Alt+U)\">Undo</ToastAction>\n */\n altText: string;\n}\n\nconst ToastAction = React.forwardRef<ToastActionElement, ToastActionProps>(\n (props: ScopedProps<ToastActionProps>, forwardedRef) => {\n const { altText, ...actionProps } = props;\n const context = useToastInteractiveContext(ACTION_NAME, props.__scopeToast);\n if (!altText) return null;\n return context.isInteractive ? (\n <ToastClose {...actionProps} ref={forwardedRef} />\n ) : (\n <span>{altText}</span>\n );\n }\n);\n\nToastAction.propTypes = {\n altText(props) {\n if (!props.altText) {\n throw new Error(`Missing prop \\`altText\\` expected on \\`${ACTION_NAME}\\``);\n }\n return null;\n },\n};\n\nToastAction.displayName = ACTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToastClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'ToastClose';\n\ntype ToastCloseElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface ToastCloseProps extends PrimitiveButtonProps {}\n\nconst ToastClose = React.forwardRef<ToastCloseElement, ToastCloseProps>(\n (props: ScopedProps<ToastCloseProps>, forwardedRef) => {\n const { __scopeToast, ...closeProps } = props;\n const interactiveContext = useToastInteractiveContext(CLOSE_NAME, __scopeToast);\n return interactiveContext.isInteractive ? (\n <Primitive.button\n type=\"button\"\n {...closeProps}\n ref={forwardedRef}\n onClick={composeEventHandlers(props.onClick, interactiveContext.onClose)}\n />\n ) : null;\n }\n);\n\nToastClose.displayName = CLOSE_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\nfunction handleAndDispatchCustomEvent<\n E extends CustomEvent,\n ReactEvent extends React.SyntheticEvent\n>(\n name: string,\n handler: ((event: E) => void) | undefined,\n detail: { originalEvent: ReactEvent } & (E extends CustomEvent<infer D> ? D : never),\n { discrete }: { discrete: boolean }\n) {\n const currentTarget = detail.originalEvent.currentTarget as HTMLElement;\n const event = new CustomEvent(name, { bubbles: true, cancelable: true, detail });\n if (handler) currentTarget.addEventListener(name, handler as EventListener, { once: true });\n\n if (discrete) {\n dispatchDiscreteCustomEvent(currentTarget, event);\n } else {\n currentTarget.dispatchEvent(event);\n }\n}\n\nconst isDeltaInDirection = (\n delta: { x: number; y: number },\n direction: SwipeDirection,\n threshold = 0\n) => {\n const deltaX = Math.abs(delta.x);\n const deltaY = Math.abs(delta.y);\n const isDeltaX = deltaX > deltaY;\n if (direction === 'left' || direction === 'right') {\n return isDeltaX && deltaX > threshold;\n } else {\n return !isDeltaX && deltaY > threshold;\n }\n};\n\nfunction useNextFrame(callback = () => {}) {\n const fn = useCallbackRef(callback);\n useLayoutEffect(() => {\n let raf1 = 0;\n let raf2 = 0;\n raf1 = window.requestAnimationFrame(() => (raf2 = window.requestAnimationFrame(fn)));\n return () => {\n window.cancelAnimationFrame(raf1);\n window.cancelAnimationFrame(raf2);\n };\n }, [fn]);\n}\n\nconst Provider = ToastProvider;\nconst Viewport = ToastViewport;\nconst Root = Toast;\nconst Title = ToastTitle;\nconst Description = ToastDescription;\nconst Action = ToastAction;\nconst Close = ToastClose;\n\nexport {\n createToastScope,\n //\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastAction,\n ToastClose,\n //\n Provider,\n Viewport,\n Root,\n Title,\n Description,\n Action,\n Close,\n};\nexport type {\n ToastProviderProps,\n ToastViewportProps,\n ToastProps,\n ToastTitleProps,\n ToastDescriptionProps,\n ToastActionProps,\n ToastCloseProps,\n};\n"],"names":["React","ReactDOM","composeEventHandlers","useComposedRefs","createContextScope","DismissableLayer","UnstablePortal","Presence","Primitive","dispatchDiscreteCustomEvent","useCallbackRef","useControllableState","useLayoutEffect","VisuallyHidden","PROVIDER_NAME","createToastContext","createToastScope","ToastProviderProvider","useToastProviderContext","ToastProvider","props","__scopeToast","label","duration","swipeDirection","swipeThreshold","children","viewport","setViewport","useState","toastCount","setToastCount","isFocusedToastEscapeKeyDownRef","useRef","isClosePausedRef","useCallback","prevCount","VIEWPORT_NAME","VIEWPORT_DEFAULT_HOTKEY","VIEWPORT_PAUSE","VIEWPORT_RESUME","ToastViewport","forwardRef","forwardedRef","hotkey","viewportProps","context","wrapperRef","ref","composedRefs","onViewportChange","hotkeyLabel","join","replace","useEffect","handleKeyDown","event","isHotkeyPressed","every","key","code","current","focus","document","addEventListener","removeEventListener","wrapper","handlePause","pauseEvent","CustomEvent","dispatchEvent","handleResume","resumeEvent","window","prepended","Set","observer","MutationObserver","mutations","addedNodes","map","mutation","Array","from","reduce","a","b","concat","forEach","node","has","prepend","add","delete","observe","childList","disconnect","pointerEvents","undefined","TOAST_NAME","TOAST_SWIPE_START","TOAST_SWIPE_MOVE","TOAST_SWIPE_CANCEL","TOAST_SWIPE_END","Toast","forceMount","open","openProp","defaultOpen","onOpenChange","toastProps","setOpen","prop","defaultProp","onChange","onSwipeStart","currentTarget","setAttribute","onSwipeMove","x","y","detail","delta","style","setProperty","onSwipeCancel","removeProperty","onSwipeEnd","ToastInteractiveProvider","useToastInteractiveContext","isInteractive","onClose","ToastImpl","type","durationProp","onEscapeKeyDown","pointerStartRef","swipeDeltaRef","closeTimerStartTimeRef","closeTimerRemainingTimeRef","closeTimerRef","onToastAdd","onToastRemove","handleClose","isFocusInToast","contains","activeElement","startTimer","Infinity","clearTimeout","Date","getTime","setTimeout","elapsedTime","createPortal","userSelect","touchAction","onKeyDown","nativeEvent","defaultPrevented","onPointerDown","button","clientX","clientY","onPointerMove","hasSwipeMoveStarted","Boolean","isHorizontalSwipe","includes","clamp","Math","min","max","clampedX","clampedY","moveStartBuffer","pointerType","eventDetail","originalEvent","handleAndDispatchCustomEvent","discrete","isDeltaInDirection","target","setPointerCapture","pointerId","abs","onPointerUp","releasePointerCapture","toast","preventDefault","once","propTypes","error","Error","ToastAnnounce","announceProps","renderChildren","setRenderChildren","isAnnounced","setIsAnnounced","useNextFrame","timer","TITLE_NAME","ToastTitle","titleProps","DESCRIPTION_NAME","ToastDescription","descriptionProps","ACTION_NAME","ToastAction","altText","actionProps","CLOSE_NAME","ToastClose","closeProps","interactiveContext","onClick","name","handler","bubbles","cancelable","direction","threshold","deltaX","deltaY","isDeltaX","callback","fn","raf1","raf2","requestAnimationFrame","cancelAnimationFrame","Provider","Viewport","Root","Title","Description","Action","Close"],"version":3,"file":"index.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A;;;;;;;;;;;;;;ACiBA;;oGAEA,CAEA,MAAMc,mCAAa,GAAG,eAAtB,AAAA;AAkBA,MAAM,CAACC,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A6B,IAAOD,IAAI,GAAGpJ,MAAM,CAACqJ,qBAAP,CAA6BH,EAA7B,CAA3C;QAAA,CAAP,CAAAC;QACA,OAAO,IAAM;YACXnJ,MAAM,CAACsJ,oBAAP,CAA4BH,IAA5B,CAAAnJ,CAAAA;YACAA,MAAM,CAACsJ,oBAAP,CAA4BF,IAA5B,CAAApJ,CAAAA;SAFF,CAGC;KAPY,EAQZ;QAACkJ,EAAD;KARY,CAAf,CAQC;CACF;AAED,MAAMK,yCAAQ,GAAGjN,wCAAjB,AAAA;AACA,MAAMkN,wCAAQ,GAAGxL,yCAAjB,AAAA;AACA,MAAMyL,yCAAI,GAAG1H,yCAAb,AAAA;AACA,MAAM2H,yCAAK,GAAGhC,wCAAd,AAAA;AACA,MAAMiC,yCAAW,GAAG9B,yCAApB,AAAA;AACA,MAAM+B,yCAAM,GAAG5B,yCAAf,AAAA;AACA,MAAM6B,yCAAK,GAAGzB,yCAAd,AAAA;;ADjsBA","sources":["packages/react/toast/src/index.ts","packages/react/toast/src/Toast.tsx"],"sourcesContent":["export * from './Toast';\n","import * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport * as DismissableLayer from '@radix-ui/react-dismissable-layer';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive, dispatchDiscreteCustomEvent } from '@radix-ui/react-primitive';\nimport { Slottable } from '@radix-ui/react-slot';\nimport { useCallbackRef } from '@radix-ui/react-use-callback-ref';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { VisuallyHidden } from '@radix-ui/react-visually-hidden';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * ToastProvider\n * -----------------------------------------------------------------------------------------------*/\n\nconst PROVIDER_NAME = 'ToastProvider';\n\ntype SwipeDirection = 'up' | 'down' | 'left' | 'right';\ntype ToastProviderContextValue = {\n label: string;\n duration: number;\n swipeDirection: SwipeDirection;\n swipeThreshold: number;\n toastCount: number;\n viewport: ToastViewportElement | null;\n onViewportChange(viewport: ToastViewportElement): void;\n onToastAdd(): void;\n onToastRemove(): void;\n isFocusedToastEscapeKeyDownRef: React.MutableRefObject<boolean>;\n isClosePausedRef: React.MutableRefObject<boolean>;\n};\n\ntype ScopedProps<P> = P & { __scopeToast?: Scope };\nconst [createToastContext, createToastScope] = createContextScope('Toast');\nconst [ToastProviderProvider, useToastProviderContext] =\n createToastContext<ToastProviderContextValue>(PROVIDER_NAME);\n\ninterface ToastProviderProps {\n children?: React.ReactNode;\n /**\n * An author-localized label for each toast. Used to help screen reader users\n * associate the interruption with a toast.\n * @defaultValue 'Notification'\n */\n label?: string;\n /**\n * Time in milliseconds that each toast should remain visible for.\n * @defaultValue 5000\n */\n duration?: number;\n /**\n * Direction of pointer swipe that should close the toast.\n * @defaultValue 'right'\n */\n swipeDirection?: SwipeDirection;\n /**\n * Distance in pixels that the swipe must pass before a close is triggered.\n * @defaultValue 50\n */\n swipeThreshold?: number;\n}\n\nconst ToastProvider: React.FC<ToastProviderProps> = (props: ScopedProps<ToastProviderProps>) => {\n const {\n __scopeToast,\n label = 'Notification',\n duration = 5000,\n swipeDirection = 'right',\n swipeThreshold = 50,\n children,\n } = props;\n const [viewport, setViewport] = React.useState<ToastViewportElement | null>(null);\n const [toastCount, setToastCount] = React.useState(0);\n const isFocusedToastEscapeKeyDownRef = React.useRef(false);\n const isClosePausedRef = React.useRef(false);\n return (\n <ToastProviderProvider\n scope={__scopeToast}\n label={label}\n duration={duration}\n swipeDirection={swipeDirection}\n swipeThreshold={swipeThreshold}\n toastCount={toastCount}\n viewport={viewport}\n onViewportChange={setViewport}\n onToastAdd={React.useCallback(() => setToastCount((prevCount) => prevCount + 1), [])}\n onToastRemove={React.useCallback(() => setToastCount((prevCount) => prevCount - 1), [])}\n isFocusedToastEscapeKeyDownRef={isFocusedToastEscapeKeyDownRef}\n isClosePausedRef={isClosePausedRef}\n >\n {children}\n </ToastProviderProvider>\n );\n};\n\nToastProvider.propTypes = {\n label(props) {\n if (props.label && typeof props.label === 'string' && !props.label.trim()) {\n const error = `Invalid prop \\`label\\` supplied to \\`${PROVIDER_NAME}\\`. Expected non-empty \\`string\\`.`;\n return new Error(error);\n }\n return null;\n },\n};\n\nToastProvider.displayName = PROVIDER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToastViewport\n * -----------------------------------------------------------------------------------------------*/\n\nconst VIEWPORT_NAME = 'ToastViewport';\nconst VIEWPORT_DEFAULT_HOTKEY = ['F8'];\nconst VIEWPORT_PAUSE = 'toast.viewportPause';\nconst VIEWPORT_RESUME = 'toast.viewportResume';\n\ntype ToastViewportElement = React.ElementRef<typeof Primitive.ol>;\ntype PrimitiveOrderedListProps = Radix.ComponentPropsWithoutRef<typeof Primitive.ol>;\ninterface ToastViewportProps extends PrimitiveOrderedListProps {\n /**\n * The keys to use as the keyboard shortcut that will move focus to the toast viewport.\n * @defaultValue ['F8']\n */\n hotkey?: string[];\n /**\n * An author-localized label for the toast viewport to provide context for screen reader users\n * when navigating page landmarks. The available `{hotkey}` placeholder will be replaced for you.\n * @defaultValue 'Notifications ({hotkey})'\n */\n label?: string;\n}\n\nconst ToastViewport = React.forwardRef<ToastViewportElement, ToastViewportProps>(\n (props: ScopedProps<ToastViewportProps>, forwardedRef) => {\n const {\n __scopeToast,\n hotkey = VIEWPORT_DEFAULT_HOTKEY,\n label = 'Notifications ({hotkey})',\n ...viewportProps\n } = props;\n const context = useToastProviderContext(VIEWPORT_NAME, __scopeToast);\n const wrapperRef = React.useRef<HTMLDivElement>(null);\n const ref = React.useRef<ToastViewportElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref, context.onViewportChange);\n const hotkeyLabel = hotkey.join('+').replace(/Key/g, '').replace(/Digit/g, '');\n\n React.useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n // we use `event.code` as it is consistent regardless of meta keys that were pressed.\n // for example, `event.key` for `Control+Alt+t` is `†` and `t !== †`\n const isHotkeyPressed = hotkey.every((key) => (event as any)[key] || event.code === key);\n if (isHotkeyPressed) ref.current?.focus();\n };\n document.addEventListener('keydown', handleKeyDown);\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [hotkey]);\n\n React.useEffect(() => {\n const wrapper = wrapperRef.current;\n const viewport = ref.current;\n if (wrapper && viewport) {\n const handlePause = () => {\n const pauseEvent = new CustomEvent(VIEWPORT_PAUSE);\n viewport.dispatchEvent(pauseEvent);\n context.isClosePausedRef.current = true;\n };\n\n const handleResume = () => {\n const resumeEvent = new CustomEvent(VIEWPORT_RESUME);\n viewport.dispatchEvent(resumeEvent);\n context.isClosePausedRef.current = false;\n };\n\n // Toasts are not in the viewport React tree so we need to bind DOM events\n wrapper.addEventListener('focusin', handlePause);\n wrapper.addEventListener('focusout', handleResume);\n wrapper.addEventListener('pointerenter', handlePause);\n wrapper.addEventListener('pointerleave', handleResume);\n window.addEventListener('blur', handlePause);\n window.addEventListener('focus', handleResume);\n return () => {\n wrapper.removeEventListener('focusin', handlePause);\n wrapper.removeEventListener('focusout', handleResume);\n wrapper.removeEventListener('pointerenter', handlePause);\n wrapper.removeEventListener('pointerleave', handleResume);\n window.removeEventListener('blur', handlePause);\n window.removeEventListener('focus', handleResume);\n };\n }\n }, [context.isClosePausedRef]);\n\n React.useEffect(() => {\n const viewport = ref.current;\n // Re-order DOM so most recent toasts are at top of DOM structure to improve tab order\n if (viewport) {\n const prepended: Set<Node> = new Set();\n const observer = new MutationObserver((mutations) => {\n const addedNodes = mutations\n .map((mutation) => Array.from(mutation.addedNodes))\n .reduce((a, b) => a.concat(b));\n\n addedNodes.forEach((node) => {\n // mutation will immediately fire again when we prepend so we only prepend if\n // it hasn't just prepended.\n if (!prepended.has(node)) {\n viewport.prepend(node);\n prepended.add(node);\n } else {\n // this else catches the case where the mutation fires immediately after prepend.\n // we remove from cache after it prepends to allow observer to catch future updates\n // to DOM order, e.g. if `key` changes for a toast and is reportalled to bottom.\n prepended.delete(node);\n }\n });\n });\n observer.observe(viewport, { childList: true });\n return () => observer.disconnect();\n }\n }, []);\n\n return (\n <DismissableLayer.Branch\n ref={wrapperRef}\n role=\"region\"\n aria-label={label.replace('{hotkey}', hotkeyLabel)}\n // Ensure virtual cursor from landmarks menus triggers focus/blur for pause/resume\n tabIndex={-1}\n // incase list has size when empty (e.g. padding), we remove pointer events so\n // it doesn't prevent interactions with page elements that it overlays\n style={{ pointerEvents: context.toastCount > 0 ? undefined : 'none' }}\n >\n {/**\n * tabindex on the the list so that it can be focused when items are removed. we focus\n * the list instead of the viewport so it announces number of items remaining.\n */}\n <Primitive.ol tabIndex={-1} {...viewportProps} ref={composedRefs} />\n </DismissableLayer.Branch>\n );\n }\n);\n\nToastViewport.displayName = VIEWPORT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * Toast\n * -----------------------------------------------------------------------------------------------*/\n\nconst TOAST_NAME = 'Toast';\nconst TOAST_SWIPE_START = 'toast.swipeStart';\nconst TOAST_SWIPE_MOVE = 'toast.swipeMove';\nconst TOAST_SWIPE_CANCEL = 'toast.swipeCancel';\nconst TOAST_SWIPE_END = 'toast.swipeEnd';\n\ntype ToastElement = ToastImplElement;\ninterface ToastProps extends Omit<ToastImplProps, keyof ToastImplPrivateProps> {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst Toast = React.forwardRef<ToastElement, ToastProps>(\n (props: ScopedProps<ToastProps>, forwardedRef) => {\n const { forceMount, open: openProp, defaultOpen, onOpenChange, ...toastProps } = props;\n const [open = true, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n return (\n <Presence present={forceMount || open}>\n <ToastImpl\n open={open}\n {...toastProps}\n ref={forwardedRef}\n onClose={() => setOpen(false)}\n onSwipeStart={composeEventHandlers(props.onSwipeStart, (event) => {\n event.currentTarget.setAttribute('data-swipe', 'start');\n })}\n onSwipeMove={composeEventHandlers(props.onSwipeMove, (event) => {\n const { x, y } = event.detail.delta;\n event.currentTarget.setAttribute('data-swipe', 'move');\n event.currentTarget.style.setProperty('--radix-toast-swipe-move-x', `${x}px`);\n event.currentTarget.style.setProperty('--radix-toast-swipe-move-y', `${y}px`);\n })}\n onSwipeCancel={composeEventHandlers(props.onSwipeCancel, (event) => {\n event.currentTarget.setAttribute('data-swipe', 'cancel');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-move-x');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-move-y');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-end-x');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-end-y');\n })}\n onSwipeEnd={composeEventHandlers(props.onSwipeEnd, (event) => {\n const { x, y } = event.detail.delta;\n event.currentTarget.setAttribute('data-swipe', 'end');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-move-x');\n event.currentTarget.style.removeProperty('--radix-toast-swipe-move-y');\n event.currentTarget.style.setProperty('--radix-toast-swipe-end-x', `${x}px`);\n event.currentTarget.style.setProperty('--radix-toast-swipe-end-y', `${y}px`);\n setOpen(false);\n })}\n />\n </Presence>\n );\n }\n);\n\nToast.displayName = TOAST_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype SwipeEvent = { currentTarget: EventTarget & ToastElement } & Omit<\n CustomEvent<{ originalEvent: React.PointerEvent; delta: { x: number; y: number } }>,\n 'currentTarget'\n>;\n\nconst [ToastInteractiveProvider, useToastInteractiveContext] = createToastContext(TOAST_NAME, {\n isInteractive: false,\n onClose() {},\n});\n\ntype ToastImplElement = React.ElementRef<typeof Primitive.li>;\ntype DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer.Root>;\ntype ToastImplPrivateProps = { open: boolean; onClose(): void };\ntype PrimitiveListItemProps = Radix.ComponentPropsWithoutRef<typeof Primitive.li>;\ninterface ToastImplProps extends ToastImplPrivateProps, PrimitiveListItemProps {\n type?: 'foreground' | 'background';\n /**\n * Time in milliseconds that toast should remain visible for. Overrides value\n * given to `ToastProvider`.\n */\n duration?: number;\n onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];\n onSwipeStart?(event: SwipeEvent): void;\n onSwipeMove?(event: SwipeEvent): void;\n onSwipeCancel?(event: SwipeEvent): void;\n onSwipeEnd?(event: SwipeEvent): void;\n}\n\nconst ToastImpl = React.forwardRef<ToastImplElement, ToastImplProps>(\n (props: ScopedProps<ToastImplProps>, forwardedRef) => {\n const {\n __scopeToast,\n children,\n type = 'foreground',\n duration: durationProp,\n open,\n onClose,\n onEscapeKeyDown,\n onSwipeStart,\n onSwipeMove,\n onSwipeCancel,\n onSwipeEnd,\n ...toastProps\n } = props;\n const context = useToastProviderContext(TOAST_NAME, __scopeToast);\n const ref = React.useRef<ToastImplElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const pointerStartRef = React.useRef<{ x: number; y: number } | null>(null);\n const swipeDeltaRef = React.useRef<{ x: number; y: number } | null>(null);\n const duration = durationProp || context.duration;\n const closeTimerStartTimeRef = React.useRef(0);\n const closeTimerRemainingTimeRef = React.useRef(duration);\n const closeTimerRef = React.useRef(0);\n const [renderLabel, setRenderLabel] = React.useState(false);\n const { onToastAdd, onToastRemove } = context;\n const handleClose = useCallbackRef(() => {\n // focus viewport if focus is within toast to read the remaining toast\n // count to SR users and ensure focus isn't lost\n const isFocusInToast = ref.current?.contains(document.activeElement);\n if (isFocusInToast) context.viewport?.focus();\n onClose();\n });\n\n const startTimer = React.useCallback(\n (duration: number) => {\n if (!duration || duration === Infinity) return;\n window.clearTimeout(closeTimerRef.current);\n closeTimerStartTimeRef.current = new Date().getTime();\n closeTimerRef.current = window.setTimeout(handleClose, duration);\n },\n [handleClose]\n );\n\n React.useEffect(() => {\n const viewport = context.viewport;\n if (viewport) {\n const handleResume = () => {\n startTimer(closeTimerRemainingTimeRef.current);\n };\n const handlePause = () => {\n const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.current;\n closeTimerRemainingTimeRef.current = closeTimerRemainingTimeRef.current - elapsedTime;\n window.clearTimeout(closeTimerRef.current);\n };\n viewport.addEventListener(VIEWPORT_PAUSE, handlePause);\n viewport.addEventListener(VIEWPORT_RESUME, handleResume);\n return () => {\n viewport.removeEventListener(VIEWPORT_PAUSE, handlePause);\n viewport.removeEventListener(VIEWPORT_RESUME, handleResume);\n };\n }\n }, [context.viewport, duration, startTimer]);\n\n // start timer when toast opens or duration changes.\n // we include `open` in deps because closed !== unmounted when animating\n // so it could reopen before being completely unmounted\n React.useEffect(() => {\n if (open && !context.isClosePausedRef.current) startTimer(duration);\n }, [open, duration, context.isClosePausedRef, startTimer]);\n\n React.useEffect(() => {\n onToastAdd();\n return () => onToastRemove();\n }, [onToastAdd, onToastRemove]);\n\n // render label in the next frame to trigger toast announcement in NVDA\n useNextFrame(() => setRenderLabel(true));\n\n if (!context.viewport) return null;\n\n return (\n <>\n <ToastInteractiveProvider scope={__scopeToast} isInteractive onClose={handleClose}>\n {ReactDOM.createPortal(\n <DismissableLayer.Root\n asChild\n onEscapeKeyDown={composeEventHandlers(onEscapeKeyDown, () => {\n if (!context.isFocusedToastEscapeKeyDownRef.current) handleClose();\n context.isFocusedToastEscapeKeyDownRef.current = false;\n })}\n >\n <Primitive.li\n role=\"status\"\n aria-live={type === 'foreground' ? 'assertive' : 'polite'}\n aria-atomic\n // Prevent voice over from announcing before the label is rendered\n aria-hidden={!renderLabel || undefined}\n tabIndex={0}\n data-state={open ? 'open' : 'closed'}\n data-swipe-direction={context.swipeDirection}\n {...toastProps}\n ref={composedRefs}\n style={{ userSelect: 'none', touchAction: 'none', ...props.style }}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (event.key !== 'Escape') return;\n onEscapeKeyDown?.(event.nativeEvent);\n if (!event.nativeEvent.defaultPrevented) {\n context.isFocusedToastEscapeKeyDownRef.current = true;\n handleClose();\n }\n })}\n onPointerDown={composeEventHandlers(props.onPointerDown, (event) => {\n if (event.button !== 0) return;\n pointerStartRef.current = { x: event.clientX, y: event.clientY };\n })}\n onPointerMove={composeEventHandlers(props.onPointerMove, (event) => {\n if (!pointerStartRef.current) return;\n const x = event.clientX - pointerStartRef.current.x;\n const y = event.clientY - pointerStartRef.current.y;\n const hasSwipeMoveStarted = Boolean(swipeDeltaRef.current);\n const isHorizontalSwipe = ['left', 'right'].includes(context.swipeDirection);\n const clamp = ['left', 'up'].includes(context.swipeDirection)\n ? Math.min\n : Math.max;\n const clampedX = isHorizontalSwipe ? clamp(0, x) : 0;\n const clampedY = !isHorizontalSwipe ? clamp(0, y) : 0;\n const moveStartBuffer = event.pointerType === 'touch' ? 10 : 2;\n const delta = { x: clampedX, y: clampedY };\n const eventDetail = { originalEvent: event, delta };\n if (hasSwipeMoveStarted) {\n swipeDeltaRef.current = delta;\n handleAndDispatchCustomEvent(TOAST_SWIPE_MOVE, onSwipeMove, eventDetail, {\n discrete: false,\n });\n } else if (isDeltaInDirection(delta, context.swipeDirection, moveStartBuffer)) {\n swipeDeltaRef.current = delta;\n handleAndDispatchCustomEvent(TOAST_SWIPE_START, onSwipeStart, eventDetail, {\n discrete: false,\n });\n (event.target as HTMLElement).setPointerCapture(event.pointerId);\n } else if (Math.abs(x) > moveStartBuffer || Math.abs(y) > moveStartBuffer) {\n // User is swiping in wrong direction so we disable swipe gesture\n // for the current pointer down interaction\n pointerStartRef.current = null;\n }\n })}\n onPointerUp={composeEventHandlers(props.onPointerUp, (event) => {\n const delta = swipeDeltaRef.current;\n (event.target as HTMLElement).releasePointerCapture(event.pointerId);\n swipeDeltaRef.current = null;\n pointerStartRef.current = null;\n if (delta) {\n const toast = event.currentTarget;\n const eventDetail = { originalEvent: event, delta };\n if (isDeltaInDirection(delta, context.swipeDirection, context.swipeThreshold)) {\n handleAndDispatchCustomEvent(TOAST_SWIPE_END, onSwipeEnd, eventDetail, {\n discrete: true,\n });\n } else {\n handleAndDispatchCustomEvent(TOAST_SWIPE_CANCEL, onSwipeCancel, eventDetail, {\n discrete: true,\n });\n }\n // Prevent click event from triggering on items within the toast when\n // pointer up is part of a swipe gesture\n toast.addEventListener('click', (event) => event.preventDefault(), {\n once: true,\n });\n }\n })}\n >\n <VisuallyHidden>{renderLabel && context.label}</VisuallyHidden>\n <Slottable>{children}</Slottable>\n </Primitive.li>\n </DismissableLayer.Root>,\n context.viewport\n )}\n </ToastInteractiveProvider>\n </>\n );\n }\n);\n\nToastImpl.propTypes = {\n type(props) {\n if (props.type && !['foreground', 'background'].includes(props.type)) {\n const error = `Invalid prop \\`type\\` supplied to \\`${TOAST_NAME}\\`. Expected \\`foreground | background\\`.`;\n return new Error(error);\n }\n return null;\n },\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ToastTitle\n * -----------------------------------------------------------------------------------------------*/\n\nconst TITLE_NAME = 'ToastTitle';\n\ntype ToastTitleElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface ToastTitleProps extends PrimitiveDivProps {}\n\nconst ToastTitle = React.forwardRef<ToastTitleElement, ToastTitleProps>(\n (props: ScopedProps<ToastTitleProps>, forwardedRef) => {\n const { __scopeToast, ...titleProps } = props;\n return <Primitive.div {...titleProps} ref={forwardedRef} />;\n }\n);\n\nToastTitle.displayName = TITLE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToastDescription\n * -----------------------------------------------------------------------------------------------*/\n\nconst DESCRIPTION_NAME = 'ToastDescription';\n\ntype ToastDescriptionElement = React.ElementRef<typeof Primitive.div>;\ninterface ToastDescriptionProps extends PrimitiveDivProps {}\n\nconst ToastDescription = React.forwardRef<ToastDescriptionElement, ToastDescriptionProps>(\n (props: ScopedProps<ToastDescriptionProps>, forwardedRef) => {\n const { __scopeToast, ...descriptionProps } = props;\n return <Primitive.div {...descriptionProps} ref={forwardedRef} />;\n }\n);\n\nToastDescription.displayName = DESCRIPTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToastAction\n * -----------------------------------------------------------------------------------------------*/\n\nconst ACTION_NAME = 'ToastAction';\n\ntype ToastActionElement = ToastCloseElement;\ninterface ToastActionProps extends ToastCloseProps {\n /**\n * A short description for an alternate way to carry out the action. For screen reader users\n * who will not be able to navigate to the button easily/quickly.\n * @example <ToastAction altText=\"Goto account settings to updgrade\">Upgrade</ToastAction>\n * @example <ToastAction altText=\"Undo (Alt+U)\">Undo</ToastAction>\n */\n altText: string;\n}\n\nconst ToastAction = React.forwardRef<ToastActionElement, ToastActionProps>(\n (props: ScopedProps<ToastActionProps>, forwardedRef) => {\n const { altText, ...actionProps } = props;\n const context = useToastInteractiveContext(ACTION_NAME, props.__scopeToast);\n if (!altText) return null;\n return context.isInteractive ? (\n <ToastClose {...actionProps} ref={forwardedRef} />\n ) : (\n <span>{altText}</span>\n );\n }\n);\n\nToastAction.propTypes = {\n altText(props) {\n if (!props.altText) {\n return new Error(`Missing prop \\`altText\\` expected on \\`${ACTION_NAME}\\``);\n }\n return null;\n },\n};\n\nToastAction.displayName = ACTION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ToastClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'ToastClose';\n\ntype ToastCloseElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface ToastCloseProps extends PrimitiveButtonProps {}\n\nconst ToastClose = React.forwardRef<ToastCloseElement, ToastCloseProps>(\n (props: ScopedProps<ToastCloseProps>, forwardedRef) => {\n const { __scopeToast, ...closeProps } = props;\n const interactiveContext = useToastInteractiveContext(CLOSE_NAME, __scopeToast);\n return interactiveContext.isInteractive ? (\n <Primitive.button\n type=\"button\"\n {...closeProps}\n ref={forwardedRef}\n onClick={composeEventHandlers(props.onClick, interactiveContext.onClose)}\n />\n ) : null;\n }\n);\n\nToastClose.displayName = CLOSE_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\nfunction handleAndDispatchCustomEvent<\n E extends CustomEvent,\n ReactEvent extends React.SyntheticEvent\n>(\n name: string,\n handler: ((event: E) => void) | undefined,\n detail: { originalEvent: ReactEvent } & (E extends CustomEvent<infer D> ? D : never),\n { discrete }: { discrete: boolean }\n) {\n const currentTarget = detail.originalEvent.currentTarget as HTMLElement;\n const event = new CustomEvent(name, { bubbles: true, cancelable: true, detail });\n if (handler) currentTarget.addEventListener(name, handler as EventListener, { once: true });\n\n if (discrete) {\n dispatchDiscreteCustomEvent(currentTarget, event);\n } else {\n currentTarget.dispatchEvent(event);\n }\n}\n\nconst isDeltaInDirection = (\n delta: { x: number; y: number },\n direction: SwipeDirection,\n threshold = 0\n) => {\n const deltaX = Math.abs(delta.x);\n const deltaY = Math.abs(delta.y);\n const isDeltaX = deltaX > deltaY;\n if (direction === 'left' || direction === 'right') {\n return isDeltaX && deltaX > threshold;\n } else {\n return !isDeltaX && deltaY > threshold;\n }\n};\n\nfunction useNextFrame(callback = () => {}) {\n const fn = useCallbackRef(callback);\n useLayoutEffect(() => {\n let raf1 = 0;\n let raf2 = 0;\n raf1 = window.requestAnimationFrame(() => (raf2 = window.requestAnimationFrame(fn)));\n return () => {\n window.cancelAnimationFrame(raf1);\n window.cancelAnimationFrame(raf2);\n };\n }, [fn]);\n}\n\nconst Provider = ToastProvider;\nconst Viewport = ToastViewport;\nconst Root = Toast;\nconst Title = ToastTitle;\nconst Description = ToastDescription;\nconst Action = ToastAction;\nconst Close = ToastClose;\n\nexport {\n createToastScope,\n //\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastAction,\n ToastClose,\n //\n Provider,\n Viewport,\n Root,\n Title,\n Description,\n Action,\n Close,\n};\nexport type {\n ToastProviderProps,\n ToastViewportProps,\n ToastProps,\n ToastTitleProps,\n ToastDescriptionProps,\n ToastActionProps,\n ToastCloseProps,\n};\n"],"names":["React","ReactDOM","composeEventHandlers","useComposedRefs","createContextScope","DismissableLayer","Presence","Primitive","dispatchDiscreteCustomEvent","Slottable","useCallbackRef","useControllableState","useLayoutEffect","VisuallyHidden","PROVIDER_NAME","createToastContext","createToastScope","ToastProviderProvider","useToastProviderContext","ToastProvider","props","__scopeToast","label","duration","swipeDirection","swipeThreshold","children","viewport","setViewport","useState","toastCount","setToastCount","isFocusedToastEscapeKeyDownRef","useRef","isClosePausedRef","useCallback","prevCount","propTypes","trim","error","Error","VIEWPORT_NAME","VIEWPORT_DEFAULT_HOTKEY","VIEWPORT_PAUSE","VIEWPORT_RESUME","ToastViewport","forwardRef","forwardedRef","hotkey","viewportProps","context","wrapperRef","ref","composedRefs","onViewportChange","hotkeyLabel","join","replace","useEffect","handleKeyDown","event","isHotkeyPressed","every","key","code","current","focus","document","addEventListener","removeEventListener","wrapper","handlePause","pauseEvent","CustomEvent","dispatchEvent","handleResume","resumeEvent","window","prepended","Set","observer","MutationObserver","mutations","addedNodes","map","mutation","Array","from","reduce","a","b","concat","forEach","node","has","prepend","add","delete","observe","childList","disconnect","pointerEvents","undefined","TOAST_NAME","TOAST_SWIPE_START","TOAST_SWIPE_MOVE","TOAST_SWIPE_CANCEL","TOAST_SWIPE_END","Toast","forceMount","open","openProp","defaultOpen","onOpenChange","toastProps","setOpen","prop","defaultProp","onChange","onSwipeStart","currentTarget","setAttribute","onSwipeMove","x","y","detail","delta","style","setProperty","onSwipeCancel","removeProperty","onSwipeEnd","ToastInteractiveProvider","useToastInteractiveContext","isInteractive","onClose","ToastImpl","type","durationProp","onEscapeKeyDown","pointerStartRef","swipeDeltaRef","closeTimerStartTimeRef","closeTimerRemainingTimeRef","closeTimerRef","renderLabel","setRenderLabel","onToastAdd","onToastRemove","handleClose","isFocusInToast","contains","activeElement","startTimer","Infinity","clearTimeout","Date","getTime","setTimeout","elapsedTime","useNextFrame","createPortal","userSelect","touchAction","onKeyDown","nativeEvent","defaultPrevented","onPointerDown","button","clientX","clientY","onPointerMove","hasSwipeMoveStarted","Boolean","isHorizontalSwipe","includes","clamp","Math","min","max","clampedX","clampedY","moveStartBuffer","pointerType","eventDetail","originalEvent","handleAndDispatchCustomEvent","discrete","isDeltaInDirection","target","setPointerCapture","pointerId","abs","onPointerUp","releasePointerCapture","toast","preventDefault","once","TITLE_NAME","ToastTitle","titleProps","DESCRIPTION_NAME","ToastDescription","descriptionProps","ACTION_NAME","ToastAction","altText","actionProps","CLOSE_NAME","ToastClose","closeProps","interactiveContext","onClick","name","handler","bubbles","cancelable","direction","threshold","deltaX","deltaY","isDeltaX","callback","fn","raf1","raf2","requestAnimationFrame","cancelAnimationFrame","Provider","Viewport","Root","Title","Description","Action","Close"],"version":3,"file":"index.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ui/react-toast",
3
- "version": "0.1.2-rc.46",
3
+ "version": "0.1.2-rc.49",
4
4
  "license": "MIT",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -18,16 +18,16 @@
18
18
  "dependencies": {
19
19
  "@babel/runtime": "^7.13.10",
20
20
  "@radix-ui/primitive": "0.1.0",
21
- "@radix-ui/react-compose-refs": "0.1.1-rc.36",
22
- "@radix-ui/react-context": "0.1.2-rc.36",
23
- "@radix-ui/react-dismissable-layer": "0.1.6-rc.36",
24
- "@radix-ui/react-portal": "0.1.5-rc.36",
25
- "@radix-ui/react-presence": "0.1.3-rc.36",
26
- "@radix-ui/react-primitive": "0.1.5-rc.36",
27
- "@radix-ui/react-use-callback-ref": "0.1.1-rc.36",
28
- "@radix-ui/react-use-controllable-state": "0.1.1-rc.36",
29
- "@radix-ui/react-use-layout-effect": "0.1.1-rc.36",
30
- "@radix-ui/react-visually-hidden": "0.1.5-rc.36"
21
+ "@radix-ui/react-compose-refs": "0.1.1-rc.39",
22
+ "@radix-ui/react-context": "0.1.2-rc.39",
23
+ "@radix-ui/react-dismissable-layer": "0.1.6-rc.39",
24
+ "@radix-ui/react-presence": "0.1.3-rc.39",
25
+ "@radix-ui/react-primitive": "0.1.5-rc.39",
26
+ "@radix-ui/react-slot": "0.1.3-rc.39",
27
+ "@radix-ui/react-use-callback-ref": "0.1.1-rc.39",
28
+ "@radix-ui/react-use-controllable-state": "0.1.1-rc.39",
29
+ "@radix-ui/react-use-layout-effect": "0.1.1-rc.39",
30
+ "@radix-ui/react-visually-hidden": "0.1.5-rc.39"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": "^16.8 || ^17.0 || ^18.0",