aport-tools 4.4.24 → 4.4.25
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/dist/forms/InputAttach.d.ts +6 -0
- package/dist/index.esm.js +19 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +19 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! aport-tools v4.4.
|
1
|
+
/*! aport-tools v4.4.25 | ISC */
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
var React = require('react');
|
@@ -1162,13 +1162,24 @@ var InputAttach = function InputAttach(_a) {
|
|
1162
1162
|
_d = _a.disabled,
|
1163
1163
|
disabled = _d === void 0 ? false : _d,
|
1164
1164
|
_e = _a.placeholder,
|
1165
|
-
placeholder = _e === void 0 ? "Upload an image" : _e
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1165
|
+
placeholder = _e === void 0 ? "Upload an image" : _e,
|
1166
|
+
_f = _a.firstValue,
|
1167
|
+
firstValue = _f === void 0 ? [] : _f;
|
1168
|
+
var _g = useFormContext(),
|
1169
|
+
setFormValue = _g.setFormValue,
|
1170
|
+
formErrors = _g.errors;
|
1171
|
+
// Initialize with firstValue or an empty array
|
1172
|
+
var _h = React.useState(function () {
|
1173
|
+
return Array.isArray(firstValue) ? firstValue.slice(0, amount) : [];
|
1174
|
+
}),
|
1175
|
+
selectedFiles = _h[0],
|
1176
|
+
setSelectedFiles = _h[1];
|
1177
|
+
// Update the form context on mount with firstValue if provided
|
1178
|
+
React.useEffect(function () {
|
1179
|
+
if (firstValue.length > 0) {
|
1180
|
+
setFormValue(name, firstValue.slice(0, amount));
|
1181
|
+
}
|
1182
|
+
}, [firstValue, name, setFormValue, amount]);
|
1172
1183
|
var theme = React.useContext(aportThemes.ThemeContext).theme;
|
1173
1184
|
var colors = theme.colors;
|
1174
1185
|
var pickImage = function pickImage() {
|