@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/es/index.js CHANGED
@@ -3476,7 +3476,7 @@ function RlsImageEditor(props) {
3476
3476
  useResize({ refElement: refImage, onResize: onResizeElement });
3477
3477
  const onCropImage = useCallback(() => {
3478
3478
  const cropProps = getCropProperties();
3479
- const width = props.imgWidth || cropProps.width;
3479
+ const width = props.maxWidth || cropProps.width;
3480
3480
  const height = width * getRatioFactor(props.ratio || '1:1');
3481
3481
  refPicture.current.width = width;
3482
3482
  refPicture.current.height = height;
@@ -3495,14 +3495,14 @@ function RlsImageEditor(props) {
3495
3495
  props.formControl?.setValue(value);
3496
3496
  };
3497
3497
  }
3498
- }, props.mimeType || 'image/jpeg', props.imgQuality || 1);
3498
+ }, props.mimeType || 'image/jpeg', props.quality || 1);
3499
3499
  }, [
3500
3500
  props.ratio,
3501
3501
  props.mimeType,
3502
3502
  props.onValue,
3503
3503
  props.formControl,
3504
- props.imgWidth,
3505
- props.imgQuality
3504
+ props.maxWidth,
3505
+ props.quality
3506
3506
  ]);
3507
3507
  const onRestore = useCallback(() => {
3508
3508
  const context = refCanvas.current.getContext('2d');
@@ -3564,13 +3564,14 @@ function useImageEditorController(options) {
3564
3564
  setSrcEditor(undefined);
3565
3565
  }, []);
3566
3566
  const RlsImageEditorChooser = useMemo(() => {
3567
- 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 }) })));
3567
+ 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 }) })));
3568
3568
  }, [
3569
3569
  srcEditor,
3570
3570
  labels,
3571
3571
  options.formControl,
3572
- options.imgWidth,
3573
- options.imgQuality,
3572
+ options.maxWidth,
3573
+ options.quality,
3574
+ options.ratio,
3574
3575
  options.disabled,
3575
3576
  onEditorValue,
3576
3577
  onCancel
@@ -3587,17 +3588,11 @@ function RlsImageChooser(props) {
3587
3588
  setSrc(image.base64);
3588
3589
  props.onValue && props.onValue(image);
3589
3590
  }, [props.onValue]);
3590
- const { RlsImageEditorChooser, onImageChooser } = useImageEditorController({
3591
- disabled: props.disabled,
3592
- formControl: props.formControl,
3593
- imgQuality: props.imgQuality,
3594
- imgWidth: props.imgWidth,
3595
- onValue
3596
- });
3591
+ const controller = useImageEditorController({ ...props, onValue });
3597
3592
  useEffect(() => {
3598
3593
  props.src && setSrc(props.src);
3599
3594
  }, [props.src]);
3600
- 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] }));
3595
+ 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] }));
3601
3596
  }
3602
3597
 
3603
3598
  const DURATION_ANIMATION = 240;