diginet-core-ui 1.3.79 → 1.3.80
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/css.js +2 -2
- package/components/accordion/details.js +3 -3
- package/components/accordion/group.js +3 -3
- package/components/accordion/index.js +5 -5
- package/components/accordion/summary.js +4 -4
- package/components/alert/index.js +8 -8
- package/components/alert/notify.js +4 -4
- package/components/avatar/index.js +11 -12
- package/components/badge/index.js +5 -5
- package/components/button/icon.js +9 -9
- package/components/button/index.js +10 -10
- package/components/button/more.js +181 -109
- package/components/button/ripple-effect.js +2 -2
- package/components/card/body.js +2 -2
- package/components/card/extra.js +2 -2
- package/components/card/footer.js +2 -2
- package/components/card/header.js +3 -3
- package/components/card/index.js +8 -8
- package/components/chart/Pie/index.js +37 -38
- package/components/chart/Pie-v2/Sectors.js +3 -3
- package/components/chart/Pie-v2/index.js +6 -6
- package/components/chart/bar/Bar.js +2 -2
- package/components/chart/bar/Labels.js +2 -3
- package/components/chart/bar/index.js +6 -6
- package/components/chart/bar-v2/Bar.js +3 -3
- package/components/chart/bar-v2/Labels.js +2 -3
- package/components/chart/bar-v2/index.js +6 -6
- package/components/chart/line/Labels.js +2 -3
- package/components/chart/line/Path.js +1 -1
- package/components/chart/line/Point.js +2 -2
- package/components/chart/line/Title.js +1 -1
- package/components/chart/line/index.js +6 -6
- package/components/chart/line-v2/Labels.js +2 -3
- package/components/chart/line-v2/Point.js +2 -2
- package/components/chart/line-v2/Title.js +1 -1
- package/components/chart/line-v2/index.js +6 -6
- package/components/check-text/index.js +2 -2
- package/components/check-text/interview-confirmation.js +2 -2
- package/components/check-text/interview-status.js +2 -2
- package/components/chip/attach.js +4 -4
- package/components/chip/index.js +5 -5
- package/components/collapse/index.js +1 -1
- package/components/divider/index.js +2 -2
- package/components/form-control/attachment/index.js +6 -6
- package/components/form-control/calendar/function.js +8 -8
- package/components/form-control/calendar/index.js +2 -2
- package/components/form-control/calendar/range.js +3 -3
- package/components/form-control/checkbox/index.js +5 -5
- package/components/form-control/control/index.js +2 -2
- package/components/form-control/date-picker/index.js +10 -10
- package/components/form-control/date-range-picker/index.js +8 -8
- package/components/form-control/dropdown/index.js +7 -7
- package/components/form-control/dropdown-box/index.js +6 -6
- package/components/form-control/form/index.js +1 -1
- package/components/form-control/form-group/index.js +1 -1
- package/components/form-control/helper-text/index.js +4 -4
- package/components/form-control/input-base/index.js +7 -7
- package/components/form-control/label/index.js +13 -13
- package/components/form-control/money-input/index.js +5 -5
- package/components/form-control/number-input/index.js +3 -3
- package/components/form-control/number-input/index2.js +36 -27
- package/components/form-control/phone-input/index.js +2 -2
- package/components/form-control/radio/index.js +4 -4
- package/components/form-control/text-input/index.js +4 -4
- package/components/form-control/time-picker/index.js +7 -7
- package/components/form-control/time-picker/swiper.js +1 -1
- package/components/form-control/toggle/index.js +4 -4
- package/components/form-view/helper-text.js +1 -1
- package/components/form-view/index.js +4 -4
- package/components/form-view/input.js +3 -3
- package/components/form-view/label.js +2 -2
- package/components/grid/Col.js +2 -2
- package/components/grid/Container.js +1 -1
- package/components/grid/Row.js +1 -1
- package/components/grid/index.js +5 -5
- package/components/image/index.js +5 -5
- package/components/index.js +83 -83
- package/components/list/list-item-action.js +1 -1
- package/components/list/list-item-icon.js +2 -2
- package/components/list/list-item-text.js +1 -1
- package/components/list/list-item.js +2 -2
- package/components/list/list.js +1 -1
- package/components/list/sub-header.js +2 -2
- package/components/modal/body.js +4 -4
- package/components/modal/footer.js +3 -3
- package/components/modal/header.js +5 -5
- package/components/modal/index.js +4 -4
- package/components/modal/modal.js +6 -6
- package/components/others/extra/index.js +2 -2
- package/components/others/import/index.js +1 -1
- package/components/others/scrollbar/index.js +1 -3
- package/components/paging/page-info.js +5 -5
- package/components/paging/page-selector.js +3 -3
- package/components/paging/page-selector2.js +5 -5
- package/components/paper/index.js +2 -2
- package/components/popover/body.js +4 -4
- package/components/popover/footer.js +4 -4
- package/components/popover/header.js +5 -5
- package/components/popover/index.js +4 -4
- package/components/popup/danger_popup.js +5 -5
- package/components/popup/index.js +6 -6
- package/components/popup/proposals_popup.js +5 -5
- package/components/popup/v2/index.js +9 -9
- package/components/progress/circular.js +169 -260
- package/components/progress/linear.js +2 -2
- package/components/rating/index.js +6 -6
- package/components/slider/slider-container.js +4 -4
- package/components/slider/slider-item.js +5 -5
- package/components/status/index.js +5 -5
- package/components/tab/tab-container.js +4 -4
- package/components/tab/tab-header.js +5 -5
- package/components/tab/tab-panel.js +4 -4
- package/components/tab/tab.js +8 -8
- package/components/tooltip/index.js +3 -3
- package/components/tooltip/portal.js +1 -1
- package/components/transfer/index.js +5 -5
- package/components/tree-view/css.js +2 -2
- package/components/tree-view/index.js +4 -4
- package/components/typography/index.js +3 -3
- package/global/index.js +1 -1
- package/icons/basic.js +1 -1
- package/icons/effect.js +5 -5
- package/icons/general/index.js +21 -21
- package/icons/index.js +2 -2
- package/icons/menu/index.js +2 -2
- package/icons/menu/v2/index.js +1 -1
- package/locale/index.js +1 -1
- package/package.json +1 -1
- package/readme.md +6 -0
- package/styles/animation.js +1 -1
- package/styles/colors.js +1 -1
- package/styles/font.js +3 -3
- package/styles/general.js +3 -2
- package/styles/typography.js +2 -2
- package/styles/utils.js +1 -1
- package/theme/index.js +3 -3
- package/theme/make-styles.js +1 -1
- package/theme/set-theme.js +1 -1
- package/theme/settings.js +6 -6
- package/theme/theme-provider.js +2 -2
- package/theme/theme.js +1 -1
- package/utils/array/array.js +3 -3
- package/utils/console.js +1 -1
- package/utils/date.js +2 -2
- package/utils/error/error.js +3 -3
- package/utils/error/errors.js +1 -1
- package/utils/handleBreakpoints.js +2 -2
- package/utils/index.js +28 -28
- package/utils/object/extend.js +1 -1
- package/utils/object/object.js +1 -1
- package/utils/render-portal.js +1 -1
- package/utils/renderHTML.js +1 -1
- package/utils/renderIcon.js +3 -3
- package/utils/sb-template.js +4 -4
- package/utils/string/capitalizeSentenceCase.js +1 -1
- package/utils/string/string.js +1 -1
- package/utils/useElementSize.js +1 -1
- package/utils/validate.js +2 -2
|
@@ -4,15 +4,15 @@ import { memo, useEffect, useRef, useState, forwardRef, useImperativeHandle, Fra
|
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { jsx, css } from '@emotion/core';
|
|
7
|
-
import useDelayUnmount from
|
|
8
|
-
import Icon from
|
|
9
|
-
import { Button, ButtonIcon, Typography } from
|
|
10
|
-
import { getGlobal } from
|
|
11
|
-
import { hexToRGBA } from
|
|
12
|
-
import { capitalize } from
|
|
13
|
-
import { animations } from
|
|
14
|
-
import { alignCenter, border, borderBox, borderRadius4px, breakWord, cursorPointer, displayBlock, ellipsis, flexCol, flexRow, justifyCenter, justifyEnd, overflowAuto, overflowHidden, parseWidth, parseWidthHeight, positionFixed, positionRelative } from
|
|
15
|
-
import theme from
|
|
7
|
+
import useDelayUnmount from "../../../utils/useDelayUnmount";
|
|
8
|
+
import Icon from "../../../icons";
|
|
9
|
+
import { Button, ButtonIcon, Typography } from "../../";
|
|
10
|
+
import { getGlobal } from "../../../global";
|
|
11
|
+
import { hexToRGBA } from "../../../styles/color-helper";
|
|
12
|
+
import { capitalize } from "../../../utils";
|
|
13
|
+
import { animations } from "../../../styles/animation";
|
|
14
|
+
import { alignCenter, border, borderBox, borderRadius4px, breakWord, cursorPointer, displayBlock, ellipsis, flexCol, flexRow, justifyCenter, justifyEnd, overflowAuto, overflowHidden, parseWidth, parseWidthHeight, positionFixed, positionRelative } from "../../../styles/general";
|
|
15
|
+
import theme from "../../../theme/settings";
|
|
16
16
|
const {
|
|
17
17
|
colors: {
|
|
18
18
|
system: {
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { css, jsx, keyframes } from '@emotion/core';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { forwardRef, memo, useMemo, useRef
|
|
7
|
-
import {
|
|
8
|
-
import { useColor as colors, useTheme } from
|
|
6
|
+
import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
7
|
+
import { displayInlineBlock, parseWidthHeight, userSelectNone } from "../../styles/general";
|
|
8
|
+
import { useColor as colors, useTheme } from "../../theme";
|
|
9
|
+
import { classNames } from "../../utils";
|
|
9
10
|
const {
|
|
10
11
|
colors: {
|
|
11
12
|
semantic: {
|
|
@@ -27,68 +28,195 @@ const validatePercent = percent => {
|
|
|
27
28
|
let per = +percent.toString().replace('%', '');
|
|
28
29
|
return Math.max(Math.min(per, 100), 0);
|
|
29
30
|
};
|
|
30
|
-
const
|
|
31
|
-
let rect, strokeWidth
|
|
31
|
+
const getDimensionOld = size => {
|
|
32
|
+
let width, labelStyle, rect, strokeWidth;
|
|
32
33
|
switch (size) {
|
|
33
34
|
case 'xl':
|
|
34
35
|
case 'extraLarge':
|
|
35
36
|
labelStyle = heading1;
|
|
37
|
+
width = 240;
|
|
36
38
|
rect = 120;
|
|
37
39
|
strokeWidth = 16;
|
|
38
40
|
break;
|
|
39
41
|
case 'lg':
|
|
40
42
|
case 'large':
|
|
41
43
|
labelStyle = heading2;
|
|
44
|
+
width = 160;
|
|
42
45
|
rect = 80;
|
|
43
46
|
strokeWidth = 12;
|
|
44
47
|
break;
|
|
45
48
|
case 'md':
|
|
46
49
|
case 'medium':
|
|
47
50
|
labelStyle = paragraph1;
|
|
51
|
+
width = 120;
|
|
48
52
|
rect = 60;
|
|
49
53
|
strokeWidth = 8;
|
|
50
54
|
break;
|
|
51
55
|
case 'sm':
|
|
52
56
|
case 'small':
|
|
53
57
|
labelStyle = paragraph2;
|
|
58
|
+
width = 80;
|
|
54
59
|
rect = 40;
|
|
55
60
|
strokeWidth = 6;
|
|
56
61
|
break;
|
|
57
62
|
case 'xs':
|
|
58
63
|
case 'extraSmall':
|
|
59
64
|
labelStyle = paragraph3;
|
|
65
|
+
width = 40;
|
|
60
66
|
rect = 20;
|
|
61
67
|
strokeWidth = 4;
|
|
62
68
|
break;
|
|
63
69
|
default:
|
|
64
|
-
|
|
65
|
-
rect = 80;
|
|
66
|
-
strokeWidth = 8;
|
|
70
|
+
return null;
|
|
67
71
|
}
|
|
68
72
|
return {
|
|
69
73
|
labelStyle,
|
|
70
74
|
rect,
|
|
71
|
-
strokeWidth
|
|
75
|
+
strokeWidth,
|
|
76
|
+
width
|
|
72
77
|
};
|
|
73
78
|
};
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
79
|
+
const designTemplate = [{
|
|
80
|
+
width: 16,
|
|
81
|
+
labelStyle: paragraph3,
|
|
82
|
+
rect: 8,
|
|
83
|
+
strokeWidth: 2
|
|
84
|
+
}, {
|
|
85
|
+
width: 24,
|
|
86
|
+
labelStyle: paragraph3,
|
|
87
|
+
rect: 12,
|
|
88
|
+
strokeWidth: 2
|
|
89
|
+
}, {
|
|
90
|
+
width: 40,
|
|
91
|
+
labelStyle: paragraph3,
|
|
92
|
+
rect: 20,
|
|
93
|
+
strokeWidth: 4
|
|
94
|
+
}, {
|
|
95
|
+
width: 80,
|
|
96
|
+
labelStyle: paragraph2,
|
|
97
|
+
rect: 40,
|
|
98
|
+
strokeWidth: 6
|
|
99
|
+
}, {
|
|
100
|
+
width: 120,
|
|
101
|
+
labelStyle: paragraph1,
|
|
102
|
+
rect: 60,
|
|
103
|
+
strokeWidth: 8
|
|
104
|
+
}, {
|
|
105
|
+
width: 160,
|
|
106
|
+
labelStyle: heading2,
|
|
107
|
+
rect: 80,
|
|
108
|
+
strokeWidth: 12
|
|
109
|
+
}, {
|
|
110
|
+
width: 240,
|
|
111
|
+
labelStyle: heading1,
|
|
112
|
+
rect: 120,
|
|
113
|
+
strokeWidth: 16
|
|
114
|
+
}];
|
|
115
|
+
const getDimension = size => {
|
|
116
|
+
const sizeObj = {
|
|
117
|
+
width: Number(size),
|
|
118
|
+
rect: size / 2
|
|
119
|
+
};
|
|
120
|
+
if (size <= 16) {
|
|
121
|
+
return {
|
|
122
|
+
...designTemplate[0],
|
|
123
|
+
...sizeObj
|
|
124
|
+
};
|
|
125
|
+
} else if (size >= 240) {
|
|
126
|
+
return {
|
|
127
|
+
...designTemplate[designTemplate.length - 1],
|
|
128
|
+
...sizeObj
|
|
129
|
+
};
|
|
130
|
+
} else {
|
|
131
|
+
const templateObj = designTemplate.reduce((acc, obj) =>
|
|
132
|
+
// Math.abs(size - obj.width) < Math.abs(size - acc.width) ? obj : acc
|
|
133
|
+
size > obj.width ? obj : acc);
|
|
134
|
+
return {
|
|
135
|
+
...templateObj,
|
|
136
|
+
...sizeObj
|
|
137
|
+
};
|
|
89
138
|
}
|
|
90
|
-
return angle;
|
|
91
139
|
};
|
|
140
|
+
const directionAngleMap = new Map([['top', -90], ['bottom', 90], ['right', 0], ['left', -180]]);
|
|
141
|
+
const CircularProgress = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
142
|
+
action = {},
|
|
143
|
+
background,
|
|
144
|
+
circleRef,
|
|
145
|
+
className,
|
|
146
|
+
color: colorProp,
|
|
147
|
+
determinate,
|
|
148
|
+
direction,
|
|
149
|
+
duration,
|
|
150
|
+
id,
|
|
151
|
+
percent,
|
|
152
|
+
percentColor: percentColorProp,
|
|
153
|
+
showValue,
|
|
154
|
+
size,
|
|
155
|
+
strokeWidth,
|
|
156
|
+
style,
|
|
157
|
+
width
|
|
158
|
+
}, reference) => {
|
|
159
|
+
const ref = useRef(null);
|
|
160
|
+
if (!circleRef) circleRef = useRef(null);
|
|
161
|
+
const color = colors[colorProp] || colorProp;
|
|
162
|
+
const percentColor = colors[percentColorProp] || percentColorProp;
|
|
163
|
+
const directionAngle = directionAngleMap.get(direction);
|
|
164
|
+
const dimension = getDimensionOld(size) || getDimension(size);
|
|
165
|
+
const containerW = width ? Math.max(determinate ? 24 : 16, width) : dimension.width;
|
|
166
|
+
const circleStrokeW = strokeWidth ? Math.max(2, strokeWidth) : dimension.strokeWidth;
|
|
167
|
+
const radius = Math.max(0, (containerW - circleStrokeW) / 2);
|
|
168
|
+
const radiusX10 = radius * 10;
|
|
169
|
+
const circumference = radius * 2 * Math.PI;
|
|
170
|
+
const _ContainerCSS = ContainerCSS(containerW);
|
|
171
|
+
const _CircleBackgroundCSS = CircleBackgroundCSS(background, !determinate);
|
|
172
|
+
const _CircleMainCSS = CircleMainCSS(color);
|
|
173
|
+
const _CircleMainIndeterminateCSS = CircleMainIndeterminateCSS(radiusX10);
|
|
174
|
+
const _CircleMainDeterminateCSS = CircleMainDeterminateCSS(circumference, percent, directionAngle, duration);
|
|
175
|
+
const _TextCSS = TextCSS(percentColor, color, dimension);
|
|
176
|
+
useImperativeHandle(reference, () => {
|
|
177
|
+
const currentRef = ref.current || {};
|
|
178
|
+
currentRef.element = ref.current;
|
|
179
|
+
const _instance = {
|
|
180
|
+
...action
|
|
181
|
+
}; // methods
|
|
182
|
+
_instance.__proto__ = {}; // hidden methods
|
|
183
|
+
currentRef.instance = _instance;
|
|
184
|
+
return currentRef;
|
|
185
|
+
});
|
|
186
|
+
const CircleBackgroundView = jsx("circle", {
|
|
187
|
+
css: _CircleBackgroundCSS,
|
|
188
|
+
cx: containerW / 2,
|
|
189
|
+
cy: containerW / 2,
|
|
190
|
+
r: radius,
|
|
191
|
+
strokeWidth: circleStrokeW
|
|
192
|
+
});
|
|
193
|
+
const CircleMainView = jsx("circle", {
|
|
194
|
+
css: [_CircleMainCSS, determinate ? _CircleMainDeterminateCSS : _CircleMainIndeterminateCSS],
|
|
195
|
+
cx: containerW / 2,
|
|
196
|
+
cy: containerW / 2,
|
|
197
|
+
r: radius,
|
|
198
|
+
strokeWidth: circleStrokeW,
|
|
199
|
+
ref: circleRef
|
|
200
|
+
});
|
|
201
|
+
const PercentTextView = showValue && determinate && containerW >= 40 ? jsx("text", {
|
|
202
|
+
css: _TextCSS,
|
|
203
|
+
dominantBaseline: 'middle',
|
|
204
|
+
x: containerW / 2,
|
|
205
|
+
y: containerW / 2 + containerW / 80
|
|
206
|
+
}, validatePercent(percent), "%") : null;
|
|
207
|
+
return useMemo(() => {
|
|
208
|
+
return jsx("span", {
|
|
209
|
+
ref: ref,
|
|
210
|
+
css: [_ContainerCSS, !determinate && AnimationRotateCSS],
|
|
211
|
+
id: id,
|
|
212
|
+
style: style,
|
|
213
|
+
className: classNames('DGN-UI-Circular-Progress', className)
|
|
214
|
+
}, jsx("svg", {
|
|
215
|
+
width: '100%',
|
|
216
|
+
height: '100%'
|
|
217
|
+
}, CircleBackgroundView, CircleMainView, PercentTextView));
|
|
218
|
+
}, [background, className, colorProp, determinate, direction, duration, id, percent, percentColorProp, showValue, size, strokeWidth, style, width]);
|
|
219
|
+
}));
|
|
92
220
|
const keyframeRotate = keyframes`
|
|
93
221
|
100%{ transform: rotate(360deg);}
|
|
94
222
|
`;
|
|
@@ -107,35 +235,27 @@ const keyframeDash = r => keyframes`
|
|
|
107
235
|
}
|
|
108
236
|
`;
|
|
109
237
|
const ContainerCSS = containerW => css`
|
|
238
|
+
${displayInlineBlock};
|
|
110
239
|
${parseWidthHeight(containerW)};
|
|
111
|
-
${overflowHidden};
|
|
112
|
-
${positionRelative};
|
|
113
|
-
${borderRadius50};
|
|
114
240
|
`;
|
|
115
241
|
const AnimationRotateCSS = css`
|
|
116
242
|
animation: ${keyframeRotate} 2s linear infinite;
|
|
117
243
|
`;
|
|
118
|
-
const CircleBackgroundCSS = (background,
|
|
119
|
-
${overflowHidden};
|
|
120
|
-
${borderRadius50};
|
|
244
|
+
const CircleBackgroundCSS = (background, isIndeterminate) => css`
|
|
121
245
|
fill: transparent;
|
|
122
246
|
stroke: ${background};
|
|
123
|
-
stroke-width: ${circleStrokeW}px;
|
|
124
247
|
${isIndeterminate && 'stroke-linecap: round'};
|
|
125
248
|
`;
|
|
126
|
-
const CircleMainCSS =
|
|
127
|
-
${overflowHidden};
|
|
128
|
-
${borderRadius50};
|
|
249
|
+
const CircleMainCSS = color => css`
|
|
129
250
|
fill: transparent;
|
|
130
251
|
stroke: ${color};
|
|
131
252
|
stroke-linecap: round;
|
|
132
|
-
stroke-width: ${circleStrokeW}px;
|
|
133
253
|
`;
|
|
134
|
-
const CircleMainDeterminateCSS = (circumference, percent,
|
|
254
|
+
const CircleMainDeterminateCSS = (circumference, percent, directionAngle, duration) => css`
|
|
135
255
|
stroke-dasharray: ${`${circumference} ${circumference}`};
|
|
136
256
|
stroke-dashoffset: ${circumference - validatePercent(percent) / 100 * circumference};
|
|
137
|
-
transform: rotate(${
|
|
138
|
-
transform-origin:
|
|
257
|
+
transform: rotate(${directionAngle}deg);
|
|
258
|
+
transform-origin: center;
|
|
139
259
|
transition: stroke-dashoffset ${duration}s cubic-bezier(0.77, 0, 0.175, 1); /* easeInOutQuart */
|
|
140
260
|
`;
|
|
141
261
|
const CircleMainIndeterminateCSS = radiusX10 => css`
|
|
@@ -149,221 +269,9 @@ const TextCSS = (percentColor, color, dimension) => css`
|
|
|
149
269
|
${dimension.labelStyle}
|
|
150
270
|
text-anchor: middle;
|
|
151
271
|
`;
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Determinate circular progress
|
|
155
|
-
*/
|
|
156
|
-
const Determinate = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
157
|
-
action = {},
|
|
158
|
-
background,
|
|
159
|
-
circleRef,
|
|
160
|
-
color,
|
|
161
|
-
direction,
|
|
162
|
-
duration,
|
|
163
|
-
percentColor,
|
|
164
|
-
percent,
|
|
165
|
-
showValue,
|
|
166
|
-
size,
|
|
167
|
-
strokeWidth,
|
|
168
|
-
width,
|
|
169
|
-
...props
|
|
170
|
-
}, reference) => {
|
|
171
|
-
const ref = useRef(null);
|
|
172
|
-
if (!circleRef) circleRef = useRef(null);
|
|
173
|
-
const dimension = getDimension(size);
|
|
174
|
-
const containerW = width ? Math.max(24, width) : dimension.rect * 2;
|
|
175
|
-
const circleStrokeW = strokeWidth ? Math.max(2, strokeWidth) : dimension.strokeWidth;
|
|
176
|
-
const radius = containerW / 2 - circleStrokeW;
|
|
177
|
-
const circumference = radius * 2 * Math.PI;
|
|
178
|
-
const _ContainerCSS = ContainerCSS(containerW);
|
|
179
|
-
const _CircleBackgroundCSS = CircleBackgroundCSS(background, circleStrokeW);
|
|
180
|
-
const _CircleMainCSS = CircleMainCSS(color, circleStrokeW);
|
|
181
|
-
const _CircleMainDeterminateCSS = CircleMainDeterminateCSS(circumference, percent, direction, duration);
|
|
182
|
-
const _TextCSS = TextCSS(percentColor, color, dimension);
|
|
183
|
-
useImperativeHandle(reference, () => {
|
|
184
|
-
const currentRef = ref.current || {};
|
|
185
|
-
currentRef.element = ref.current;
|
|
186
|
-
const _instance = {
|
|
187
|
-
...action
|
|
188
|
-
}; // methods
|
|
189
|
-
_instance.__proto__ = {}; // hidden methods
|
|
190
|
-
currentRef.instance = _instance;
|
|
191
|
-
return currentRef;
|
|
192
|
-
});
|
|
193
|
-
const CircleBackgroundMemo = useMemo(() => jsx("circle", {
|
|
194
|
-
css: _CircleBackgroundCSS,
|
|
195
|
-
cx: containerW / 2,
|
|
196
|
-
cy: containerW / 2,
|
|
197
|
-
r: radius
|
|
198
|
-
}), [background, size, strokeWidth, width]);
|
|
199
|
-
const CircleMainMemo = useMemo(() => jsx("circle", {
|
|
200
|
-
css: [_CircleMainCSS, _CircleMainDeterminateCSS],
|
|
201
|
-
cx: containerW / 2,
|
|
202
|
-
cy: containerW / 2,
|
|
203
|
-
r: radius,
|
|
204
|
-
ref: circleRef
|
|
205
|
-
}), [color, direction, duration, percent, size, strokeWidth, width]);
|
|
206
|
-
const PercentTextMemo = useMemo(() => showValue && jsx("text", {
|
|
207
|
-
css: _TextCSS,
|
|
208
|
-
dominantBaseline: 'middle',
|
|
209
|
-
x: containerW / 2,
|
|
210
|
-
y: containerW / 2 + containerW / 80
|
|
211
|
-
}, validatePercent(percent), "%"), [color, percentColor, percent, size, strokeWidth, showValue, width]);
|
|
212
|
-
return jsx("svg", {
|
|
213
|
-
...props,
|
|
214
|
-
css: _ContainerCSS,
|
|
215
|
-
ref: ref
|
|
216
|
-
}, CircleBackgroundMemo, CircleMainMemo, PercentTextMemo);
|
|
217
|
-
}));
|
|
218
|
-
Determinate.defaultProps = {
|
|
219
|
-
background: lineCategory,
|
|
220
|
-
color: semanticInfo,
|
|
221
|
-
direction: 'top',
|
|
222
|
-
duration: 2,
|
|
223
|
-
percent: 25,
|
|
224
|
-
showValue: false,
|
|
225
|
-
size: 'medium'
|
|
226
|
-
};
|
|
227
|
-
Determinate.propTypes = {
|
|
228
|
-
/** Color for background stroke of the circular progress. */
|
|
229
|
-
background: PropTypes.string,
|
|
230
|
-
/** Color for main stroke of the circular progress. */
|
|
231
|
-
color: PropTypes.string,
|
|
232
|
-
/** Direction of the start point. */
|
|
233
|
-
direction: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
|
|
234
|
-
/** Time to processing. */
|
|
235
|
-
duration: PropTypes.number,
|
|
236
|
-
/** The percent of the progress. */
|
|
237
|
-
percent: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
238
|
-
/** Color percent-label of the progress. */
|
|
239
|
-
percentColor: PropTypes.string,
|
|
240
|
-
/** It's boolean to show the percent-label. */
|
|
241
|
-
showValue: PropTypes.bool,
|
|
242
|
-
/** Static dimensions default. */
|
|
243
|
-
size: PropTypes.oneOf(['xl', 'lg', 'md', 'sm', 'xs', 'extraLarge', 'large', 'medium', 'small', 'extraSmall']),
|
|
244
|
-
/** Dynamic width dimensions of the progress circle. */
|
|
245
|
-
strokeWidth: PropTypes.number,
|
|
246
|
-
/** Dynamic width and height dimensions of the container. */
|
|
247
|
-
width: PropTypes.number
|
|
248
|
-
};
|
|
249
|
-
export const DeterminateCircularProgress = Determinate;
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Indeterminate circular progress
|
|
253
|
-
*/
|
|
254
|
-
const Indeterminate = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
255
|
-
action = {},
|
|
256
|
-
background,
|
|
257
|
-
circleRef,
|
|
258
|
-
color,
|
|
259
|
-
size,
|
|
260
|
-
strokeWidth,
|
|
261
|
-
width,
|
|
262
|
-
...props
|
|
263
|
-
}, reference) => {
|
|
264
|
-
const ref = useRef(null);
|
|
265
|
-
if (!circleRef) circleRef = useRef(null);
|
|
266
|
-
const dimension = getDimension(size);
|
|
267
|
-
const containerW = width ? Math.max(16, width) : dimension.rect * 2;
|
|
268
|
-
const circleStrokeW = strokeWidth ? Math.max(2, strokeWidth) : dimension.strokeWidth;
|
|
269
|
-
const radius = containerW / 2 - circleStrokeW;
|
|
270
|
-
const radiusX10 = radius * 10;
|
|
271
|
-
const _ContainerCSS = ContainerCSS(containerW);
|
|
272
|
-
const _CircleBackgroundCSS = CircleBackgroundCSS(background, circleStrokeW, true);
|
|
273
|
-
const _CircleMainCSS = CircleMainCSS(color, circleStrokeW);
|
|
274
|
-
const _CircleMainIndeterminateCSS = CircleMainIndeterminateCSS(radiusX10);
|
|
275
|
-
useImperativeHandle(reference, () => {
|
|
276
|
-
const currentRef = ref.current || {};
|
|
277
|
-
currentRef.element = ref.current;
|
|
278
|
-
const _instance = {
|
|
279
|
-
...action
|
|
280
|
-
}; // methods
|
|
281
|
-
_instance.__proto__ = {}; // hidden methods
|
|
282
|
-
currentRef.instance = _instance;
|
|
283
|
-
return currentRef;
|
|
284
|
-
});
|
|
285
|
-
const CircleBackgroundMemo = useMemo(() => jsx("circle", {
|
|
286
|
-
css: _CircleBackgroundCSS,
|
|
287
|
-
cx: containerW / 2,
|
|
288
|
-
cy: containerW / 2,
|
|
289
|
-
r: radius
|
|
290
|
-
}), [background, size, strokeWidth, width]);
|
|
291
|
-
const CircleMainMemo = useMemo(() => jsx("circle", {
|
|
292
|
-
css: [_CircleMainCSS, _CircleMainIndeterminateCSS],
|
|
293
|
-
cx: containerW / 2,
|
|
294
|
-
cy: containerW / 2,
|
|
295
|
-
r: radius,
|
|
296
|
-
ref: circleRef
|
|
297
|
-
}), [color, size, strokeWidth, width]);
|
|
298
|
-
return jsx("svg", {
|
|
299
|
-
...props,
|
|
300
|
-
css: [_ContainerCSS, AnimationRotateCSS],
|
|
301
|
-
ref: ref
|
|
302
|
-
}, CircleBackgroundMemo, CircleMainMemo);
|
|
303
|
-
}));
|
|
304
|
-
Indeterminate.defaultProps = {
|
|
305
|
-
background: lineCategory,
|
|
306
|
-
color: semanticInfo,
|
|
307
|
-
size: 'medium'
|
|
308
|
-
};
|
|
309
|
-
Indeterminate.propTypes = {
|
|
310
|
-
/** Color for background stroke of the circular progress. */
|
|
311
|
-
background: PropTypes.string,
|
|
312
|
-
/** Color for main stroke of the circular progress. */
|
|
313
|
-
color: PropTypes.string,
|
|
314
|
-
/** Static dimensions default. */
|
|
315
|
-
size: PropTypes.oneOf(['xl', 'lg', 'md', 'sm', 'xs', 'extraLarge', 'large', 'medium', 'small', 'extraSmall']),
|
|
316
|
-
/** Dynamic width dimensions of the progress circle. */
|
|
317
|
-
strokeWidth: PropTypes.number,
|
|
318
|
-
/** Dynamic width and height dimensions of the container. */
|
|
319
|
-
width: PropTypes.number
|
|
320
|
-
};
|
|
321
|
-
export const IndeterminateCircularProgress = Indeterminate;
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* Circular progress
|
|
325
|
-
*/
|
|
326
|
-
const CircularProgress = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
327
|
-
action = {},
|
|
328
|
-
determinate,
|
|
329
|
-
direction,
|
|
330
|
-
duration,
|
|
331
|
-
percent,
|
|
332
|
-
percentColor: percentColorProp,
|
|
333
|
-
showValue,
|
|
334
|
-
color: colorProp,
|
|
335
|
-
...props
|
|
336
|
-
}, reference) => {
|
|
337
|
-
const ref = useRef(null);
|
|
338
|
-
const color = colors[colorProp] || colorProp;
|
|
339
|
-
const percentColor = colors[percentColorProp] || percentColorProp;
|
|
340
|
-
useImperativeHandle(reference, () => {
|
|
341
|
-
const currentRef = ref.current || {};
|
|
342
|
-
currentRef.element = ref.current;
|
|
343
|
-
const _instance = {
|
|
344
|
-
...action
|
|
345
|
-
}; // methods
|
|
346
|
-
_instance.__proto__ = {}; // hidden methods
|
|
347
|
-
currentRef.instance = _instance;
|
|
348
|
-
return currentRef;
|
|
349
|
-
});
|
|
350
|
-
return determinate ? jsx(DeterminateCircularProgress, {
|
|
351
|
-
ref: ref,
|
|
352
|
-
color: color,
|
|
353
|
-
direction: direction,
|
|
354
|
-
duration: duration,
|
|
355
|
-
percent: percent,
|
|
356
|
-
percentColor: percentColor,
|
|
357
|
-
showValue: true,
|
|
358
|
-
...props
|
|
359
|
-
}) : jsx(IndeterminateCircularProgress, {
|
|
360
|
-
ref: ref,
|
|
361
|
-
color: color,
|
|
362
|
-
...props
|
|
363
|
-
});
|
|
364
|
-
}));
|
|
365
272
|
CircularProgress.defaultProps = {
|
|
366
273
|
background: lineCategory,
|
|
274
|
+
className: '',
|
|
367
275
|
color: semanticInfo,
|
|
368
276
|
determinate: false,
|
|
369
277
|
direction: 'top',
|
|
@@ -371,11 +279,14 @@ CircularProgress.defaultProps = {
|
|
|
371
279
|
percent: 25,
|
|
372
280
|
percentColor: semanticInfo,
|
|
373
281
|
showValue: false,
|
|
374
|
-
size: 'medium'
|
|
282
|
+
size: 'medium',
|
|
283
|
+
style: {}
|
|
375
284
|
};
|
|
376
285
|
CircularProgress.propTypes = {
|
|
377
286
|
/** Color for background stroke of the circular progress. */
|
|
378
287
|
background: PropTypes.string,
|
|
288
|
+
/** Class for component. */
|
|
289
|
+
className: PropTypes.string,
|
|
379
290
|
/** Color for main stroke of the circular progress. */
|
|
380
291
|
color: PropTypes.string,
|
|
381
292
|
/** Determinate or Indeterminate. */
|
|
@@ -388,13 +299,11 @@ CircularProgress.propTypes = {
|
|
|
388
299
|
percent: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
389
300
|
/** Color percent-label of the progress. */
|
|
390
301
|
percentColor: PropTypes.string,
|
|
391
|
-
/**
|
|
302
|
+
/** If `true, show the percent-label. */
|
|
392
303
|
showValue: PropTypes.bool,
|
|
393
|
-
/**
|
|
394
|
-
size: PropTypes.oneOf(['xl', 'lg', 'md', 'sm', 'xs', 'extraLarge', 'large', 'medium', 'small', 'extraSmall']),
|
|
395
|
-
/**
|
|
396
|
-
|
|
397
|
-
/** Dynamic width and height dimensions of the container. */
|
|
398
|
-
width: PropTypes.number
|
|
304
|
+
/** The size of the component. */
|
|
305
|
+
size: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.oneOf(['xl', 'lg', 'md', 'sm', 'xs', 'extraLarge', 'large', 'medium', 'small', 'extraSmall'])]),
|
|
306
|
+
/** Style inline of component. */
|
|
307
|
+
style: PropTypes.object
|
|
399
308
|
};
|
|
400
309
|
export default CircularProgress;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { jsx, css, keyframes } from '@emotion/core';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { forwardRef, memo, useEffect, useMemo, useRef } from 'react';
|
|
6
|
-
import theme from
|
|
7
|
-
import { Typography } from
|
|
6
|
+
import theme from "../../theme/settings";
|
|
7
|
+
import { Typography } from "../";
|
|
8
8
|
const cutPX = x => {
|
|
9
9
|
return isNaN(x) ? x : x + 'px';
|
|
10
10
|
};
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
import { memo, useMemo, useRef, useState, useEffect, forwardRef, Fragment, useImperativeHandle } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { jsx, css } from '@emotion/core';
|
|
6
|
-
import { StarHalf, StarOutline } from
|
|
7
|
-
import { randomString } from
|
|
8
|
-
import { hexToRGBA } from
|
|
9
|
-
import { color as colors } from
|
|
10
|
-
import theme from
|
|
11
|
-
import { alignCenter, border, cursorPointer, flexRow, flexRowReverse, inlineFlex, outlineNone, overflowHidden, pointerEventsNone, positionAbsolute, positionRelative } from
|
|
6
|
+
import { StarHalf, StarOutline } from "../../icons";
|
|
7
|
+
import { randomString } from "../../utils";
|
|
8
|
+
import { hexToRGBA } from "../../styles/color-helper";
|
|
9
|
+
import { color as colors } from "../../styles/colors";
|
|
10
|
+
import theme from "../../theme/settings";
|
|
11
|
+
import { alignCenter, border, cursorPointer, flexRow, flexRowReverse, inlineFlex, outlineNone, overflowHidden, pointerEventsNone, positionAbsolute, positionRelative } from "../../styles/general";
|
|
12
12
|
const {
|
|
13
13
|
colors: {
|
|
14
14
|
system: {
|
|
@@ -4,10 +4,10 @@ import { css, jsx } from '@emotion/core';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
6
6
|
import { ButtonIcon } from '..';
|
|
7
|
-
import { randomString } from
|
|
8
|
-
import SliderItem from
|
|
9
|
-
import { color as colors } from
|
|
10
|
-
import { alignCenter, backgroundTransparent, borderBox, cursorPointer, displayNone, flexCol, flexRow, justifyCenter, overflowHidden, positionAbsolute, positionRelative, userSelectNone } from
|
|
7
|
+
import { randomString } from "../../utils";
|
|
8
|
+
import SliderItem from "./slider-item";
|
|
9
|
+
import { color as colors } from "../../styles/colors";
|
|
10
|
+
import { alignCenter, backgroundTransparent, borderBox, cursorPointer, displayNone, flexCol, flexRow, justifyCenter, overflowHidden, positionAbsolute, positionRelative, userSelectNone } from "../../styles/general";
|
|
11
11
|
const {
|
|
12
12
|
system: {
|
|
13
13
|
active,
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { forwardRef, memo, useEffect, useState, useRef, useImperativeHandle } from 'react';
|
|
4
4
|
import { jsx, css } from '@emotion/core';
|
|
5
|
-
import { randomString, getFileType } from
|
|
5
|
+
import { randomString, getFileType } from "../../utils";
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import
|
|
8
|
-
import { animations } from
|
|
9
|
-
import { displayBlock, displayNone, justifyCenter, positionAbsolute } from
|
|
7
|
+
import CircularProgress from "../progress/circular";
|
|
8
|
+
import { animations } from "../../styles/animation";
|
|
9
|
+
import { displayBlock, displayNone, justifyCenter, positionAbsolute } from "../../styles/general";
|
|
10
10
|
const fadeIn = animations.fadeIn;
|
|
11
11
|
const regex = /(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)/g;
|
|
12
12
|
const googleDriveRegex = /(http(s)?:\/\/.)?(drive\.google\.com\/file\/d\/)/;
|
|
@@ -152,7 +152,7 @@ const SliderItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
152
152
|
ref: ref
|
|
153
153
|
}, iframeTimeoutId && getFileType(url, undefined, false) === 'pdf' && jsx("div", {
|
|
154
154
|
css: loadingCSS
|
|
155
|
-
}, jsx(
|
|
155
|
+
}, jsx(CircularProgress, {
|
|
156
156
|
size: 'xs'
|
|
157
157
|
})), getViewer(url, getFileType(url, undefined, false)));
|
|
158
158
|
}));
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
6
|
-
import { Typography } from
|
|
7
|
-
import Icon from
|
|
8
|
-
import { alignCenter, backgroundTransparent, borderBox, flexRow } from
|
|
9
|
-
import theme from
|
|
10
|
-
import OptionWrapper from
|
|
6
|
+
import { Typography } from "../";
|
|
7
|
+
import Icon from "../../icons";
|
|
8
|
+
import { alignCenter, backgroundTransparent, borderBox, flexRow } from "../../styles/general";
|
|
9
|
+
import theme from "../../theme/settings";
|
|
10
|
+
import OptionWrapper from "../others/option-wrapper";
|
|
11
11
|
const {
|
|
12
12
|
colors: {
|
|
13
13
|
system: {
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import React, { forwardRef, useState, memo, useEffect, useRef, useImperativeHandle, useMemo } from 'react';
|
|
4
4
|
import { jsx, css } from '@emotion/core';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { classNames, randomString, refType as ref } from
|
|
7
|
-
import TabContext from
|
|
8
|
-
import { isNumeric } from
|
|
9
|
-
import { flexCol, flexRow, positionRelative, parseWidth, typographyTypes } from
|
|
6
|
+
import { classNames, randomString, refType as ref } from "../../utils";
|
|
7
|
+
import TabContext from "./context";
|
|
8
|
+
import { isNumeric } from "../../utils/type";
|
|
9
|
+
import { flexCol, flexRow, positionRelative, parseWidth, typographyTypes } from "../../styles/general";
|
|
10
10
|
const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
11
11
|
action = {},
|
|
12
12
|
children,
|