@radix-ui/react-toast 0.1.2-rc.52 → 0.1.2-rc.55

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":";;;;AA0BA,sBAAsB,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAgBvD,OAAA,uFAAmG,CAAC;AAIpG;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,CAiC/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,0GAuKL,CAAC;AAiDF,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,EAA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AAO,UAAU,MAAM,CAAC,CAAC;AACpF,gCAA0B,SAAQ,oBAAoB;CAAG;AAEzD,OAAA,MAAM,qGAaL,CAAC;AA4FF,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 {\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} from './Toast';\nexport type {\n ToastProviderProps,\n ToastViewportProps,\n ToastProps,\n ToastTitleProps,\n ToastDescriptionProps,\n ToastActionProps,\n ToastCloseProps,\n} from './Toast';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
1
+ {"mappings":";;;;AA0BA,sBAAsB,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAgBvD,OAAA,uFAAmG,CAAC;AAIpG;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,CAiC/C,CAAC;AAwBF,iCAAiC,MAAM,wBAAwB,CAAC,OAAO,UAAU,EAAE,CAAC,CAAC;AACrF,mCAA6B,S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AC,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACvC,WAAW,CAAC,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACtC,aAAa,CAAC,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACxC,UAAU,CAAC,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;CACtC;AAoQD,yBAAyB,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;AAiHF,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 {\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} from './Toast';\nexport type {\n ToastProviderProps,\n ToastViewportProps,\n ToastProps,\n ToastTitleProps,\n ToastDescriptionProps,\n ToastActionProps,\n ToastCloseProps,\n} from './Toast';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
package/dist/index.js CHANGED
@@ -6,9 +6,9 @@ var $iTyic$radixuireactcomposerefs = require("@radix-ui/react-compose-refs");
6
6
  var $iTyic$radixuireactcollection = require("@radix-ui/react-collection");
7
7
  var $iTyic$radixuireactcontext = require("@radix-ui/react-context");
8
8
  var $iTyic$radixuireactdismissablelayer = require("@radix-ui/react-dismissable-layer");
9
+ var $iTyic$radixuireactportal = require("@radix-ui/react-portal");
9
10
  var $iTyic$radixuireactpresence = require("@radix-ui/react-presence");
10
11
  var $iTyic$radixuireactprimitive = require("@radix-ui/react-primitive");
11
- var $iTyic$radixuireactslot = require("@radix-ui/react-slot");
12
12
  var $iTyic$radixuireactusecallbackref = require("@radix-ui/react-use-callback-ref");
13
13
  var $iTyic$radixuireactusecontrollablestate = require("@radix-ui/react-use-controllable-state");
14
14
  var $iTyic$radixuireactuselayouteffect = require("@radix-ui/react-use-layout-effect");
@@ -338,7 +338,7 @@ const $9208a85b3e79d33f$export$8d8dc7d5f743331b = /*#__PURE__*/ $iTyic$react.for
338
338
  onClose () {}
339
339
  });
340
340
  const $9208a85b3e79d33f$var$ToastImpl = /*#__PURE__*/ $iTyic$react.forwardRef((props, forwardedRef)=>{
341
- 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;
341
+ const { __scopeToast: __scopeToast , type: type = 'foreground' , duration: durationProp , open: open , onClose: onClose , onEscapeKeyDown: onEscapeKeyDown , onSwipeStart: onSwipeStart , onSwipeMove: onSwipeMove , onSwipeCancel: onSwipeCancel , onSwipeEnd: onSwipeEnd , ...toastProps } = props;
342
342
  const context = $9208a85b3e79d33f$var$useToastProviderContext($9208a85b3e79d33f$var$TOAST_NAME, __scopeToast);
343
343
  const ref = $iTyic$react.useRef(null);
344
344
  const composedRefs = $iTyic$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref);
@@ -348,7 +348,6 @@ const $9208a85b3e79d33f$var$ToastImpl = /*#__PURE__*/ $iTyic$react.forwardRef((p
348
348
  const closeTimerStartTimeRef = $iTyic$react.useRef(0);
349
349
  const closeTimerRemainingTimeRef = $iTyic$react.useRef(duration1);
350
350
  const closeTimerRef = $iTyic$react.useRef(0);
351
- const [renderLabel, setRenderLabel] = $iTyic$react.useState(false);
352
351
  const { onToastAdd: onToastAdd , onToastRemove: onToastRemove } = context;
353
352
  const handleClose = $iTyic$radixuireactusecallbackref.useCallbackRef(()=>{
354
353
  var _ref$current2, _context$viewport2;
@@ -406,11 +405,15 @@ const $9208a85b3e79d33f$var$ToastImpl = /*#__PURE__*/ $iTyic$react.forwardRef((p
406
405
  }, [
407
406
  onToastAdd,
408
407
  onToastRemove
409
- ]); // render label in the next frame to trigger toast announcement in NVDA
410
- $9208a85b3e79d33f$var$useNextFrame(()=>setRenderLabel(true)
411
- );
408
+ ]);
412
409
  if (!context.viewport) return null;
413
- return /*#__PURE__*/ $iTyic$react.createElement($iTyic$react.Fragment, null, /*#__PURE__*/ $iTyic$react.createElement($9208a85b3e79d33f$var$ToastInteractiveProvider, {
410
+ return /*#__PURE__*/ $iTyic$react.createElement($iTyic$react.Fragment, null, /*#__PURE__*/ $iTyic$react.createElement($9208a85b3e79d33f$var$ToastAnnounce, {
411
+ __scopeToast: __scopeToast // Toasts are always role=status to avoid stuttering issues with role=alert in SRs.
412
+ ,
413
+ role: "status",
414
+ "aria-live": type === 'foreground' ? 'assertive' : 'polite',
415
+ "aria-atomic": true
416
+ }, props.children), /*#__PURE__*/ $iTyic$react.createElement($9208a85b3e79d33f$var$ToastInteractiveProvider, {
414
417
  scope: __scopeToast,
415
418
  isInteractive: true,
416
419
  onClose: handleClose
@@ -423,11 +426,6 @@ const $9208a85b3e79d33f$var$ToastImpl = /*#__PURE__*/ $iTyic$react.forwardRef((p
423
426
  context.isFocusedToastEscapeKeyDownRef.current = false;
424
427
  })
425
428
  }, /*#__PURE__*/ $iTyic$react.createElement($iTyic$radixuireactprimitive.Primitive.li, ($parcel$interopDefault($iTyic$babelruntimehelpersextends))({
426
- role: "status",
427
- "aria-live": type === 'foreground' ? 'assertive' : 'polite',
428
- "aria-atomic": true // Prevent voice over from announcing before the label is rendered
429
- ,
430
- "aria-hidden": !renderLabel || undefined,
431
429
  tabIndex: 0,
432
430
  "data-state": open ? 'open' : 'closed',
433
431
  "data-swipe-direction": context.swipeDirection
@@ -517,7 +515,7 @@ const $9208a85b3e79d33f$var$ToastImpl = /*#__PURE__*/ $iTyic$react.forwardRef((p
517
515
  });
518
516
  }
519
517
  })
520
- }), /*#__PURE__*/ $iTyic$react.createElement($iTyic$radixuireactvisuallyhidden.VisuallyHidden, null, renderLabel && context.label), /*#__PURE__*/ $iTyic$react.createElement($iTyic$radixuireactslot.Slottable, null, children)))), context.viewport)));
518
+ })))), context.viewport)));
521
519
  });
522
520
  $9208a85b3e79d33f$var$ToastImpl.propTypes = {
523
521
  type (props) {
@@ -531,6 +529,38 @@ $9208a85b3e79d33f$var$ToastImpl.propTypes = {
531
529
  return null;
532
530
  }
533
531
  };
532
+ /* -----------------------------------------------------------------------------------------------*/ const $9208a85b3e79d33f$var$ToastAnnounce = (props)=>{
533
+ const { __scopeToast: __scopeToast , children: children , ...announceProps } = props;
534
+ const context = $9208a85b3e79d33f$var$useToastProviderContext($9208a85b3e79d33f$var$TOAST_NAME, __scopeToast);
535
+ const [renderAnnounceText, setRenderAnnounceText] = $iTyic$react.useState(false);
536
+ const [isAnnounced, setIsAnnounced] = $iTyic$react.useState(false);
537
+ const [fragment, setFragment] = $iTyic$react.useState();
538
+ const [rootFragmentNode, setRootFragmentNode] = $iTyic$react.useState(null); // We portal children into a document fragment so that we can extract the bare text nodes
539
+ // before rendering to the DOM. This avoids issues with duplicate `children`
540
+ // and animation libraries when composing via `asChild`.
541
+ const announceTextContent = $iTyic$react.useMemo(()=>{
542
+ return rootFragmentNode ? $9208a85b3e79d33f$var$getAnnounceTextContent(rootFragmentNode) : null;
543
+ }, [
544
+ rootFragmentNode
545
+ ]); // setting the fragment in `useLayoutEffect` as `DocumentFragment` doesn't exist on the server
546
+ $iTyic$radixuireactuselayouteffect.useLayoutEffect(()=>{
547
+ setFragment(new DocumentFragment());
548
+ }, []); // render text content in the next frame to ensure toast is announced in NVDA
549
+ $9208a85b3e79d33f$var$useNextFrame(()=>setRenderAnnounceText(true)
550
+ );
551
+ $iTyic$react.useEffect(()=>{
552
+ const timer = window.setTimeout(()=>setIsAnnounced(true)
553
+ , 1000);
554
+ return ()=>window.clearTimeout(timer)
555
+ ;
556
+ }, []);
557
+ return isAnnounced ? null : /*#__PURE__*/ $iTyic$react.createElement($iTyic$react.Fragment, null, fragment && /*#__PURE__*/ $iTyic$react.createElement($iTyic$radixuireactportal.Portal, {
558
+ container: fragment,
559
+ ref: setRootFragmentNode
560
+ }, context.label, " ", children), /*#__PURE__*/ $iTyic$react.createElement($iTyic$radixuireactportal.Portal, {
561
+ asChild: true
562
+ }, /*#__PURE__*/ $iTyic$react.createElement($iTyic$radixuireactvisuallyhidden.VisuallyHidden, announceProps, renderAnnounceText && announceTextContent)));
563
+ };
534
564
  /* -------------------------------------------------------------------------------------------------
535
565
  * ToastTitle
536
566
  * -----------------------------------------------------------------------------------------------*/ const $9208a85b3e79d33f$var$TITLE_NAME = 'ToastTitle';
@@ -626,6 +656,22 @@ function $9208a85b3e79d33f$var$useNextFrame(callback = ()=>{}) {
626
656
  fn
627
657
  ]);
