@rolster/react-components 19.1.12 → 19.1.13
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-BamXLzHk.css → index-Dvak5slE.css} +36 -0
- package/dist/cjs/index.js +122 -25
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/assets/{index-BamXLzHk.css → index-Dvak5slE.css} +36 -0
- package/dist/es/index.js +121 -26
- package/dist/es/index.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/ButtonAction/ButtonAction.css +3 -0
- package/dist/esm/components/atoms/ButtonAction/ButtonAction.css.map +1 -1
- package/dist/esm/components/atoms/Input/Input.js +12 -12
- package/dist/esm/components/atoms/Input/Input.js.map +1 -1
- package/dist/esm/components/definitions.d.ts +5 -2
- package/dist/esm/components/organisms/BottomSheet/BottomSheet.d.ts +5 -2
- package/dist/esm/components/organisms/BottomSheet/BottomSheet.js +6 -5
- package/dist/esm/components/organisms/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/esm/components/organisms/Dropdown/Dropdown.css +31 -0
- package/dist/esm/components/organisms/Dropdown/Dropdown.css.map +1 -0
- package/dist/esm/components/organisms/Dropdown/Dropdown.d.ts +8 -0
- package/dist/esm/components/organisms/Dropdown/Dropdown.js +23 -0
- package/dist/esm/components/organisms/Dropdown/Dropdown.js.map +1 -0
- package/dist/esm/components/organisms/FormNavigation/FormNavigation.d.ts +3 -1
- package/dist/esm/components/organisms/FormNavigation/FormNavigation.js +3 -3
- package/dist/esm/components/organisms/FormNavigation/FormNavigation.js.map +1 -1
- package/dist/esm/components/organisms/Modal/Modal.d.ts +5 -2
- package/dist/esm/components/organisms/Modal/Modal.js +6 -5
- package/dist/esm/components/organisms/Modal/Modal.js.map +1 -1
- package/dist/esm/controllers/DropdownController.d.ts +9 -0
- package/dist/esm/controllers/DropdownController.js +75 -0
- package/dist/esm/controllers/DropdownController.js.map +1 -0
- package/dist/esm/index.d.ts +3 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -425,6 +425,7 @@
|
|
|
425
425
|
color: var(--pvt-button-content-font-color);
|
|
426
426
|
border: var(--pvt-button-content-border);
|
|
427
427
|
background: var(--pvt-button-content-background);
|
|
428
|
+
pointer-events: none;
|
|
428
429
|
}
|
|
429
430
|
.rls-button__content::before {
|
|
430
431
|
position: absolute;
|
|
@@ -592,6 +593,9 @@
|
|
|
592
593
|
opacity: 0.5;
|
|
593
594
|
pointer-events: none;
|
|
594
595
|
}
|
|
596
|
+
.rls-button-action__content {
|
|
597
|
+
pointer-events: none;
|
|
598
|
+
}
|
|
595
599
|
.rls-button-action__tooltip {
|
|
596
600
|
position: absolute;
|
|
597
601
|
top: calc(100% + var(--rls-sizing-x6));
|
|
@@ -2546,6 +2550,38 @@
|
|
|
2546
2550
|
}
|
|
2547
2551
|
} /*# sourceMappingURL=Confirmation.css.map */
|
|
2548
2552
|
|
|
2553
|
+
.rls-dropdown {
|
|
2554
|
+
--pvt-content-opacity: 0;
|
|
2555
|
+
--pvt-content-transform: scale(0, 0);
|
|
2556
|
+
position: var(--rlc-dropdown-position, absolute);
|
|
2557
|
+
display: block;
|
|
2558
|
+
opacity: 0;
|
|
2559
|
+
width: auto;
|
|
2560
|
+
z-index: -16;
|
|
2561
|
+
transition: opacity 240ms 0ms var(--rls-standard-curve);
|
|
2562
|
+
}
|
|
2563
|
+
.rls-dropdown--visible {
|
|
2564
|
+
--pvt-content-opacity: 1;
|
|
2565
|
+
--pvt-content-transform: scale(1, 1);
|
|
2566
|
+
opacity: 1;
|
|
2567
|
+
z-index: var(--rlc-dropdown-z-index, var(--rls-z-index-4));
|
|
2568
|
+
}
|
|
2569
|
+
.rls-dropdown__content {
|
|
2570
|
+
display: block;
|
|
2571
|
+
width: auto;
|
|
2572
|
+
max-width: var(--rlc-dropdown-max-width, 150rem);
|
|
2573
|
+
border-radius: var(--rlc-dropdown-radius, var(--rls-sizing-x6));
|
|
2574
|
+
padding: var(--rlc-dropdown-padding, var(--rls-sizing-x6));
|
|
2575
|
+
box-sizing: border-box;
|
|
2576
|
+
border: var(--rlc-dropdown-border, var(--rls-app-border-1-200));
|
|
2577
|
+
background: var(--rlc-dropdown-background, var(--rls-app-color-050));
|
|
2578
|
+
opacity: var(--pvt-content-opacity);
|
|
2579
|
+
transform: var(--pvt-content-transform);
|
|
2580
|
+
transition:
|
|
2581
|
+
transform 240ms 0ms var(--rls-standard-curve),
|
|
2582
|
+
opacity 240ms 0ms var(--rls-standard-curve);
|
|
2583
|
+
} /*# sourceMappingURL=Dropdown.css.map */
|
|
2584
|
+
|
|
2549
2585
|
.rls-field-autocomplete {
|
|
2550
2586
|
--pvt-control-width: 100%;
|
|
2551
2587
|
--pvt-control-opacity: 1;
|
package/dist/cjs/index.js
CHANGED
|
@@ -584,7 +584,7 @@ function RlsImage({ src, rlsTheme }) {
|
|
|
584
584
|
}
|
|
585
585
|
|
|
586
586
|
function RlsInput({ children, decimals, disabled, formControl, identifier, onBlur, onEnter, onFocus, onKeyDown, onKeyUp, onValue, placeholder, readOnly, type, value }) {
|
|
587
|
-
const valueInitial = formControl?.value ?? value ? String(value) : '';
|
|
587
|
+
const valueInitial = (formControl?.value ?? value) ? String(value) : '';
|
|
588
588
|
const [valueInput, setValueInput] = require$$0.useState(valueInitial);
|
|
589
589
|
const [focused, setFocused] = require$$0.useState(false);
|
|
590
590
|
const changeIsInternal = require$$0.useRef(false);
|
|
@@ -595,7 +595,7 @@ function RlsInput({ children, decimals, disabled, formControl, identifier, onBlu
|
|
|
595
595
|
}
|
|
596
596
|
changeIsInternal.current = false;
|
|
597
597
|
}, [formControl?.value]);
|
|
598
|
-
const
|
|
598
|
+
const onChangeInput = require$$0.useCallback((event) => {
|
|
599
599
|
const valueInput = event.target.value;
|
|
600
600
|
const value = type === 'number'
|
|
601
601
|
? parseFloat((+valueInput).toFixed(decimals))
|
|
@@ -605,22 +605,22 @@ function RlsInput({ children, decimals, disabled, formControl, identifier, onBlu
|
|
|
605
605
|
setValueInput(valueInput);
|
|
606
606
|
formControl?.setValue(value);
|
|
607
607
|
}, [formControl, onValue, type, decimals]);
|
|
608
|
-
const
|
|
609
|
-
onKeyDown
|
|
610
|
-
event.key === 'Enter' && onEnter
|
|
608
|
+
const onKeyDownInput = require$$0.useCallback((event) => {
|
|
609
|
+
onKeyDown?.(event);
|
|
610
|
+
event.key === 'Enter' && onEnter?.();
|
|
611
611
|
}, [onKeyDown, onEnter]);
|
|
612
|
-
const
|
|
613
|
-
onKeyUp
|
|
612
|
+
const onKeyUpInput = require$$0.useCallback((event) => {
|
|
613
|
+
onKeyUp?.(event);
|
|
614
614
|
}, [onKeyUp]);
|
|
615
|
-
const
|
|
615
|
+
const onFocusInput = require$$0.useCallback(() => {
|
|
616
616
|
formControl?.focus();
|
|
617
617
|
setFocused(() => true);
|
|
618
|
-
onFocus
|
|
618
|
+
onFocus?.();
|
|
619
619
|
}, [formControl, onFocus]);
|
|
620
|
-
const
|
|
620
|
+
const onBlurInput = require$$0.useCallback(() => {
|
|
621
621
|
formControl?.blur();
|
|
622
622
|
setFocused(() => false);
|
|
623
|
-
onBlur
|
|
623
|
+
onBlur?.();
|
|
624
624
|
}, [formControl, onBlur]);
|
|
625
625
|
const className = require$$0.useMemo(() => {
|
|
626
626
|
return renderClassStatus('rls-input', {
|
|
@@ -628,7 +628,7 @@ function RlsInput({ children, decimals, disabled, formControl, identifier, onBlu
|
|
|
628
628
|
focused: formControl?.focused ?? focused
|
|
629
629
|
});
|
|
630
630
|
}, [formControl?.focused, formControl?.disabled, focused, disabled]);
|
|
631
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, children: [jsxRuntimeExports.jsx("input", { ref: formControl?.elementRef, className: "rls-input__component", autoComplete: "off", type: type ?? 'text', placeholder: placeholder, disabled: formControl?.disabled || disabled, readOnly: readOnly, onFocus:
|
|
631
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, children: [jsxRuntimeExports.jsx("input", { ref: formControl?.elementRef, className: "rls-input__component", autoComplete: "off", type: type ?? 'text', placeholder: placeholder, disabled: formControl?.disabled || disabled, readOnly: readOnly, onFocus: onFocusInput, onBlur: onBlurInput, onChange: onChangeInput, onKeyDown: onKeyDownInput, onKeyUp: onKeyUpInput, value: valueInput }), jsxRuntimeExports.jsx("span", { className: "rls-input__value", children: children })] }));
|
|
632
632
|
}
|
|
633
633
|
|
|
634
634
|
function RlsInputDecimal(props) {
|
|
@@ -1574,13 +1574,14 @@ function RlsToolbar({ actions, children, subtitle }) {
|
|
|
1574
1574
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-toolbar", children: [jsxRuntimeExports.jsxs("div", { className: "rls-toolbar__description", children: [children && jsxRuntimeExports.jsx("label", { className: "rls-toolbar__title", children: children }), subtitle && (jsxRuntimeExports.jsx("label", { className: "rls-toolbar__subtitle smalltext-semibold", children: subtitle }))] }), actions && (jsxRuntimeExports.jsx("div", { className: "rls-toolbar__actions", children: actions.map((action, index) => (jsxRuntimeExports.jsx("div", { children: action }, index))) }))] }));
|
|
1575
1575
|
}
|
|
1576
1576
|
|
|
1577
|
-
function RlsBottomSheet({ children, className,
|
|
1577
|
+
function RlsBottomSheet({ autoclose, children, className, controller, onBackdrop, visible, rlsTheme }) {
|
|
1578
1578
|
const classNameSheet = require$$0.useMemo(() => {
|
|
1579
|
-
return renderClassStatus('rls-bottom-sheet', { visible }, className);
|
|
1580
|
-
}, [className, visible]);
|
|
1579
|
+
return renderClassStatus('rls-bottom-sheet', { visible: controller?.visible ?? visible }, className);
|
|
1580
|
+
}, [className, visible, controller?.visible]);
|
|
1581
1581
|
const onClickBackdrop = require$$0.useCallback(() => {
|
|
1582
|
-
|
|
1583
|
-
|
|
1582
|
+
autoclose && controller?.close();
|
|
1583
|
+
onBackdrop?.();
|
|
1584
|
+
}, [autoclose, controller, onBackdrop]);
|
|
1584
1585
|
return ReactDOM.createPortal(jsxRuntimeExports.jsxs("div", { className: classNameSheet, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-bottom-sheet__component", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-bottom-sheet__backdrop", onClick: onClickBackdrop })] }), document.body);
|
|
1585
1586
|
}
|
|
1586
1587
|
|
|
@@ -1753,6 +1754,25 @@ function RlsDatatableFloating({ children, className, identifier, invested, rlsTh
|
|
|
1753
1754
|
return (jsxRuntimeExports.jsx("td", { id: identifier, className: classNameFloating, "rls-theme": rlsTheme, children: children }));
|
|
1754
1755
|
}
|
|
1755
1756
|
|
|
1757
|
+
function RlsDropdown({ children, controller, rlsTheme }) {
|
|
1758
|
+
const className = require$$0.useMemo(() => {
|
|
1759
|
+
return renderClassStatus('rls-dropdown', {
|
|
1760
|
+
visible: controller.visible
|
|
1761
|
+
});
|
|
1762
|
+
}, [controller.visible]);
|
|
1763
|
+
require$$0.useEffect(() => {
|
|
1764
|
+
function onCloseDropdown({ target }) {
|
|
1765
|
+
!controller.component.current.contains(target) &&
|
|
1766
|
+
controller.close();
|
|
1767
|
+
}
|
|
1768
|
+
document.addEventListener('click', onCloseDropdown);
|
|
1769
|
+
return () => {
|
|
1770
|
+
document.removeEventListener('click', onCloseDropdown);
|
|
1771
|
+
};
|
|
1772
|
+
}, []);
|
|
1773
|
+
return (jsxRuntimeExports.jsx("div", { ref: controller.component, className: className, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-dropdown__content", children: children }) }));
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1756
1776
|
function calculateMinHeightList(count, height) {
|
|
1757
1777
|
return count <= 0 ? 160 : (count < 6 ? count : 6) * height;
|
|
1758
1778
|
}
|
|
@@ -2060,13 +2080,14 @@ function RlsFieldAutocomplete(props) {
|
|
|
2060
2080
|
return jsxRuntimeExports.jsx(RlsFieldAutocompleteTemplate, { ...props, render: render });
|
|
2061
2081
|
}
|
|
2062
2082
|
|
|
2063
|
-
function RlsModal({ children, className,
|
|
2083
|
+
function RlsModal({ autoclose, children, className, controller, onBackdrop, visible, rlsTheme }) {
|
|
2064
2084
|
const classNameModal = require$$0.useMemo(() => {
|
|
2065
|
-
return renderClassStatus('rls-modal', { visible }, className);
|
|
2066
|
-
}, [className, visible]);
|
|
2085
|
+
return renderClassStatus('rls-modal', { visible: controller?.visible ?? visible }, className);
|
|
2086
|
+
}, [className, visible, controller?.visible]);
|
|
2067
2087
|
const onClickBackdrop = require$$0.useCallback(() => {
|
|
2068
|
-
|
|
2069
|
-
|
|
2088
|
+
autoclose && controller?.close();
|
|
2089
|
+
onBackdrop?.();
|
|
2090
|
+
}, [autoclose, controller, onBackdrop]);
|
|
2070
2091
|
return ReactDOM.createPortal(jsxRuntimeExports.jsxs("div", { className: classNameModal, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-modal__component", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-modal__backdrop", onClick: onClickBackdrop })] }), document.body);
|
|
2071
2092
|
}
|
|
2072
2093
|
|
|
@@ -2729,10 +2750,10 @@ function RlsFieldSelect(props) {
|
|
|
2729
2750
|
return jsxRuntimeExports.jsx(RlsFieldSelectTemplate, { ...props, render: render });
|
|
2730
2751
|
}
|
|
2731
2752
|
|
|
2732
|
-
function RlsFormNavigation({ children, className, visible, rlsTheme }) {
|
|
2753
|
+
function RlsFormNavigation({ children, className, controller, visible, rlsTheme }) {
|
|
2733
2754
|
const classNameForm = require$$0.useMemo(() => {
|
|
2734
|
-
return renderClassStatus('rls-form-navigation', { visible }, className);
|
|
2735
|
-
}, [visible,
|
|
2755
|
+
return renderClassStatus('rls-form-navigation', { visible: controller?.visible ?? visible }, className);
|
|
2756
|
+
}, [className, visible, controller?.visible]);
|
|
2736
2757
|
return ReactDOM.createPortal(jsxRuntimeExports.jsx("div", { className: classNameForm, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-form-navigation__component", children: children }) }), document.body);
|
|
2737
2758
|
}
|
|
2738
2759
|
|
|
@@ -3265,6 +3286,80 @@ function RlsApplication({ children }) {
|
|
|
3265
3286
|
}, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children, RlsSnackbar] }), RlsConfirmation] }));
|
|
3266
3287
|
}
|
|
3267
3288
|
|
|
3289
|
+
function useDropdownController() {
|
|
3290
|
+
const [visible, setVisible] = require$$0.useState(false);
|
|
3291
|
+
const component = require$$0.useRef(null);
|
|
3292
|
+
const open = require$$0.useCallback((positionX, positionY) => {
|
|
3293
|
+
component.current.style.transformOrigin = '0% 0%';
|
|
3294
|
+
component.current.style.top = `${positionY}px`;
|
|
3295
|
+
component.current.style.left = `${positionX}px`;
|
|
3296
|
+
setVisible(true);
|
|
3297
|
+
}, []);
|
|
3298
|
+
const openWithEvent = require$$0.useCallback((event) => {
|
|
3299
|
+
const rectContent = component.current.getBoundingClientRect();
|
|
3300
|
+
const rectElement = event.target.getBoundingClientRect();
|
|
3301
|
+
let positionX = 0;
|
|
3302
|
+
let positionY = 0;
|
|
3303
|
+
let effect = '0% 0%';
|
|
3304
|
+
let transform = 0;
|
|
3305
|
+
const elementX = rectElement.x + rectElement.width / 2;
|
|
3306
|
+
const elementY = rectElement.y + rectElement.height / 2;
|
|
3307
|
+
if (elementX + rectContent.width <= window.innerWidth) {
|
|
3308
|
+
positionX = elementX;
|
|
3309
|
+
transform += 1;
|
|
3310
|
+
}
|
|
3311
|
+
else if (elementX + rectElement.width - rectContent.width > 0) {
|
|
3312
|
+
positionX = elementX + rectElement.width - rectContent.width;
|
|
3313
|
+
transform += 3;
|
|
3314
|
+
}
|
|
3315
|
+
else {
|
|
3316
|
+
positionX = window.innerWidth - rectContent.width;
|
|
3317
|
+
transform += 1;
|
|
3318
|
+
}
|
|
3319
|
+
if (elementY + rectContent.height <= window.innerHeight) {
|
|
3320
|
+
positionY = elementY;
|
|
3321
|
+
transform += 4;
|
|
3322
|
+
}
|
|
3323
|
+
else if (elementY + rectElement.height - rectContent.height > 0) {
|
|
3324
|
+
positionY = elementY + rectElement.height - rectContent.height;
|
|
3325
|
+
transform += 7;
|
|
3326
|
+
}
|
|
3327
|
+
else {
|
|
3328
|
+
positionY = window.innerHeight - rectContent.height;
|
|
3329
|
+
transform += 4;
|
|
3330
|
+
}
|
|
3331
|
+
switch (transform) {
|
|
3332
|
+
case 7:
|
|
3333
|
+
effect = '100% 0%';
|
|
3334
|
+
break;
|
|
3335
|
+
case 8:
|
|
3336
|
+
effect = '0% 100%';
|
|
3337
|
+
break;
|
|
3338
|
+
case 10:
|
|
3339
|
+
effect = '100% 100%';
|
|
3340
|
+
break;
|
|
3341
|
+
default:
|
|
3342
|
+
effect = '0% 0%';
|
|
3343
|
+
break;
|
|
3344
|
+
}
|
|
3345
|
+
component.current.style.transformOrigin = effect;
|
|
3346
|
+
component.current.style.top = `${positionY}px`;
|
|
3347
|
+
component.current.style.left = `${positionX}px`;
|
|
3348
|
+
setVisible(true);
|
|
3349
|
+
event.stopPropagation();
|
|
3350
|
+
}, []);
|
|
3351
|
+
const close = require$$0.useCallback(() => {
|
|
3352
|
+
setVisible(false);
|
|
3353
|
+
}, []);
|
|
3354
|
+
return {
|
|
3355
|
+
close,
|
|
3356
|
+
component,
|
|
3357
|
+
open,
|
|
3358
|
+
openWithEvent,
|
|
3359
|
+
visible
|
|
3360
|
+
};
|
|
3361
|
+
}
|
|
3362
|
+
|
|
3268
3363
|
function usePortalController() {
|
|
3269
3364
|
const [visible, setVisible] = require$$0.useState(false);
|
|
3270
3365
|
const open = require$$0.useCallback(() => {
|
|
@@ -3305,6 +3400,7 @@ exports.RlsDatatableRecord = RlsDatatableRecord;
|
|
|
3305
3400
|
exports.RlsDatatableSubheader = RlsDatatableSubheader;
|
|
3306
3401
|
exports.RlsDatatableTitle = RlsDatatableTitle;
|
|
3307
3402
|
exports.RlsDatatableTotals = RlsDatatableTotals;
|
|
3403
|
+
exports.RlsDropdown = RlsDropdown;
|
|
3308
3404
|
exports.RlsFieldAutocomplete = RlsFieldAutocomplete;
|
|
3309
3405
|
exports.RlsFieldAutocompleteTemplate = RlsFieldAutocompleteTemplate;
|
|
3310
3406
|
exports.RlsFieldClock = RlsFieldClock;
|
|
@@ -3370,6 +3466,7 @@ exports.renderClassStatus = renderClassStatus;
|
|
|
3370
3466
|
exports.setErrorsI18n = setErrorsI18n;
|
|
3371
3467
|
exports.useConfirmation = useConfirmation;
|
|
3372
3468
|
exports.useDatatable = useDatatable;
|
|
3469
|
+
exports.useDropdownController = useDropdownController;
|
|
3373
3470
|
exports.useFieldAutocomplete = useFieldAutocomplete;
|
|
3374
3471
|
exports.useFieldSelect = useFieldSelect;
|
|
3375
3472
|
exports.useFormSingleSelectionController = useFormSingleSelectionController;
|