@scaleflex/widget-progress-panel 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 scaleflex
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,242 @@
1
+ # `@scaleflex/widget-progress-panel`
2
+
3
+ [![Plugins][plugins-image]](#plugins)
4
+ [![Website][filerobot-image]][sfx-url]
5
+ [![Version][filerobot-version]][version-url]
6
+ [![Scaleflex team][made-by-image]][sfx-url]
7
+ [![License][license-image]][license-url]
8
+ [![CodeSandbox][codeSandbox-image]][codeSandbox-url]
9
+
10
+ <div align='center'>
11
+ <img title="Scaleflex Widget logo" alt="Scaleflex Widget logo" src="https://cdn.scaleflex.com/plugins/filerobot-widget/assets/filerobot_widget_logo_with_fire.png?vh=b2ff09" width="140"/>
12
+ </div>
13
+
14
+ A panel showing the progress of uploading, downloading, transforming with possibility to cancel/retry/show location in [Scaleflex Media Asset Widget](https://www.npmjs.com/package/@scaleflex/widget-core).
15
+
16
+ ## Usage
17
+
18
+ ### NPM
19
+
20
+ ```bash
21
+ npm install --save @scaleflex/widget-progress-panel
22
+ ```
23
+
24
+ ### YARN
25
+
26
+ ```bash
27
+ yarn add @scaleflex/widget-progress-panel
28
+ ```
29
+
30
+ then
31
+
32
+ ```js
33
+ import ProgressPanel from '@scaleflex/widget-progress-panel'
34
+ ...
35
+ ...
36
+ ...
37
+ scaleflexWidget.use(ProgressPanel, propertiesObject)
38
+ ```
39
+
40
+ ### From CDN
41
+
42
+ The plugin from CDN is found inside `Scaleflex` global object `Scaleflex.ProgressPanel`
43
+
44
+ ```js
45
+ const ProgressPanel = window.ScaleflexWidget.ProgressPanel
46
+ ...
47
+ ...
48
+ ...
49
+ scaleflexWidget.use(ProgressPanel, propertiesObject)
50
+ ```
51
+
52
+ > If you are using [`@scaleflex/widget-explorer`](../@scaleflex/widget-explorer/#scaleflexwidgetexplorer) plugin you don't need to manually import this plugin as it is being imported automatically there with its styles and the default id `ProgressPanel`.
53
+
54
+ ### Plugin's styles
55
+
56
+ ```js
57
+ import "@scaleflex/widget-core/dist/style.css";
58
+ ```
59
+
60
+ or if you prefer the minified version
61
+
62
+ ```js
63
+ import "@scaleflex/widget-core/dist/style.min.css";
64
+ ```
65
+
66
+ > The plugin's css file should be imported after the [Core's css file](../@scaleflex/widget-core/#modules-styles) for having the styles shown correctly.
67
+
68
+ ### Example
69
+
70
+ ```js
71
+ const ScaleflexWidget = window.ScaleflexWidget;
72
+ const demoContainer = "scaleflex-tests-v5a";
73
+ const demoSecurityTemplateId = "......";
74
+
75
+ const widgetInstance = ScaleflexWidget.Core({
76
+ securityTemplateId: demoSecurityTemplateId,
77
+ container: demoContainer,
78
+ dev: false, // optional, default: false
79
+ });
80
+
81
+ const Explorer = ScaleflexWidget.Explorer;
82
+ const ProgressPanel = ScaleflexWidget.ProgressPanel
83
+ const XHRUpload = ScaleflexWidget.XHRUpload
84
+
85
+ widgetInstance
86
+ .use(Explorer, { target: "#scaleflex-widget", inline: true })
87
+ .use(ProgressPanel, {
88
+ target: '#scaleflex-widget-progress-panel',
89
+ });
90
+ .use(XHRUpload)
91
+ ```
92
+
93
+ ## Properties
94
+
95
+ ### `target`
96
+
97
+ <u>Type:</u> `string`
98
+
99
+ <u>Default:</u> `undefined`
100
+
101
+ The selector (ID, Class) of an HTML element or an existed HTML element that would be used for displaying the plugin.
102
+
103
+ > **NOTE** If no target provided, it wll show inside [Explorer](../@scaleflex/widget-explorer).
104
+
105
+ ### `locale`
106
+
107
+ <u>Type:</u> `object`.
108
+
109
+ <u>Default:</u>
110
+
111
+ ```js
112
+ strings: {
113
+ progressPanelProcessingHeaderLabel: 'Processing',
114
+ progressPanelProcessedHeaderLabel: 'Processed',
115
+ progressPanelHeaderItemsText: {
116
+ 0: 'item',
117
+ 1: 'items'
118
+ },
119
+ progressPanelEtaLeftText: '%{time} left',
120
+ progressPanelActivityCompleteLabel: 'Uploaded',
121
+ progressPanelActivityErrorLabel: 'Uploading failed',
122
+ progressPanelActivityProgressLabel: 'Uploading',
123
+ progressPanelCompleteActionTitle: 'Show file location',
124
+ progressPanelVideoActivityCompleteActionTitle: 'Show link',
125
+ progressPanelErrorActionTitle: 'Retry',
126
+ progressPanelProgressActionTitle: 'Cancel',
127
+ progressPanelPauseActionTitle: 'Pause',
128
+ progressPanelResumeActionTitle: 'Resume',
129
+ progressPanelAssetProcessingTitle: 'Asset is being processed',
130
+ uploadDelayedHint: 'It takes few seconds to complete processing, after you can use your uploaded assets.',
131
+ progressPanelArchiveCompleteLabel: 'Completed archive',
132
+ progressPanelArchiveFailedLabel: 'Failed archive',
133
+ progressPanelPreparingArchiveLabel: 'Preparing archive',
134
+ progressPanelDownloadingArchiveLabel: 'Downloading archive',
135
+ progressPanelDownloadingActivityLabel: 'Downloading',
136
+ progressPanelDownloadingActivityErrorLabel: 'Downloading failed',
137
+ progressPanelDownloadingActivityCompleteLabel: 'Downloaded',
138
+ progressPanelTranscodeActivityLabel: 'Transcoding',
139
+ progressPanelTranscodedActivityLabel: 'Transcoded',
140
+ progressPanelTranscodeErrorActivityLabel: 'Transcoding failed',
141
+ progressPanelCompressActivityLabel: 'Compressing',
142
+ progressPanelCompressedActivityLabel: 'Compressed',
143
+ progressPanelCompressErrorActivityLabel: 'Compressing failed',
144
+ progressPanelConvertActivityLabel: 'Converting',
145
+ progressPanelConvertedActivityLabel: 'Converted',
146
+ progressPanelConvertErrorActivityLabel: 'Converting failed',
147
+ progressPanelPreparingCsvActivityLabel: 'Preparing CSV',
148
+ progressPanelProcessingCsvActivityLabel: 'Processing CSV',
149
+ progressPanelProcessingCsvActivityErrorLabel: 'Processing CSV failed',
150
+ progressPanelProcessedCsvActivityLabel: 'Processed CSV'
151
+ }
152
+ ```
153
+
154
+ Customizing some of the translations or the language's strings and replace the default locale.
155
+
156
+ ## Events
157
+
158
+ The progress panel plugin emits different events that you could subscribe to or add your handler to be called with the provided arguments passed while emitting/firing the event, the events are listed below with examples show the parameters for handler:
159
+
160
+ ### `progressPanel-minimize`
161
+
162
+ Emitted when progress panel is minimized.
163
+
164
+ - `value`: minimize value true/false.
165
+
166
+ ### `progressPanel-toggle`
167
+
168
+ Emitted when progress panel is opened/closed.
169
+
170
+ - `value`: toggle value true/false.
171
+
172
+ ### `activities-reset`
173
+
174
+ Emitted when progress panel is closed.
175
+
176
+ ### `activity-progress`
177
+
178
+ Emitted when activity is on progress.
179
+
180
+ `params: object`:
181
+
182
+ - `id`: activity id.
183
+ - `percentage`: activity progress percentage.
184
+
185
+ ### `activity-update`
186
+
187
+ Emitted when activity is updated.
188
+
189
+ `params: object`:
190
+
191
+ - `id`: activity id.
192
+ - `progress`: activity progress details.
193
+
194
+ ### `activity-action`
195
+
196
+ Emitted when activity action button is clicked.
197
+
198
+ `params: object`:
199
+
200
+ - `id`: activity id.
201
+ - `activity`: whole activity details.
202
+ - `activityActionType`: action type(locate, play, pause, embed).
203
+
204
+ ### `activity-error`
205
+
206
+ Emitted when activity has an error.
207
+
208
+ `params: object`:
209
+
210
+ - `id`: activity id.
211
+ - `error`: error details.
212
+
213
+ ### `activity-retry`
214
+
215
+ Emitted when activity is retried.
216
+
217
+ `params: object`:
218
+
219
+ - `id`: activity id.
220
+
221
+ ### `activity-cancel`
222
+
223
+ Emitted when activity is cancelled.
224
+
225
+ `params: object`:
226
+
227
+ - `id`: activity id.
228
+
229
+ <!-- Variables -->
230
+
231
+ [npm-url]: https://www.npmjs.com/package/@scaleflex/widget-progress-panel
232
+ [license-url]: https://opensource.org/licenses/MIT
233
+ [sfx-url]: https://www.scaleflex.com/
234
+ [version-url]: https://www.npmjs.com/package/@scaleflex/widget-progress-panel
235
+ [codeSandbox-url]: https://codesandbox.io/s/filerobot-widget-v3-c5l9th
236
+ [npm-image]: https://img.shields.io/npm/v/@telus/remark-config.svg?style=for-the-badge&logo=npm
237
+ [license-image]: https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge
238
+ [made-by-image]: https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-the%20Scaleflex%20team-6986fa.svg?style=for-the-badge
239
+ [plugins-image]: https://img.shields.io/static/v1?label=Scaleflex&message=Plugins&color=yellow&style=for-the-badge
240
+ [filerobot-image]: https://img.shields.io/static/v1?label=Scaleflex&message=website&color=orange&style=for-the-badge
241
+ [filerobot-version]: https://img.shields.io/npm/v/@scaleflex/widget-progress-panel?label=Version&style=for-the-badge&logo=npm
242
+ [codeSandbox-image]: https://img.shields.io/badge/CodeSandbox-black?style=for-the-badge&logo=CodeSandbox
@@ -0,0 +1,56 @@
1
+ import { Video2, Link, Archieve, Image2, File2, Music, Documentation, Script, Csv, Target, Pause, Play, Font2 } from '@scaleflex/icons';
2
+ import { PC } from '@scaleflex/widget-common';
3
+ export var ACTIVITY_ICONS = {
4
+ Video: Video2,
5
+ Archive: Archieve,
6
+ Font2: Font2,
7
+ Image: Image2,
8
+ Csv: Csv
9
+ };
10
+ export var PROGRESS_PANEL_FILE_ICONS = {
11
+ image: {
12
+ icon: Image2,
13
+ iconColor: PC.Green
14
+ },
15
+ application: {
16
+ icon: File2,
17
+ iconColor: PC.Red
18
+ },
19
+ video: {
20
+ icon: Video2,
21
+ iconColor: PC.Instagram
22
+ },
23
+ audio: {
24
+ icon: Music,
25
+ iconColor: PC.Device
26
+ },
27
+ text: {
28
+ icon: Documentation,
29
+ iconColor: PC.GoogleDrive
30
+ },
31
+ archive: {
32
+ icon: Archieve,
33
+ iconColor: PC.Orange
34
+ },
35
+ script: {
36
+ icon: Script,
37
+ iconColor: PC.OneDrive
38
+ }
39
+ };
40
+ export var PROGRESS_PANEL_FILE_ICON_BY_EXT = {
41
+ zip: PROGRESS_PANEL_FILE_ICONS.archive,
42
+ rar: PROGRESS_PANEL_FILE_ICONS.archive,
43
+ tar: PROGRESS_PANEL_FILE_ICONS.archive,
44
+ gz: PROGRESS_PANEL_FILE_ICONS.archive,
45
+ js: PROGRESS_PANEL_FILE_ICONS.script,
46
+ py: PROGRESS_PANEL_FILE_ICONS.script,
47
+ jsx: PROGRESS_PANEL_FILE_ICONS.script,
48
+ tsx: PROGRESS_PANEL_FILE_ICONS.script,
49
+ php: PROGRESS_PANEL_FILE_ICONS.script
50
+ };
51
+ export var ACTIVITY_BUTTON_ICONS = {
52
+ Link: Link,
53
+ Target: Target,
54
+ Pause: Pause,
55
+ Play: Play
56
+ };
@@ -0,0 +1,151 @@
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;
@@ -0,0 +1,82 @@
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
+ var _useCore = useCore(),
16
+ emit = _useCore.emit;
17
+ var id = activity.id,
18
+ _activity$statusData = activity.statusData,
19
+ statusData = _activity$statusData === void 0 ? {} : _activity$statusData,
20
+ name = activity.name,
21
+ _activity$hideRetryBu = activity.hideRetryButton,
22
+ hideRetryButton = _activity$hideRetryBu === void 0 ? false : _activity$hideRetryBu;
23
+ var percentage = activity === null || activity === void 0 ? void 0 : (_activity$progress = activity.progress) === null || _activity$progress === void 0 ? void 0 : _activity$progress.percentage;
24
+ var status = activity === null || activity === void 0 ? void 0 : (_activity$progress2 = activity.progress) === null || _activity$progress2 === void 0 ? void 0 : _activity$progress2.status;
25
+ var isStatusComplete = status === PROGRESS_PANEL_STATUS.COMPLETE;
26
+ var actionButtons = (_statusData$status = statusData[status]) === null || _statusData$status === void 0 ? void 0 : _statusData$status.actionButtons;
27
+ 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];
28
+ var hasCompleteActionButtons = isStatusComplete && !!completeActionButton;
29
+ var almostCompleted = status === PROGRESS_PANEL_STATUS.PROGRESSING && percentage === 100;
30
+ var isErrorStatus = status === PROGRESS_PANEL_STATUS.ERROR;
31
+ var hideActivityRetryButton = isErrorStatus && hideRetryButton;
32
+ var handleAction = function handleAction(event, activityActionType) {
33
+ event.stopPropagation();
34
+ emit('activity-action', {
35
+ id: id,
36
+ activity: activity,
37
+ activityActionType: activityActionType
38
+ });
39
+ };
40
+ var activityStatusLabel = i18n((_statusData$status2 = statusData[status]) === null || _statusData$status2 === void 0 ? void 0 : _statusData$status2.labelI18nKey);
41
+ var activityTitle = name || activityStatusLabel || status;
42
+ return /*#__PURE__*/_jsxs(Styled.ProgressPanelActivityContainerNew, {
43
+ showActivityButton: !hideActivityRetryButton,
44
+ disableAction: isStatusComplete && !actionButtons || almostCompleted,
45
+ showBackgroundHover: hasCompleteActionButtons,
46
+ onClick: hasCompleteActionButtons ? function (event) {
47
+ return handleAction(event, completeActionButton.type);
48
+ } : undefined,
49
+ children: [/*#__PURE__*/_jsx(Styled.ProgressPanelActivityWrapper, {
50
+ children: /*#__PURE__*/_jsxs(Styled.ProgressPanelActivity, {
51
+ children: [/*#__PURE__*/_jsxs(Styled.ActivityInfo, {
52
+ $opacity: isProgressPanelActive(status) && 0.7,
53
+ "aria-label": activityTitle,
54
+ title: activityTitle,
55
+ children: [/*#__PURE__*/_jsx(ProgressPanelFileIcon, {
56
+ activity: activity
57
+ }), /*#__PURE__*/_jsxs(Styled.ActivityInfoMain, {
58
+ children: [/*#__PURE__*/_jsx(Styled.ActivityFileState, {
59
+ children: activityStatusLabel
60
+ }), name && /*#__PURE__*/_jsx(Styled.ActivityFileName, {
61
+ children: name
62
+ })]
63
+ })]
64
+ }), !almostCompleted && /*#__PURE__*/_jsx(ActivityActions, {
65
+ hideRetryButton: hideRetryButton,
66
+ id: id,
67
+ status: status,
68
+ i18n: i18n,
69
+ actionButtons: actionButtons,
70
+ handleAction: handleAction
71
+ }), /*#__PURE__*/_jsx(ActivityStatus, {
72
+ status: status,
73
+ statusTitle: activityStatusLabel,
74
+ percentage: percentage,
75
+ almostCompleted: almostCompleted,
76
+ i18n: i18n
77
+ })]
78
+ })
79
+ }), !isLastItem && /*#__PURE__*/_jsx(Divider, {})]
80
+ });
81
+ };
82
+ export default Activity;
@@ -0,0 +1,63 @@
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;
@@ -0,0 +1,39 @@
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;