628
658
  }
659
+ function $9208a85b3e79d33f$var$getAnnounceTextContent(container) {
660
+ const textContent = [];
661
+ const childNodes = Array.from(container.childNodes);
662
+ childNodes.forEach((node)=>{
663
+ if (node.nodeType === node.TEXT_NODE && node.textContent) textContent.push(node.textContent);
664
+ if ($9208a85b3e79d33f$var$isHTMLElement(node)) {
665
+ const isHidden = node.ariaHidden || node.hidden || node.style.display === 'none';
666
+ if (!isHidden) textContent.push(...$9208a85b3e79d33f$var$getAnnounceTextContent(node));
667
+ }
668
+ }); // We return a collection of text rather than a single concatenated string.
669
+ // This allows SR VO to naturally pause break between nodes while announcing.
670
+ return textContent;
671
+ }
672
+ function $9208a85b3e79d33f$var$isHTMLElement(node) {
673
+ return node.nodeType === node.ELEMENT_NODE;
674
+ }
629
675
  /**
630
676
  * Returns a list of potential tabbable candidates.
631
677
  *
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A;;;;;;;;;;;;;;;ACkBA;;oGAEA,CAEA,MAAM8B,mCAAa,GAAG,eAAtB,AAAA;AAEA,MAAM,CAACC,gCAAD,EAAaC,mCAAb,EAA4BC,2CAA5B,CAAA,GAAqDd,8CAAgB,CAAe,OAAf,CAA3E,AAAA;AAkBA,MAAM,CAACe,wCAAD,EAAqBlC,yCAArB,CAAA,GAAyCoB,6CAAkB,CAAC,OAAD,EAAU;IAACa,2CAAD;CAAV,CAAjE,AAAA;AACA,MAAM,CAACE,2CAAD,EAAwBC,6CAAxB,CAAA,GACJF,wCAAkB,CAA4BJ,mCAA5B,CADpB,AAAA;AA4BA,MAAM7B,wCAA2C,GAAIoC,CAAAA,KAAD,GAA4C;IAC9F,MAAM,E,cACJC,YADI,CAAA,SAEJC,KAAK,GAAG,cAFJ,aAGJC,QAAQ,GAAG,IAHP,mBAIJC,cAAc,GAAG,OAJb,mBAKJC,cAAc,GAAG,EALb,G,UAMJC,QAAAA,CAAAA,EANI,GAOFN,KAPJ,AAAM;IAQN,MAAM,CAACO,QAAD,EAAWC,WAAX,CAAA,GAA0B9B,qBAAA,CAA4C,IAA5C,CAAhC,AAAA;IACA,MAAM,CAACgC,UAAD,EAAaC,aAAb,CAAA,GAA8BjC,qBAAA,CAAe,CAAf,CAApC,AAAA;IACA,MAAMkC,8BAA8B,G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AI,CAACG,QAAL,IAAiBH,IAAI,CAACI,MAAtB,IAAgCH,aAApC,EAAmD,OAAOJ,UAAU,CAACQ,WAAlB,CAF1B,CAGzB,2EADA;YAEA,yEAAA;YACA,mDAAA;YACA,OAAOL,IAAI,CAACM,QAAL,IAAiB,CAAjB,GAAqBT,UAAU,CAACU,aAAhC,GAAgDV,UAAU,CAACQ,WAAlE,CAAA;SACD;KARY,CAAf,AAA6E;IAU7E,MAAOV,MAAM,CAACa,QAAP,EAAP,CAA0Bd,KAAK,CAACe,IAAN,CAAWd,MAAM,CAACe,WAAlB,CAAA,CAZ2B,CAarD,gFADA;IAEA,uEAAA;IACA,OAAOhB,KAAP,CAAA;CACD;AAED,SAASnI,gCAAT,CAAoBoJ,UAApB,EAA+C;IAC7C,MAAMC,wBAAwB,GAAG1L,QAAQ,CAAC4B,aAA1C,AAAA;IACA,OAAO6J,UAAU,CAACE,IAAX,CAAiBvJ,CAAAA,SAAD,GAAe;QACpC,8FAAA;QACA,IAAIA,SAAS,KAAKsJ,wBAAlB,EAA4C,OAAO,IAAP,CAA5C;QACAtJ,SAAS,CAACrC,KAAV,EAAAqC,CAAAA;QACA,OAAOpC,QAAQ,CAAC4B,aAAT,KAA2B8J,wBAAlC,CAAA;KAJK,CAAP,CAKC;CACF;AAED,MAAMzQ,yCAAQ,GAAGP,wCAAjB,AAAA;AACA,MAAMQ,wCAAQ,GAAGP,yCAAjB,AAAA;AACA,MAAMQ,yCAAI,GAAGP,yCAAb,AAAA;AACA,MAAMQ,yCAAK,GAAGP,wCAAd,AAAA;AACA,MAAMQ,yCAAW,GAAGP,yCAApB,AAAA;AACA,MAAMQ,yCAAM,GAAGP,yCAAf,AAAA;AACA,MAAMQ,yCAAK,GAAGP,yCAAd,AAAA;;ADp1BA","sources":["packages/react/toast/src/index.ts","packages/react/toast/src/Toast.tsx"],"sourcesContent":["export {\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} from './Toast';\nexport type {\n ToastProviderProps,\n ToastViewportProps,\n ToastProps,\n ToastTitleProps,\n ToastDescriptionProps,\n ToastActionProps,\n ToastCloseProps,\n} 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 { createCollection } from '@radix-ui/react-collection';\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\nconst [Collection, useCollection, createCollectionScope] = createCollection<ToastElement>('Toast');\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', [createCollectionScope]);\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 <Collection.Provider scope={__scopeToast}>\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 </Collection.Provider>\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 getItems = useCollection(__scopeToast);\n const wrapperRef = React.useRef<HTMLDivElement>(null);\n const headFocusProxyRef = React.useRef<FocusProxyElement>(null);\n const tailFocusProxyRef = React.useRef<FocusProxyElement>(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 const hasToasts = context.toastCount > 0;\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 const getSortedTabbableCandidates = React.useCallback(\n ({ tabbingDirection }: { tabbingDirection: 'forwards' | 'backwards' }) => {\n const toastItems = getItems();\n const tabbableCandidates = toastItems.map((toastItem) => {\n const toastNode = toastItem.ref.current!;\n const toastTabbableCandidates = [toastNode, ...getTabbableCandidates(toastNode)];\n return tabbingDirection === 'forwards'\n ? toastTabbableCandidates\n : toastTabbableCandidates.reverse();\n });\n return (\n tabbingDirection === 'forwards' ? tabbableCandidates.reverse() : tabbableCandidates\n ).flat();\n },\n [getItems]\n );\n\n React.useEffect(() => {\n const viewport = ref.current;\n // We programmatically manage tabbing as we are unable to influence\n // the source order with portals, this allows us to reverse the\n // tab order so that it runs from most recent toast to least\n if (viewport) {\n const handleKeyDown = (event: KeyboardEvent) => {\n const isMetaKey = event.altKey || event.ctrlKey || event.metaKey;\n const isTabKey = event.key === 'Tab' && !isMetaKey;\n\n if (isTabKey) {\n const focusedElement = document.activeElement;\n const isTabbingBackwards = event.shiftKey;\n const targetIsViewport = event.target === viewport;\n\n // If we're back tabbing after jumping to the viewport then we simply\n // proxy focus out to the preceding document\n if (targetIsViewport && isTabbingBackwards) {\n headFocusProxyRef.current?.focus();\n return;\n }\n\n const tabbingDirection = isTabbingBackwards ? 'backwards' : 'forwards';\n const sortedCandidates = getSortedTabbableCandidates({ tabbingDirection });\n const index = sortedCandidates.findIndex((candidate) => candidate === focusedElement);\n if (focusFirst(sortedCandidates.slice(index + 1))) {\n event.preventDefault();\n } else {\n // If we can't focus that means we're at the edges so we\n // proxy to the corresponding exit point and let the browser handle\n // tab/shift+tab keypress and implicitly pass focus to the next valid element in the document\n isTabbingBackwards\n ? headFocusProxyRef.current?.focus()\n : tailFocusProxyRef.current?.focus();\n }\n }\n };\n\n // Toasts are not in the viewport React tree so we need to bind DOM events\n viewport.addEventListener('keydown', handleKeyDown);\n return () => viewport.removeEventListener('keydown', handleKeyDown);\n }\n }, [getItems, getSortedTabbableCandidates]);\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: hasToasts ? undefined : 'none' }}\n >\n {hasToasts && (\n <FocusProxy\n ref={headFocusProxyRef}\n onFocusFromOutsideViewport={() => {\n const tabbableCandidates = getSortedTabbableCandidates({\n tabbingDirection: 'forwards',\n });\n focusFirst(tabbableCandidates);\n }}\n />\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 <Collection.Slot scope={__scopeToast}>\n <Primitive.ol tabIndex={-1} {...viewportProps} ref={composedRefs} />\n </Collection.Slot>\n {hasToasts && (\n <FocusProxy\n ref={tailFocusProxyRef}\n onFocusFromOutsideViewport={() => {\n const tabbableCandidates = getSortedTabbableCandidates({\n tabbingDirection: 'backwards',\n });\n focusFirst(tabbableCandidates);\n }}\n />\n )}\n </DismissableLayer.Branch>\n );\n }\n);\n\nToastViewport.displayName = VIEWPORT_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst FOCUS_PROXY_NAME = 'ToastFocusProxy';\n\ntype FocusProxyElement = React.ElementRef<typeof VisuallyHidden>;\ntype VisuallyHiddenProps = Radix.ComponentPropsWithoutRef<typeof VisuallyHidden>;\ninterface FocusProxyProps extends VisuallyHiddenProps {\n onFocusFromOutsideViewport(): void;\n}\n\nconst FocusProxy = React.forwardRef<FocusProxyElement, ScopedProps<FocusProxyProps>>(\n (props, forwardedRef) => {\n const { __scopeToast, onFocusFromOutsideViewport, ...proxyProps } = props;\n const context = useToastProviderContext(FOCUS_PROXY_NAME, __scopeToast);\n\n return (\n <VisuallyHidden\n aria-hidden\n tabIndex={0}\n {...proxyProps}\n ref={forwardedRef}\n // Avoid page scrolling when focus is on the focus proxy\n style={{ position: 'fixed' }}\n onFocus={(event) => {\n const prevFocusedElement = event.relatedTarget as HTMLElement | null;\n const isFocusFromOutsideViewport = !context.viewport?.contains(prevFocusedElement);\n if (isFocusFromOutsideViewport) onFocusFromOutsideViewport();\n }}\n />\n );\n }\n);\n\nFocusProxy.displayName = FOCUS_PROXY_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 <Collection.ItemSlot scope={__scopeToast}>\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 (\n isDeltaInDirection(delta, context.swipeDirection, context.swipeThreshold)\n ) {\n handleAndDispatchCustomEvent(TOAST_SWIPE_END, onSwipeEnd, eventDetail, {\n discrete: true,\n });\n } else {\n handleAndDispatchCustomEvent(\n TOAST_SWIPE_CANCEL,\n onSwipeCancel,\n eventDetail,\n {\n discrete: true,\n }\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 </Collection.ItemSlot>,\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\n/**\n * Returns a list of potential tabbable candidates.\n *\n * NOTE: This is only a close approximation. For example it doesn't take into account cases like when\n * elements are not visible. This cannot be worked out easily by just reading a property, but rather\n * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker\n * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1\n */\nfunction getTabbableCandidates(container: HTMLElement) {\n const nodes: HTMLElement[] = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node: any) => {\n const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';\n if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;\n // `.tabIndex` is not the same as the `tabindex` attribute. It works on the\n // runtime's understanding of tabbability, so this automatically accounts\n // for any kind of element that could be tabbed to.\n return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n },\n });\n while (walker.nextNode()) nodes.push(walker.currentNode as HTMLElement);\n // we do not take into account the order of nodes with positive `tabIndex` as it\n // hinders accessibility to have tab order different from visual order.\n return nodes;\n}\n\nfunction focusFirst(candidates: HTMLElement[]) {\n const previouslyFocusedElement = document.activeElement;\n return candidates.some((candidate) => {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === previouslyFocusedElement) return true;\n candidate.focus();\n return document.activeElement !== previouslyFocusedElement;\n });\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":["createToastScope","ToastProvider","ToastViewport","Toast","ToastTitle","ToastDescription","ToastAction","ToastClose","Provider","Viewport","Root","Title","Description","Action","Close","React","ReactDOM","composeEventHandlers","useComposedRefs","createCollection","createContextScope","DismissableLayer","Presence","Primitive","dispatchDiscreteCustomEvent","Slottable","useCallbackRef","useControllableState","useLayoutEffect","VisuallyHidden","PROVIDER_NAME","Collection","useCollection","createCollectionScope","createToastContext","ToastProviderProvider","useToastProviderContext","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","forwardRef","forwardedRef","hotkey","viewportProps","context","getItems","wrapperRef","headFocusProxyRef","tailFocusProxyRef","ref","composedRefs","onViewportChange","hotkeyLabel","join","replace","hasToasts","useEffect","handleKeyDown","event","isHotkeyPressed","every","key","code","current","focus","document","addEventListener","removeEventListener","wrapper","handlePause","pauseEvent","CustomEvent","dispatchEvent","handleResume","resumeEvent","window","getSortedTabbableCandidates","tabbingDirection","toastItems","tabbableCandidates","map","toastItem","toastNode","toastTabbableCandidates","getTabbableCandidates","reverse","flat","isMetaKey","altKey","ctrlKey","metaKey","isTabKey","focusedElement","activeElement","isTabbingBackwards","shiftKey","targetIsViewport","target","sortedCandidates","index","findIndex","candidate","focusFirst","slice","preventDefault","pointerEvents","undefined","FOCUS_PROXY_NAME","FocusProxy","onFocusFromOutsideViewport","proxyProps","position","prevFocusedElement","relatedTarget","isFocusFromOutsideViewport","contains","TOAST_NAME","TOAST_SWIPE_START","TOAST_SWIPE_MOVE","TOAST_SWIPE_CANCEL","TOAST_SWIPE_END","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","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","setPointerCapture","pointerId","abs","onPointerUp","releasePointerCapture","toast","once","TITLE_NAME","titleProps","DESCRIPTION_NAME","descriptionProps","ACTION_NAME","altText","actionProps","CLOSE_NAME","closeProps","interactiveContext","onClick","name","handler","bubbles","cancelable","direction","threshold","deltaX","deltaY","isDeltaX","callback","fn","raf1","raf2","requestAnimationFrame","cancelAnimationFrame","container","nodes","walker","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","isHiddenInput","tagName","disabled","hidden","FILTER_SKIP","tabIndex","FILTER_ACCEPT","nextNode","push","currentNode","candidates","previouslyFocusedElement","some"],"version":3,"file":"index.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A;;;;;;;;;;;;;;;ACkBA;;oGAEA,CAEA,MAAM8B,mCAAa,GAAG,eAAtB,AAAA;AAEA,MAAM,CAACC,gCAAD,EAAaC,mCAAb,EAA4BC,2CAA5B,CAAA,GAAqDd,8CAAgB,CAAe,OAAf,CAA3E,AAAA;AAkBA,MAAM,CAACe,wCAAD,EAAqBlC,yCAArB,C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,wCAAQ,GAAGP,yCAAjB,AAAA;AACA,MAAMQ,yCAAI,GAAGP,yCAAb,AAAA;AACA,MAAMQ,yCAAK,GAAGP,wCAAd,AAAA;AACA,MAAMQ,yCAAW,GAAGP,yCAApB,AAAA;AACA,MAAMQ,yCAAM,GAAGP,yCAAf,AAAA;AACA,MAAMQ,yCAAK,GAAGP,yCAAd,AAAA;;ADx5BA","sources":["packages/react/toast/src/index.ts","packages/react/toast/src/Toast.tsx"],"sourcesContent":["export {\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} from './Toast';\nexport type {\n ToastProviderProps,\n ToastViewportProps,\n ToastProps,\n ToastTitleProps,\n ToastDescriptionProps,\n ToastActionProps,\n ToastCloseProps,\n} 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 { createCollection } from '@radix-ui/react-collection';\nimport { createContextScope } from '@radix-ui/react-context';\nimport * as DismissableLayer from '@radix-ui/react-dismissable-layer';\nimport { Portal } 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\nconst [Collection, useCollection, createCollectionScope] = createCollection<ToastElement>('Toast');\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', [createCollectionScope]);\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 <Collection.Provider scope={__scopeToast}>\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 </Collection.Provider>\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 getItems = useCollection(__scopeToast);\n const wrapperRef = React.useRef<HTMLDivElement>(null);\n const headFocusProxyRef = React.useRef<FocusProxyElement>(null);\n const tailFocusProxyRef = React.useRef<FocusProxyElement>(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 const hasToasts = context.toastCount > 0;\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 const getSortedTabbableCandidates = React.useCallback(\n ({ tabbingDirection }: { tabbingDirection: 'forwards' | 'backwards' }) => {\n const toastItems = getItems();\n const tabbableCandidates = toastItems.map((toastItem) => {\n const toastNode = toastItem.ref.current!;\n const toastTabbableCandidates = [toastNode, ...getTabbableCandidates(toastNode)];\n return tabbingDirection === 'forwards'\n ? toastTabbableCandidates\n : toastTabbableCandidates.reverse();\n });\n return (\n tabbingDirection === 'forwards' ? tabbableCandidates.reverse() : tabbableCandidates\n ).flat();\n },\n [getItems]\n );\n\n React.useEffect(() => {\n const viewport = ref.current;\n // We programmatically manage tabbing as we are unable to influence\n // the source order with portals, this allows us to reverse the\n // tab order so that it runs from most recent toast to least\n if (viewport) {\n const handleKeyDown = (event: KeyboardEvent) => {\n const isMetaKey = event.altKey || event.ctrlKey || event.metaKey;\n const isTabKey = event.key === 'Tab' && !isMetaKey;\n\n if (isTabKey) {\n const focusedElement = document.activeElement;\n const isTabbingBackwards = event.shiftKey;\n const targetIsViewport = event.target === viewport;\n\n // If we're back tabbing after jumping to the viewport then we simply\n // proxy focus out to the preceding document\n if (targetIsViewport && isTabbingBackwards) {\n headFocusProxyRef.current?.focus();\n return;\n }\n\n const tabbingDirection = isTabbingBackwards ? 'backwards' : 'forwards';\n const sortedCandidates = getSortedTabbableCandidates({ tabbingDirection });\n const index = sortedCandidates.findIndex((candidate) => candidate === focusedElement);\n if (focusFirst(sortedCandidates.slice(index + 1))) {\n event.preventDefault();\n } else {\n // If we can't focus that means we're at the edges so we\n // proxy to the corresponding exit point and let the browser handle\n // tab/shift+tab keypress and implicitly pass focus to the next valid element in the document\n isTabbingBackwards\n ? headFocusProxyRef.current?.focus()\n : tailFocusProxyRef.current?.focus();\n }\n }\n };\n\n // Toasts are not in the viewport React tree so we need to bind DOM events\n viewport.addEventListener('keydown', handleKeyDown);\n return () => viewport.removeEventListener('keydown', handleKeyDown);\n }\n }, [getItems, getSortedTabbableCandidates]);\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: hasToasts ? undefined : 'none' }}\n >\n {hasToasts && (\n <FocusProxy\n ref={headFocusProxyRef}\n onFocusFromOutsideViewport={() => {\n const tabbableCandidates = getSortedTabbableCandidates({\n tabbingDirection: 'forwards',\n });\n focusFirst(tabbableCandidates);\n }}\n />\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 <Collection.Slot scope={__scopeToast}>\n <Primitive.ol tabIndex={-1} {...viewportProps} ref={composedRefs} />\n </Collection.Slot>\n {hasToasts && (\n <FocusProxy\n ref={tailFocusProxyRef}\n onFocusFromOutsideViewport={() => {\n const tabbableCandidates = getSortedTabbableCandidates({\n tabbingDirection: 'backwards',\n });\n focusFirst(tabbableCandidates);\n }}\n />\n )}\n </DismissableLayer.Branch>\n );\n }\n);\n\nToastViewport.displayName = VIEWPORT_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst FOCUS_PROXY_NAME = 'ToastFocusProxy';\n\ntype FocusProxyElement = React.ElementRef<typeof VisuallyHidden>;\ntype VisuallyHiddenProps = Radix.ComponentPropsWithoutRef<typeof VisuallyHidden>;\ninterface FocusProxyProps extends VisuallyHiddenProps {\n onFocusFromOutsideViewport(): void;\n}\n\nconst FocusProxy = React.forwardRef<FocusProxyElement, ScopedProps<FocusProxyProps>>(\n (props, forwardedRef) => {\n const { __scopeToast, onFocusFromOutsideViewport, ...proxyProps } = props;\n const context = useToastProviderContext(FOCUS_PROXY_NAME, __scopeToast);\n\n return (\n <VisuallyHidden\n aria-hidden\n tabIndex={0}\n {...proxyProps}\n ref={forwardedRef}\n // Avoid page scrolling when focus is on the focus proxy\n style={{ position: 'fixed' }}\n onFocus={(event) => {\n const prevFocusedElement = event.relatedTarget as HTMLElement | null;\n const isFocusFromOutsideViewport = !context.viewport?.contains(prevFocusedElement);\n if (isFocusFromOutsideViewport) onFocusFromOutsideViewport();\n }}\n />\n );\n }\n);\n\nFocusProxy.displayName = FOCUS_PROXY_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 <Collection.ItemSlot scope={__scopeToast}>\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 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 (\n isDeltaInDirection(delta, context.swipeDirection, context.swipeThreshold)\n ) {\n handleAndDispatchCustomEvent(TOAST_SWIPE_END, onSwipeEnd, eventDetail, {\n discrete: true,\n });\n } else {\n handleAndDispatchCustomEvent(\n TOAST_SWIPE_CANCEL,\n onSwipeCancel,\n eventDetail,\n {\n discrete: true,\n }\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 </Collection.ItemSlot>,\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\ninterface ToastAnnounceProps\n extends React.ComponentPropsWithoutRef<'div'>,\n ScopedProps<{ children?: ToastImplProps['children'] }> {}\n\nconst ToastAnnounce: React.FC<ToastAnnounceProps> = (props: ScopedProps<ToastAnnounceProps>) => {\n const { __scopeToast, children, ...announceProps } = props;\n const context = useToastProviderContext(TOAST_NAME, __scopeToast);\n const [renderAnnounceText, setRenderAnnounceText] = React.useState(false);\n const [isAnnounced, setIsAnnounced] = React.useState(false);\n const [fragment, setFragment] = React.useState<DocumentFragment>();\n const [rootFragmentNode, setRootFragmentNode] = React.useState<HTMLDivElement | null>(null);\n\n // We portal children into a document fragment so that we can extract the bare text nodes\n // before rendering to the DOM. This avoids issues with duplicate `children`\n // and animation libraries when composing via `asChild`.\n const announceTextContent = React.useMemo(() => {\n return rootFragmentNode ? getAnnounceTextContent(rootFragmentNode) : null;\n }, [rootFragmentNode]);\n\n // setting the fragment in `useLayoutEffect` as `DocumentFragment` doesn't exist on the server\n useLayoutEffect(() => {\n setFragment(new DocumentFragment());\n }, []);\n\n // render text content in the next frame to ensure toast is announced in NVDA\n useNextFrame(() => setRenderAnnounceText(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 <>\n {fragment && (\n <Portal container={fragment as any} ref={setRootFragmentNode}>\n {context.label} {children}\n </Portal>\n )}\n <Portal asChild>\n <VisuallyHidden {...announceProps}>\n {renderAnnounceText && announceTextContent}\n </VisuallyHidden>\n </Portal>\n </>\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\nfunction getAnnounceTextContent(container: HTMLElement) {\n const textContent: string[] = [];\n const childNodes = Array.from(container.childNodes);\n\n childNodes.forEach((node) => {\n if (node.nodeType === node.TEXT_NODE && node.textContent) textContent.push(node.textContent);\n if (isHTMLElement(node)) {\n const isHidden = node.ariaHidden || node.hidden || node.style.display === 'none';\n if (!isHidden) textContent.push(...getAnnounceTextContent(node));\n }\n });\n\n // We return a collection of text rather than a single concatenated string.\n // This allows SR VO to naturally pause break between nodes while announcing.\n return textContent;\n}\n\nfunction isHTMLElement(node: any): node is HTMLElement {\n return node.nodeType === node.ELEMENT_NODE;\n}\n\n/**\n * Returns a list of potential tabbable candidates.\n *\n * NOTE: This is only a close approximation. For example it doesn't take into account cases like when\n * elements are not visible. This cannot be worked out easily by just reading a property, but rather\n * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker\n * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1\n */\nfunction getTabbableCandidates(container: HTMLElement) {\n const nodes: HTMLElement[] = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node: any) => {\n const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';\n if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;\n // `.tabIndex` is not the same as the `tabindex` attribute. It works on the\n // runtime's understanding of tabbability, so this automatically accounts\n // for any kind of element that could be tabbed to.\n return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n },\n });\n while (walker.nextNode()) nodes.push(walker.currentNode as HTMLElement);\n // we do not take into account the order of nodes with positive `tabIndex` as it\n // hinders accessibility to have tab order different from visual order.\n return nodes;\n}\n\nfunction focusFirst(candidates: HTMLElement[]) {\n const previouslyFocusedElement = document.activeElement;\n return candidates.some((candidate) => {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === previouslyFocusedElement) return true;\n candidate.focus();\n return document.activeElement !== previouslyFocusedElement;\n });\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":["createToastScope","ToastProvider","ToastViewport","Toast","ToastTitle","ToastDescription","ToastAction","ToastClose","Provider","Viewport","Root","Title","Description","Action","Close","React","ReactDOM","composeEventHandlers","useComposedRefs","createCollection","createContextScope","DismissableLayer","Portal","Presence","Primitive","dispatchDiscreteCustomEvent","useCallbackRef","useControllableState","useLayoutEffect","VisuallyHidden","PROVIDER_NAME","Collection","useCollection","createCollectionScope","createToastContext","ToastProviderProvider","useToastProviderContext","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","forwardRef","forwardedRef","hotkey","viewportProps","context","getItems","wrapperRef","headFocusProxyRef","tailFocusProxyRef","ref","composedRefs","onViewportChange","hotkeyLabel","join","replace","hasToasts","useEffect","handleKeyDown","event","isHotkeyPressed","every","key","code","current","focus","document","addEventListener","removeEventListener","wrapper","handlePause","pauseEvent","CustomEvent","dispatchEvent","handleResume","resumeEvent","window","getSortedTabbableCandidates","tabbingDirection","toastItems","tabbableCandidates","map","toastItem","toastNode","toastTabbableCandidates","getTabbableCandidates","reverse","flat","isMetaKey","altKey","ctrlKey","metaKey","isTabKey","focusedElement","activeElement","isTabbingBackwards","shiftKey","targetIsViewport","target","sortedCandidates","index","findIndex","candidate","focusFirst","slice","preventDefault","pointerEvents","undefined","FOCUS_PROXY_NAME","FocusProxy","onFocusFromOutsideViewport","proxyProps","position","prevFocusedElement","relatedTarget","isFocusFromOutsideViewport","contains","TOAST_NAME","TOAST_SWIPE_START","TOAST_SWIPE_MOVE","TOAST_SWIPE_CANCEL","TOAST_SWIPE_END","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","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","setPointerCapture","pointerId","abs","onPointerUp","releasePointerCapture","toast","once","ToastAnnounce","announceProps","renderAnnounceText","setRenderAnnounceText","isAnnounced","setIsAnnounced","fragment","setFragment","rootFragmentNode","setRootFragmentNode","announceTextContent","useMemo","getAnnounceTextContent","DocumentFragment","useNextFrame","timer","TITLE_NAME","titleProps","DESCRIPTION_NAME","descriptionProps","ACTION_NAME","altText","actionProps","CLOSE_NAME","closeProps","interactiveContext","onClick","name","handler","bubbles","cancelable","direction","threshold","deltaX","deltaY","isDeltaX","callback","fn","raf1","raf2","requestAnimationFrame","cancelAnimationFrame","container","textContent","childNodes","Array","from","forEach","node","nodeType","TEXT_NODE","push","isHTMLElement","isHidden","ariaHidden","hidden","display","ELEMENT_NODE","nodes","walker","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","isHiddenInput","tagName","disabled","FILTER_SKIP","tabIndex","FILTER_ACCEPT","nextNode","currentNode","candidates","previouslyFocusedElement","some"],"version":3,"file":"index.js.map"}
@@ -1,14 +1,14 @@
1
1
  import $eyrYI$babelruntimehelpersesmextends from "@babel/runtime/helpers/esm/extends";
2
- import {useState as $eyrYI$useState, useRef as $eyrYI$useRef, createElement as $eyrYI$createElement, useCallback as $eyrYI$useCallback, forwardRef as $eyrYI$forwardRef, useEffect as $eyrYI$useEffect, Fragment as $eyrYI$Fragment} from "react";
2
+ import {useState as $eyrYI$useState, useRef as $eyrYI$useRef, createElement as $eyrYI$createElement, useCallback as $eyrYI$useCallback, forwardRef as $eyrYI$forwardRef, useEffect as $eyrYI$useEffect, Fragment as $eyrYI$Fragment, useMemo as $eyrYI$useMemo} from "react";
3
3
  import {createPortal as $eyrYI$createPortal} from "react-dom";
4
4
  import {composeEventHandlers as $eyrYI$composeEventHandlers} from "@radix-ui/primitive";
5
5
  import {useComposedRefs as $eyrYI$useComposedRefs} from "@radix-ui/react-compose-refs";
6
6
  import {createCollection as $eyrYI$createCollection} from "@radix-ui/react-collection";
7
7
  import {createContextScope as $eyrYI$createContextScope} from "@radix-ui/react-context";
8
8
  import {Branch as $eyrYI$Branch, Root as $eyrYI$Root} from "@radix-ui/react-dismissable-layer";
9
+ import {Portal as $eyrYI$Portal} from "@radix-ui/react-portal";
9
10
  import {Presence as $eyrYI$Presence} from "@radix-ui/react-presence";
10
11
  import {Primitive as $eyrYI$Primitive, dispatchDiscreteCustomEvent as $eyrYI$dispatchDiscreteCustomEvent} from "@radix-ui/react-primitive";
11
- import {Slottable as $eyrYI$Slottable} from "@radix-ui/react-slot";
12
12
  import {useCallbackRef as $eyrYI$useCallbackRef} from "@radix-ui/react-use-callback-ref";
13
13
  import {useControllableState as $eyrYI$useControllableState} from "@radix-ui/react-use-controllable-state";
14
14
  import {useLayoutEffect as $eyrYI$useLayoutEffect} from "@radix-ui/react-use-layout-effect";
@@ -316,7 +316,7 @@ const $054eb8030ebde76e$export$8d8dc7d5f743331b = /*#__PURE__*/ $eyrYI$forwardRe
316
316
  onClose () {}
317
317
  });
