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ChF,MAAM,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, {createContext, ForwardedRef, forwardRef, HTMLAttributes, JSX, ReactElement, ReactNode, useContext} 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   * @selector [data-hovered]\n   */\n  isHovered: boolean,\n  /**\n   * Whether the toast region is currently focused.\n   * @selector [data-focused]\n   */\n  isFocused: boolean,\n  /**\n   * Whether the toast region is keyboard focused.\n   * @selector [data-focus-visible]\n   */\n  isFocusVisible: boolean\n}\n\nexport interface ToastRegionProps<T> extends AriaToastRegionProps, StyleRenderProps<ToastRegionRenderProps<T>>, GlobalDOMAttributes<HTMLDivElement> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state.\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>(props: ToastRegionProps<T>, ref: ForwardedRef<HTMLDivElement>): 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' ? <ToastList {...props} render={undefined} className={undefined} style={{display: 'contents'}}>{props.children}</ToastList> : props.children}\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> extends Omit<ToastRegionProps<T>, 'queue' | 'children' | 'render'>, 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>(props: ToastListProps<T>, ref: ForwardedRef<HTMLOListElement>) {\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   * @selector [data-focused]\n   */\n  isFocused: boolean,\n  /**\n   * Whether the toast is keyboard focused.\n   * @selector [data-focus-visible]\n   */\n  isFocusVisible: boolean\n}\n\nexport interface ToastProps<T> 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 element. A function may be provided to compute the class based on component state.\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 application.\n */\nconst Toast = /*#__PURE__*/ (forwardRef as forwardRefType)(function Toast<T>(props: ToastProps<T>, ref: ForwardedRef<HTMLDivElement>) {\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          [TextContext, {\n            slots: {\n              [DEFAULT_SLOT]: {},\n              title: titleProps,\n              description: descriptionProps\n            }\n          }],\n          [ButtonContext, {\n            slots: {\n              [DEFAULT_SLOT]: {},\n              close: closeButtonProps\n            }\n          }]\n        ]}>\n        {renderProps.children}\n      </Provider>\n    </dom.div>\n  );\n});\n\nexport interface ToastContentProps extends HTMLAttributes<HTMLElement>, DOMRenderProps<'div', undefined> {}\n\nexport const ToastContentContext = createContext<ContextValue<HTMLAttributes<HTMLElement>, HTMLDivElement>>({});\n\n/**\n * ToastContent wraps the main content of a toast notification.\n */\nexport const ToastContent = /*#__PURE__*/ forwardRef(function ToastContent(props: ToastContentProps, ref: ForwardedRef<HTMLDivElement>) {\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 {Toast as UNSTABLE_Toast, ToastList as UNSTABLE_ToastList, ToastRegion as UNSTABLE_ToastRegion, ToastContent as UNSTABLE_ToastContent, ToastStateContext as UNSTABLE_ToastStateContext};\n"],"names":[],"version":3,"file":"Toast.cjs.map"}