foxit-component 0.0.1-alpha.2 → 0.0.1-alpha.21

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.
Files changed (58) hide show
  1. package/es/Alert/Alert.d.ts +12 -0
  2. package/es/Alert/Alert.js +24 -0
  3. package/es/Button/Button.d.ts +2 -1
  4. package/es/Button/Button.js +4 -4
  5. package/es/Checkbox/Checkbox.d.ts +10 -2
  6. package/es/Checkbox/Checkbox.js +35 -5
  7. package/es/Empty/Empty.js +0 -1
  8. package/es/Form/Form.js +0 -1
  9. package/es/Form/FormItem.js +1 -2
  10. package/es/Form/FormProvider.js +101 -109
  11. package/es/Input/Input.d.ts +1 -0
  12. package/es/Input/Input.js +6 -5
  13. package/es/Menu/Menu.d.ts +1 -1
  14. package/es/Menu/Menu.js +1 -2
  15. package/es/Modal/Modal.d.ts +2 -0
  16. package/es/Modal/Modal.js +87 -16
  17. package/es/Modal/ModalTemp.js +4 -1
  18. package/es/Pagination/Pagination.d.ts +1 -0
  19. package/es/Pagination/Pagination.js +20 -12
  20. package/es/Quantity/Quantity.d.ts +10 -0
  21. package/es/Quantity/Quantity.js +45 -0
  22. package/es/Radio/Radio.js +0 -1
  23. package/es/Select/Select.d.ts +10 -0
  24. package/es/Select/Select.js +15 -10
  25. package/es/Spin/Spin.d.ts +10 -0
  26. package/es/Spin/Spin.js +11 -0
  27. package/es/Switch/Switch.d.ts +9 -0
  28. package/es/Switch/Switch.js +20 -0
  29. package/es/Table/Table.d.ts +3 -1
  30. package/es/Table/Table.js +12 -8
  31. package/es/Tabs/Tabs.js +0 -1
  32. package/es/Tag/Tag.d.ts +1 -1
  33. package/es/Tag/Tag.js +1 -2
  34. package/es/Toast/Toast.js +0 -1
  35. package/es/Toast/ToastContainer.js +0 -1
  36. package/es/Tooltip/Tooltip.js +0 -1
  37. package/es/constants/icons.d.ts +10 -0
  38. package/es/constants/icons.js +11 -1
  39. package/es/index.css +1 -0
  40. package/es/index.d.ts +6 -4
  41. package/es/index.js +5 -1
  42. package/es/node_modules/tslib/tslib.es6.js +39 -1
  43. package/package.json +16 -14
  44. package/es/Button/button.css.js +0 -6
  45. package/es/Checkbox/checkbox.css.js +0 -6
  46. package/es/Empty/empty.css.js +0 -6
  47. package/es/Form/form.css.js +0 -6
  48. package/es/Input/input.css.js +0 -6
  49. package/es/Menu/menu.css.js +0 -6
  50. package/es/Modal/modal.css.js +0 -6
  51. package/es/Pagination/pagination.css.js +0 -6
  52. package/es/Radio/radio.css.js +0 -6
  53. package/es/Table/table.css.js +0 -6
  54. package/es/Tabs/tabs.css.js +0 -6
  55. package/es/Tag/tag.css.js +0 -6
  56. package/es/Toast/toast.css.js +0 -6
  57. package/es/Tooltip/tooltip.css.js +0 -6
  58. package/es/node_modules/style-inject/dist/style-inject.es.js +0 -28
package/es/Modal/Modal.js CHANGED
@@ -1,39 +1,110 @@
1
- import { __assign } from '../node_modules/tslib/tslib.es6.js';
1
+ import { __assign, __awaiter, __generator } from '../node_modules/tslib/tslib.es6.js';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { useState } from 'react';
3
4
  import { Icon } from '../Icon/index.js';
5
+ import classNames from 'classnames';
4
6
  import { createRoot } from 'react-dom/client';
5
7
  import { Modal as Modal$1 } from './ModalTemp.js';
6
8
  import { Button } from '../Button/Button.js';
7
- import './modal.css.js';
8
9
 
