diginet-core-ui 1.3.55 → 1.3.56
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/button/icon.js +21 -21
- package/components/form-control/dropdown/index.js +313 -340
- package/components/form-control/number-input/index2.js +3 -1
- package/components/index.js +1 -1
- package/components/modal/body.js +58 -48
- package/components/modal/footer.js +43 -41
- package/components/modal/header.js +22 -18
- package/components/modal/modal.js +70 -48
- package/components/paging/page-selector2.js +373 -0
- package/package.json +1 -1
- package/readme.md +7 -0
- package/utils/useElementSize.js +48 -0
- package/utils/useEventListener.js +45 -0
- package/utils/useInput.js +1 -1
|
@@ -142,6 +142,7 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
142
142
|
const returnValue = convertMoneyToNumber(valueT);
|
|
143
143
|
e.value = globalRef.current.value = !isNaN(parseFloat(returnValue)) ? parseFloat(returnValue) : null;
|
|
144
144
|
e.target.value = globalRef.current.valueString = valueT || '';
|
|
145
|
+
globalRef.current.returnValue = returnValue || '';
|
|
145
146
|
onInput === null || onInput === void 0 ? void 0 : onInput(e);
|
|
146
147
|
setValue(valueT);
|
|
147
148
|
};
|
|
@@ -294,7 +295,8 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
294
295
|
onChange({ ...e,
|
|
295
296
|
value: globalRef.current.value,
|
|
296
297
|
target: { ...e.target,
|
|
297
|
-
value: globalRef.current.valueString
|
|
298
|
+
value: globalRef.current.valueString,
|
|
299
|
+
valueString: globalRef.current.returnValue
|
|
298
300
|
}
|
|
299
301
|
});
|
|
300
302
|
},
|
package/components/index.js
CHANGED
|
@@ -72,7 +72,7 @@ export { default as ModalBody } from './modal/body';
|
|
|
72
72
|
export { default as ModalFooter } from './modal/footer'; // PAGING
|
|
73
73
|
|
|
74
74
|
export { default as PagingInfo } from './paging/page-info';
|
|
75
|
-
export { default as PagingSelector } from './paging/page-
|
|
75
|
+
export { default as PagingSelector } from './paging/page-selector2'; // PAPER
|
|
76
76
|
|
|
77
77
|
export { default as Paper } from './paper'; // POPOVER
|
|
78
78
|
|
package/components/modal/body.js
CHANGED
|
@@ -1,69 +1,79 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import { memo, useMemo,
|
|
4
|
+
import { memo, useMemo, useRef, forwardRef, useImperativeHandle } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { jsx, css } from '@emotion/core';
|
|
7
|
-
import {
|
|
7
|
+
import { borderBox, displayBlock, overflowAuto, positionRelative } from '../../styles/general';
|
|
8
|
+
import theme from '../../theme/settings';
|
|
8
9
|
const {
|
|
9
10
|
colors: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
fill: {
|
|
12
|
+
'scrollbar-rest': scrollbarRest,
|
|
13
|
+
'scrollbar-active': scrollbarActive
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
spacing
|
|
17
|
+
} = theme;
|
|
13
18
|
const ModalBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
14
19
|
children,
|
|
15
20
|
className,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
&::-webkit-scrollbar-thumb{
|
|
34
|
-
border-radius: 10px;
|
|
35
|
-
mix-blend-mode: normal;
|
|
36
|
-
background-color: ${scrollbar};
|
|
37
|
-
background-clip: content-box;
|
|
38
|
-
border: 8px solid transparent;
|
|
39
|
-
}
|
|
40
|
-
`;
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
!!refs && refs(ref);
|
|
43
|
-
}, []);
|
|
44
|
-
const Body = useMemo(() => jsx("div", {
|
|
45
|
-
css: ModalBodyBox,
|
|
46
|
-
className: 'DGN-UI-Modal-Body ' + className,
|
|
47
|
-
...props,
|
|
21
|
+
id,
|
|
22
|
+
style
|
|
23
|
+
}, reference) => {
|
|
24
|
+
const ref = useRef(null);
|
|
25
|
+
useImperativeHandle(reference, () => {
|
|
26
|
+
const currentRef = ref.current || {};
|
|
27
|
+
const _instance = {}; // methods
|
|
28
|
+
|
|
29
|
+
_instance.__proto__ = {}; // hidden methods
|
|
30
|
+
|
|
31
|
+
currentRef.instance = _instance;
|
|
32
|
+
return currentRef;
|
|
33
|
+
});
|
|
34
|
+
return useMemo(() => jsx("div", {
|
|
35
|
+
css: ModalBodyCSS,
|
|
36
|
+
id: id,
|
|
37
|
+
className: ['DGN-UI-Modal-Body', className].join(' ').trim().replace(/\s+/g, ' '),
|
|
48
38
|
style: style,
|
|
49
39
|
ref: ref
|
|
50
|
-
}, children), [children, style]);
|
|
51
|
-
return Body;
|
|
40
|
+
}, children), [children, className, id, style]);
|
|
52
41
|
}));
|
|
42
|
+
const ModalBodyCSS = css`
|
|
43
|
+
${displayBlock};
|
|
44
|
+
${positionRelative};
|
|
45
|
+
${borderBox};
|
|
46
|
+
${overflowAuto};
|
|
47
|
+
width: 100%;
|
|
48
|
+
height: auto;
|
|
49
|
+
padding: ${spacing([2, 4])};
|
|
50
|
+
order: 2;
|
|
51
|
+
&::-webkit-scrollbar {
|
|
52
|
+
width: 24px;
|
|
53
|
+
}
|
|
54
|
+
&::-webkit-scrollbar-thumb {
|
|
55
|
+
border-radius: 10px;
|
|
56
|
+
mix-blend-mode: normal;
|
|
57
|
+
background-color: ${scrollbarRest};
|
|
58
|
+
background-clip: content-box;
|
|
59
|
+
border: 8px solid transparent;
|
|
60
|
+
:hover {
|
|
61
|
+
background-color: ${scrollbarActive};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
53
65
|
ModalBody.defaultProps = {
|
|
54
|
-
className: ''
|
|
66
|
+
className: '',
|
|
67
|
+
style: {}
|
|
55
68
|
};
|
|
56
69
|
ModalBody.propTypes = {
|
|
57
|
-
/**
|
|
58
|
-
|
|
70
|
+
/** The content of the component. */
|
|
71
|
+
children: PropTypes.node,
|
|
59
72
|
|
|
60
|
-
/**
|
|
73
|
+
/** Class for component. */
|
|
61
74
|
className: PropTypes.string,
|
|
62
75
|
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
/** child content in header (like title) */
|
|
67
|
-
children: PropTypes.node
|
|
76
|
+
/** Style inline of component. */
|
|
77
|
+
style: PropTypes.object
|
|
68
78
|
};
|
|
69
79
|
export default ModalBody;
|
|
@@ -1,61 +1,63 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import { memo, useMemo,
|
|
4
|
+
import { memo, useMemo, useRef, forwardRef, useImperativeHandle } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { jsx, css } from '@emotion/core';
|
|
7
|
+
import { alignCenter, borderBox, flexRow, justifyEnd, positionRelative } from '../../styles/general';
|
|
8
|
+
import theme from '../../theme/settings';
|
|
9
|
+
const {
|
|
10
|
+
spacing
|
|
11
|
+
} = theme;
|
|
7
12
|
const ModalFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
8
13
|
children,
|
|
9
14
|
className,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
id,
|
|
16
|
+
style
|
|
17
|
+
}, reference) => {
|
|
18
|
+
const ref = useRef(null);
|
|
19
|
+
useImperativeHandle(reference, () => {
|
|
20
|
+
const currentRef = ref.current || {};
|
|
21
|
+
const _instance = {}; // methods
|
|
17
22
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
border-radius: 0px 0px 4px 4px;
|
|
28
|
-
box-sizing: border-box;
|
|
29
|
-
/* box-shadow: inset 0px 2px 2px rgba(0, 0, 0, 0.25); */
|
|
30
|
-
box-shadow: 0px -1px 1px rgba(0, 0, 0, 0.25);
|
|
31
|
-
order: 3;
|
|
32
|
-
`;
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
!!refs && refs(ref);
|
|
35
|
-
}, []);
|
|
36
|
-
const Footer = useMemo(() => jsx("div", {
|
|
37
|
-
css: ModalFooterBox,
|
|
38
|
-
className: 'DGN-UI-Modal-Footer ' + className,
|
|
39
|
-
...props,
|
|
23
|
+
_instance.__proto__ = {}; // hidden methods
|
|
24
|
+
|
|
25
|
+
currentRef.instance = _instance;
|
|
26
|
+
return currentRef;
|
|
27
|
+
});
|
|
28
|
+
return useMemo(() => jsx("div", {
|
|
29
|
+
css: ModalFooterCSS,
|
|
30
|
+
id: id,
|
|
31
|
+
className: ['DGN-UI-Modal-Footer', className].join(' ').trim().replace(/\s+/g, ' '),
|
|
40
32
|
style: style,
|
|
41
33
|
ref: ref
|
|
42
|
-
}, children), [children, style]);
|
|
43
|
-
return Footer;
|
|
34
|
+
}, children), [children, className, id, style]);
|
|
44
35
|
}));
|
|
36
|
+
const ModalFooterCSS = css`
|
|
37
|
+
${flexRow};
|
|
38
|
+
${positionRelative};
|
|
39
|
+
${alignCenter};
|
|
40
|
+
${justifyEnd};
|
|
41
|
+
${borderBox};
|
|
42
|
+
width: 100%;
|
|
43
|
+
min-height: 56px;
|
|
44
|
+
padding: ${spacing([4, 6])};
|
|
45
|
+
border-radius: 0px 0px 4px 4px;
|
|
46
|
+
box-shadow: 0px -1px 1px rgba(0, 0, 0, 0.25);
|
|
47
|
+
order: 3;
|
|
48
|
+
`;
|
|
45
49
|
ModalFooter.defaultProps = {
|
|
46
|
-
className: ''
|
|
50
|
+
className: '',
|
|
51
|
+
style: {}
|
|
47
52
|
};
|
|
48
53
|
ModalFooter.propTypes = {
|
|
49
|
-
/**
|
|
50
|
-
|
|
54
|
+
/** The content of the component. */
|
|
55
|
+
children: PropTypes.node,
|
|
51
56
|
|
|
52
|
-
/**
|
|
57
|
+
/** Class for component. */
|
|
53
58
|
className: PropTypes.string,
|
|
54
59
|
|
|
55
|
-
/**
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
/** child content in header (like title) */
|
|
59
|
-
children: PropTypes.node
|
|
60
|
+
/** Style inline of component. */
|
|
61
|
+
style: PropTypes.object
|
|
60
62
|
};
|
|
61
63
|
export default ModalFooter;
|
|
@@ -7,13 +7,17 @@ import { jsx, css } from '@emotion/core';
|
|
|
7
7
|
import ModalContext from './context';
|
|
8
8
|
import { ButtonIcon, Typography } from '../';
|
|
9
9
|
import { alignCenter, borderBox, flexRow, justifyBetween, positionRelative } from '../../styles/general';
|
|
10
|
-
import
|
|
10
|
+
import theme from '../../theme/settings';
|
|
11
11
|
const {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
12
|
+
colors: {
|
|
13
|
+
fill: {
|
|
14
|
+
headerbar
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
spacing
|
|
18
|
+
} = theme;
|
|
16
19
|
const ModalHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
20
|
+
id,
|
|
17
21
|
title,
|
|
18
22
|
className,
|
|
19
23
|
children,
|
|
@@ -36,6 +40,7 @@ const ModalHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
36
40
|
});
|
|
37
41
|
return useMemo(() => jsx("div", {
|
|
38
42
|
css: _ModalHeaderCSS,
|
|
43
|
+
id: id,
|
|
39
44
|
className: ['DGN-UI-Modal-Header', className].join(' ').trim().replace(/\s+/g, ' '),
|
|
40
45
|
style: style,
|
|
41
46
|
onMouseDown: modal.onMoveModal,
|
|
@@ -52,10 +57,10 @@ const ModalHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
52
57
|
viewType: 'ghost',
|
|
53
58
|
name: 'Close',
|
|
54
59
|
style: {
|
|
55
|
-
marginLeft:
|
|
60
|
+
marginLeft: spacing(4)
|
|
56
61
|
},
|
|
57
62
|
onClick: modal.close
|
|
58
|
-
})), [children,
|
|
63
|
+
})), [children, className, id, showClose, style, title]);
|
|
59
64
|
}));
|
|
60
65
|
|
|
61
66
|
const ModalHeaderCSS = modal => css`
|
|
@@ -67,8 +72,7 @@ const ModalHeaderCSS = modal => css`
|
|
|
67
72
|
background-color: ${headerbar};
|
|
68
73
|
width: 100%;
|
|
69
74
|
height: 56px;
|
|
70
|
-
padding:
|
|
71
|
-
margin-bottom: 2px;
|
|
75
|
+
padding: ${spacing([4, 6])};
|
|
72
76
|
border-radius: 4px 4px 0px 0px;
|
|
73
77
|
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.25);
|
|
74
78
|
cursor: ${modal.onMoveModal ? 'move' : 'inherit'};
|
|
@@ -82,19 +86,19 @@ ModalHeader.defaultProps = {
|
|
|
82
86
|
showClose: true
|
|
83
87
|
};
|
|
84
88
|
ModalHeader.propTypes = {
|
|
85
|
-
/**
|
|
86
|
-
|
|
89
|
+
/** The content of the component. */
|
|
90
|
+
children: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
87
91
|
|
|
88
|
-
/**
|
|
92
|
+
/** Class for component. */
|
|
89
93
|
className: PropTypes.string,
|
|
90
94
|
|
|
91
|
-
/**
|
|
92
|
-
|
|
95
|
+
/** If `true`, button close is shown. */
|
|
96
|
+
showClose: PropTypes.bool,
|
|
93
97
|
|
|
94
|
-
/**
|
|
95
|
-
|
|
98
|
+
/** Style inline of component. */
|
|
99
|
+
style: PropTypes.object,
|
|
96
100
|
|
|
97
|
-
/**
|
|
98
|
-
|
|
101
|
+
/** The content of the component if not have prop `children`. */
|
|
102
|
+
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
|
|
99
103
|
};
|
|
100
104
|
export default ModalHeader;
|
|
@@ -5,25 +5,26 @@ import { memo, useState, useRef, forwardRef, useEffect, useMemo, useImperativeHa
|
|
|
5
5
|
import { createPortal } from 'react-dom';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { jsx, css } from '@emotion/core';
|
|
8
|
+
import useDelayUnmount from '../../utils/useDelayUnmount';
|
|
8
9
|
import ModalContext from './context';
|
|
9
10
|
import { animations } from '../../styles/animation';
|
|
10
|
-
import { typography } from '../../styles/typography';
|
|
11
11
|
import { borderBox, borderRadius4px, flexCol, flexRow, justifyCenter, parseWidth, positionFixed, positionRelative } from '../../styles/general';
|
|
12
|
-
import
|
|
13
|
-
const {
|
|
14
|
-
paragraph1
|
|
15
|
-
} = typography;
|
|
16
|
-
const {
|
|
17
|
-
system: {
|
|
18
|
-
white
|
|
19
|
-
}
|
|
20
|
-
} = colors;
|
|
21
|
-
const fadeInDown = animations.fadeInDown;
|
|
22
|
-
import { useTheme } from '../../theme';
|
|
12
|
+
import theme from '../../theme/settings';
|
|
23
13
|
const {
|
|
14
|
+
colors: {
|
|
15
|
+
system: {
|
|
16
|
+
white
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
typography: {
|
|
20
|
+
paragraph1
|
|
21
|
+
},
|
|
24
22
|
zIndex: zIndexCORE
|
|
25
|
-
} =
|
|
23
|
+
} = theme;
|
|
24
|
+
const fadeInDown = animations.fadeInDown;
|
|
25
|
+
const fadeOutUp = animations.fadeOutUp;
|
|
26
26
|
const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
27
|
+
id,
|
|
27
28
|
open,
|
|
28
29
|
moveable,
|
|
29
30
|
dragAnyWhere,
|
|
@@ -40,8 +41,10 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
40
41
|
className
|
|
41
42
|
}, reference) => {
|
|
42
43
|
const ref = useRef(null);
|
|
44
|
+
const overflow = useRef(null);
|
|
43
45
|
const modalBoxRef = useRef(null);
|
|
44
46
|
const [openState, setOpenState] = useState(open);
|
|
47
|
+
const showModal = useDelayUnmount(openState, 200);
|
|
45
48
|
|
|
46
49
|
const _ModalContainerCSS = ModalContainerCSS(zIndex, alignment, darkTheme);
|
|
47
50
|
|
|
@@ -52,12 +55,10 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
52
55
|
};
|
|
53
56
|
|
|
54
57
|
const onCloseModal = () => {
|
|
58
|
+
document.body.style.overflow = overflow.current; // reset overflow of <body /> before open modal
|
|
59
|
+
|
|
55
60
|
onClose && onClose();
|
|
56
61
|
setOpenState(false);
|
|
57
|
-
|
|
58
|
-
if (pressESCToClose) {
|
|
59
|
-
document.removeEventListener('keydown', pressESCHandler);
|
|
60
|
-
}
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
const pressESCHandler = event => {
|
|
@@ -127,6 +128,11 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
127
128
|
};
|
|
128
129
|
};
|
|
129
130
|
|
|
131
|
+
useEffect(() => {
|
|
132
|
+
return () => {
|
|
133
|
+
document.body.style.overflow = overflow.current; // reset overflow of <body /> before open modal
|
|
134
|
+
};
|
|
135
|
+
}, []);
|
|
130
136
|
useEffect(() => {
|
|
131
137
|
setOpenState(open);
|
|
132
138
|
}, [open]);
|
|
@@ -147,13 +153,21 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
147
153
|
}
|
|
148
154
|
}
|
|
149
155
|
|
|
150
|
-
document.
|
|
156
|
+
overflow.current = document.body.style.overflow; // overflow of <body /> before open modal
|
|
157
|
+
|
|
158
|
+
document.body.style.overflow = 'hidden'; // Allow press ESC to close popup
|
|
151
159
|
|
|
152
160
|
if (pressESCToClose) {
|
|
153
161
|
document.addEventListener('keydown', pressESCHandler);
|
|
154
162
|
}
|
|
155
|
-
|
|
156
|
-
|
|
163
|
+
|
|
164
|
+
return () => {
|
|
165
|
+
document.body.style.overflow = overflow.current; // reset overflow of <body /> before open modal
|
|
166
|
+
|
|
167
|
+
if (pressESCToClose) {
|
|
168
|
+
document.removeEventListener('keydown', pressESCHandler);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
157
171
|
}
|
|
158
172
|
}, [openState]);
|
|
159
173
|
useImperativeHandle(reference, () => {
|
|
@@ -166,7 +180,7 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
166
180
|
return currentRef;
|
|
167
181
|
});
|
|
168
182
|
return useMemo(() => {
|
|
169
|
-
if (
|
|
183
|
+
if (showModal) {
|
|
170
184
|
const node = jsx("div", {
|
|
171
185
|
className: 'DGN-UI-Portal DGN-UI-Modal',
|
|
172
186
|
style: {
|
|
@@ -175,6 +189,7 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
175
189
|
inset: 0
|
|
176
190
|
}
|
|
177
191
|
}, jsx("div", {
|
|
192
|
+
id: id,
|
|
178
193
|
css: _ModalContainerCSS,
|
|
179
194
|
className: 'DGN-UI-Modal-Container',
|
|
180
195
|
ref: ref
|
|
@@ -182,7 +197,7 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
182
197
|
css: _ModalBoxCSS,
|
|
183
198
|
ref: modalBoxRef,
|
|
184
199
|
onMouseDown: moveable && dragAnyWhere ? dragMouseDown : null,
|
|
185
|
-
className: [
|
|
200
|
+
className: [`DGN-UI-Modal-Box ${openState ? 'DGN-UI-Modal-Show' : 'DGN-UI-Modal-Hide'}`, className].join(' ').trim().replace(/\s+/g, ' '),
|
|
186
201
|
style: style
|
|
187
202
|
}, jsx(ModalContext.Provider, {
|
|
188
203
|
value: {
|
|
@@ -195,7 +210,7 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
195
210
|
}
|
|
196
211
|
|
|
197
212
|
return null;
|
|
198
|
-
}, [moveable, dragAnyWhere, style, className, children, openState]);
|
|
213
|
+
}, [id, moveable, dragAnyWhere, style, className, children, openState, showModal]);
|
|
199
214
|
}));
|
|
200
215
|
|
|
201
216
|
const ModalContainerCSS = (zIndex, alignment, darkTheme) => css`
|
|
@@ -231,6 +246,13 @@ const ModalBoxCSS = (width, moveable, dragAnyWhere) => css`
|
|
|
231
246
|
-webkit-box-direction: normal;
|
|
232
247
|
animation: ${fadeInDown} 0.2s ease;
|
|
233
248
|
animation-fill-mode: forwards;
|
|
249
|
+
&.DGN-UI-Modal-Show {
|
|
250
|
+
animation: ${fadeInDown} 0.2s ease;
|
|
251
|
+
}
|
|
252
|
+
&.DGN-UI-Modal-Hide {
|
|
253
|
+
animation: ${fadeOutUp} 0.3s ease;
|
|
254
|
+
animation-fill-mode: forwards;
|
|
255
|
+
}
|
|
234
256
|
`;
|
|
235
257
|
|
|
236
258
|
Modal.defaultProps = {
|
|
@@ -248,46 +270,46 @@ Modal.defaultProps = {
|
|
|
248
270
|
className: ''
|
|
249
271
|
};
|
|
250
272
|
Modal.propTypes = {
|
|
251
|
-
/**
|
|
273
|
+
/** The component alignment. */
|
|
252
274
|
alignment: PropTypes.oneOf(['top', 'center']),
|
|
253
275
|
|
|
254
|
-
/**
|
|
255
|
-
|
|
276
|
+
/** If `true`, focus when component is shown. */
|
|
277
|
+
autoFocus: PropTypes.bool,
|
|
256
278
|
|
|
257
|
-
/**
|
|
258
|
-
|
|
279
|
+
/** The content of the component. */
|
|
280
|
+
children: PropTypes.node,
|
|
259
281
|
|
|
260
|
-
/**
|
|
261
|
-
|
|
282
|
+
/** Class for component. */
|
|
283
|
+
className: PropTypes.string,
|
|
262
284
|
|
|
263
|
-
/**
|
|
264
|
-
|
|
285
|
+
/** If `true`, dark backdrop when component is shown. */
|
|
286
|
+
darkTheme: PropTypes.bool,
|
|
265
287
|
|
|
266
|
-
/** allow
|
|
288
|
+
/** If `true`, allow drag the component at any position. */
|
|
267
289
|
dragAnyWhere: PropTypes.bool,
|
|
268
290
|
|
|
269
|
-
/**
|
|
291
|
+
/** If `true`, allow move the component by drag and move. */
|
|
292
|
+
moveable: PropTypes.bool,
|
|
293
|
+
|
|
294
|
+
/** If `true`, allows drag the component out of the screen. */
|
|
270
295
|
moveOutScreen: PropTypes.bool,
|
|
271
296
|
|
|
272
|
-
/**
|
|
273
|
-
|
|
297
|
+
/** Callback fired when the component requests to be closed. */
|
|
298
|
+
onClose: PropTypes.func,
|
|
274
299
|
|
|
275
|
-
/**
|
|
276
|
-
|
|
300
|
+
/** If `true`, the component is shown. */
|
|
301
|
+
open: PropTypes.bool,
|
|
277
302
|
|
|
278
|
-
/**
|
|
279
|
-
|
|
303
|
+
/** If `true`, hitting escape will close component. */
|
|
304
|
+
pressESCToClose: PropTypes.bool,
|
|
280
305
|
|
|
281
|
-
/**
|
|
306
|
+
/** Style inline of component. */
|
|
282
307
|
style: PropTypes.object,
|
|
283
308
|
|
|
284
|
-
/**
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
/** the function to run when close modal */
|
|
288
|
-
onClose: PropTypes.func,
|
|
309
|
+
/** Width of the component. */
|
|
310
|
+
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
289
311
|
|
|
290
|
-
/**
|
|
291
|
-
|
|
312
|
+
/** The z-index of component. */
|
|
313
|
+
zIndex: PropTypes.number
|
|
292
314
|
};
|
|
293
315
|
export default Modal;
|