@rolster/react-components 18.23.5 → 18.23.6

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/cjs/index.js CHANGED
@@ -3478,7 +3478,7 @@ function RlsImageEditor(props) {
3478
3478
  useResize({ refElement: refImage, onResize: onResizeElement });
3479
3479
  const onCropImage = require$$0.useCallback(() => {
3480
3480
  const cropProps = getCropProperties();
3481
- const width = props.imgWidth || cropProps.width;
3481
+ const width = props.maxWidth || cropProps.width;
3482
3482
  const height = width * getRatioFactor(props.ratio || '1:1');
3483
3483
  refPicture.current.width = width;
3484
3484
  refPicture.current.height = height;
@@ -3497,14 +3497,14 @@ function RlsImageEditor(props) {
3497
3497
  props.formControl?.setValue(value);
3498
3498
  };
3499
3499
  }
3500
- }, props.mimeType || 'image/jpeg', props.imgQuality || 1);
3500
+ }, props.mimeType || 'image/jpeg', props.quality || 1);
3501
3501
  }, [
3502
3502
  props.ratio,
3503
3503
  props.mimeType,
3504
3504
  props.onValue,
3505
3505
  props.formControl,
3506
- props.imgWidth,
3507
- props.imgQuality
3506
+ props.maxWidth,
3507
+ props.quality
3508
3508
  ]);
3509
3509
  const onRestore = require$$0.useCallback(() => {
3510
3510
  const context = refCanvas.current.getContext('2d');
@@ -3566,13 +3566,14 @@ function useImageEditorController(options) {
3566
3566
  setSrcEditor(undefined);
3567
3567
  }, []);
3568
3568
  const RlsImageEditorChooser = require$$0.useMemo(() => {
3569
- return (srcEditor && (jsxRuntimeExports.jsx(RlsImageEditorModal, { src: srcEditor, formControl: options.formControl, imgWidth: options.imgWidth, imgQuality: options.imgQuality, onValue: onEditorValue, visible: true, children: jsxRuntimeExports.jsx(RlsButton, { type: "flat", rlsTheme: "danger", onClick: onCancel, disabled: options.disabled, children: labels.actionCancel }) })));
3569
+ return (srcEditor && (jsxRuntimeExports.jsx(RlsImageEditorModal, { visible: true, src: srcEditor, formControl: options.formControl, maxWidth: options.maxWidth, quality: options.quality, ratio: options.ratio, onValue: onEditorValue, children: jsxRuntimeExports.jsx(RlsButton, { type: "flat", rlsTheme: "danger", onClick: onCancel, disabled: options.disabled, children: labels.actionCancel }) })));
3570
3570
  }, [
3571
3571
  srcEditor,
3572
3572
  labels,
3573
3573
  options.formControl,
3574
- options.imgWidth,
3575
- options.imgQuality,
3574
+ options.maxWidth,
3575
+ options.quality,
3576
+ options.ratio,
3576
3577
  options.disabled,
3577
3578
  onEditorValue,
3578
3579
  onCancel
@@ -3589,17 +3590,11 @@ function RlsImageChooser(props) {
3589
3590
  setSrc(image.base64);
3590
3591
  props.onValue && props.onValue(image);
3591
3592
  }, [props.onValue]);
3592
- const { RlsImageEditorChooser, onImageChooser } = useImageEditorController({
3593
- disabled: props.disabled,
3594
- formControl: props.formControl,
3595
- imgQuality: props.imgQuality,
3596
- imgWidth: props.imgWidth,
3597
- onValue
3598
- });
3593
+ const controller = useImageEditorController({ ...props, onValue });
3599
3594
  require$$0.useEffect(() => {
3600
3595
  props.src && setSrc(props.src);
3601
3596
  }, [props.src]);
3602
- return (jsxRuntimeExports.jsxs("div", { className: "rls-image-chooser", children: [jsxRuntimeExports.jsx("div", { className: "rls-image-chooser__avatar", onClick: onImageChooser, children: src && jsxRuntimeExports.jsx("img", { src: src }) }), RlsImageEditorChooser] }));
3597
+ return (jsxRuntimeExports.jsxs("div", { className: "rls-image-chooser", children: [jsxRuntimeExports.jsx("div", { className: "rls-image-chooser__avatar", onClick: controller.onImageChooser, children: src && jsxRuntimeExports.jsx("img", { src: src }) }), controller.RlsImageEditorChooser] }));
3603
3598
  }
3604
3599
 
3605
3600
  const DURATION_ANIMATION = 240;