318
318
  const $054eb8030ebde76e$var$ToastImpl = /*#__PURE__*/ $eyrYI$forwardRef((props, forwardedRef)=>{
319
- 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;
319
+ const { __scopeToast: __scopeToast , type: type = 'foreground' , duration: durationProp , open: open , onClose: onClose , onEscapeKeyDown: onEscapeKeyDown , onSwipeStart: onSwipeStart , onSwipeMove: onSwipeMove , onSwipeCancel: onSwipeCancel , onSwipeEnd: onSwipeEnd , ...toastProps } = props;
320
320
  const context = $054eb8030ebde76e$var$useToastProviderContext($054eb8030ebde76e$var$TOAST_NAME, __scopeToast);
321
321
  const ref = $eyrYI$useRef(null);
322
322
  const composedRefs = $eyrYI$useComposedRefs(forwardedRef, ref);
@@ -326,7 +326,6 @@ const $054eb8030ebde76e$var$ToastImpl = /*#__PURE__*/ $eyrYI$forwardRef((props,
326
326
  const closeTimerStartTimeRef = $eyrYI$useRef(0);
327
327
  const closeTimerRemainingTimeRef = $eyrYI$useRef(duration1);
328
328
  const closeTimerRef = $eyrYI$useRef(0);
329
- const [renderLabel, setRenderLabel] = $eyrYI$useState(false);
330
329
  const { onToastAdd: onToastAdd , onToastRemove: onToastRemove } = context;
331
330
  const handleClose = $eyrYI$useCallbackRef(()=>{
332
331
  var _ref$current2, _context$viewport2;
@@ -384,11 +383,15 @@ const $054eb8030ebde76e$var$ToastImpl = /*#__PURE__*/ $eyrYI$forwardRef((props,
384
383
  }, [
385
384
  onToastAdd,
386
385
  onToastRemove
387
- ]); // render label in the next frame to trigger toast announcement in NVDA
388
- $054eb8030ebde76e$var$useNextFrame(()=>setRenderLabel(true)
389
- );
386
+ ]);
390
387
  if (!context.viewport) return null;
391
- return /*#__PURE__*/ $eyrYI$createElement($eyrYI$Fragment, null, /*#__PURE__*/ $eyrYI$createElement($054eb8030ebde76e$var$ToastInteractiveProvider, {
388
+ return /*#__PURE__*/ $eyrYI$createElement($eyrYI$Fragment, null, /*#__PURE__*/ $eyrYI$createElement($054eb8030ebde76e$var$ToastAnnounce, {
389
+ __scopeToast: __scopeToast // Toasts are always role=status to avoid stuttering issues with role=alert in SRs.
390
+ ,
391
+ role: "status",
392
+ "aria-live": type === 'foreground' ? 'assertive' : 'polite',
393
+ "aria-atomic": true
394
+ }, props.children), /*#__PURE__*/ $eyrYI$createElement($054eb8030ebde76e$var$ToastInteractiveProvider, {
392
395
  scope: __scopeToast,
393
396
  isInteractive: true,
394
397
  onClose: handleClose
@@ -401,11 +404,6 @@ const $054eb8030ebde76e$var$ToastImpl = /*#__PURE__*/ $eyrYI$forwardRef((props,
401
404
  context.isFocusedToastEscapeKeyDownRef.current = false;
402
405
  })
403
406
  }, /*#__PURE__*/ $eyrYI$createElement($eyrYI$Primitive.li, $eyrYI$babelruntimehelpersesmextends({
404
- role: "status",
405
- "aria-live": type === 'foreground' ? 'assertive' : 'polite',
406
- "aria-atomic": true // Prevent voice over from announcing before the label is rendered
407
- ,
408
- "aria-hidden": !renderLabel || undefined,
409
407
  tabIndex: 0,
410
408
  "data-state": open ? 'open' : 'closed',
411
409
  "data-swipe-direction": context.swipeDirection
@@ -495,7 +493,7 @@ const $054eb8030ebde76e$var$ToastImpl = /*#__PURE__*/ $eyrYI$forwardRef((props,
495
493
  });
496
494
  }
497
495
  })
498
- }), /*#__PURE__*/ $eyrYI$createElement($eyrYI$VisuallyHidden, null, renderLabel && context.label), /*#__PURE__*/ $eyrYI$createElement($eyrYI$Slottable, null, children)))), context.viewport)));
496
+ })))), context.viewport)));
499
497
  });
