@rolster/react-components 18.22.2 → 18.22.4

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.
Files changed (33) hide show
  1. package/dist/cjs/assets/{index-CkCoIjNb.css → index-DrZV0dgi.css} +32 -17
  2. package/dist/cjs/index.js +44 -21
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/es/assets/{index-CkCoIjNb.css → index-DrZV0dgi.css} +32 -17
  5. package/dist/es/index.js +44 -22
  6. package/dist/es/index.js.map +1 -1
  7. package/dist/esm/components/atoms/Image/Image.css +8 -0
  8. package/dist/esm/components/atoms/Image/Image.css.map +1 -0
  9. package/dist/esm/components/atoms/Image/Image.d.ts +6 -0
  10. package/dist/esm/components/atoms/Image/Image.js +22 -0
  11. package/dist/esm/components/atoms/Image/Image.js.map +1 -0
  12. package/dist/esm/components/atoms/index.d.ts +1 -0
  13. package/dist/esm/components/atoms/index.js +1 -0
  14. package/dist/esm/components/atoms/index.js.map +1 -1
  15. package/dist/esm/components/molecules/LabelCheckBox/LabelCheckBox.css +8 -6
  16. package/dist/esm/components/molecules/LabelCheckBox/LabelCheckBox.css.map +1 -1
  17. package/dist/esm/components/molecules/LabelCheckBox/LabelCheckBox.js +1 -1
  18. package/dist/esm/components/molecules/LabelCheckBox/LabelCheckBox.js.map +1 -1
  19. package/dist/esm/components/molecules/LabelRadioButton/LabelRadioButton.css +8 -6
  20. package/dist/esm/components/molecules/LabelRadioButton/LabelRadioButton.css.map +1 -1
  21. package/dist/esm/components/molecules/LabelRadioButton/LabelRadioButton.js +1 -1
  22. package/dist/esm/components/molecules/LabelRadioButton/LabelRadioButton.js.map +1 -1
  23. package/dist/esm/components/molecules/LabelSwitch/LabelSwitch.css +7 -5
  24. package/dist/esm/components/molecules/LabelSwitch/LabelSwitch.css.map +1 -1
  25. package/dist/esm/components/molecules/LabelSwitch/LabelSwitch.js +1 -1
  26. package/dist/esm/components/molecules/LabelSwitch/LabelSwitch.js.map +1 -1
  27. package/dist/esm/components/organisms/ImageChooser/ImageChooser.d.ts +1 -0
  28. package/dist/esm/components/organisms/ImageChooser/ImageChooser.js +1 -1
  29. package/dist/esm/components/organisms/ImageChooser/ImageChooser.js.map +1 -1
  30. package/dist/esm/components/organisms/ImageEditor/ImageEditor.d.ts +1 -0
  31. package/dist/esm/components/organisms/ImageEditor/ImageEditor.js +21 -17
  32. package/dist/esm/components/organisms/ImageEditor/ImageEditor.js.map +1 -1
  33. 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));
@@ -1275,18 +1284,20 @@
1275
1284
  width: auto;
1276
1285
  }
1277
1286
  .rls-label-checkbox__text {
1278
- max-width: calc(100% - var(--rls-sizing-x16));
1279
- height: var(--pvt-text-height);
1280
- line-height: var(--rls-sizing-x12);
1287
+ max-width: calc(100% - var(--rls-sizing-x28));
1281
1288
  color: var(--rls-app-color-600);
1289
+ line-height: var(--pvt-text-height);
1282
1290
  font-size: var(--rls-label-font-size);
1283
1291
  font-weight: var(--rls-font-weight-medium);
1284
1292
  letter-spacing: var(--rls-label-letter-spacing);
1285
1293
  user-select: none;
1286
1294
  opacity: var(--pvt-text-opacity);
1287
- overflow: var(--pvt-text-overflow);
1288
- white-space: var(--pvt-text-white-space);
1289
- text-overflow: var(--pvt-text-text-overflow);
1295
+ }
1296
+ .rls-label-checkbox__text > p {
1297
+ height: initial;
1298
+ overflow: initial;
1299
+ text-overflow: initial;
1300
+ white-space: initial;
1290
1301
  } /*# sourceMappingURL=LabelCheckBox.css.map */
1291
1302
 
1292
1303
  .rls-label-radiobutton {
@@ -1314,18 +1325,20 @@
1314
1325
  width: auto;
1315
1326
  }
1316
1327
  .rls-label-radiobutton__text {
1317
- max-width: calc(100% - var(--rls-sizing-x16));
1318
- height: var(--pvt-text-height);
1319
- line-height: var(--rls-sizing-x12);
1328
+ max-width: calc(100% - var(--rls-sizing-x28));
1320
1329
  color: var(--rls-app-color-600);
1330
+ line-height: var(--pvt-text-height);
1321
1331
  font-size: var(--rls-label-font-size);
1322
1332
  font-weight: var(--rls-font-weight-medium);
1323
1333
  letter-spacing: var(--rls-label-letter-spacing);
1324
1334
  user-select: none;
1325
1335
  opacity: var(--pvt-text-opacity);
1326
- overflow: var(--pvt-text-overflow);
1327
- white-space: var(--pvt-text-white-space);
1328
- text-overflow: var(--pvt-text-text-overflow);
1336
+ }
1337
+ .rls-label-radiobutton__text > p {
1338
+ height: initial;
1339
+ overflow: initial;
1340
+ text-overflow: initial;
1341
+ white-space: initial;
1329
1342
  } /*# sourceMappingURL=LabelRadioButton.css.map */