9
10
  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: {
11
+ 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, type = _a.type, _e = _a.closable, closable = _e === void 0 ? true : _e;
12
+ var _f = useState(false), loading = _f[0], setLoading = _f[1];
13
+ var _g = useState(false), cancelLoading = _g[0], setCancelLoading = _g[1];
14
+ var handleOk = function () { return __awaiter(void 0, void 0, void 0, function () {
15
+ return __generator(this, function (_a) {
16
+ switch (_a.label) {
17
+ case 0:
18
+ if (!onOk) return [3 /*break*/, 4];
19
+ _a.label = 1;
20
+ case 1:
21
+ _a.trys.push([1, , 3, 4]);
22
+ setLoading(true);
23
+ return [4 /*yield*/, onOk()];
24
+ case 2:
25
+ _a.sent();
26
+ return [3 /*break*/, 4];
27
+ case 3:
28
+ setLoading(false);
29
+ return [7 /*endfinally*/];
30
+ case 4: return [2 /*return*/];
31
+ }
32
+ });
33
+ }); };
34
+ var handleCancel = function () { return __awaiter(void 0, void 0, void 0, function () {
35
+ return __generator(this, function (_a) {
36
+ switch (_a.label) {
37
+ case 0:
38
+ if (!onCancel) return [3 /*break*/, 4];
39
+ _a.label = 1;
40
+ case 1:
41
+ _a.trys.push([1, , 3, 4]);
42
+ setCancelLoading(true);
43
+ return [4 /*yield*/, onCancel()];
44
+ case 2:
45
+ _a.sent();
46
+ return [3 /*break*/, 4];
47
+ case 3:
48
+ setCancelLoading(false);
49
+ return [7 /*endfinally*/];
50
+ case 4: return [2 /*return*/];
51
+ }
52
+ });
53
+ }); };
54
+ return (jsxs("div", __assign({ className: classNames('foxit-modal-content-container', type === 'success' ? 'foxit-modal-success' : ''), style: {
12
55
  maxWidth: width,
13
56
  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 })))] }))] })));
57
+ } }, { children: [jsxs("div", __assign({ className: "foxit-modal-head" }, { children: [jsx("div", __assign({ className: "foxit-modal-title" }, { children: title })), closable && (jsx("div", __assign({ onClick: onCancel, className: type === 'success' ? 'foxit-modal-success-icon' : 'foxit-modal-close-button' }, { children: type === 'success' ? (jsx(Icon, { name: "FireWorkColoursOutlined" })) : (jsx(Icon, { name: "CloseOutlined" })) })))] })), jsx("div", __assign({ className: "foxit-modal-children" }, { children: children })), jsxs("div", __assign({ className: "foxit-modal-footer" }, { children: [onCancelText && (jsx(Button, __assign({ size: "medium", onClick: handleCancel, loading: cancelLoading }, { children: onCancelText }))), onOkText && (jsx(Button, __assign({ primary: true, size: "medium", onClick: handleOk, loading: loading }, { children: onOkText })))] }))] })));
15
58
  };
16
59
  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 })) })));
60
+ 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, type = _a.type, closable = _a.closable;
61
+ 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, type: type, closable: closable }, { children: children })) })));
19
62
  };
20
63
  // 语法糖的调用方式
21
64
  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;
65
+ 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, closable = _a.closable;
23
66
  var modalRoot = document.createElement('div');
24
67
  document.body.appendChild(modalRoot);
25
68
  var root = createRoot(modalRoot);
