@dreamcommerce/aurora 2.6.0-5 → 2.6.0-8

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.
@@ -11,7 +11,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
11
11
 
12
12
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
13
13
 
14
- const ControlXhrImagePicker = ({ url, label, isRequired, id, name, onChange, allowedExtensions, initialFile, className, errors, hint, labelAdditionalInfo
14
+ const ControlXhrImagePicker = ({ url, label, isRequired, id, name, onChange, allowedExtensions, initialFile, className, errors, hint, labelAdditionalInfo, onUploaded
15
15
  // hasWidthInput,
16
16
  // widthInputPostfix,
17
17
  // widthInputLabel,
@@ -23,7 +23,7 @@ const ControlXhrImagePicker = ({ url, label, isRequired, id, name, onChange, all
23
23
  hint && React__default['default'].createElement(index$1['default'], { hint: hint, spacingLeft: true }))),
24
24
  React__default['default'].createElement(index['default'].Content, null,
25
25
  React__default['default'].createElement(index['default'].Element, null,
26
- React__default['default'].createElement(index$2['default'], { url: url, id: id, name: name, onChange: onChange, allowedExtensions: allowedExtensions, initialFile: initialFile, className: className, errors: errors }))),
26
+ React__default['default'].createElement(index$2['default'], { url: url, id: id, name: name, onChange: onChange, allowedExtensions: allowedExtensions, initialFile: initialFile, className: className, errors: errors, onUploaded: onUploaded }))),
27
27
  React__default['default'].createElement(index['default'].Errors, null)));
28
28
  };
29
29
 
@@ -10,6 +10,7 @@ var classnames = require('classnames');
10
10
  var index = require('../context/index.js');
11
11
  var responsive_breakpoints = require('../../../constants/responsive_breakpoints.js');
12
12
  var use_screen_detect = require('../../../hooks/use_screen_detect.js');
13
+ var utilities$1 = require('@dreamcommerce/utilities');
13
14
  var with_translation = require('../../../utilities/translation/with_translation.js');
14
15
  var reactTransitionGroup = require('react-transition-group');
15
16
  var constants = require('../constants.js');
@@ -18,7 +19,6 @@ var main_module = require('../../../css/dropdown/main.module.less.js');
18
19
  var utilities = require('../utilities.js');
19
20
  var use_click_outside = require('../../../hooks/use_click_outside.js');
20
21
  var icon_arrow = require('../../../assets/icon_arrow.js');
21
- var utilities$1 = require('@dreamcommerce/utilities');
22
22
  var main_module$1 = require('../../../css/hint/main.module.less.js');
23
23
  var main_module$2 = require('../../../css/tooltip/main.module.less.js');
24
24
 
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var constants = require('../file_picker/constants.js');
7
- var index = require('../image_picker/index.js');
8
7
  var http_requester_contants = require('../../../../star_core/build/esm/packages/star_core/src/features/http_requester/http_requester_contants.js');
8
+ var index = require('../image_picker/index.js');
9
9
  var use_http_api = require('../../hooks/use_http_api.js');
10
10
 
11
11
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -14,14 +14,14 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
14
14
 