1330
1343
 
1331
1344
  .rls-label-switch {
@@ -1353,17 +1366,19 @@
1353
1366
  }
1354
1367
  .rls-label-switch__text {
1355
1368
  max-width: calc(100% - var(--rls-sizing-x28));
1356
- height: var(--pvt-text-height);
1357
- line-height: var(--rls-sizing-x12);
1358
1369
  color: var(--rls-app-color-600);
1370
+ line-height: var(--pvt-text-height);
1359
1371
  font-size: var(--rls-label-font-size);
1360
1372
  font-weight: var(--rls-font-weight-medium);
1361
1373
  letter-spacing: var(--rls-label-letter-spacing);
1362
1374
  user-select: none;
1363
1375
  opacity: var(--pvt-text-opacity);
1364
- overflow: var(--pvt-text-overflow);
1365
- white-space: var(--pvt-text-white-space);
1366
- text-overflow: var(--pvt-text-text-overflow);
1376
+ }
1377
+ .rls-label-switch__text > p {
1378
+ height: initial;
1379
+ overflow: initial;
1380
+ text-overflow: initial;
1381
+ white-space: initial;
1367
1382
  } /*# sourceMappingURL=LabelSwitch.css.map */
1368
1383
 
1369
1384
  .rls-pagination {
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);
@@ -1887,7 +1905,7 @@ function RlsLabelCheckBox({ children, disabled, extended, identifier, formContro
1887
1905
  const className = require$$0.useMemo(() => {
1888
1906
  return renderClassStatus('rls-label-checkbox', { disabled, extended });
1889
1907
  }, [disabled, extended]);
1890
- return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-label-checkbox__component", onClick: onToggle, children: jsxRuntimeExports.jsx(RlsCheckBox, { checked: checked, disabled: disabled }) }), jsxRuntimeExports.jsx("label", { className: "rls-label-checkbox__text", children: children })] }));
1908
+ return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-label-checkbox__component", onClick: onToggle, children: jsxRuntimeExports.jsx(RlsCheckBox, { checked: checked, disabled: disabled }) }), jsxRuntimeExports.jsx("div", { className: "rls-label-checkbox__text", children: children })] }));
1891
1909
  }
1892
1910
 
1893
1911
  function RlsLabelRadioButton({ children, disabled, extended, identifier, formControl, rlsTheme, value }) {
@@ -1901,7 +1919,7 @@ function RlsLabelRadioButton({ children, disabled, extended, identifier, formCon
1901
1919
  const className = require$$0.useMemo(() => {
1902
1920
  return renderClassStatus('rls-label-radiobutton', { disabled, extended });
1903
1921
  }, [disabled, extended]);
1904
- return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-label-radiobutton__component", onClick: onSelect, children: jsxRuntimeExports.jsx(RlsRadioButton, { checked: checked, disabled: disabled }) }), jsxRuntimeExports.jsx("label", { className: "rls-label-radiobutton__text", children: children })] }));
1922
+ return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-label-radiobutton__component", onClick: onSelect, children: jsxRuntimeExports.jsx(RlsRadioButton, { checked: checked, disabled: disabled }) }), jsxRuntimeExports.jsx("div", { className: "rls-label-radiobutton__text", children: children })] }));
1905
1923
  }
1906
1924
 
1907
1925
  function RlsLabelSwitch({ children, disabled, extended, identifier, formControl, rlsTheme }) {
@@ -1917,7 +1935,7 @@ function RlsLabelSwitch({ children, disabled, extended, identifier, formControl,
1917
1935
  const className = require$$0.useMemo(() => {
1918
1936
  return renderClassStatus('rls-label-switch', { disabled, extended });
1919
1937
  }, [disabled, extended]);
1920
- return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-label-switch__component", onClick: onToggle, children: jsxRuntimeExports.jsx(RlsSwitch, { checked: checked, disabled: disabled }) }), jsxRuntimeExports.jsx("label", { className: "rls-label-switch__text", children: children })] }));
1938
+ return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-label-switch__component", onClick: onToggle, children: jsxRuntimeExports.jsx(RlsSwitch, { checked: checked, disabled: disabled }) }), jsxRuntimeExports.jsx("div", { className: "rls-label-switch__text", children: children })] }));
1921
1939
  }
1922
1940
 
1923
1941
  function RlsPagination({ suggestions, count, filter, onPagination }) {
@@ -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 _ratio = rateSelection * getRatioFactor(props.ratio || '1:1');
3382
- let width = (refImage.current.offsetWidth * rateSelection) / 100;
3383
- let height = (refImage.current.offsetWidth * _ratio) / 100;
3384
- if (height > refImage.current.offsetHeight) {
3385
- height = refImage.current.offsetHeight;
3386
- width =
3387
- (height * refImage.current.offsetHeight) /
3388
- refImage.current.offsetHeight;
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 _ratio = rateSelection * getRatioFactor(props.ratio || '1:1');
3394
- let height = (refImage.current.offsetHeight * rateSelection) / 100;
3395
- let width = (refImage.current.offsetHeight * _ratio) / 100;
3396
- if (width > refImage.current.offsetWidth) {
3397
- width = refImage.current.offsetWidth;
3398
- height =
3399
- (width * refImage.current.offsetWidth) / refImage.current.offsetWidth;
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;