500
498
  $054eb8030ebde76e$var$ToastImpl.propTypes = {
501
499
  type (props) {
@@ -509,6 +507,38 @@ $054eb8030ebde76e$var$ToastImpl.propTypes = {
509
507
  return null;
510
508
  }
511
509
  };
510
+ /* -----------------------------------------------------------------------------------------------*/ const $054eb8030ebde76e$var$ToastAnnounce = (props)=>{
511
+ const { __scopeToast: __scopeToast , children: children , ...announceProps } = props;
512
+ const context = $054eb8030ebde76e$var$useToastProviderContext($054eb8030ebde76e$var$TOAST_NAME, __scopeToast);
513
+ const [renderAnnounceText, setRenderAnnounceText] = $eyrYI$useState(false);
514
+ const [isAnnounced, setIsAnnounced] = $eyrYI$useState(false);
515
+ const [fragment, setFragment] = $eyrYI$useState();
516
+ const [rootFragmentNode, setRootFragmentNode] = $eyrYI$useState(null); // We portal children into a document fragment so that we can extract the bare text nodes
517
+ // before rendering to the DOM. This avoids issues with duplicate `children`
518
+ // and animation libraries when composing via `asChild`.
519
+ const announceTextContent = $eyrYI$useMemo(()=>{
520
+ return rootFragmentNode ? $054eb8030ebde76e$var$getAnnounceTextContent(rootFragmentNode) : null;
521
+ }, [
522
+ rootFragmentNode
523
+ ]); // setting the fragment in `useLayoutEffect` as `DocumentFragment` doesn't exist on the server
524
+ $eyrYI$useLayoutEffect(()=>{
525
+ setFragment(new DocumentFragment());
526
+ }, []); // render text content in the next frame to ensure toast is announced in NVDA
527
+ $054eb8030ebde76e$var$useNextFrame(()=>setRenderAnnounceText(true)
528
+ );
529
+ $eyrYI$useEffect(()=>{
530
+ const timer = window.setTimeout(()=>setIsAnnounced(true)
531
+ , 1000);
532
+ return ()=>window.clearTimeout(timer)
533
+ ;
534
+ }, []);
535
+ return isAnnounced ? null : /*#__PURE__*/ $eyrYI$createElement($eyrYI$Fragment, null, fragment && /*#__PURE__*/ $eyrYI$createElement($eyrYI$Portal, {
536
+ container: fragment,
537
+ ref: setRootFragmentNode
538
+ }, context.label, " ", children), /*#__PURE__*/ $eyrYI$createElement($eyrYI$Portal, {
539
+ asChild: true
540
+ }, /*#__PURE__*/ $eyrYI$createElement($eyrYI$VisuallyHidden, announceProps, renderAnnounceText && announceTextContent)));
541
+ };
512
542
  /* -------------------------------------------------------------------------------------------------
513
543
  * ToastTitle
514
544
  * -----------------------------------------------------------------------------------------------*/ const $054eb8030ebde76e$var$TITLE_NAME = 'ToastTitle';
@@ -604,6 +634,22 @@ function $054eb8030ebde76e$var$useNextFrame(callback = ()=>{}) {
604
634
  fn
605
635
  ]);
