@rolster/react-components 18.21.32 → 18.21.34
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/{index-BQ758ZeF.css → index-D3ZlI-1N.css} +1 -0
- package/dist/cjs/index.js +52 -31
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/assets/{index-BQ758ZeF.css → index-D3ZlI-1N.css} +1 -0
- package/dist/es/index.js +52 -33
- package/dist/es/index.js.map +1 -1
- package/dist/esm/components/atoms/Amount/Amount.d.ts +1 -1
- package/dist/esm/components/atoms/Breadcrumb/Breadcrumb.js +5 -2
- package/dist/esm/components/atoms/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/esm/components/atoms/Button/Button.css +1 -0
- package/dist/esm/components/atoms/Button/Button.css.map +1 -1
- package/dist/esm/components/atoms/Input/Input.d.ts +2 -1
- package/dist/esm/components/atoms/Input/Input.js +14 -6
- package/dist/esm/components/atoms/Input/Input.js.map +1 -1
- package/dist/esm/components/atoms/InputMoney/InputMoney.d.ts +1 -1
- package/dist/esm/components/atoms/InputPassword/InputPassword.js +1 -1
- package/dist/esm/components/atoms/InputPassword/InputPassword.js.map +1 -1
- package/dist/esm/components/molecules/FieldMoney/FieldMoney.d.ts +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.d.ts +1 -0
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js +13 -8
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js.map +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteController.d.ts +1 -0
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteController.js +3 -3
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteController.js.map +1 -1
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.js +8 -7
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.js.map +1 -1
- package/dist/esm/components/organisms/FieldSelect/FieldSelectController.d.ts +1 -0
- package/dist/esm/components/organisms/FieldSelect/FieldSelectController.js +3 -3
- package/dist/esm/components/organisms/FieldSelect/FieldSelectController.js.map +1 -1
- package/dist/esm/components/organisms/VirtualScroll/VirtualScroll.d.ts +1 -0
- package/dist/esm/components/organisms/VirtualScroll/VirtualScroll.js +37 -0
- package/dist/esm/components/organisms/VirtualScroll/VirtualScroll.js.map +1 -0
- package/dist/esm/components/organisms/index.d.ts +2 -0
- package/dist/esm/components/organisms/index.js +2 -0
- package/dist/esm/components/organisms/index.js.map +1 -1
- package/dist/esm/controllers/ListController.d.ts +2 -1
- package/dist/esm/controllers/ListController.js +6 -3
- package/dist/esm/controllers/ListController.js.map +1 -1
- package/package.json +2 -2
|
@@ -249,6 +249,7 @@
|
|
|
249
249
|
justify-content: center;
|
|
250
250
|
align-items: center;
|
|
251
251
|
overflow: hidden;
|
|
252
|
+
column-gap: var(--rlc-button-content-gap, var(--rls-sizing-x2));
|
|
252
253
|
line-height: var(--rls-sizing-x20);
|
|
253
254
|
height: var(--rls-sizing-x20);
|
|
254
255
|
padding: var(--rlc-button-content-padding, 0rem var(--rls-sizing-x4));
|
package/dist/cjs/index.js
CHANGED
|
@@ -1502,10 +1502,13 @@ function RlsBreadcrumbLabel({ label }) {
|
|
|
1502
1502
|
actionable: !!label.onClick
|
|
1503
1503
|
});
|
|
1504
1504
|
}, [label.onClick]);
|
|
1505
|
-
return (jsxRuntimeExports.jsx("label", { className: "rls-breadcrumb__label", onClick: label.onClick,
|
|
1505
|
+
return (jsxRuntimeExports.jsx("label", { className: "rls-breadcrumb__label", onClick: label.onClick, children: jsxRuntimeExports.jsx("a", { className: className, "rls-theme": label.rlsTheme, children: label.label }) }));
|
|
1506
1506
|
}
|
|
1507
1507
|
function RlsBreadcrumb({ labels }) {
|
|
1508
|
-
|
|
1508
|
+
const children = require$$0.useMemo(() => {
|
|
1509
|
+
return labels.map((label, index) => (jsxRuntimeExports.jsx(RlsBreadcrumbLabel, { label: label }, index)));
|
|
1510
|
+
}, [labels]);
|
|
1511
|
+
return jsxRuntimeExports.jsx("div", { className: "rls-breadcrumb", children: children });
|
|
1509
1512
|
}
|
|
1510
1513
|
|
|
1511
1514
|
function RlsIcon({ value, skeleton }) {
|
|
@@ -1539,21 +1542,28 @@ function RlsCheckBoxControl({ formControl, disabled, identifier, rlsTheme }) {
|
|
|
1539
1542
|
return (jsxRuntimeExports.jsx(RlsCheckBox, { identifier: identifier, checked: !!formControl.value, disabled: disabled, onClick: onClick, rlsTheme: rlsTheme }));
|
|
1540
1543
|
}
|
|
1541
1544
|
|
|
1542
|
-
function RlsInput({ children, disabled, formControl, identifier, onEnter, onKeyDown, onKeyUp, onValue, placeholder, readOnly, type, value }) {
|
|
1545
|
+
function RlsInput({ children, decimals, disabled, formControl, identifier, onEnter, onKeyDown, onKeyUp, onValue, placeholder, readOnly, type, value }) {
|
|
1543
1546
|
const valueInitial = formControl?.value ?? value ? String(value) : '';
|
|
1544
1547
|
const [valueInput, setValueInput] = require$$0.useState(valueInitial);
|
|
1545
1548
|
const [focused, setFocused] = require$$0.useState(false);
|
|
1549
|
+
const isChangeInternal = require$$0.useRef(false);
|
|
1546
1550
|
require$$0.useEffect(() => {
|
|
1547
|
-
|
|
1548
|
-
|
|
1551
|
+
if (!isChangeInternal.current) {
|
|
1552
|
+
const control = formControl?.value ? String(formControl.value) : '';
|
|
1553
|
+
valueInput !== control && setValueInput(control);
|
|
1554
|
+
}
|
|
1555
|
+
isChangeInternal.current = false;
|
|
1549
1556
|
}, [formControl?.value]);
|
|
1550
1557
|
const _onChange = require$$0.useCallback((event) => {
|
|
1551
1558
|
const valueInput = event.target.value;
|
|
1552
|
-
const value = type === 'number'
|
|
1559
|
+
const value = type === 'number'
|
|
1560
|
+
? commons.floorDecimals(+valueInput, decimals || 0)
|
|
1561
|
+
: valueInput;
|
|
1562
|
+
isChangeInternal.current = true;
|
|
1553
1563
|
onValue && onValue(value);
|
|
1554
1564
|
setValueInput(valueInput);
|
|
1555
1565
|
formControl?.setValue(value);
|
|
1556
|
-
}, [formControl, onValue]);
|
|
1566
|
+
}, [formControl, onValue, type, decimals]);
|
|
1557
1567
|
const _onKeyDown = require$$0.useCallback((event) => {
|
|
1558
1568
|
onKeyDown && onKeyDown(event);
|
|
1559
1569
|
event.key === 'Enter' && onEnter && onEnter();
|
|
@@ -1606,7 +1616,7 @@ function RlsInputPassword({ disabled, formControl, identifier, onEnter, onKeyDow
|
|
|
1606
1616
|
}, [formControl, onValue]);
|
|
1607
1617
|
const _onKeyDown = require$$0.useCallback((event) => {
|
|
1608
1618
|
onKeyDown && onKeyDown(event);
|
|
1609
|
-
event.
|
|
1619
|
+
event.key === 'Enter' && onEnter && onEnter();
|
|
1610
1620
|
}, [onKeyDown, onEnter]);
|
|
1611
1621
|
const _onKeyUp = require$$0.useCallback((event) => {
|
|
1612
1622
|
onKeyUp && onKeyUp(event);
|
|
@@ -2421,8 +2431,11 @@ function useDatatable() {
|
|
|
2421
2431
|
return { scrolleable, tableRef };
|
|
2422
2432
|
}
|
|
2423
2433
|
|
|
2434
|
+
function calculateMinHeightList(count, height) {
|
|
2435
|
+
return count <= 0 ? 160 : (count < 6 ? count : 6) * height;
|
|
2436
|
+
}
|
|
2424
2437
|
function useListController(props) {
|
|
2425
|
-
const {
|
|
2438
|
+
const { count, suggestions, automatic, formControl, lineHeight, reference } = props;
|
|
2426
2439
|
const listIsOpen = require$$0.useRef(false);
|
|
2427
2440
|
const contentRef = require$$0.useRef(null);
|
|
2428
2441
|
const listRef = require$$0.useRef(null);
|
|
@@ -2485,7 +2498,7 @@ function useListController(props) {
|
|
|
2485
2498
|
changeValueInternal.current = false;
|
|
2486
2499
|
}, [collection, formControl?.value]);
|
|
2487
2500
|
const setState = require$$0.useCallback((state) => {
|
|
2488
|
-
const minHeightList =
|
|
2501
|
+
const minHeightList = calculateMinHeightList(count, lineHeight ?? 48);
|
|
2489
2502
|
const _state = state.modalIsVisible
|
|
2490
2503
|
? {
|
|
2491
2504
|
...state,
|
|
@@ -2493,7 +2506,7 @@ function useListController(props) {
|
|
|
2493
2506
|
}
|
|
2494
2507
|
: state;
|
|
2495
2508
|
refreshState((state) => ({ ...state, ..._state }));
|
|
2496
|
-
}, [
|
|
2509
|
+
}, [count]);
|
|
2497
2510
|
const setFormValue = require$$0.useCallback((element, initialValue = false) => {
|
|
2498
2511
|
refreshState((state) => ({
|
|
2499
2512
|
...state,
|
|
@@ -2538,10 +2551,10 @@ function useListController(props) {
|
|
|
2538
2551
|
const DURATION_ANIMATION$1 = 240;
|
|
2539
2552
|
const MAX_ELEMENTS = 6;
|
|
2540
2553
|
function useFieldAutocomplete(props) {
|
|
2541
|
-
const
|
|
2554
|
+
const count = require$$0.useRef(props.suggestions.length);
|
|
2542
2555
|
const controller = useListController({
|
|
2543
2556
|
...props,
|
|
2544
|
-
|
|
2557
|
+
count: count.current
|
|
2545
2558
|
});
|
|
2546
2559
|
const [coincidences, setCoincidences] = require$$0.useState([]);
|
|
2547
2560
|
const [pattern, setPattern] = require$$0.useState('');
|
|
@@ -2560,7 +2573,7 @@ function useFieldAutocomplete(props) {
|
|
|
2560
2573
|
_store.current = store;
|
|
2561
2574
|
const coincidences = collection.slice(0, MAX_ELEMENTS);
|
|
2562
2575
|
setCoincidences(coincidences);
|
|
2563
|
-
|
|
2576
|
+
count.current = coincidences.length;
|
|
2564
2577
|
}, []);
|
|
2565
2578
|
require$$0.useEffect(() => {
|
|
2566
2579
|
refreshCoincidences(props.suggestions, pattern, true);
|
|
@@ -2670,33 +2683,38 @@ function RlsFieldAutocompleteTemplate(props) {
|
|
|
2670
2683
|
});
|
|
2671
2684
|
});
|
|
2672
2685
|
}, []);
|
|
2673
|
-
const
|
|
2686
|
+
const disabled = require$$0.useMemo(() => {
|
|
2674
2687
|
return formControl?.disabled || props.disabled;
|
|
2675
2688
|
}, [formControl?.disabled, props.disabled]);
|
|
2676
2689
|
const className = require$$0.useMemo(() => {
|
|
2677
2690
|
return renderClassStatus('rls-field-box', {
|
|
2678
|
-
focused: autocomplete.focused && !
|
|
2691
|
+
focused: autocomplete.focused && !disabled,
|
|
2679
2692
|
error: formControl?.wrong,
|
|
2680
|
-
disabled
|
|
2693
|
+
disabled,
|
|
2681
2694
|
selected: !!autocomplete.value
|
|
2682
2695
|
}, 'rls-field-list rls-field-autocomplete');
|
|
2683
|
-
}, [formControl?.wrong, autocomplete.value, autocomplete.focused,
|
|
2696
|
+
}, [formControl?.wrong, autocomplete.value, autocomplete.focused, disabled]);
|
|
2684
2697
|
const classNameList = require$$0.useMemo(() => {
|
|
2685
2698
|
return renderClassStatus('rls-field-list__suggestions', {
|
|
2686
2699
|
higher: autocomplete.higher,
|
|
2687
2700
|
visible: autocomplete.modalIsVisible
|
|
2688
2701
|
});
|
|
2689
2702
|
}, [autocomplete.higher, autocomplete.modalIsVisible]);
|
|
2690
|
-
const
|
|
2703
|
+
const onChangePattern = require$$0.useCallback((event) => {
|
|
2691
2704
|
autocomplete.setPattern(event.target.value);
|
|
2692
2705
|
}, [autocomplete.setPattern]);
|
|
2693
|
-
const
|
|
2706
|
+
const onClickPattern = require$$0.useCallback(() => {
|
|
2694
2707
|
onSearch && onSearch(autocomplete.pattern);
|
|
2695
2708
|
}, [onSearch, autocomplete.pattern]);
|
|
2696
|
-
|
|
2709
|
+
const onKeyDownPattern = require$$0.useCallback((event) => {
|
|
2710
|
+
event.key === 'Enter' && onSearch && onSearch(autocomplete.pattern);
|
|
2711
|
+
autocomplete.onKeydownInput(event);
|
|
2712
|
+
}, [autocomplete.onKeydownInput, onSearch, autocomplete.pattern]);
|
|
2713
|
+
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: autocomplete.contentRef, 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("input", { className: "rls-field-list__control", readOnly: true, disabled: disabled, placeholder: placeholder, value: autocomplete.value, onClick: autocomplete.onClickControl }), jsxRuntimeExports.jsx("button", { className: "rls-field-list__action", disabled: disabled, onClick: autocomplete.onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: autocomplete.value ? 'trash-2' : 'arrow-ios-down' }) })] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })), jsxRuntimeExports.jsxs("div", { className: classNameList, children: [jsxRuntimeExports.jsx("div", { className: "rls-field-list__suggestions__body", children: jsxRuntimeExports.jsxs("ul", { ref: autocomplete.listRef, className: "rls-field-list__ul", children: [jsxRuntimeExports.jsxs("div", { className: "rls-field-list__ul__search", children: [jsxRuntimeExports.jsx("input", { ref: autocomplete.inputRef, className: "rls-field-list__ul__control", type: "text", placeholder: labels.listInputPlaceholder, value: autocomplete.pattern, onChange: onChangePattern, onFocus: autocomplete.onFocusInput, onBlur: autocomplete.onBlurInput, onKeyDown: onKeyDownPattern, disabled: disabled || searching }), onSearch && (jsxRuntimeExports.jsx("button", { disabled: disabled || searching, onClick: onClickPattern, children: jsxRuntimeExports.jsx(RlsIcon, { value: "search" }) }))] }), searching && jsxRuntimeExports.jsx(RlsProgressBar, { indeterminate: true }), autocomplete.coincidences.map((element, index) => (jsxRuntimeExports.jsx("li", { className: "rls-field-list__element", tabIndex: -1, onClick: autocomplete.onClickElement(element), onKeyDown: autocomplete.onKeydownElement(element), children: render(element) }, index))), !autocomplete.coincidences.length && (jsxRuntimeExports.jsx("li", { className: "rls-field-list__empty", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-list__empty__description", children: [jsxRuntimeExports.jsx("label", { className: "rls-label-bold rls-truncate", children: labels.listEmptyTitle }), jsxRuntimeExports.jsx("p", { className: "rls-caption-regular", children: labels.listEmptyDescription })] }) }))] }) }), jsxRuntimeExports.jsx("div", { className: "rls-field-list__backdrop", onClick: autocomplete.onClickBackdrop })] })] }));
|
|
2697
2714
|
}
|
|
2698
2715
|
function RlsFieldAutocomplete(props) {
|
|
2699
|
-
|
|
2716
|
+
const render = require$$0.useCallback((element) => (jsxRuntimeExports.jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: jsxRuntimeExports.jsx("span", { children: element.title }) })), []);
|
|
2717
|
+
return jsxRuntimeExports.jsx(RlsFieldAutocompleteTemplate, { ...props, render: render });
|
|
2700
2718
|
}
|
|
2701
2719
|
|
|
2702
2720
|
function RlsModal({ children, overflow, visible, rlsTheme }) {
|
|
@@ -2948,13 +2966,13 @@ function RlsFieldDateRange({ children, date: _date, disabled, formControl, ident
|
|
|
2948
2966
|
}
|
|
2949
2967
|
|
|
2950
2968
|
function useFieldSelect(props) {
|
|
2951
|
-
const
|
|
2969
|
+
const count = require$$0.useRef(props.suggestions.length);
|
|
2952
2970
|
const controller = useListController({
|
|
2953
2971
|
...props,
|
|
2954
|
-
|
|
2972
|
+
count: count.current
|
|
2955
2973
|
});
|
|
2956
2974
|
require$$0.useEffect(() => {
|
|
2957
|
-
|
|
2975
|
+
count.current = props.suggestions.length;
|
|
2958
2976
|
}, [props.suggestions]);
|
|
2959
2977
|
const onFocusInput = require$$0.useCallback(() => {
|
|
2960
2978
|
controller.setState({ focused: true });
|
|
@@ -3060,26 +3078,27 @@ function RlsFieldSelectTemplate(props) {
|
|
|
3060
3078
|
});
|
|
3061
3079
|
});
|
|
3062
3080
|
}, []);
|
|
3063
|
-
const
|
|
3081
|
+
const disabled = require$$0.useMemo(() => {
|
|
3064
3082
|
return formControl?.disabled || props.disabled;
|
|
3065
3083
|
}, [formControl?.disabled, props.disabled]);
|
|
3066
3084
|
const className = require$$0.useMemo(() => {
|
|
3067
3085
|
return renderClassStatus('rls-field-box', {
|
|
3068
|
-
disabled:
|
|
3086
|
+
disabled: disabled,
|
|
3069
3087
|
error: formControl?.wrong,
|
|
3070
|
-
focused: select.focused && !
|
|
3088
|
+
focused: select.focused && !disabled
|
|
3071
3089
|
}, 'rls-field-list rls-field-select');
|
|
3072
|
-
}, [formControl?.wrong, select.focused,
|
|
3090
|
+
}, [formControl?.wrong, select.focused, disabled]);
|
|
3073
3091
|
const classNameList = require$$0.useMemo(() => {
|
|
3074
3092
|
return renderClassStatus('rls-field-list__suggestions', {
|
|
3075
3093
|
higher: select.higher,
|
|
3076
3094
|
visible: select.modalIsVisible
|
|
3077
3095
|
});
|
|
3078
3096
|
}, [select.modalIsVisible, select.higher]);
|
|
3079
|
-
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: select.contentRef, 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("input", { ref: select.inputRef, className: "rls-field-list__control", readOnly: true,
|
|
3097
|
+
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: select.contentRef, 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("input", { ref: select.inputRef, className: "rls-field-list__control", readOnly: true, placeholder: placeholder, value: select.value, onFocus: select.onFocusInput, onBlur: select.onBlurInput, onClick: select.onClickInput, onKeyDown: select.onKeydownInput, disabled: disabled }), jsxRuntimeExports.jsx("button", { className: 'rls-field-list__action', disabled: disabled, onClick: select.onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: !unremovable && !!select.value ? 'close' : 'arrow-ios-down' }) })] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })), jsxRuntimeExports.jsxs("div", { className: classNameList, children: [jsxRuntimeExports.jsx("div", { className: "rls-field-list__suggestions__body", children: jsxRuntimeExports.jsxs("ul", { ref: select.listRef, className: "rls-field-list__ul", children: [suggestions.map((element, index) => (jsxRuntimeExports.jsx("li", { className: "rls-field-list__element", tabIndex: -1, onClick: select.onClickElement(element), onKeyDown: select.onKeydownElement(element), children: render(element) }, index))), !suggestions.length && (jsxRuntimeExports.jsx("li", { className: "rls-field-list__empty", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-list__empty__description", children: [jsxRuntimeExports.jsx("label", { className: "rls-label-bold rls-truncate", children: labels.listEmptyTitle }), jsxRuntimeExports.jsx("p", { className: "rls-caption-regular", children: labels.listEmptyDescription })] }) }))] }) }), jsxRuntimeExports.jsx("div", { className: "rls-field-list__backdrop", onClick: select.onClickBackdrop })] })] }));
|
|
3080
3098
|
}
|
|
3081
3099
|
function RlsFieldSelect(props) {
|
|
3082
|
-
|
|
3100
|
+
const render = require$$0.useCallback((element) => (jsxRuntimeExports.jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: jsxRuntimeExports.jsx("span", { children: element.title }) })), []);
|
|
3101
|
+
return jsxRuntimeExports.jsx(RlsFieldSelectTemplate, { ...props, render: render });
|
|
3083
3102
|
}
|
|
3084
3103
|
|
|
3085
3104
|
function RlsFormNavigation({ children, visible, rlsTheme }) {
|
|
@@ -3251,6 +3270,8 @@ exports.renderClassStatus = renderClassStatus;
|
|
|
3251
3270
|
exports.setErrorsI18n = setErrorsI18n;
|
|
3252
3271
|
exports.useConfirmation = useConfirmation;
|
|
3253
3272
|
exports.useDatatable = useDatatable;
|
|
3273
|
+
exports.useFieldAutocomplete = useFieldAutocomplete;
|
|
3274
|
+
exports.useFieldSelect = useFieldSelect;
|
|
3254
3275
|
exports.useListController = useListController;
|
|
3255
3276
|
exports.useSnackbar = useSnackbar;
|
|
3256
3277
|
//# sourceMappingURL=index.js.map
|