@dreamcommerce/aurora 2.8.1-25 → 2.8.1-27
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/packages/aurora/src/components/image_picker/index.js +7 -0
- package/build/cjs/packages/aurora/src/components/image_picker/index.js.map +1 -1
- package/build/cjs/packages/aurora/src/components/xhr_image_picker/index.js +1 -5
- package/build/cjs/packages/aurora/src/components/xhr_image_picker/index.js.map +1 -1
- package/build/esm/packages/aurora/src/components/image_picker/index.js +7 -0
- package/build/esm/packages/aurora/src/components/image_picker/index.js.map +1 -1
- package/build/esm/packages/aurora/src/components/xhr_image_picker/index.js +2 -6
- package/build/esm/packages/aurora/src/components/xhr_image_picker/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -33,8 +33,15 @@ const ImagePicker = React.memo(({ id, onChange, onError, errors: initialErrors,
|
|
|
33
33
|
const inputRef = React.createRef();
|
|
34
34
|
console.log('ImagePicker');
|
|
35
35
|
console.log('ImagePicker', initialErrors);
|
|
36
|
+
const [errorsToDisplay, setErrorsToDisplay] = React.useState([]);
|
|
36
37
|
const [imageSize, setImageSize] = React.useState(undefined);
|
|
37
38
|
const { onDropFile, onFileChange, onDragOver, onDragLeave, onFileDelete, onPreviewError, file, errors, isPreview, isDragOver } = use_file_picker.useFilePicker({ initialFile, onChange, allowedExtensions, initialErrors, onError, inputRef });
|
|
39
|
+
React.useEffect(() => {
|
|
40
|
+
setErrorsToDisplay(errors);
|
|
41
|
+
}, [errors]);
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
console.log('errorsToDisplay', errorsToDisplay);
|
|
44
|
+
}, [errorsToDisplay]);
|
|
38
45
|
const acceptFiles = utils.getAcceptFilesParametersFromAllowedExtensions(allowedExtensions);
|
|
39
46
|
const imagePickerClassName = classnames__default['default'](main_module['default'][css_classes['default'].imagePicker], className && className);
|
|
40
47
|
const imagePickerWrapperClassName = classnames__default['default'](main_module['default'][css_classes['default'].imagePickerWrapper], file && main_module['default'][css_classes['default'].imagePickerWrapperHasFile], {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iEAAqE;AAClG,2BAA2B,yDAA6D;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iEAAqE;AAClG,2BAA2B,yDAA6D;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -12,7 +12,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
12
12
|
|
|
13
13
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
14
|
|
|
15
|
-
const XhrImagePicker = ({ id, url, name, onUploaded, initialFile, errors
|
|
15
|
+
const XhrImagePicker = ({ id, url, name, onUploaded, initialFile, errors, onError, onChange, onImageSizeUpdated, allowedExtensions = [
|
|
16
16
|
constants.FILES_EXTENSIONS.WEBP,
|
|
17
17
|
constants.FILES_EXTENSIONS.JPG,
|
|
18
18
|
constants.FILES_EXTENSIONS.PNG,
|
|
@@ -20,12 +20,8 @@ const XhrImagePicker = ({ id, url, name, onUploaded, initialFile, errors: initia
|
|
|
20
20
|
constants.FILES_EXTENSIONS.SVG,
|
|
21
21
|
constants.FILES_EXTENSIONS.JPEG
|
|
22
22
|
] }) => {
|
|
23
|
-
const [errors, setErrors] = React.useState([]);
|
|
24
23
|
const httpApi = use_http_api.useHttpApi();
|
|
25
24
|
const pendingRequestRef = React__default['default'].useRef();
|
|
26
|
-
React.useEffect(() => {
|
|
27
|
-
initialErrors && setErrors(initialErrors);
|
|
28
|
-
}, [initialErrors]);
|
|
29
25
|
const handleControlChange = async (fileList) => {
|
|
30
26
|
onChange === null || onChange === void 0 ? void 0 : onChange(fileList);
|
|
31
27
|
if (!fileList || !fileList.length)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -24,8 +24,15 @@ const ImagePicker = memo(({ id, onChange, onError, errors: initialErrors, allowe
|
|
|
24
24
|
const inputRef = createRef();
|
|
25
25
|
console.log('ImagePicker');
|
|
26
26
|
console.log('ImagePicker', initialErrors);
|
|
27
|
+
const [errorsToDisplay, setErrorsToDisplay] = useState([]);
|
|
27
28
|
const [imageSize, setImageSize] = useState(undefined);
|
|
28
29
|
const { onDropFile, onFileChange, onDragOver, onDragLeave, onFileDelete, onPreviewError, file, errors, isPreview, isDragOver } = useFilePicker({ initialFile, onChange, allowedExtensions, initialErrors, onError, inputRef });
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setErrorsToDisplay(errors);
|
|
32
|
+
}, [errors]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
console.log('errorsToDisplay', errorsToDisplay);
|
|
35
|
+
}, [errorsToDisplay]);
|
|
29
36
|
const acceptFiles = getAcceptFilesParametersFromAllowedExtensions(allowedExtensions);
|
|
30
37
|
const imagePickerClassName = classnames(styles[CSS_CLASSES.imagePicker], className && className);
|
|
31
38
|
const imagePickerWrapperClassName = classnames(styles[CSS_CLASSES.imagePickerWrapper], file && styles[CSS_CLASSES.imagePickerWrapperHasFile], {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA,+BAA+B,iEAAqE;AACpG,gCAAgC,yDAA6D;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA,+BAA+B,iEAAqE;AACpG,gCAAgC,yDAA6D;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import { FILES_EXTENSIONS } from '../file_picker/constants.js';
|
|
3
3
|
import { REQUEST_TYPES } from '../../../../star_core/build/esm/packages/star_core/src/features/http_requester/http_requester_contants.js';
|
|
4
4
|
import ImagePicker from '../image_picker/index.js';
|
|
5
5
|
import { useHttpApi } from '../../hooks/use_http_api.js';
|
|
6
6
|
|
|
7
|
-
const XhrImagePicker = ({ id, url, name, onUploaded, initialFile, errors
|
|
7
|
+
const XhrImagePicker = ({ id, url, name, onUploaded, initialFile, errors, onError, onChange, onImageSizeUpdated, allowedExtensions = [
|
|
8
8
|
FILES_EXTENSIONS.WEBP,
|
|
9
9
|
FILES_EXTENSIONS.JPG,
|
|
10
10
|
FILES_EXTENSIONS.PNG,
|
|
@@ -12,12 +12,8 @@ const XhrImagePicker = ({ id, url, name, onUploaded, initialFile, errors: initia
|
|
|
12
12
|
FILES_EXTENSIONS.SVG,
|
|
13
13
|
FILES_EXTENSIONS.JPEG
|
|
14
14
|
] }) => {
|
|
15
|
-
const [errors, setErrors] = useState([]);
|
|
16
15
|
const httpApi = useHttpApi();
|
|
17
16
|
const pendingRequestRef = React.useRef();
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
initialErrors && setErrors(initialErrors);
|
|
20
|
-
}, [initialErrors]);
|
|
21
17
|
const handleControlChange = async (fileList) => {
|
|
22
18
|
onChange === null || onChange === void 0 ? void 0 : onChange(fileList);
|
|
23
19
|
if (!fileList || !fileList.length)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|