import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
import { useState } from 'react';
import { BaseDialog, FcrClassDialog, FcrConfirmDialog } from '.';
import { FcrGlobalDialog } from './global-dialog';
import { FcrButton } from '../button';
import { FcrIcon } from '../icon';
import { FcrIconType } from '../icon/type';
import { FcrBasicConfirmDialog } from './basic-confirm-dialog';
import { FcrDialogApi } from './confirm';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
var meta = {
  title: 'Components/Dialog'
};
export var Docs = function Docs() {
  var _useState = useState(false),
    _useState2 = _slicedToArray(_useState, 2),
    visible = _useState2[0],
    setVisible = _useState2[1];
  var _useState3 = useState(false),
    _useState4 = _slicedToArray(_useState3, 2),
    confirmDialogVisible = _useState4[0],
    setConfirmDialogVisible = _useState4[1];
  var _useState5 = useState(false),
    _useState6 = _slicedToArray(_useState5, 2),
    FcrBasicConfirmDialogVisible = _useState6[0],
    setBasicConfirmVisible = _useState6[1];
  var _useState7 = useState(false),
    _useState8 = _slicedToArray(_useState7, 2),
    classDialogVisible = _useState8[0],
    setClassDialogVisible = _useState8[1];
  var _useState9 = useState(false),
    _useState0 = _slicedToArray(_useState9, 2),
    globalDialogVisible = _useState0[0],
    setGlobalDialogVisible = _useState0[1];
  var handlerDialog = function handlerDialog() {
    FcrDialogApi.warning({
      id: 'warning',
      dialogProps: {
        title: 'title',
        content: 'content',
        onOk: function onOk() {
          return console.log('ok');
        },
        onCancel: function onCancel() {
          return console.log('cancel');
        },
        visible: true
      }
    });
  };
  return /*#__PURE__*/_jsxs("div", {
    children: [/*#__PURE__*/_jsx(FcrButton, {
      onClick: function onClick() {
        return setVisible(true);
      },
      children: "open base dialog"
    }), /*#__PURE__*/_jsx(FcrButton, {
      onClick: handlerDialog,
      children: "use api open base dialog "
    }), /*#__PURE__*/_jsx(FcrButton, {
      onClick: function onClick() {
        return setBasicConfirmVisible(true);
      },
      children: "open base confirm dialog"
    }), /*#__PURE__*/_jsx(FcrButton, {
      onClick: function onClick() {
        return setConfirmDialogVisible(true);
      },
      children: "open confirm dialog"
    }), /*#__PURE__*/_jsx(FcrButton, {
      onClick: function onClick() {
        return setClassDialogVisible(true);
      },
      children: "open class dialog"
    }), /*#__PURE__*/_jsx(FcrButton, {
      onClick: function onClick() {
        return setGlobalDialogVisible(true);
      },
      children: "open global dialog"
    }), /*#__PURE__*/_jsx(BaseDialog, {
      closable: true,
      visible: visible,
      onClose: function onClose() {
        return setVisible(false);
      },
      children: /*#__PURE__*/_jsx("div", {
        children: "Base Dialog"
      })
    }), /*#__PURE__*/_jsx(FcrBasicConfirmDialog, {
      visible: FcrBasicConfirmDialogVisible,
      onOk: function onOk() {
        return setBasicConfirmVisible(false);
      },
      onCancel: function onCancel() {
        return setBasicConfirmVisible(false);
      },
      title: "Basic Confirm Dialog"
    }), /*#__PURE__*/_jsx(FcrConfirmDialog, {
      icon: /*#__PURE__*/_jsx(FcrIcon, {
        type: FcrIconType.FCR_BTN_LOADING,
        size: 50
      }),
      checkedProps: {
        label: '不再显示'
      },
      checkable: true,
      maskClosable: false,
      onOk: function onOk() {
        return setConfirmDialogVisible(false);
      },
      title: '移到垃圾桶',
      visible: confirmDialogVisible,
      onClose: function onClose() {
        return setConfirmDialogVisible(false);
      },
      children: /*#__PURE__*/_jsx("div", {
        children: "\u6B64\u767D\u677F\u5C06\u79FB\u5230\u5783\u573E\u6876\uFF0C\u534F\u4F5C\u7EC4\u5C06\u4E0D\u518D\u62E5\u6709\u5176\u8BBF\u95EE\u6743\u9650\u3002"
      })
    }), /*#__PURE__*/_jsx(FcrClassDialog, {
      imgUrl: " ",
      maskClosable: false,
      visible: classDialogVisible,
      onClose: function onClose() {
        return setClassDialogVisible(false);
      },
      title: '本节课程已结束！',
      content: '你可以去预约其它的课程啦',
      cancelBtn: false,
      actions: [{
        text: '我知道了，离开教室',
        styleType: 'danger',
        onClick: function onClick() {
          return setClassDialogVisible(false);
        }
      }]
    }), /*#__PURE__*/_jsx(FcrGlobalDialog, {
      header: /*#__PURE__*/_jsx("span", {
        children: "Global dialog"
      }),
      onClose: function onClose() {
        return setGlobalDialogVisible(false);
      },
      visible: globalDialogVisible,
      children: /*#__PURE__*/_jsx("div", {
        className: "fcr-text-1 fcr-flex fcr-justify-center",
        children: "global dialog"
      })
    })]
  });
};
export default meta;