@scaleflex/widget-progress-panel 4.8.5 → 4.8.6

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.
@@ -1,151 +0,0 @@
1
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31;
2
- function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
3
- import styled, { css } from 'styled-components';
4
- import { FV, PC, PSH, Image } from '@scaleflex/widget-common';
5
- import { IconButton } from '@scaleflex/ui/core';
6
- import { Arrow as StyledArrow, Loading } from '@scaleflex/icons';
7
- var ProgressPanelContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: ", ";\n right: 20px;\n bottom: 0;\n width: 470px;\n transition: all 300ms ease-out;\n max-height: 360px;\n border-radius:", ";\n background-color: ", ";\n z-index: ", ";\n box-shadow: ", ";\n visibility: ", ";\n opacity: ", ";\n transform: ", ";\n"])), function (_ref) {
8
- var position = _ref.position;
9
- return position;
10
- }, function (_ref2) {
11
- var isMinimized = _ref2.isMinimized;
12
- return isMinimized ? '4px' : '0px 0px 4px 4px';
13
- }, function (_ref3) {
14
- var theme = _ref3.theme;
15
- return theme.palette[PC.BackgroundSecondary];
16
- }, function (_ref4) {
17
- var zIndex = _ref4.zIndex;
18
- return zIndex;
19
- }, function (_ref5) {
20
- var theme = _ref5.theme;
21
- return theme.shadows[PSH.ShadowLg];
22
- }, function (_ref6) {
23
- var show = _ref6.show;
24
- return show ? 'visible' : 'hidden';
25
- }, function (_ref7) {
26
- var show = _ref7.show;
27
- return show ? 1 : 0;
28
- }, function (_ref8) {
29
- var show = _ref8.show;
30
- return show ? 'translate3d(0, -24px, 0)' : 'translate3d(0, 74px, 0)';
31
- });
32
- var ProgressPanelList = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n overflow: auto;\n max-height: 233px;\n"])));
33
- var ActionButtonsWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: inline-flex;\n column-gap: 12px;\n"])));
34
- var ActionButton = styled(IconButton)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: none;\n padding: 4px;\n width: 22px;\n height: 22px;\n background: ", ";\n border-radius: 50%;\n\n ", "\n\n &:hover {\n background-color: ", ";\n }\n\n &:focus {\n background-color: ", ";\n }\n\n &:active {\n background-color: ", ";\n }\n"])), function (_ref9) {
35
- var theme = _ref9.theme;
36
- return theme.palette[PC.IconsPrimary];
37
- }, function (_ref10) {
38
- var isResumeButton = _ref10.isResumeButton;
39
- return isResumeButton && css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n svg {\n margin-left: 2px;\n }\n "])));
40
- }, function (_ref11) {
41
- var theme = _ref11.theme;
42
- return theme.palette[PC.IconsPrimaryHover];
43
- }, function (_ref12) {
44
- var theme = _ref12.theme;
45
- return theme.palette[PC.IconsPrimaryHover];
46
- }, function (_ref13) {
47
- var theme = _ref13.theme;
48
- return theme.palette[PC.IconsPrimaryHover];
49
- });
50
- var ActivityStatus = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: inline-flex;\n"])));
51
-
52
- // TODO: remove this container when upload is updated to new implementation
53
- var ProgressPanelActivityContainer = styled.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n padding: 0px 16px;\n\n ", "\n\n ", "\n"])), function (_ref14) {
54
- var disableAction = _ref14.disableAction;
55
- return !disableAction && css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n &:hover {\n ", " {\n display: inline-flex;\n }\n ", " {\n display: none;\n }\n }\n"])), ActionButton, ActivityStatus);
56
- }, function (_ref15) {
57
- var disableAction = _ref15.disableAction;
58
- return !disableAction && css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n &:hover {\n background-color: ", " ;\n }\n cursor: pointer;\n "])), function (_ref16) {
59
- var theme = _ref16.theme;
60
- return theme.palette[PC.BackgroundHover];
61
- });
62
- });
63
- // TODO: rename to ProgressPanelActivityContainer upload is updated to new implementation
64
- var ProgressPanelActivityContainerNew = styled.div(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n padding: 0px 16px;\n\n ", "\n"])), function (_ref17) {
65
- var disableAction = _ref17.disableAction,
66
- showBackgroundHover = _ref17.showBackgroundHover,
67
- theme = _ref17.theme,
68
- showActivityButton = _ref17.showActivityButton;
69
- return !disableAction && css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n &:hover {\n ", " {\n display: inline-flex;\n }\n\n ", " {\n ", "\n }\n background-color: ", ";\n cursor:", ";\n }\n"])), ActionButton, ActivityStatus, showActivityButton && css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n display: none\n "]))), showBackgroundHover && theme.palette[PC.BackgroundHover], showBackgroundHover && 'pointer');
70
- });
71
- var ProgressPanelActivityWrapper = styled.div(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n padding: 12px 0px;\n"])));
72
- var ProgressPanelActivity = styled.div(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: space-between ;\n height: 22px;\n"])));
73
- var ActivityInfo = styled.div(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n column-gap: 12px;\n opacity: ", " ;\n"])), function (_ref18) {
74
- var $opacity = _ref18.$opacity;
75
- return $opacity;
76
- });
77
- var ProgressPanelHeader = styled.div(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 16px;\n gap: 10px;\n height: 48px;\n border-radius:", ";\n background:", ";\n color: ", ";\n"])), function (_ref19) {
78
- var isMinimized = _ref19.isMinimized;
79
- return isMinimized ? '4px' : '4px 4px 0px 0px';
80
- }, function (_ref20) {
81
- var palette = _ref20.theme.palette;
82
- return palette[PC.AccentPrimaryActive];
83
- }, function (_ref21) {
84
- var palette = _ref21.theme.palette;
85
- return palette[PC.BackgroundStateless];
86
- });
87
- var ProgressPanelInfo = styled.div(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral([""])));
88
- var ProgressPanelState = styled.span(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n ", "\n\n"])), function (_ref22) {
89
- var hasTotalEta = _ref22.hasTotalEta;
90
- return hasTotalEta && css(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n &:after {\n content: '\u2022';\n margin: 0 8px;\n }\n"])));
91
- });
92
- var ProgressPanelEta = styled.span(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n"])));
93
- var ProgressPanelActions = styled.div(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["\n display: flex;\n column-gap: 12px;\n"])));
94
- var Arrow = styled(StyledArrow)(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["\n transform: ", ";\n"])), function (_ref23) {
95
- var $isMinimized = _ref23.$isMinimized;
96
- return $isMinimized ? 'rotate(270deg)' : 'rotate(-270deg)';
97
- });
98
- var ProgressPanelIconButton = styled(IconButton)(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["\n color: ", ";\n\n &:hover,\n &:focus,\n &:active {\n background-color: ", ";\n color: ", ";\n }\n"])), function (_ref24) {
99
- var palette = _ref24.theme.palette;
100
- return palette[PC.IconsInvert];
101
- }, function (_ref25) {
102
- var palette = _ref25.theme.palette;
103
- return palette[PC.AccentPrimaryHover];
104
- }, function (_ref26) {
105
- var palette = _ref26.theme.palette;
106
- return palette[PC.IconsInvert];
107
- });
108
- var ActivityInfoMain = styled.div(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["\n display: flex;\n column-gap: 4px;\n line-height: 1.2;\n"])));
109
- var ActivityFileState = styled.span(_templateObject25 || (_templateObject25 = _taggedTemplateLiteral(["\n font-weight: 500;\n"])));
110
- var ActivityFileName = styled.span(_templateObject26 || (_templateObject26 = _taggedTemplateLiteral(["\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n max-width: 230px;\n"])));
111
- var NotificationContainer = styled.div(_templateObject27 || (_templateObject27 = _taggedTemplateLiteral(["\n padding: 0px 16px;\n background-color: ", ";\n"])), function (_ref27) {
112
- var palette = _ref27.theme.palette;
113
- return palette[PC.BackgroundBlue];
114
- });
115
- var NotificationWrapper = styled.div(_templateObject28 || (_templateObject28 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between ;\n"])));
116
- var NotificationText = styled.span(function (_ref28) {
117
- var _ref28$theme = _ref28.theme,
118
- palette = _ref28$theme.palette,
119
- typography = _ref28$theme.typography;
120
- return css(_templateObject29 || (_templateObject29 = _taggedTemplateLiteral(["\n max-width: 366px;\n ", ";\n color: ", ";\n"])), typography.font[FV.LabelMedium], palette[PC.TextInfo]);
121
- });
122
- var LoadingIcon = styled(Loading)(_templateObject30 || (_templateObject30 = _taggedTemplateLiteral(["\n animation: rotating-spinner 2s linear infinite;\n"])));
123
- var FileIcon = styled(Image)(_templateObject31 || (_templateObject31 = _taggedTemplateLiteral(["\n height: 22px;\n width: 22px;\n"])));
124
- var Styled = {
125
- ProgressPanelContainer: ProgressPanelContainer,
126
- ProgressPanelList: ProgressPanelList,
127
- ProgressPanelActivityContainer: ProgressPanelActivityContainer,
128
- ProgressPanelActivityContainerNew: ProgressPanelActivityContainerNew,
129
- ProgressPanelActivityWrapper: ProgressPanelActivityWrapper,
130
- ProgressPanelActivity: ProgressPanelActivity,
131
- ActivityInfo: ActivityInfo,
132
- ActivityInfoMain: ActivityInfoMain,
133
- ActivityFileState: ActivityFileState,
134
- ActivityFileName: ActivityFileName,
135
- ActivityStatus: ActivityStatus,
136
- ProgressPanelHeader: ProgressPanelHeader,
137
- ProgressPanelInfo: ProgressPanelInfo,
138
- ProgressPanelState: ProgressPanelState,
139
- ProgressPanelEta: ProgressPanelEta,
140
- ProgressPanelActions: ProgressPanelActions,
141
- ProgressPanelIconButton: ProgressPanelIconButton,
142
- Arrow: Arrow,
143
- ActionButtonsWrapper: ActionButtonsWrapper,
144
- ActionButton: ActionButton,
145
- NotificationContainer: NotificationContainer,
146
- NotificationWrapper: NotificationWrapper,
147
- NotificationText: NotificationText,
148
- LoadingIcon: LoadingIcon,
149
- FileIcon: FileIcon
150
- };
151
- export default Styled;
@@ -1,84 +0,0 @@
1
- import { Divider } from '@scaleflex/ui/core';
2
- import { PROGRESS_PANEL_STATUS } from '@scaleflex/widget-utils/lib/constants';
3
- import { useCore } from '@scaleflex/widget-core/lib/hooks';
4
- import { isProgressPanelActive } from '../progressPanel.slice';
5
- import ActivityActions from './ActivityActions';
6
- import ActivityStatus from './ActivityStatus';
7
- import ProgressPanelFileIcon from './common/ProgressPanelFileIcon';
8
- import Styled from '../ProgressPanel.styled';
9
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
- var Activity = function Activity(_ref) {
11
- var _activity$progress, _activity$progress2, _statusData$status, _statusData$PROGRESS_, _statusData$PROGRESS_2, _statusData$status2;
12
- var activity = _ref.activity,
13
- isLastItem = _ref.isLastItem,
14
- i18n = _ref.i18n,
15
- role = _ref.role;
16
- var _useCore = useCore(),
17
- emit = _useCore.emit;
18
- var id = activity.id,
19
- _activity$statusData = activity.statusData,
20
- statusData = _activity$statusData === void 0 ? {} : _activity$statusData,
21
- name = activity.name,
22
- _activity$hideRetryBu = activity.hideRetryButton,
23
- hideRetryButton = _activity$hideRetryBu === void 0 ? false : _activity$hideRetryBu;
24
- var percentage = activity === null || activity === void 0 ? void 0 : (_activity$progress = activity.progress) === null || _activity$progress === void 0 ? void 0 : _activity$progress.percentage;
25
- var status = activity === null || activity === void 0 ? void 0 : (_activity$progress2 = activity.progress) === null || _activity$progress2 === void 0 ? void 0 : _activity$progress2.status;
26
- var isStatusComplete = status === PROGRESS_PANEL_STATUS.COMPLETE;
27
- var actionButtons = (_statusData$status = statusData[status]) === null || _statusData$status === void 0 ? void 0 : _statusData$status.actionButtons;
28
- var completeActionButton = (_statusData$PROGRESS_ = statusData[PROGRESS_PANEL_STATUS.COMPLETE]) === null || _statusData$PROGRESS_ === void 0 ? void 0 : (_statusData$PROGRESS_2 = _statusData$PROGRESS_.actionButtons) === null || _statusData$PROGRESS_2 === void 0 ? void 0 : _statusData$PROGRESS_2[0];
29
- var hasCompleteActionButtons = isStatusComplete && !!completeActionButton;
30
- var almostCompleted = status === PROGRESS_PANEL_STATUS.PROGRESSING && percentage === 100;
31
- var isErrorStatus = status === PROGRESS_PANEL_STATUS.ERROR;
32
- var hideActivityRetryButton = isErrorStatus && hideRetryButton;
33
- var handleAction = function handleAction(event, activityActionType) {
34
- event.stopPropagation();
35
- emit('activity-action', {
36
- id: id,
37
- activity: activity,
38
- activityActionType: activityActionType
39
- });
40
- };
41
- var activityStatusLabel = i18n((_statusData$status2 = statusData[status]) === null || _statusData$status2 === void 0 ? void 0 : _statusData$status2.labelI18nKey);
42
- var activityTitle = name || activityStatusLabel || status;
43
- return /*#__PURE__*/_jsxs(Styled.ProgressPanelActivityContainerNew, {
44
- showActivityButton: !hideActivityRetryButton,
45
- disableAction: isStatusComplete && !actionButtons || almostCompleted,
46
- showBackgroundHover: hasCompleteActionButtons,
47
- onClick: hasCompleteActionButtons ? function (event) {
48
- return handleAction(event, completeActionButton.type);
49
- } : undefined,
50
- role: role,
51
- children: [/*#__PURE__*/_jsx(Styled.ProgressPanelActivityWrapper, {
52
- children: /*#__PURE__*/_jsxs(Styled.ProgressPanelActivity, {
53
- children: [/*#__PURE__*/_jsxs(Styled.ActivityInfo, {
54
- $opacity: isProgressPanelActive(status) && 0.7,
55
- "aria-label": activityTitle,
56
- title: activityTitle,
57
- children: [/*#__PURE__*/_jsx(ProgressPanelFileIcon, {
58
- activity: activity
59
- }), /*#__PURE__*/_jsxs(Styled.ActivityInfoMain, {
60
- children: [/*#__PURE__*/_jsx(Styled.ActivityFileState, {
61
- children: activityStatusLabel
62
- }), name && /*#__PURE__*/_jsx(Styled.ActivityFileName, {
63
- children: name
64
- })]
65
- })]
66
- }), !almostCompleted && /*#__PURE__*/_jsx(ActivityActions, {
67
- hideRetryButton: hideRetryButton,
68
- id: id,
69
- status: status,
70
- i18n: i18n,
71
- actionButtons: actionButtons,
72
- handleAction: handleAction
73
- }), /*#__PURE__*/_jsx(ActivityStatus, {
74
- status: status,
75
- statusTitle: activityStatusLabel,
76
- percentage: percentage,
77
- almostCompleted: almostCompleted,
78
- i18n: i18n
79
- })]
80
- })
81
- }), !isLastItem && /*#__PURE__*/_jsx(Divider, {})]
82
- });
83
- };
84
- export default Activity;
@@ -1,63 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- import { PROGRESS_PANEL_STATUS } from '@scaleflex/widget-utils/lib/constants';
8
- import CancelButton from './CancelButton';
9
- import { ACTIVITY_BUTTON_ICONS } from '../ProgressPanel.constants';
10
- import RetryButton from './RetryButton';
11
- import Styled from '../ProgressPanel.styled';
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- var ActivityActions = function ActivityActions(_ref) {
14
- var _activityActions$stat;
15
- var id = _ref.id,
16
- status = _ref.status,
17
- actionButtons = _ref.actionButtons,
18
- i18n = _ref.i18n,
19
- handleAction = _ref.handleAction,
20
- hideRetryButton = _ref.hideRetryButton;
21
- var activityActions = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, PROGRESS_PANEL_STATUS.PREPARING, function () {
22
- return /*#__PURE__*/_jsx(CancelButton, {
23
- id: id,
24
- i18n: i18n
25
- });
26
- }), PROGRESS_PANEL_STATUS.PROGRESSING, function () {
27
- return /*#__PURE__*/_jsx(CancelButton, {
28
- id: id,
29
- i18n: i18n
30
- });
31
- }), PROGRESS_PANEL_STATUS.PAUSED, function () {
32
- return /*#__PURE__*/_jsx(CancelButton, {
33
- id: id,
34
- i18n: i18n
35
- });
36
- }), PROGRESS_PANEL_STATUS.ERROR, function () {
37
- return !hideRetryButton && /*#__PURE__*/_jsx(RetryButton, {
38
- id: id,
39
- i18n: i18n
40
- });
41
- });
42
- return /*#__PURE__*/_jsxs(Styled.ActionButtonsWrapper, {
43
- children: [(_activityActions$stat = activityActions[status]) === null || _activityActions$stat === void 0 ? void 0 : _activityActions$stat.call(activityActions), actionButtons && actionButtons.map(function (button) {
44
- var ButtonIcon = ACTIVITY_BUTTON_ICONS[button.icon];
45
- return ButtonIcon && /*#__PURE__*/_jsx(Styled.ActionButton, {
46
- size: "sm",
47
- color: "primary",
48
- onClick: function onClick(event) {
49
- return handleAction(event, button.type);
50
- },
51
- "aria-label": i18n(button.titleI18nKey),
52
- title: i18n(button.titleI18nKey),
53
- isResumeButton: button.type === 'play',
54
- children: function children(iconProps) {
55
- return /*#__PURE__*/_jsx(ButtonIcon, _objectSpread(_objectSpread({}, iconProps), {}, {
56
- size: 12
57
- }));
58
- }
59
- }, i18n(button.titleI18nKey));
60
- })]
61
- });
62
- };
63
- export default ActivityActions;
@@ -1,39 +0,0 @@
1
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
2
- function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
3
- import styled, { css, keyframes } from 'styled-components';
4
- import { PC } from '@scaleflex/widget-common';
5
- var circulate = keyframes({
6
- '0%': {
7
- // let the progress start at the top of the ring
8
- transform: 'rotate(-90deg)'
9
- },
10
- '100%': {
11
- transform: 'rotate(270deg)'
12
- }
13
- });
14
- var CircularProgressRoot = styled.span(function (_ref) {
15
- var palette = _ref.theme.palette,
16
- determinate = _ref.determinate;
17
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-block;\n width: 22px;\n height: 22px;\n color: ", ";\n\n ", "\n\n ", "\n"])), palette[PC.Success], determinate && css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n transform: rotate(-90deg);\n transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n "]))), !determinate && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["animation: 0.5s linear 0s infinite normal none running ", ";"])), circulate));
18
- });
19
- var CircularProgressSvg = styled.svg(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: block\n"])));
20
- var CircularProgressTrack = styled.circle(function (_ref2) {
21
- var palette = _ref2.theme.palette,
22
- size = _ref2.size,
23
- thickness = _ref2.thickness;
24
- return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n cx: ", ";\n cy: ", ";\n r: ", ";\n fill: transparent;\n stroke: ", ";\n stroke-width: ", " ;\n"])), size, size, (size - thickness) / 2, palette[PC.BackgroundGrey], thickness);
25
- });
26
- var CircularProgress = styled.circle(function (_ref3) {
27
- var size = _ref3.size,
28
- thickness = _ref3.thickness,
29
- strokeDasharray = _ref3.strokeDasharray,
30
- strokeDashoffset = _ref3.strokeDashoffset;
31
- return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n cx: ", ";\n cy: ", ";\n r: ", ";\n fill: none;\n stroke: currentColor;\n stroke-dasharray: ", ";\n stroke-dashoffset: ", ";\n stroke-width: ", " ;\n transition: stroke-dashoffset 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n"])), size, size, (size - thickness) / 2, strokeDasharray, strokeDashoffset, thickness);
32
- });
33
- var Styled = {
34
- CircularProgressRoot: CircularProgressRoot,
35
- CircularProgress: CircularProgress,
36
- CircularProgressTrack: CircularProgressTrack,
37
- CircularProgressSvg: CircularProgressSvg
38
- };
39
- export default Styled;
@@ -1,37 +0,0 @@
1
- import { useMemo } from 'react';
2
- import Styled from './ActivityCircularProgress.styled';
3
- import StyledProgressPanel from '../../ProgressPanel.styled';
4
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
- var SIZE = 44;
6
- var ActivityCircularProgress = function ActivityCircularProgress(_ref) {
7
- var _ref$value = _ref.value,
8
- value = _ref$value === void 0 ? 0 : _ref$value,
9
- _ref$thickness = _ref.thickness,
10
- thickness = _ref$thickness === void 0 ? 6 : _ref$thickness,
11
- determinate = _ref.determinate,
12
- statusTitle = _ref.statusTitle;
13
- var circumference = useMemo(function () {
14
- return 2 * Math.PI * ((SIZE - thickness) / 2);
15
- }, [thickness]);
16
- return /*#__PURE__*/_jsx(StyledProgressPanel.ActivityStatus, {
17
- "aria-label": statusTitle,
18
- title: statusTitle,
19
- children: /*#__PURE__*/_jsx(Styled.CircularProgressRoot, {
20
- "aria-valuenow": value,
21
- determinate: determinate,
22
- children: /*#__PURE__*/_jsxs(Styled.CircularProgressSvg, {
23
- viewBox: "22 22 44 44",
24
- children: [/*#__PURE__*/_jsx(Styled.CircularProgressTrack, {
25
- size: SIZE,
26
- thickness: thickness
27
- }), /*#__PURE__*/_jsx(Styled.CircularProgress, {
28
- size: SIZE,
29
- thickness: thickness,
30
- strokeDasharray: circumference.toFixed(3),
31
- strokeDashoffset: ((100 - value) / 100 * circumference).toFixed(3)
32
- })]
33
- })
34
- })
35
- });
36
- };
37
- export default ActivityCircularProgress;
@@ -1,51 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
3
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
4
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
- import { useTheme } from '@scaleflex/ui/theme/hooks';
6
- import { Success, WarningRound } from '@scaleflex/icons';
7
- import { PC } from '@scaleflex/widget-common';
8
- import { PROGRESS_PANEL_STATUS } from '@scaleflex/widget-utils/lib/constants';
9
- import Styled from '../ProgressPanel.styled';
10
- import ActivityCircularProgress from './ActivityCircularProgress';
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
- var activityStatusToComponent = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, PROGRESS_PANEL_STATUS.PREPARING, ActivityCircularProgress), PROGRESS_PANEL_STATUS.PROGRESSING, ActivityCircularProgress), PROGRESS_PANEL_STATUS.PAUSED, ActivityCircularProgress), PROGRESS_PANEL_STATUS.DELAYED, function (_ref) {
13
- var theme = _ref.theme;
14
- return /*#__PURE__*/_jsx(Success, {
15
- size: 22,
16
- color: theme.palette[PC.Success]
17
- });
18
- }), PROGRESS_PANEL_STATUS.COMPLETE, function (_ref2) {
19
- var theme = _ref2.theme;
20
- return /*#__PURE__*/_jsx(Success, {
21
- size: 22,
22
- color: theme.palette[PC.Success]
23
- });
24
- }), PROGRESS_PANEL_STATUS.ERROR, function (_ref3) {
25
- var theme = _ref3.theme;
26
- return /*#__PURE__*/_jsx(WarningRound, {
27
- size: 22,
28
- color: theme.palette[PC.Error]
29
- });
30
- });
31
- var ActivityStatus = function ActivityStatus(_ref4) {
32
- var status = _ref4.status,
33
- statusTitle = _ref4.statusTitle,
34
- percentage = _ref4.percentage,
35
- almostCompleted = _ref4.almostCompleted,
36
- i18n = _ref4.i18n;
37
- var theme = useTheme();
38
- var indeterminate = status === PROGRESS_PANEL_STATUS.PREPARING || almostCompleted;
39
- var title = statusTitle || status;
40
- var ActivityStatusComp = activityStatusToComponent[status];
41
- return /*#__PURE__*/_jsx(Styled.ActivityStatus, {
42
- title: title,
43
- children: ActivityStatusComp && /*#__PURE__*/_jsx(ActivityStatusComp, {
44
- theme: theme,
45
- value: indeterminate ? 25 : percentage,
46
- determinate: !indeterminate,
47
- statusTitle: almostCompleted ? i18n('progressPanelAssetProcessingTitle') : title
48
- })
49
- });
50
- };
51
- export default ActivityStatus;
@@ -1,34 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- import { Cross } from '@scaleflex/icons';
8
- import { useCore } from '@scaleflex/widget-core/lib/hooks';
9
- import Styled from '../ProgressPanel.styled';
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- var CancelButton = function CancelButton(_ref) {
12
- var id = _ref.id,
13
- i18n = _ref.i18n;
14
- var _useCore = useCore(),
15
- emit = _useCore.emit;
16
- var handleCancel = function handleCancel() {
17
- emit('activity-cancel', {
18
- id: id
19
- });
20
- };
21
- return /*#__PURE__*/_jsx(Styled.ActionButton, {
22
- size: "sm",
23
- color: "primary",
24
- onClick: handleCancel,
25
- "aria-label": i18n('progressPanelProgressActionTitle'),
26
- title: i18n('progressPanelProgressActionTitle'),
27
- children: function children(iconProps) {
28
- return /*#__PURE__*/_jsx(Cross, _objectSpread(_objectSpread({}, iconProps), {}, {
29
- size: 12
30
- }));
31
- }
32
- });
33
- };
34
- export default CancelButton;
@@ -1,71 +0,0 @@
1
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
- import { useEffect, useState } from 'react';
8
- import { useSelector } from 'react-redux';
9
- import { VirtualList } from '@scaleflex/widget-common';
10
- import { EVENTS } from '@scaleflex/widget-utils/lib/constants';
11
- import { useCore } from '@scaleflex/widget-core/lib/hooks';
12
- import { selectProgressPanelActivitiesIds, selectIsProgressPanelMinimized, selectShowProgressPanel, selectProgressPanelDelayedActivitiesIds } from '../progressPanel.slice';
13
- import ProgressPanelItem from './ProgressPanelItem';
14
- import ProgressPanelHeader from './ProgressPanelHeader';
15
- import Styled from '../ProgressPanel.styled';
16
- import UploadDelayedNotification from './UploadDelayedNotification';
17
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
- var ProgressPanel = function ProgressPanel(_ref) {
19
- var i18n = _ref.i18n,
20
- _ref$zIndex = _ref.zIndex,
21
- zIndex = _ref$zIndex === void 0 ? 9999 : _ref$zIndex,
22
- _ref$position = _ref.position,
23
- position = _ref$position === void 0 ? 'fixed' : _ref$position;
24
- var _useCore = useCore(),
25
- on = _useCore.on,
26
- off = _useCore.off;
27
- var progressPanelActivitiesIds = useSelector(selectProgressPanelActivitiesIds);
28
- var isPanelMinimized = useSelector(selectIsProgressPanelMinimized);
29
- var showProgressPanel = useSelector(selectShowProgressPanel);
30
- var progressPanelDelayedActivitiesIds = useSelector(selectProgressPanelDelayedActivitiesIds);
31
- var _useState = useState(),
32
- _useState2 = _slicedToArray(_useState, 2),
33
- style = _useState2[0],
34
- setStyle = _useState2[1];
35
- var handleOnStyleChange = function handleOnStyleChange(newStyle) {
36
- setStyle(newStyle);
37
- };
38
- useEffect(function () {
39
- on(EVENTS.CHANGE_PROGRESS_PANEL_STYLE, handleOnStyleChange);
40
- return function () {
41
- off(EVENTS.CHANGE_PROGRESS_PANEL_STYLE, handleOnStyleChange);
42
- };
43
- }, []);
44
- return /*#__PURE__*/_jsxs(Styled.ProgressPanelContainer, {
45
- className: "filerobot-progressPanel",
46
- zIndex: zIndex,
47
- show: showProgressPanel,
48
- isMinimized: isPanelMinimized,
49
- position: position,
50
- style: style,
51
- role: "dialog",
52
- "aria-label": "Progress panel",
53
- children: [/*#__PURE__*/_jsx(ProgressPanelHeader, {
54
- i18n: i18n
55
- }), progressPanelDelayedActivitiesIds.length > 0 && /*#__PURE__*/_jsx(UploadDelayedNotification, {
56
- i18n: i18n
57
- }), !isPanelMinimized && /*#__PURE__*/_jsx(Styled.ProgressPanelList, {
58
- role: "list",
59
- children: /*#__PURE__*/_jsx(VirtualList, {
60
- items: progressPanelActivitiesIds,
61
- injectedItemPropName: "activityId",
62
- children: /*#__PURE__*/_jsx(ProgressPanelItem, {
63
- itemsCount: progressPanelActivitiesIds.length,
64
- i18n: i18n,
65
- role: "listitem"
66
- })
67
- })
68
- })]
69
- });
70
- };
71
- export default ProgressPanel;
@@ -1,78 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- import { useSelector, useDispatch } from 'react-redux';
8
- import throttle from 'lodash.throttle';
9
- import { Cross } from '@scaleflex/icons';
10
- import prettyETA from '@scaleflex/widget-utils/lib/prettyETA';
11
- import { useCore } from '@scaleflex/widget-core/lib/hooks';
12
- import { selectProgressPanelInProgressActivitiesIds, selectProgressPanelCompletedActivitiesIds, selectProgressPanelTotalEta, selectIsProgressPanelMinimized, progressPanelMinimized, resetPanel } from '../progressPanel.slice';
13
- import Styled from '../ProgressPanel.styled';
14
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
- var ProgressPanelHeader = function ProgressPanelHeader(_ref) {
16
- var i18n = _ref.i18n;
17
- var dispatch = useDispatch();
18
- var _useCore = useCore(),
19
- cancelUploads = _useCore.cancelUploads,
20
- emit = _useCore.emit;
21
- var isPanelMinimized = useSelector(selectIsProgressPanelMinimized);
22
- var inProgressActivitiesIds = useSelector(selectProgressPanelInProgressActivitiesIds);
23
- var completedActivitiesIds = useSelector(selectProgressPanelCompletedActivitiesIds);
24
- var totalEta = useSelector(selectProgressPanelTotalEta);
25
- var togglePanel = function togglePanel() {
26
- dispatch(progressPanelMinimized(!isPanelMinimized));
27
- emit('progressPanel-minimize', !isPanelMinimized);
28
- };
29
- var closeProgressPanel = function closeProgressPanel() {
30
- dispatch(resetPanel());
31
- cancelUploads();
32
- };
33
- var ProgressPanelEta = throttle(function () {
34
- return /*#__PURE__*/_jsx(Styled.ProgressPanelEta, {
35
- children: i18n('progressPanelEtaLeftText', {
36
- time: prettyETA(totalEta)
37
- })
38
- });
39
- }, 500, {
40
- leading: true,
41
- trailing: true
42
- });
43
- var isPanelActive = inProgressActivitiesIds.length;
44
- var panelItems = isPanelActive ? inProgressActivitiesIds : completedActivitiesIds;
45
- return /*#__PURE__*/_jsxs(Styled.ProgressPanelHeader, {
46
- isMinimized: isPanelMinimized,
47
- children: [/*#__PURE__*/_jsxs(Styled.ProgressPanelInfo, {
48
- children: [/*#__PURE__*/_jsx(Styled.ProgressPanelState, {
49
- hasTotalEta: !!totalEta,
50
- children: "".concat(isPanelActive ? i18n('progressPanelProcessingHeaderLabel') : i18n('progressPanelProcessedHeaderLabel'), "\n (").concat(panelItems.length, " ").concat(i18n('progressPanelHeaderItemsText', {
51
- smart_count: panelItems.length
52
- }), ")")
53
- }), !!totalEta && /*#__PURE__*/_jsx(ProgressPanelEta, {})]
54
- }), /*#__PURE__*/_jsxs(Styled.ProgressPanelActions, {
55
- children: [/*#__PURE__*/_jsx(Styled.ProgressPanelIconButton, {
56
- onClick: togglePanel,
57
- size: "xs",
58
- color: "basic",
59
- children: function children(iconProps) {
60
- return /*#__PURE__*/_jsx(Styled.Arrow, _objectSpread(_objectSpread({}, iconProps), {}, {
61
- $isMinimized: isPanelMinimized,
62
- size: 12
63
- }));
64
- }
65
- }), !isPanelActive && /*#__PURE__*/_jsx(Styled.ProgressPanelIconButton, {
66
- onClick: closeProgressPanel,
67
- size: "xs",
68
- color: "basic",
69
- children: function children(iconProps) {
70
- return /*#__PURE__*/_jsx(Cross, _objectSpread(_objectSpread({}, iconProps), {}, {
71
- size: 12
72
- }));
73
- }
74
- })]
75
- })]
76
- });
77
- };
78
- export default ProgressPanelHeader;
@@ -1,21 +0,0 @@
1
- import { useSelector } from 'react-redux';
2
- import { selectProgressPanelActivityById } from '../progressPanel.slice';
3
- import Activity from './Activity';
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- var ProgressPanelItem = function ProgressPanelItem(_ref) {
6
- var activityId = _ref.activityId,
7
- index = _ref.index,
8
- itemsCount = _ref.itemsCount,
9
- i18n = _ref.i18n,
10
- role = _ref.role;
11
- var activity = useSelector(function (state) {
12
- return selectProgressPanelActivityById(state, activityId);
13
- });
14
- return /*#__PURE__*/_jsx(Activity, {
15
- activity: activity,
16
- isLastItem: index === itemsCount - 1,
17
- i18n: i18n,
18
- role: role
19
- }, activity.id);
20
- };
21
- export default ProgressPanelItem;