26
69
  var handleClose = function () {
27
70
  root.unmount();
28
- document.body.removeChild(modalRoot);
71
+ if (document.body.contains(modalRoot)) {
72
+ document.body.removeChild(modalRoot);
73
+ }
29
74
  };
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 })) })));
75
+ root.render(jsx(Modal$1, __assign({ opened: true, onClose: handleClose, maskClosable: maskClosable, position: "top" }, { children: jsx(ModalContent, __assign({ title: title, width: width, onCancel: onCancel instanceof Function && onCancel.constructor.name === 'AsyncFunction'
76
+ ? function () { return __awaiter(void 0, void 0, void 0, function () {
77
+ return __generator(this, function (_a) {
78
+ switch (_a.label) {
79
+ case 0: return [4 /*yield*/, onCancel()];
80
+ case 1:
81
+ _a.sent();
82
+ handleClose();
83
+ return [2 /*return*/];
84
+ }
85
+ });
86
+ }); }
87
+ : function () {
88
+ onCancel === null || onCancel === void 0 ? void 0 : onCancel();
89
+ handleClose();
90
+ }, onCancelText: onCancelText, onOk:
91
+ // 判断传进来的onOk是否为async函数
92
+ onOk instanceof Function && onOk.constructor.name === 'AsyncFunction'
93
+ ? function () { return __awaiter(void 0, void 0, void 0, function () {
94
+ return __generator(this, function (_a) {
95
+ switch (_a.label) {
96
+ case 0: return [4 /*yield*/, onOk()];
97
+ case 1:
98
+ _a.sent();
99
+ handleClose();
100
+ return [2 /*return*/];
101
+ }
102
+ });
103
+ }); }
104
+ : function () {
105
+ onOk === null || onOk === void 0 ? void 0 : onOk();
106
+ handleClose();
107
+ }, onOkText: onOkText, closable: closable }, { children: content })) })));
37
108
  };
38
109
 
39
110
  export { Modal };
@@ -4,7 +4,6 @@ import { useState, useEffect, useRef } from 'react';
4
4
  import { CSSTransition } from 'react-transition-group';
5
5
  import { createPortal } from 'react-dom';
6
6
  import classNames from 'classnames';
7
- import './modal.css.js';
8
7
 
9
8
  var contentAnimation = {
10
9
  enter: 'foxit-modal-opacity-0 foxit-modal-scale-0',
@@ -24,6 +23,10 @@ var Portal = function (_a) {
24
23
  useEffect(function () {
25
24
  var _a, _b;
26
25
  (_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);
26
+ return function () {
27
+ var _a, _b;
28
+ (_b = (_a = document === null || document === void 0 ? void 0 : document.body) === null || _a === void 0 ? void 0 : _a.removeChild) === null || _b === void 0 ? void 0 : _b.call(_a, container);
29
+ };
27
30
  }, [container]);
28
31
  return createPortal(children, container);
29
32
  };
@@ -5,6 +5,7 @@ interface PaginationProps {
5
5
  pageSize: number;
6
6
  onChange?: (page: number) => void;
7
7
  defaultCurrent?: number;
8
+ current?: number;
8
9
  }
9
10
  declare const Pagination: React.FC<PaginationProps>;
10
11
  export default Pagination;
@@ -1,15 +1,19 @@
1
1
  import { __assign } from '../node_modules/tslib/tslib.es6.js';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { useState, useEffect } from 'react';
4
- import './pagination.css.js';
5
4
 
6
5
  var $_MORE = 9999999999;
7
6
  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];
7
+ var total = _a.total, pageSize = _a.pageSize, onChange = _a.onChange, _b = _a.defaultCurrent, defaultCurrent = _b === void 0 ? 1 : _b, currentProp = _a.current;
8
+ var _c = useState(currentProp !== undefined ? currentProp : defaultCurrent), current = _c[0], setCurrent = _c[1];
10
9
  var _d = useState([]), pages = _d[0], setPages = _d[1];
11
10
  var maxButtons = 5;
12
11
  var totalPages = Math.ceil(total / pageSize);
