@rolster/react-components 18.22.2 → 18.22.3
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/assets/{index-CkCoIjNb.css → index-DZlD2mZH.css} +9 -0
- package/dist/cjs/index.js +41 -18
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/assets/{index-CkCoIjNb.css → index-DZlD2mZH.css} +9 -0
- package/dist/es/index.js +41 -19
- package/dist/es/index.js.map +1 -1
- package/dist/esm/components/atoms/Image/Image.css +8 -0
- package/dist/esm/components/atoms/Image/Image.css.map +1 -0
- package/dist/esm/components/atoms/Image/Image.d.ts +6 -0
- package/dist/esm/components/atoms/Image/Image.js +22 -0
- package/dist/esm/components/atoms/Image/Image.js.map +1 -0
- package/dist/esm/components/atoms/index.d.ts +1 -0
- package/dist/esm/components/atoms/index.js +1 -0
- package/dist/esm/components/atoms/index.js.map +1 -1
- package/dist/esm/components/organisms/ImageChooser/ImageChooser.d.ts +1 -0
- package/dist/esm/components/organisms/ImageChooser/ImageChooser.js +1 -1
- package/dist/esm/components/organisms/ImageChooser/ImageChooser.js.map +1 -1
- package/dist/esm/components/organisms/ImageEditor/ImageEditor.d.ts +1 -0
- package/dist/esm/components/organisms/ImageEditor/ImageEditor.js +21 -17
- package/dist/esm/components/organisms/ImageEditor/ImageEditor.js.map +1 -1
- package/package.json +1 -1
|
@@ -514,6 +514,15 @@
|
|
|
514
514
|
transition: all 160ms 0ms var(--rls-standard-curve);
|
|
515
515
|
} /*# sourceMappingURL=CheckBox.css.map */
|
|
516
516
|
|
|
517
|
+
.rls-image {
|
|
518
|
+
content-visibility: auto;
|
|
519
|
+
background-color: var(--rls-theme-color-600);
|
|
520
|
+
opacity: 0;
|
|
521
|
+
}
|
|
522
|
+
.rls-image--complet {
|
|
523
|
+
opacity: 1;
|
|
524
|
+
} /*# sourceMappingURL=Image.css.map */
|
|
525
|
+
|
|
517
526
|
.rls-input {
|
|
518
527
|
--pvt-font-color: var(--rlc-input-font-color, var(--rls-app-color-900));
|
|
519
528
|
--pvt-font-size: var(--rlc-input-font-size, var(--rls-input-font-size));
|
package/dist/cjs/index.js
CHANGED
|
@@ -1554,6 +1554,24 @@ function RlsCheckBoxControl({ formControl, disabled, identifier, rlsTheme }) {
|
|
|
1554
1554
|
return (jsxRuntimeExports.jsx(RlsCheckBox, { identifier: identifier, checked: !!formControl.value, disabled: disabled, onClick: onClick, rlsTheme: rlsTheme }));
|
|
1555
1555
|
}
|
|
1556
1556
|
|
|
1557
|
+
function RlsImage({ src }) {
|
|
1558
|
+
const [isComplet, setIsComplet] = require$$0.useState(false);
|
|
1559
|
+
const refSrc = require$$0.useRef(src);
|
|
1560
|
+
const className = require$$0.useMemo(() => {
|
|
1561
|
+
return renderClassStatus('rls-image', { complet: isComplet });
|
|
1562
|
+
}, [isComplet]);
|
|
1563
|
+
require$$0.useEffect(() => {
|
|
1564
|
+
if (refSrc.current !== src) {
|
|
1565
|
+
setIsComplet(false);
|
|
1566
|
+
refSrc.current = src;
|
|
1567
|
+
}
|
|
1568
|
+
}, [src]);
|
|
1569
|
+
const onLoad = require$$0.useCallback(() => {
|
|
1570
|
+
setIsComplet(true);
|
|
1571
|
+
}, []);
|
|
1572
|
+
return jsxRuntimeExports.jsx("img", { className: className, src: src, onLoad: onLoad });
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1557
1575
|
function RlsInput({ children, decimals, disabled, formControl, identifier, onBlur, onEnter, onFocus, onKeyDown, onKeyUp, onValue, placeholder, readOnly, type, value }) {
|
|
1558
1576
|
const valueInitial = formControl?.value ?? value ? String(value) : '';
|
|
1559
1577
|
const [valueInput, setValueInput] = require$$0.useState(valueInitial);
|
|
@@ -3378,25 +3396,28 @@ function RlsImageEditor(props) {
|
|
|
3378
3396
|
refOverlayLeft.current.style.width = `calc(${left}px)`;
|
|
3379
3397
|
}, []);
|
|
3380
3398
|
const refreshSelectionFromWidth = require$$0.useCallback((rateSelection) => {
|
|
3381
|
-
const
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3399
|
+
const ratioFactor = getRatioFactor(props.ratio || '1:1');
|
|
3400
|
+
const _ratio = rateSelection * ratioFactor;
|
|
3401
|
+
const offsetWidth = refImage.current?.offsetWidth || 0;
|
|
3402
|
+
const offsetHeight = refImage.current?.offsetHeight || 0;
|
|
3403
|
+
let width = (offsetWidth * rateSelection) / 100;
|
|
3404
|
+
let height = (offsetWidth * _ratio) / 100;
|
|
3405
|
+
if (height > offsetHeight) {
|
|
3406
|
+
height = offsetHeight;
|
|
3407
|
+
width = height / ratioFactor;
|
|
3389
3408
|
}
|
|
3390
3409
|
return { height, width };
|
|
3391
3410
|
}, [props.ratio]);
|
|
3392
3411
|
const refreshSelectionFromHeight = require$$0.useCallback((rateSelection) => {
|
|
3393
|
-
const
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3412
|
+
const ratioFactor = getRatioFactor(props.ratio || '1:1');
|
|
3413
|
+
const _ratio = rateSelection * ratioFactor;
|
|
3414
|
+
const offsetWidth = refImage.current?.offsetWidth || 0;
|
|
3415
|
+
const offsetHeight = refImage.current?.offsetHeight || 0;
|
|
3416
|
+
let height = (offsetHeight * rateSelection) / 100;
|
|
3417
|
+
let width = (offsetHeight * _ratio) / 100;
|
|
3418
|
+
if (width > offsetWidth) {
|
|
3419
|
+
width = offsetWidth;
|
|
3420
|
+
height = width / ratioFactor;
|
|
3400
3421
|
}
|
|
3401
3422
|
return { height, width };
|
|
3402
3423
|
}, [props.ratio]);
|
|
@@ -3499,13 +3520,14 @@ function RlsImageEditor(props) {
|
|
|
3499
3520
|
props.formControl?.setValue(value);
|
|
3500
3521
|
};
|
|
3501
3522
|
}
|
|
3502
|
-
}, props.mimeType || 'image/jpeg', 1);
|
|
3523
|
+
}, props.mimeType || 'image/jpeg', props.imgQuality || 1);
|
|
3503
3524
|
}, [
|
|
3504
3525
|
props.ratio,
|
|
3505
3526
|
props.mimeType,
|
|
3506
3527
|
props.onValue,
|
|
3507
3528
|
props.formControl,
|
|
3508
|
-
props.imgWidth
|
|
3529
|
+
props.imgWidth,
|
|
3530
|
+
props.imgQuality
|
|
3509
3531
|
]);
|
|
3510
3532
|
const onRestore = require$$0.useCallback(() => {
|
|
3511
3533
|
const context = refCanvas.current.getContext('2d');
|
|
@@ -3567,7 +3589,7 @@ function RlsImageChooser(props) {
|
|
|
3567
3589
|
const onCancel = require$$0.useCallback(() => {
|
|
3568
3590
|
setSrcEditor(undefined);
|
|
3569
3591
|
}, []);
|
|
3570
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-image-chooser", children: [jsxRuntimeExports.jsx("div", { className: "rls-image-chooser__avatar", onClick: onSelect, children: src && jsxRuntimeExports.jsx("img", { src: src }) }), srcEditor && (jsxRuntimeExports.jsx(RlsModal, { className: "rls-image-chooser__modal", visible: true, children: jsxRuntimeExports.jsx(RlsImageEditor, { src: srcEditor, formControl: props.formControl, imgWidth: props.imgWidth, onValue: onEditorValue, children: jsxRuntimeExports.jsx(RlsButton, { type: "flat", rlsTheme: "danger", onClick: onCancel, disabled: props.disabled, children: labels.actionCancel }) }) })), jsxRuntimeExports.jsx("input", { ref: refInput, type: "file", disabled: props.disabled })] }));
|
|
3592
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-image-chooser", children: [jsxRuntimeExports.jsx("div", { className: "rls-image-chooser__avatar", onClick: onSelect, children: src && jsxRuntimeExports.jsx("img", { src: src }) }), srcEditor && (jsxRuntimeExports.jsx(RlsModal, { className: "rls-image-chooser__modal", visible: true, children: jsxRuntimeExports.jsx(RlsImageEditor, { src: srcEditor, formControl: props.formControl, imgWidth: props.imgWidth, imgQuality: props.imgQuality, onValue: onEditorValue, children: jsxRuntimeExports.jsx(RlsButton, { type: "flat", rlsTheme: "danger", onClick: onCancel, disabled: props.disabled, children: labels.actionCancel }) }) })), jsxRuntimeExports.jsx("input", { ref: refInput, type: "file", disabled: props.disabled })] }));
|
|
3571
3593
|
}
|
|
3572
3594
|
|
|
3573
3595
|
const DURATION_ANIMATION = 240;
|
|
@@ -3695,6 +3717,7 @@ exports.RlsFieldSelectTemplate = RlsFieldSelectTemplate;
|
|
|
3695
3717
|
exports.RlsFieldText = RlsFieldText;
|
|
3696
3718
|
exports.RlsFormNavigation = RlsFormNavigation;
|
|
3697
3719
|
exports.RlsIcon = RlsIcon;
|
|
3720
|
+
exports.RlsImage = RlsImage;
|
|
3698
3721
|
exports.RlsImageChooser = RlsImageChooser;
|
|
3699
3722
|
exports.RlsImageEditor = RlsImageEditor;
|
|
3700
3723
|
exports.RlsInput = RlsInput;
|