@aloudata/aloudata-design 2.8.7 → 2.9.0

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/dist/index.d.ts CHANGED
@@ -102,5 +102,4 @@ export type { UploadFile, UploadProps } from './Upload';
102
102
  export { default as User } from './User';
103
103
  export { default as Watermark } from './Watermark';
104
104
  export { default as message } from './message';
105
- export type { MessageArgsProps } from './message';
106
105
  export { default as notification } from './notification';
package/dist/index.js CHANGED
@@ -60,5 +60,5 @@ export { default as User } from "./User";
60
60
  export { default as Watermark } from "./Watermark";
61
61
  export { default as message } from "./message";
62
62
  // alias, keep API the same as antd
63
-
63
+ // export type { MessageArgsProps } from './message';
64
64
  export { default as notification } from "./notification";
@@ -1,14 +1,12 @@
1
- import { MessageArgsProps } from 'antd';
2
- import { JointContent } from 'antd/lib/message/interface';
3
- import React from 'react';
4
- export type { MessageArgsProps };
1
+ import { ToastOptions } from 'react-toastify';
2
+ export type NoticeType = 'info' | 'success' | 'error';
3
+ interface MessageOptions extends ToastOptions {
4
+ className?: string;
5
+ }
5
6
  declare const message: {
6
- info: (content: JointContent, duration?: number, onClose?: VoidFunction) => import("antd/es/message/interface").MessageType;
7
- success: (content: JointContent, duration?: number, onClose?: VoidFunction) => import("antd/es/message/interface").MessageType;
8
- error: (content: JointContent, duration?: number, onClose?: VoidFunction) => import("antd/es/message/interface").MessageType;
9
- warning: (content: JointContent, duration?: number, onClose?: VoidFunction) => import("antd/es/message/interface").MessageType;
10
- loading: (content: JointContent, duration?: number, onClose?: VoidFunction) => import("antd/es/message/interface").MessageType;
11
- open: (args: MessageArgsProps) => import("antd/es/message/interface").MessageType;
12
- destroy: (key?: React.Key) => void;
7
+ success: (message?: string, options?: MessageOptions) => import("react-toastify").Id;
8
+ error: (message?: string, options?: MessageOptions) => import("react-toastify").Id;
9
+ info: (message?: string, options?: MessageOptions) => import("react-toastify").Id;
13
10
  };
11
+ export type { MessageOptions };
14
12
  export default message;
@@ -1,134 +1,78 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1
2
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
5
6
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
7
- import { message as AntdMessage } from 'antd';
7
+ import classNames from 'classnames';
8
8
  import React from 'react';