12
+ useEffect(function () {
13
+ if (currentProp !== undefined && currentProp !== current) {
14
+ setCurrent(currentProp);
15
+ }
16
+ }, [currentProp, current]);
13
17
  useEffect(function () {
14
18
  var generatePages = function () {
15
19
  var pageArray = [];
@@ -49,14 +53,16 @@ var Pagination = function (_a) {
49
53
  var handleClick = function (page, index) {
50
54
  if (page === $_MORE) {
51
55
  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);
56
+ var newPage = pages[index - 1] + 1;
57
+ setCurrent(newPage);
58
+ onChange === null || onChange === void 0 ? void 0 : onChange(newPage);
54
59
  }
55
60
  else if (index < pages.length - 1 &&
56
61
  pages[index + 1] !== null &&
57
62
  pages[index + 1] !== totalPages) {
58
- setCurrent(pages[index + 1] - 1);
59
- onChange === null || onChange === void 0 ? void 0 : onChange(pages[index + 1] - 1);
63
+ var newPage = pages[index + 1] - 1;
64
+ setCurrent(newPage);
65
+ onChange === null || onChange === void 0 ? void 0 : onChange(newPage);
60
66
  }
61
67
  }
62
68
  else if (page !== current) {
@@ -66,17 +72,19 @@ var Pagination = function (_a) {
66
72
  };
67
73
  var handlePrev = function () {
68
74
  if (current > 1) {
69
- setCurrent(current - 1);
70
- onChange === null || onChange === void 0 ? void 0 : onChange(current - 1);
75
+ var newPage = current - 1;
76
+ setCurrent(newPage);
77
+ onChange === null || onChange === void 0 ? void 0 : onChange(newPage);
71
78
  }
72
79
  };
73
80
  var handleNext = function () {
74
81
  if (current < totalPages) {
75
- setCurrent(current + 1);
76
- onChange === null || onChange === void 0 ? void 0 : onChange(current + 1);
82
+ var newPage = current + 1;
83
+ setCurrent(newPage);
84
+ onChange === null || onChange === void 0 ? void 0 : onChange(newPage);
77
85
  }
78
86
  };
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: '>' }))] })));
87
+ return total > pageSize ? (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: '>' }))] }))) : null;
80
88
  };
81
89
 
82
90
  export { Pagination as default };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import './quantity.css';
3
+ interface QuantityProps {
4
+ value?: number;
5
+ onChange?: (value: number) => void;
6
+ min?: number;
7
+ max?: number;
8
+ }
9
+ declare const Quantity: React.FC<QuantityProps>;
10
+ export { Quantity };
@@ -0,0 +1,45 @@
1
+ import { __assign } from '../node_modules/tslib/tslib.es6.js';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import { useState } from 'react';
4
+
5
+ var Quantity = function (_a) {
6
+ var value = _a.value, onChange = _a.onChange, min = _a.min, max = _a.max;
7
+ var _b = useState(value || min || 0), internalValue = _b[0], setInternalValue = _b[1];
8
+ var currentValue = value !== undefined ? value : internalValue;
9
+ var handleIncrement = function () {
10
+ var newValue = currentValue + 1;
11
+ if (max !== undefined && newValue > max)
12
+ return;
13
+ if (onChange) {
14
+ onChange(newValue);
15
+ }
16
+ setInternalValue(newValue);
17
+ };
18
+ var handleDecrement = function () {
19
+ var newValue = currentValue - 1;
20
+ if (min !== undefined && newValue < min)
21
+ return;
22
+ if (onChange) {
23
+ onChange(newValue);
24
+ }
25
+ setInternalValue(newValue);
26
+ };
27
+ var handleChange = function (e) {
28
+ var newValue = parseInt(e.target.value, 10) || 0;
29
+ if (min !== undefined && newValue < min) {
30
+ newValue = min;
31
+ }
32
+ if (max !== undefined && newValue > max) {
33
+ newValue = max;
34
+ }
35
+ if (onChange) {
36
+ onChange(newValue);
37
+ }
38
+ setInternalValue(newValue);
39
+ };
40
+ return (jsxs("div", __assign({ className: "foxit-quantity" }, { children: [jsx("button", __assign({ className: "foxit-quantity-button", onClick: handleDecrement, disabled: min !== undefined && currentValue <= min }, { children: jsx("div", { children: "-" }) })), jsx("input", {
41
+ // type="number"
42
+ value: currentValue, onChange: handleChange, min: min, max: max, className: "foxit-quantity-number" }), jsx("button", __assign({ className: "foxit-quantity-button", onClick: handleIncrement, disabled: max !== undefined && currentValue >= max }, { children: jsx("div", { children: "+" }) }))] })));
43
+ };
44
+
45
+ export { Quantity };
package/es/Radio/Radio.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { __assign } from '../node_modules/tslib/tslib.es6.js';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { createContext, useContext, useState } from 'react';
4
- import './radio.css.js';
5
4
 
6
5
  var RadioContext = createContext({});
