@rolster/react-components 1.4.2 → 1.5.0
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/lib.cjs.js +64 -24
- package/dist/cjs/lib.cjs.js.map +1 -1
- package/dist/es/lib.js +64 -24
- package/dist/es/lib.js.map +1 -1
- package/dist/esm/components/atoms/Input/Input.d.ts +2 -1
- package/dist/esm/components/atoms/Input/Input.js +4 -1
- package/dist/esm/components/atoms/Input/Input.js.map +1 -1
- package/dist/esm/components/atoms/InputMoney/InputMoney.d.ts +2 -1
- package/dist/esm/components/atoms/InputMoney/InputMoney.js +10 -2
- package/dist/esm/components/atoms/InputMoney/InputMoney.js.map +1 -1
- package/dist/esm/components/atoms/InputNumber/InputNumber.d.ts +2 -1
- package/dist/esm/components/atoms/InputNumber/InputNumber.js +10 -2
- package/dist/esm/components/atoms/InputNumber/InputNumber.js.map +1 -1
- package/dist/esm/components/atoms/InputPassword/InputPassword.d.ts +2 -1
- package/dist/esm/components/atoms/InputPassword/InputPassword.js +4 -1
- package/dist/esm/components/atoms/InputPassword/InputPassword.js.map +1 -1
- package/dist/esm/components/atoms/InputText/InputText.d.ts +2 -1
- package/dist/esm/components/atoms/InputText/InputText.js +10 -2
- package/dist/esm/components/atoms/InputText/InputText.js.map +1 -1
- package/dist/esm/components/organisms/AutocompleteField/AutocompleteField.d.ts +3 -2
- package/dist/esm/components/organisms/AutocompleteField/AutocompleteField.js +13 -8
- package/dist/esm/components/organisms/AutocompleteField/AutocompleteField.js.map +1 -1
- package/dist/esm/components/organisms/SelectField/SelectField.d.ts +2 -1
- package/dist/esm/components/organisms/SelectField/SelectField.js +13 -8
- package/dist/esm/components/organisms/SelectField/SelectField.js.map +1 -1
- package/package.json +1 -1
package/dist/es/lib.js
CHANGED
|
@@ -1407,7 +1407,7 @@ function RlsCheckBox({ checked, disabled, rlsTheme }) {
|
|
|
1407
1407
|
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-checkbox', { checked, disabled }), "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-checkbox__component" }) }));
|
|
1408
1408
|
}
|
|
1409
1409
|
|
|
1410
|
-
function RlsInput({ children, defaultValue, disabled, formControl, placeholder, type }) {
|
|
1410
|
+
function RlsInput({ children, defaultValue, disabled, formControl, onValue, placeholder, type }) {
|
|
1411
1411
|
const [active, setActive] = useState(false);
|
|
1412
1412
|
function onChange(event) {
|
|
1413
1413
|
switch (type) {
|
|
@@ -1421,6 +1421,9 @@ function RlsInput({ children, defaultValue, disabled, formControl, placeholder,
|
|
|
1421
1421
|
}
|
|
1422
1422
|
function setState(value) {
|
|
1423
1423
|
formControl?.setState(value);
|
|
1424
|
+
if (onValue) {
|
|
1425
|
+
onValue(value);
|
|
1426
|
+
}
|
|
1424
1427
|
}
|
|
1425
1428
|
function onFocus() {
|
|
1426
1429
|
formControl?.setActive(true);
|
|
@@ -1437,30 +1440,49 @@ function RlsInput({ children, defaultValue, disabled, formControl, placeholder,
|
|
|
1437
1440
|
}), children: [jsxRuntimeExports.jsx("input", { ref: formControl?.elementRef, className: "rls-input__component", autoComplete: "off", type: type || 'text', placeholder: placeholder, disabled: disabled, onFocus: onFocus, onBlur: onBlur, onChange: onChange, value: formControl?.state || defaultValue || '' }), jsxRuntimeExports.jsx("span", { className: "rls-input__value", children: children })] }));
|
|
1438
1441
|
}
|
|
1439
1442
|
|
|
1440
|
-
function RlsInputMoney({ decimals, defaultValue, disabled, formControl, placeholder, symbol }) {
|
|
1443
|
+
function RlsInputMoney({ decimals, defaultValue, disabled, formControl, onValue, placeholder, symbol }) {
|
|
1441
1444
|
const [value, setValue] = useState(defaultValue || 0);
|
|
1442
1445
|
useEffect(() => {
|
|
1443
1446
|
formControl?.subscribe((value) => {
|
|
1444
1447
|
setValue(value || 0);
|
|
1445
1448
|
});
|
|
1446
1449
|
}, []);
|
|
1447
|
-
|
|
1450
|
+
function onMoney(value) {
|
|
1451
|
+
if (!formControl) {
|
|
1452
|
+
setValue(value);
|
|
1453
|
+
}
|
|
1454
|
+
if (onValue) {
|
|
1455
|
+
onValue(value);
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-input-money", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "number", disabled: disabled, placeholder: placeholder, defaultValue: defaultValue, onValue: onMoney, children: jsxRuntimeExports.jsx(RlsAmount, { value: formControl?.state || value, symbol: symbol, decimals: decimals }) }) }));
|
|
1448
1459
|
}
|
|
1449
1460
|
|
|
1450
|
-
function RlsInputNumber({ disabled, defaultValue, formControl, placeholder }) {
|
|
1461
|
+
function RlsInputNumber({ disabled, defaultValue, formControl, onValue, placeholder }) {
|
|
1451
1462
|
const [value, setValue] = useState(defaultValue || 0);
|
|
1452
1463
|
useEffect(() => {
|
|
1453
1464
|
formControl?.subscribe((value) => {
|
|
1454
1465
|
setValue(value || 0);
|
|
1455
1466
|
});
|
|
1456
1467
|
}, []);
|
|
1457
|
-
|
|
1468
|
+
function onNumber(value) {
|
|
1469
|
+
if (!formControl) {
|
|
1470
|
+
setValue(value);
|
|
1471
|
+
}
|
|
1472
|
+
if (onValue) {
|
|
1473
|
+
onValue(value);
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-input-number", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "number", disabled: disabled, placeholder: placeholder, onValue: onNumber, children: formControl?.state || value }) }));
|
|
1458
1477
|
}
|
|
1459
1478
|
|
|
1460
|
-
function RlsInputPassword({ disabled, formControl, placeholder, type }) {
|
|
1479
|
+
function RlsInputPassword({ disabled, formControl, onValue, placeholder, type }) {
|
|
1461
1480
|
const [active, setActive] = useState(false);
|
|
1462
1481
|
function onChange(event) {
|
|
1463
1482
|
formControl?.setState(event.target.value);
|
|
1483
|
+
if (onValue) {
|
|
1484
|
+
onValue(event.target.value);
|
|
1485
|
+
}
|
|
1464
1486
|
}
|
|
1465
1487
|
function onFocus() {
|
|
1466
1488
|
setActive(true);
|
|
@@ -1477,14 +1499,22 @@ function RlsInputPassword({ disabled, formControl, placeholder, type }) {
|
|
|
1477
1499
|
}), children: jsxRuntimeExports.jsx("input", { className: "rls-input-password__component", autoComplete: "off", type: type || 'password', placeholder: placeholder, disabled: disabled, onFocus: onFocus, onBlur: onBlur, onChange: onChange }) }));
|
|
1478
1500
|
}
|
|
1479
1501
|
|
|
1480
|
-
function RlsInputText({ defaultValue, disabled, formControl, placeholder }) {
|
|
1502
|
+
function RlsInputText({ defaultValue, disabled, formControl, onValue, placeholder }) {
|
|
1481
1503
|
const [value, setValue] = useState(defaultValue || '');
|
|
1482
1504
|
useEffect(() => {
|
|
1483
1505
|
formControl?.subscribe((value) => {
|
|
1484
1506
|
setValue(value || '');
|
|
1485
1507
|
});
|
|
1486
1508
|
}, []);
|
|
1487
|
-
|
|
1509
|
+
function onText(value) {
|
|
1510
|
+
if (!formControl) {
|
|
1511
|
+
setValue(value);
|
|
1512
|
+
}
|
|
1513
|
+
if (onValue) {
|
|
1514
|
+
onValue(value);
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-input-text", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "text", disabled: disabled, placeholder: placeholder, onValue: onText, children: formControl?.state || value }) }));
|
|
1488
1518
|
}
|
|
1489
1519
|
|
|
1490
1520
|
function RlsPoster({ children, rlsTheme }) {
|
|
@@ -2635,7 +2665,7 @@ function useListControl(suggestions, ignoreHigher = false) {
|
|
|
2635
2665
|
|
|
2636
2666
|
const DURATION_ANIMATION$1 = 240;
|
|
2637
2667
|
const MAX_ELEMENTS = 6;
|
|
2638
|
-
function RlsAutocompleteField({ suggestions, children, disabled, formControl, placeholder, searching, rlsTheme
|
|
2668
|
+
function RlsAutocompleteField({ suggestions, children, disabled, formControl, onSearch, onSelect, placeholder, searching, rlsTheme }) {
|
|
2639
2669
|
const [pattern, setPattern] = useState('');
|
|
2640
2670
|
const [coincidences, setCoincidences] = useState([]);
|
|
2641
2671
|
const [store, setStore] = useState({
|
|
@@ -2701,12 +2731,12 @@ function RlsAutocompleteField({ suggestions, children, disabled, formControl, pl
|
|
|
2701
2731
|
function onClickBackdrop() {
|
|
2702
2732
|
setVisible(false);
|
|
2703
2733
|
}
|
|
2704
|
-
function
|
|
2734
|
+
function onClickItem(element) {
|
|
2705
2735
|
return () => {
|
|
2706
2736
|
onChange(element);
|
|
2707
2737
|
};
|
|
2708
2738
|
}
|
|
2709
|
-
function
|
|
2739
|
+
function onKeydownItem(element) {
|
|
2710
2740
|
return (event) => {
|
|
2711
2741
|
switch (event.code) {
|
|
2712
2742
|
case 'Enter':
|
|
@@ -2721,11 +2751,16 @@ function RlsAutocompleteField({ suggestions, children, disabled, formControl, pl
|
|
|
2721
2751
|
function onChange(element) {
|
|
2722
2752
|
const { description, value } = element;
|
|
2723
2753
|
setVisible(false);
|
|
2724
|
-
if (
|
|
2725
|
-
|
|
2726
|
-
|
|
2754
|
+
if (onSelect) {
|
|
2755
|
+
onSelect(value);
|
|
2756
|
+
}
|
|
2757
|
+
else {
|
|
2758
|
+
if (formControl) {
|
|
2759
|
+
setChangeInternal(true);
|
|
2760
|
+
formControl.setState(value);
|
|
2761
|
+
}
|
|
2762
|
+
setValue(description);
|
|
2727
2763
|
}
|
|
2728
|
-
setValue(description);
|
|
2729
2764
|
}
|
|
2730
2765
|
function filterSuggestions(pattern, reboot = false) {
|
|
2731
2766
|
if (pattern) {
|
|
@@ -2783,7 +2818,7 @@ function RlsAutocompleteField({ suggestions, children, disabled, formControl, pl
|
|
|
2783
2818
|
setPattern(value);
|
|
2784
2819
|
}, disabled: disabled || searching, onFocus: onFocusInput, onBlur: onBlurInput, onKeyDown: onKeydownInput }), onSearch && (jsxRuntimeExports.jsx("button", { disabled: disabled || searching, onClick: () => {
|
|
2785
2820
|
onSearch(pattern);
|
|
2786
|
-
}, children: jsxRuntimeExports.jsx(RlsIcon, { value: "search" }) }))] }), searching && jsxRuntimeExports.jsx(RlsProgressBar, { indeterminate: true }), coincidences.map((element, index) => (jsxRuntimeExports.jsx("li", { className: "rls-list-field__element", tabIndex: -1, onClick:
|
|
2821
|
+
}, children: jsxRuntimeExports.jsx(RlsIcon, { value: "search" }) }))] }), searching && jsxRuntimeExports.jsx(RlsProgressBar, { indeterminate: true }), coincidences.map((element, index) => (jsxRuntimeExports.jsx("li", { className: "rls-list-field__element", tabIndex: -1, onClick: onClickItem(element), onKeyDown: onKeydownItem(element), children: jsxRuntimeExports.jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: element.title }) }, index))), !coincidences.length && (jsxRuntimeExports.jsx("li", { className: "rls-list-field__empty", children: jsxRuntimeExports.jsxs("div", { className: "rls-list-field__empty__description", children: [jsxRuntimeExports.jsx("label", { className: "label-bold truncate", children: "Selecci\u00F3n no disponible" }), jsxRuntimeExports.jsx("label", { className: "caption-regular", children: "Lo sentimos, en el momento no hay elementos en el listado" })] }) }))] }), jsxRuntimeExports.jsx("div", { className: "rls-list-field__backdrop", onClick: onClickBackdrop })] })] }));
|
|
2787
2822
|
}
|
|
2788
2823
|
|
|
2789
2824
|
function RlsCard({ children, rlsTheme }) {
|
|
@@ -3112,7 +3147,7 @@ function RlsFormNavigation({ children, visible, rlsTheme }) {
|
|
|
3112
3147
|
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-form-navigation', { visible }), "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-form-navigation__body", children: children }) }));
|
|
3113
3148
|
}
|
|
3114
3149
|
|
|
3115
|
-
function RlsSelectField({ suggestions, children, disabled, formControl, placeholder, rlsTheme }) {
|
|
3150
|
+
function RlsSelectField({ suggestions, children, disabled, formControl, onSelect, placeholder, rlsTheme }) {
|
|
3116
3151
|
const { active, boxContentRef, higher, inputRef, listRef, suggestionsField, value, visible, setActive, setValue, setVisible, navigationElement, navigationInput } = useListControl(suggestions);
|
|
3117
3152
|
const [changeInternal, setChangeInternal] = useState(false);
|
|
3118
3153
|
useEffect(() => {
|
|
@@ -3161,12 +3196,12 @@ function RlsSelectField({ suggestions, children, disabled, formControl, placehol
|
|
|
3161
3196
|
function onClickBackdrop() {
|
|
3162
3197
|
setVisible(false);
|
|
3163
3198
|
}
|
|
3164
|
-
function
|
|
3199
|
+
function onClickItem(element) {
|
|
3165
3200
|
return () => {
|
|
3166
3201
|
onChange(element);
|
|
3167
3202
|
};
|
|
3168
3203
|
}
|
|
3169
|
-
function
|
|
3204
|
+
function onKeydownItem(element) {
|
|
3170
3205
|
return (event) => {
|
|
3171
3206
|
switch (event.code) {
|
|
3172
3207
|
case 'Enter':
|
|
@@ -3181,18 +3216,23 @@ function RlsSelectField({ suggestions, children, disabled, formControl, placehol
|
|
|
3181
3216
|
function onChange({ description, value }) {
|
|
3182
3217
|
inputRef?.current?.focus();
|
|
3183
3218
|
setVisible(false);
|
|
3184
|
-
if (
|
|
3185
|
-
|
|
3186
|
-
|
|
3219
|
+
if (onSelect) {
|
|
3220
|
+
onSelect(value);
|
|
3221
|
+
}
|
|
3222
|
+
else {
|
|
3223
|
+
if (formControl) {
|
|
3224
|
+
setChangeInternal(true);
|
|
3225
|
+
formControl.setState(value);
|
|
3226
|
+
}
|
|
3227
|
+
setValue(description);
|
|
3187
3228
|
}
|
|
3188
|
-
setValue(description);
|
|
3189
3229
|
}
|
|
3190
3230
|
return (jsxRuntimeExports.jsxs("div", { ref: boxContentRef, className: 'rls-select-field rls-list-field ' +
|
|
3191
3231
|
renderClassStatus('rls-box-field', { active, disabled }), "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-box-field__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-box-field__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-box-field__body", children: [jsxRuntimeExports.jsx("input", { ref: inputRef, className: "rls-list-field__control", readOnly: true, disabled: disabled, placeholder: placeholder, value: value, onFocus: onFocusInput, onBlur: onBlurInput, onClick: onClickInput, onKeyDown: onKeydownInput }), jsxRuntimeExports.jsx("button", { className: renderClassStatus('rls-list-field__action', { visible }), disabled: disabled, onClick: onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-down" }) })] }) }), jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-list-field__suggestions', {
|
|
3192
3232
|
visible,
|
|
3193
3233
|
hide: !visible,
|
|
3194
3234
|
higher
|
|
3195
|
-
}), children: [jsxRuntimeExports.jsxs("ul", { ref: listRef, className: "rls-list-field__ul", children: [suggestions.map((element, index) => (jsxRuntimeExports.jsx("li", { className: "rls-list-field__element", tabIndex: -1, onClick:
|
|
3235
|
+
}), children: [jsxRuntimeExports.jsxs("ul", { ref: listRef, className: "rls-list-field__ul", children: [suggestions.map((element, index) => (jsxRuntimeExports.jsx("li", { className: "rls-list-field__element", tabIndex: -1, onClick: onClickItem(element), onKeyDown: onKeydownItem(element), children: jsxRuntimeExports.jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: element.title }) }, index))), !suggestions.length && (jsxRuntimeExports.jsx("li", { className: "rls-list-field__empty", children: jsxRuntimeExports.jsxs("div", { className: "rls-list-field__empty__description", children: [jsxRuntimeExports.jsx("label", { className: "label-bold truncate", children: "Selecci\u00F3n no disponible" }), jsxRuntimeExports.jsx("label", { className: "caption-regular", children: "Lo sentimos, en el momento no hay elementos en el listado" })] }) }))] }), jsxRuntimeExports.jsx("div", { className: "rls-list-field__backdrop", onClick: onClickBackdrop })] })] }));
|
|
3196
3236
|
}
|
|
3197
3237
|
|
|
3198
3238
|
const DURATION_ANIMATION = 240;
|