15
15
  const XhrImagePicker = ({ id, url, name, onUploaded, initialFile, errors, allowedExtensions = [constants.FILES_EXTENSIONS.WEBP, constants.FILES_EXTENSIONS.JPG, constants.FILES_EXTENSIONS.PNG, constants.FILES_EXTENSIONS.GIF, constants.FILES_EXTENSIONS.SVG] }) => {
16
16
  const httpApi = use_http_api.useHttpApi();
17
- const onChange = async (fileList) => {
17
+ const onChange = async (fileList, size) => {
18
18
  const { response } = httpApi.fetch({
19
19
  url,
20
20
  method: http_requester_contants.REQUEST_TYPES.post,
21
21
  data: fileList[0]
22
22
  });
23
23
  const data = await response;
24
- onUploaded === null || onUploaded === void 0 ? void 0 : onUploaded(data, fileList[0]);
24
+ onUploaded === null || onUploaded === void 0 ? void 0 : onUploaded(data, fileList[0], size);
25
25
  };
26
26
  return (React__default['default'].createElement(index['default'], { id: id, name: name, onChange: onChange, errors: errors, allowedExtensions: allowedExtensions, initialFile: initialFile }));
27
27
  };
@@ -3,7 +3,7 @@ import Control from '../../index.js';
3
3
  import Hint from '../../../hint/index.js';
4
4
  import XhrImagePicker from '../../../xhr_image_picker/index.js';
5
5
 
6
- const ControlXhrImagePicker = ({ url, label, isRequired, id, name, onChange, allowedExtensions, initialFile, className, errors, hint, labelAdditionalInfo
6
+ const ControlXhrImagePicker = ({ url, label, isRequired, id, name, onChange, allowedExtensions, initialFile, className, errors, hint, labelAdditionalInfo, onUploaded
7
7
  // hasWidthInput,
8
8
  // widthInputPostfix,
9
9
  // widthInputLabel,
@@ -15,7 +15,7 @@ const ControlXhrImagePicker = ({ url, label, isRequired, id, name, onChange, all
15
15
  hint && React.createElement(Hint, { hint: hint, spacingLeft: true }))),
16
16
  React.createElement(Control.Content, null,
17
17
  React.createElement(Control.Element, null,
18
- React.createElement(XhrImagePicker, { url: url, id: id, name: name, onChange: onChange, allowedExtensions: allowedExtensions, initialFile: initialFile, className: className, errors: errors }))),
18
+ React.createElement(XhrImagePicker, { url: url, id: id, name: name, onChange: onChange, allowedExtensions: allowedExtensions, initialFile: initialFile, className: className, errors: errors, onUploaded: onUploaded }))),
19
19
  React.createElement(Control.Errors, null)));
20
20
  };
21
21
 
@@ -6,6 +6,7 @@ import { IRange } from "../range/types";
6
6
  import React from 'react';
7
7
  import { TVerticalPosition } from "../../typings/general";
8
8
  import { TImageSize } from "../image_picker/types";
9
+ import { IRequestResponse } from '@dreamcommerce/star_core';
9
10
  export declare type TControlErrors = string[] | null | undefined;
10
11
  export interface IControlContext {
11
12
  errors?: TControlErrors;
@@ -176,6 +177,7 @@ export interface IControlXhrImagePicker extends IFilePicker, IControlCommonProps
176
177
  isRequired?: boolean;
177
178
  onChange?: (fileList: FileList | null, size?: TImageSize) => void;
178
179
  labelAdditionalInfo?: string | ReactNode;
180
+ onUploaded?: (resp: IRequestResponse<any>, file: File, size: TImageSize) => void;
179
181
  }