7
6
  var Radio = function (_a) {
@@ -12,6 +12,16 @@ export interface SelectProps {
12
12
  isMulti?: boolean;
13
13
  placeholder?: string;
14
14
  preIcon?: React.ReactNode;
15
+ value?: string | number | CustomOption | null;
16
+ onChange?: (v: unknown) => void;
17
+ [key: string]: unknown;
18
+ }
19
+ interface CustomOption {
20
+ readonly value: string | number;
21
+ readonly label: string;
22
+ readonly color?: string;
23
+ readonly isFixed?: boolean;
24
+ readonly isDisabled?: boolean;
15
25
  }
16
26
  declare const Select: React.FC<SelectProps>;
17
27
  export default Select;
@@ -5,15 +5,18 @@ import classNames from 'classnames';
5
5
  import { Icon } from '../Icon/index.js';
6
6
 
7
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"]);
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, value = _a.value, onChange = _a.onChange, rest = __rest(_a, ["options", "className", "defaultValue", "isDisabled", "isClearable", "isSearchable", "isMulti", "placeholder", "preIcon", "value", "onChange"]);
9
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
- } })); },
10
+ control: function (styles, _a) {
11
+ var isDisabled = _a.isDisabled;
12
+ return (__assign(__assign({}, styles), { backgroundColor: isDisabled ? '#f8f8f8' : 'white',
13
+ // minWidth: 200,
14
+ height: 48, paddingLeft: 8, borderRadius: 10, fontSize: 14, boxShadow: 'none', border: '1px solid #D9D9D9', ':hover': {
15
+ border: '1px solid #757575'
16
+ }, ':focus-within': {
17
+ border: '1px solid #FF5F00'
18
+ } }));
19
+ },
17
20
  option: function (styles, _a) {
18
21
  var isSelected = _a.isSelected, isFocused = _a.isFocused;
19
22
  return __assign(__assign({}, styles), { backgroundColor: isFocused ? '#FFF6F0' : 'white', color: isSelected ? '#FF5F00' : '#666', ':hover': {
@@ -26,7 +29,7 @@ var Select = function (_a) {
26
29
  };
27
30
  var CustomControl = function (props) { return (jsxs(components.Control, __assign({}, props, { children: [preIcon && (jsx("div", __assign({ style: {
28
31
  display: 'flex',
29
- paddingLeft: 16,
32
+ paddingLeft: 8,
30
33
  marginRight: -4,
31
34
  color: props.hasValue ? '#525252' : '#B3B3B3'
32
35
  } }, { children: preIcon }))), props.children] }))); };
@@ -36,7 +39,9 @@ var Select = function (_a) {
36
39
  return Array.isArray(defaultValue) &&
37
40
  defaultValue.includes(option.value);
38
41
  })
39
- : options.find(function (option) { return option.value === defaultValue; }), isDisabled: isDisabled, isClearable: isClearable, isSearchable: isSearchable, isMulti: isMulti, components: { Control: CustomControl, Option: CustomOptionComp } }, rest)));
42
+ : options.find(function (option) { return option.value === defaultValue; }), isDisabled: isDisabled, isClearable: isClearable, isSearchable: isSearchable, isMulti: isMulti, components: { Control: CustomControl, Option: CustomOptionComp }, onChange: onChange, menuPosition: "fixed" }, rest, { value: isMulti && Array.isArray(value)
43
+ ? value.map(function (v) { return options.find(function (option) { return option.value === v; }); })
44
+ : options.find(function (option) { return option.value === value; }) || value })));
40
45
  };
41
46
 
42
47
  export { Select as default };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import './spin.css';
