foxit-component 0.0.1-alpha.1 → 0.0.1-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Button/Button.d.ts +8 -11
- package/es/Button/Button.js +4 -6
- package/es/Button/button.css.js +1 -1
- package/es/Checkbox/Checkbox.d.ts +10 -0
- package/es/Checkbox/Checkbox.js +19 -0
- package/es/Checkbox/checkbox.css.js +6 -0
- package/es/Empty/Empty.d.ts +7 -0
- package/es/Empty/Empty.js +11 -0
- package/es/Empty/empty.css.js +6 -0
- package/es/Form/Form.d.ts +14 -0
- package/es/Form/Form.js +38 -0
- package/es/Form/Form.types.d.ts +39 -0
- package/es/Form/FormContext.d.ts +3 -0
- package/es/Form/FormContext.js +5 -0
- package/es/Form/FormItem.d.ts +16 -0
- package/es/Form/FormItem.js +35 -0
- package/es/Form/FormProvider.d.ts +10 -0
- package/es/Form/FormProvider.js +227 -0
- package/es/Form/form.css.js +6 -0
- package/es/Icon/index.d.ts +7 -0
- package/es/Icon/index.js +9 -0
- package/es/Input/Input.d.ts +13 -0
- package/es/Input/Input.js +28 -0
- package/es/Input/input.css.js +6 -0
- package/es/Menu/Menu.d.ts +22 -0
- package/es/Menu/Menu.js +50 -0
- package/es/Menu/menu.css.js +6 -0
- package/es/Modal/Modal.d.ts +20 -0
- package/es/Modal/Modal.js +39 -0
- package/es/Modal/ModalTemp.d.ts +11 -0
- package/es/Modal/ModalTemp.js +72 -0
- package/es/Modal/modal.css.js +6 -0
- package/es/Pagination/Pagination.d.ts +10 -0
- package/es/Pagination/Pagination.js +82 -0
- package/es/Pagination/pagination.css.js +6 -0
- package/es/Radio/Radio.d.ts +18 -0
- package/es/Radio/Radio.js +45 -0
- package/es/Radio/radio.css.js +6 -0
- package/es/Select/Select.d.ts +17 -0
- package/es/Select/Select.js +42 -0
- package/es/Table/Table.d.ts +15 -0
- package/es/Table/Table.js +15 -0
- package/es/Table/table.css.js +6 -0
- package/es/Tabs/Tabs.d.ts +14 -0
- package/es/Tabs/Tabs.js +22 -0
- package/es/Tabs/tabs.css.js +6 -0
- package/es/Tag/Tag.d.ts +8 -0
- package/es/Tag/Tag.js +11 -0
- package/es/Tag/tag.css.js +6 -0
- package/es/Toast/Toast.d.ts +5 -0
- package/es/Toast/Toast.js +44 -0
- package/es/Toast/Toast.types.d.ts +5 -0
- package/es/Toast/ToastContainer.d.ts +3 -0
- package/es/Toast/ToastContainer.js +47 -0
- package/es/Toast/ToastManager.d.ts +8 -0
- package/es/Toast/ToastManager.js +19 -0
- package/es/Toast/index.d.ts +8 -0
- package/es/Toast/index.js +39 -0
- package/es/Toast/toast.css.js +6 -0
- package/es/Tooltip/Tooltip.d.ts +8 -0
- package/es/Tooltip/Tooltip.js +31 -0
- package/es/Tooltip/tooltip.css.js +6 -0
- package/es/constants/icons.d.ts +24 -0
- package/es/constants/icons.js +29 -0
- package/es/index.d.ts +33 -0
- package/es/index.js +16 -0
- package/es/node_modules/style-inject/dist/style-inject.es.js +1 -1
- package/es/node_modules/tslib/tslib.es6.js +11 -1
- package/package.json +1 -1
package/es/Menu/Menu.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { __assign, __spreadArray } from '../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Icon } from '../Icon/index.js';
|
|
5
|
+
import './menu.css.js';
|
|
6
|
+
|
|
7
|
+
var getItem = function (label, key, icon, children, type) {
|
|
8
|
+
return {
|
|
9
|
+
key: key,
|
|
10
|
+
icon: icon,
|
|
11
|
+
children: children,
|
|
12
|
+
label: label,
|
|
13
|
+
type: type
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
var Menu = function (_a) {
|
|
17
|
+
var items = _a.items, onClick = _a.onClick, _b = _a.defaultSelectedKeys, defaultSelectedKeys = _b === void 0 ? [] : _b, _c = _a.defaultOpenKeys, defaultOpenKeys = _c === void 0 ? [] : _c, style = _a.style;
|
|
18
|
+
var _d = useState(defaultOpenKeys), openKeys = _d[0], setOpenKeys = _d[1];
|
|
19
|
+
var _e = useState(defaultSelectedKeys), selectedKeys = _e[0], setSelectedKeys = _e[1];
|
|
20
|
+
var handleMenuClick = function (e) {
|
|
21
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
22
|
+
setSelectedKeys([e.key]);
|
|
23
|
+
};
|
|
24
|
+
// const handleOpenChange = (keys: string[]) => {
|
|
25
|
+
// setOpenKeys(keys);
|
|
26
|
+
// };
|
|
27
|
+
var isFirstLevel = function (item) {
|
|
28
|
+
return items.some(function (i) { return i.key === item.key; });
|
|
29
|
+
};
|
|
30
|
+
var renderMenuItem = function (item) {
|
|
31
|
+
var isSelected = selectedKeys.includes(item.key.toString());
|
|
32
|
+
return (jsx("div", __assign({ className: "foxit-menu-item ".concat(isSelected ? 'selected' : '') }, { children: jsxs("div", __assign({ className: "foxit-menu-item-content", onClick: function () { return handleMenuClick({ key: item.key.toString() }); } }, { children: [item.icon && jsx("span", __assign({ style: { marginRight: '8px' } }, { children: item.icon })), jsx("span", __assign({ className: isFirstLevel(item) ? 'foxit-menu-item-label' : '' }, { children: item.label }))] })) }), item.key));
|
|
33
|
+
};
|
|
34
|
+
var renderSubMenu = function (item) {
|
|
35
|
+
var isOpen = openKeys.includes(item.key.toString());
|
|
36
|
+
return (jsxs("div", { children: [jsxs("div", __assign({ className: "foxit-menu-submenu-title", onClick: function () {
|
|
37
|
+
if (isOpen) {
|
|
38
|
+
setOpenKeys(openKeys.filter(function (key) { return key !== item.key.toString(); }));
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
setOpenKeys(__spreadArray(__spreadArray([], openKeys, true), [item.key.toString()], false));
|
|
42
|
+
}
|
|
43
|
+
} }, { children: [jsxs("div", __assign({ style: { display: 'flex', alignItems: 'center' } }, { children: [item.icon && jsx("span", __assign({ style: { marginRight: '8px' } }, { children: item.icon })), jsx("span", __assign({ className: isFirstLevel(item) ? 'foxit-menu-item-label' : '' }, { children: item.label }))] })), jsx("span", { children: jsx(Icon, { name: "DownOutlined", className: "foxit-menu-icon ".concat(isOpen ? '' : 'foxit-menu-rotated-icon') }) })] })), isOpen && item.children && (jsx("div", __assign({ className: "foxit-menu-submenu-items" }, { children: item.children.map(function (child) {
|
|
44
|
+
return child.children ? renderSubMenu(child) : renderMenuItem(child);
|
|
45
|
+
}) })))] }, item.key));
|
|
46
|
+
};
|
|
47
|
+
return (jsx("div", __assign({ className: "foxit-menu", style: __assign({}, style) }, { children: items.map(function (item) { return (item.children ? renderSubMenu(item) : renderMenuItem(item)); }) })));
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export { Menu as default, getItem };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import styleInject from '../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".foxit-menu {\n font-size: 14px;\n /* font-family: sans-serif;\n border: 0px solid #FFFFFF; */\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n border-radius: 10px;\n overflow: hidden;\n}\n\n.foxit-menu-item-content {\n padding: 8px 16px;\n cursor: pointer;\n display: flex;\n align-items: center;\n}\n\n.foxit-menu-item {\n padding-left: 0px;\n}\n\n.foxit-menu-item.selected {\n background-color: #fff6f0 !important;\n color: #ff5f00;\n font-weight: 600;\n}\n\n.foxit-menu-item:hover {\n background-color: #f5f6f8;\n}\n\n.foxit-menu-submenu-title {\n padding: 8px 16px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n.foxit-menu-submenu-title:hover {\n background-color: #f5f6f8;\n}\n\n.foxit-menu-icon {\n transition: transform 0.3s ease-in-out; /* Adjust timing as needed */\n}\n\n.foxit-menu-rotated-icon {\n transform: rotate(180deg);\n}\n\n.foxit-menu-item-label {\n font-weight: 600;\n}\n";
|
|
4
|
+
styleInject(css_248z);
|
|
5
|
+
|
|
6
|
+
export { css_248z as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import './modal.css';
|
|
3
|
+
interface IModalProps {
|
|
4
|
+
title: string | React.ReactNode;
|
|
5
|
+
opened?: boolean;
|
|
6
|
+
onOk?: () => void;
|
|
7
|
+
onOkText?: string | React.ReactNode;
|
|
8
|
+
onCancel?: () => void;
|
|
9
|
+
onCancelText?: string | React.ReactNode;
|
|
10
|
+
maskClosable?: boolean;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
width?: string;
|
|
13
|
+
}
|
|
14
|
+
interface ModalComponent extends FC<IModalProps> {
|
|
15
|
+
confirm: (props: IModalProps & {
|
|
16
|
+
content: React.ReactNode;
|
|
17
|
+
}) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare const Modal: ModalComponent;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { __assign } from '../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { Icon } from '../Icon/index.js';
|
|
4
|
+
import { createRoot } from 'react-dom/client';
|
|
5
|
+
import { Modal as Modal$1 } from './ModalTemp.js';
|
|
6
|
+
import { Button } from '../Button/Button.js';
|
|
7
|
+
import './modal.css.js';
|
|
8
|
+
|
|
9
|
+
var ModalContent = function (_a) {
|
|
10
|
+
var title = _a.title, onCancel = _a.onCancel, _b = _a.onCancelText, onCancelText = _b === void 0 ? undefined : _b, onOk = _a.onOk, _c = _a.onOkText, onOkText = _c === void 0 ? undefined : _c, children = _a.children, _d = _a.width, width = _d === void 0 ? '400px' : _d;
|
|
11
|
+
return (jsxs("div", __assign({ className: "foxit-modal-content-container", style: {
|
|
12
|
+
maxWidth: width,
|
|
13
|
+
width: width
|
|
14
|
+
} }, { children: [jsxs("div", __assign({ className: "foxit-modal-head" }, { children: [jsx("div", __assign({ className: "foxit-modal-title" }, { children: title })), jsx("div", __assign({ onClick: onCancel, className: "foxit-modal-close-button" }, { children: jsx(Icon, { name: "CloseOutlined" }) }))] })), jsx("div", { children: children }), jsxs("div", __assign({ className: "foxit-modal-footer" }, { children: [onCancelText && (jsx(Button, __assign({ size: "medium", onClick: onCancel }, { children: onCancelText }))), onOkText && (jsx(Button, __assign({ primary: true, size: "medium", onClick: onOk }, { children: onOkText })))] }))] })));
|
|
15
|
+
};
|
|
16
|
+
var Modal = function (_a) {
|
|
17
|
+
var title = _a.title, opened = _a.opened, onOk = _a.onOk, onOkText = _a.onOkText, onCancel = _a.onCancel, onCancelText = _a.onCancelText, maskClosable = _a.maskClosable, children = _a.children, width = _a.width;
|
|
18
|
+
return (jsx(Modal$1, __assign({ opened: opened, onClose: onCancel || (function () { }), maskClosable: maskClosable, position: "top" }, { children: jsx(ModalContent, __assign({ title: title, width: width, onCancel: onCancel, onCancelText: onCancelText, onOk: onOk, onOkText: onOkText }, { children: children })) })));
|
|
19
|
+
};
|
|
20
|
+
// 语法糖的调用方式
|
|
21
|
+
Modal.confirm = function (_a) {
|
|
22
|
+
var title = _a.title, onOk = _a.onOk, onCancel = _a.onCancel, onOkText = _a.onOkText, onCancelText = _a.onCancelText, _b = _a.maskClosable, maskClosable = _b === void 0 ? true : _b, content = _a.content, width = _a.width;
|
|
23
|
+
var modalRoot = document.createElement('div');
|
|
24
|
+
document.body.appendChild(modalRoot);
|
|
25
|
+
var root = createRoot(modalRoot);
|
|
26
|
+
var handleClose = function () {
|
|
27
|
+
root.unmount();
|
|
28
|
+
document.body.removeChild(modalRoot);
|
|
29
|
+
};
|
|
30
|
+
root.render(jsx(Modal$1, __assign({ opened: true, onClose: handleClose, maskClosable: maskClosable, position: "top" }, { children: jsx(ModalContent, __assign({ title: title, width: width, onCancel: function () {
|
|
31
|
+
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
32
|
+
handleClose();
|
|
33
|
+
}, onCancelText: onCancelText, onOk: function () {
|
|
34
|
+
onOk === null || onOk === void 0 ? void 0 : onOk();
|
|
35
|
+
handleClose();
|
|
36
|
+
}, onOkText: onOkText }, { children: content })) })));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { Modal };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import './modal.css';
|
|
3
|
+
interface IModalProps {
|
|
4
|
+
opened: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
maskClosable?: boolean;
|
|
7
|
+
position?: 'center' | 'top' | 'bottom';
|
|
8
|
+
text?: string | React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const Modal: React.FC<React.PropsWithChildren<IModalProps>>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { __assign } from '../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useEffect, useRef } from 'react';
|
|
4
|
+
import { CSSTransition } from 'react-transition-group';
|
|
5
|
+
import { createPortal } from 'react-dom';
|
|
6
|
+
import classNames from 'classnames';
|
|
7
|
+
import './modal.css.js';
|
|
8
|
+
|
|
9
|
+
var contentAnimation = {
|
|
10
|
+
enter: 'foxit-modal-opacity-0 foxit-modal-scale-0',
|
|
11
|
+
enterActive: 'foxit-modal-transition foxit-modal-scale-100 foxit-modal-opacity-100',
|
|
12
|
+
exit: 'foxit-modal-opacity-100 foxit-modal-scale-100',
|
|
13
|
+
exitActive: 'foxit-modal-transition !foxit-modal-opacity-0 !foxit-modal-scale-0'
|
|
14
|
+
};
|
|
15
|
+
var overlayAnimation = {
|
|
16
|
+
enter: 'foxit-modal-opacity-0',
|
|
17
|
+
enterActive: 'foxit-modal-transition foxit-modal-opacity-100',
|
|
18
|
+
exit: 'foxit-modal-opacity-100',
|
|
19
|
+
exitActive: 'foxit-modal-transition !foxit-modal-opacity-0'
|
|
20
|
+
};
|
|
21
|
+
var Portal = function (_a) {
|
|
22
|
+
var children = _a.children;
|
|
23
|
+
var container = useState(function () { return document.createElement('div'); })[0];
|
|
24
|
+
useEffect(function () {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
(_b = (_a = document === null || document === void 0 ? void 0 : document.body) === null || _a === void 0 ? void 0 : _a.appendChild) === null || _b === void 0 ? void 0 : _b.call(_a, container);
|
|
27
|
+
}, [container]);
|
|
28
|
+
return createPortal(children, container);
|
|
29
|
+
};
|
|
30
|
+
var ModalLayout = function (_a) {
|
|
31
|
+
var _b = _a.onClose, onClose = _b === void 0 ? function () { } : _b, children = _a.children, opened = _a.opened, _c = _a.maskClosable, maskClosable = _c === void 0 ? true : _c, _d = _a.position, position = _d === void 0 ? 'center' : _d;
|
|
32
|
+
var overlayRef = useRef(null);
|
|
33
|
+
var contentRef = useRef(null);
|
|
34
|
+
var _e = useState(false), animationIn = _e[0], setAnimationIn = _e[1];
|
|
35
|
+
useEffect(function () {
|
|
36
|
+
setAnimationIn(opened);
|
|
37
|
+
}, [opened]);
|
|
38
|
+
var justifyClass = 'foxit-modal-justify-center';
|
|
39
|
+
if (position === 'top') {
|
|
40
|
+
justifyClass = 'foxit-modal-justify-top';
|
|
41
|
+
}
|
|
42
|
+
else if (position === 'bottom') {
|
|
43
|
+
justifyClass = 'foxit-modal-justify-bottom';
|
|
44
|
+
}
|
|
45
|
+
return (jsxs("div", __assign({ className: classNames('foxit-modal-fixed-layout', justifyClass) }, { children: [jsx(CSSTransition, __assign({ in: animationIn, nodeRef: overlayRef, timeout: 150, mountOnEnter: true, unmountOnExit: true, classNames: overlayAnimation }, { children: jsx("div", __assign({ ref: overlayRef, className: "foxit-modal-overlay", onClick: maskClosable ? onClose : undefined }, { children: jsx("div", { className: "foxit-modal-overlay-bg" }) })) })), jsx(CSSTransition, __assign({ in: animationIn, nodeRef: contentRef, timeout: 150, mountOnEnter: true, unmountOnExit: true, classNames: contentAnimation }, { children: jsx("div", __assign({ ref: contentRef, className: "foxit-modal-content" }, { children: children })) }))] })));
|
|
46
|
+
};
|
|
47
|
+
var Modal = function (_a) {
|
|
48
|
+
var opened = _a.opened, onClose = _a.onClose, maskClosable = _a.maskClosable, children = _a.children, position = _a.position;
|
|
49
|
+
var _b = useState(false), mounted = _b[0], setMounted = _b[1];
|
|
50
|
+
useEffect(function () {
|
|
51
|
+
if (opened && !mounted) {
|
|
52
|
+
setMounted(true);
|
|
53
|
+
}
|
|
54
|
+
else if (!opened && mounted) {
|
|
55
|
+
setTimeout(function () {
|
|
56
|
+
setMounted(false);
|
|
57
|
+
}, 150);
|
|
58
|
+
}
|
|
59
|
+
}, [opened, mounted]);
|
|
60
|
+
useEffect(function () {
|
|
61
|
+
document.body.style.overflowY = opened ? 'hidden' : '';
|
|
62
|
+
return function () {
|
|
63
|
+
document.body.style.overflow = '';
|
|
64
|
+
};
|
|
65
|
+
}, [opened]);
|
|
66
|
+
if (!mounted) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
return (jsx(Portal, { children: jsx(ModalLayout, __assign({ onClose: onClose, opened: opened, maskClosable: maskClosable, position: position }, { children: children })) }));
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export { Modal };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import styleInject from '../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".foxit-modal-content-container {\n display: flex;\n flex-direction: column;\n padding: 24px;\n background-color: #fff;\n border-radius: 10px;\n justify-content: space-between;\n min-width: 320px;\n gap: 24px;\n}\n\n.foxit-modal-head {\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n.foxit-modal-title {\n font-weight: 500;\n font-size: 20px;\n}\n\n.foxit-modal-close-button {\n display: flex;\n width: 16px;\n height: 16px;\n cursor: pointer;\n align-items: center;\n justify-content: center;\n}\n\n.foxit-modal-close-button svg {\n stroke: #6b7280;\n}\n\n.foxit-modal-close-button:hover svg {\n stroke: #ea580c;\n}\n\n.foxit-modal-footer {\n display: flex;\n gap: 16px;\n justify-content: flex-end;\n}\n\n.foxit-modal-fixed-layout {\n position: fixed;\n inset: 0;\n z-index: 50;\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: 36px;\n}\n\n.foxit-modal-justify-center {\n justify-content: center;\n}\n\n.foxit-modal-justify-top {\n justify-content: flex-start;\n padding-top: 96px;\n}\n\n.foxit-modal-justify-bottom {\n justify-content: flex-end;\n}\n\n.foxit-modal-overlay {\n position: fixed;\n inset: 0;\n z-index: 50;\n width: 100%;\n height: 100%;\n cursor: pointer;\n}\n\n.foxit-modal-overlay-bg {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.15); /* Equivalent to bg-main-black opacity-15 */\n}\n\n.foxit-modal-content {\n z-index: 50;\n max-height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n width: auto;\n font-size: 16px;\n font-weight: 400;\n}\n\n.foxit-modal-opacity-0 {\n opacity: 0;\n}\n\n.foxit-modal-opacity-100 {\n opacity: 1;\n}\n\n.foxit-modal-scale-0 {\n transform: scale(0);\n}\n\n.foxit-modal-scale-100 {\n transform: scale(1);\n}\n\n.foxit-modal-transition {\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.foxit-modal-hide-overflow {\n overflow-y: hidden;\n}\n";
|
|
4
|
+
styleInject(css_248z);
|
|
5
|
+
|
|
6
|
+
export { css_248z as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './pagination.css';
|
|
3
|
+
interface PaginationProps {
|
|
4
|
+
total: number;
|
|
5
|
+
pageSize: number;
|
|
6
|
+
onChange?: (page: number) => void;
|
|
7
|
+
defaultCurrent?: number;
|
|
8
|
+
}
|
|
9
|
+
declare const Pagination: React.FC<PaginationProps>;
|
|
10
|
+
export default Pagination;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { __assign } from '../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
4
|
+
import './pagination.css.js';
|
|
5
|
+
|
|
6
|
+
var $_MORE = 9999999999;
|
|
7
|
+
var Pagination = function (_a) {
|
|
8
|
+
var total = _a.total, pageSize = _a.pageSize, onChange = _a.onChange, _b = _a.defaultCurrent, defaultCurrent = _b === void 0 ? 1 : _b;
|
|
9
|
+
var _c = useState(defaultCurrent), current = _c[0], setCurrent = _c[1];
|
|
10
|
+
var _d = useState([]), pages = _d[0], setPages = _d[1];
|
|
11
|
+
var maxButtons = 5;
|
|
12
|
+
var totalPages = Math.ceil(total / pageSize);
|
|
13
|
+
useEffect(function () {
|
|
14
|
+
var generatePages = function () {
|
|
15
|
+
var pageArray = [];
|
|
16
|
+
if (totalPages <= maxButtons) {
|
|
17
|
+
for (var i = 1; i <= totalPages; i++) {
|
|
18
|
+
pageArray.push(i);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
pageArray.push(1);
|
|
23
|
+
var ellipsis = $_MORE;
|
|
24
|
+
if (current <= 3) {
|
|
25
|
+
for (var i = 2; i <= Math.min(maxButtons - 2, totalPages - 1); i++) {
|
|
26
|
+
pageArray.push(i);
|
|
27
|
+
}
|
|
28
|
+
pageArray.push(ellipsis);
|
|
29
|
+
}
|
|
30
|
+
else if (current >= totalPages - 2) {
|
|
31
|
+
pageArray.push(ellipsis);
|
|
32
|
+
for (var i = totalPages - maxButtons + 3; i <= totalPages - 1; i++) {
|
|
33
|
+
pageArray.push(i);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
pageArray.push(ellipsis);
|
|
38
|
+
pageArray.push(current - 1);
|
|
39
|
+
pageArray.push(current);
|
|
40
|
+
pageArray.push(current + 1);
|
|
41
|
+
pageArray.push(ellipsis);
|
|
42
|
+
}
|
|
43
|
+
pageArray.push(totalPages);
|
|
44
|
+
}
|
|
45
|
+
setPages(pageArray);
|
|
46
|
+
};
|
|
47
|
+
generatePages();
|
|
48
|
+
}, [total, pageSize, current, totalPages]);
|
|
49
|
+
var handleClick = function (page, index) {
|
|
50
|
+
if (page === $_MORE) {
|
|
51
|
+
if (index > 0 && pages[index - 1] !== null && pages[index - 1] !== 1) {
|
|
52
|
+
setCurrent(pages[index - 1] + 1);
|
|
53
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(pages[index - 1] + 1);
|
|
54
|
+
}
|
|
55
|
+
else if (index < pages.length - 1 &&
|
|
56
|
+
pages[index + 1] !== null &&
|
|
57
|
+
pages[index + 1] !== totalPages) {
|
|
58
|
+
setCurrent(pages[index + 1] - 1);
|
|
59
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(pages[index + 1] - 1);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else if (page !== current) {
|
|
63
|
+
setCurrent(page);
|
|
64
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(page);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var handlePrev = function () {
|
|
68
|
+
if (current > 1) {
|
|
69
|
+
setCurrent(current - 1);
|
|
70
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(current - 1);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var handleNext = function () {
|
|
74
|
+
if (current < totalPages) {
|
|
75
|
+
setCurrent(current + 1);
|
|
76
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(current + 1);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
return (jsxs("div", __assign({ className: "foxit-pagination-container" }, { children: [jsx("button", __assign({ className: "foxit-pagination-prev", onClick: handlePrev, disabled: current === 1 }, { children: '<' })), pages.map(function (page, index) { return (jsx("button", __assign({ className: "foxit-pagination-button", onClick: function () { return handleClick(page, index); }, disabled: page === current }, { children: page === $_MORE ? '...' : page }), index)); }), jsx("button", __assign({ className: "foxit-pagination-next", onClick: handleNext, disabled: current === totalPages }, { children: '>' }))] })));
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export { Pagination as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import styleInject from '../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".foxit-pagination-container {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.foxit-pagination-button,\n.foxit-pagination-prev,\n.foxit-pagination-next {\n font-size: 16px;\n font-weight: 500;\n height: 48px;\n min-width: 48px;\n padding: 0 12px;\n border: none;\n border-radius: 10px;\n margin: 0 4px;\n color: #757575;\n background-color: transparent;\n cursor: pointer;\n transition:\n background-color 0.3s ease,\n color 0.3s ease;\n}\n\n.foxit-pagination-next:hover,\n.foxit-pagination-prev:hover {\n color: #ff5f00;\n}\n\n.foxit-pagination-button:hover {\n background-color: rgba(255, 95, 0, 0.1);\n}\n\n.foxit-pagination-button:disabled {\n background-color: #ff5f00;\n color: white;\n cursor: default;\n}\n";
|
|
4
|
+
styleInject(css_248z);
|
|
5
|
+
|
|
6
|
+
export { css_248z as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode, FC } from 'react';
|
|
2
|
+
import './radio.css';
|
|
3
|
+
interface RadioProps {
|
|
4
|
+
value: string;
|
|
5
|
+
checked?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
onChange?: (value: string) => void;
|
|
9
|
+
}
|
|
10
|
+
interface RadioGroupProps {
|
|
11
|
+
onChange?: (value: string) => void;
|
|
12
|
+
value?: string;
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
declare const Radio: FC<RadioProps> & {
|
|
16
|
+
Group: FC<RadioGroupProps>;
|
|
17
|
+
};
|
|
18
|
+
export default Radio;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { __assign } from '../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { createContext, useContext, useState } from 'react';
|
|
4
|
+
import './radio.css.js';
|
|
5
|
+
|
|
6
|
+
var RadioContext = createContext({});
|
|
7
|
+
var Radio = function (_a) {
|
|
8
|
+
var value = _a.value, checked = _a.checked, _b = _a.disabled, disabled = _b === void 0 ? false : _b, children = _a.children, onChange = _a.onChange;
|
|
9
|
+
var context = useContext(RadioContext);
|
|
10
|
+
var _c = useState(checked || false), internalChecked = _c[0], setInternalChecked = _c[1];
|
|
11
|
+
var isChecked = context.selectedValue !== undefined
|
|
12
|
+
? context.selectedValue === value
|
|
13
|
+
: checked !== undefined
|
|
14
|
+
? checked
|
|
15
|
+
: internalChecked;
|
|
16
|
+
var handleChange = function () {
|
|
17
|
+
if (!disabled) {
|
|
18
|
+
if (context.onChange) {
|
|
19
|
+
context.onChange(value);
|
|
20
|
+
}
|
|
21
|
+
else if (onChange) {
|
|
22
|
+
setInternalChecked(true);
|
|
23
|
+
onChange(value);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
setInternalChecked(true);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
return (jsxs("label", __assign({ className: "foxit-radio-container ".concat(disabled ? 'disabled' : '') }, { children: [jsx("input", { type: "radio", value: value, checked: isChecked, disabled: disabled, onChange: handleChange }), jsx("span", { className: "foxit-radio-checkmark" }), jsx("span", __assign({ className: "foxit-radio-content" }, { children: children }))] })));
|
|
31
|
+
};
|
|
32
|
+
var RadioGroup = function (_a) {
|
|
33
|
+
var onChange = _a.onChange, value = _a.value, children = _a.children;
|
|
34
|
+
var _b = useState(value), selectedValue = _b[0], setSelectedValue = _b[1];
|
|
35
|
+
var handleChange = function (val) {
|
|
36
|
+
setSelectedValue(val);
|
|
37
|
+
if (onChange) {
|
|
38
|
+
onChange(val);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return (jsx(RadioContext.Provider, __assign({ value: { onChange: handleChange, selectedValue: value !== undefined ? value : selectedValue } }, { children: children })));
|
|
42
|
+
};
|
|
43
|
+
Radio.Group = RadioGroup;
|
|
44
|
+
|
|
45
|
+
export { Radio as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import styleInject from '../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".foxit-radio-container {\n display: inline-block;\n position: relative;\n padding-left: 25px;\n cursor: pointer;\n -webkit-user-select: none;\n user-select: none;\n}\n\n.foxit-radio-container input {\n position: absolute;\n opacity: 0;\n cursor: pointer;\n}\n\n.foxit-radio-checkmark {\n position: absolute;\n top: 0;\n left: 0;\n height: 20px;\n width: 20px;\n background-color: #fff;\n border: 1px solid #b3b3b3;\n border-radius: 50%;\n}\n\n.foxit-radio-content {\n line-height: 20px;\n}\n\n.foxit-radio-container input:checked ~ .foxit-radio-checkmark {\n background-color: #ffffff;\n border: 1px solid #ff5f00;\n}\n\n.foxit-radio-checkmark:after {\n content: '';\n position: absolute;\n display: none;\n}\n\n.foxit-radio-container input:checked ~ .foxit-radio-checkmark:after {\n display: block;\n}\n\n.foxit-radio-container .foxit-radio-checkmark:after {\n top: 4px;\n left: 4px;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background: #ff5f00;\n}\n\n.foxit-radio-container.disabled {\n cursor: not-allowed;\n opacity: 0.6;\n}\n";
|
|
4
|
+
styleInject(css_248z);
|
|
5
|
+
|
|
6
|
+
export { css_248z as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SelectProps {
|
|
3
|
+
options: {
|
|
4
|
+
value: string | number;
|
|
5
|
+
label: string;
|
|
6
|
+
}[];
|
|
7
|
+
className?: string;
|
|
8
|
+
defaultValue?: string | number | string[] | number[];
|
|
9
|
+
isDisabled?: boolean;
|
|
10
|
+
isClearable?: boolean;
|
|
11
|
+
isSearchable?: boolean;
|
|
12
|
+
isMulti?: boolean;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
preIcon?: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
declare const Select: React.FC<SelectProps>;
|
|
17
|
+
export default Select;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { __rest, __assign } from '../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import ReactSelect, { components } from 'react-select';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { Icon } from '../Icon/index.js';
|
|
6
|
+
|
|
7
|
+
var Select = function (_a) {
|
|
8
|
+
var options = _a.options, className = _a.className, defaultValue = _a.defaultValue, isDisabled = _a.isDisabled, isClearable = _a.isClearable, isSearchable = _a.isSearchable, isMulti = _a.isMulti, _b = _a.placeholder, placeholder = _b === void 0 ? 'Select...' : _b, preIcon = _a.preIcon, rest = __rest(_a, ["options", "className", "defaultValue", "isDisabled", "isClearable", "isSearchable", "isMulti", "placeholder", "preIcon"]);
|
|
9
|
+
var customStyles = {
|
|
10
|
+
control: function (styles) { return (__assign(__assign({}, styles), { backgroundColor: 'white',
|
|
11
|
+
// minWidth: 200,
|
|
12
|
+
height: 48, borderRadius: 10, fontSize: 14, boxShadow: 'none', border: '1px solid #B3B3B3', ':hover': {
|
|
13
|
+
border: '1px solid #757575'
|
|
14
|
+
}, ':focus-within': {
|
|
15
|
+
border: '1px solid #FF5F00'
|
|
16
|
+
} })); },
|
|
17
|
+
option: function (styles, _a) {
|
|
18
|
+
var isSelected = _a.isSelected, isFocused = _a.isFocused;
|
|
19
|
+
return __assign(__assign({}, styles), { backgroundColor: isFocused ? '#FFF6F0' : 'white', color: isSelected ? '#FF5F00' : '#666', ':hover': {
|
|
20
|
+
backgroundColor: '#FFF6F0'
|
|
21
|
+
}, fontSize: 16, display: 'flex', justifyContent: 'space-between', alignItems: 'center' });
|
|
22
|
+
},
|
|
23
|
+
indicatorSeparator: function (styles) { return (__assign(__assign({}, styles), { display: 'none' })); },
|
|
24
|
+
placeholder: function (styles) { return (__assign(__assign({}, styles), { color: '#B3B3B3' })); },
|
|
25
|
+
dropdownIndicator: function (styles) { return (__assign(__assign({}, styles), { paddingRight: 16 })); }
|
|
26
|
+
};
|
|
27
|
+
var CustomControl = function (props) { return (jsxs(components.Control, __assign({}, props, { children: [preIcon && (jsx("div", __assign({ style: {
|
|
28
|
+
display: 'flex',
|
|
29
|
+
paddingLeft: 16,
|
|
30
|
+
marginRight: -4,
|
|
31
|
+
color: props.hasValue ? '#525252' : '#B3B3B3'
|
|
32
|
+
} }, { children: preIcon }))), props.children] }))); };
|
|
33
|
+
var CustomOptionComp = function (props) { return (jsxs(components.Option, __assign({}, props, { children: [props.children, props.isSelected && jsx(Icon, { name: "CheckCircleOutlined" })] }))); };
|
|
34
|
+
return (jsx(ReactSelect, __assign({ options: options, className: classNames('foxit-select-wrapper', className), placeholder: placeholder, styles: customStyles, defaultValue: isMulti
|
|
35
|
+
? options.filter(function (option) {
|
|
36
|
+
return Array.isArray(defaultValue) &&
|
|
37
|
+
defaultValue.includes(option.value);
|
|
38
|
+
})
|
|
39
|
+
: options.find(function (option) { return option.value === defaultValue; }), isDisabled: isDisabled, isClearable: isClearable, isSearchable: isSearchable, isMulti: isMulti, components: { Control: CustomControl, Option: CustomOptionComp } }, rest)));
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { Select as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './table.css';
|
|
3
|
+
export interface Column<T> {
|
|
4
|
+
title: string;
|
|
5
|
+
dataIndex: keyof T;
|
|
6
|
+
width?: number;
|
|
7
|
+
align?: 'left' | 'center' | 'right';
|
|
8
|
+
render?: (text: T[keyof T], record: T) => React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
interface TableProps<T> {
|
|
11
|
+
columns: Column<T>[];
|
|
12
|
+
data: T[];
|
|
13
|
+
}
|
|
14
|
+
declare const Table: <T>({ columns, data }: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default Table;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { __assign } from '../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import './table.css.js';
|
|
4
|
+
|
|
5
|
+
var Table = function (_a) {
|
|
6
|
+
var columns = _a.columns, data = _a.data;
|
|
7
|
+
return (jsx("div", __assign({ className: "foxit-table" }, { children: jsxs("table", __assign({ className: "foxit-table-container" }, { children: [jsx("thead", { children: jsx("tr", { children: columns.map(function (column, index) { return (jsx("th", __assign({ style: {
|
|
8
|
+
width: column.width ? "".concat(column.width, "px") : 'auto',
|
|
9
|
+
textAlign: column.align || 'left'
|
|
10
|
+
} }, { children: column.title }), index)); }) }) }), jsx("tbody", { children: data.map(function (record, rowIndex) { return (jsx("tr", __assign({ className: rowIndex % 2 === 0 ? 'foxit-even-row' : 'foxit-odd-row' }, { children: columns.map(function (column, colIndex) { return (jsx("td", __assign({ style: { textAlign: column.align || 'left' } }, { children: column.render
|
|
11
|
+
? column.render(record[column.dataIndex], record)
|
|
12
|
+
: record[column.dataIndex] }), colIndex)); }) }), rowIndex)); }) })] })) })));
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { Table as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import styleInject from '../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".foxit-table {\n border-radius: 10px;\n overflow: hidden;\n border: 1px solid #ff5f00;\n color: #373737;\n}\n\n.foxit-table-container {\n width: 100%;\n border-collapse: collapse;\n}\n\n.foxit-table-container th,\n.foxit-table-container td {\n min-height: 70px;\n height: 70px;\n padding: 24px;\n}\n\n.foxit-table-container th {\n background-color: #fff6f0;\n font-weight: 700;\n font-size: 16px;\n}\n\n.foxit-table-container td {\n font-size: 14px;\n font-weight: 400;\n}\n\n.foxit-table-container .foxit-even-row {\n background-color: white;\n}\n\n.foxit-table-container .foxit-odd-row {\n background-color: #fff6f0;\n}\n";
|
|
4
|
+
styleInject(css_248z);
|
|
5
|
+
|
|
6
|
+
export { css_248z as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './tabs.css';
|
|
3
|
+
interface TabItem {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
interface ButtonTabsProps {
|
|
9
|
+
activeKey?: string;
|
|
10
|
+
items: TabItem[];
|
|
11
|
+
onChange?: (key: string) => void;
|
|
12
|
+
}
|
|
13
|
+
declare const ButtonTabs: React.FC<ButtonTabsProps>;
|
|
14
|
+
export default ButtonTabs;
|
package/es/Tabs/Tabs.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { __assign } from '../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import './tabs.css.js';
|
|
5
|
+
|
|
6
|
+
var ButtonTabs = function (_a) {
|
|
7
|
+
var _b;
|
|
8
|
+
var activeKey = _a.activeKey, items = _a.items, onChange = _a.onChange;
|
|
9
|
+
var _c = useState(activeKey || ((_b = items[0]) === null || _b === void 0 ? void 0 : _b.key)), internalActiveKey = _c[0], setInternalActiveKey = _c[1];
|
|
10
|
+
var handleTabChange = function (key) {
|
|
11
|
+
if (onChange) {
|
|
12
|
+
onChange(key);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
setInternalActiveKey(key);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var currentKey = activeKey || internalActiveKey;
|
|
19
|
+
return (jsxs("div", { children: [jsx("div", __assign({ className: "foxit-tabs" }, { children: items.map(function (item) { return (jsx("button", __assign({ className: "foxit-tab-item ".concat(currentKey === item.key ? 'active' : ''), onClick: function () { return handleTabChange(item.key); } }, { children: item.label }), item.key)); }) })), jsx("div", __assign({ className: "foxit-tab-content" }, { children: items.map(function (item) { return item.key === currentKey && jsx("div", { children: item.children }, item.key); }) }))] }));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { ButtonTabs as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import styleInject from '../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".foxit-tabs {\n display: flex;\n gap: 8px;\n}\n\n.foxit-tab-item {\n font-weight: 600;\n padding: 14px 20px;\n border: none;\n border-radius: 10px;\n background-color: #f1f3f4;\n color: #757575;\n cursor: pointer;\n transition:\n background-color 0.3s,\n color 0.3s;\n}\n\n.foxit-tab-item.active {\n background-color: #ff5f00;\n color: white;\n}\n\n.foxit-tab-item:hover:not(.active) {\n background-color: #e0e0e0;\n}\n\n.foxit-tab-content {\n margin-top: 16px;\n}\n";
|
|
4
|
+
styleInject(css_248z);
|
|
5
|
+
|
|
6
|
+
export { css_248z as default };
|
package/es/Tag/Tag.d.ts
ADDED
package/es/Tag/Tag.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __assign } from '../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import './tag.css.js';
|
|
4
|
+
|
|
5
|
+
var Tag = function (_a) {
|
|
6
|
+
var color = _a.color, children = _a.children;
|
|
7
|
+
var className = "foxit-tag foxit-tag-".concat(color);
|
|
8
|
+
return jsx("span", __assign({ className: className }, { children: children }));
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { Tag as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import styleInject from '../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
|
+
|
|
3
|
+
var css_248z = ".foxit-tag {\n display: inline-block;\n min-height: 24px;\n padding: 4px 8px;\n border-radius: 5px;\n font-size: 12px;\n font-weight: 600;\n white-space: nowrap;\n height: 24px;\n}\n\n.foxit-tag-active {\n background-color: #edfafa;\n color: #0f8b8d;\n}\n\n.foxit-tag-canceled {\n background-color: #ffecec;\n color: #e22727;\n}\n\n.foxit-tag-pending {\n background-color: #fbf4d0;\n color: #9b8827;\n}\n\n.foxit-tag-offline {\n background-color: #edecff;\n color: #6462c6;\n}\n\n.foxit-tag-trial {\n background-color: #e4f4fe;\n color: #2288ce;\n}\n\n.foxit-tag-expired {\n background-color: #ececec;\n color: #757575;\n}\n";
|
|
4
|
+
styleInject(css_248z);
|
|
5
|
+
|
|
6
|
+
export { css_248z as default };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { __assign } from '../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useRef, useEffect } from 'react';
|
|
4
|
+
import { CSSTransition } from 'react-transition-group';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import './toast.css.js';
|
|
7
|
+
import { Icon } from '../Icon/index.js';
|
|
8
|
+
|
|
9
|
+
var Toast = function (_a) {
|
|
10
|
+
var toast = _a.toast, _b = _a.type, type = _b === void 0 ? 'success' : _b, _c = _a.duration, duration = _c === void 0 ? 4000 : _c;
|
|
11
|
+
var _d = useState(false), animationIn = _d[0], setAnimationIn = _d[1];
|
|
12
|
+
var toastRef = useRef(null);
|
|
13
|
+
useEffect(function () {
|
|
14
|
+
setAnimationIn(true);
|
|
15
|
+
var timer = setTimeout(function () {
|
|
16
|
+
setAnimationIn(false);
|
|
17
|
+
}, duration - 500);
|
|
18
|
+
return function () {
|
|
19
|
+
clearTimeout(timer);
|
|
20
|
+
};
|
|
21
|
+
}, [toast]);
|
|
22
|
+
var getIconName = function (type) {
|
|
23
|
+
switch (type) {
|
|
24
|
+
case 'success':
|
|
25
|
+
return 'SuccessColoursOutlined';
|
|
26
|
+
case 'error':
|
|
27
|
+
return 'ErrorColoursOutlined';
|
|
28
|
+
case 'warning':
|
|
29
|
+
return 'WarningColoursOutlined';
|
|
30
|
+
case 'loading':
|
|
31
|
+
return 'LoadingOutlined';
|
|
32
|
+
default:
|
|
33
|
+
return 'WarningColoursOutlined';
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
return (jsxs(Fragment, { children: [animationIn && type === 'loading' && jsx("div", { className: "foxit-toast-loading-overlay" }), jsx(CSSTransition, __assign({ in: animationIn, nodeRef: toastRef, timeout: 500, mountOnEnter: true, unmountOnExit: true, classNames: {
|
|
37
|
+
enter: 'foxit-toast-enter',
|
|
38
|
+
enterActive: 'foxit-toast-enter-active',
|
|
39
|
+
exit: 'foxit-toast-exit',
|
|
40
|
+
exitActive: 'foxit-toast-exit-active'
|
|
41
|
+
} }, { children: jsxs("div", __assign({ ref: toastRef, className: classNames('foxit-toast-item', "foxit-toast-item-".concat(type)) }, { children: [jsx(Icon, { name: getIconName(type), className: type === 'loading' ? 'foxit-toast-loading' : '' }), toast] })) }))] }));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { Toast as default };
|