180
182
  export interface ICellSelector {
181
183
  rows?: number;
@@ -6,4 +6,5 @@ import '@auroraComponents/range/types';
6
6
  import 'react';
7
7
  import '@auroraTypings/general';
8
8
  import '@auroraComponents/image_picker/types';
9
+ import '@dreamcommerce/star_core';
9
10
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../src/components/controls/types.ts"],"names":[],"mappings":"AAAA,OAA0G,OAAO,CAAC;AAClH,OAAgD,kCAAkC,CAAC;AAEnF,OAAkC,sCAAsC,CAAC;AACzE,OAA4B,qCAAqC,CAAC;AAClE,OAAuB,+BAA+B,CAAC;AACvD,OAAkB,OAAO,CAAC;AAC1B,OAAkC,wBAAwB,CAAC;AAC3D,OAA2B,sCAAsC,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../src/components/controls/types.ts"],"names":[],"mappings":"AAAA,OAA0G,OAAO,CAAC;AAClH,OAAgD,kCAAkC,CAAC;AAEnF,OAAkC,sCAAsC,CAAC;AACzE,OAA4B,qCAAqC,CAAC;AAClE,OAAuB,+BAA+B,CAAC;AACvD,OAAkB,OAAO,CAAC;AAC1B,OAAkC,wBAAwB,CAAC;AAC3D,OAA2B,sCAAsC,CAAC;AAClE,OAAiC,0BAA0B,CAAC"}
@@ -6,6 +6,7 @@ import classnames from 'classnames';
6
6
  import { useDropdownContext } from '../context/index.js';
7
7
  import { SCREEN_XS } from '../../../constants/responsive_breakpoints.js';
8
8
  import { useScreenDetect } from '../../../hooks/use_screen_detect.js';
9
+ import { UiDomUtils } from '@dreamcommerce/utilities';
9
10
  import withTranslation from '../../../utilities/translation/with_translation.js';
10
11
  import { TransitionGroup, CSSTransition } from 'react-transition-group';
11
12
  import { DROPDOWN_Z_INDEX, DROPDOWN_ON_MODAL_Z_INDEX } from '../constants.js';
@@ -14,7 +15,6 @@ import cssClasses from '../../../css/dropdown/main.module.less.js';
14
15
  import { getBounding, getXYModifiersForNestedDropdowns, isChildOfModal } from '../utilities.js';
15
16
  import { useClickOutside } from '../../../hooks/use_click_outside.js';
16
17
  import IconArrow from '../../../assets/icon_arrow.js';
17
- import { UiDomUtils } from '@dreamcommerce/utilities';
18
18
  import cssClasses$1 from '../../../css/hint/main.module.less.js';
19
19
  import cssClasses$2 from '../../../css/tooltip/main.module.less.js';
20
20
 
@@ -4,7 +4,7 @@ export declare type TImagePickerFile = {
4
4
  fileUrl: string;
5
5
  fileName: string;
6
6
  };
7
- export interface IImagePicker extends IFilePicker {
7
+ export interface IImagePicker extends Omit<IFilePicker, 'onChange'> {
8
8
  onChange?: (fileList: FileList | null, size?: TImageSize) => void;
9
9
  }
10
10
  export interface ISelectedImagePreview {
@@ -1,19 +1,19 @@
1
1
  import React from 'react';
2
2
  import { FILES_EXTENSIONS } from '../file_picker/constants.js';
3
- import ImagePicker from '../image_picker/index.js';
4
3
  import { REQUEST_TYPES } from '../../../../star_core/build/esm/packages/star_core/src/features/http_requester/http_requester_contants.js';
4
+ import ImagePicker from '../image_picker/index.js';
5
5
  import { useHttpApi } from '../../hooks/use_http_api.js';
6
6
 
7
7
  const XhrImagePicker = ({ id, url, name, onUploaded, initialFile, errors, allowedExtensions = [FILES_EXTENSIONS.WEBP, FILES_EXTENSIONS.JPG, FILES_EXTENSIONS.PNG, FILES_EXTENSIONS.GIF, FILES_EXTENSIONS.SVG] }) => {
8
8
  const httpApi = useHttpApi();
9
- const onChange = async (fileList) => {
9
+ const onChange = async (fileList, size) => {
10
10
  const { response } = httpApi.fetch({
11
11
  url,
12
12
  method: REQUEST_TYPES.post,
13
13
  data: fileList[0]
14
14
  });
15
15
  const data = await response;
16
- onUploaded === null || onUploaded === void 0 ? void 0 : onUploaded(data, fileList[0]);
16
+ onUploaded === null || onUploaded === void 0 ? void 0 : onUploaded(data, fileList[0], size);
17
17
  };
18
18
  return (React.createElement(ImagePicker, { id: id, name: name, onChange: onChange, errors: errors, allowedExtensions: allowedExtensions, initialFile: initialFile }));
19
19
  };
@@ -1,7 +1,7 @@
1
- import { IImagePicker } from "../image_picker/types";
1
+ import { IImagePicker, TImageSize } from "../image_picker/types";
2
2
  import { IRequestResponse } from '@dreamcommerce/star_core';
3
3
  export interface IXhrImagePickerProps extends IImagePicker {
4
4
  url: string;
5
- onUploaded?: (resp: IRequestResponse<any>, file: File) => void;
5
+ onUploaded?: (resp: IRequestResponse<any>, file: File, size: TImageSize) => void;
6
6
  onUploadError?: Function;
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../src/components/xhr_image_picker/types.ts"],"names":[],"mappings":"AAAA,OAA6B,sCAAsC,CAAC;AACpE,OAAiC,0BAA0B,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../src/components/xhr_image_picker/types.ts"],"names":[],"mappings":"AAAA,OAAyC,sCAAsC,CAAC;AAChF,OAAiC,0BAA0B,CAAC"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@dreamcommerce/aurora",
3
3
  "packageManager": "yarn@3.2.0",
4
4
  "sideEffects": false,
5
- "version": "2.6.0-5",
5
+ "version": "2.6.0-8",
6
6
  "description": "aurora",
7
7
  "author": "k0ssak",
8
8
  "license": "MIT",