3
+ interface FoxitSpinProps {
4
+ spinning: boolean;
5
+ size?: 'small' | 'default' | 'large';
6
+ children?: React.ReactNode;
7
+ className?: string;
8
+ }
9
+ declare const Spin: React.FC<FoxitSpinProps>;
10
+ export { Spin };
@@ -0,0 +1,11 @@
1
+ import { __assign } from '../node_modules/tslib/tslib.es6.js';
2
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
+ import classNames from 'classnames';
4
+ import { Icon } from '../Icon/index.js';
5
+
6
+ var Spin = function (_a) {
7
+ var _b = _a.spinning, spinning = _b === void 0 ? true : _b, _c = _a.size, size = _c === void 0 ? 'default' : _c, children = _a.children, className = _a.className;
8
+ return spinning ? (jsxs("div", __assign({ className: classNames('foxit-spin', "foxit-spin-".concat(size)) }, { children: [jsx("div", __assign({ className: "foxit-spin-icon" }, { children: jsx(Icon, { name: "LoadingOutlined", className: classNames('foxit-spin-spinning', className) }) })), children && jsx("div", __assign({ className: "foxit-spin-container" }, { children: children }))] }))) : children ? (jsx(Fragment, { children: children })) : (jsx(Fragment, {}));
9
+ };
10
+
11
+ export { Spin };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import './switch.css';
3
+ interface FoxitSwitchProps {
4
+ value?: boolean;
5
+ onChange?: (value: boolean) => void;
6
+ size?: 'small' | 'large';
7
+ }
8
+ declare const Switch: React.FC<FoxitSwitchProps>;
9
+ export { Switch };
@@ -0,0 +1,20 @@
1
+ import { __assign } from '../node_modules/tslib/tslib.es6.js';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { useState } from 'react';
4
+
5
+ var Switch = function (_a) {
6
+ var value = _a.value, onChange = _a.onChange, _b = _a.size, size = _b === void 0 ? 'large' : _b;
7
+ var _c = useState(value || false), internalValue = _c[0], setInternalValue = _c[1];
8
+ var isControlled = value !== undefined;
9
+ var handleToggle = function () {
10
+ if (onChange) {
11
+ onChange(!isControlled ? !internalValue : !value);
12
+ }
13
+ if (!isControlled) {
14
+ setInternalValue(!internalValue);
15
+ }
16
+ };
17
+ return (jsx("div", __assign({ className: "foxit-switch ".concat(size, " ").concat(isControlled ? (value ? 'checked' : '') : internalValue ? 'checked' : ''), onClick: handleToggle }, { children: jsx("div", { className: "foxit-switch-handle" }) })));
18
+ };
19
+
20
+ export { Switch };
@@ -10,6 +10,8 @@ export interface Column<T> {
10
10
  interface TableProps<T> {
11
11
  columns: Column<T>[];
12
12
  data: T[];
13
+ loading?: boolean;
14
+ emptyText?: React.ReactNode;
13
15
  }
14
- declare const Table: <T>({ columns, data }: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
16
+ declare const Table: <T>({ columns, data, loading, emptyText }: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
15
17
  export default Table;
package/es/Table/Table.js CHANGED
@@ -1,15 +1,19 @@
1
1
  import { __assign } from '../node_modules/tslib/tslib.es6.js';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
- import './table.css.js';
3
+ import Empty from '../Empty/Empty.js';
4
+ import { Icon } from '../Icon/index.js';
4
5
 
5
6
  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)); }) })] })) })));
7
+ var columns = _a.columns, data = _a.data, loading = _a.loading, emptyText = _a.emptyText;
8
+ return !loading && data.length === 0 ? (jsx(Empty, { description: emptyText || 'No Data' })) : (jsxs("div", __assign({ className: "foxit-table" }, { children: [loading ? (jsx("div", __assign({ className: "foxit-table-loading" }, { children: jsx(Icon, { name: "LoadingOutlined", className: "foxit-table-icon-loading" }) }))) : null, jsxs("table", __assign({ className: "foxit-table-container" }, { children: [jsx("thead", { children: jsx("tr", { children: columns.map(function (column, index) { return (jsx("th", __assign({ style: {
9
+ width: column.width ? "".concat(column.width, "px") : 'auto',
10
+ textAlign: column.align || 'left'
11
+ } }, { 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
12
+ ? column.render(record[column.dataIndex], record)
13
+ : typeof record[column.dataIndex] === 'object'
14
+ ? JSON.stringify(record[column.dataIndex]) // 将对象转换为字符串
15
+ : String(record[column.dataIndex]) // 确保它是一个字符串
16
+ }), colIndex)); }) }), rowIndex)); }) })] }))] })));
13
17
  };
14
18
 
15
19
  export { Table as default };
package/es/Tabs/Tabs.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { __assign } from '../node_modules/tslib/tslib.es6.js';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { useState } from 'react';
4
- import './tabs.css.js';
5
4
 
