@antscorp/antsomi-ui 1.3.5-beta.791 → 1.3.5-beta.793
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/components/atoms/NotificationStatus/NotificationStatus.d.ts +12 -0
- package/es/components/atoms/NotificationStatus/NotificationStatus.js +27 -0
- package/es/components/atoms/NotificationStatus/constants/index.d.ts +15 -0
- package/es/components/atoms/NotificationStatus/constants/index.js +15 -0
- package/es/components/atoms/NotificationStatus/index.d.ts +1 -0
- package/es/components/atoms/NotificationStatus/index.js +1 -0
- package/es/components/atoms/NotificationStatus/styled.d.ts +3 -0
- package/es/components/atoms/NotificationStatus/styled.js +14 -0
- package/es/components/atoms/index.d.ts +1 -0
- package/es/components/atoms/index.js +1 -0
- package/es/components/molecules/DrawerDetail/DrawerDetail.js +2 -2
- package/es/providers/ConfigProvider/GlobalStyle.js +23 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type TNotification = {
|
|
3
|
+
title: string;
|
|
4
|
+
message?: string;
|
|
5
|
+
type: 'success' | 'error';
|
|
6
|
+
timeout?: number;
|
|
7
|
+
};
|
|
8
|
+
declare const useNotificationStatus: () => {
|
|
9
|
+
contextHolder: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
10
|
+
showNotification: ({ title, message, type, timeout, }: TNotification) => void;
|
|
11
|
+
};
|
|
12
|
+
export default useNotificationStatus;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { notification } from 'antd';
|
|
3
|
+
import { MAP_BY_TYPE, STYLE_NOTIFICATION } from './constants';
|
|
4
|
+
import { Content, Title } from './styled';
|
|
5
|
+
import { Icon } from '../Icon';
|
|
6
|
+
const useNotificationStatus = () => {
|
|
7
|
+
const [api, contextHolder] = notification.useNotification();
|
|
8
|
+
const showNotification = ({ title = '', message = '', type = 'success', timeout = 4, }) => {
|
|
9
|
+
const info = MAP_BY_TYPE[type];
|
|
10
|
+
return api[type]({
|
|
11
|
+
message: _jsx(Title, { color: info.color, children: title }),
|
|
12
|
+
description: _jsx(Content, { children: message }),
|
|
13
|
+
duration: timeout,
|
|
14
|
+
style: {
|
|
15
|
+
...STYLE_NOTIFICATION,
|
|
16
|
+
borderLeft: `4px solid ${info.color}`,
|
|
17
|
+
},
|
|
18
|
+
placement: 'bottomLeft',
|
|
19
|
+
closeIcon: _jsx(Icon, { size: 14, color: "#595959", type: "icon-ants-remove-slim" }),
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
contextHolder,
|
|
24
|
+
showNotification,
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export default useNotificationStatus;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const MAP_BY_TYPE: {
|
|
2
|
+
readonly success: {
|
|
3
|
+
readonly color: "#12B800";
|
|
4
|
+
};
|
|
5
|
+
readonly error: {
|
|
6
|
+
readonly color: "#ef3340";
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare const STYLE_NOTIFICATION: {
|
|
10
|
+
display: string;
|
|
11
|
+
alignItems: string;
|
|
12
|
+
gap: string;
|
|
13
|
+
padding: string;
|
|
14
|
+
borderRadius: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const MAP_BY_TYPE = {
|
|
2
|
+
success: {
|
|
3
|
+
color: '#12B800',
|
|
4
|
+
},
|
|
5
|
+
error: {
|
|
6
|
+
color: '#ef3340',
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
export const STYLE_NOTIFICATION = {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
gap: '10px',
|
|
13
|
+
padding: '15px',
|
|
14
|
+
borderRadius: '10px',
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as useNotificationStatus } from './NotificationStatus';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as useNotificationStatus } from './NotificationStatus';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const Title: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const WrapperIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
+
export declare const Content: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
export const Title = styled.div `
|
|
3
|
+
font-weight: bold;
|
|
4
|
+
font-size: 14px;
|
|
5
|
+
line-height: 20px;
|
|
6
|
+
color: ${props => props.color || '#000'};
|
|
7
|
+
`;
|
|
8
|
+
export const WrapperIcon = styled.div `
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
`;
|
|
12
|
+
export const Content = styled.div `
|
|
13
|
+
color: #7f7f7f;
|
|
14
|
+
`;
|
|
@@ -44,6 +44,7 @@ export * from './RateV2';
|
|
|
44
44
|
export * from './Popover';
|
|
45
45
|
export * from './Iframe';
|
|
46
46
|
export * from './Avatar';
|
|
47
|
+
export * from './NotificationStatus';
|
|
47
48
|
export type { SliderProps } from './Slider';
|
|
48
49
|
export type { PaginationProps } from './Pagination';
|
|
49
50
|
export type { InputDynamicProps } from './InputDynamic';
|
|
@@ -16,7 +16,7 @@ import { safeParseJson } from '@antscorp/antsomi-ui/es/utils';
|
|
|
16
16
|
import { POST_MESSAGE_TYPES } from '@antscorp/antsomi-ui/es/constants';
|
|
17
17
|
export const DrawerDetail = props => {
|
|
18
18
|
// Props
|
|
19
|
-
const { width, fullScreen: fullScreenProp = false, children, menuProps, closeIconProps, maxWidth, minWidth, defaultSize = 'max', headerProps, name, destroyOnClose = true, ...restProps } = props;
|
|
19
|
+
const { width, fullScreen: fullScreenProp = false, children, menuProps, closeIconProps, maxWidth, minWidth, defaultSize = 'max', headerProps, name, destroyOnClose = true, mask = false, ...restProps } = props;
|
|
20
20
|
const { show: showMenu = true, showExpandButton = true, showClose = true, items, selectedKeys, footer, onClick = () => { }, } = menuProps || {};
|
|
21
21
|
const { children: headerChildren, ...restOfHeaderProps } = headerProps || {};
|
|
22
22
|
const { onClose = () => { } } = props;
|
|
@@ -115,7 +115,7 @@ export const DrawerDetail = props => {
|
|
|
115
115
|
motionAppear: false,
|
|
116
116
|
motionEnter: false,
|
|
117
117
|
motionLeave: false,
|
|
118
|
-
}, mask:
|
|
118
|
+
}, mask: mask, classNames: {
|
|
119
119
|
body: 'drawer-detail-body',
|
|
120
120
|
}, contentWrapperStyle: {
|
|
121
121
|
transition: 'none',
|
|
@@ -1125,4 +1125,27 @@ export const GlobalStyle = () => (_jsx(Global, { styles: css `
|
|
|
1125
1125
|
}
|
|
1126
1126
|
}
|
|
1127
1127
|
}
|
|
1128
|
+
|
|
1129
|
+
/* Notification */
|
|
1130
|
+
.antsomi-notification-notice {
|
|
1131
|
+
display: flex;
|
|
1132
|
+
max-width: 340px !important;
|
|
1133
|
+
|
|
1134
|
+
.antsomi-notification-notice-content {
|
|
1135
|
+
display: flex;
|
|
1136
|
+
flex: 1;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
.antsomi-notification-notice-with-icon {
|
|
1140
|
+
display: flex;
|
|
1141
|
+
flex-direction: column;
|
|
1142
|
+
justify-content: center;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
.antsomi-notification-notice-close {
|
|
1146
|
+
position: relative !important;
|
|
1147
|
+
top: 0 !important;
|
|
1148
|
+
inset-inline-end: 0 !important;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1128
1151
|
` }));
|