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AAM,QAAQ;AAGrB","sources":["packages/react-aria-components/src/Toast.tsx"],"sourcesContent":["/*\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaToastProps, AriaToastRegionProps, useToast, useToastRegion} from 'react-aria/useToast';\n\nimport {ButtonContext} from './Button';\nimport {\n  ClassNameOrFunction,\n  ContextValue,\n  DEFAULT_SLOT,\n  dom,\n  DOMRenderProps,\n  Provider,\n  RenderProps,\n  StyleRenderProps,\n  useContextProps,\n  useRenderProps\n} from './utils';\nimport {createPortal} from 'react-dom';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {QueuedToast, ToastQueue, ToastState, useToastQueue} from 'react-stately/useToastState';\nimport React, {\n  createContext,\n  ForwardedRef,\n  forwardRef,\n  HTMLAttributes,\n  JSX,\n  ReactElement,\n  ReactNode,\n  useContext\n} from 'react';\nimport {TextContext} from './Text';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useHover} from 'react-aria/useHover';\nimport {useIsSSR} from 'react-aria/SSRProvider';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useObjectRef} from 'react-aria/useObjectRef';\nimport {useUNSAFE_PortalContext} from 'react-aria/PortalProvider';\n\nconst ToastStateContext = createContext<ToastState<any> | null>(null);\n\nexport interface ToastRegionRenderProps<T> {\n  /** A list of all currently visible toasts. */\n  visibleToasts: QueuedToast<T>[];\n  /**\n   * Whether the toast region is currently hovered with a mouse.\n   *\n   * @selector [data-hovered]\n   */\n  isHovered: boolean;\n  /**\n   * Whether the toast region is currently focused.\n   *\n   * @selector [data-focused]\n   */\n  isFocused: boolean;\n  /**\n   * Whether the toast region is keyboard focused.\n   *\n   * @selector [data-focus-visible]\n   */\n  isFocusVisible: boolean;\n}\n\nexport interface ToastRegionProps<T>\n  extends\n    AriaToastRegionProps,\n    StyleRenderProps<ToastRegionRenderProps<T>>,\n    GlobalDOMAttributes<HTMLDivElement> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n   * element. A function may be provided to compute the class based on component state.\n   *\n   * @default 'react-aria-ToastRegion'\n   */\n  className?: ClassNameOrFunction<ToastRegionRenderProps<T>>;\n  /** The queue of toasts to display. */\n  queue: ToastQueue<T>;\n  /** A function to render each toast, or children containing a `<ToastList>`. */\n  children: ReactNode | ((renderProps: {toast: QueuedToast<T>}) => ReactElement);\n}\n\n/**\n * A ToastRegion displays one or more toast notifications.\n */\nconst ToastRegion = /*#__PURE__*/ (forwardRef as forwardRefType)(function ToastRegion<T>(\n  props: ToastRegionProps<T>,\n  ref: ForwardedRef<HTMLDivElement>\n): JSX.Element | null {\n  let isSSR = useIsSSR();\n  let state = useToastQueue(props.queue);\n  let objectRef = useObjectRef(ref);\n  let {regionProps} = useToastRegion(props, state, objectRef);\n\n  let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n  let {hoverProps, isHovered} = useHover({});\n  let renderProps = useRenderProps({\n    ...props,\n    children: undefined,\n    defaultClassName: 'react-aria-ToastRegion',\n    values: {\n      visibleToasts: state.visibleToasts,\n      isHovered,\n      isFocused,\n      isFocusVisible\n    }\n  });\n\n  let {direction} = useLocale();\n  let portalContainer;\n  let {getContainer} = useUNSAFE_PortalContext();\n  if (!isSSR) {\n    portalContainer = document.body;\n    if (getContainer) {\n      portalContainer = getContainer();\n    }\n  }\n\n  let DOMProps = filterDOMProps(props, {global: true});\n\n  let region = (\n    <ToastStateContext.Provider value={state}>\n      <dom.div\n        {...mergeProps(DOMProps, renderProps, regionProps, focusProps, hoverProps)}\n        dir={direction}\n        ref={objectRef}\n        data-hovered={isHovered || undefined}\n        data-focused={isFocused || undefined}\n        data-focus-visible={isFocusVisible || undefined}>\n        {typeof props.children === 'function' ? (\n          <ToastList\n            {...props}\n            render={undefined}\n            className={undefined}\n            style={{display: 'contents'}}>\n            {props.children}\n          </ToastList>\n        ) : (\n          props.children\n        )}\n      </dom.div>\n    </ToastStateContext.Provider>\n  );\n\n  return state.visibleToasts.length > 0 && portalContainer\n    ? createPortal(region, portalContainer)\n    : null;\n});\n\nexport interface ToastListProps<T>\n  extends\n    Omit<ToastRegionProps<T>, 'queue' | 'children' | 'render'>,\n    DOMRenderProps<'ol', ToastRegionRenderProps<T>> {\n  /** A function to render each toast. */\n  children: (renderProps: {toast: QueuedToast<T>}) => ReactElement;\n}\n\nconst ToastList = /*#__PURE__*/ (forwardRef as forwardRefType)(function ToastList<T>(\n  props: ToastListProps<T>,\n  ref: ForwardedRef<HTMLOListElement>\n) {\n  let state = useContext(ToastStateContext)!;\n  let {hoverProps, isHovered} = useHover({});\n  let renderProps = useRenderProps({\n    ...props,\n    children: undefined,\n    defaultClassName: 'react-aria-ToastList',\n    values: {\n      visibleToasts: state.visibleToasts,\n      isFocused: false,\n      isFocusVisible: false,\n      isHovered\n    }\n  });\n\n  return (\n    <dom.ol {...hoverProps} {...renderProps} ref={ref}>\n      {state.visibleToasts.map(toast => (\n        <li key={toast.key} style={{display: 'contents'}}>\n          {props.children({toast})}\n        </li>\n      ))}\n    </dom.ol>\n  );\n});\n\nexport interface ToastRenderProps<T> {\n  /**\n   * The toast object to display.\n   */\n  toast: QueuedToast<T>;\n  /**\n   * Whether the toast is currently focused.\n   *\n   * @selector [data-focused]\n   */\n  isFocused: boolean;\n  /**\n   * Whether the toast is keyboard focused.\n   *\n   * @selector [data-focus-visible]\n   */\n  isFocusVisible: boolean;\n}\n\nexport interface ToastProps<T>\n  extends AriaToastProps<T>, RenderProps<ToastRenderProps<T>>, GlobalDOMAttributes<HTMLDivElement> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n   * element. A function may be provided to compute the class based on component state.\n   *\n   * @default 'react-aria-Toast'\n   */\n  className?: ClassNameOrFunction<ToastRenderProps<T>>;\n}\n\n/**\n * A Toast displays a brief, temporary notification of actions, errors, or other events in an\n * application.\n */\nconst Toast = /*#__PURE__*/ (forwardRef as forwardRefType)(function Toast<T>(\n  props: ToastProps<T>,\n  ref: ForwardedRef<HTMLDivElement>\n) {\n  let state = useContext(ToastStateContext)!;\n  let objectRef = useObjectRef(ref);\n  let {toastProps, contentProps, titleProps, descriptionProps, closeButtonProps} = useToast(\n    props,\n    state,\n    objectRef\n  );\n\n  let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n  let renderProps = useRenderProps({\n    ...props,\n    defaultClassName: 'react-aria-Toast',\n    values: {\n      toast: props.toast,\n      isFocused,\n      isFocusVisible\n    }\n  });\n\n  let DOMProps = filterDOMProps(props, {global: true});\n\n  return (\n    <dom.div\n      {...mergeProps(DOMProps, renderProps, toastProps, focusProps)}\n      ref={objectRef}\n      data-focused={isFocused || undefined}\n      data-focus-visible={isFocusVisible || undefined}>\n      <Provider\n        values={[\n          [ToastContentContext, contentProps],\n          [\n            TextContext,\n            {\n              slots: {\n                [DEFAULT_SLOT]: {},\n                title: titleProps,\n                description: descriptionProps\n              }\n            }\n          ],\n          [\n            ButtonContext,\n            {\n              slots: {\n                [DEFAULT_SLOT]: {},\n                close: closeButtonProps\n              }\n            }\n          ]\n        ]}>\n        {renderProps.children}\n      </Provider>\n    </dom.div>\n  );\n});\n\nexport interface ToastContentProps\n  extends HTMLAttributes<HTMLElement>, DOMRenderProps<'div', undefined> {}\n\nexport const ToastContentContext = createContext<\n  ContextValue<HTMLAttributes<HTMLElement>, HTMLDivElement>\n>({});\n\n/**\n * ToastContent wraps the main content of a toast notification.\n */\nexport const ToastContent = /*#__PURE__*/ forwardRef(function ToastContent(\n  props: ToastContentProps,\n  ref: ForwardedRef<HTMLDivElement>\n) {\n  [props, ref] = useContextProps(props, ref, ToastContentContext);\n  return (\n    <dom.div render={props.render} className=\"react-aria-ToastContent\" {...props} ref={ref}>\n      {props.children}\n    </dom.div>\n  );\n});\n\nexport {\n  Toast as UNSTABLE_Toast,\n  ToastList as UNSTABLE_ToastList,\n  ToastRegion as UNSTABLE_ToastRegion,\n  ToastContent as UNSTABLE_ToastContent,\n  ToastStateContext as UNSTABLE_ToastStateContext\n};\n"],"names":[],"version":3,"file":"Toast.cjs.map"}