@rolster/react-components 18.23.8 → 18.23.10

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.
@@ -705,6 +705,12 @@
705
705
  opacity: 0.5;
706
706
  } /*# sourceMappingURL=InputPassword.css.map */
707
707
 
708
+ .rls-input-percentage {
709
+ position: relative;
710
+ width: 100%;
711
+ box-sizing: border-box;
712
+ } /*# sourceMappingURL=InputPercentage.css.map */
713
+
708
714
  .rls-input-search {
709
715
  --rlc-input-height: var(--rls-sizing-x14);
710
716
  position: relative;
@@ -1251,6 +1257,13 @@
1251
1257
  z-index: 2;
1252
1258
  } /*# sourceMappingURL=FieldPassword.css.map */
1253
1259
 
1260
+ .rls-field-percentage {
1261
+ --rlc-fieldbox-body-padding: var(--rls-sizing-x4);
1262
+ position: relative;
1263
+ width: 100%;
1264
+ box-sizing: border-box;
1265
+ } /*# sourceMappingURL=FieldPercentage.css.map */
1266
+
1254
1267
  .rls-field-readonly {
1255
1268
  --rlc-fieldbox-body-padding: var(--rls-sizing-x4);
1256
1269
  --pvt-font-color: var(--rlc-input-font-color, var(--rls-app-color-900));
package/dist/cjs/index.js CHANGED
@@ -1565,6 +1565,16 @@ function RlsInputPassword({ disabled, formControl, identifier, onEnter, onKeyDow
1565
1565
  return (jsxRuntimeExports.jsx("div", { id: identifier, className: className, children: jsxRuntimeExports.jsx("input", { className: "rls-input-password__component", autoComplete: "off", type: type ?? 'password', placeholder: placeholder, disabled: disabled, readOnly: readOnly, onFocus: _onFocus, onBlur: _onBlur, onChange: _onChange, onKeyDown: _onKeyDown, onKeyUp: _onKeyUp }) }));
1566
1566
  }
1567
1567
 
1568
+ function RlsInputPercentage(props) {
1569
+ const { formControl, identifier, onValue, value } = props;
1570
+ const [valueInput, setValueInput] = require$$0.useState(formControl?.value ?? value ?? 0);
1571
+ const onValueInput = require$$0.useCallback((value) => {
1572
+ !formControl && setValueInput(value);
1573
+ onValue && onValue(value);
1574
+ }, [formControl, onValue]);
1575
+ return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-percentage", children: jsxRuntimeExports.jsxs(RlsInput, { ...props, type: "number", value: valueInput, onValue: onValueInput, children: [formControl?.value ?? valueInput, "%"] }) }));
1576
+ }
1577
+
1568
1578
  function RlsInputSearch({ formControl, identifier, onEnter, onSearch, placeholder }) {
1569
1579
  const [value, setValue] = require$$0.useState('');
1570
1580
  const onValue = require$$0.useCallback((value) => {
@@ -1862,6 +1872,24 @@ function RlsFieldPassword(props) {
1862
1872
  return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx(RlsInputPassword, { ...props, type: password ? 'password' : 'text' }), jsxRuntimeExports.jsx(RlsButtonAction, { icon: password ? 'eye' : 'eye-off', onClick: onToggleInput })] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
1863
1873
  }
1864
1874
 
1875
+ function RlsFieldPercentage(props) {
1876
+ const { children, disabled, formControl, identifier, msgErrorDisabled, rlsTheme } = props;
1877
+ const className = require$$0.useMemo(() => {
1878
+ const _disabled = formControl?.disabled || disabled;
1879
+ return renderClassStatus('rls-field-box', {
1880
+ focused: formControl?.focused && !_disabled,
1881
+ error: formControl?.wrong,
1882
+ disabled: _disabled
1883
+ }, 'rls-field-percentage');
1884
+ }, [
1885
+ formControl?.focused,
1886
+ formControl?.wrong,
1887
+ formControl?.disabled,
1888
+ disabled
1889
+ ]);
1890
+ return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsInputPercentage, { ...props }) }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
1891
+ }
1892
+
1865
1893
  function RlsFieldReadonly({ children, identifier, rlsTheme, value }) {
1866
1894
  return (jsxRuntimeExports.jsxs("div", { id: identifier, className: "rls-field-readonly rls-field-box", "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx("input", { className: "rls-input__component", autoComplete: "off", type: 'text', readOnly: true, value: value }) }) })] }));
1867
1895
  }
@@ -3460,7 +3488,8 @@ function RlsImageEditor(props) {
3460
3488
  const context = refCanvas.current.getContext('2d', {
3461
3489
  willReadFrequently: true
3462
3490
  });
3463
- const { height, width } = calculateImgDimension(image.current, props.maxDimension || 500);
3491
+ const width = image.current.width;
3492
+ const height = image.current.height;
3464
3493
  refCanvas.current.width = width;
3465
3494
  refCanvas.current.height = height;
3466
3495
  context?.drawImage(image.current, 0, 0, width, height);
@@ -3758,6 +3787,7 @@ exports.RlsFieldDateRange = RlsFieldDateRange;
3758
3787
  exports.RlsFieldMoney = RlsFieldMoney;
3759
3788
  exports.RlsFieldNumber = RlsFieldNumber;
3760
3789
  exports.RlsFieldPassword = RlsFieldPassword;
3790
+ exports.RlsFieldPercentage = RlsFieldPercentage;
3761
3791
  exports.RlsFieldReadonly = RlsFieldReadonly;
3762
3792
  exports.RlsFieldSelect = RlsFieldSelect;
3763
3793
  exports.RlsFieldSelectTemplate = RlsFieldSelectTemplate;
@@ -3771,6 +3801,7 @@ exports.RlsInput = RlsInput;
3771
3801
  exports.RlsInputMoney = RlsInputMoney;
3772
3802
  exports.RlsInputNumber = RlsInputNumber;
3773
3803
  exports.RlsInputPassword = RlsInputPassword;
3804
+ exports.RlsInputPercentage = RlsInputPercentage;
3774
3805
  exports.RlsInputSearch = RlsInputSearch;
3775
3806
  exports.RlsInputText = RlsInputText;
3776
3807
  exports.RlsLabel = RlsLabel;
@@ -3800,6 +3831,7 @@ exports.RlsSwitch = RlsSwitch;
3800
3831
  exports.RlsSwitchControl = RlsSwitchControl;
3801
3832
  exports.RlsTabularText = RlsTabularText;
3802
3833
  exports.RlsToolbar = RlsToolbar;
3834
+ exports.calculateImgDimension = calculateImgDimension;
3803
3835
  exports.rangeFormatTemplate = rangeFormatTemplate;
3804
3836
  exports.renderClassStatus = renderClassStatus;
3805
3837
  exports.setErrorsI18n = setErrorsI18n;