import _defineProperty from "@babel/runtime/helpers/defineProperty";
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
import "core-js/modules/es.symbol.js";
import "core-js/modules/es.array.filter.js";
import "core-js/modules/es.array.for-each.js";
import "core-js/modules/es.array.push.js";
import "core-js/modules/es.object.define-properties.js";
import "core-js/modules/es.object.define-property.js";
import "core-js/modules/es.object.get-own-property-descriptor.js";
import "core-js/modules/es.object.get-own-property-descriptors.js";
import "core-js/modules/es.object.keys.js";
import "core-js/modules/es.object.to-string.js";
import "core-js/modules/esnext.iterator.constructor.js";
import "core-js/modules/esnext.iterator.filter.js";
import "core-js/modules/esnext.iterator.for-each.js";
import "core-js/modules/web.dom-collections.for-each.js";
import "core-js/modules/web.timers.js";
import { useEffect, useState } from 'react';
import { BlinkingBox } from '.';
import { useI18n } from '../../i18n';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
var meta = {
  title: 'Components/BlinkingBox',
  tags: ['autodocs'],
  component: BlinkingBox,
  args: {
    visible: true,
    duration: 3,
    type: 'warn',
    styles: {
      display: 'flex'
    }
  },
  argTypes: {}
};
export var Doc = function Doc(props) {
  var visible = props.visible,
    duration = props.duration,
    type = props.type,
    styles = props.styles;
  var _useState = useState(true),
    _useState2 = _slicedToArray(_useState, 2),
    basicVisible = _useState2[0],
    setBasicVisible = _useState2[1];
  var t = useI18n();
  var handleChange = function handleChange(val) {
    if (!val) {
      setBasicVisible(false);
    }
  };
  useEffect(function () {
    if (!basicVisible) {
      var timerId = setTimeout(function () {
        setBasicVisible(true);
        clearTimeout(timerId);
      }, 2 * 1000);
    }
  }, [basicVisible]);
  return /*#__PURE__*/_jsxs("div", {
    children: [/*#__PURE__*/_jsxs("div", {
      style: {
        width: 200,
        marginBottom: 50
      },
      children: ["Basic:", /*#__PURE__*/_jsx(BlinkingBox, {
        visible: basicVisible,
        onChange: handleChange,
        children: /*#__PURE__*/_jsx("span", {
          children: t('fmt_uimanager_tips_exceed')
        })
      })]
    }), /*#__PURE__*/_jsxs("div", {
      children: ["Please Change Properties:", /*#__PURE__*/_jsx("br", {}), "Change visible to true:", /*#__PURE__*/_jsx("div", {
        style: {
          width: 200,
          marginBottom: 50
        },
        children: /*#__PURE__*/_jsx(BlinkingBox, {
          visible: visible,
          styles: _objectSpread({}, styles),
          children: /*#__PURE__*/_jsx("span", {
            children: t('fmt_uimanager_tips_exceed')
          })
        })
      }), "Change duration to 3:", /*#__PURE__*/_jsx("div", {
        style: {
          width: 200,
          marginBottom: 50
        },
        children: /*#__PURE__*/_jsx(BlinkingBox, {
          visible: visible,
          duration: duration,
          styles: _objectSpread({}, styles),
          children: /*#__PURE__*/_jsx("span", {
            children: t('fmt_uimanager_tips_exceed')
          })
        })
      }), "Change type to 'warn':", /*#__PURE__*/_jsx("div", {
        style: {
          width: 200,
          marginBottom: 50
        },
        children: /*#__PURE__*/_jsx(BlinkingBox, {
          visible: visible,
          type: type,
          styles: _objectSpread({}, styles),
          children: /*#__PURE__*/_jsx("span", {
            children: t('fmt_uimanager_tips_exceed')
          })
        })
      })]
    })]
  });
};
export default meta;