@uppy/status-bar
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -228,3 +228,3 @@ "use strict"; | ||
function UnknownProgressDetails(props) { | ||
function FileUploadCount(props) { | ||
const { | ||
@@ -309,3 +309,3 @@ i18n, | ||
return h(UnknownProgressDetails, { | ||
return h(FileUploadCount, { | ||
i18n: i18n, | ||
@@ -362,3 +362,5 @@ complete: complete, | ||
error, | ||
i18n | ||
i18n, | ||
complete, | ||
numUploads | ||
} = props; | ||
@@ -374,8 +376,3 @@ | ||
className: "uppy-StatusBar-content", | ||
role: "alert", | ||
title: i18n('uploadFailed') | ||
}, h("div", { | ||
className: "uppy-StatusBar-status" | ||
}, h("div", { | ||
className: "uppy-StatusBar-statusPrimary" | ||
}, h("svg", { | ||
@@ -390,5 +387,9 @@ "aria-hidden": "true", | ||
d: "M4.278 5.5L0 1.222 1.222 0 5.5 4.278 9.778 0 11 1.222 6.722 5.5 11 9.778 9.778 11 5.5 6.722 1.222 11 0 9.778z" | ||
})), i18n('uploadFailed'))), h("button", { | ||
className: "uppy-StatusBar-details", | ||
"aria-label": error, | ||
})), h("div", { | ||
className: "uppy-StatusBar-status" | ||
}, h("div", { | ||
className: "uppy-StatusBar-statusPrimary" | ||
}, i18n('uploadFailed'), h("button", { | ||
className: "uppy-u-reset uppy-StatusBar-details", | ||
"aria-label": i18n('showErrorDetails'), | ||
"data-microtip-position": "top-right", | ||
@@ -398,3 +399,7 @@ "data-microtip-size": "medium", | ||
type: "button" | ||
}, "?")); | ||
}, "?")), h(FileUploadCount, { | ||
i18n: i18n, | ||
complete: complete, | ||
numUploads: numUploads | ||
}))); | ||
} | ||
@@ -401,0 +406,0 @@ |
@@ -18,2 +18,4 @@ "use strict"; | ||
const StatusBarUI = require('./StatusBar'); | ||
const locale = require('./locale.js'); | ||
/** | ||
@@ -47,35 +49,3 @@ * StatusBar: renders a status bar with upload/pause/resume/cancel/retry buttons, | ||
this.type = 'progressindicator'; | ||
this.defaultLocale = { | ||
strings: { | ||
uploading: 'Uploading', | ||
upload: 'Upload', | ||
complete: 'Complete', | ||
uploadFailed: 'Upload failed', | ||
paused: 'Paused', | ||
retry: 'Retry', | ||
retryUpload: 'Retry upload', | ||
cancel: 'Cancel', | ||
pause: 'Pause', | ||
resume: 'Resume', | ||
done: 'Done', | ||
filesUploadedOfTotal: { | ||
0: '%{complete} of %{smart_count} file uploaded', | ||
1: '%{complete} of %{smart_count} files uploaded' | ||
}, | ||
dataUploadedOfTotal: '%{complete} of %{total}', | ||
xTimeLeft: '%{time} left', | ||
uploadXFiles: { | ||
0: 'Upload %{smart_count} file', | ||
1: 'Upload %{smart_count} files' | ||
}, | ||
uploadXNewFiles: { | ||
0: 'Upload +%{smart_count} file', | ||
1: 'Upload +%{smart_count} files' | ||
}, | ||
xMoreFilesAdded: { | ||
0: '%{smart_count} more file added', | ||
1: '%{smart_count} more files added' | ||
} | ||
} | ||
}; // set default options | ||
this.defaultLocale = locale; // set default options | ||
@@ -136,3 +106,3 @@ const defaultOptions = { | ||
error, | ||
uploadState: getUploadingState(isAllErrored, isAllComplete, recoveredState, state.files || {}), | ||
uploadState: getUploadingState(error, isAllComplete, recoveredState, state.files || {}), | ||
allowNewUpload, | ||
@@ -194,3 +164,3 @@ totalProgress, | ||
}, _class.VERSION = "2.1.1", _temp); | ||
}, _class.VERSION = "2.1.2", _temp); | ||
@@ -218,4 +188,4 @@ function getTotalSpeed(files) { | ||
function getUploadingState(isAllErrored, isAllComplete, recoveredState, files) { | ||
if (isAllErrored) { | ||
function getUploadingState(error, isAllComplete, recoveredState, files) { | ||
if (error && !isAllComplete) { | ||
return statusBarStates.STATE_ERROR; | ||
@@ -222,0 +192,0 @@ } |
@@ -150,3 +150,3 @@ "use strict"; | ||
const showPauseResumeBtn = resumableUploads && !hidePauseResumeButton && uploadState === STATE_UPLOADING; | ||
const showRetryBtn = error && !hideRetryButton; | ||
const showRetryBtn = error && !isAllComplete && !hideRetryButton; | ||
const showDoneBtn = doneButtonHandler && uploadState === STATE_COMPLETE; | ||
@@ -191,3 +191,5 @@ const progressClassNames = classNames('uppy-StatusBar-progress', { | ||
error: error, | ||
i18n: i18n | ||
i18n: i18n, | ||
numUploads: numUploads, | ||
complete: complete | ||
}); | ||
@@ -194,0 +196,0 @@ |
{ | ||
"name": "@uppy/status-bar", | ||
"description": "A progress bar for Uppy, with many bells and whistles.", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"license": "MIT", | ||
@@ -30,3 +30,3 @@ "main": "lib/index.js", | ||
"@transloadit/prettier-bytes": "0.0.7", | ||
"@uppy/utils": "^4.0.3", | ||
"@uppy/utils": "^4.0.4", | ||
"classnames": "^2.2.6", | ||
@@ -37,5 +37,4 @@ "lodash.throttle": "^4.1.1", | ||
"peerDependencies": { | ||
"@uppy/core": "^2.0.0" | ||
}, | ||
"gitHead": "b8b4127bd55b8e7395889048407c074fce944295" | ||
} | ||
"@uppy/core": "^2.1.3" | ||
} | ||
} |
@@ -31,9 +31,8 @@ const classNames = require('classnames') | ||
}, | ||
{ 'uppy-StatusBar-actionBtn--disabled': isSomeGhost } | ||
{ 'uppy-StatusBar-actionBtn--disabled': isSomeGhost }, | ||
) | ||
const uploadBtnText | ||
= newFiles && isUploadStarted && !recoveredState | ||
? i18n('uploadXNewFiles', { smart_count: newFiles }) | ||
: i18n('uploadXFiles', { smart_count: newFiles }) | ||
const uploadBtnText = newFiles && isUploadStarted && !recoveredState | ||
? i18n('uploadXNewFiles', { smart_count: newFiles }) | ||
: i18n('uploadXFiles', { smart_count: newFiles }) | ||
@@ -251,3 +250,3 @@ return ( | ||
function UnknownProgressDetails (props) { | ||
function FileUploadCount (props) { | ||
const { i18n, complete, numUploads } = props | ||
@@ -268,3 +267,3 @@ | ||
'uppy-StatusBar-actionBtn', | ||
'uppy-StatusBar-actionBtn--uploadNewlyAdded' | ||
'uppy-StatusBar-actionBtn--uploadNewlyAdded', | ||
) | ||
@@ -334,3 +333,3 @@ | ||
return ( | ||
<UnknownProgressDetails | ||
<FileUploadCount | ||
i18n={i18n} | ||
@@ -396,3 +395,3 @@ complete={complete} | ||
function ProgressBarError (props) { | ||
const { error, i18n } = props | ||
const { error, i18n, complete, numUploads } = props | ||
@@ -406,32 +405,31 @@ function displayErrorAlert () { | ||
return ( | ||
<div | ||
className="uppy-StatusBar-content" | ||
role="alert" | ||
title={i18n('uploadFailed')} | ||
> | ||
<div className="uppy-StatusBar-content" title={i18n('uploadFailed')}> | ||
<svg | ||
aria-hidden="true" | ||
focusable="false" | ||
className="uppy-StatusBar-statusIndicator uppy-c-icon" | ||
width="11" | ||
height="11" | ||
viewBox="0 0 11 11" | ||
> | ||
<path d="M4.278 5.5L0 1.222 1.222 0 5.5 4.278 9.778 0 11 1.222 6.722 5.5 11 9.778 9.778 11 5.5 6.722 1.222 11 0 9.778z" /> | ||
</svg> | ||
<div className="uppy-StatusBar-status"> | ||
<div className="uppy-StatusBar-statusPrimary"> | ||
<svg | ||
aria-hidden="true" | ||
focusable="false" | ||
className="uppy-StatusBar-statusIndicator uppy-c-icon" | ||
width="11" | ||
height="11" | ||
viewBox="0 0 11 11" | ||
{i18n('uploadFailed')} | ||
<button | ||
className="uppy-u-reset uppy-StatusBar-details" | ||
aria-label={i18n('showErrorDetails')} | ||
data-microtip-position="top-right" | ||
data-microtip-size="medium" | ||
onClick={displayErrorAlert} | ||
type="button" | ||
> | ||
<path d="M4.278 5.5L0 1.222 1.222 0 5.5 4.278 9.778 0 11 1.222 6.722 5.5 11 9.778 9.778 11 5.5 6.722 1.222 11 0 9.778z" /> | ||
</svg> | ||
{i18n('uploadFailed')} | ||
? | ||
</button> | ||
</div> | ||
<FileUploadCount i18n={i18n} complete={complete} numUploads={numUploads} /> | ||
</div> | ||
<button | ||
className="uppy-StatusBar-details" | ||
aria-label={error} | ||
data-microtip-position="top-right" | ||
data-microtip-size="medium" | ||
onClick={displayErrorAlert} | ||
type="button" | ||
> | ||
? | ||
</button> | ||
</div> | ||
@@ -438,0 +436,0 @@ ) |
@@ -8,2 +8,4 @@ const { UIPlugin } = require('@uppy/core') | ||
const locale = require('./locale.js') | ||
/** | ||
@@ -15,3 +17,3 @@ * StatusBar: renders a status bar with upload/pause/resume/cancel/retry buttons, | ||
// eslint-disable-next-line global-require | ||
static VERSION = require('../package.json').version; | ||
static VERSION = require('../package.json').version | ||
@@ -24,35 +26,3 @@ constructor (uppy, opts) { | ||
this.defaultLocale = { | ||
strings: { | ||
uploading: 'Uploading', | ||
upload: 'Upload', | ||
complete: 'Complete', | ||
uploadFailed: 'Upload failed', | ||
paused: 'Paused', | ||
retry: 'Retry', | ||
retryUpload: 'Retry upload', | ||
cancel: 'Cancel', | ||
pause: 'Pause', | ||
resume: 'Resume', | ||
done: 'Done', | ||
filesUploadedOfTotal: { | ||
0: '%{complete} of %{smart_count} file uploaded', | ||
1: '%{complete} of %{smart_count} files uploaded', | ||
}, | ||
dataUploadedOfTotal: '%{complete} of %{total}', | ||
xTimeLeft: '%{time} left', | ||
uploadXFiles: { | ||
0: 'Upload %{smart_count} file', | ||
1: 'Upload %{smart_count} files', | ||
}, | ||
uploadXNewFiles: { | ||
0: 'Upload +%{smart_count} file', | ||
1: 'Upload +%{smart_count} files', | ||
}, | ||
xMoreFilesAdded: { | ||
0: '%{smart_count} more file added', | ||
1: '%{smart_count} more files added', | ||
}, | ||
}, | ||
} | ||
this.defaultLocale = locale | ||
@@ -90,3 +60,3 @@ // set default options | ||
}) | ||
}; | ||
} | ||
@@ -138,6 +108,6 @@ render (state) { | ||
uploadState: getUploadingState( | ||
isAllErrored, | ||
error, | ||
isAllComplete, | ||
recoveredState, | ||
state.files || {} | ||
state.files || {}, | ||
), | ||
@@ -218,4 +188,4 @@ allowNewUpload, | ||
function getUploadingState (isAllErrored, isAllComplete, recoveredState, files) { | ||
if (isAllErrored) { | ||
function getUploadingState (error, isAllComplete, recoveredState, files) { | ||
if (error && !isAllComplete) { | ||
return statusBarStates.STATE_ERROR | ||
@@ -222,0 +192,0 @@ } |
@@ -127,4 +127,3 @@ const { h } = require('preact') | ||
const showUploadBtn | ||
= !error | ||
const showUploadBtn = !error | ||
&& newFiles | ||
@@ -136,13 +135,11 @@ && !isUploadInProgress | ||
const showCancelBtn | ||
= !hideCancelButton | ||
const showCancelBtn = !hideCancelButton | ||
&& uploadState !== STATE_WAITING | ||
&& uploadState !== STATE_COMPLETE | ||
const showPauseResumeBtn | ||
= resumableUploads | ||
const showPauseResumeBtn = resumableUploads | ||
&& !hidePauseResumeButton | ||
&& uploadState === STATE_UPLOADING | ||
const showRetryBtn = error && !hideRetryButton | ||
const showRetryBtn = error && !isAllComplete && !hideRetryButton | ||
@@ -159,3 +156,3 @@ const showDoneBtn = doneButtonHandler && uploadState === STATE_COMPLETE | ||
`is-${uploadState}`, | ||
{ 'has-ghosts': isSomeGhost } | ||
{ 'has-ghosts': isSomeGhost }, | ||
) | ||
@@ -180,11 +177,14 @@ | ||
case STATE_POSTPROCESSING: | ||
return <ProgressBarProcessing progress={calculateProcessingProgress(files)} /> | ||
case STATE_COMPLETE: | ||
return <ProgressBarComplete i18n={i18n} /> | ||
case STATE_ERROR: | ||
return ( | ||
<ProgressBarProcessing | ||
progress={calculateProcessingProgress(files)} | ||
<ProgressBarError | ||
error={error} | ||
i18n={i18n} | ||
numUploads={numUploads} | ||
complete={complete} | ||
/> | ||
) | ||
case STATE_COMPLETE: | ||
return <ProgressBarComplete i18n={i18n} /> | ||
case STATE_ERROR: | ||
return <ProgressBarError error={error} i18n={i18n} /> | ||
case STATE_UPLOADING: | ||
@@ -215,3 +215,3 @@ return ( | ||
<div className="uppy-StatusBar-actions"> | ||
{(recoveredState || showUploadBtn) ? ( | ||
{recoveredState || showUploadBtn ? ( | ||
<UploadBtn | ||
@@ -218,0 +218,0 @@ newFiles={newFiles} |
/* eslint-disable */ | ||
import type { Locale } from '@uppy/core' | ||
import type { Locale } from '@uppy/core' | ||
type StatusBarLocale = Locale< | ||
| 'uploading' | ||
| 'upload' | ||
type StatusBarLocale = Locale< | ||
| 'uploading' | ||
| 'complete' | ||
@@ -11,3 +10,2 @@ | 'uploadFailed' | ||
| 'retry' | ||
| 'retryUpload' | ||
| 'cancel' | ||
@@ -22,5 +20,8 @@ | 'pause' | ||
| 'uploadXNewFiles' | ||
| 'upload' | ||
| 'retryUpload' | ||
| 'xMoreFilesAdded' | ||
> | ||
| 'showErrorDetails' | ||
> | ||
export default StatusBarLocale | ||
export default StatusBarLocale |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
155096
28
2513
Updated@uppy/utils@^4.0.4