@rolster/react-components 1.4.2 → 1.5.1
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/{lib.cjs-a7ae2768.css → lib.cjs-78c58092.css} +3 -0
- package/dist/cjs/lib.cjs.js +64 -24
- package/dist/cjs/lib.cjs.js.map +1 -1
- package/dist/es/assets/{lib-a7ae2768.css → lib-78c58092.css} +3 -0
- package/dist/es/lib.js +64 -24
- package/dist/es/lib.js.map +1 -1
- package/dist/esm/components/atoms/Amount/Amount.css +1 -0
- package/dist/esm/components/atoms/Input/Input.css +2 -0
- 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
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
.rls-amount {
|
|
18
18
|
display: flex;
|
|
19
|
+
justify-content: var(--rls-amount-text-align);
|
|
19
20
|
}
|
|
20
21
|
.rls-amount > span {
|
|
21
22
|
margin-right: var(--sizing-4);
|
|
@@ -423,6 +424,7 @@
|
|
|
423
424
|
color: var(--pvt-component-font-color);
|
|
424
425
|
font-weight: var(--font-weight-medium);
|
|
425
426
|
font-size: var(--rls-input-font-size);
|
|
427
|
+
text-align: var(--rls-input-text-align);
|
|
426
428
|
letter-spacing: var(--rls-input-letter-spacing);
|
|
427
429
|
}
|
|
428
430
|
.rls-input__component::-webkit-outer-spin-button,
|
|
@@ -455,6 +457,7 @@
|
|
|
455
457
|
color: var(--pvt-value-font-color);
|
|
456
458
|
font-weight: var(--font-weight-medium);
|
|
457
459
|
font-size: var(--rls-input-font-size);
|
|
460
|
+
text-align: var(--rls-input-text-align);
|
|
458
461
|
letter-spacing: var(--rls-input-letter-spacing);
|
|
459
462
|
}
|
|
460
463
|
|
package/dist/cjs/lib.cjs.js
CHANGED
|
@@ -1409,7 +1409,7 @@ function RlsCheckBox({ checked, disabled, rlsTheme }) {
|
|
|
1409
1409
|
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-checkbox', { checked, disabled }), "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-checkbox__component" }) }));
|
|
1410
1410
|
}
|
|
1411
1411
|
|
|
1412
|
-
function RlsInput({ children, defaultValue, disabled, formControl, placeholder, type }) {
|
|
1412
|
+
function RlsInput({ children, defaultValue, disabled, formControl, onValue, placeholder, type }) {
|
|
1413
1413
|
const [active, setActive] = require$$0.useState(false);
|
|
1414
1414
|
function onChange(event) {
|
|
1415
1415
|
switch (type) {
|
|
@@ -1423,6 +1423,9 @@ function RlsInput({ children, defaultValue, disabled, formControl, placeholder,
|
|
|
1423
1423
|
}
|
|
1424
1424
|
function setState(value) {
|
|
1425
1425
|
formControl?.setState(value);
|
|
1426
|
+
if (onValue) {
|
|
1427
|
+
onValue(value);
|
|
1428
|
+
}
|
|
1426
1429
|
}
|
|
1427
1430
|
function onFocus() {
|
|
1428
1431
|
formControl?.setActive(true);
|
|
@@ -1439,30 +1442,49 @@ function RlsInput({ children, defaultValue, disabled, formControl, placeholder,
|
|
|
1439
1442
|
}), 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 })] }));
|
|
1440
1443
|
}
|
|
1441
1444
|
|
|
1442
|
-
function RlsInputMoney({ decimals, defaultValue, disabled, formControl, placeholder, symbol }) {
|
|
1445
|
+
function RlsInputMoney({ decimals, defaultValue, disabled, formControl, onValue, placeholder, symbol }) {
|
|
1443
1446
|
const [value, setValue] = require$$0.useState(defaultValue || 0);
|
|
1444
1447
|
require$$0.useEffect(() => {
|
|
1445
1448
|
formControl?.subscribe((value) => {
|
|
1446
1449
|
setValue(value || 0);
|
|
1447
1450
|
});
|
|
1448
1451
|
}, []);
|
|
1449
|
-
|
|
1452
|
+
function onMoney(value) {
|
|
1453
|
+
if (!formControl) {
|
|
1454
|
+
setValue(value);
|
|
1455
|
+
}
|
|
1456
|
+
if (onValue) {
|
|
1457
|
+
onValue(value);
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
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 }) }) }));
|
|
1450
1461
|
}
|
|
1451
1462
|
|
|
1452
|
-
function RlsInputNumber({ disabled, defaultValue, formControl, placeholder }) {
|
|
1463
|
+
function RlsInputNumber({ disabled, defaultValue, formControl, onValue, placeholder }) {
|
|
1453
1464
|
const [value, setValue] = require$$0.useState(defaultValue || 0);
|
|
1454
1465
|
require$$0.useEffect(() => {
|
|
1455
1466
|
formControl?.subscribe((value) => {
|
|
1456
1467
|
setValue(value || 0);
|
|
1457
1468
|
});
|
|
1458
1469
|
}, []);
|
|
1459
|
-
|
|
1470
|
+
function onNumber(value) {
|
|
1471
|
+
if (!formControl) {
|
|
1472
|
+
setValue(value);
|
|
1473
|
+
}
|
|
1474
|
+
if (onValue) {
|
|
1475
|
+
onValue(value);
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
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 }) }));
|
|
1460
1479
|
}
|
|
1461
1480
|
|
|
1462
|
-
function RlsInputPassword({ disabled, formControl, placeholder, type }) {
|
|
1481
|
+
function RlsInputPassword({ disabled, formControl, onValue, placeholder, type }) {
|
|
1463
1482
|
const [active, setActive] = require$$0.useState(false);
|
|
1464
1483
|
function onChange(event) {
|
|
1465
1484
|
formControl?.setState(event.target.value);
|
|
1485
|
+
if (onValue) {
|
|
1486
|
+
onValue(event.target.value);
|
|
1487
|
+
}
|
|
1466
1488
|
}
|
|
1467
1489
|
function onFocus() {
|
|
1468
1490
|
setActive(true);
|
|
@@ -1479,14 +1501,22 @@ function RlsInputPassword({ disabled, formControl, placeholder, type }) {
|
|
|
1479
1501
|
}), children: jsxRuntimeExports.jsx("input", { className: "rls-input-password__component", autoComplete: "off", type: type || 'password', placeholder: placeholder, disabled: disabled, onFocus: onFocus, onBlur: onBlur, onChange: onChange }) }));
|
|
1480
1502
|
}
|
|
1481
1503
|
|
|
1482
|
-
function RlsInputText({ defaultValue, disabled, formControl, placeholder }) {
|
|
1504
|
+
function RlsInputText({ defaultValue, disabled, formControl, onValue, placeholder }) {
|
|
1483
1505
|
const [value, setValue] = require$$0.useState(defaultValue || '');
|
|
1484
1506
|
require$$0.useEffect(() => {
|
|
1485
1507
|
formControl?.subscribe((value) => {
|
|
1486
1508
|
setValue(value || '');
|
|
1487
1509
|
});
|
|
1488
1510
|
}, []);
|
|
1489
|
-
|
|
1511
|
+
function onText(value) {
|
|
1512
|
+
if (!formControl) {
|
|
1513
|
+
setValue(value);
|
|
1514
|
+
}
|
|
1515
|
+
if (onValue) {
|
|
1516
|
+
onValue(value);
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
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 }) }));
|
|
1490
1520
|
}
|
|
1491
1521
|
|
|
1492
1522
|
function RlsPoster({ children, rlsTheme }) {
|
|
@@ -2637,7 +2667,7 @@ function useListControl(suggestions, ignoreHigher = false) {
|
|
|
2637
2667
|
|
|
2638
2668
|
const DURATION_ANIMATION$1 = 240;
|
|
2639
2669
|
const MAX_ELEMENTS = 6;
|
|
2640
|
-
function RlsAutocompleteField({ suggestions, children, disabled, formControl, placeholder, searching, rlsTheme
|
|
2670
|
+
function RlsAutocompleteField({ suggestions, children, disabled, formControl, onSearch, onSelect, placeholder, searching, rlsTheme }) {
|
|
2641
2671
|
const [pattern, setPattern] = require$$0.useState('');
|
|
2642
2672
|
const [coincidences, setCoincidences] = require$$0.useState([]);
|
|
2643
2673
|
const [store, setStore] = require$$0.useState({
|
|
@@ -2703,12 +2733,12 @@ function RlsAutocompleteField({ suggestions, children, disabled, formControl, pl
|
|
|
2703
2733
|
function onClickBackdrop() {
|
|
2704
2734
|
setVisible(false);
|
|
2705
2735
|
}
|
|
2706
|
-
function
|
|
2736
|
+
function onClickItem(element) {
|
|
2707
2737
|
return () => {
|
|
2708
2738
|
onChange(element);
|
|
2709
2739
|
};
|
|
2710
2740
|
}
|
|
2711
|
-
function
|
|
2741
|
+
function onKeydownItem(element) {
|
|
2712
2742
|
return (event) => {
|
|
2713
2743
|
switch (event.code) {
|
|
2714
2744
|
case 'Enter':
|
|
@@ -2723,11 +2753,16 @@ function RlsAutocompleteField({ suggestions, children, disabled, formControl, pl
|
|
|
2723
2753
|
function onChange(element) {
|
|
2724
2754
|
const { description, value } = element;
|
|
2725
2755
|
setVisible(false);
|
|
2726
|
-
if (
|
|
2727
|
-
|
|
2728
|
-
|
|
2756
|
+
if (onSelect) {
|
|
2757
|
+
onSelect(value);
|
|
2758
|
+
}
|
|
2759
|
+
else {
|
|
2760
|
+
if (formControl) {
|
|
2761
|
+
setChangeInternal(true);
|
|
2762
|
+
formControl.setState(value);
|
|
2763
|
+
}
|
|
2764
|
+
setValue(description);
|
|
2729
2765
|
}
|
|
2730
|
-
setValue(description);
|
|
2731
2766
|
}
|
|
2732
2767
|
function filterSuggestions(pattern, reboot = false) {
|
|
2733
2768
|
if (pattern) {
|
|
@@ -2785,7 +2820,7 @@ function RlsAutocompleteField({ suggestions, children, disabled, formControl, pl
|
|
|
2785
2820
|
setPattern(value);
|
|
2786
2821
|
}, disabled: disabled || searching, onFocus: onFocusInput, onBlur: onBlurInput, onKeyDown: onKeydownInput }), onSearch && (jsxRuntimeExports.jsx("button", { disabled: disabled || searching, onClick: () => {
|
|
2787
2822
|
onSearch(pattern);
|
|
2788
|
-
}, 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:
|
|
2823
|
+
}, 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 })] })] }));
|
|
2789
2824
|
}
|
|
2790
2825
|
|
|
2791
2826
|
function RlsCard({ children, rlsTheme }) {
|
|
@@ -3114,7 +3149,7 @@ function RlsFormNavigation({ children, visible, rlsTheme }) {
|
|
|
3114
3149
|
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-form-navigation', { visible }), "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-form-navigation__body", children: children }) }));
|
|
3115
3150
|
}
|
|
3116
3151
|
|
|
3117
|
-
function RlsSelectField({ suggestions, children, disabled, formControl, placeholder, rlsTheme }) {
|
|
3152
|
+
function RlsSelectField({ suggestions, children, disabled, formControl, onSelect, placeholder, rlsTheme }) {
|
|
3118
3153
|
const { active, boxContentRef, higher, inputRef, listRef, suggestionsField, value, visible, setActive, setValue, setVisible, navigationElement, navigationInput } = useListControl(suggestions);
|
|
3119
3154
|
const [changeInternal, setChangeInternal] = require$$0.useState(false);
|
|
3120
3155
|
require$$0.useEffect(() => {
|
|
@@ -3163,12 +3198,12 @@ function RlsSelectField({ suggestions, children, disabled, formControl, placehol
|
|
|
3163
3198
|
function onClickBackdrop() {
|
|
3164
3199
|
setVisible(false);
|
|
3165
3200
|
}
|
|
3166
|
-
function
|
|
3201
|
+
function onClickItem(element) {
|
|
3167
3202
|
return () => {
|
|
3168
3203
|
onChange(element);
|
|
3169
3204
|
};
|
|
3170
3205
|
}
|
|
3171
|
-
function
|
|
3206
|
+
function onKeydownItem(element) {
|
|
3172
3207
|
return (event) => {
|
|
3173
3208
|
switch (event.code) {
|
|
3174
3209
|
case 'Enter':
|
|
@@ -3183,18 +3218,23 @@ function RlsSelectField({ suggestions, children, disabled, formControl, placehol
|
|
|
3183
3218
|
function onChange({ description, value }) {
|
|
3184
3219
|
inputRef?.current?.focus();
|
|
3185
3220
|
setVisible(false);
|
|
3186
|
-
if (
|
|
3187
|
-
|
|
3188
|
-
|
|
3221
|
+
if (onSelect) {
|
|
3222
|
+
onSelect(value);
|
|
3223
|
+
}
|
|
3224
|
+
else {
|
|
3225
|
+
if (formControl) {
|
|
3226
|
+
setChangeInternal(true);
|
|
3227
|
+
formControl.setState(value);
|
|
3228
|
+
}
|
|
3229
|
+
setValue(description);
|
|
3189
3230
|
}
|
|
3190
|
-
setValue(description);
|
|
3191
3231
|
}
|
|
3192
3232
|
return (jsxRuntimeExports.jsxs("div", { ref: boxContentRef, className: 'rls-select-field rls-list-field ' +
|
|
3193
3233
|
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', {
|
|
3194
3234
|
visible,
|
|
3195
3235
|
hide: !visible,
|
|
3196
3236
|
higher
|
|
3197
|
-
}), 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:
|
|
3237
|
+
}), 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 })] })] }));
|
|
3198
3238
|
}
|
|
3199
3239
|
|
|
3200
3240
|
const DURATION_ANIMATION = 240;
|