6
5
  var ButtonTabs = function (_a) {
7
6
  var _b;
package/es/Tag/Tag.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import './tag.css';
3
3
  interface TagProps {
4
- color: 'active' | 'canceled' | 'pending' | 'offline' | 'trial' | 'expired';
4
+ color?: 'active' | 'canceled' | 'pending' | 'offline' | 'trial' | 'expired' | string;
5
5
  children: React.ReactNode;
6
6
  }
7
7
  declare const Tag: React.FC<TagProps>;
package/es/Tag/Tag.js CHANGED
@@ -1,9 +1,8 @@
1
1
  import { __assign } from '../node_modules/tslib/tslib.es6.js';
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import './tag.css.js';
4
3
 
5
4
  var Tag = function (_a) {
6
- var color = _a.color, children = _a.children;
5
+ var _b = _a.color, color = _b === void 0 ? 'active' : _b, children = _a.children;
7
6
  var className = "foxit-tag foxit-tag-".concat(color);
8
7
  return jsx("span", __assign({ className: className }, { children: children }));
9
8
  };
package/es/Toast/Toast.js CHANGED
@@ -3,7 +3,6 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import { useState, useRef, useEffect } from 'react';
4
4
  import { CSSTransition } from 'react-transition-group';
5
5
  import classNames from 'classnames';
6
- import './toast.css.js';
7
6
  import { Icon } from '../Icon/index.js';
8
7
 
9
8
  var Toast = function (_a) {
@@ -2,7 +2,6 @@ import { __assign } from '../node_modules/tslib/tslib.es6.js';
2
2
  import { jsx, Fragment } from 'react/jsx-runtime';
3
3
  import { useState, useEffect } from 'react';
4
4
  import { createRoot } from 'react-dom/client';
5
- import './toast.css.js';
6
5
  import Toast from './Toast.js';
7
6
 
8
7
  var createToastContainer = function (toastManager, duration, unique) {
@@ -1,7 +1,6 @@
1
1
  import { __assign } from '../node_modules/tslib/tslib.es6.js';
2
2
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
3
  import { useState, useRef } from 'react';
4
- import './tooltip.css.js';
5
4
 
6
5
  var Tooltip = function (_a) {
7
6
  var title = _a.title, children = _a.children;
@@ -17,8 +17,18 @@ export declare const ICONS: Readonly<{
17
17
  LoadingOutlined: (className?: string) => import("react/jsx-runtime").JSX.Element;
18
18
  CloseOutlined: (className?: string) => import("react/jsx-runtime").JSX.Element;
19
19
  QuestionCircleOutlined: (className?: string) => import("react/jsx-runtime").JSX.Element;
20
+ EditorOutlined: (className?: string) => import("react/jsx-runtime").JSX.Element;
21
+ DateOutlined: (className?: string) => import("react/jsx-runtime").JSX.Element;
22
+ DownLoadOutlined: (className?: string) => import("react/jsx-runtime").JSX.Element;
23
+ UserConfigOutlined: (className?: string) => import("react/jsx-runtime").JSX.Element;
24
+ BillingColoursOutlined: (className?: string) => import("react/jsx-runtime").JSX.Element;
25
+ ManageColoursOutlined: (className?: string) => import("react/jsx-runtime").JSX.Element;
20
26
  SuccessColoursOutlined: (className?: string) => import("react/jsx-runtime").JSX.Element;
21
27
  ErrorColoursOutlined: (className?: string) => import("react/jsx-runtime").JSX.Element;
22
28
  WarningColoursOutlined: (className?: string) => import("react/jsx-runtime").JSX.Element;
29
+ UpgradeColoursOutlined: (className?: string) => import("react/jsx-runtime").JSX.Element;
30
+ SwitchToColoursOutlined: (className?: string) => import("react/jsx-runtime").JSX.Element;
31
+ ShoppingColoursOutlined: (className?: string) => import("react/jsx-runtime").JSX.Element;
23
32
  EmptyColoursOutlined: (className?: string) => import("react/jsx-runtime").JSX.Element;
33
+ FireWorkColoursOutlined: (className?: string) => import("react/jsx-runtime").JSX.Element;
24
34
  }>;