/
propTypes.js
61 lines (54 loc) · 1.53 KB
/
propTypes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import PropTypes from 'prop-types'
import { Uppy as UppyCore } from '@uppy/core'
// The `uppy` prop receives the Uppy core instance.
const uppy = PropTypes.instanceOf(UppyCore)
// A list of plugins to mount inside this component.
const plugins = PropTypes.arrayOf(PropTypes.string)
// Language strings for this component.
const locale = PropTypes.shape({
strings: PropTypes.object, // eslint-disable-line react/forbid-prop-types
pluralize: PropTypes.func,
})
// List of meta fields for the editor in the Dashboard.
const metaField = PropTypes.shape({
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
placeholder: PropTypes.string,
})
const metaFields = PropTypes.oneOfType([
PropTypes.arrayOf(metaField),
PropTypes.func,
])
// A size in pixels (number) or with some other unit (string).
const cssSize = PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
])
// Common props for dashboardy components (Dashboard and DashboardModal).
const dashboard = {
uppy,
inline: PropTypes.bool,
plugins,
width: cssSize,
height: cssSize,
showProgressDetails: PropTypes.bool,
hideUploadButton: PropTypes.bool,
hideProgressAfterFinish: PropTypes.bool,
note: PropTypes.string,
metaFields,
proudlyDisplayPoweredByUppy: PropTypes.bool,
disableStatusBar: PropTypes.bool,
disableInformer: PropTypes.bool,
disableThumbnailGenerator: PropTypes.bool,
// pass-through to ThumbnailGenerator
thumbnailWidth: PropTypes.number,
locale,
}
export {
uppy,
locale,
dashboard,
plugins,
metaFields,
cssSize,
}