sag_components 1.0.405 → 1.0.407
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.
|
@@ -17,7 +17,8 @@ var _IconButton = require("./IconButton.style");
|
|
|
17
17
|
/* IconButton */
|
|
18
18
|
const IconButton = props => {
|
|
19
19
|
const {
|
|
20
|
-
downloadStatus,
|
|
20
|
+
// downloadStatus,
|
|
21
|
+
showProcess,
|
|
21
22
|
contentColor,
|
|
22
23
|
buttonText,
|
|
23
24
|
backgroundColor,
|
|
@@ -30,11 +31,9 @@ const IconButton = props => {
|
|
|
30
31
|
onClick,
|
|
31
32
|
onCancelClick
|
|
32
33
|
} = props;
|
|
33
|
-
const [mouseDownPressed, setMouseDownPressed] = (0, _react.useState)(false);
|
|
34
34
|
const [progress, setProgress] = (0, _react.useState)(0);
|
|
35
|
-
const [showProcess, setShowProcess] = (0, _react.useState)(false);
|
|
36
35
|
const incrementProgress = () => {
|
|
37
|
-
if (
|
|
36
|
+
if (showProcess && progress <= 90) {
|
|
38
37
|
const interval = setInterval(() => {
|
|
39
38
|
setProgress(prevProgress => {
|
|
40
39
|
const newProgress = prevProgress + 3;
|
|
@@ -43,17 +42,15 @@ const IconButton = props => {
|
|
|
43
42
|
}
|
|
44
43
|
return newProgress;
|
|
45
44
|
});
|
|
46
|
-
setShowProcess(true);
|
|
47
45
|
}, 500);
|
|
48
46
|
} else {
|
|
49
47
|
setProgress(0);
|
|
50
|
-
setShowProcess(false);
|
|
51
48
|
}
|
|
52
49
|
};
|
|
53
50
|
(0, _react.useEffect)(() => {
|
|
54
51
|
incrementProgress();
|
|
55
|
-
console.log('
|
|
56
|
-
}, [
|
|
52
|
+
console.log('showProcess inside useEffect', showProcess);
|
|
53
|
+
}, [showProcess]);
|
|
57
54
|
const getIcon = icon => {
|
|
58
55
|
switch (icon) {
|
|
59
56
|
case 'download':
|
|
@@ -102,24 +99,6 @@ const IconButton = props => {
|
|
|
102
99
|
return '';
|
|
103
100
|
}
|
|
104
101
|
};
|
|
105
|
-
const onMouseDownHandler = () => {
|
|
106
|
-
if (disabled) return;
|
|
107
|
-
setMouseDownPressed(true);
|
|
108
|
-
};
|
|
109
|
-
const onMouseUpHandler = () => {
|
|
110
|
-
if (disabled) return;
|
|
111
|
-
setMouseDownPressed(false);
|
|
112
|
-
};
|
|
113
|
-
const onPointerOutHandler = () => {
|
|
114
|
-
if (disabled) return;
|
|
115
|
-
if (!mouseDownPressed) return;
|
|
116
|
-
setMouseDownPressed(false);
|
|
117
|
-
};
|
|
118
|
-
const getClassNameExtention = () => {
|
|
119
|
-
if (disabled) return 'disabled';
|
|
120
|
-
if (mouseDownPressed) return 'mouseDownPressed';
|
|
121
|
-
return '';
|
|
122
|
-
};
|
|
123
102
|
const onClickHandler = event => {
|
|
124
103
|
if (disabled) return;
|
|
125
104
|
onClick(event);
|
|
@@ -128,14 +107,10 @@ const IconButton = props => {
|
|
|
128
107
|
onCancelClick(event);
|
|
129
108
|
};
|
|
130
109
|
return /*#__PURE__*/_react.default.createElement(_IconButton.ButtonWrapper, null, /*#__PURE__*/_react.default.createElement(_IconButton.IconButtonContainer, {
|
|
131
|
-
className: getClassNameExtention(),
|
|
132
110
|
backgroundColor: backgroundColor,
|
|
133
111
|
borderColor: borderColor,
|
|
134
112
|
borderRadius: borderRadius,
|
|
135
113
|
color: contentColor,
|
|
136
|
-
onMouseDown: onMouseDownHandler,
|
|
137
|
-
onMouseUp: onMouseUpHandler,
|
|
138
|
-
onPointerOut: onPointerOutHandler,
|
|
139
114
|
inProgress: showProcess,
|
|
140
115
|
progress: progress,
|
|
141
116
|
onClick: event => {
|
|
@@ -148,7 +123,8 @@ const IconButton = props => {
|
|
|
148
123
|
exports.IconButton = IconButton;
|
|
149
124
|
var _default = exports.default = IconButton;
|
|
150
125
|
IconButton.defaultProps = {
|
|
151
|
-
downloadStatus: '',
|
|
126
|
+
// downloadStatus: '',
|
|
127
|
+
showProcess: false,
|
|
152
128
|
buttonText: '',
|
|
153
129
|
iconName: 'eye',
|
|
154
130
|
contentColor: '#212121',
|