9
- import { AttentionTriangleFill, CheckCircleFill, CloseCircleFill, InformationCircleFill, LoadingLine } from "../Icon";
10
- function isReactNode(value) {
11
- return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean' || _typeof(value) === 'symbol' || value === null || value === undefined || /*#__PURE__*/React.isValidElement(value);
12
- }
9
+ import { Slide, toast } from 'react-toastify';
10
+ import { CheckCircleFill, CloseLLine, DangerFill, InformationCircleFill } from "../Icon";
11
+ var closeX = /*#__PURE__*/React.createElement(CloseLLine, {
12
+ size: 20,
13
+ color: "#6B7280"
14
+ });
13
15
  var iconMap = {
14
- info: {
15
- icon: /*#__PURE__*/React.createElement("div", {
16
- className: "ald-message-icon-wrap"
17
- }, /*#__PURE__*/React.createElement(InformationCircleFill, {
18
- color: 'var(--alias-colors-icon-information)',
19
- size: 20
20
- })),
21
- type: 'info'
22
- },
23
- success: {
24
- icon: /*#__PURE__*/React.createElement("div", {
25
- className: "ald-message-icon-wrap"
26
- }, /*#__PURE__*/React.createElement(CheckCircleFill, {
27
- color: 'var(--alias-colors-icon-success)',
28
- size: 20
29
- })),
30
- type: 'success'
31
- },
32
- error: {
33
- icon: /*#__PURE__*/React.createElement("div", {
34
- className: "ald-message-icon-wrap"
35
- }, /*#__PURE__*/React.createElement(CloseCircleFill, {
36
- color: 'var(--alias-colors-icon-danger)',
37
- size: 20
38
- })),
39
- type: 'error'
40
- },
41
- warning: {
42
- icon: /*#__PURE__*/React.createElement("div", {
43
- className: "ald-message-icon-wrap"
44
- }, /*#__PURE__*/React.createElement(AttentionTriangleFill, {
45
- color: 'var(--alias-colors-icon-warning)',
46
- size: 20
47
- })),
48
- type: 'warning'
49
- },
50
- loading: {
51
- icon: /*#__PURE__*/React.createElement("div", {
52
- className: "ald-message-icon-wrap"
53
- }, /*#__PURE__*/React.createElement(LoadingLine, {
54
- className: "ald-loading-spin",
55
- size: 20
56
- })),
57
- type: 'loading'
16
+ info: /*#__PURE__*/React.createElement(InformationCircleFill, {
17
+ color: "#fff",
18
+ size: 20
19
+ }),
20
+ success: /*#__PURE__*/React.createElement(CheckCircleFill, {
21
+ color: "#fff",
22
+ size: 20
23
+ }),
24
+ error: /*#__PURE__*/React.createElement(DangerFill, {
25
+ color: "#fff",
26
+ size: 20
27
+ })
28
+ };
29
+ var defaultOptions = {
30
+ closeButton: false,
31
+ pauseOnHover: true,
32
+ transition: Slide,
33
+ position: 'bottom-center',
34
+ autoClose: 3000,
35
+ //3000
36
+ hideProgressBar: true,
37
+ closeOnClick: true,
38
+ draggable: false,
39
+ progress: undefined,
40
+ theme: 'light',
41
+ containerId: 'message-container',
42
+ icon: function icon() {
43
+ return null;
58
44
  }
59
45
  };
46
+ var getMessage = function getMessage(message, type) {
47
+ return /*#__PURE__*/React.createElement("div", {
48
+ className: "ald-message-content"
49
+ }, /*#__PURE__*/React.createElement("div", {
50
+ className: "ald-message-icon-wrap"
51
+ }, iconMap[type]), /*#__PURE__*/React.createElement("div", {
52
+ className: "ald-message-text"
53
+ }, message, " ", closeX));
54
+ };
60
55
  var message = {
61
- info: function info(content, duration, onClose) {
62
- if (isReactNode(content)) {
63
- // content 是 React.ReactNode 类型
64
- return AntdMessage.info(_objectSpread({
65
- content: content,
66
- duration: duration,
67
- onClose: onClose
68
- }, iconMap.info));
69
- } else {
70
- // content 是 ArgsProps 类型
71
- return AntdMessage.info(_objectSpread(_objectSpread({}, content), iconMap.info));
72
- }
73
- },
74
- success: function success(content, duration, onClose) {
75
- if (isReactNode(content)) {
76
- // content 是 React.ReactNode 类型
77
- return AntdMessage.success(_objectSpread({
78
- content: content,
79
- duration: duration,
80
- onClose: onClose
81
- }, iconMap.success));
82
- } else {
83
- // content 是 ArgsProps 类型
84
- return AntdMessage.success(_objectSpread(_objectSpread({}, content), iconMap.success));
85
- }
86
- },
87
- error: function error(content, duration, onClose) {
88
- if (isReactNode(content)) {
89
- // content 是 React.ReactNode 类型
90
- return AntdMessage.error(_objectSpread({
91
- content: content,
92
- duration: duration,
93
- onClose: onClose
94
- }, iconMap.error));
95
- } else {
96
- // content 是 ArgsProps 类型
97
- return AntdMessage.error(_objectSpread(_objectSpread({}, content), iconMap.error));
98
- }
99
- },
100
- warning: function warning(content, duration, onClose) {
101
- if (isReactNode(content)) {
102
- // content 是 React.ReactNode 类型
103
- return AntdMessage.warning(_objectSpread({
104
- content: content,
105
- duration: duration,
106
- onClose: onClose
107
- }, iconMap.warning));
108
- } else {
109
- // content 是 ArgsProps 类型
110
- return AntdMessage.warning(_objectSpread(_objectSpread({}, content), iconMap.warning));
111
- }
112
- },
113
- loading: function loading(content, duration, onClose) {
114
- if (isReactNode(content)) {
115
- // content 是 React.ReactNode 类型
116
- return AntdMessage.loading(_objectSpread({
117
- content: content,
118
- duration: duration,
119
- onClose: onClose
120
- }, iconMap.loading));
121
- } else {
122
- // content 是 ArgsProps 类型
123
- return AntdMessage.loading(_objectSpread(_objectSpread({}, content), iconMap.loading));
124
- }
56
+ success: function success(message) {
57
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
58
+ toast.dismiss();
59
+ return toast.success(getMessage(message !== null && message !== void 0 ? message : '', 'success'), _objectSpread(_objectSpread(_objectSpread({}, defaultOptions), options), {}, {
60
+ className: classNames('ald-message ald-message-success', options.className)
61
+ }));
125
62
  },
126
- open: function open(args) {
127
- var type = args.type || 'info';
128
- return AntdMessage.open(_objectSpread(_objectSpread({}, args), iconMap[type]));
63
+ error: function error(message) {
64
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
65
+ toast.dismiss();
66
+ return toast.error(getMessage(message !== null && message !== void 0 ? message : '', 'error'), _objectSpread(_objectSpread(_objectSpread({}, defaultOptions), options), {}, {
67
+ className: classNames('ald-message ald-message-error', options.className)
68
+ }));
129
69
  },
130
- destroy: function destroy(key) {
131
- AntdMessage.destroy(key);
70
+ info: function info(message) {
71
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
72
+ toast.dismiss();
73
+ return toast.info(getMessage(message !== null && message !== void 0 ? message : '', 'info'), _objectSpread(_objectSpread(_objectSpread({}, defaultOptions), options), {}, {
74
+ className: classNames('ald-message ald-message-info', options.className)
75
+ }));
132
76
  }
133
77
  };
134
78
  export default message;
@@ -1,31 +1,75 @@
1
- @import '../../style/index.less';
2
-
3
- .ant-message .ant-message-notice {
4
- .ant-message-notice-content {
5
- padding: 0;
6
- border-radius: var(--alias-radius-75, 6px);
7
- border: 1px solid var(--alias-colors-border-strong, #d1d5db);
8
- background: var(--alias-colors-bg-skeleton-subtler, #fff);
9
- box-shadow: 0 10px 10px -5px rgba(0, 0, 0, 0.04),
10
- 0 20px 25px -5px rgba(0, 0, 0, 0.1);
11
-
12
- .ant-message-custom-content {
1
+ @import '../../style/components/toastify.less';
2
+ @import '../../Divider/style/index.less';
3
+ /* stylelint-disable selector-class-pattern, keyframes-name-pattern */
4
+ .ald-message {
5
+ display: flex;
6
+ align-items: center;
7
+ padding: 0;
8
+ border-radius: var(--alias-radius-75, 6px);
9
+ background: var(--alias-colors-bg-skeleton-subtler, #fff);
10
+
11
+ & > svg {
12
+ flex-shrink: 0;
13
+ }
14
+
15
+ .Toastify__toast-body {
16
+ font-size: 14px;
17
+ font-style: normal;
18
+ font-weight: 400;
19
+ line-height: 20px;
20
+ margin: 0;
21
+
22
+ .ald-message-content {
13
23
  display: flex;
14
- overflow: hidden;
15
- padding: var(--alias-padding-150-minus-1, 12px)
16
- var(--alias-padding-200-minus-1, 16px);
17
24
  align-items: center;
18
- color: var(--alias-colors-text-default, #1f2937);
19
- font-size: 14px;
20
- font-weight: 500;
21
- line-height: 20px;
22
25
 
23
26
  .ald-message-icon-wrap {
24
- display: grid;
25
- place-items: center;
26
- flex-shrink: 0;
27
- font-size: 20px;
28
- margin-right: 6px;
27
+ height: 52px;
28
+ display: flex;
29
+ align-items: center;
30
+ justify-content: center;
31
+ width: 44px;
32
+ }
33
+
34
+ .ald-message-text {
35
+ display: flex;
36
+ align-items: center;
37
+ padding: 12px;
38
+ color: var(--alias-colors-text-default, #1f2937);
39
+ height: 52px;
40
+ gap: 12px;
41
+ border-top-right-radius: var(--alias-radius-75, 6px);
42
+ border-bottom-right-radius: var(--alias-radius-75, 6px);
43
+ border-top: var(--alias-stroke-md, 1px) solid
44
+ var(--alias-colors-border-strong, #d1d5db);
45
+ border-bottom: var(--alias-stroke-md, 1px) solid
46
+ var(--alias-colors-border-strong, #d1d5db);
47
+ border-right: var(--alias-stroke-md, 1px) solid
48
+ var(--alias-colors-border-strong, #d1d5db);
49
+ }
50
+ }
51
+ }
52
+
53
+ &.ald-message-success {
54
+ .ald-message-content {
55
+ .ald-message-icon-wrap {
56
+ background: var(--alias-colors-bg-accent-green-strong, #22c55e);
57
+ }
58
+ }
59
+ }
60
+
61
+ &.ald-message-info {
62
+ .ald-message-content {
63
+ .ald-message-icon-wrap {
64
+ background: var(--alias-colors-bg-accent-blue-strong, #2986f4);
65
+ }
66
+ }
67
+ }
68
+
69
+ &.ald-message-error {
70
+ .ald-message-content {
71
+ .ald-message-icon-wrap {
72
+ background: var(--alias-colors-bg-accent-red-strong, #ef4444);
29
73
  }
30
74
  }
31
75
  }
@@ -1,14 +1,21 @@
1
- import type { ArgsProps } from 'antd/lib/notification/interface';
2
1
  import React from 'react';
3
- interface IAldArgsProps extends ArgsProps {
4
- footer?: React.ReactNode;
2
+ import { ToastOptions as NotificationOptions, ToastPosition } from 'react-toastify';
3
+ type PlacementPosition = ToastPosition | 'topLeft' | 'topCenter' | 'topRight' | 'bottomCenter' | 'bottomLeft' | 'bottomRight';
4
+ interface IAldArgsProps extends NotificationOptions {
5
+ placement?: PlacementPosition;
6
+ message: React.ReactNode;
7
+ description?: React.ReactNode;
8
+ duration?: number;
9
+ className?: string;
10
+ style?: React.CSSProperties;
5
11
  }
6
12
  declare const notification: {
7
- open: (config: ArgsProps) => void;
8
- success: (config: IAldArgsProps) => void;
9
- error: (config: IAldArgsProps) => void;
10
- warning: (config: IAldArgsProps) => void;
11
- info: (config: IAldArgsProps) => void;
12
- destroy: (key?: string) => void;
13
+ open: (config: IAldArgsProps) => import("react-toastify").Id;
14
+ success: (config: IAldArgsProps) => import("react-toastify").Id;
15
+ error: (config: IAldArgsProps) => import("react-toastify").Id;
16
+ info: (config: IAldArgsProps) => import("react-toastify").Id;
17
+ warning: (config: IAldArgsProps) => import("react-toastify").Id;
18
+ close: (id: number) => void;
19
+ closeAll: () => void;
13
20
  };
14
21
  export default notification;