diginet-core-ui 1.4.14-beta.2 → 1.4.14-beta.4
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/components/accordion/details.js +36 -25
- package/components/accordion/group.js +33 -18
- package/components/accordion/index.js +42 -28
- package/components/accordion/summary.js +60 -52
- package/components/alert/index.js +84 -75
- package/components/alert/notify.js +43 -31
- package/components/avatar/index.js +78 -75
- package/components/badge/index.js +62 -60
- package/components/breadcrumb/index.js +62 -44
- package/components/button/icon.js +69 -49
- package/components/button/index.js +97 -75
- package/components/button/more.js +60 -39
- package/components/button/ripple-effect.js +1 -1
- package/components/card/body.js +25 -15
- package/components/card/extra.js +25 -15
- package/components/card/footer.js +25 -15
- package/components/card/header.js +26 -15
- package/components/card/index.js +66 -57
- package/components/chart/bar/Labels.js +14 -8
- package/components/chart/bar-v2/Labels.js +14 -8
- package/components/chart/line/Labels.js +14 -8
- package/components/chart/line/Path.js +3 -3
- package/components/chart/line/Point.js +12 -11
- package/components/chart/line-v2/Labels.js +14 -8
- package/components/check-text/index.js +21 -16
- package/components/check-text/interview-confirmation.js +21 -15
- package/components/check-text/interview-status.js +21 -15
- package/components/chip/attach.js +6 -2
- package/components/chip/index.js +83 -82
- package/components/collapse/index.js +1 -1
- package/components/dialogs/colors.js +13 -11
- package/components/divider/index.js +40 -22
- package/components/form-control/attachment/index.js +73 -36
- package/components/form-control/calendar/function.js +42 -38
- package/components/form-control/calendar/index.js +32 -20
- package/components/form-control/calendar/range.js +38 -22
- package/components/form-control/checkbox/index.js +83 -59
- package/components/form-control/control/index.js +9 -10
- package/components/form-control/date-picker/index.js +81 -64
- package/components/form-control/date-range-picker/index.js +92 -75
- package/components/form-control/dropdown/index.js +243 -216
- package/components/form-control/dropdown-box/index.js +56 -43
- package/components/form-control/form-group/index.js +7 -6
- package/components/form-control/helper-text/index.js +45 -41
- package/components/form-control/input-base/index.js +165 -133
- package/components/form-control/label/index.js +48 -41
- package/components/form-control/money-input/index.js +76 -68
- package/components/form-control/number-input/index.js +579 -521
- package/components/form-control/number-input/index2.js +89 -69
- package/components/form-control/password-input/index.js +67 -59
- package/components/form-control/radio/index.js +85 -69
- package/components/form-control/text-input/index.js +79 -70
- package/components/form-control/time-picker/index.js +79 -56
- package/components/form-control/time-picker/v2/index.js +22 -16
- package/components/form-control/toggle/index.js +140 -129
- package/components/form-view/helper-text.js +2 -2
- package/components/form-view/index.js +34 -31
- package/components/form-view/input.js +70 -69
- package/components/form-view/label.js +14 -9
- package/components/grid/Col.js +48 -39
- package/components/grid/Container.js +31 -38
- package/components/grid/Row.js +28 -32
- package/components/grid/index.js +66 -54
- package/components/image/index.js +37 -27
- package/components/list/list-item-action.js +36 -26
- package/components/list/list-item-icon.js +34 -29
- package/components/list/list-item-text.js +27 -22
- package/components/list/list-item.js +42 -36
- package/components/list/list.js +46 -38
- package/components/list/sub-header.js +33 -26
- package/components/modal/body.js +24 -14
- package/components/modal/footer.js +23 -13
- package/components/modal/header.js +39 -28
- package/components/modal/index.js +3 -3
- package/components/modal/modal.js +60 -49
- package/components/others/extra/index.js +31 -30
- package/components/others/import/index.js +2 -2
- package/components/others/scrollbar/index.js +32 -26
- package/components/paging/page-info.js +33 -34
- package/components/paging/page-selector.js +15 -15
- package/components/paper/index.js +32 -28
- package/components/popover/body.js +14 -8
- package/components/popover/footer.js +13 -8
- package/components/popover/header.js +17 -15
- package/components/popover/index.js +71 -60
- package/components/popup/danger_popup.js +17 -16
- package/components/popup/index.js +16 -17
- package/components/popup/v2/index.js +28 -41
- package/components/progress/circular.js +65 -80
- package/components/progress/linear.js +73 -58
- package/components/rating/index.js +41 -55
- package/components/slider/slider-container.js +49 -57
- package/components/slider/slider-item.js +30 -29
- package/components/status/index.js +23 -34
- package/components/tab/tab-header.js +20 -11
- package/components/tab/tab-panel.js +12 -7
- package/components/tab/tab.js +35 -22
- package/components/tooltip/index.js +24 -35
- package/components/transfer/index.js +102 -103
- package/components/tree-view/index.js +99 -81
- package/components/typography/index.js +62 -45
- package/global/index.js +2 -17
- package/icons/basic.js +975 -972
- package/icons/effect.js +8 -7
- package/package.json +3 -1
- package/styles/color-helper.js +2 -2
- package/styles/colors.js +168 -30
- package/styles/general.js +73 -5
- package/styles/sx/index.js +7 -4
- package/styles/utils.js +6 -5
- package/theme/createSpacing.js +10 -0
- package/theme/createTheme.js +26 -0
- package/theme/createZIndex.js +9 -0
- package/theme/index.js +13 -2
- package/theme/make-styles.js +2 -1
- package/theme/settings.js +699 -8
- package/theme/theme-provider.js +32 -15
- package/theme/theme.js +57 -56
- package/theme/use-classes.js +15 -0
- package/theme/utils/getThemeProps.js +12 -0
- package/theme/utils/resolveProps.js +17 -0
- package/theme/utils/useThemeProps.js +14 -0
- package/utils/handleBreakpoints.js +2 -2
- package/utils/hexToRGBA/index.js +2 -2
- package/utils/object/deepmerge.js +104 -0
- package/utils/object/object.js +7 -12
- package/utils/render-portal.js +4 -3
- package/theme/set-theme.js +0 -38
|
@@ -1,70 +1,64 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import {
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import { ButtonIcon, Icon, LinearProgress } from "./..";
|
|
4
5
|
import PropTypes from 'prop-types';
|
|
5
|
-
import {
|
|
6
|
-
import LinearProgress from "../progress/linear";
|
|
7
|
-
import ButtonIcon from "../button/icon";
|
|
8
|
-
import Icon from "../../icons";
|
|
9
|
-
import { hexToRGBA } from "../../styles/color-helper";
|
|
6
|
+
import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
10
7
|
import { animations } from "../../styles/animation";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
colors: {
|
|
16
|
-
system: {
|
|
17
|
-
white: systemWhite
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
typography: {
|
|
21
|
-
heading3,
|
|
22
|
-
heading4,
|
|
23
|
-
heading5,
|
|
24
|
-
paragraph1,
|
|
25
|
-
paragraph2,
|
|
26
|
-
paragraph3
|
|
27
|
-
},
|
|
28
|
-
spacing,
|
|
29
|
-
zIndex: zIndexCORE
|
|
30
|
-
} = useTheme();
|
|
8
|
+
import { bgColor, border, borderRadius4px, boxBorder, breakWord, displayBlock, flexRow, itemsCenter, justifyStart, positionRelative, textColor, userSelectNone } from "../../styles/general";
|
|
9
|
+
import { useTheme } from "../../theme";
|
|
10
|
+
import useThemeProps from "../../theme/utils/useThemeProps";
|
|
11
|
+
import { classNames, getProp, hexToRGBA, useDelayUnmount } from "../../utils";
|
|
31
12
|
const iconMap = new Map([['info', 'Info'], ['success', 'ApprovalFilled'], ['warning', 'Warning'], ['danger', 'CancelFilled']]);
|
|
32
13
|
const maxWidthMap = new Map([['tiny', 320], ['small', 400], ['medium', 480]]);
|
|
33
|
-
const primaryTypoMap = new Map([['tiny', heading5], ['small', heading4], ['medium', heading3]]);
|
|
14
|
+
const primaryTypoMap = new Map([['tiny', 'typography.heading5'], ['small', 'typography.heading4'], ['medium', 'typography.heading3']]);
|
|
34
15
|
const iconSizeMap = new Map([['tiny', 16], ['small', 20], ['medium', 24]]);
|
|
35
16
|
const linearProgressSizeMap = new Map([['tiny', 2], ['small', 3], ['medium', 4]]);
|
|
36
17
|
const transitionTime = 300;
|
|
37
|
-
const Alert = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
18
|
+
const Alert = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
19
|
+
if (!reference) reference = useRef(null);
|
|
20
|
+
const theme = useTheme();
|
|
21
|
+
const {
|
|
22
|
+
colors
|
|
23
|
+
} = theme;
|
|
24
|
+
|
|
25
|
+
// props priority: `inProps` > `themeDefaultProps`
|
|
26
|
+
const props = useThemeProps({
|
|
27
|
+
props: inProps,
|
|
28
|
+
name: 'Alert'
|
|
29
|
+
});
|
|
30
|
+
const {
|
|
31
|
+
action = {},
|
|
32
|
+
autoDisappear,
|
|
33
|
+
children,
|
|
34
|
+
className,
|
|
35
|
+
clearAble,
|
|
36
|
+
color,
|
|
37
|
+
duration,
|
|
38
|
+
onClose,
|
|
39
|
+
progressing,
|
|
40
|
+
secondary,
|
|
41
|
+
size,
|
|
42
|
+
text,
|
|
43
|
+
type: typeProp
|
|
44
|
+
} = props;
|
|
45
|
+
const type = typeProp || color;
|
|
53
46
|
const ref = useRef(null);
|
|
54
47
|
const clearIconRef = useRef(null);
|
|
55
48
|
const [percentState, setPercentState] = useState(100);
|
|
56
49
|
const [isClose, setIsClose] = useState(false);
|
|
57
50
|
const showAlert = useDelayUnmount(!isClose, transitionTime);
|
|
58
|
-
const mainColor = colors
|
|
59
|
-
const opacityColor = hexToRGBA(mainColor, 0.15);
|
|
51
|
+
const mainColor = getProp(colors, type, type);
|
|
52
|
+
const opacityColor = hexToRGBA(getProp(colors, mainColor, mainColor), 0.15);
|
|
60
53
|
const iconName = iconMap.get(type);
|
|
61
54
|
const iconSize = iconSizeMap.get(size);
|
|
62
|
-
const _AlertContainerCSS = AlertContainerCSS(size);
|
|
63
|
-
const _AlertInfoCSS = AlertInfoCSS(mainColor, opacityColor);
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
const
|
|
55
|
+
const _AlertContainerCSS = AlertContainerCSS(size, theme);
|
|
56
|
+
const _AlertInfoCSS = AlertInfoCSS(mainColor, opacityColor, theme);
|
|
57
|
+
const _AlertIconCSS = AlertIconCSS(theme);
|
|
58
|
+
const _AlertTextCSS = AlertTextCSS(clearAble, theme);
|
|
59
|
+
const _AlertPrimaryCSS = AlertPrimaryCSS(secondary, size, theme);
|
|
60
|
+
const _AlertSecondaryCSS = AlertSecondaryCSS(size, theme);
|
|
61
|
+
const _linearProgressCSS = linearProgressCSS(size, theme);
|
|
68
62
|
const _onClose = () => {
|
|
69
63
|
setIsClose(true);
|
|
70
64
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
@@ -107,7 +101,7 @@ const Alert = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
107
101
|
css: _AlertInfoCSS,
|
|
108
102
|
className: classNames('DGN-UI-Alert', className)
|
|
109
103
|
}, jsx("span", {
|
|
110
|
-
css:
|
|
104
|
+
css: _AlertIconCSS,
|
|
111
105
|
className: 'DGN-UI-Alert-Icon'
|
|
112
106
|
}, node), jsx("span", {
|
|
113
107
|
css: _AlertTextCSS,
|
|
@@ -130,7 +124,7 @@ const Alert = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
130
124
|
color: type,
|
|
131
125
|
name: 'Close'
|
|
132
126
|
}) : null));
|
|
133
|
-
}, [
|
|
127
|
+
}, [children, className, clearAble, color, onClose, secondary, size, text, typeProp, isClose, mainColor, opacityColor, theme]);
|
|
134
128
|
const LinearView = useMemo(() => {
|
|
135
129
|
return progressing ? jsx("span", {
|
|
136
130
|
css: _linearProgressCSS,
|
|
@@ -146,7 +140,7 @@ const Alert = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
146
140
|
boxShadow: 'none'
|
|
147
141
|
}
|
|
148
142
|
})) : null;
|
|
149
|
-
}, [
|
|
143
|
+
}, [duration, size, progressing, percentState, theme]);
|
|
150
144
|
return showAlert ? jsx("div", {
|
|
151
145
|
css: _AlertContainerCSS,
|
|
152
146
|
className: 'DGN-UI-Container-Alert',
|
|
@@ -154,73 +148,88 @@ const Alert = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
154
148
|
}, AlertView, LinearView) : null;
|
|
155
149
|
}));
|
|
156
150
|
const fadeIn = animations.fadeIn;
|
|
157
|
-
const AlertContainerCSS = size
|
|
151
|
+
const AlertContainerCSS = (size, {
|
|
152
|
+
zIndex
|
|
153
|
+
}) => css`
|
|
158
154
|
${positionRelative};
|
|
159
155
|
${displayBlock};
|
|
160
156
|
max-width: ${maxWidthMap.get(size)}px;
|
|
161
157
|
transition: opacity ${transitionTime}ms ease;
|
|
162
158
|
margin-bottom: 1rem;
|
|
163
159
|
pointer-events: auto;
|
|
164
|
-
z-index: ${
|
|
160
|
+
z-index: ${zIndex(1)};
|
|
165
161
|
animation: ${fadeIn} ${transitionTime}ms ease;
|
|
166
162
|
`;
|
|
167
|
-
const AlertInfoCSS = (mainColor, opacityColor
|
|
163
|
+
const AlertInfoCSS = (mainColor, opacityColor, {
|
|
164
|
+
colors,
|
|
165
|
+
spacing
|
|
166
|
+
}) => css`
|
|
168
167
|
${flexRow};
|
|
169
168
|
${positionRelative};
|
|
170
169
|
${boxBorder};
|
|
171
170
|
${borderRadius4px};
|
|
172
171
|
${breakWord};
|
|
173
172
|
${border(1, mainColor)};
|
|
174
|
-
|
|
173
|
+
${textColor(mainColor)};
|
|
175
174
|
background-image: linear-gradient(${opacityColor}, ${opacityColor});
|
|
176
|
-
|
|
175
|
+
${bgColor(getProp(colors, 'system/standard'))};
|
|
177
176
|
width: 100%;
|
|
178
177
|
min-width: 320px;
|
|
179
178
|
padding: ${spacing([0, 1, 0, 4])};
|
|
180
179
|
opacity: 1;
|
|
181
180
|
`;
|
|
182
|
-
const AlertIconCSS =
|
|
181
|
+
const AlertIconCSS = ({
|
|
182
|
+
spacing
|
|
183
|
+
}) => css`
|
|
183
184
|
display: inherit;
|
|
184
185
|
margin-right: ${spacing([2.5])};
|
|
185
186
|
padding: ${spacing([2, 0])};
|
|
186
187
|
`;
|
|
187
|
-
const AlertTextCSS = clearAble
|
|
188
|
+
const AlertTextCSS = (clearAble, {
|
|
189
|
+
spacing
|
|
190
|
+
}) => css`
|
|
188
191
|
${displayBlock};
|
|
189
192
|
margin-right: ${spacing([clearAble ? 2.5 : 0])};
|
|
190
193
|
padding: ${spacing([2, 0])};
|
|
191
194
|
align-self: center;
|
|
192
195
|
`;
|
|
193
|
-
const AlertPrimaryCSS = (secondary, size) => css`
|
|
196
|
+
const AlertPrimaryCSS = (secondary, size, theme) => css`
|
|
194
197
|
${flexRow};
|
|
195
198
|
${positionRelative};
|
|
196
199
|
${itemsCenter};
|
|
197
200
|
${justifyStart};
|
|
198
201
|
${userSelectNone};
|
|
199
|
-
${secondary ? primaryTypoMap.get(size) : paragraph1};
|
|
202
|
+
${secondary ? getProp(theme, primaryTypoMap.get(size)) : getProp(theme, 'typography.paragraph1')};
|
|
200
203
|
`;
|
|
201
|
-
const AlertSecondaryCSS = size
|
|
204
|
+
const AlertSecondaryCSS = (size, {
|
|
205
|
+
typography
|
|
206
|
+
}) => css`
|
|
202
207
|
${displayBlock};
|
|
203
208
|
${userSelectNone};
|
|
204
|
-
${size === 'tiny' ? paragraph3 : paragraph2};
|
|
209
|
+
${size === 'tiny' ? typography.paragraph3 : typography.paragraph2};
|
|
205
210
|
`;
|
|
206
211
|
const AlertClearIconCSS = css`
|
|
207
212
|
margin-left: auto;
|
|
208
213
|
`;
|
|
209
|
-
const linearProgressCSS = size
|
|
214
|
+
const linearProgressCSS = (size, {
|
|
215
|
+
spacing
|
|
216
|
+
}) => css`
|
|
210
217
|
${displayBlock};
|
|
211
218
|
${positionRelative};
|
|
212
219
|
margin-top: ${spacing([size === 'medium' ? 1 : 0.5])};
|
|
213
220
|
padding: ${spacing([0, 1.25])};
|
|
214
221
|
`;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
222
|
+
|
|
223
|
+
// Alert.defaultProps = {
|
|
224
|
+
// autoDisappear: false,
|
|
225
|
+
// className: '',
|
|
226
|
+
// clearAble: true,
|
|
227
|
+
// color: 'semantic/info',
|
|
228
|
+
// duration: 2000,
|
|
229
|
+
// progressing: false,
|
|
230
|
+
// size: 'medium',
|
|
231
|
+
// };
|
|
232
|
+
|
|
224
233
|
Alert.propTypes = {
|
|
225
234
|
/** Automatically remove the Alert component after the timer ends (milliseconds). */
|
|
226
235
|
autoDisappear: PropTypes.bool,
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import {
|
|
4
|
-
import ReactDOM, { createPortal } from 'react-dom';
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import theme from "../../theme/settings";
|
|
9
|
-
import { classNames } from "../../utils";
|
|
5
|
+
import { forwardRef, memo, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
6
|
+
import ReactDOM, { createPortal } from 'react-dom';
|
|
10
7
|
import { bgTransparent, pointerEventsNone, positionFixed } from "../../styles/general";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
8
|
+
import { useTheme } from "../../theme";
|
|
9
|
+
import useThemeProps from "../../theme/utils/useThemeProps";
|
|
10
|
+
import { classNames } from "../../utils";
|
|
11
|
+
import Alert from "./";
|
|
14
12
|
const positionVerticalMap = new Map([['top', css`
|
|
15
13
|
top: 15px;
|
|
16
14
|
`], ['center', css`
|
|
@@ -29,17 +27,27 @@ const positionHorizontalMap = new Map([['left', css`
|
|
|
29
27
|
`], ['right', css`
|
|
30
28
|
right: 15px;
|
|
31
29
|
`]]);
|
|
32
|
-
const Notify = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
30
|
+
const Notify = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
31
|
+
if (!reference) reference = useRef(null);
|
|
32
|
+
const theme = useTheme();
|
|
33
|
+
|
|
34
|
+
// props priority: `inProps` > `themeDefaultProps`
|
|
35
|
+
const props = useThemeProps({
|
|
36
|
+
props: inProps,
|
|
37
|
+
name: 'Notify'
|
|
38
|
+
});
|
|
39
|
+
const {
|
|
40
|
+
action = {},
|
|
41
|
+
className,
|
|
42
|
+
getAddNotify,
|
|
43
|
+
id,
|
|
44
|
+
position,
|
|
45
|
+
style,
|
|
46
|
+
...other
|
|
47
|
+
} = props;
|
|
41
48
|
const ref = useRef(null);
|
|
42
49
|
const [positionState, setPositionState] = useState(position);
|
|
50
|
+
const _AlertCSS = AlertCSS(theme);
|
|
43
51
|
const PositionVerticalCSS = positionVerticalMap.get((positionState === null || positionState === void 0 ? void 0 : positionState.vertical) || 'bottom');
|
|
44
52
|
const PositionHorizontalCSS = positionHorizontalMap.get((positionState === null || positionState === void 0 ? void 0 : positionState.horizontal) || 'center');
|
|
45
53
|
const showNotify = (message, {
|
|
@@ -56,13 +64,13 @@ const Notify = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
56
64
|
// onClose={() => el.remove()}
|
|
57
65
|
, {
|
|
58
66
|
secondary: message,
|
|
59
|
-
...
|
|
67
|
+
...other,
|
|
60
68
|
...options
|
|
61
69
|
}), ref.current.appendChild(el));
|
|
62
70
|
};
|
|
63
71
|
useEffect(() => {
|
|
64
72
|
if (getAddNotify && typeof getAddNotify === 'function') getAddNotify(showNotify);
|
|
65
|
-
}, [
|
|
73
|
+
}, [other]);
|
|
66
74
|
useEffect(() => {
|
|
67
75
|
setPositionState(position);
|
|
68
76
|
}, [position]);
|
|
@@ -80,27 +88,31 @@ const Notify = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
80
88
|
});
|
|
81
89
|
const NotifyContainerView = jsx("div", {
|
|
82
90
|
ref: ref,
|
|
83
|
-
css: [
|
|
91
|
+
css: [_AlertCSS, PositionVerticalCSS, PositionHorizontalCSS],
|
|
84
92
|
id: id,
|
|
85
93
|
style: style,
|
|
86
94
|
className: classNames('DGN-UI-Notify-Alert', (position === null || position === void 0 ? void 0 : position.vertical) || 'center' + '-' + (position === null || position === void 0 ? void 0 : position.horizontal) || 'center', className)
|
|
87
95
|
});
|
|
88
96
|
return /*#__PURE__*/createPortal(NotifyContainerView, document.body);
|
|
89
97
|
}));
|
|
90
|
-
const AlertCSS =
|
|
98
|
+
const AlertCSS = ({
|
|
99
|
+
zIndex
|
|
100
|
+
}) => css`
|
|
91
101
|
${positionFixed};
|
|
92
102
|
${pointerEventsNone};
|
|
93
103
|
${bgTransparent};
|
|
94
|
-
z-index: ${
|
|
104
|
+
z-index: ${zIndex(2)};
|
|
95
105
|
`;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
106
|
+
|
|
107
|
+
// Notify.defaultProps = {
|
|
108
|
+
// className: '',
|
|
109
|
+
// position: {
|
|
110
|
+
// vertical: 'bottom',
|
|
111
|
+
// horizontal: 'center',
|
|
112
|
+
// },
|
|
113
|
+
// style: {},
|
|
114
|
+
// };
|
|
115
|
+
|
|
104
116
|
Notify.propTypes = {
|
|
105
117
|
/** Class for component. */
|
|
106
118
|
className: PropTypes.string,
|
|
@@ -6,23 +6,12 @@ import { ButtonIcon, Image, ModalSample, Notify, Popover, Typography } from "./.
|
|
|
6
6
|
import OptionWrapper from "../others/option-wrapper";
|
|
7
7
|
import { getGlobal } from "../../global";
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
|
-
import {
|
|
10
|
-
import { borderNone, borderRadius, boxContent, cursorInherit, cursorPointer, displayBlock, displayFlex, displayInlineFlex, displayNone, flexCol, itemsCenter, overflowHidden, parseMinWidth, parseWidthHeight,
|
|
9
|
+
import { Fragment, forwardRef, isValidElement, memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
10
|
+
import { borderNone, borderRadius, boxContent, cursorInherit, cursorPointer, displayBlock, displayFlex, displayInlineFlex, displayNone, flexCol, itemsCenter, overflowHidden, parseMinWidth, parseWidthHeight, positionAbsolute, positionRelative, userSelectNone, z } from "../../styles/general";
|
|
11
|
+
import { getColor } from "../../styles/utils";
|
|
11
12
|
import { useTheme } from "../../theme";
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
colors: {
|
|
15
|
-
system: {
|
|
16
|
-
white: systemWhite
|
|
17
|
-
},
|
|
18
|
-
fill: {
|
|
19
|
-
tooltip: fillTooltip
|
|
20
|
-
},
|
|
21
|
-
text: {
|
|
22
|
-
tooltip: textTooltip
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
} = useTheme();
|
|
13
|
+
import useThemeProps from "../../theme/utils/useThemeProps";
|
|
14
|
+
import { classNames, getProp, isMobile, refType as ref } from "../../utils";
|
|
26
15
|
const checkFileType = (type, matchType) => {
|
|
27
16
|
if (typeof matchType === 'object' && matchType instanceof RegExp) {
|
|
28
17
|
return matchType.test(type);
|
|
@@ -33,36 +22,44 @@ const checkFileType = (type, matchType) => {
|
|
|
33
22
|
return new RegExp(matchType).test(type);
|
|
34
23
|
}
|
|
35
24
|
};
|
|
36
|
-
const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
37
|
-
action = {},
|
|
38
|
-
actionIconHeight,
|
|
39
|
-
actionIconWidth,
|
|
40
|
-
allowEdit,
|
|
41
|
-
className,
|
|
42
|
-
clearAble,
|
|
43
|
-
data,
|
|
44
|
-
defaultSrc,
|
|
45
|
-
direction,
|
|
46
|
-
disabled,
|
|
47
|
-
height,
|
|
48
|
-
hoverAble,
|
|
49
|
-
id,
|
|
50
|
-
lazyLoading,
|
|
51
|
-
matchType,
|
|
52
|
-
maxSize,
|
|
53
|
-
maxSizeError,
|
|
54
|
-
onChange,
|
|
55
|
-
onClick,
|
|
56
|
-
onRemove,
|
|
57
|
-
outlined,
|
|
58
|
-
readOnly,
|
|
59
|
-
src,
|
|
60
|
-
style,
|
|
61
|
-
width,
|
|
62
|
-
wrongTypeError
|
|
63
|
-
}, reference) => {
|
|
25
|
+
const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
64
26
|
if (!reference) reference = useRef(null);
|
|
65
|
-
|
|
27
|
+
const theme = useTheme();
|
|
28
|
+
|
|
29
|
+
// props priority: `inProps` > `themeDefaultProps`
|
|
30
|
+
const props = useThemeProps({
|
|
31
|
+
props: inProps,
|
|
32
|
+
name: 'Avatar'
|
|
33
|
+
});
|
|
34
|
+
const {
|
|
35
|
+
action = {},
|
|
36
|
+
actionIconHeight,
|
|
37
|
+
actionIconWidth,
|
|
38
|
+
allowEdit,
|
|
39
|
+
className,
|
|
40
|
+
clearAble,
|
|
41
|
+
data,
|
|
42
|
+
defaultSrc: defaultSrcProp,
|
|
43
|
+
direction,
|
|
44
|
+
disabled,
|
|
45
|
+
height,
|
|
46
|
+
hoverAble,
|
|
47
|
+
id,
|
|
48
|
+
lazyLoading,
|
|
49
|
+
matchType,
|
|
50
|
+
maxSize,
|
|
51
|
+
maxSizeError,
|
|
52
|
+
onChange,
|
|
53
|
+
onClick,
|
|
54
|
+
onRemove,
|
|
55
|
+
outlined,
|
|
56
|
+
readOnly,
|
|
57
|
+
src,
|
|
58
|
+
style,
|
|
59
|
+
width,
|
|
60
|
+
wrongTypeError
|
|
61
|
+
} = props;
|
|
62
|
+
const defaultSrc = defaultSrcProp || AvatarDefault;
|
|
66
63
|
const ref = useRef(null);
|
|
67
64
|
const inputRef = useRef(null);
|
|
68
65
|
const avatarRef = useRef(null);
|
|
@@ -73,7 +70,7 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
73
70
|
const _ActionIconCSS = ActionIconCSS(actionIconWidth);
|
|
74
71
|
const _AvatarPreviewCSS = AvatarPreviewCSS(readOnly || disabled);
|
|
75
72
|
const _AvatarContainerCSS = AvatarContainerCSS(_ActionIconCSS.name);
|
|
76
|
-
const _AvatarRootCSS = AvatarRootCSS(width, height, outlined);
|
|
73
|
+
const _AvatarRootCSS = AvatarRootCSS(width, height, outlined, theme);
|
|
77
74
|
const _isMobile = isMobile.any();
|
|
78
75
|
const triggerInput = e => {
|
|
79
76
|
if (e || !srcState) {
|
|
@@ -115,13 +112,13 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
115
112
|
return info.map((key, index) => {
|
|
116
113
|
return jsx(Typography, {
|
|
117
114
|
key: index,
|
|
118
|
-
color:
|
|
115
|
+
color: 'text/tooltip',
|
|
119
116
|
type: 'p1'
|
|
120
117
|
}, key + ': ' + data[key]);
|
|
121
118
|
});
|
|
122
119
|
}
|
|
123
120
|
return jsx(Typography, {
|
|
124
|
-
color:
|
|
121
|
+
color: 'text/tooltip',
|
|
125
122
|
type: 'p1'
|
|
126
123
|
}, getGlobal('noDataText'));
|
|
127
124
|
};
|
|
@@ -227,19 +224,19 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
227
224
|
arrow: true,
|
|
228
225
|
open: viewMoreInfo,
|
|
229
226
|
pressESCToClose: false,
|
|
230
|
-
bgColor:
|
|
227
|
+
bgColor: 'fill/tooltip',
|
|
231
228
|
anchor: avatarRef,
|
|
232
229
|
fullScreen: false,
|
|
233
230
|
direction: direction
|
|
234
231
|
}, jsx("div", {
|
|
235
|
-
css: MoreInfoCSS
|
|
232
|
+
css: MoreInfoCSS(theme)
|
|
236
233
|
}, typeof data === 'function' ? data() : renderData())) : null, jsx(Notify, {
|
|
237
234
|
ref: notifyRef,
|
|
238
235
|
progressing: true,
|
|
239
236
|
autoDisappear: true,
|
|
240
237
|
color: 'danger'
|
|
241
238
|
}));
|
|
242
|
-
}, [actionIconHeight, actionIconWidth, allowEdit, clearAble, data,
|
|
239
|
+
}, [actionIconHeight, actionIconWidth, allowEdit, clearAble, data, defaultSrcProp, direction, disabled, height, hoverAble, lazyLoading, matchType, maxSize, maxSizeError, outlined, readOnly, width, srcState, theme, viewAvatar, viewMoreInfo]);
|
|
243
240
|
}));
|
|
244
241
|
const ActionIconCSS = actionIconWidth => css`
|
|
245
242
|
${displayFlex};
|
|
@@ -269,7 +266,9 @@ const AvatarContainerCSS = ActionIconCSSName => css`
|
|
|
269
266
|
}
|
|
270
267
|
}
|
|
271
268
|
`;
|
|
272
|
-
const AvatarRootCSS = (width, height, outlined
|
|
269
|
+
const AvatarRootCSS = (width, height, outlined, {
|
|
270
|
+
colors
|
|
271
|
+
}) => css`
|
|
273
272
|
${displayBlock};
|
|
274
273
|
${positionRelative};
|
|
275
274
|
${overflowHidden};
|
|
@@ -278,36 +277,40 @@ const AvatarRootCSS = (width, height, outlined) => css`
|
|
|
278
277
|
${boxContent};
|
|
279
278
|
${parseWidthHeight(width, height)};
|
|
280
279
|
${borderRadius('50%')};
|
|
281
|
-
border: ${typeof outlined === 'boolean' && outlined ? `1px solid ${
|
|
280
|
+
border: ${typeof outlined === 'boolean' && outlined ? `1px solid ${getColor(getProp(colors, 'system/standard'))}` : outlined};
|
|
282
281
|
input {
|
|
283
282
|
${displayNone};
|
|
284
283
|
}
|
|
285
284
|
`;
|
|
286
|
-
const MoreInfoCSS =
|
|
285
|
+
const MoreInfoCSS = ({
|
|
286
|
+
spacing
|
|
287
|
+
}) => css`
|
|
287
288
|
${displayBlock};
|
|
288
289
|
${positionRelative};
|
|
289
|
-
${
|
|
290
|
+
padding: ${spacing([2])};
|
|
290
291
|
`;
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}
|
|
292
|
+
|
|
293
|
+
// Avatar.defaultProps = {
|
|
294
|
+
// actionIconHeight: 24,
|
|
295
|
+
// actionIconWidth: 24,
|
|
296
|
+
// allowEdit: false,
|
|
297
|
+
// className: '',
|
|
298
|
+
// clearAble: true,
|
|
299
|
+
// data: {},
|
|
300
|
+
// direction: 'bottom',
|
|
301
|
+
// disabled: false,
|
|
302
|
+
// height: 48,
|
|
303
|
+
// hoverAble: false,
|
|
304
|
+
// lazyLoading: false,
|
|
305
|
+
// matchType: /^image\/(gif|jpe?g|tiff?|png|webp|bmp|svg(\+xml)?)$/i,
|
|
306
|
+
// maxSizeError: `File ${getGlobal(['errorDefault', 'maxSize'])}`,
|
|
307
|
+
// outlined: false,
|
|
308
|
+
// readOnly: false,
|
|
309
|
+
// style: {},
|
|
310
|
+
// width: 48,
|
|
311
|
+
// wrongTypeError: `File ${getGlobal(['errorDefault', 'fileType'])}`,
|
|
312
|
+
// };
|
|
313
|
+
|
|
311
314
|
Avatar.propTypes = {
|
|
312
315
|
/** The height of action icon. */
|
|
313
316
|
actionIconHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|