sag_components 1.0.398 → 1.0.400
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.
|
@@ -27,25 +27,27 @@ const IconButton = props => {
|
|
|
27
27
|
iconWidth,
|
|
28
28
|
iconHeight,
|
|
29
29
|
disabled,
|
|
30
|
-
inProgress,
|
|
31
30
|
onClick,
|
|
32
31
|
onCancelClick
|
|
33
32
|
} = props;
|
|
34
33
|
const [mouseDownPressed, setMouseDownPressed] = (0, _react.useState)(false);
|
|
35
34
|
const [progress, setProgress] = (0, _react.useState)(0);
|
|
35
|
+
const [showProcess, setShowProcess] = (0, _react.useState)(false);
|
|
36
36
|
const incrementProgress = () => {
|
|
37
37
|
if (downloadStatus === 'in progress' && progress <= 90) {
|
|
38
38
|
const interval = setInterval(() => {
|
|
39
39
|
setProgress(prevProgress => {
|
|
40
|
-
const newProgress = prevProgress +
|
|
40
|
+
const newProgress = prevProgress + 3;
|
|
41
41
|
if (newProgress >= 90) {
|
|
42
42
|
clearInterval(interval);
|
|
43
43
|
}
|
|
44
44
|
return newProgress;
|
|
45
45
|
});
|
|
46
|
+
setShowProcess(true);
|
|
46
47
|
}, 500);
|
|
47
48
|
} else if (downloadStatus === 'success') {
|
|
48
49
|
setProgress(0);
|
|
50
|
+
setShowProcess(false);
|
|
49
51
|
}
|
|
50
52
|
};
|
|
51
53
|
(0, _react.useEffect)(() => {
|
|
@@ -133,20 +135,19 @@ const IconButton = props => {
|
|
|
133
135
|
onMouseDown: onMouseDownHandler,
|
|
134
136
|
onMouseUp: onMouseUpHandler,
|
|
135
137
|
onPointerOut: onPointerOutHandler,
|
|
136
|
-
inProgress:
|
|
138
|
+
inProgress: showProcess,
|
|
137
139
|
progress: progress,
|
|
138
140
|
onClick: event => {
|
|
139
141
|
onClickHandler(event);
|
|
140
142
|
}
|
|
141
|
-
}, getIcon(iconName), buttonText !== '' && buttonText !== undefined && /*#__PURE__*/_react.default.createElement(_IconButton.SpanText, null, buttonText)),
|
|
143
|
+
}, getIcon(iconName), buttonText !== '' && buttonText !== undefined && /*#__PURE__*/_react.default.createElement(_IconButton.SpanText, null, buttonText)), showProcess && /*#__PURE__*/_react.default.createElement(_IconButton.CancelClick, {
|
|
142
144
|
onClick: event => onCancelClickHandler(event)
|
|
143
145
|
}, "Click here to cancel"));
|
|
144
146
|
};
|
|
145
147
|
exports.IconButton = IconButton;
|
|
146
148
|
var _default = exports.default = IconButton;
|
|
147
149
|
IconButton.defaultProps = {
|
|
148
|
-
|
|
149
|
-
downloadStatus: 'in progress',
|
|
150
|
+
downloadStatus: 'fail',
|
|
150
151
|
buttonText: '',
|
|
151
152
|
iconName: 'eye',
|
|
152
153
|
contentColor: '#212121',
|
|
@@ -156,7 +157,6 @@ IconButton.defaultProps = {
|
|
|
156
157
|
iconHeight: 18,
|
|
157
158
|
iconWidth: 18,
|
|
158
159
|
disabled: false,
|
|
159
|
-
inProgress: false,
|
|
160
160
|
onClick: () => {},
|
|
161
161
|
onCancelClick: () => {}
|
|
162
162
|
};
|
|
@@ -12,4 +12,4 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
|
|
|
12
12
|
const ButtonWrapper = exports.ButtonWrapper = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: fit-content;\n text-align: center;\n"])));
|
|
13
13
|
const IconButtonContainer = exports.IconButtonContainer = _styledComponents.default.button(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n font-size: 14px;\n font-weight: 400;\n display: flex;\n gap: 10px;\n align-items: center;\n justify-content: center;\n padding: 12px 20px;\n margin-bottom: 5px;\n color: ", ";\n border-radius: ", ";\n border: 1px solid ", ";\n background: ", ";\n position: relative;\n transition: all .3s;\n ", "\n &:hover, &:focus {\n cursor: pointer;\n box-shadow: 5px 5px 10px 0px rgba(0, 0, 0, 0.1);\n }\n"])), props => props.color, props => props.borderRadius, props => props.borderColor.toString(), props => props.backgroundColor.toString(), props => props.inProgress && (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n pointer-events: none;\n &:after {\n content: 'In Progress';\n display: flex;\n align-items: center;\n justify-content: center;\n text-wrap: nowrap;\n position: absolute;\n background: linear-gradient(\n to right,\n #5FCC70 ", "%,\n #B1B1B1 ", "%,\n #B1B1B1 100%\n );\n width: 100%;\n height: 100%;\n border-radius: ", ";\n border-width: 0;\n z-index: 9;\n }\n "])), props.progress, props.progress + 1, props => props.borderRadius));
|
|
14
14
|
const SpanText = exports.SpanText = _styledComponents.default.span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n"])));
|
|
15
|
-
const CancelClick = exports.CancelClick = _styledComponents.default.span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n display: inherit;\n font-family: \"Lato\", sans-serif;;\n font-size: 14px;\n color: #568202;\n"])));
|
|
15
|
+
const CancelClick = exports.CancelClick = _styledComponents.default.span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n display: inherit;\n font-family: \"Lato\", sans-serif;;\n font-size: 14px;\n color: #568202;\n cursor: pointer;\n"])));
|