@rolster/react-components 1.4.1 → 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/assets/{lib.cjs-7a1f29f4.css → lib.cjs-a7ae2768.css} +10 -8
- package/dist/cjs/lib.cjs.js +64 -24
- package/dist/cjs/lib.cjs.js.map +1 -1
- package/dist/es/assets/{lib-7a1f29f4.css → lib-a7ae2768.css} +10 -8
- 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/DateField/DateField.css +1 -1
- package/dist/esm/components/organisms/DatePicker/DatePicker.css +9 -7
- 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
|
@@ -1679,12 +1679,13 @@
|
|
|
1679
1679
|
|
|
1680
1680
|
.rls-date-picker {
|
|
1681
1681
|
position: relative;
|
|
1682
|
-
|
|
1683
|
-
|
|
1682
|
+
display: flex;
|
|
1683
|
+
flex-direction: column;
|
|
1684
1684
|
overflow: hidden;
|
|
1685
|
+
max-width: 18.75rem;
|
|
1685
1686
|
}
|
|
1686
1687
|
.rls-date-picker__header {
|
|
1687
|
-
background: var(--color-
|
|
1688
|
+
background: var(--color-rolster-100);
|
|
1688
1689
|
padding: var(--sizing-8);
|
|
1689
1690
|
box-sizing: border-box;
|
|
1690
1691
|
margin-bottom: var(--sizing-16);
|
|
@@ -1696,7 +1697,7 @@
|
|
|
1696
1697
|
font-weight: var(--font-weight-bold);
|
|
1697
1698
|
}
|
|
1698
1699
|
.rls-date-picker__title:hover {
|
|
1699
|
-
color: var(--color-
|
|
1700
|
+
color: var(--color-rolster-500);
|
|
1700
1701
|
}
|
|
1701
1702
|
.rls-date-picker__title--description {
|
|
1702
1703
|
height: var(--sizing-32);
|
|
@@ -1712,6 +1713,7 @@
|
|
|
1712
1713
|
}
|
|
1713
1714
|
.rls-date-picker__component {
|
|
1714
1715
|
display: flex;
|
|
1716
|
+
width: 18.75rem;
|
|
1715
1717
|
padding: 0rem var(--sizing-4);
|
|
1716
1718
|
box-sizing: border-box;
|
|
1717
1719
|
margin-bottom: var(--sizing-8);
|
|
@@ -1733,20 +1735,20 @@
|
|
|
1733
1735
|
display: none;
|
|
1734
1736
|
}
|
|
1735
1737
|
.rls-date-picker__actions {
|
|
1738
|
+
display: flex;
|
|
1739
|
+
flex-wrap: wrap;
|
|
1740
|
+
gap: var(--sizing-8);
|
|
1736
1741
|
padding: var(--sizing-8) var(--sizing-16) var(--sizing-12) var(--sizing-16);
|
|
1737
1742
|
overflow: hidden;
|
|
1738
1743
|
box-sizing: border-box;
|
|
1739
1744
|
}
|
|
1740
1745
|
.rls-date-picker__actions--cancel {
|
|
1741
1746
|
width: calc(50% - var(--sizing-4));
|
|
1742
|
-
margin-right: var(--sizing-4);
|
|
1743
1747
|
}
|
|
1744
1748
|
.rls-date-picker__actions--today {
|
|
1745
1749
|
width: calc(50% - var(--sizing-4));
|
|
1746
|
-
margin-left: var(--sizing-4);
|
|
1747
1750
|
}
|
|
1748
1751
|
.rls-date-picker__actions--ok {
|
|
1749
|
-
margin-top: var(--sizing-8);
|
|
1750
1752
|
width: 100%;
|
|
1751
1753
|
}
|
|
1752
1754
|
.rls-date-picker__actions button {
|
|
@@ -1814,7 +1816,7 @@
|
|
|
1814
1816
|
}
|
|
1815
1817
|
|
|
1816
1818
|
.rls-date-field {
|
|
1817
|
-
--rls-
|
|
1819
|
+
--rls-boxfield-body-padding: var(--sizing-6) var(--sizing-8);
|
|
1818
1820
|
position: relative;
|
|
1819
1821
|
float: left;
|
|
1820
1822
|
width: 100%;
|
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;
|