606
636
  }
637
+ function $054eb8030ebde76e$var$getAnnounceTextContent(container) {
638
+ const textContent = [];
639
+ const childNodes = Array.from(container.childNodes);
640
+ childNodes.forEach((node)=>{
641
+ if (node.nodeType === node.TEXT_NODE && node.textContent) textContent.push(node.textContent);
642
+ if ($054eb8030ebde76e$var$isHTMLElement(node)) {
643
+ const isHidden = node.ariaHidden || node.hidden || node.style.display === 'none';
644
+ if (!isHidden) textContent.push(...$054eb8030ebde76e$var$getAnnounceTextContent(node));
645
+ }
646
+ }); // We return a collection of text rather than a single concatenated string.
647
+ // This allows SR VO to naturally pause break between nodes while announcing.
648
+ return textContent;
649
+ }
650
+ function $054eb8030ebde76e$var$isHTMLElement(node) {
651
+ return node.nodeType === node.ELEMENT_NODE;
652
+ }
607
653
  /**
608
654
  * Returns a list of potential tabbable candidates.
609
655
  *
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;A;;;;;;;;;;;;;;;ACkBA;;oGAEA,CAEA,MAAM8B,mCAAa,GAAG,eAAtB,AAAA;AAEA,MAAM,CAACC,gCAAD,EAAaC,mCAAb,EAA4BC,2CAA5B,CAAA,GAAqDd,uBAAgB,CAAe,OAAf,CAA3E,AAAA;AAkBA,MAAM,CAACe,wCAAD,EAAqBlC,yCAArB,CAAA,GAAyCoB,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C;QACAtJ,SAAS,CAACrC,KAAV,EAAAqC,CAAAA;QACA,OAAOpC,QAAQ,CAAC4B,aAAT,KAA2B8J,wBAAlC,CAAA;KAJK,CAAP,CAKC;CACF;AAED,MAAMzQ,yCAAQ,GAAGP,wCAAjB,AAAA;AACA,MAAMQ,wCAAQ,GAAGP,yCAAjB,AAAA;AACA,MAAMQ,yCAAI,GAAGP,yCAAb,AAAA;AACA,MAAMQ,yCAAK,GAAGP,wCAAd,AAAA;AACA,MAAMQ,yCAAW,GAAGP,yCAApB,AAAA;AACA,MAAMQ,yCAAM,GAAGP,yCAAf,AAAA;AACA,MAAMQ,yCAAK,GAAGP,yCAAd,AAAA;;ADp1BA","sources":["packages/react/toast/src/index.ts","packages/react/toast/src/Toast.tsx"],"sourcesContent":["export {\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} from './Toast';\nexport type {\n ToastProviderProps,\n ToastViewportProps,\n ToastProps,\n ToastTitleProps,\n ToastDescriptionProps,\n ToastActionProps,\n ToastCloseProps,\n} 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 { createCollection } from '@radix-ui/react-collection';\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\nconst [Collection, useCollection, createCollectionScope] = createCollection<ToastElement>('Toast');\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', [createCollectionScope]);\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 <Collection.Provider scope={__scopeToast}>\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 </Collection.Provider>\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 getItems = useCollection(__scopeToast);\n const wrapperRef = React.useRef<HTMLDivElement>(null);\n const headFocusProxyRef = React.useRef<FocusProxyElement>(null);\n const tailFocusProxyRef = React.useRef<FocusProxyElement>(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 const hasToasts = context.toastCount > 0;\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 const getSortedTabbableCandidates = React.useCallback(\n ({ tabbingDirection }: { tabbingDirection: 'forwards' | 'backwards' }) => {\n const toastItems = getItems();\n const tabbableCandidates = toastItems.map((toastItem) => {\n const toastNode = toastItem.ref.current!;\n const toastTabbableCandidates = [toastNode, ...getTabbableCandidates(toastNode)];\n return tabbingDirection === 'forwards'\n ? toastTabbableCandidates\n : toastTabbableCandidates.reverse();\n });\n return (\n tabbingDirection === 'forwards' ? tabbableCandidates.reverse() : tabbableCandidates\n ).flat();\n },\n [getItems]\n );\n\n React.useEffect(() => {\n const viewport = ref.current;\n // We programmatically manage tabbing as we are unable to influence\n // the source order with portals, this allows us to reverse the\n // tab order so that it runs from most recent toast to least\n if (viewport) {\n const handleKeyDown = (event: KeyboardEvent) => {\n const isMetaKey = event.altKey || event.ctrlKey || event.metaKey;\n const isTabKey = event.key === 'Tab' && !isMetaKey;\n\n if (isTabKey) {\n const focusedElement = document.activeElement;\n const isTabbingBackwards = event.shiftKey;\n const targetIsViewport = event.target === viewport;\n\n // If we're back tabbing after jumping to the viewport then we simply\n // proxy focus out to the preceding document\n if (targetIsViewport && isTabbingBackwards) {\n headFocusProxyRef.current?.focus();\n return;\n }\n\n const tabbingDirection = isTabbingBackwards ? 'backwards' : 'forwards';\n const sortedCandidates = getSortedTabbableCandidates({ tabbingDirection });\n const index = sortedCandidates.findIndex((candidate) => candidate === focusedElement);\n if (focusFirst(sortedCandidates.slice(index + 1))) {\n event.preventDefault();\n } else {\n // If we can't focus that means we're at the edges so we\n // proxy to the corresponding exit point and let the browser handle\n // tab/shift+tab keypress and implicitly pass focus to the next valid element in the document\n isTabbingBackwards\n ? headFocusProxyRef.current?.focus()\n : tailFocusProxyRef.current?.focus();\n }\n }\n };\n\n // Toasts are not in the viewport React tree so we need to bind DOM events\n viewport.addEventListener('keydown', handleKeyDown);\n return () => viewport.removeEventListener('keydown', handleKeyDown);\n }\n }, [getItems, getSortedTabbableCandidates]);\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: hasToasts ? undefined : 'none' }}\n >\n {hasToasts && (\n <FocusProxy\n ref={headFocusProxyRef}\n onFocusFromOutsideViewport={() => {\n const tabbableCandidates = getSortedTabbableCandidates({\n tabbingDirection: 'forwards',\n });\n focusFirst(tabbableCandidates);\n }}\n />\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 <Collection.Slot scope={__scopeToast}>\n <Primitive.ol tabIndex={-1} {...viewportProps} ref={composedRefs} />\n </Collection.Slot>\n {hasToasts && (\n <FocusProxy\n ref={tailFocusProxyRef}\n onFocusFromOutsideViewport={() => {\n const tabbableCandidates = getSortedTabbableCandidates({\n tabbingDirection: 'backwards',\n });\n focusFirst(tabbableCandidates);\n }}\n />\n )}\n </DismissableLayer.Branch>\n );\n }\n);\n\nToastViewport.displayName = VIEWPORT_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst FOCUS_PROXY_NAME = 'ToastFocusProxy';\n\ntype FocusProxyElement = React.ElementRef<typeof VisuallyHidden>;\ntype VisuallyHiddenProps = Radix.ComponentPropsWithoutRef<typeof VisuallyHidden>;\ninterface FocusProxyProps extends VisuallyHiddenProps {\n onFocusFromOutsideViewport(): void;\n}\n\nconst FocusProxy = React.forwardRef<FocusProxyElement, ScopedProps<FocusProxyProps>>(\n (props, forwardedRef) => {\n const { __scopeToast, onFocusFromOutsideViewport, ...proxyProps } = props;\n const context = useToastProviderContext(FOCUS_PROXY_NAME, __scopeToast);\n\n return (\n <VisuallyHidden\n aria-hidden\n tabIndex={0}\n {...proxyProps}\n ref={forwardedRef}\n // Avoid page scrolling when focus is on the focus proxy\n style={{ position: 'fixed' }}\n onFocus={(event) => {\n const prevFocusedElement = event.relatedTarget as HTMLElement | null;\n const isFocusFromOutsideViewport = !context.viewport?.contains(prevFocusedElement);\n if (isFocusFromOutsideViewport) onFocusFromOutsideViewport();\n }}\n />\n );\n }\n);\n\nFocusProxy.displayName = FOCUS_PROXY_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 <Collection.ItemSlot scope={__scopeToast}>\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 (\n isDeltaInDirection(delta, context.swipeDirection, context.swipeThreshold)\n ) {\n handleAndDispatchCustomEvent(TOAST_SWIPE_END, onSwipeEnd, eventDetail, {\n discrete: true,\n });\n } else {\n handleAndDispatchCustomEvent(\n TOAST_SWIPE_CANCEL,\n onSwipeCancel,\n eventDetail,\n {\n discrete: true,\n }\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 </Collection.ItemSlot>,\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\n/**\n * Returns a list of potential tabbable candidates.\n *\n * NOTE: This is only a close approximation. For example it doesn't take into account cases like when\n * elements are not visible. This cannot be worked out easily by just reading a property, but rather\n * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker\n * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1\n */\nfunction getTabbableCandidates(container: HTMLElement) {\n const nodes: HTMLElement[] = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node: any) => {\n const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';\n if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;\n // `.tabIndex` is not the same as the `tabindex` attribute. It works on the\n // runtime's understanding of tabbability, so this automatically accounts\n // for any kind of element that could be tabbed to.\n return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n },\n });\n while (walker.nextNode()) nodes.push(walker.currentNode as HTMLElement);\n // we do not take into account the order of nodes with positive `tabIndex` as it\n // hinders accessibility to have tab order different from visual order.\n return nodes;\n}\n\nfunction focusFirst(candidates: HTMLElement[]) {\n const previouslyFocusedElement = document.activeElement;\n return candidates.some((candidate) => {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === previouslyFocusedElement) return true;\n candidate.focus();\n return document.activeElement !== previouslyFocusedElement;\n });\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":["createToastScope","ToastProvider","ToastViewport","Toast","ToastTitle","ToastDescription","ToastAction","ToastClose","Provider","Viewport","Root","Title","Description","Action","Close","React","ReactDOM","composeEventHandlers","useComposedRefs","createCollection","createContextScope","DismissableLayer","Presence","Primitive","dispatchDiscreteCustomEvent","Slottable","useCallbackRef","useControllableState","useLayoutEffect","VisuallyHidden","PROVIDER_NAME","Collection","useCollection","createCollectionScope","createToastContext","ToastProviderProvider","useToastProviderContext","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","forwardRef","forwardedRef","hotkey","viewportProps","context","getItems","wrapperRef","headFocusProxyRef","tailFocusProxyRef","ref","composedRefs","onViewportChange","hotkeyLabel","join","replace","hasToasts","useEffect","handleKeyDown","event","isHotkeyPressed","every","key","code","current","focus","document","addEventListener","removeEventListener","wrapper","handlePause","pauseEvent","CustomEvent","dispatchEvent","handleResume","resumeEvent","window","getSortedTabbableCandidates","tabbingDirection","toastItems","tabbableCandidates","map","toastItem","toastNode","toastTabbableCandidates","getTabbableCandidates","reverse","flat","isMetaKey","altKey","ctrlKey","metaKey","isTabKey","focusedElement","activeElement","isTabbingBackwards","shiftKey","targetIsViewport","target","sortedCandidates","index","findIndex","candidate","focusFirst","slice","preventDefault","pointerEvents","undefined","FOCUS_PROXY_NAME","FocusProxy","onFocusFromOutsideViewport","proxyProps","position","prevFocusedElement","relatedTarget","isFocusFromOutsideViewport","contains","TOAST_NAME","TOAST_SWIPE_START","TOAST_SWIPE_MOVE","TOAST_SWIPE_CANCEL","TOAST_SWIPE_END","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","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","setPointerCapture","pointerId","abs","onPointerUp","releasePointerCapture","toast","once","TITLE_NAME","titleProps","DESCRIPTION_NAME","descriptionProps","ACTION_NAME","altText","actionProps","CLOSE_NAME","closeProps","interactiveContext","onClick","name","handler","bubbles","cancelable","direction","threshold","deltaX","deltaY","isDeltaX","callback","fn","raf1","raf2","requestAnimationFrame","cancelAnimationFrame","container","nodes","walker","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","isHiddenInput","tagName","disabled","hidden","FILTER_SKIP","tabIndex","FILTER_ACCEPT","nextNode","push","currentNode","candidates","previouslyFocusedElement","some"],"version":3,"file":"index.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;A;;;;;;;;;;;;;;;ACkBA;;oGAEA,CAEA,MAAM8B,mCAAa,GAAG,eAAtB,AAAA;AAEA,MAAM,CAACC,gCAAD,EAAaC,mCAAb,EAA4BC,2CAA5B,CAAA,GAAqDd,uBAAgB,CAAe,OAAf,CAA3E,AAAA;AAkBA,MAAM,CAACe,wCAAD,EAAqBlC,yCAArB,CAAA,GAAyCoB,yBAAkB,CAAC,OAAD,EAAU;IAACa,2CAAD;CAAV,CAAjE,AAAA;AACA,MAAM,CAACE,2CAAD,EAAwBC,6CAAxB,CAAA,GACJF,wCAAkB,CAA4BJ,mCAA5B,CADpB,AAAA;AA4BA,MAAM7B,wCAA2C,GAAIoC,CAAAA,KAAD,GAA4C;IAC9F,MAAM,E,cACJC,YADI,CAAA,SAEJC,KAAK,GAAG,cAFJ,aAGJC,QAAQ,GAAG,IAHP,mBAIJC,cAAc,GAAG,OAJb,mBAKJC,cAAc,GAAG,EALb,G,UAMJC,QAAAA,CAAAA,EANI,GAOFN,KAPJ,AAAM;IAQN,MAAM,CAACO,QAAD,EAAWC,WAAX,CAAA,GAA0B9B,eAAA,CAA4C,IAA5C,CAAhC,AAAA;IACA,MAAM,CAACgC,UAAD,EAAaC,aAAb,CAAA,GAA8BjC,eAAA,CAAe,CAAf,CAApC,AAAA;IACA,MAAMkC,8BAA8B,GAAGlC,aAAA,CAAa,KAAb,CAAvC,AAAA;IACA,MAAMoC,gBAAgB,GAAGpC,aAAA,CAAa,KAAb,CAAzB,AAA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,MAAM,CAACY,WAAlB,CAAA,CAZ2B,CAarD,gFADA;IAEA,uEAAA;IACA,OAAOb,KAAP,CAAA;CACD;AAED,SAAS/J,gCAAT,CAAoB6K,UAApB,EAA+C;IAC7C,MAAMC,wBAAwB,GAAGnN,QAAQ,CAAC4B,aAA1C,AAAA;IACA,OAAOsL,UAAU,CAACE,IAAX,CAAiBhL,CAAAA,SAAD,GAAe;QACpC,8FAAA;QACA,IAAIA,SAAS,KAAK+K,wBAAlB,EAA4C,OAAO,IAAP,CAA5C;QACA/K,SAAS,CAACrC,KAAV,EAAAqC,CAAAA;QACA,OAAOpC,QAAQ,CAAC4B,aAAT,KAA2BuL,wBAAlC,CAAA;KAJK,CAAP,CAKC;CACF;AAED,MAAMlS,yCAAQ,GAAGP,wCAAjB,AAAA;AACA,MAAMQ,wCAAQ,GAAGP,yCAAjB,AAAA;AACA,MAAMQ,yCAAI,GAAGP,yCAAb,AAAA;AACA,MAAMQ,yCAAK,GAAGP,wCAAd,AAAA;AACA,MAAMQ,yCAAW,GAAGP,yCAApB,AAAA;AACA,MAAMQ,yCAAM,GAAGP,yCAAf,AAAA;AACA,MAAMQ,yCAAK,GAAGP,yCAAd,AAAA;;ADx5BA","sources":["packages/react/toast/src/index.ts","packages/react/toast/src/Toast.tsx"],"sourcesContent":["export {\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} from './Toast';\nexport type {\n ToastProviderProps,\n ToastViewportProps,\n ToastProps,\n ToastTitleProps,\n ToastDescriptionProps,\n ToastActionProps,\n ToastCloseProps,\n} 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 { createCollection } from '@radix-ui/react-collection';\nimport { createContextScope } from '@radix-ui/react-context';\nimport * as DismissableLayer from '@radix-ui/react-dismissable-layer';\nimport { Portal } 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\nconst [Collection, useCollection, createCollectionScope] = createCollection<ToastElement>('Toast');\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', [createCollectionScope]);\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 <Collection.Provider scope={__scopeToast}>\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 </Collection.Provider>\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 getItems = useCollection(__scopeToast);\n const wrapperRef = React.useRef<HTMLDivElement>(null);\n const headFocusProxyRef = React.useRef<FocusProxyElement>(null);\n const tailFocusProxyRef = React.useRef<FocusProxyElement>(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 const hasToasts = context.toastCount > 0;\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 const getSortedTabbableCandidates = React.useCallback(\n ({ tabbingDirection }: { tabbingDirection: 'forwards' | 'backwards' }) => {\n const toastItems = getItems();\n const tabbableCandidates = toastItems.map((toastItem) => {\n const toastNode = toastItem.ref.current!;\n const toastTabbableCandidates = [toastNode, ...getTabbableCandidates(toastNode)];\n return tabbingDirection === 'forwards'\n ? toastTabbableCandidates\n : toastTabbableCandidates.reverse();\n });\n return (\n tabbingDirection === 'forwards' ? tabbableCandidates.reverse() : tabbableCandidates\n ).flat();\n },\n [getItems]\n );\n\n React.useEffect(() => {\n const viewport = ref.current;\n // We programmatically manage tabbing as we are unable to influence\n // the source order with portals, this allows us to reverse the\n // tab order so that it runs from most recent toast to least\n if (viewport) {\n const handleKeyDown = (event: KeyboardEvent) => {\n const isMetaKey = event.altKey || event.ctrlKey || event.metaKey;\n const isTabKey = event.key === 'Tab' && !isMetaKey;\n\n if (isTabKey) {\n const focusedElement = document.activeElement;\n const isTabbingBackwards = event.shiftKey;\n const targetIsViewport = event.target === viewport;\n\n // If we're back tabbing after jumping to the viewport then we simply\n // proxy focus out to the preceding document\n if (targetIsViewport && isTabbingBackwards) {\n headFocusProxyRef.current?.focus();\n return;\n }\n\n const tabbingDirection = isTabbingBackwards ? 'backwards' : 'forwards';\n const sortedCandidates = getSortedTabbableCandidates({ tabbingDirection });\n const index = sortedCandidates.findIndex((candidate) => candidate === focusedElement);\n if (focusFirst(sortedCandidates.slice(index + 1))) {\n event.preventDefault();\n } else {\n // If we can't focus that means we're at the edges so we\n // proxy to the corresponding exit point and let the browser handle\n // tab/shift+tab keypress and implicitly pass focus to the next valid element in the document\n isTabbingBackwards\n ? headFocusProxyRef.current?.focus()\n : tailFocusProxyRef.current?.focus();\n }\n }\n };\n\n // Toasts are not in the viewport React tree so we need to bind DOM events\n viewport.addEventListener('keydown', handleKeyDown);\n return () => viewport.removeEventListener('keydown', handleKeyDown);\n }\n }, [getItems, getSortedTabbableCandidates]);\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: hasToasts ? undefined : 'none' }}\n >\n {hasToasts && (\n <FocusProxy\n ref={headFocusProxyRef}\n onFocusFromOutsideViewport={() => {\n const tabbableCandidates = getSortedTabbableCandidates({\n tabbingDirection: 'forwards',\n });\n focusFirst(tabbableCandidates);\n }}\n />\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 <Collection.Slot scope={__scopeToast}>\n <Primitive.ol tabIndex={-1} {...viewportProps} ref={composedRefs} />\n </Collection.Slot>\n {hasToasts && (\n <FocusProxy\n ref={tailFocusProxyRef}\n onFocusFromOutsideViewport={() => {\n const tabbableCandidates = getSortedTabbableCandidates({\n tabbingDirection: 'backwards',\n });\n focusFirst(tabbableCandidates);\n }}\n />\n )}\n </DismissableLayer.Branch>\n );\n }\n);\n\nToastViewport.displayName = VIEWPORT_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst FOCUS_PROXY_NAME = 'ToastFocusProxy';\n\ntype FocusProxyElement = React.ElementRef<typeof VisuallyHidden>;\ntype VisuallyHiddenProps = Radix.ComponentPropsWithoutRef<typeof VisuallyHidden>;\ninterface FocusProxyProps extends VisuallyHiddenProps {\n onFocusFromOutsideViewport(): void;\n}\n\nconst FocusProxy = React.forwardRef<FocusProxyElement, ScopedProps<FocusProxyProps>>(\n (props, forwardedRef) => {\n const { __scopeToast, onFocusFromOutsideViewport, ...proxyProps } = props;\n const context = useToastProviderContext(FOCUS_PROXY_NAME, __scopeToast);\n\n return (\n <VisuallyHidden\n aria-hidden\n tabIndex={0}\n {...proxyProps}\n ref={forwardedRef}\n // Avoid page scrolling when focus is on the focus proxy\n style={{ position: 'fixed' }}\n onFocus={(event) => {\n const prevFocusedElement = event.relatedTarget as HTMLElement | null;\n const isFocusFromOutsideViewport = !context.viewport?.contains(prevFocusedElement);\n if (isFocusFromOutsideViewport) onFocusFromOutsideViewport();\n }}\n />\n );\n }\n);\n\nFocusProxy.displayName = FOCUS_PROXY_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 <Collection.ItemSlot scope={__scopeToast}>\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 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 (\n isDeltaInDirection(delta, context.swipeDirection, context.swipeThreshold)\n ) {\n handleAndDispatchCustomEvent(TOAST_SWIPE_END, onSwipeEnd, eventDetail, {\n discrete: true,\n });\n } else {\n handleAndDispatchCustomEvent(\n TOAST_SWIPE_CANCEL,\n onSwipeCancel,\n eventDetail,\n {\n discrete: true,\n }\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 </Collection.ItemSlot>,\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\ninterface ToastAnnounceProps\n extends React.ComponentPropsWithoutRef<'div'>,\n ScopedProps<{ children?: ToastImplProps['children'] }> {}\n\nconst ToastAnnounce: React.FC<ToastAnnounceProps> = (props: ScopedProps<ToastAnnounceProps>) => {\n const { __scopeToast, children, ...announceProps } = props;\n const context = useToastProviderContext(TOAST_NAME, __scopeToast);\n const [renderAnnounceText, setRenderAnnounceText] = React.useState(false);\n const [isAnnounced, setIsAnnounced] = React.useState(false);\n const [fragment, setFragment] = React.useState<DocumentFragment>();\n const [rootFragmentNode, setRootFragmentNode] = React.useState<HTMLDivElement | null>(null);\n\n // We portal children into a document fragment so that we can extract the bare text nodes\n // before rendering to the DOM. This avoids issues with duplicate `children`\n // and animation libraries when composing via `asChild`.\n const announceTextContent = React.useMemo(() => {\n return rootFragmentNode ? getAnnounceTextContent(rootFragmentNode) : null;\n }, [rootFragmentNode]);\n\n // setting the fragment in `useLayoutEffect` as `DocumentFragment` doesn't exist on the server\n useLayoutEffect(() => {\n setFragment(new DocumentFragment());\n }, []);\n\n // render text content in the next frame to ensure toast is announced in NVDA\n useNextFrame(() => setRenderAnnounceText(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 <>\n {fragment && (\n <Portal container={fragment as any} ref={setRootFragmentNode}>\n {context.label} {children}\n </Portal>\n )}\n <Portal asChild>\n <VisuallyHidden {...announceProps}>\n {renderAnnounceText && announceTextContent}\n </VisuallyHidden>\n </Portal>\n </>\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\nfunction getAnnounceTextContent(container: HTMLElement) {\n const textContent: string[] = [];\n const childNodes = Array.from(container.childNodes);\n\n childNodes.forEach((node) => {\n if (node.nodeType === node.TEXT_NODE && node.textContent) textContent.push(node.textContent);\n if (isHTMLElement(node)) {\n const isHidden = node.ariaHidden || node.hidden || node.style.display === 'none';\n if (!isHidden) textContent.push(...getAnnounceTextContent(node));\n }\n });\n\n // We return a collection of text rather than a single concatenated string.\n // This allows SR VO to naturally pause break between nodes while announcing.\n return textContent;\n}\n\nfunction isHTMLElement(node: any): node is HTMLElement {\n return node.nodeType === node.ELEMENT_NODE;\n}\n\n/**\n * Returns a list of potential tabbable candidates.\n *\n * NOTE: This is only a close approximation. For example it doesn't take into account cases like when\n * elements are not visible. This cannot be worked out easily by just reading a property, but rather\n * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker\n * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1\n */\nfunction getTabbableCandidates(container: HTMLElement) {\n const nodes: HTMLElement[] = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node: any) => {\n const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';\n if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;\n // `.tabIndex` is not the same as the `tabindex` attribute. It works on the\n // runtime's understanding of tabbability, so this automatically accounts\n // for any kind of element that could be tabbed to.\n return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n },\n });\n while (walker.nextNode()) nodes.push(walker.currentNode as HTMLElement);\n // we do not take into account the order of nodes with positive `tabIndex` as it\n // hinders accessibility to have tab order different from visual order.\n return nodes;\n}\n\nfunction focusFirst(candidates: HTMLElement[]) {\n const previouslyFocusedElement = document.activeElement;\n return candidates.some((candidate) => {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === previouslyFocusedElement) return true;\n candidate.focus();\n return document.activeElement !== previouslyFocusedElement;\n });\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":["createToastScope","ToastProvider","ToastViewport","Toast","ToastTitle","ToastDescription","ToastAction","ToastClose","Provider","Viewport","Root","Title","Description","Action","Close","React","ReactDOM","composeEventHandlers","useComposedRefs","createCollection","createContextScope","DismissableLayer","Portal","Presence","Primitive","dispatchDiscreteCustomEvent","useCallbackRef","useControllableState","useLayoutEffect","VisuallyHidden","PROVIDER_NAME","Collection","useCollection","createCollectionScope","createToastContext","ToastProviderProvider","useToastProviderContext","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","forwardRef","forwardedRef","hotkey","viewportProps","context","getItems","wrapperRef","headFocusProxyRef","tailFocusProxyRef","ref","composedRefs","onViewportChange","hotkeyLabel","join","replace","hasToasts","useEffect","handleKeyDown","event","isHotkeyPressed","every","key","code","current","focus","document","addEventListener","removeEventListener","wrapper","handlePause","pauseEvent","CustomEvent","dispatchEvent","handleResume","resumeEvent","window","getSortedTabbableCandidates","tabbingDirection","toastItems","tabbableCandidates","map","toastItem","toastNode","toastTabbableCandidates","getTabbableCandidates","reverse","flat","isMetaKey","altKey","ctrlKey","metaKey","isTabKey","focusedElement","activeElement","isTabbingBackwards","shiftKey","targetIsViewport","target","sortedCandidates","index","findIndex","candidate","focusFirst","slice","preventDefault","pointerEvents","undefined","FOCUS_PROXY_NAME","FocusProxy","onFocusFromOutsideViewport","proxyProps","position","prevFocusedElement","relatedTarget","isFocusFromOutsideViewport","contains","TOAST_NAME","TOAST_SWIPE_START","TOAST_SWIPE_MOVE","TOAST_SWIPE_CANCEL","TOAST_SWIPE_END","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","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","setPointerCapture","pointerId","abs","onPointerUp","releasePointerCapture","toast","once","ToastAnnounce","announceProps","renderAnnounceText","setRenderAnnounceText","isAnnounced","setIsAnnounced","fragment","setFragment","rootFragmentNode","setRootFragmentNode","announceTextContent","useMemo","getAnnounceTextContent","DocumentFragment","useNextFrame","timer","TITLE_NAME","titleProps","DESCRIPTION_NAME","descriptionProps","ACTION_NAME","altText","actionProps","CLOSE_NAME","closeProps","interactiveContext","onClick","name","handler","bubbles","cancelable","direction","threshold","deltaX","deltaY","isDeltaX","callback","fn","raf1","raf2","requestAnimationFrame","cancelAnimationFrame","container","textContent","childNodes","Array","from","forEach","node","nodeType","TEXT_NODE","push","isHTMLElement","isHidden","ariaHidden","hidden","display","ELEMENT_NODE","nodes","walker","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","isHiddenInput","tagName","disabled","FILTER_SKIP","tabIndex","FILTER_ACCEPT","nextNode","currentNode","candidates","previouslyFocusedElement","some"],"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.52",
3
+ "version": "0.1.2-rc.55",
4
4
  "license": "MIT",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -17,18 +17,18 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@babel/runtime": "^7.13.10",
20
- "@radix-ui/primitive": "0.1.1-rc.2",
21
- "@radix-ui/react-collection": "0.1.5-rc.42",
22
- "@radix-ui/react-compose-refs": "0.1.1-rc.42",
23
- "@radix-ui/react-context": "0.1.2-rc.42",
24
- "@radix-ui/react-dismissable-layer": "0.1.6-rc.42",
25
- "@radix-ui/react-presence": "0.1.3-rc.42",
26
- "@radix-ui/react-primitive": "0.1.5-rc.42",
27
- "@radix-ui/react-slot": "0.1.3-rc.42",
28
- "@radix-ui/react-use-callback-ref": "0.1.1-rc.42",
29
- "@radix-ui/react-use-controllable-state": "0.1.1-rc.42",
30
- "@radix-ui/react-use-layout-effect": "0.1.1-rc.42",
31
- "@radix-ui/react-visually-hidden": "0.1.5-rc.42"
20
+ "@radix-ui/primitive": "0.1.1-rc.5",
21
+ "@radix-ui/react-collection": "0.1.5-rc.45",
22
+ "@radix-ui/react-compose-refs": "0.1.1-rc.45",
23
+ "@radix-ui/react-context": "0.1.2-rc.45",
24
+ "@radix-ui/react-dismissable-layer": "0.1.6-rc.45",
25
+ "@radix-ui/react-portal": "0.1.5-rc.45",
26
+ "@radix-ui/react-presence": "0.1.3-rc.45",
27
+ "@radix-ui/react-primitive": "0.1.5-rc.45",
28
+ "@radix-ui/react-use-callback-ref": "0.1.1-rc.45",
29
+ "@radix-ui/react-use-controllable-state": "0.1.1-rc.45",
30
+ "@radix-ui/react-use-layout-effect": "0.1.1-rc.45",
31
+ "@radix-ui/react-visually-hidden": "0.1.5-rc.45"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "react": "^16.8 || ^17.0 || ^18.0",