UNPKG

1.3 kBJavaScriptView Raw
1"use client";
2
3import classNames from 'classnames';
4import * as React from 'react';
5import { useBootstrapPrefix } from './ThemeProvider';
6import { jsx as _jsx } from "react/jsx-runtime";
7const positionClasses = {
8 'top-start': 'top-0 start-0',
9 'top-center': 'top-0 start-50 translate-middle-x',
10 'top-end': 'top-0 end-0',
11 'middle-start': 'top-50 start-0 translate-middle-y',
12 'middle-center': 'top-50 start-50 translate-middle',
13 'middle-end': 'top-50 end-0 translate-middle-y',
14 'bottom-start': 'bottom-0 start-0',
15 'bottom-center': 'bottom-0 start-50 translate-middle-x',
16 'bottom-end': 'bottom-0 end-0'
17};
18const ToastContainer = /*#__PURE__*/React.forwardRef(({
19 bsPrefix,
20 position,
21 containerPosition,
22 className,
23 // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
24 as: Component = 'div',
25 ...props
26}, ref) => {
27 bsPrefix = useBootstrapPrefix(bsPrefix, 'toast-container');
28 return /*#__PURE__*/_jsx(Component, {
29 ref: ref,
30 ...props,
31 className: classNames(bsPrefix, position && positionClasses[position], containerPosition && `position-${containerPosition}`, className)
32 });
33});
34ToastContainer.displayName = 'ToastContainer';
35export default ToastContainer;
\No newline at end of file