diginet-core-ui 1.3.78 → 1.3.79
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 +2 -6
- package/components/accordion/group.js +2 -9
- package/components/accordion/index.js +2 -15
- package/components/accordion/summary.js +4 -27
- package/components/alert/index.js +98 -137
- package/components/alert/notify.js +97 -166
- package/components/avatar/index.js +4 -63
- package/components/badge/index.js +7 -34
- package/components/button/icon.js +120 -186
- package/components/button/index.js +136 -205
- package/components/button/more.js +0 -12
- package/components/button/ripple-effect.js +46 -44
- package/components/card/body.js +2 -7
- package/components/card/extra.js +2 -7
- package/components/card/footer.js +2 -7
- package/components/card/header.js +2 -7
- package/components/card/index.js +2 -22
- package/components/chart/Pie/Circle.js +0 -1
- package/components/chart/Pie/Sector.js +0 -17
- package/components/chart/Pie/Sectors.js +0 -10
- package/components/chart/Pie/index.js +4 -36
- package/components/chart/Pie-v2/Circle.js +0 -1
- package/components/chart/Pie-v2/Sector.js +0 -13
- package/components/chart/Pie-v2/Sectors.js +0 -20
- package/components/chart/Pie-v2/index.js +11 -38
- package/components/chart/bar/Axis.js +0 -12
- package/components/chart/bar/Bar.js +13 -35
- package/components/chart/bar/Grid.js +0 -18
- package/components/chart/bar/Labels.js +0 -18
- package/components/chart/bar/Points.js +0 -17
- package/components/chart/bar/index.js +6 -26
- package/components/chart/bar-v2/Axis.js +0 -12
- package/components/chart/bar-v2/Bar.js +15 -36
- package/components/chart/bar-v2/Grid.js +0 -18
- package/components/chart/bar-v2/Labels.js +0 -18
- package/components/chart/bar-v2/Points.js +0 -17
- package/components/chart/bar-v2/index.js +6 -26
- package/components/chart/line/Axis.js +4 -16
- package/components/chart/line/Grid.js +2 -19
- package/components/chart/line/Labels.js +0 -18
- package/components/chart/line/Path.js +23 -33
- package/components/chart/line/Point.js +6 -40
- package/components/chart/line/Title.js +0 -3
- package/components/chart/line/index.js +12 -35
- package/components/chart/line-v2/Axis.js +0 -13
- package/components/chart/line-v2/Grid.js +0 -18
- package/components/chart/line-v2/Labels.js +0 -18
- package/components/chart/line-v2/Path.js +23 -33
- package/components/chart/line-v2/Point.js +6 -35
- package/components/chart/line-v2/Title.js +0 -3
- package/components/chart/line-v2/index.js +12 -30
- package/components/check-text/index.js +0 -8
- package/components/check-text/interview-confirmation.js +0 -7
- package/components/check-text/interview-status.js +0 -7
- package/components/chip/attach.js +4 -17
- package/components/chip/index.js +6 -33
- package/components/collapse/index.js +0 -13
- package/components/divider/index.js +0 -8
- package/components/form-control/attachment/index.js +24 -202
- package/components/form-control/calendar/function.js +40 -94
- package/components/form-control/calendar/index.js +5 -30
- package/components/form-control/calendar/range.js +11 -28
- package/components/form-control/checkbox/index.js +4 -37
- package/components/form-control/control/index.js +3 -13
- package/components/form-control/date-picker/index-old.js +18 -0
- package/components/form-control/date-picker/index.js +23 -99
- package/components/form-control/date-range-picker/index.js +86 -221
- package/components/form-control/dropdown/index.js +72 -289
- package/components/form-control/dropdown-box/index.js +6 -35
- package/components/form-control/form/index.js +0 -2
- package/components/form-control/form-group/index.js +1 -6
- package/components/form-control/helper-text/index.js +2 -9
- package/components/form-control/input-base/index.js +218 -399
- package/components/form-control/label/index.js +2 -12
- package/components/form-control/money-input/index.js +43 -132
- package/components/form-control/number-input/index.js +15 -113
- package/components/form-control/number-input/index2.js +78 -119
- package/components/form-control/phone-input/index.js +16 -78
- package/components/form-control/radio/index.js +4 -23
- package/components/form-control/text-input/index.js +33 -256
- package/components/form-control/time-picker/index.js +14 -71
- package/components/form-control/time-picker/swiper.js +21 -73
- package/components/form-control/toggle/index.js +4 -19
- package/components/form-view/helper-text.js +2 -2
- package/components/form-view/index.js +0 -14
- package/components/form-view/input.js +2 -13
- package/components/form-view/label.js +0 -2
- package/components/grid/Col.js +2 -15
- package/components/grid/Container.js +2 -21
- package/components/grid/Row.js +2 -21
- package/components/grid/index.js +2 -43
- package/components/image/index.js +2 -22
- package/components/index.js +62 -31
- package/components/list/list-item-action.js +0 -9
- package/components/list/list-item-icon.js +0 -9
- package/components/list/list-item-text.js +0 -5
- package/components/list/list-item.js +0 -11
- package/components/list/list.js +0 -13
- package/components/list/sub-header.js +0 -4
- package/components/modal/body.js +2 -6
- package/components/modal/footer.js +2 -11
- package/components/modal/header.js +2 -12
- package/components/modal/index.js +2 -10
- package/components/modal/modal.js +11 -52
- package/components/others/extra/index.js +3 -10
- package/components/others/import/index.js +0 -7
- package/components/others/option-wrapper/index.js +4 -7
- package/components/others/scrollbar/index.js +0 -3
- package/components/paging/page-info.js +39 -101
- package/components/paging/page-selector.js +7 -35
- package/components/paging/page-selector2.js +35 -74
- package/components/paper/index.js +0 -11
- package/components/popover/body.js +2 -6
- package/components/popover/footer.js +2 -11
- package/components/popover/header.js +2 -7
- package/components/popover/index.js +39 -123
- package/components/popup/danger_popup.js +0 -19
- package/components/popup/index.js +2 -48
- package/components/popup/proposals_popup.js +10 -49
- package/components/popup/v2/index.js +0 -31
- package/components/progress/circular.js +19 -81
- package/components/progress/linear.js +4 -20
- package/components/rating/index.js +0 -24
- package/components/slider/slider-container.js +3 -40
- package/components/slider/slider-item.js +10 -25
- package/components/status/index.js +2 -16
- package/components/tab/tab-container.js +2 -16
- package/components/tab/tab-header.js +4 -24
- package/components/tab/tab-panel.js +4 -16
- package/components/tab/tab.js +4 -28
- package/components/tooltip/index.js +12 -97
- package/components/tooltip/portal.js +0 -2
- package/components/transfer/index.js +22 -67
- package/components/tree-view/index.js +62 -202
- package/components/typography/index.js +3 -31
- package/global/index.js +0 -8
- package/icons/basic.js +0 -48
- package/icons/effect.js +17 -29
- package/icons/general/clock/clock.js +0 -2
- package/icons/general/color-handler/background.js +0 -2
- package/icons/general/color-handler/text.js +0 -2
- package/icons/general/emoji/emoji.js +0 -2
- package/icons/general/font-properties/bold.js +0 -2
- package/icons/general/font-properties/font-family.js +0 -2
- package/icons/general/font-properties/font-size.js +0 -2
- package/icons/general/font-properties/italic.js +0 -2
- package/icons/general/font-properties/underline.js +0 -2
- package/icons/general/hyperlink/hyperlink.js +0 -2
- package/icons/general/indent/decrease.js +0 -2
- package/icons/general/indent/increase.js +0 -2
- package/icons/general/list/bullets.js +0 -2
- package/icons/general/list/numbering.js +0 -2
- package/icons/general/picture/picture.js +0 -2
- package/icons/general/steps/redo.js +0 -2
- package/icons/general/steps/undo.js +0 -2
- package/icons/general/text-align/center.js +0 -2
- package/icons/general/text-align/justify.js +0 -2
- package/icons/general/text-align/left.js +0 -2
- package/icons/general/text-align/right.js +0 -2
- package/icons/menu/dhr.js +2 -1
- package/icons/menu/index.js +2 -2
- package/icons/menu/v2/index.js +0 -10
- package/package.json +1 -1
- package/readme.md +11 -1
- package/styles/animation.js +15 -58
- package/styles/color-helper.js +24 -54
- package/styles/colors.js +17 -9
- package/styles/general.js +6 -2
- package/styles/typography.js +4 -4
- package/styles/utils.js +2 -2
- package/theme/createBreakpoints.js +7 -18
- package/theme/make-styles.js +2 -5
- package/theme/set-theme.js +3 -6
- package/theme/settings.js +3 -2
- package/theme/theme-provider.js +0 -1
- package/utils/array/array.js +14 -23
- package/utils/classNames.js +0 -5
- package/utils/console.js +0 -6
- package/utils/date.js +13 -82
- package/utils/error/error.js +1 -9
- package/utils/error/errors.js +1 -48
- package/utils/getFileType.js +0 -9
- package/utils/handleBreakpoints.js +0 -5
- package/utils/intersectionObserver.js +0 -5
- package/utils/iterator.js +0 -9
- package/utils/map-parent.js +3 -10
- package/utils/object/extend.js +0 -10
- package/utils/object/object.js +12 -11
- package/utils/parseHTML.js +0 -1
- package/utils/promisify.js +0 -5
- package/utils/randomString.js +0 -7
- package/utils/remove-unicode.js +0 -1
- package/utils/render-portal.js +1 -9
- package/utils/renderHTML.js +4 -6
- package/utils/renderIcon.js +4 -14
- package/utils/sb-template.js +6 -5
- package/utils/string/capitalize.js +0 -1
- package/utils/string/capitalizeSentenceCase.js +0 -2
- package/utils/string/string.js +0 -13
- package/utils/type.js +0 -21
- package/utils/updatePosition.js +4 -5
- package/utils/useDelayUnmount.js +0 -4
- package/utils/useElementSize.js +9 -3
- package/utils/useEventListener.js +12 -6
- package/utils/useInput.js +0 -6
- package/utils/useMediaQuery.js +8 -10
- package/utils/useOnClickOutside.js +0 -2
- package/utils/usePortal.js +3 -10
- package/utils/validate.js +6 -20
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { Fragment, memo, useMemo, useRef, useState } from 'react';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
@@ -43,10 +42,8 @@ const AttachChip = /*#__PURE__*/memo(({
|
|
|
43
42
|
display: flex;
|
|
44
43
|
}
|
|
45
44
|
`;
|
|
46
|
-
|
|
47
45
|
const getStartIcon = () => {
|
|
48
46
|
var _file$FileName;
|
|
49
|
-
|
|
50
47
|
const lastIndexOfDot = (_file$FileName = file.FileName) === null || _file$FileName === void 0 ? void 0 : _file$FileName.lastIndexOf('.');
|
|
51
48
|
if (!lastIndexOfDot) return null;
|
|
52
49
|
const fileExt = file.FileName.slice(lastIndexOfDot + 1);
|
|
@@ -58,19 +55,16 @@ const AttachChip = /*#__PURE__*/memo(({
|
|
|
58
55
|
viewBox: true
|
|
59
56
|
});
|
|
60
57
|
};
|
|
61
|
-
|
|
62
58
|
const clickOutAction = event => {
|
|
63
59
|
if (!moreActionRef.current) {
|
|
64
60
|
document.removeEventListener('click', clickOutAction);
|
|
65
61
|
return;
|
|
66
62
|
}
|
|
67
|
-
|
|
68
63
|
if (!moreActionRef.current.contains(event.target)) {
|
|
69
64
|
moreActionRef.current.classList.remove('DGN-UI-Chip-show');
|
|
70
65
|
document.removeEventListener('click', clickOutAction);
|
|
71
66
|
}
|
|
72
67
|
};
|
|
73
|
-
|
|
74
68
|
const onShowMoreOption = () => {
|
|
75
69
|
if (!moreActionRef.current.classList.contains('DGN-UI-Chip-show')) {
|
|
76
70
|
moreActionRef.current.classList.add('DGN-UI-Chip-show');
|
|
@@ -79,7 +73,6 @@ const AttachChip = /*#__PURE__*/memo(({
|
|
|
79
73
|
}, 100);
|
|
80
74
|
}
|
|
81
75
|
};
|
|
82
|
-
|
|
83
76
|
const viewAction = (e, file) => {
|
|
84
77
|
if (onView) {
|
|
85
78
|
onView(e, file);
|
|
@@ -87,15 +80,14 @@ const AttachChip = /*#__PURE__*/memo(({
|
|
|
87
80
|
setOpen(true);
|
|
88
81
|
}
|
|
89
82
|
};
|
|
90
|
-
|
|
91
83
|
const downloadAction = (e, file = {}) => {
|
|
92
84
|
if (onDownload) onDownload(e, file);else if (file.URL) {
|
|
93
85
|
fetch(file.URL).then(resp => resp.blob()).then(blob => {
|
|
94
86
|
const url = window.URL.createObjectURL(blob);
|
|
95
87
|
const a = document.createElement('a');
|
|
96
88
|
a.style.display = 'none';
|
|
97
|
-
a.href = url;
|
|
98
|
-
|
|
89
|
+
a.href = url;
|
|
90
|
+
// the filename you want
|
|
99
91
|
a.download = file.FileName;
|
|
100
92
|
document.body.appendChild(a);
|
|
101
93
|
a.click();
|
|
@@ -103,22 +95,18 @@ const AttachChip = /*#__PURE__*/memo(({
|
|
|
103
95
|
}).catch(() => alert('File not found'));
|
|
104
96
|
}
|
|
105
97
|
};
|
|
106
|
-
|
|
107
98
|
const deleteAction = (e, file) => {
|
|
108
99
|
if (onRemove) onRemove(e, file);
|
|
109
100
|
setTimeout(() => {
|
|
110
101
|
if (moreActionRef.current && moreActionRef.current.parentNode) moreActionRef.current.parentNode.remove();
|
|
111
102
|
}, 0);
|
|
112
103
|
};
|
|
113
|
-
|
|
114
104
|
const renderLabel = label => {
|
|
115
105
|
if (maxLength && label && label.length > maxLength) {
|
|
116
106
|
label = label.slice(0, maxLength) + '...';
|
|
117
107
|
}
|
|
118
|
-
|
|
119
108
|
return label;
|
|
120
109
|
};
|
|
121
|
-
|
|
122
110
|
const attachView = useMemo(() => {
|
|
123
111
|
return jsx(ModalSample, {
|
|
124
112
|
open: open,
|
|
@@ -128,7 +116,8 @@ const AttachChip = /*#__PURE__*/memo(({
|
|
|
128
116
|
url: file.URL
|
|
129
117
|
})));
|
|
130
118
|
}, [open]);
|
|
131
|
-
return jsx(Fragment, null, jsx(Chip, {
|
|
119
|
+
return jsx(Fragment, null, jsx(Chip, {
|
|
120
|
+
...props,
|
|
132
121
|
clearAble: false,
|
|
133
122
|
label: renderLabel(file.FileName),
|
|
134
123
|
startIcon: getStartIcon(),
|
|
@@ -166,10 +155,8 @@ AttachChip.propTypes = {
|
|
|
166
155
|
URL: PropTypes.string.isRequired,
|
|
167
156
|
FileName: PropTypes.string.isRequired
|
|
168
157
|
}).isRequired,
|
|
169
|
-
|
|
170
158
|
/** max length content to display was allowed */
|
|
171
159
|
maxLength: PropTypes.number,
|
|
172
|
-
|
|
173
160
|
/** any props else of Chip component */
|
|
174
161
|
props: PropTypes.any
|
|
175
162
|
};
|
package/components/chip/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { memo, useRef, forwardRef, useMemo, useImperativeHandle } from 'react';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
@@ -70,30 +69,25 @@ const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
70
69
|
useImperativeHandle(reference, () => {
|
|
71
70
|
const currentRef = ref.current || {};
|
|
72
71
|
const _instance = {}; // methods
|
|
73
|
-
|
|
74
72
|
_instance.__proto__ = {}; // hidden methods
|
|
75
|
-
|
|
76
73
|
currentRef.instance = _instance;
|
|
77
74
|
return currentRef;
|
|
78
75
|
});
|
|
79
|
-
|
|
80
76
|
const onRemoveHandler = () => {
|
|
81
77
|
if (onRemove || disabled) onRemove(ref.current);
|
|
82
78
|
};
|
|
83
|
-
|
|
84
79
|
const _onClick = event => {
|
|
85
80
|
onClick && event.stopPropagation();
|
|
86
81
|
if (disabled) return;
|
|
87
82
|
onClick && onClick(event);
|
|
88
83
|
};
|
|
89
|
-
|
|
90
84
|
const _onDbClick = event => {
|
|
91
85
|
onDbClick && event.stopPropagation();
|
|
92
86
|
if (disabled) return;
|
|
93
87
|
onDbClick && onDbClick(event);
|
|
94
|
-
};
|
|
95
|
-
|
|
88
|
+
};
|
|
96
89
|
|
|
90
|
+
// Start Icon
|
|
97
91
|
const startIconView = useMemo(() => {
|
|
98
92
|
if (typeof startIcon === 'string') {
|
|
99
93
|
return jsx(Icon, {
|
|
@@ -105,8 +99,9 @@ const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
105
99
|
} else return jsx("div", {
|
|
106
100
|
css: ChipIconCSS(infoChip)
|
|
107
101
|
}, startIcon);
|
|
108
|
-
}, [startIcon, size]);
|
|
102
|
+
}, [startIcon, size]);
|
|
109
103
|
|
|
104
|
+
// Label
|
|
110
105
|
const labelView = useMemo(() => {
|
|
111
106
|
return jsx(Typography, {
|
|
112
107
|
css: ChipLabelCSS,
|
|
@@ -115,11 +110,11 @@ const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
115
110
|
lineClamp: 1,
|
|
116
111
|
...labelProps
|
|
117
112
|
}, label);
|
|
118
|
-
}, [label, size, startIcon, endIcon, clearAble]);
|
|
113
|
+
}, [label, size, startIcon, endIcon, clearAble]);
|
|
119
114
|
|
|
115
|
+
// End Icon
|
|
120
116
|
const endIconView = useMemo(() => {
|
|
121
117
|
let node = endIcon;
|
|
122
|
-
|
|
123
118
|
if (typeof node === 'string') {
|
|
124
119
|
return jsx(Icon, {
|
|
125
120
|
name: node,
|
|
@@ -129,7 +124,6 @@ const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
129
124
|
viewBox: true
|
|
130
125
|
});
|
|
131
126
|
}
|
|
132
|
-
|
|
133
127
|
return clearAble ? jsx(ButtonIcon, {
|
|
134
128
|
ref: IconRef,
|
|
135
129
|
className: 'end-icon',
|
|
@@ -162,7 +156,6 @@ const ChipLabelCSS = css`
|
|
|
162
156
|
${positionRelative};
|
|
163
157
|
${userSelectNone};
|
|
164
158
|
`;
|
|
165
|
-
|
|
166
159
|
const ChipRootCSS = (onClick, onDbClick, colorProps, info) => css`
|
|
167
160
|
${inlineFlex};
|
|
168
161
|
${alignCenter};
|
|
@@ -225,7 +218,6 @@ const ChipRootCSS = (onClick, onDbClick, colorProps, info) => css`
|
|
|
225
218
|
${cursorNotAllowed}
|
|
226
219
|
}
|
|
227
220
|
`;
|
|
228
|
-
|
|
229
221
|
const ChipIconCSS = info => css`
|
|
230
222
|
${flexRow};
|
|
231
223
|
${justifyCenter};
|
|
@@ -240,7 +232,6 @@ const ChipIconCSS = info => css`
|
|
|
240
232
|
min-height: ${info === null || info === void 0 ? void 0 : info.iconSize};
|
|
241
233
|
max-height: ${info === null || info === void 0 ? void 0 : info.iconSize};
|
|
242
234
|
`;
|
|
243
|
-
|
|
244
235
|
Chip.defaultProps = {
|
|
245
236
|
viewType: 'outlined',
|
|
246
237
|
size: 'medium',
|
|
@@ -249,57 +240,39 @@ Chip.defaultProps = {
|
|
|
249
240
|
Chip.propTypes = {
|
|
250
241
|
/** content to display in Chip */
|
|
251
242
|
label: PropTypes.string,
|
|
252
|
-
|
|
253
243
|
/** class of Chip element */
|
|
254
244
|
className: PropTypes.string,
|
|
255
|
-
|
|
256
245
|
/** max length content to display was allowed */
|
|
257
|
-
|
|
258
246
|
/** style inline of component */
|
|
259
247
|
style: PropTypes.object,
|
|
260
|
-
|
|
261
248
|
/** the icon display at head of Chip */
|
|
262
249
|
startIcon: PropTypes.any,
|
|
263
|
-
|
|
264
250
|
/** the icon display at last of Chip */
|
|
265
251
|
endIcon: PropTypes.any,
|
|
266
|
-
|
|
267
252
|
/** type of chip */
|
|
268
253
|
viewType: PropTypes.oneOf(['ghost', 'outlined', 'filled']),
|
|
269
|
-
|
|
270
254
|
/** color for text or background of Chip */
|
|
271
255
|
color: PropTypes.oneOfType([PropTypes.oneOf(['default', 'primary', 'info', 'success', 'warning', 'danger']), PropTypes.string]),
|
|
272
|
-
|
|
273
256
|
/** size of Chip */
|
|
274
257
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
275
|
-
|
|
276
258
|
/** show clear icon if true */
|
|
277
259
|
clearAble: PropTypes.bool,
|
|
278
|
-
|
|
279
260
|
/** prevent all event and change color if true */
|
|
280
261
|
disabled: PropTypes.bool,
|
|
281
|
-
|
|
282
262
|
/** prevent all event if true */
|
|
283
263
|
readOnly: PropTypes.bool,
|
|
284
|
-
|
|
285
264
|
/** the function to get ref of Chip */
|
|
286
265
|
refs: PropTypes.func,
|
|
287
|
-
|
|
288
266
|
/** the function will run after remove chip */
|
|
289
267
|
onRemove: PropTypes.func,
|
|
290
|
-
|
|
291
268
|
/** the function will run when click on chip */
|
|
292
269
|
onClick: PropTypes.func,
|
|
293
|
-
|
|
294
270
|
/** the function will run when double click on chip */
|
|
295
271
|
onDbClick: PropTypes.func,
|
|
296
|
-
|
|
297
272
|
/** like onDbClick (priority onDbClick) */
|
|
298
273
|
onDoubleClick: PropTypes.func,
|
|
299
|
-
|
|
300
274
|
/** content to display on Chip (the same to label) */
|
|
301
275
|
children: PropTypes.node,
|
|
302
|
-
|
|
303
276
|
/** props for Typography of label */
|
|
304
277
|
labelProps: PropTypes.object
|
|
305
278
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
5
4
|
import { css, jsx } from '@emotion/core';
|
|
@@ -16,12 +15,10 @@ const Collapse = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
16
15
|
}, reference) => {
|
|
17
16
|
const ref = useRef(null);
|
|
18
17
|
const timer = useRef(null);
|
|
19
|
-
|
|
20
18
|
const _onOpen = () => {
|
|
21
19
|
if (timer.current) {
|
|
22
20
|
clearTimeout(timer.current);
|
|
23
21
|
}
|
|
24
|
-
|
|
25
22
|
const scrollHeight = ref.current.scrollHeight;
|
|
26
23
|
const duration = Math.min(scrollHeight, 1500);
|
|
27
24
|
ref.current.style.transitionDuration = duration + 'ms';
|
|
@@ -30,29 +27,24 @@ const Collapse = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
30
27
|
if (ref.current) {
|
|
31
28
|
ref.current.style.height = 'auto';
|
|
32
29
|
}
|
|
33
|
-
|
|
34
30
|
onOpened && onOpened(ref.current);
|
|
35
31
|
}, duration);
|
|
36
32
|
};
|
|
37
|
-
|
|
38
33
|
const _onClose = () => {
|
|
39
34
|
if (ref.current) {
|
|
40
35
|
if (timer.current) {
|
|
41
36
|
clearTimeout(timer.current);
|
|
42
37
|
}
|
|
43
|
-
|
|
44
38
|
const scrollHeight = ref.current.scrollHeight;
|
|
45
39
|
ref.current.style.height = scrollHeight + 'px';
|
|
46
40
|
timer.current = setTimeout(() => {
|
|
47
41
|
if (ref.current) {
|
|
48
42
|
ref.current.style.height = null;
|
|
49
43
|
}
|
|
50
|
-
|
|
51
44
|
onClosed && onClosed(ref.current);
|
|
52
45
|
});
|
|
53
46
|
}
|
|
54
47
|
};
|
|
55
|
-
|
|
56
48
|
useEffect(() => {
|
|
57
49
|
if (open) {
|
|
58
50
|
_onOpen();
|
|
@@ -87,19 +79,14 @@ Collapse.defaultProps = {
|
|
|
87
79
|
Collapse.propTypes = {
|
|
88
80
|
/** The content of the component. */
|
|
89
81
|
children: PropTypes.node,
|
|
90
|
-
|
|
91
82
|
/** Class for component. */
|
|
92
83
|
className: PropTypes.string,
|
|
93
|
-
|
|
94
84
|
/** Callback fired when the component closed. */
|
|
95
85
|
onClosed: PropTypes.func,
|
|
96
|
-
|
|
97
86
|
/** Callback fired when the component opened. */
|
|
98
87
|
onOpened: PropTypes.func,
|
|
99
|
-
|
|
100
88
|
/** If `true`, the content is shown. */
|
|
101
89
|
open: PropTypes.bool,
|
|
102
|
-
|
|
103
90
|
/** Style inline of component. */
|
|
104
91
|
style: PropTypes.object
|
|
105
92
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import { memo, useMemo, useEffect, useRef, forwardRef } from 'react';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
@@ -23,7 +22,6 @@ const Divider = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
23
22
|
if (!ref) {
|
|
24
23
|
ref = useRef(null);
|
|
25
24
|
}
|
|
26
|
-
|
|
27
25
|
if (typeof width === 'number') width = `${width}px`;
|
|
28
26
|
if (typeof height === 'number') height = `${height}px`;
|
|
29
27
|
const DividerRoot = css`
|
|
@@ -64,22 +62,16 @@ Divider.defaultProps = {
|
|
|
64
62
|
Divider.propTypes = {
|
|
65
63
|
/** width of divider */
|
|
66
64
|
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
67
|
-
|
|
68
65
|
/** color of divider */
|
|
69
66
|
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
70
|
-
|
|
71
67
|
/** color of divider */
|
|
72
68
|
color: PropTypes.string,
|
|
73
|
-
|
|
74
69
|
/** direction of divider */
|
|
75
70
|
direction: PropTypes.oneOf(['vertical', 'horizontal']),
|
|
76
|
-
|
|
77
71
|
/** style inline of divider */
|
|
78
72
|
style: PropTypes.object,
|
|
79
|
-
|
|
80
73
|
/** className of divider */
|
|
81
74
|
className: PropTypes.string,
|
|
82
|
-
|
|
83
75
|
/** any props else */
|
|
84
76
|
props: PropTypes.object
|
|
85
77
|
};
|