@dhis2-ui/file-input 7.14.1 → 7.14.2
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/build/cjs/file-input/file-input.js +12 -141
- package/build/es/file-input/file-input.js +14 -143
- package/package.json +8 -7
|
@@ -9,7 +9,7 @@ var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
|
9
9
|
|
|
10
10
|
var _button = require("@dhis2-ui/button");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _statusIcon = require("@dhis2-ui/status-icon");
|
|
13
13
|
|
|
14
14
|
var _uiConstants = require("@dhis2/ui-constants");
|
|
15
15
|
|
|
@@ -29,139 +29,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
29
29
|
|
|
30
30
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
31
|
|
|
32
|
-
function Valid({
|
|
33
|
-
className
|
|
34
|
-
}) {
|
|
35
|
-
return /*#__PURE__*/_react.default.createElement(_uiIcons.IconCheckmark24, {
|
|
36
|
-
color: _uiConstants.theme.valid,
|
|
37
|
-
className: className
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
Valid.propTypes = {
|
|
42
|
-
className: _propTypes.default.string
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
function Warning({
|
|
46
|
-
className
|
|
47
|
-
}) {
|
|
48
|
-
return /*#__PURE__*/_react.default.createElement(_uiIcons.IconWarningFilled24, {
|
|
49
|
-
color: _uiConstants.theme.warning,
|
|
50
|
-
className: className
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
Warning.propTypes = {
|
|
55
|
-
className: _propTypes.default.string
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
function Error({
|
|
59
|
-
className
|
|
60
|
-
}) {
|
|
61
|
-
return /*#__PURE__*/_react.default.createElement(_uiIcons.IconErrorFilled24, {
|
|
62
|
-
color: _uiConstants.theme.error,
|
|
63
|
-
className: className
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
Error.propTypes = {
|
|
68
|
-
className: _propTypes.default.string
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
function Info({
|
|
72
|
-
className
|
|
73
|
-
}) {
|
|
74
|
-
return /*#__PURE__*/_react.default.createElement(_uiIcons.IconInfo24, {
|
|
75
|
-
color: _uiConstants.theme.info,
|
|
76
|
-
className: className
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
Info.propTypes = {
|
|
81
|
-
className: _propTypes.default.string
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
function Loading({
|
|
85
|
-
className
|
|
86
|
-
}) {
|
|
87
|
-
return /*#__PURE__*/_react.default.createElement(_loader.CircularLoader, {
|
|
88
|
-
small: true,
|
|
89
|
-
className: className
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
Loading.propTypes = {
|
|
94
|
-
className: _propTypes.default.string
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const StatusIcon = ({
|
|
98
|
-
error,
|
|
99
|
-
warning,
|
|
100
|
-
valid,
|
|
101
|
-
loading,
|
|
102
|
-
info,
|
|
103
|
-
className,
|
|
104
|
-
defaultTo
|
|
105
|
-
}) => {
|
|
106
|
-
if (error) {
|
|
107
|
-
return /*#__PURE__*/_react.default.createElement(Error, {
|
|
108
|
-
className: className
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (warning) {
|
|
113
|
-
return /*#__PURE__*/_react.default.createElement(Warning, {
|
|
114
|
-
className: className
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (valid) {
|
|
119
|
-
return /*#__PURE__*/_react.default.createElement(Valid, {
|
|
120
|
-
className: className
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (loading) {
|
|
125
|
-
return /*#__PURE__*/_react.default.createElement(Loading, {
|
|
126
|
-
className: className
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (info) {
|
|
131
|
-
return /*#__PURE__*/_react.default.createElement(Info, {
|
|
132
|
-
className: className
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return defaultTo;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
StatusIcon.defaultProps = {
|
|
140
|
-
defaultTo: null
|
|
141
|
-
};
|
|
142
|
-
StatusIcon.propTypes = {
|
|
143
|
-
className: _propTypes.default.string,
|
|
144
|
-
defaultTo: _propTypes.default.element,
|
|
145
|
-
error: _propTypes.default.bool,
|
|
146
|
-
info: _propTypes.default.bool,
|
|
147
|
-
loading: _propTypes.default.bool,
|
|
148
|
-
valid: _propTypes.default.bool,
|
|
149
|
-
warning: _propTypes.default.bool
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
function Upload({
|
|
153
|
-
className
|
|
154
|
-
}) {
|
|
155
|
-
return /*#__PURE__*/_react.default.createElement(_uiIcons.IconUpload24, {
|
|
156
|
-
color: _uiConstants.colors.grey700,
|
|
157
|
-
className: className
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
Upload.propTypes = {
|
|
162
|
-
className: _propTypes.default.string
|
|
163
|
-
};
|
|
164
|
-
|
|
165
32
|
class FileInput extends _react.Component {
|
|
166
33
|
constructor(...args) {
|
|
167
34
|
super(...args);
|
|
@@ -221,7 +88,9 @@ class FileInput extends _react.Component {
|
|
|
221
88
|
} = this.props;
|
|
222
89
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
223
90
|
"data-test": dataTest,
|
|
224
|
-
className: _style.default.dynamic([["
|
|
91
|
+
className: _style.default.dynamic([["1746996489", [_uiConstants.spacers.dp8, _uiConstants.spacers.dp4]]]) + " " + ((0, _classnames.default)('file-input', className) || "")
|
|
92
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
93
|
+
className: _style.default.dynamic([["1746996489", [_uiConstants.spacers.dp8, _uiConstants.spacers.dp4]]])
|
|
225
94
|
}, /*#__PURE__*/_react.default.createElement("input", {
|
|
226
95
|
id: name,
|
|
227
96
|
name: name,
|
|
@@ -231,10 +100,12 @@ class FileInput extends _react.Component {
|
|
|
231
100
|
accept: accept,
|
|
232
101
|
multiple: multiple,
|
|
233
102
|
disabled: disabled,
|
|
234
|
-
className: _style.default.dynamic([["
|
|
103
|
+
className: _style.default.dynamic([["1746996489", [_uiConstants.spacers.dp8, _uiConstants.spacers.dp4]]])
|
|
235
104
|
}), /*#__PURE__*/_react.default.createElement(_button.Button, {
|
|
236
105
|
disabled: disabled,
|
|
237
|
-
icon: /*#__PURE__*/_react.default.createElement(
|
|
106
|
+
icon: /*#__PURE__*/_react.default.createElement(_uiIcons.IconUpload24, {
|
|
107
|
+
color: _uiConstants.colors.grey700
|
|
108
|
+
}),
|
|
238
109
|
initialFocus: initialFocus,
|
|
239
110
|
large: large,
|
|
240
111
|
onBlur: this.handleBlur,
|
|
@@ -243,14 +114,14 @@ class FileInput extends _react.Component {
|
|
|
243
114
|
small: small,
|
|
244
115
|
tabIndex: tabIndex,
|
|
245
116
|
type: "button"
|
|
246
|
-
}, buttonLabel), /*#__PURE__*/_react.default.createElement(StatusIcon, {
|
|
117
|
+
}, buttonLabel)), /*#__PURE__*/_react.default.createElement(_statusIcon.StatusIcon, {
|
|
247
118
|
error: error,
|
|
248
119
|
valid: valid,
|
|
249
120
|
warning: warning
|
|
250
121
|
}), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
251
|
-
id: "
|
|
252
|
-
dynamic: [_uiConstants.spacers.
|
|
253
|
-
}, ["input.__jsx-style-dynamic-selector{display:none;}", `.file-input.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;
|
|
122
|
+
id: "1746996489",
|
|
123
|
+
dynamic: [_uiConstants.spacers.dp8, _uiConstants.spacers.dp4]
|
|
124
|
+
}, ["input.__jsx-style-dynamic-selector{display:none;}", `.file-input.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:${_uiConstants.spacers.dp8};padding-bottom:${_uiConstants.spacers.dp4};}`]));
|
|
254
125
|
}
|
|
255
126
|
|
|
256
127
|
}
|
|
@@ -3,146 +3,13 @@ import _JSXStyle from "styled-jsx/style";
|
|
|
3
3
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
4
|
|
|
5
5
|
import { Button } from '@dhis2-ui/button';
|
|
6
|
-
import {
|
|
7
|
-
import { colors,
|
|
8
|
-
import {
|
|
6
|
+
import { StatusIcon } from '@dhis2-ui/status-icon';
|
|
7
|
+
import { colors, spacers, sharedPropTypes } from '@dhis2/ui-constants';
|
|
8
|
+
import { IconUpload24 } from '@dhis2/ui-icons';
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import React, { createRef, Component } from 'react';
|
|
12
12
|
|
|
13
|
-
function Valid({
|
|
14
|
-
className
|
|
15
|
-
}) {
|
|
16
|
-
return /*#__PURE__*/React.createElement(IconCheckmark24, {
|
|
17
|
-
color: theme.valid,
|
|
18
|
-
className: className
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
Valid.propTypes = {
|
|
23
|
-
className: PropTypes.string
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
function Warning({
|
|
27
|
-
className
|
|
28
|
-
}) {
|
|
29
|
-
return /*#__PURE__*/React.createElement(IconWarningFilled24, {
|
|
30
|
-
color: theme.warning,
|
|
31
|
-
className: className
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
Warning.propTypes = {
|
|
36
|
-
className: PropTypes.string
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
function Error({
|
|
40
|
-
className
|
|
41
|
-
}) {
|
|
42
|
-
return /*#__PURE__*/React.createElement(IconErrorFilled24, {
|
|
43
|
-
color: theme.error,
|
|
44
|
-
className: className
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
Error.propTypes = {
|
|
49
|
-
className: PropTypes.string
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
function Info({
|
|
53
|
-
className
|
|
54
|
-
}) {
|
|
55
|
-
return /*#__PURE__*/React.createElement(IconInfo24, {
|
|
56
|
-
color: theme.info,
|
|
57
|
-
className: className
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
Info.propTypes = {
|
|
62
|
-
className: PropTypes.string
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
function Loading({
|
|
66
|
-
className
|
|
67
|
-
}) {
|
|
68
|
-
return /*#__PURE__*/React.createElement(CircularLoader, {
|
|
69
|
-
small: true,
|
|
70
|
-
className: className
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
Loading.propTypes = {
|
|
75
|
-
className: PropTypes.string
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const StatusIcon = ({
|
|
79
|
-
error,
|
|
80
|
-
warning,
|
|
81
|
-
valid,
|
|
82
|
-
loading,
|
|
83
|
-
info,
|
|
84
|
-
className,
|
|
85
|
-
defaultTo
|
|
86
|
-
}) => {
|
|
87
|
-
if (error) {
|
|
88
|
-
return /*#__PURE__*/React.createElement(Error, {
|
|
89
|
-
className: className
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (warning) {
|
|
94
|
-
return /*#__PURE__*/React.createElement(Warning, {
|
|
95
|
-
className: className
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (valid) {
|
|
100
|
-
return /*#__PURE__*/React.createElement(Valid, {
|
|
101
|
-
className: className
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (loading) {
|
|
106
|
-
return /*#__PURE__*/React.createElement(Loading, {
|
|
107
|
-
className: className
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (info) {
|
|
112
|
-
return /*#__PURE__*/React.createElement(Info, {
|
|
113
|
-
className: className
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return defaultTo;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
StatusIcon.defaultProps = {
|
|
121
|
-
defaultTo: null
|
|
122
|
-
};
|
|
123
|
-
StatusIcon.propTypes = {
|
|
124
|
-
className: PropTypes.string,
|
|
125
|
-
defaultTo: PropTypes.element,
|
|
126
|
-
error: PropTypes.bool,
|
|
127
|
-
info: PropTypes.bool,
|
|
128
|
-
loading: PropTypes.bool,
|
|
129
|
-
valid: PropTypes.bool,
|
|
130
|
-
warning: PropTypes.bool
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
function Upload({
|
|
134
|
-
className
|
|
135
|
-
}) {
|
|
136
|
-
return /*#__PURE__*/React.createElement(IconUpload24, {
|
|
137
|
-
color: colors.grey700,
|
|
138
|
-
className: className
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
Upload.propTypes = {
|
|
143
|
-
className: PropTypes.string
|
|
144
|
-
};
|
|
145
|
-
|
|
146
13
|
class FileInput extends Component {
|
|
147
14
|
constructor(...args) {
|
|
148
15
|
super(...args);
|
|
@@ -202,7 +69,9 @@ class FileInput extends Component {
|
|
|
202
69
|
} = this.props;
|
|
203
70
|
return /*#__PURE__*/React.createElement("div", {
|
|
204
71
|
"data-test": dataTest,
|
|
205
|
-
className: _JSXStyle.dynamic([["
|
|
72
|
+
className: _JSXStyle.dynamic([["1746996489", [spacers.dp8, spacers.dp4]]]) + " " + (cx('file-input', className) || "")
|
|
73
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
className: _JSXStyle.dynamic([["1746996489", [spacers.dp8, spacers.dp4]]])
|
|
206
75
|
}, /*#__PURE__*/React.createElement("input", {
|
|
207
76
|
id: name,
|
|
208
77
|
name: name,
|
|
@@ -212,10 +81,12 @@ class FileInput extends Component {
|
|
|
212
81
|
accept: accept,
|
|
213
82
|
multiple: multiple,
|
|
214
83
|
disabled: disabled,
|
|
215
|
-
className: _JSXStyle.dynamic([["
|
|
84
|
+
className: _JSXStyle.dynamic([["1746996489", [spacers.dp8, spacers.dp4]]])
|
|
216
85
|
}), /*#__PURE__*/React.createElement(Button, {
|
|
217
86
|
disabled: disabled,
|
|
218
|
-
icon: /*#__PURE__*/React.createElement(
|
|
87
|
+
icon: /*#__PURE__*/React.createElement(IconUpload24, {
|
|
88
|
+
color: colors.grey700
|
|
89
|
+
}),
|
|
219
90
|
initialFocus: initialFocus,
|
|
220
91
|
large: large,
|
|
221
92
|
onBlur: this.handleBlur,
|
|
@@ -224,14 +95,14 @@ class FileInput extends Component {
|
|
|
224
95
|
small: small,
|
|
225
96
|
tabIndex: tabIndex,
|
|
226
97
|
type: "button"
|
|
227
|
-
}, buttonLabel), /*#__PURE__*/React.createElement(StatusIcon, {
|
|
98
|
+
}, buttonLabel)), /*#__PURE__*/React.createElement(StatusIcon, {
|
|
228
99
|
error: error,
|
|
229
100
|
valid: valid,
|
|
230
101
|
warning: warning
|
|
231
102
|
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
232
|
-
id: "
|
|
233
|
-
dynamic: [spacers.
|
|
234
|
-
}, ["input.__jsx-style-dynamic-selector{display:none;}", `.file-input.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;
|
|
103
|
+
id: "1746996489",
|
|
104
|
+
dynamic: [spacers.dp8, spacers.dp4]
|
|
105
|
+
}, ["input.__jsx-style-dynamic-selector{display:none;}", `.file-input.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;gap:${spacers.dp8};padding-bottom:${spacers.dp4};}`]));
|
|
235
106
|
}
|
|
236
107
|
|
|
237
108
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2-ui/file-input",
|
|
3
|
-
"version": "7.14.
|
|
3
|
+
"version": "7.14.2",
|
|
4
4
|
"description": "UI FileInput",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,12 +33,13 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@dhis2/prop-types": "^3.0.0-beta.1",
|
|
36
|
-
"@dhis2-ui/button": "7.14.
|
|
37
|
-
"@dhis2-ui/field": "7.14.
|
|
38
|
-
"@dhis2-ui/label": "7.14.
|
|
39
|
-
"@dhis2-ui/loader": "7.14.
|
|
40
|
-
"@dhis2/
|
|
41
|
-
"@dhis2/ui-
|
|
36
|
+
"@dhis2-ui/button": "7.14.2",
|
|
37
|
+
"@dhis2-ui/field": "7.14.2",
|
|
38
|
+
"@dhis2-ui/label": "7.14.2",
|
|
39
|
+
"@dhis2-ui/loader": "7.14.2",
|
|
40
|
+
"@dhis2-ui/status-icon": "7.14.2",
|
|
41
|
+
"@dhis2/ui-constants": "7.14.2",
|
|
42
|
+
"@dhis2/ui-icons": "7.14.2",
|
|
42
43
|
"classnames": "^2.3.1",
|
|
43
44
|
"prop-types": "^15.7.2"
|
|
44
45
|
},
|