import "core-js/modules/es.date.to-string.js";
import { useEffect } from 'react';
import { FcrToast, FcrToastApi, TOAST_ROOT_CLASS_NAME } from '.';
import { FcrButton } from '../button';
import { v4 as uuidv4 } from 'uuid';
import { FcrIconType } from '../icon/type';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
var meta = {
  title: 'Components/Toast',
  tags: ['autodocs'],
  argTypes: {
    size: {
      type: 'string',
      defaultValue: 'small'
    },
    content: {
      type: 'string',
      defaultValue: 'This is a toast message'
    },
    closable: {
      type: 'boolean',
      defaultValue: false
    },
    icon: {
      type: 'boolean',
      defaultValue: false
    },
    action: {
      type: 'boolean',
      defaultValue: false
    }
  },
  args: {
    size: 'small',
    content: 'This is a toast message',
    closable: false
  }
};
export var Basic = {
  render: function render(_ref) {
    var closable = _ref.closable,
      icon = _ref.icon,
      action = _ref.action,
      size = _ref.size,
      content = _ref.content;
    useEffect(function () {
      document.body.classList.add(TOAST_ROOT_CLASS_NAME);
    }, []);
    return /*#__PURE__*/_jsxs("div", {
      style: {
        display: 'flex',
        flexDirection: 'column',
        gap: '20px',
        width: '100%',
        height: '100%'
      },
      children: [/*#__PURE__*/_jsxs("div", {
        children: [/*#__PURE__*/_jsx(FcrButton, {
          onClick: function onClick() {
            FcrToastApi.open({
              id: uuidv4(),
              toastProps: {
                type: 'info',
                content: "test ".concat(new Date().getTime())
              }
            });
          },
          children: "show toast"
        }), /*#__PURE__*/_jsx(FcrButton, {
          onClick: function onClick() {
            FcrToastApi.open({
              id: uuidv4(),
              persist: true,
              duration: 15000,
              toastProps: {
                type: 'warn',
                content: "test ".concat(new Date().getTime()),
                closable: true
              }
            });
          },
          children: "show presist toast"
        })]
      }), /*#__PURE__*/_jsx(FcrToast, {
        size: size,
        icon: icon ? FcrIconType.FCR_HOST : undefined,
        action: action ? {
          onClick: function onClick() {},
          text: 'Learn more'
        } : undefined,
        type: "error",
        closable: closable,
        content: content
      }), /*#__PURE__*/_jsx(FcrToast, {
        size: size,
        action: action ? {
          onClick: function onClick() {},
          text: 'Learn more'
        } : undefined,
        icon: icon ? FcrIconType.FCR_HOST : undefined,
        closable: closable,
        type: "info",
        content: content
      }), /*#__PURE__*/_jsx(FcrToast, {
        size: size,
        action: action ? {
          onClick: function onClick() {},
          text: 'Learn more'
        } : undefined,
        icon: icon ? FcrIconType.FCR_HOST : undefined,
        closable: closable,
        type: "normal",
        content: content
      }), /*#__PURE__*/_jsx(FcrToast, {
        size: size,
        action: action ? {
          onClick: function onClick() {},
          text: 'Learn more'
        } : undefined,
        icon: icon ? FcrIconType.FCR_QUESTION : undefined,
        closable: closable,
        type: "warn",
        content: content
      })]
    });
  }
};
export default meta;