@rolster/react-components 19.6.4 → 19.6.9
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/LICENSE +21 -21
- package/dist/cjs/index.cjs +851 -595
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/es/index.mjs +851 -597
- package/dist/es/index.mjs.map +1 -1
- package/dist/esm/components/atoms/AreaText/AreaText.js +6 -2
- package/dist/esm/components/atoms/AreaText/AreaText.js.map +1 -1
- package/dist/esm/components/atoms/ButtonAction/ButtonAction.d.ts +1 -1
- package/dist/esm/components/atoms/ButtonAction/ButtonAction.js +1 -1
- package/dist/esm/components/atoms/ButtonAction/ButtonAction.js.map +1 -1
- package/dist/esm/components/atoms/CheckBox/CheckBox.d.ts +1 -1
- package/dist/esm/components/atoms/Input/Input.js +6 -2
- package/dist/esm/components/atoms/Input/Input.js.map +1 -1
- package/dist/esm/components/atoms/InputCounter/InputCounter.js +5 -3
- package/dist/esm/components/atoms/InputCounter/InputCounter.js.map +1 -1
- package/dist/esm/components/atoms/InputDecimal/InputDecimal.js +6 -1
- package/dist/esm/components/atoms/InputDecimal/InputDecimal.js.map +1 -1
- package/dist/esm/components/atoms/InputMoney/InputMoney.js +3 -1
- package/dist/esm/components/atoms/InputMoney/InputMoney.js.map +1 -1
- package/dist/esm/components/atoms/InputNumber/InputNumber.js +3 -1
- package/dist/esm/components/atoms/InputNumber/InputNumber.js.map +1 -1
- package/dist/esm/components/atoms/InputPassword/InputPassword.js +3 -1
- package/dist/esm/components/atoms/InputPassword/InputPassword.js.map +1 -1
- package/dist/esm/components/atoms/InputPercentage/InputPercentage.js +3 -1
- package/dist/esm/components/atoms/InputPercentage/InputPercentage.js.map +1 -1
- package/dist/esm/components/atoms/InputSearch/InputSearch.d.ts +1 -1
- package/dist/esm/components/atoms/InputSearch/InputSearch.js +3 -1
- package/dist/esm/components/atoms/InputSearch/InputSearch.js.map +1 -1
- package/dist/esm/components/atoms/InputText/InputText.js +3 -1
- package/dist/esm/components/atoms/InputText/InputText.js.map +1 -1
- package/dist/esm/components/atoms/Led/Led.js.map +1 -1
- package/dist/esm/components/atoms/Spinner/Spinner.js.map +1 -1
- package/dist/esm/components/atoms/Switch/Switch.d.ts +1 -1
- package/dist/esm/components/molecules/Alert/Alert.d.ts +1 -1
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.js +12 -4
- package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.js.map +1 -1
- package/dist/esm/components/molecules/FieldArea/FieldArea.d.ts +1 -1
- package/dist/esm/components/molecules/FieldArea/FieldArea.js.map +1 -1
- package/dist/esm/components/molecules/FieldFile/FieldFile.d.ts +1 -1
- package/dist/esm/components/molecules/FieldFile/FieldFile.js +6 -4
- package/dist/esm/components/molecules/FieldFile/FieldFile.js.map +1 -1
- package/dist/esm/components/molecules/FieldListSuggestions/FieldListSuggestions.d.ts +1 -1
- package/dist/esm/components/molecules/FieldMoney/FieldMoney.js +3 -2
- package/dist/esm/components/molecules/FieldMoney/FieldMoney.js.map +1 -1
- package/dist/esm/components/molecules/FieldNumber/FieldNumber.js +3 -2
- package/dist/esm/components/molecules/FieldNumber/FieldNumber.js.map +1 -1
- package/dist/esm/components/molecules/FieldPercentage/FieldPercentage.js +3 -2
- package/dist/esm/components/molecules/FieldPercentage/FieldPercentage.js.map +1 -1
- package/dist/esm/components/molecules/FieldText/FieldText.js +3 -2
- package/dist/esm/components/molecules/FieldText/FieldText.js.map +1 -1
- package/dist/esm/components/molecules/MessageFormError/MessageFormError.js.map +1 -1
- package/dist/esm/components/molecules/Pagination/Pagination.js +2 -1
- package/dist/esm/components/molecules/Pagination/Pagination.js.map +1 -1
- package/dist/esm/components/molecules/PickerDay/PickerDay.d.ts +1 -1
- package/dist/esm/components/molecules/PickerDay/PickerDay.js +22 -7
- package/dist/esm/components/molecules/PickerDay/PickerDay.js.map +1 -1
- package/dist/esm/components/molecules/PickerDayRange/PickerDayRange.js +4 -2
- package/dist/esm/components/molecules/PickerDayRange/PickerDayRange.js.map +1 -1
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.js +20 -10
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.js.map +1 -1
- package/dist/esm/components/molecules/PickerSelectorTitle/PickerSelectorTitle.js +17 -5
- package/dist/esm/components/molecules/PickerSelectorTitle/PickerSelectorTitle.js.map +1 -1
- package/dist/esm/components/molecules/PickerYear/PickerYear.js +18 -4
- package/dist/esm/components/molecules/PickerYear/PickerYear.js.map +1 -1
- package/dist/esm/components/molecules/Slider/Slider.js.map +1 -1
- package/dist/esm/components/molecules/Tabs/Tabs.js +6 -2
- package/dist/esm/components/molecules/Tabs/Tabs.js.map +1 -1
- package/dist/esm/components/organisms/BottomSheet/BottomSheet.js +3 -1
- package/dist/esm/components/organisms/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/esm/components/organisms/Confirmation/Confirmation.d.ts +1 -1
- package/dist/esm/components/organisms/Dropdown/Dropdown.js +2 -1
- package/dist/esm/components/organisms/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js +3 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js.map +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteController.js +12 -5
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteController.js.map +1 -1
- package/dist/esm/components/organisms/FieldClock/FieldClock.d.ts +1 -1
- package/dist/esm/components/organisms/FieldClock/FieldClock.js +6 -2
- package/dist/esm/components/organisms/FieldClock/FieldClock.js.map +1 -1
- package/dist/esm/components/organisms/FieldColor/FieldColor.js +6 -2
- package/dist/esm/components/organisms/FieldColor/FieldColor.js.map +1 -1
- package/dist/esm/components/organisms/FieldDate/FieldDate.d.ts +1 -1
- package/dist/esm/components/organisms/FieldDate/FieldDate.js +6 -2
- package/dist/esm/components/organisms/FieldDate/FieldDate.js.map +1 -1
- package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.js +6 -2
- package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.js.map +1 -1
- package/dist/esm/components/organisms/FieldList/FieldList.js +1 -1
- package/dist/esm/components/organisms/FieldList/FieldList.js.map +1 -1
- package/dist/esm/components/organisms/FieldList/FieldListController.d.ts +5 -5
- package/dist/esm/components/organisms/FieldList/FieldListController.js +5 -2
- package/dist/esm/components/organisms/FieldList/FieldListController.js.map +1 -1
- package/dist/esm/components/organisms/FieldSelect/FieldSelectController.js +21 -8
- package/dist/esm/components/organisms/FieldSelect/FieldSelectController.js.map +1 -1
- package/dist/esm/components/organisms/ImageChooser/ImageChooser.js +3 -1
- package/dist/esm/components/organisms/ImageChooser/ImageChooser.js.map +1 -1
- package/dist/esm/components/organisms/ImageEditor/ImageEditor.d.ts +1 -1
- package/dist/esm/components/organisms/ImageEditorModal/ImageEditorModal.d.ts +1 -1
- package/dist/esm/components/organisms/Modal/Modal.js +3 -1
- package/dist/esm/components/organisms/Modal/Modal.js.map +1 -1
- package/dist/esm/components/organisms/ModalSheet/ModalSheet.js +3 -1
- package/dist/esm/components/organisms/ModalSheet/ModalSheet.js.map +1 -1
- package/dist/esm/components/organisms/Notifications/Notifications.d.ts +17 -0
- package/dist/esm/components/organisms/Notifications/Notifications.js +59 -0
- package/dist/esm/components/organisms/Notifications/Notifications.js.map +1 -0
- package/dist/esm/components/organisms/PickerClock/PickerClock.js +12 -2
- package/dist/esm/components/organisms/PickerClock/PickerClock.js.map +1 -1
- package/dist/esm/components/organisms/PickerColor/PickerColor.js +9 -3
- package/dist/esm/components/organisms/PickerColor/PickerColor.js.map +1 -1
- package/dist/esm/components/organisms/PickerDate/PickerDate.js +7 -2
- package/dist/esm/components/organisms/PickerDate/PickerDate.js.map +1 -1
- package/dist/esm/components/organisms/PickerDateRange/PickerDateRange.js +7 -2
- package/dist/esm/components/organisms/PickerDateRange/PickerDateRange.js.map +1 -1
- package/dist/esm/components/organisms/Snackbar/Snackbar.js +3 -1
- package/dist/esm/components/organisms/Snackbar/Snackbar.js.map +1 -1
- package/dist/esm/components/types.d.ts +6 -1
- package/dist/esm/context.d.ts +5 -2
- package/dist/esm/context.js +14 -12
- package/dist/esm/context.js.map +1 -1
- package/dist/esm/controllers/DropdownController.js +3 -3
- package/dist/esm/controllers/DropdownController.js.map +1 -1
- package/dist/esm/controllers/FormToggleController.js +8 -3
- package/dist/esm/controllers/FormToggleController.js.map +1 -1
- package/dist/esm/controllers/ImageEditorController.js +6 -2
- package/dist/esm/controllers/ImageEditorController.js.map +1 -1
- package/dist/esm/controllers/ListController.d.ts +1 -1
- package/dist/esm/controllers/ListController.js +26 -11
- package/dist/esm/controllers/ListController.js.map +1 -1
- package/dist/esm/controllers/ResizeController.js +2 -1
- package/dist/esm/controllers/ResizeController.js.map +1 -1
- package/dist/esm/helpers/color.d.ts +4 -4
- package/dist/esm/helpers/css.js +6 -5
- package/dist/esm/helpers/css.js.map +1 -1
- package/dist/esm/helpers/date-range-picker.js.map +1 -1
- package/dist/esm/helpers/design-system.js.map +1 -1
- package/dist/esm/helpers/language.js.map +1 -1
- package/dist/esm/index.d.ts +8 -7
- package/dist/esm/index.js +7 -6
- package/dist/esm/index.js.map +1 -1
- package/package.json +83 -91
package/dist/es/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import require$$0, { useMemo, useState, useRef, useCallback, useEffect, useEffectEvent, createContext } from 'react';
|
|
1
|
+
import require$$0, { useMemo, useState, useRef, useCallback, useEffect, useEffectEvent, createContext, useContext } from 'react';
|
|
2
2
|
import { currencyFormat, BigDecimal, valueIsDefined, SealedPartial } from '@rolster/commons';
|
|
3
3
|
import { i18n, i18nSubscribe } from '@rolster/i18n';
|
|
4
4
|
import { PaginationController, verifyDayPicker, createDayPicker, createDayRangePicker, verifyMonthPicker, createMonthPicker, monthLimitTemplate, createYearPicker, verifyYearPicker, ListCollection, navigationListFromInput, navigationListFromElement, createAutocompleteStore, PickerListenerEvent, dateOutRange, verifyDateRange } from '@rolster/components';
|
|
@@ -431,12 +431,13 @@ var jsxRuntimeExports = requireJsxRuntime();
|
|
|
431
431
|
function renderClassStatus(base, status = {}, additionals) {
|
|
432
432
|
const _classElement = [base];
|
|
433
433
|
Object.entries(status).forEach(([key, state]) => {
|
|
434
|
-
state
|
|
435
|
-
(typeof state === 'string'
|
|
436
|
-
|
|
437
|
-
: _classElement.push(`${base}--${key}`));
|
|
434
|
+
if (state) {
|
|
435
|
+
_classElement.push(typeof state === 'string' ? `${base}--${state}` : `${base}--${key}`);
|
|
436
|
+
}
|
|
438
437
|
});
|
|
439
|
-
|
|
438
|
+
if (additionals) {
|
|
439
|
+
_classElement.push(additionals);
|
|
440
|
+
}
|
|
440
441
|
return _classElement.join(' ').trim();
|
|
441
442
|
}
|
|
442
443
|
|
|
@@ -492,7 +493,9 @@ function RlsAreaText({ autoComplete, disabled, formControl, identifier, onBlur,
|
|
|
492
493
|
useEffect(() => {
|
|
493
494
|
if (!changeIsInternal.current) {
|
|
494
495
|
const nextValue = String(formControl?.value ?? value ?? '');
|
|
495
|
-
valueArea !== nextValue
|
|
496
|
+
if (valueArea !== nextValue) {
|
|
497
|
+
setValueArea(nextValue);
|
|
498
|
+
}
|
|
496
499
|
}
|
|
497
500
|
changeIsInternal.current = false;
|
|
498
501
|
}, [formControl?.value, value, valueArea]);
|
|
@@ -510,7 +513,9 @@ function RlsAreaText({ autoComplete, disabled, formControl, identifier, onBlur,
|
|
|
510
513
|
}, [formControl, onValue]);
|
|
511
514
|
const onKeyDownArea = useCallback((event) => {
|
|
512
515
|
onKeyDown?.(event);
|
|
513
|
-
event.key === 'Enter'
|
|
516
|
+
if (event.key === 'Enter') {
|
|
517
|
+
onEnter?.();
|
|
518
|
+
}
|
|
514
519
|
}, [onKeyDown, onEnter]);
|
|
515
520
|
const onKeyUpArea = useCallback((event) => {
|
|
516
521
|
onKeyUp?.(event);
|
|
@@ -673,7 +678,9 @@ function RlsInput({ children, decimals, disabled, formControl, identifier, onBlu
|
|
|
673
678
|
useEffect(() => {
|
|
674
679
|
if (!changeIsInternal.current && formControl) {
|
|
675
680
|
const valueControl = formControl.value ? String(formControl.value) : '';
|
|
676
|
-
valueInput !== valueControl
|
|
681
|
+
if (valueInput !== valueControl) {
|
|
682
|
+
setValueInput(valueControl);
|
|
683
|
+
}
|
|
677
684
|
}
|
|
678
685
|
changeIsInternal.current = false;
|
|
679
686
|
}, [formControl?.value]);
|
|
@@ -689,7 +696,9 @@ function RlsInput({ children, decimals, disabled, formControl, identifier, onBlu
|
|
|
689
696
|
}, [formControl, onValue, type, decimals]);
|
|
690
697
|
const onKeyDownInput = useCallback((event) => {
|
|
691
698
|
onKeyDown?.(event);
|
|
692
|
-
event.key === 'Enter'
|
|
699
|
+
if (event.key === 'Enter') {
|
|
700
|
+
onEnter?.();
|
|
701
|
+
}
|
|
693
702
|
}, [onKeyDown, onEnter]);
|
|
694
703
|
const onKeyUpInput = useCallback((event) => {
|
|
695
704
|
onKeyUp?.(event);
|
|
@@ -728,9 +737,9 @@ function RlsInputCounter({ className, disabled, formControl, identifier, max, mi
|
|
|
728
737
|
useEffect(() => {
|
|
729
738
|
if (!changeIsInternal.current && formControl) {
|
|
730
739
|
const counterValue = formControl.value;
|
|
731
|
-
counterValue !== undefined &&
|
|
732
|
-
counterValue !== value &&
|
|
740
|
+
if (counterValue !== undefined && counterValue !== value) {
|
|
733
741
|
setValue(counterValue);
|
|
742
|
+
}
|
|
734
743
|
}
|
|
735
744
|
changeIsInternal.current = false;
|
|
736
745
|
}, [formControl?.value]);
|
|
@@ -751,7 +760,9 @@ function RlsInputCounter({ className, disabled, formControl, identifier, max, mi
|
|
|
751
760
|
const incrementIsAllowed = useMemo(() => max !== undefined && value >= max, [max, value]);
|
|
752
761
|
const onChangeInput = useCallback((event) => {
|
|
753
762
|
const parsed = parseFloat(event.target.value);
|
|
754
|
-
!isNaN(parsed)
|
|
763
|
+
if (!isNaN(parsed)) {
|
|
764
|
+
onUpdate(parsed);
|
|
765
|
+
}
|
|
755
766
|
}, [onUpdate]);
|
|
756
767
|
const onFocusInput = useCallback(() => {
|
|
757
768
|
setFocused(true);
|
|
@@ -774,7 +785,12 @@ function RlsInputDecimal(props) {
|
|
|
774
785
|
}, [formControl?.value, valueInput]);
|
|
775
786
|
const onValueInput = useCallback((value) => {
|
|
776
787
|
const valueDecimal = BigDecimal.create(value);
|
|
777
|
-
|
|
788
|
+
if (formControl) {
|
|
789
|
+
formControl.setValue(valueDecimal);
|
|
790
|
+
}
|
|
791
|
+
else {
|
|
792
|
+
setValueInput(value);
|
|
793
|
+
}
|
|
778
794
|
onValue?.(valueDecimal);
|
|
779
795
|
}, [formControl, onValue]);
|
|
780
796
|
const decimalProps = { ...props, formControl: undefined };
|
|
@@ -785,7 +801,9 @@ function RlsInputMoney(props) {
|
|
|
785
801
|
const { decimals, formControl, identifier, onValue, symbol, value } = props;
|
|
786
802
|
const [valueInput, setValueInput] = useState(formControl?.value ?? value ?? 0);
|
|
787
803
|
const onValueInput = useCallback((value) => {
|
|
788
|
-
!formControl
|
|
804
|
+
if (!formControl) {
|
|
805
|
+
setValueInput(value);
|
|
806
|
+
}
|
|
789
807
|
onValue?.(value);
|
|
790
808
|
}, [formControl, onValue]);
|
|
791
809
|
return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-money", children: jsxRuntimeExports.jsx(RlsInput, { ...props, type: "number", value: valueInput, onValue: onValueInput, children: jsxRuntimeExports.jsx(RlsAmount, { value: formControl?.value ?? valueInput, symbol: symbol, decimals: decimals }) }) }));
|
|
@@ -795,7 +813,9 @@ function RlsInputNumber(props) {
|
|
|
795
813
|
const { formControl, identifier, onValue, value } = props;
|
|
796
814
|
const [valueInput, setValueInput] = useState(formControl?.value ?? value ?? 0);
|
|
797
815
|
const onValueInput = useCallback((value) => {
|
|
798
|
-
!formControl
|
|
816
|
+
if (!formControl) {
|
|
817
|
+
setValueInput(value);
|
|
818
|
+
}
|
|
799
819
|
onValue?.(value);
|
|
800
820
|
}, [formControl, onValue]);
|
|
801
821
|
return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-number", children: jsxRuntimeExports.jsx(RlsInput, { ...props, type: "number", value: valueInput, onValue: onValueInput, children: formControl?.value ?? valueInput }) }));
|
|
@@ -809,7 +829,9 @@ function RlsInputPassword({ disabled, formControl, identifier, onEnter, onKeyDow
|
|
|
809
829
|
}, [formControl, onValue]);
|
|
810
830
|
const _onKeyDown = useCallback((event) => {
|
|
811
831
|
onKeyDown?.(event);
|
|
812
|
-
event.key === 'Enter'
|
|
832
|
+
if (event.key === 'Enter') {
|
|
833
|
+
onEnter?.();
|
|
834
|
+
}
|
|
813
835
|
}, [onKeyDown, onEnter]);
|
|
814
836
|
const _onKeyUp = useCallback((event) => {
|
|
815
837
|
onKeyUp?.(event);
|
|
@@ -835,7 +857,9 @@ function RlsInputPercentage(props) {
|
|
|
835
857
|
const { formControl, identifier, onValue, value } = props;
|
|
836
858
|
const [valueInput, setValueInput] = useState(formControl?.value ?? value ?? 0);
|
|
837
859
|
const onValueInput = useCallback((value) => {
|
|
838
|
-
!formControl
|
|
860
|
+
if (!formControl) {
|
|
861
|
+
setValueInput(value);
|
|
862
|
+
}
|
|
839
863
|
onValue?.(value);
|
|
840
864
|
}, [formControl, onValue]);
|
|
841
865
|
return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-percentage", children: jsxRuntimeExports.jsxs(RlsInput, { ...props, type: "number", value: valueInput, onValue: onValueInput, children: [formControl?.value ?? valueInput, "%"] }) }));
|
|
@@ -847,7 +871,9 @@ function RlsInputSearch({ formControl, disabled, identifier, onEnter, onSearch,
|
|
|
847
871
|
return renderClassStatus('rls-input-search', { disabled });
|
|
848
872
|
}, [disabled]);
|
|
849
873
|
const onValue = useCallback((value) => {
|
|
850
|
-
!formControl
|
|
874
|
+
if (!formControl) {
|
|
875
|
+
setValue(() => value);
|
|
876
|
+
}
|
|
851
877
|
}, [formControl]);
|
|
852
878
|
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, children: [jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, placeholder: placeholder, onEnter: onEnter, onValue: onValue, disabled: disabled, children: formControl?.value ?? value }), onSearch && (jsxRuntimeExports.jsx(RlsButtonAction, { icon: "search", onClick: onSearch, disabled: disabled }))] }));
|
|
853
879
|
}
|
|
@@ -856,7 +882,9 @@ function RlsInputText(props) {
|
|
|
856
882
|
const { formControl, identifier, onValue, value } = props;
|
|
857
883
|
const [valueInput, setValueInput] = useState(formControl?.value ?? value ?? '');
|
|
858
884
|
const onValueInput = useCallback((value) => {
|
|
859
|
-
!formControl
|
|
885
|
+
if (!formControl) {
|
|
886
|
+
setValueInput(value);
|
|
887
|
+
}
|
|
860
888
|
onValue?.(value);
|
|
861
889
|
}, [formControl, onValue]);
|
|
862
890
|
return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-text", children: jsxRuntimeExports.jsx(RlsInput, { ...props, type: "text", value: valueInput, onValue: onValueInput, children: formControl?.value ?? valueInput }) }));
|
|
@@ -1379,7 +1407,9 @@ function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsThem
|
|
|
1379
1407
|
const [visible, setVisible] = useState(false);
|
|
1380
1408
|
useEffect(() => {
|
|
1381
1409
|
function onCloseMenu({ target }) {
|
|
1382
|
-
!componentRef?.current?.contains(target)
|
|
1410
|
+
if (!componentRef?.current?.contains(target)) {
|
|
1411
|
+
setVisible(false);
|
|
1412
|
+
}
|
|
1383
1413
|
}
|
|
1384
1414
|
document.addEventListener('click', onCloseMenu);
|
|
1385
1415
|
return () => {
|
|
@@ -1398,15 +1428,21 @@ function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsThem
|
|
|
1398
1428
|
const onSelectAction = useCallback((action) => {
|
|
1399
1429
|
setAction(() => action);
|
|
1400
1430
|
setVisible(() => false);
|
|
1401
|
-
|
|
1431
|
+
if (automatic) {
|
|
1432
|
+
onAction(action.value);
|
|
1433
|
+
}
|
|
1402
1434
|
}, [onAction, automatic]);
|
|
1403
1435
|
const onClickAction = useCallback(() => {
|
|
1404
|
-
|
|
1436
|
+
if (action) {
|
|
1437
|
+
onAction(action.value);
|
|
1438
|
+
}
|
|
1405
1439
|
}, [action, onAction]);
|
|
1406
1440
|
const onClickOption = useCallback((event) => {
|
|
1407
1441
|
const index = Number(event.currentTarget.dataset.index);
|
|
1408
1442
|
const option = options[index];
|
|
1409
|
-
|
|
1443
|
+
if (option) {
|
|
1444
|
+
onSelectAction(option);
|
|
1445
|
+
}
|
|
1410
1446
|
}, [options, onSelectAction]);
|
|
1411
1447
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-button-toggle", ref: componentRef, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-button-toggle__content", children: [action && (jsxRuntimeExports.jsx("div", { className: "rls-button-toggle__action", children: jsxRuntimeExports.jsx(RlsButton, { disabled: disabled, type: type, onClick: onClickAction, children: action.label }) })), jsxRuntimeExports.jsx("div", { className: "rls-button-toggle__icon", children: jsxRuntimeExports.jsx(RlsButton, { type: type, prefixIcon: "arrow-ios-down", disabled: disabled, onClick: onClickMenu }) })] }), jsxRuntimeExports.jsx("div", { className: classNameList, children: jsxRuntimeExports.jsx("ul", { children: options.map((action, index) => (jsxRuntimeExports.jsx("li", { className: "rls-truncate", "data-index": index, onClick: onClickOption, children: action.label }, index))) }) })] }));
|
|
1412
1448
|
}
|
|
@@ -1539,7 +1575,7 @@ function RlsMessageFormError({ className, formControl }) {
|
|
|
1539
1575
|
return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: formControl?.wrong && (jsxRuntimeExports.jsx("div", { className: className, children: jsxRuntimeExports.jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: msgError }) })) }));
|
|
1540
1576
|
}
|
|
1541
1577
|
|
|
1542
|
-
function
|
|
1578
|
+
function RlsFieldArea(props) {
|
|
1543
1579
|
const { children, formControl, identifier, rlsTheme } = props;
|
|
1544
1580
|
const disabled = useMemo(() => {
|
|
1545
1581
|
return formControl?.disabled || props.disabled;
|
|
@@ -1550,12 +1586,12 @@ function RlsFieldDecimal(props) {
|
|
|
1550
1586
|
error: formControl?.wrong,
|
|
1551
1587
|
focused: formControl?.focused && !disabled,
|
|
1552
1588
|
readonly: props.readOnly
|
|
1553
|
-
}, 'rls-field-
|
|
1589
|
+
}, 'rls-field-area');
|
|
1554
1590
|
}, [formControl?.focused, formControl?.wrong, props.readOnly, disabled]);
|
|
1555
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(
|
|
1591
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsAreaText, { ...props }) }) }), !props.msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1556
1592
|
}
|
|
1557
1593
|
|
|
1558
|
-
function
|
|
1594
|
+
function RlsFieldDecimal(props) {
|
|
1559
1595
|
const { children, formControl, identifier, rlsTheme } = props;
|
|
1560
1596
|
const disabled = useMemo(() => {
|
|
1561
1597
|
return formControl?.disabled || props.disabled;
|
|
@@ -1566,14 +1602,14 @@ function RlsFieldArea(props) {
|
|
|
1566
1602
|
error: formControl?.wrong,
|
|
1567
1603
|
focused: formControl?.focused && !disabled,
|
|
1568
1604
|
readonly: props.readOnly
|
|
1569
|
-
}, 'rls-field-
|
|
1605
|
+
}, 'rls-field-decimal');
|
|
1570
1606
|
}, [formControl?.focused, formControl?.wrong, props.readOnly, disabled]);
|
|
1571
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(
|
|
1607
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsInputDecimal, { ...props }) }) }), !props.msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1572
1608
|
}
|
|
1573
1609
|
|
|
1574
|
-
function RlsFieldFile({ accept, children, disabled:
|
|
1610
|
+
function RlsFieldFile({ accept, children, disabled: _disabled, formControl, identifier, msgErrorDisabled, onValue, placeholder, readOnly, rlsTheme, value }) {
|
|
1575
1611
|
const inputRef = useRef(null);
|
|
1576
|
-
const disabled = useMemo(() => formControl?.disabled ||
|
|
1612
|
+
const disabled = useMemo(() => formControl?.disabled || _disabled, [formControl?.disabled, _disabled]);
|
|
1577
1613
|
const className = useMemo(() => renderClassStatus('rls-field-box', {
|
|
1578
1614
|
disabled,
|
|
1579
1615
|
error: formControl?.wrong,
|
|
@@ -1603,9 +1639,11 @@ function RlsFieldFile({ accept, children, disabled: disabledProp, formControl, i
|
|
|
1603
1639
|
event.target.value = '';
|
|
1604
1640
|
}, [formControl, onValue]);
|
|
1605
1641
|
const onClickControl = useCallback(() => {
|
|
1606
|
-
!readOnly && !disabled
|
|
1642
|
+
if (!readOnly && !disabled) {
|
|
1643
|
+
inputRef.current?.click();
|
|
1644
|
+
}
|
|
1607
1645
|
}, [readOnly, disabled]);
|
|
1608
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", onClick: onClickControl, children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { className: "rls-input__component", readOnly: true, type: "text", value: displayValue, placeholder: placeholder }), jsxRuntimeExports.jsx("input", { ref: inputRef, className: "rls-field-file__input", type: "file", accept: accept, disabled: disabled || readOnly, onChange: onChangeInput }), jsxRuntimeExports.jsx(RlsButtonAction, { icon: currentFile ? 'close' : 'attach
|
|
1646
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", onClick: onClickControl, children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { className: "rls-input__component", readOnly: true, type: "text", value: displayValue, placeholder: placeholder }), jsxRuntimeExports.jsx("input", { ref: inputRef, className: "rls-field-file__input", type: "file", accept: accept, disabled: disabled || readOnly, onChange: onChangeInput }), jsxRuntimeExports.jsx(RlsButtonAction, { icon: currentFile ? 'close' : 'attach', disabled: disabled, onClick: onClickAction })] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1609
1647
|
}
|
|
1610
1648
|
|
|
1611
1649
|
const reactI18n = i18n({
|
|
@@ -1678,7 +1716,7 @@ function RlsFieldListSuggestions({ elements, action, disabled, higher, render, r
|
|
|
1678
1716
|
}
|
|
1679
1717
|
|
|
1680
1718
|
function RlsFieldMoney(props) {
|
|
1681
|
-
const { children, formControl, identifier, rlsTheme } = props;
|
|
1719
|
+
const { action, children, formControl, identifier, rlsTheme } = props;
|
|
1682
1720
|
const disabled = useMemo(() => {
|
|
1683
1721
|
return formControl?.disabled || props.disabled;
|
|
1684
1722
|
}, [formControl?.disabled, props.disabled]);
|
|
@@ -1690,11 +1728,11 @@ function RlsFieldMoney(props) {
|
|
|
1690
1728
|
readonly: props.readOnly
|
|
1691
1729
|
}, 'rls-field-money');
|
|
1692
1730
|
}, [formControl?.focused, formControl?.wrong, props.readOnly, disabled]);
|
|
1693
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.
|
|
1731
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { 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(RlsInputMoney, { ...props }), action && (jsxRuntimeExports.jsx(RlsButtonAction, { icon: action.icon, disabled: disabled, onClick: action.onClick }))] }) }), !props.msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1694
1732
|
}
|
|
1695
1733
|
|
|
1696
1734
|
function RlsFieldNumber(props) {
|
|
1697
|
-
const { children, formControl, identifier, rlsTheme } = props;
|
|
1735
|
+
const { action, children, formControl, identifier, rlsTheme } = props;
|
|
1698
1736
|
const disabled = useMemo(() => {
|
|
1699
1737
|
return formControl?.disabled || props.disabled;
|
|
1700
1738
|
}, [formControl?.disabled, props.disabled]);
|
|
@@ -1706,7 +1744,7 @@ function RlsFieldNumber(props) {
|
|
|
1706
1744
|
readonly: props.readOnly
|
|
1707
1745
|
}, 'rls-field-number');
|
|
1708
1746
|
}, [formControl?.focused, formControl?.wrong, props.readOnly, disabled]);
|
|
1709
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.
|
|
1747
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { 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(RlsInputNumber, { ...props }), action && (jsxRuntimeExports.jsx(RlsButtonAction, { icon: action.icon, disabled: disabled, onClick: action.onClick }))] }) }), !props.msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1710
1748
|
}
|
|
1711
1749
|
|
|
1712
1750
|
function RlsFieldPassword(props) {
|
|
@@ -1730,7 +1768,7 @@ function RlsFieldPassword(props) {
|
|
|
1730
1768
|
}
|
|
1731
1769
|
|
|
1732
1770
|
function RlsFieldPercentage(props) {
|
|
1733
|
-
const { children, formControl, identifier, rlsTheme } = props;
|
|
1771
|
+
const { action, children, formControl, identifier, rlsTheme } = props;
|
|
1734
1772
|
const disabled = useMemo(() => {
|
|
1735
1773
|
return formControl?.disabled || props.disabled;
|
|
1736
1774
|
}, [formControl?.disabled, props.disabled]);
|
|
@@ -1742,7 +1780,7 @@ function RlsFieldPercentage(props) {
|
|
|
1742
1780
|
readonly: props.readOnly
|
|
1743
1781
|
}, 'rls-field-percentage');
|
|
1744
1782
|
}, [formControl?.focused, formControl?.wrong, props.readOnly, disabled]);
|
|
1745
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.
|
|
1783
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { 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(RlsInputPercentage, { ...props }), action && (jsxRuntimeExports.jsx(RlsButtonAction, { icon: action.icon, disabled: disabled, onClick: action.onClick }))] }) }), !props.msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1746
1784
|
}
|
|
1747
1785
|
|
|
1748
1786
|
function RlsFieldReadonly({ children, identifier, rlsTheme, value }) {
|
|
@@ -1750,7 +1788,7 @@ function RlsFieldReadonly({ children, identifier, rlsTheme, value }) {
|
|
|
1750
1788
|
}
|
|
1751
1789
|
|
|
1752
1790
|
function RlsFieldText(props) {
|
|
1753
|
-
const { children, formControl, identifier, rlsTheme } = props;
|
|
1791
|
+
const { action, children, formControl, identifier, rlsTheme } = props;
|
|
1754
1792
|
const disabled = useMemo(() => {
|
|
1755
1793
|
return formControl?.disabled || props.disabled;
|
|
1756
1794
|
}, [formControl?.disabled, props.disabled]);
|
|
@@ -1762,7 +1800,7 @@ function RlsFieldText(props) {
|
|
|
1762
1800
|
readonly: props.readOnly
|
|
1763
1801
|
}, 'rls-field-text');
|
|
1764
1802
|
}, [formControl?.focused, formControl?.wrong, props.readOnly, disabled]);
|
|
1765
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.
|
|
1803
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { 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(RlsInputText, { ...props }), action && (jsxRuntimeExports.jsx(RlsButtonAction, { icon: action.icon, disabled: disabled, onClick: action.onClick }))] }) }), !props.msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
1766
1804
|
}
|
|
1767
1805
|
|
|
1768
1806
|
function useFormToggleController({ disabled, formControl }) {
|
|
@@ -1772,9 +1810,14 @@ function useFormToggleController({ disabled, formControl }) {
|
|
|
1772
1810
|
}, [formControl?.value]);
|
|
1773
1811
|
const onToggle = useCallback(() => {
|
|
1774
1812
|
if (!disabled) {
|
|
1775
|
-
formControl
|
|
1776
|
-
|
|
1777
|
-
|
|
1813
|
+
if (formControl) {
|
|
1814
|
+
if (formControl.enabled) {
|
|
1815
|
+
formControl.setValue(!formControl.value);
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
else {
|
|
1819
|
+
setChecked((checked) => !checked);
|
|
1820
|
+
}
|
|
1778
1821
|
}
|
|
1779
1822
|
}, [formControl, disabled]);
|
|
1780
1823
|
return { checked, onToggle };
|
|
@@ -1876,8 +1919,9 @@ function RlsPagination({ suggestions, count, filter, onPagination }) {
|
|
|
1876
1919
|
setTemplate(template);
|
|
1877
1920
|
}, [onPagination]);
|
|
1878
1921
|
const refreshPagination = useCallback((pagination) => {
|
|
1879
|
-
pagination
|
|
1922
|
+
if (pagination) {
|
|
1880
1923
|
refreshTemplate(pagination.template, pagination.page.collection);
|
|
1924
|
+
}
|
|
1881
1925
|
}, [refreshTemplate]);
|
|
1882
1926
|
useEffect(() => {
|
|
1883
1927
|
const pagination = new PaginationController({
|
|
@@ -1923,7 +1967,9 @@ function RlsPickerDayElement({ day, onSelect, disabled }) {
|
|
|
1923
1967
|
});
|
|
1924
1968
|
}, [day, disabled]);
|
|
1925
1969
|
const onClick = useCallback(() => {
|
|
1926
|
-
day.value && !day.disabled && !disabled
|
|
1970
|
+
if (day.value && !day.disabled && !disabled) {
|
|
1971
|
+
onSelect(day.value);
|
|
1972
|
+
}
|
|
1927
1973
|
}, [day.value, day.disabled, disabled, onSelect]);
|
|
1928
1974
|
return (jsxRuntimeExports.jsx("div", { className: className, onClick: onClick, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-day__element__span", children: day.value || '??' }) }));
|
|
1929
1975
|
}
|
|
@@ -1933,7 +1979,12 @@ function RlsPickerDay({ date, disabled, formControl, maxDate, month, minDate, on
|
|
|
1933
1979
|
const [value, setValue] = useState(formControl?.value ?? dateDay.getDate());
|
|
1934
1980
|
const [_, setI18nVersion] = useState(0);
|
|
1935
1981
|
const setDayValue = useCallback((value) => {
|
|
1936
|
-
|
|
1982
|
+
if (formControl) {
|
|
1983
|
+
formControl.setValue(value);
|
|
1984
|
+
}
|
|
1985
|
+
else {
|
|
1986
|
+
setValue(value);
|
|
1987
|
+
}
|
|
1937
1988
|
}, [formControl]);
|
|
1938
1989
|
const onSelect = useCallback((value) => {
|
|
1939
1990
|
setDayValue(value);
|
|
@@ -1947,13 +1998,21 @@ function RlsPickerDay({ date, disabled, formControl, maxDate, month, minDate, on
|
|
|
1947
1998
|
useEffect(() => {
|
|
1948
1999
|
const options = createPickerOptions();
|
|
1949
2000
|
const day = verifyDayPicker(options);
|
|
1950
|
-
|
|
2001
|
+
if (day) {
|
|
2002
|
+
setDayValue(day);
|
|
2003
|
+
}
|
|
2004
|
+
else {
|
|
2005
|
+
setWeeks(createDayPicker(options));
|
|
2006
|
+
}
|
|
1951
2007
|
}, [dateDay, month, year, value, minDate, maxDate]);
|
|
1952
2008
|
useEffect(() => {
|
|
1953
2009
|
const day = verifyDayPicker(createPickerOptions());
|
|
1954
|
-
day
|
|
1955
|
-
|
|
1956
|
-
|
|
2010
|
+
if (day) {
|
|
2011
|
+
formControl?.setValue(day);
|
|
2012
|
+
}
|
|
2013
|
+
else {
|
|
2014
|
+
setValue(formControl?.value || dateDay.getDate());
|
|
2015
|
+
}
|
|
1957
2016
|
}, [formControl?.value]);
|
|
1958
2017
|
const createPickerOptions = useCallback(() => {
|
|
1959
2018
|
return {
|
|
@@ -1982,7 +2041,9 @@ function RlsPickerDayRangeElement({ day, onSelect, disabled }) {
|
|
|
1982
2041
|
});
|
|
1983
2042
|
}, [day.disabled, day.end, day.forbidden, day.ranged, day.source, disabled]);
|
|
1984
2043
|
const onClick = useCallback(() => {
|
|
1985
|
-
day.value && !day.disabled && !disabled
|
|
2044
|
+
if (day.value && !day.disabled && !disabled) {
|
|
2045
|
+
onSelect(day.value);
|
|
2046
|
+
}
|
|
1986
2047
|
}, [day.value, day.disabled, disabled, onSelect]);
|
|
1987
2048
|
return (jsxRuntimeExports.jsx("div", { className: className, onClick: onClick, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-day-range__element__span", children: day.value || '??' }) }));
|
|
1988
2049
|
}
|
|
@@ -2038,10 +2099,9 @@ function RlsPickerMonthElement({ month, onSelect, disabled }) {
|
|
|
2038
2099
|
});
|
|
2039
2100
|
}, [month.disabled, month.focused, month.selected, disabled]);
|
|
2040
2101
|
const onClick = useCallback(() => {
|
|
2041
|
-
valueIsDefined(month.value) &&
|
|
2042
|
-
!month.disabled &&
|
|
2043
|
-
!disabled &&
|
|
2102
|
+
if (valueIsDefined(month.value) && !month.disabled && !disabled) {
|
|
2044
2103
|
onSelect(month.value);
|
|
2104
|
+
}
|
|
2045
2105
|
}, [month.value, month.disabled, disabled, onSelect]);
|
|
2046
2106
|
return (jsxRuntimeExports.jsx("div", { className: className, onClick: onClick, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-month__span", children: label }) }));
|
|
2047
2107
|
}
|
|
@@ -2050,7 +2110,12 @@ function RlsPickerMonth({ date, disabled, formControl, maxDate, minDate, onValue
|
|
|
2050
2110
|
const [months, setMonths] = useState([]);
|
|
2051
2111
|
const [value, setValue] = useState(formControl?.value ?? dateMonth.getMonth());
|
|
2052
2112
|
const setMonthValue = useCallback((value) => {
|
|
2053
|
-
|
|
2113
|
+
if (formControl) {
|
|
2114
|
+
formControl.setValue(value);
|
|
2115
|
+
}
|
|
2116
|
+
else {
|
|
2117
|
+
setValue(value);
|
|
2118
|
+
}
|
|
2054
2119
|
}, [formControl]);
|
|
2055
2120
|
const onSelect = useCallback((value) => {
|
|
2056
2121
|
setMonthValue(value);
|
|
@@ -2065,9 +2130,12 @@ function RlsPickerMonth({ date, disabled, formControl, maxDate, minDate, onValue
|
|
|
2065
2130
|
maxDate
|
|
2066
2131
|
};
|
|
2067
2132
|
const month = verifyMonthPicker(options);
|
|
2068
|
-
valueIsDefined(month)
|
|
2069
|
-
|
|
2070
|
-
|
|
2133
|
+
if (valueIsDefined(month)) {
|
|
2134
|
+
setMonthValue(month);
|
|
2135
|
+
}
|
|
2136
|
+
else {
|
|
2137
|
+
setMonths(createMonthPicker(options));
|
|
2138
|
+
}
|
|
2071
2139
|
}, [dateMonth, year, value, minDate, maxDate]);
|
|
2072
2140
|
useEffect(() => {
|
|
2073
2141
|
const month = verifyMonthPicker({
|
|
@@ -2077,9 +2145,12 @@ function RlsPickerMonth({ date, disabled, formControl, maxDate, minDate, onValue
|
|
|
2077
2145
|
minDate,
|
|
2078
2146
|
maxDate
|
|
2079
2147
|
});
|
|
2080
|
-
valueIsDefined(month)
|
|
2081
|
-
|
|
2082
|
-
|
|
2148
|
+
if (valueIsDefined(month)) {
|
|
2149
|
+
formControl?.setValue(month);
|
|
2150
|
+
}
|
|
2151
|
+
else {
|
|
2152
|
+
setValue(formControl?.value ?? dateMonth.getMonth());
|
|
2153
|
+
}
|
|
2083
2154
|
}, [formControl?.value]);
|
|
2084
2155
|
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-month", "rls-theme": rlsTheme, children: months.map((month, index) => (jsxRuntimeExports.jsx(RlsPickerMonthElement, { month: month, onSelect: onSelect, disabled: disabled }, index))) }));
|
|
2085
2156
|
}
|
|
@@ -2121,11 +2192,17 @@ function RlsPickerSelectorTitle({ monthControl, type, yearControl, date, disable
|
|
|
2121
2192
|
onClick?.('year');
|
|
2122
2193
|
}, [onClick]);
|
|
2123
2194
|
const onPreviousYear = useCallback(() => {
|
|
2124
|
-
valueIsDefined(yearControl.value)
|
|
2195
|
+
if (valueIsDefined(yearControl.value)) {
|
|
2125
2196
|
yearControl.setValue(yearControl.value - 1);
|
|
2197
|
+
}
|
|
2126
2198
|
}, [yearControl.value]);
|
|
2127
2199
|
const onPrevious = useCallback(() => {
|
|
2128
|
-
type === 'month'
|
|
2200
|
+
if (type === 'month') {
|
|
2201
|
+
onPreviousMonth();
|
|
2202
|
+
}
|
|
2203
|
+
else {
|
|
2204
|
+
onPreviousYear();
|
|
2205
|
+
}
|
|
2129
2206
|
}, [type, onPreviousMonth, onPreviousYear]);
|
|
2130
2207
|
const onNextMonth = useCallback(() => {
|
|
2131
2208
|
if (valueIsDefined(monthControl.value) &&
|
|
@@ -2140,11 +2217,17 @@ function RlsPickerSelectorTitle({ monthControl, type, yearControl, date, disable
|
|
|
2140
2217
|
}
|
|
2141
2218
|
}, [monthControl.value, yearControl.value]);
|
|
2142
2219
|
const onNextYear = useCallback(() => {
|
|
2143
|
-
valueIsDefined(yearControl.value)
|
|
2220
|
+
if (valueIsDefined(yearControl.value)) {
|
|
2144
2221
|
yearControl.setValue(yearControl.value + 1);
|
|
2222
|
+
}
|
|
2145
2223
|
}, [yearControl.value]);
|
|
2146
2224
|
const onNext = useCallback(() => {
|
|
2147
|
-
type === 'month'
|
|
2225
|
+
if (type === 'month') {
|
|
2226
|
+
onNextMonth();
|
|
2227
|
+
}
|
|
2228
|
+
else {
|
|
2229
|
+
onNextYear();
|
|
2230
|
+
}
|
|
2148
2231
|
}, [type, onNextMonth, onNextYear]);
|
|
2149
2232
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-selector-title", children: [jsxRuntimeExports.jsx(RlsButtonIcon, { icon: "arrow-ios-left", onClick: onPrevious, disabled: limitPrevious || disabled }), jsxRuntimeExports.jsxs("div", { className: "rls-picker-selector-title__label", children: [jsxRuntimeExports.jsxs("span", { onClick: onMonth, children: [label, ","] }), jsxRuntimeExports.jsx("span", { onClick: onYear, children: yearControl.value })] }), jsxRuntimeExports.jsx(RlsButtonIcon, { icon: "arrow-ios-right", onClick: onNext, disabled: limitNext || disabled })] }));
|
|
2150
2233
|
}
|
|
@@ -2158,7 +2241,9 @@ function RlsPickerYearElement({ onSelect, year, disabled }) {
|
|
|
2158
2241
|
});
|
|
2159
2242
|
}, [year.disabled, year.focused, year.selected, disabled]);
|
|
2160
2243
|
const onClick = useCallback(() => {
|
|
2161
|
-
year.value && !year.disabled && !disabled
|
|
2244
|
+
if (year.value && !year.disabled && !disabled) {
|
|
2245
|
+
onSelect(year.value);
|
|
2246
|
+
}
|
|
2162
2247
|
}, [year.value, year.disabled, disabled, onSelect]);
|
|
2163
2248
|
return (jsxRuntimeExports.jsx("div", { className: className, onClick: onClick, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-year__span", children: year.value || '????' }) }));
|
|
2164
2249
|
}
|
|
@@ -2177,14 +2262,26 @@ function RlsPickerYear({ date, disabled, formControl, maxDate, minDate, onValue,
|
|
|
2177
2262
|
useEffect(() => {
|
|
2178
2263
|
const options = createPickerOptions();
|
|
2179
2264
|
const validYear = verifyYearPicker(options);
|
|
2180
|
-
|
|
2265
|
+
if (validYear) {
|
|
2266
|
+
setYear(validYear);
|
|
2267
|
+
}
|
|
2268
|
+
else {
|
|
2269
|
+
setTemplate(createYearPicker(options));
|
|
2270
|
+
}
|
|
2181
2271
|
}, [dateYear, year, minDate, maxDate]);
|
|
2182
2272
|
useEffect(() => {
|
|
2183
2273
|
const yearValue = formControl?.value;
|
|
2184
|
-
valueIsDefined(yearValue) && yearValue !== year
|
|
2274
|
+
if (valueIsDefined(yearValue) && yearValue !== year) {
|
|
2275
|
+
setYear(yearValue);
|
|
2276
|
+
}
|
|
2185
2277
|
}, [formControl?.value]);
|
|
2186
2278
|
const onSelect = useCallback((value) => {
|
|
2187
|
-
|
|
2279
|
+
if (formControl) {
|
|
2280
|
+
formControl.setValue(value);
|
|
2281
|
+
}
|
|
2282
|
+
else {
|
|
2283
|
+
setYear(value);
|
|
2284
|
+
}
|
|
2188
2285
|
onValue?.(value);
|
|
2189
2286
|
}, [formControl, onValue]);
|
|
2190
2287
|
const onClickPrev = useCallback(() => {
|
|
@@ -2259,7 +2356,9 @@ function RlsTab({ onSelect, tab, value }) {
|
|
|
2259
2356
|
});
|
|
2260
2357
|
}, [tab, value]);
|
|
2261
2358
|
const onClick = useCallback(() => {
|
|
2262
|
-
!tab.disabled
|
|
2359
|
+
if (!tab.disabled) {
|
|
2360
|
+
onSelect(tab.value);
|
|
2361
|
+
}
|
|
2263
2362
|
}, [tab.disabled]);
|
|
2264
2363
|
return (jsxRuntimeExports.jsx("div", { className: className, onClick: onClick, children: jsxRuntimeExports.jsx("span", { children: tab.label }) }));
|
|
2265
2364
|
}
|
|
@@ -2271,7 +2370,9 @@ function RlsTabs({ tabs, onValue, rlsTheme }) {
|
|
|
2271
2370
|
}, [onValue]);
|
|
2272
2371
|
useEffect(() => {
|
|
2273
2372
|
const initial = tabs.find((tab) => tab.defaultActive) ?? tabs[0];
|
|
2274
|
-
|
|
2373
|
+
if (initial) {
|
|
2374
|
+
onSelect(initial.value);
|
|
2375
|
+
}
|
|
2275
2376
|
}, []);
|
|
2276
2377
|
return (jsxRuntimeExports.jsx("div", { className: "rls-tabs", "rls-theme": rlsTheme, children: tabs.map((tab, index) => {
|
|
2277
2378
|
return (jsxRuntimeExports.jsx(RlsTab, { tab: tab, value: value, onSelect: onSelect }, index));
|
|
@@ -2287,7 +2388,9 @@ function RlsBottomSheet({ autoclose, children, className, controller, onBackdrop
|
|
|
2287
2388
|
return renderClassStatus('rls-bottom-sheet', { visible: controller?.visible ?? visible }, className);
|
|
2288
2389
|
}, [className, visible, controller?.visible]);
|
|
2289
2390
|
const onClickBackdrop = useCallback(() => {
|
|
2290
|
-
|
|
2391
|
+
if (autoclose) {
|
|
2392
|
+
controller?.close();
|
|
2393
|
+
}
|
|
2291
2394
|
onBackdrop?.();
|
|
2292
2395
|
}, [autoclose, controller, onBackdrop]);
|
|
2293
2396
|
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);
|
|
@@ -2443,8 +2546,9 @@ function RlsDropdown({ children, controller, rlsTheme }) {
|
|
|
2443
2546
|
}, [controller.visible]);
|
|
2444
2547
|
useEffect(() => {
|
|
2445
2548
|
function onCloseDropdown({ target }) {
|
|
2446
|
-
!controller.component.current.contains(target)
|
|
2549
|
+
if (!controller.component.current.contains(target)) {
|
|
2447
2550
|
controller.close();
|
|
2551
|
+
}
|
|
2448
2552
|
}
|
|
2449
2553
|
document.addEventListener('click', onCloseDropdown);
|
|
2450
2554
|
return () => {
|
|
@@ -2498,8 +2602,9 @@ function useListController(props) {
|
|
|
2498
2602
|
const valueProtected = useRef(undefined);
|
|
2499
2603
|
useEffect(() => {
|
|
2500
2604
|
function onCloseSuggestions({ target }) {
|
|
2501
|
-
!refContent?.current?.contains(target)
|
|
2605
|
+
if (!refContent?.current?.contains(target)) {
|
|
2502
2606
|
refreshState((state) => ({ ...state, listIsVisible: false }));
|
|
2607
|
+
}
|
|
2503
2608
|
}
|
|
2504
2609
|
document.addEventListener('click', onCloseSuggestions);
|
|
2505
2610
|
return () => {
|
|
@@ -2523,9 +2628,12 @@ function useListController(props) {
|
|
|
2523
2628
|
const element = collection.find(formControl.value);
|
|
2524
2629
|
if (!element) {
|
|
2525
2630
|
valueProtected.current = formControl.value;
|
|
2526
|
-
automatic
|
|
2527
|
-
|
|
2528
|
-
|
|
2631
|
+
if (automatic) {
|
|
2632
|
+
setFormValue(collection.value[0], true);
|
|
2633
|
+
}
|
|
2634
|
+
else {
|
|
2635
|
+
setFormValue(undefined);
|
|
2636
|
+
}
|
|
2529
2637
|
}
|
|
2530
2638
|
else {
|
|
2531
2639
|
refreshState((state) => ({ ...state, value: element.description }));
|
|
@@ -2533,12 +2641,20 @@ function useListController(props) {
|
|
|
2533
2641
|
}
|
|
2534
2642
|
else if (valueProtected.current) {
|
|
2535
2643
|
const element = collection.find(valueProtected.current);
|
|
2536
|
-
|
|
2644
|
+
if (element) {
|
|
2645
|
+
setFormValue(element);
|
|
2646
|
+
}
|
|
2647
|
+
else {
|
|
2648
|
+
refreshState({ ...state, value: '' });
|
|
2649
|
+
}
|
|
2537
2650
|
}
|
|
2538
2651
|
else {
|
|
2539
|
-
automatic
|
|
2540
|
-
|
|
2541
|
-
|
|
2652
|
+
if (automatic) {
|
|
2653
|
+
setFormValue(collection.value[0], true);
|
|
2654
|
+
}
|
|
2655
|
+
else {
|
|
2656
|
+
refreshState({ ...state, value: '' });
|
|
2657
|
+
}
|
|
2542
2658
|
}
|
|
2543
2659
|
}
|
|
2544
2660
|
changeValueInternal.current = false;
|
|
@@ -2558,9 +2674,12 @@ function useListController(props) {
|
|
|
2558
2674
|
value: element?.description || ''
|
|
2559
2675
|
}));
|
|
2560
2676
|
changeValueInternal.current = true;
|
|
2561
|
-
valueIsDefault
|
|
2562
|
-
|
|
2563
|
-
|
|
2677
|
+
if (valueIsDefault) {
|
|
2678
|
+
formControl?.setDefaultValue(element?.value);
|
|
2679
|
+
}
|
|
2680
|
+
else {
|
|
2681
|
+
formControl?.setValue(element?.value);
|
|
2682
|
+
}
|
|
2564
2683
|
}, [formControl]);
|
|
2565
2684
|
const navigationInput = useCallback((event) => {
|
|
2566
2685
|
if (state.listIsVisible) {
|
|
@@ -2593,7 +2712,7 @@ function useListController(props) {
|
|
|
2593
2712
|
};
|
|
2594
2713
|
}
|
|
2595
2714
|
|
|
2596
|
-
const DURATION_ANIMATION$
|
|
2715
|
+
const DURATION_ANIMATION$2 = 240;
|
|
2597
2716
|
const MAX_ELEMENTS = 6;
|
|
2598
2717
|
function useFieldAutocomplete(props) {
|
|
2599
2718
|
const controller = useListController(props);
|
|
@@ -2625,7 +2744,9 @@ function useFieldAutocomplete(props) {
|
|
|
2625
2744
|
refreshCoincidences(props.suggestions, pattern, reboot);
|
|
2626
2745
|
}, [props.suggestions, pattern]);
|
|
2627
2746
|
useEffect(() => {
|
|
2628
|
-
props.disabled
|
|
2747
|
+
if (props.disabled) {
|
|
2748
|
+
controller.setState({ focused: false });
|
|
2749
|
+
}
|
|
2629
2750
|
}, [props.disabled, controller.setState]);
|
|
2630
2751
|
const onFocusInput = useCallback(() => {
|
|
2631
2752
|
controller.setState({ focused: true });
|
|
@@ -2650,7 +2771,7 @@ function useFieldAutocomplete(props) {
|
|
|
2650
2771
|
clearTimeout(focusTimeoutId.current);
|
|
2651
2772
|
focusTimeoutId.current = setTimeout(() => {
|
|
2652
2773
|
controller.refInput?.current?.focus();
|
|
2653
|
-
}, DURATION_ANIMATION$
|
|
2774
|
+
}, DURATION_ANIMATION$2);
|
|
2654
2775
|
}
|
|
2655
2776
|
}, [controller.setState, props.readOnly]);
|
|
2656
2777
|
useEffect(() => {
|
|
@@ -2680,7 +2801,9 @@ function useFieldAutocomplete(props) {
|
|
|
2680
2801
|
}, [controller.setState]);
|
|
2681
2802
|
const onChange = useCallback((element) => {
|
|
2682
2803
|
if (props.onSelect) {
|
|
2683
|
-
|
|
2804
|
+
if (element.value) {
|
|
2805
|
+
props.onSelect(element.value);
|
|
2806
|
+
}
|
|
2684
2807
|
}
|
|
2685
2808
|
else {
|
|
2686
2809
|
controller.setFormValue(element);
|
|
@@ -2708,9 +2831,12 @@ function useFieldAutocomplete(props) {
|
|
|
2708
2831
|
}, [onChange]);
|
|
2709
2832
|
const onKeydownElement = useCallback((element) => {
|
|
2710
2833
|
return (event) => {
|
|
2711
|
-
event.code === 'Enter'
|
|
2712
|
-
|
|
2713
|
-
|
|
2834
|
+
if (event.code === 'Enter') {
|
|
2835
|
+
onChange(element);
|
|
2836
|
+
}
|
|
2837
|
+
else {
|
|
2838
|
+
controller.navigationElement(event);
|
|
2839
|
+
}
|
|
2714
2840
|
};
|
|
2715
2841
|
}, [onChange, controller.navigationElement]);
|
|
2716
2842
|
return {
|
|
@@ -2764,7 +2890,9 @@ function RlsFieldAutocompleteTemplate(props) {
|
|
|
2764
2890
|
onSearch?.(autocomplete.pattern);
|
|
2765
2891
|
}, [onSearch, autocomplete.pattern]);
|
|
2766
2892
|
const onKeyDownPattern = useCallback((event) => {
|
|
2767
|
-
event.key === 'Enter'
|
|
2893
|
+
if (event.key === 'Enter') {
|
|
2894
|
+
onSearch?.(autocomplete.pattern);
|
|
2895
|
+
}
|
|
2768
2896
|
autocomplete.onKeydownInput(event);
|
|
2769
2897
|
}, [autocomplete.onKeydownInput, onSearch, autocomplete.pattern]);
|
|
2770
2898
|
const searchControl = useMemo(() => ({
|
|
@@ -2801,7 +2929,9 @@ function RlsModal({ autoclose, children, className, controller, onBackdrop, visi
|
|
|
2801
2929
|
return renderClassStatus('rls-modal', { visible: controller?.visible ?? visible }, className);
|
|
2802
2930
|
}, [className, visible, controller?.visible]);
|
|
2803
2931
|
const onClickBackdrop = useCallback(() => {
|
|
2804
|
-
|
|
2932
|
+
if (autoclose) {
|
|
2933
|
+
controller?.close();
|
|
2934
|
+
}
|
|
2805
2935
|
onBackdrop?.();
|
|
2806
2936
|
}, [autoclose, controller, onBackdrop]);
|
|
2807
2937
|
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);
|
|
@@ -2902,7 +3032,12 @@ function RlsPickerClock({ formControl, onListener, rlsTheme, time }) {
|
|
|
2902
3032
|
});
|
|
2903
3033
|
}, []);
|
|
2904
3034
|
useEffect(() => {
|
|
2905
|
-
|
|
3035
|
+
if (selectionIsHours) {
|
|
3036
|
+
refreshClockHour();
|
|
3037
|
+
}
|
|
3038
|
+
else {
|
|
3039
|
+
refreshClockMinute();
|
|
3040
|
+
}
|
|
2906
3041
|
}, [selectionIsHours]);
|
|
2907
3042
|
useEffect(() => {
|
|
2908
3043
|
if (!changeIsInternal.current && formControl?.value) {
|
|
@@ -2922,7 +3057,12 @@ function RlsPickerClock({ formControl, onListener, rlsTheme, time }) {
|
|
|
2922
3057
|
const angle = Math.atan2(-positionX, positionY) + Math.PI;
|
|
2923
3058
|
const value = Math.round(angle / radianUnit);
|
|
2924
3059
|
refreshClock(value);
|
|
2925
|
-
|
|
3060
|
+
if (selectionIsHours) {
|
|
3061
|
+
setHour(value === 0 ? 12 : value);
|
|
3062
|
+
}
|
|
3063
|
+
else {
|
|
3064
|
+
setMinute(value);
|
|
3065
|
+
}
|
|
2926
3066
|
}, [selectionIsHours, radianUnit]);
|
|
2927
3067
|
const refreshClock = useCallback((value) => {
|
|
2928
3068
|
const angle = value * radianUnit;
|
|
@@ -3039,7 +3179,9 @@ function RlsFieldClock({ children, disabled: disabledProps, formControl, identif
|
|
|
3039
3179
|
};
|
|
3040
3180
|
}, [timeValue]);
|
|
3041
3181
|
const onClickInput = useCallback(() => {
|
|
3042
|
-
!readOnly
|
|
3182
|
+
if (!readOnly) {
|
|
3183
|
+
setModalIsVisible(true);
|
|
3184
|
+
}
|
|
3043
3185
|
}, [readOnly]);
|
|
3044
3186
|
const onChange = useCallback((value) => {
|
|
3045
3187
|
setValue(value);
|
|
@@ -3056,452 +3198,82 @@ function RlsFieldClock({ children, disabled: disabledProps, formControl, identif
|
|
|
3056
3198
|
}
|
|
3057
3199
|
}, [timeValue, formControl, valueInitial, onChange]);
|
|
3058
3200
|
const onListener = useCallback(({ event, value }) => {
|
|
3059
|
-
event !== PickerListenerEvent.Cancel
|
|
3201
|
+
if (event !== PickerListenerEvent.Cancel) {
|
|
3202
|
+
onChange(value);
|
|
3203
|
+
}
|
|
3060
3204
|
formControl?.touch();
|
|
3061
3205
|
setModalIsVisible(false);
|
|
3062
3206
|
}, [formControl, onChange]);
|
|
3063
3207
|
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: "rls-field-clock", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children && jsxRuntimeExports.jsx("span", { 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-clock__control", type: "text", value: status.valueInput, readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), !readOnly && (jsxRuntimeExports.jsx(RlsButtonIcon, { icon: status.icon, onClick: onClickAction, disabled: disabled }))] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }), jsxRuntimeExports.jsx(RlsModal, { className: "rls-field-clock-modal", visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntimeExports.jsx(RlsPickerClock, { formControl: formControl, time: time, disabled: disabled, onListener: onListener }) })] }));
|
|
3064
3208
|
}
|
|
3065
3209
|
|
|
3066
|
-
|
|
3067
|
-
const
|
|
3068
|
-
const
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
const
|
|
3072
|
-
const
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
const
|
|
3076
|
-
const
|
|
3077
|
-
const
|
|
3078
|
-
const [visibility, setVisibility] = useState('DAY');
|
|
3210
|
+
function RlsPickerColor({ color, formControl, onListener, rlsTheme }) {
|
|
3211
|
+
const initialColor = useMemo(() => formControl?.value ?? color ?? DEFAULT_COLOR, []);
|
|
3212
|
+
const initialHsv = useMemo(() => hexToHsv(initialColor) ?? { h: 258, s: 100, v: 100 }, []);
|
|
3213
|
+
const canvasRef = useRef(null);
|
|
3214
|
+
const hueRef = useRef(null);
|
|
3215
|
+
const alphaRef = useRef(null);
|
|
3216
|
+
const selectionIsActive = useRef(false);
|
|
3217
|
+
const activeSlider = useRef(null);
|
|
3218
|
+
const hexEditing = useRef(false);
|
|
3219
|
+
const [hsv, setHsv] = useState(initialHsv);
|
|
3220
|
+
const [alpha, setAlpha] = useState(1);
|
|
3221
|
+
const [hexInput, setHexInput] = useState(initialColor);
|
|
3079
3222
|
const [labels, setLabels] = useState({
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
dateActionToday: reactI18n('dateActionToday')
|
|
3223
|
+
colorActionCancel: reactI18n('dateActionCancel'),
|
|
3224
|
+
colorActionSelect: reactI18n('dateActionSelect')
|
|
3083
3225
|
});
|
|
3084
|
-
const
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
}
|
|
3093
|
-
}, [
|
|
3094
|
-
const
|
|
3095
|
-
return
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3226
|
+
const hexColor = useMemo(() => hsvToHex(hsv), [hsv]);
|
|
3227
|
+
const hexValue = useMemo(() => {
|
|
3228
|
+
return hexInput.replace('#', '');
|
|
3229
|
+
}, [hexInput]);
|
|
3230
|
+
const canvasStyle = useMemo(() => {
|
|
3231
|
+
const { r, g, b } = hsvToRgb({ h: hsv.h, s: 100, v: 100 });
|
|
3232
|
+
return {
|
|
3233
|
+
background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent), rgb(${r}, ${g}, ${b})`
|
|
3234
|
+
};
|
|
3235
|
+
}, [hsv.h]);
|
|
3236
|
+
const indicatorPosition = useMemo(() => {
|
|
3237
|
+
return {
|
|
3238
|
+
left: `${(hsv.s / 100) * 100}%`,
|
|
3239
|
+
top: `${100 - (hsv.v / 100) * 100}%`
|
|
3240
|
+
};
|
|
3241
|
+
}, [hsv.s, hsv.v]);
|
|
3242
|
+
const hueSliderStyle = useMemo(() => {
|
|
3243
|
+
return {
|
|
3244
|
+
background: 'linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%)'
|
|
3245
|
+
};
|
|
3246
|
+
}, []);
|
|
3247
|
+
const hueIndicatorStyle = useMemo(() => {
|
|
3248
|
+
return { left: `${(hsv.h / 360) * 100}%`, backgroundColor: hexColor };
|
|
3249
|
+
}, [hsv.h, hexColor]);
|
|
3250
|
+
const alphaSliderStyle = useMemo(() => {
|
|
3251
|
+
return {
|
|
3252
|
+
background: `linear-gradient(to right, transparent, ${hexColor})`
|
|
3253
|
+
};
|
|
3254
|
+
}, [hexColor]);
|
|
3255
|
+
const alphaIndicatorStyle = useMemo(() => {
|
|
3256
|
+
return { left: `${alpha * 100}%`, backgroundColor: hexColor };
|
|
3257
|
+
}, [alpha, hexColor]);
|
|
3258
|
+
useEffect(() => {
|
|
3259
|
+
if (!hexEditing.current) {
|
|
3260
|
+
setHexInput(hexColor);
|
|
3261
|
+
}
|
|
3262
|
+
}, [hexColor]);
|
|
3102
3263
|
useEffect(() => {
|
|
3103
|
-
const date = verifyDateRange({ date: _date, minDate, maxDate });
|
|
3104
|
-
yearControl.setValue(date.getFullYear());
|
|
3105
|
-
monthControl.setValue(date.getMonth());
|
|
3106
|
-
dayControl.setValue(date.getDate());
|
|
3107
|
-
formControl?.setValue(date);
|
|
3108
3264
|
return i18nSubscribe(() => {
|
|
3109
3265
|
setLabels({
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
dateActionToday: reactI18n('dateActionToday')
|
|
3266
|
+
colorActionCancel: reactI18n('dateActionCancel'),
|
|
3267
|
+
colorActionSelect: reactI18n('dateActionSelect')
|
|
3113
3268
|
});
|
|
3114
3269
|
});
|
|
3115
3270
|
}, []);
|
|
3116
|
-
const
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
const onCancel = useCallback(() => {
|
|
3123
|
-
onListener?.({ event: PickerListenerEvent.Cancel });
|
|
3124
|
-
}, [onListener]);
|
|
3125
|
-
const onToday = useCallback(() => {
|
|
3126
|
-
yearControl.setValue(today.current.getFullYear());
|
|
3127
|
-
dayControl.setValue(today.current.getDate());
|
|
3128
|
-
monthControl.setValue(today.current.getMonth());
|
|
3129
|
-
formControl?.setValue(today.current);
|
|
3130
|
-
onListener?.({
|
|
3131
|
-
event: PickerListenerEvent.Now,
|
|
3132
|
-
value: today.current
|
|
3133
|
-
});
|
|
3134
|
-
}, [formControl, onListener]);
|
|
3135
|
-
const onSelect = useCallback(() => {
|
|
3136
|
-
formControl?.setValue(value);
|
|
3137
|
-
onListener?.({
|
|
3138
|
-
event: PickerListenerEvent.Select,
|
|
3139
|
-
value: value
|
|
3140
|
-
});
|
|
3141
|
-
}, [formControl, value, onListener]);
|
|
3142
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-date", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-date__header", children: [jsxRuntimeExports.jsx(RlsPickerSelectorTitle, { monthControl: monthControl, yearControl: yearControl, date: value, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: 'month', onClick: onVisibilityTitle }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__title", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityDay, children: title }) })] }), jsxRuntimeExports.jsxs("div", { className: classNameComponent, children: [jsxRuntimeExports.jsx(RlsPickerDay, { formControl: dayControl, date: value, month: monthControl.value, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsxRuntimeExports.jsx(RlsPickerMonth, { formControl: monthControl, date: value, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsxRuntimeExports.jsx(RlsPickerYear, { formControl: yearControl, date: value, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), !automatic && (jsxRuntimeExports.jsx("div", { className: "rls-picker-date__footer", children: jsxRuntimeExports.jsxs("div", { className: "rls-picker-date__actions", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--cancel", children: jsxRuntimeExports.jsx(RlsButton, { type: "flat", onClick: onCancel, children: labels.dateActionCancel }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--today", children: jsxRuntimeExports.jsx(RlsButtonAction, { icon: "calendar", onClick: onToday, disabled: itIsDisabledToday }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--ok", children: jsxRuntimeExports.jsx(RlsButton, { type: "gradient", onClick: onSelect, children: labels.dateActionSelect }) })] }) }))] }));
|
|
3143
|
-
}
|
|
3144
|
-
|
|
3145
|
-
function RlsFieldDate({ children, date, disabled: disabledProps, formControl, format, identifier, maxDate, minDate, msgErrorDisabled, onValue, placeholder, readOnly, rlsTheme, value: valueInitial }) {
|
|
3146
|
-
const today = useRef(new Date()); // Initial current date in component
|
|
3147
|
-
const [value, setValue] = useState(formControl?.value ?? valueInitial);
|
|
3148
|
-
const [modalIsVisible, setModalIsVisible] = useState(false);
|
|
3149
|
-
const disabled = useMemo(() => {
|
|
3150
|
-
return formControl?.disabled || disabledProps;
|
|
3151
|
-
}, [formControl?.disabled, disabledProps]);
|
|
3152
|
-
const className = useMemo(() => {
|
|
3153
|
-
return renderClassStatus('rls-field-box', {
|
|
3154
|
-
disabled,
|
|
3155
|
-
readonly: readOnly
|
|
3156
|
-
});
|
|
3157
|
-
}, [disabled, readOnly]);
|
|
3158
|
-
const dateValue = useMemo(() => {
|
|
3159
|
-
return formControl ? formControl.value : value;
|
|
3160
|
-
}, [formControl?.value, value]);
|
|
3161
|
-
const status = useMemo(() => {
|
|
3162
|
-
return {
|
|
3163
|
-
icon: dateValue ? 'trash-2' : 'calendar',
|
|
3164
|
-
label: dateValue
|
|
3165
|
-
? dateFormatTemplate(dateValue, format ?? DATE_FORMAT)
|
|
3166
|
-
: ''
|
|
3167
|
-
};
|
|
3168
|
-
}, [dateValue, format]);
|
|
3169
|
-
useEffect(() => {
|
|
3170
|
-
const dateSecure = verifyDateRange({
|
|
3171
|
-
date: formControl?.value ?? date ?? today.current,
|
|
3172
|
-
minDate,
|
|
3173
|
-
maxDate
|
|
3174
|
-
});
|
|
3175
|
-
setValue(dateSecure);
|
|
3176
|
-
formControl?.setValue(dateSecure);
|
|
3177
|
-
}, []);
|
|
3178
|
-
const onClickInput = useCallback(() => {
|
|
3179
|
-
!readOnly && setModalIsVisible(true);
|
|
3180
|
-
}, [readOnly]);
|
|
3181
|
-
const onChange = useCallback((value) => {
|
|
3182
|
-
setValue(value);
|
|
3183
|
-
onValue?.(value);
|
|
3184
|
-
}, [onValue]);
|
|
3185
|
-
const onClickAction = useCallback(() => {
|
|
3186
|
-
if (dateValue) {
|
|
3187
|
-
formControl?.setValue(valueInitial);
|
|
3188
|
-
formControl?.touch();
|
|
3189
|
-
onChange(valueInitial);
|
|
3190
|
-
}
|
|
3191
|
-
else {
|
|
3192
|
-
setModalIsVisible(true);
|
|
3193
|
-
}
|
|
3194
|
-
}, [dateValue, formControl, valueInitial, onChange]);
|
|
3195
|
-
const onListener = useCallback(({ event, value }) => {
|
|
3196
|
-
event !== PickerListenerEvent.Cancel && onChange(value);
|
|
3197
|
-
formControl?.touch();
|
|
3198
|
-
setModalIsVisible(false);
|
|
3199
|
-
}, [formControl, onChange]);
|
|
3200
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: "rls-field-date", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children && jsxRuntimeExports.jsx("span", { 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-date__control", type: "text", value: status.label, readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), !readOnly && (jsxRuntimeExports.jsx(RlsButtonIcon, { icon: status.icon, onClick: onClickAction, disabled: disabled }))] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }), jsxRuntimeExports.jsx(RlsModal, { className: "rls-field-date-modal", visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntimeExports.jsx(RlsPickerDate, { formControl: formControl, date: date, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: onListener }) })] }));
|
|
3201
|
-
}
|
|
3202
|
-
|
|
3203
|
-
function rangeFormatTemplate({ maxDate, minDate }) {
|
|
3204
|
-
const minFormat = dateFormatTemplate(minDate, DATE_RANGE_FORMAT);
|
|
3205
|
-
const maxFormat = dateFormatTemplate(maxDate, DATE_RANGE_FORMAT);
|
|
3206
|
-
return `${minFormat} - ${maxFormat}`;
|
|
3207
|
-
}
|
|
3208
|
-
|
|
3209
|
-
function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl, maxDate, minDate, onListener, rlsTheme }) {
|
|
3210
|
-
const _date = useMemo(() => normalizeMinTime(datePicker ?? new Date()), [datePicker]);
|
|
3211
|
-
const _range = useMemo(() => formControl?.value ?? DateRange.now(), [formControl?.value]);
|
|
3212
|
-
const yearControl = useReactControl(_date.getFullYear());
|
|
3213
|
-
const monthControl = useReactControl(_date.getMonth());
|
|
3214
|
-
const rangeControl = useReactControl(_range);
|
|
3215
|
-
const [visibility, setVisibility] = useState('DAY');
|
|
3216
|
-
const [labels, setLabels] = useState({
|
|
3217
|
-
dateActionCancel: reactI18n('dateActionCancel'),
|
|
3218
|
-
dateActionSelect: reactI18n('dateActionSelect')
|
|
3219
|
-
});
|
|
3220
|
-
const value = useMemo(() => {
|
|
3221
|
-
return rangeControl.value ?? _range;
|
|
3222
|
-
}, [rangeControl.value, _range]);
|
|
3223
|
-
const date = useMemo(() => {
|
|
3224
|
-
let value = _date;
|
|
3225
|
-
if (valueIsDefined(yearControl.value)) {
|
|
3226
|
-
value = assignYearInDate(value, yearControl.value);
|
|
3227
|
-
}
|
|
3228
|
-
if (valueIsDefined(monthControl.value)) {
|
|
3229
|
-
value = assignMonthInDate(value, monthControl.value);
|
|
3230
|
-
}
|
|
3231
|
-
return value;
|
|
3232
|
-
}, [_date, yearControl.value, monthControl.value]);
|
|
3233
|
-
const classNameComponent = useMemo(() => {
|
|
3234
|
-
return renderClassStatus('rls-picker-date-range__component', {
|
|
3235
|
-
day: visibility === 'DAY',
|
|
3236
|
-
month: visibility === 'MONTH',
|
|
3237
|
-
year: visibility === 'YEAR'
|
|
3238
|
-
});
|
|
3239
|
-
}, [visibility]);
|
|
3240
|
-
const classNameFooter = useMemo(() => {
|
|
3241
|
-
return renderClassStatus('rls-picker-date-range__footer', { automatic });
|
|
3242
|
-
}, [automatic]);
|
|
3243
|
-
const title = useMemo(() => rangeFormatTemplate(value), [value]);
|
|
3244
|
-
useEffect(() => {
|
|
3245
|
-
return i18nSubscribe(() => {
|
|
3246
|
-
setLabels({
|
|
3247
|
-
dateActionCancel: reactI18n('dateActionCancel'),
|
|
3248
|
-
dateActionSelect: reactI18n('dateActionSelect')
|
|
3249
|
-
});
|
|
3250
|
-
});
|
|
3251
|
-
}, []);
|
|
3252
|
-
useEffect(() => {
|
|
3253
|
-
setVisibility('DAY');
|
|
3254
|
-
}, [rangeControl.value]);
|
|
3255
|
-
const onVisibilityDay = useCallback(() => {
|
|
3256
|
-
setVisibility('DAY');
|
|
3257
|
-
}, []);
|
|
3258
|
-
const onVisibilityTitle = useCallback((type) => {
|
|
3259
|
-
type === 'month' ? setVisibility('MONTH') : setVisibility('YEAR');
|
|
3260
|
-
}, []);
|
|
3261
|
-
const onCancel = useCallback(() => {
|
|
3262
|
-
onListener?.({ event: PickerListenerEvent.Cancel });
|
|
3263
|
-
}, [onListener]);
|
|
3264
|
-
const onSelect = useCallback(() => {
|
|
3265
|
-
formControl?.setValue(value);
|
|
3266
|
-
onListener?.({ event: PickerListenerEvent.Select, value });
|
|
3267
|
-
}, [formControl, value, onListener]);
|
|
3268
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range__header", children: [jsxRuntimeExports.jsx(RlsPickerSelectorTitle, { monthControl: monthControl, yearControl: yearControl, date: date, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: visibility === 'MONTH' ? 'year' : 'month', onClick: onVisibilityTitle }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__title", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityDay, children: title }) })] }), jsxRuntimeExports.jsxs("div", { className: classNameComponent, children: [jsxRuntimeExports.jsx(RlsPickerDayRange, { formControl: rangeControl, date: date, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsxRuntimeExports.jsx(RlsPickerMonth, { formControl: monthControl, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsxRuntimeExports.jsx(RlsPickerYear, { formControl: yearControl, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), jsxRuntimeExports.jsx("div", { className: classNameFooter, children: jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range__actions", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__actions--cancel", children: jsxRuntimeExports.jsx(RlsButton, { type: "flat", onClick: onCancel, children: labels.dateActionCancel }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__actions--ok", children: jsxRuntimeExports.jsx(RlsButton, { type: "gradient", onClick: onSelect, children: labels.dateActionSelect }) })] }) })] }));
|
|
3269
|
-
}
|
|
3270
|
-
|
|
3271
|
-
function RlsFieldDateRange({ children, date, disabled: disabledProps, formControl, identifier, maxDate, minDate, msgErrorDisabled, onValue, placeholder, readOnly, rlsTheme, value: valueInitial }) {
|
|
3272
|
-
const currentDate = useMemo(() => date ?? new Date(), [date]);
|
|
3273
|
-
const [value, setValue] = useState(formControl?.value || valueInitial);
|
|
3274
|
-
const [modalIsVisible, setModalIsVisible] = useState(false);
|
|
3275
|
-
const disabled = useMemo(() => {
|
|
3276
|
-
return formControl?.disabled || disabledProps;
|
|
3277
|
-
}, [formControl?.disabled, disabledProps]);
|
|
3278
|
-
const className = useMemo(() => {
|
|
3279
|
-
return renderClassStatus('rls-field-box', {
|
|
3280
|
-
disabled,
|
|
3281
|
-
readonly: readOnly
|
|
3282
|
-
});
|
|
3283
|
-
}, [disabled, readOnly]);
|
|
3284
|
-
const dateRangeValue = useMemo(() => {
|
|
3285
|
-
return formControl ? formControl.value : value;
|
|
3286
|
-
}, [formControl?.value, value]);
|
|
3287
|
-
const status = useMemo(() => {
|
|
3288
|
-
return {
|
|
3289
|
-
icon: dateRangeValue ? 'trash-2' : 'calendar',
|
|
3290
|
-
valueInput: dateRangeValue ? rangeFormatTemplate(dateRangeValue) : ''
|
|
3291
|
-
};
|
|
3292
|
-
}, [dateRangeValue]);
|
|
3293
|
-
const onClickInput = useCallback(() => {
|
|
3294
|
-
!readOnly && setModalIsVisible(true);
|
|
3295
|
-
}, [readOnly]);
|
|
3296
|
-
const onChange = useCallback((value) => {
|
|
3297
|
-
setValue(value);
|
|
3298
|
-
onValue?.(value);
|
|
3299
|
-
}, [onValue]);
|
|
3300
|
-
const onClickAction = useCallback(() => {
|
|
3301
|
-
if (dateRangeValue) {
|
|
3302
|
-
formControl?.setValue(valueInitial);
|
|
3303
|
-
formControl?.touch();
|
|
3304
|
-
onChange(valueInitial);
|
|
3305
|
-
}
|
|
3306
|
-
else {
|
|
3307
|
-
setModalIsVisible(true);
|
|
3308
|
-
}
|
|
3309
|
-
}, [dateRangeValue, formControl, valueInitial, onChange]);
|
|
3310
|
-
const onListener = useCallback(({ event, value }) => {
|
|
3311
|
-
event !== PickerListenerEvent.Cancel && onChange(value);
|
|
3312
|
-
formControl?.touch();
|
|
3313
|
-
setModalIsVisible(false);
|
|
3314
|
-
}, [formControl, onChange]);
|
|
3315
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: "rls-field-date-range", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children && jsxRuntimeExports.jsx("span", { 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-date-range__control", type: "text", value: status.valueInput, readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), !readOnly && (jsxRuntimeExports.jsx(RlsButtonIcon, { icon: status.icon, onClick: onClickAction, disabled: disabled }))] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }), jsxRuntimeExports.jsx(RlsModal, { className: "rls-field-date-range-modal", visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntimeExports.jsx(RlsPickerDateRange, { formControl: formControl, date: currentDate, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: onListener }) })] }));
|
|
3316
|
-
}
|
|
3317
|
-
|
|
3318
|
-
function useFieldSelect(props) {
|
|
3319
|
-
const controller = useListController(props);
|
|
3320
|
-
useEffect(() => {
|
|
3321
|
-
props.disabled && controller.setState({ focused: false });
|
|
3322
|
-
}, [props.disabled]);
|
|
3323
|
-
const onFocusInput = useCallback(() => {
|
|
3324
|
-
controller.setState({ focused: true });
|
|
3325
|
-
}, [controller.setState]);
|
|
3326
|
-
const onBlurInput = useCallback(() => {
|
|
3327
|
-
controller.setState({ focused: false });
|
|
3328
|
-
}, [controller.setState]);
|
|
3329
|
-
const onClickInput = useCallback(() => {
|
|
3330
|
-
!props.readOnly && controller.setState({ listIsVisible: true });
|
|
3331
|
-
}, [controller.setState, props.readOnly]);
|
|
3332
|
-
const onKeydownInput = useCallback((event) => {
|
|
3333
|
-
switch (event.code) {
|
|
3334
|
-
case 'Space':
|
|
3335
|
-
case 'Enter':
|
|
3336
|
-
controller.setState({ listIsVisible: true });
|
|
3337
|
-
break;
|
|
3338
|
-
case 'Escape':
|
|
3339
|
-
case 'Tab':
|
|
3340
|
-
controller.setState({ listIsVisible: false });
|
|
3341
|
-
break;
|
|
3342
|
-
default:
|
|
3343
|
-
controller.navigationInput(event);
|
|
3344
|
-
break;
|
|
3345
|
-
}
|
|
3346
|
-
}, [controller.setState, controller.navigationInput]);
|
|
3347
|
-
const onClickAction = useCallback(() => {
|
|
3348
|
-
const removable = !props.unremovable && !!controller.value;
|
|
3349
|
-
if (removable) {
|
|
3350
|
-
controller.setState({ listIsVisible: false });
|
|
3351
|
-
controller.setFormValue(undefined);
|
|
3352
|
-
props.onValue?.(props.value);
|
|
3353
|
-
}
|
|
3354
|
-
else {
|
|
3355
|
-
const listIsVisible = !controller.listIsVisible;
|
|
3356
|
-
controller.setState({ listIsVisible });
|
|
3357
|
-
listIsVisible && controller.refInput?.current?.focus();
|
|
3358
|
-
}
|
|
3359
|
-
}, [
|
|
3360
|
-
controller.listIsVisible,
|
|
3361
|
-
controller.value,
|
|
3362
|
-
controller.setState,
|
|
3363
|
-
controller.setFormValue,
|
|
3364
|
-
props.unremovable,
|
|
3365
|
-
props.onValue
|
|
3366
|
-
]);
|
|
3367
|
-
const onClickBackdrop = useCallback(() => {
|
|
3368
|
-
controller.setState({ listIsVisible: false });
|
|
3369
|
-
}, [controller.setState]);
|
|
3370
|
-
const onChange = useCallback((element) => {
|
|
3371
|
-
!props.disabled && controller.refInput?.current?.focus();
|
|
3372
|
-
if (props.onSelect) {
|
|
3373
|
-
controller.setState({ listIsVisible: false });
|
|
3374
|
-
element.value && props.onSelect(element.value);
|
|
3375
|
-
}
|
|
3376
|
-
else {
|
|
3377
|
-
controller.setFormValue(element);
|
|
3378
|
-
controller.setState({ listIsVisible: false });
|
|
3379
|
-
}
|
|
3380
|
-
props.onValue?.(element.value);
|
|
3381
|
-
}, [
|
|
3382
|
-
controller.setState,
|
|
3383
|
-
controller.setFormValue,
|
|
3384
|
-
props.onSelect,
|
|
3385
|
-
props.onValue,
|
|
3386
|
-
props.disabled
|
|
3387
|
-
]);
|
|
3388
|
-
const onClickElement = useCallback((element) => {
|
|
3389
|
-
return () => {
|
|
3390
|
-
onChange(element);
|
|
3391
|
-
};
|
|
3392
|
-
}, [onChange]);
|
|
3393
|
-
const onKeydownElement = useCallback((element) => {
|
|
3394
|
-
return (event) => {
|
|
3395
|
-
event.code === 'Enter'
|
|
3396
|
-
? onChange(element)
|
|
3397
|
-
: controller.navigationElement(event);
|
|
3398
|
-
};
|
|
3399
|
-
}, [onChange, controller.navigationElement]);
|
|
3400
|
-
return {
|
|
3401
|
-
...controller,
|
|
3402
|
-
onBlurInput,
|
|
3403
|
-
onClickAction,
|
|
3404
|
-
onClickBackdrop,
|
|
3405
|
-
onClickInput,
|
|
3406
|
-
onClickElement,
|
|
3407
|
-
onFocusInput,
|
|
3408
|
-
onKeydownElement,
|
|
3409
|
-
onKeydownInput
|
|
3410
|
-
};
|
|
3411
|
-
}
|
|
3412
|
-
|
|
3413
|
-
function RlsFieldSelectTemplate(props) {
|
|
3414
|
-
const select = useFieldSelect(props);
|
|
3415
|
-
const { render, suggestions, action, children, formControl, msgErrorDisabled, placeholder, rlsTheme, unremovable } = props;
|
|
3416
|
-
const disabled = useMemo(() => {
|
|
3417
|
-
return formControl?.disabled || props.disabled;
|
|
3418
|
-
}, [formControl?.disabled, props.disabled]);
|
|
3419
|
-
const className = useMemo(() => {
|
|
3420
|
-
return renderClassStatus('rls-field-box', {
|
|
3421
|
-
focused: select.focused && !disabled,
|
|
3422
|
-
error: formControl?.wrong,
|
|
3423
|
-
disabled: disabled,
|
|
3424
|
-
readonly: props.readOnly
|
|
3425
|
-
}, `rls-field-list rls-field-select ${props.className ?? ''}`);
|
|
3426
|
-
}, [
|
|
3427
|
-
formControl?.wrong,
|
|
3428
|
-
select.focused,
|
|
3429
|
-
props.className,
|
|
3430
|
-
props.readOnly,
|
|
3431
|
-
disabled
|
|
3432
|
-
]);
|
|
3433
|
-
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: select.refContent, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { 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.refInput, 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 }), !props.readOnly && (jsxRuntimeExports.jsx(RlsButtonIcon, { icon: !unremovable && !!select.value ? 'close' : 'arrow-ios-down', onClick: select.onClickAction, disabled: disabled }))] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })), jsxRuntimeExports.jsx(RlsFieldListSuggestions, { elements: suggestions, visible: select.listIsVisible, action: action, disabled: disabled, higher: select.higher, render: render, refList: select.refList, onClickElement: select.onClickElement, onKeydownElement: select.onKeydownElement, onClickBackdrop: select.onClickBackdrop })] }));
|
|
3434
|
-
}
|
|
3435
|
-
function RlsFieldSelect(props) {
|
|
3436
|
-
const render = useCallback((element) => (jsxRuntimeExports.jsx(RlsBallot, { className: "rls-field-list__ballot", subtitle: element.subtitle, img: element.img, initials: element.initials, children: jsxRuntimeExports.jsx("span", { children: element.title }) })), []);
|
|
3437
|
-
return jsxRuntimeExports.jsx(RlsFieldSelectTemplate, { ...props, render: render });
|
|
3438
|
-
}
|
|
3439
|
-
|
|
3440
|
-
function RlsPickerColor({ color, formControl, onListener, rlsTheme }) {
|
|
3441
|
-
const initialColor = useMemo(() => formControl?.value ?? color ?? DEFAULT_COLOR, []);
|
|
3442
|
-
const initialHsv = useMemo(() => hexToHsv(initialColor) ?? { h: 258, s: 100, v: 100 }, []);
|
|
3443
|
-
const canvasRef = useRef(null);
|
|
3444
|
-
const hueRef = useRef(null);
|
|
3445
|
-
const alphaRef = useRef(null);
|
|
3446
|
-
const selectionIsActive = useRef(false);
|
|
3447
|
-
const activeSlider = useRef(null);
|
|
3448
|
-
const hexEditing = useRef(false);
|
|
3449
|
-
const [hsv, setHsv] = useState(initialHsv);
|
|
3450
|
-
const [alpha, setAlpha] = useState(1);
|
|
3451
|
-
const [hexInput, setHexInput] = useState(initialColor);
|
|
3452
|
-
const [labels, setLabels] = useState({
|
|
3453
|
-
colorActionCancel: reactI18n('dateActionCancel'),
|
|
3454
|
-
colorActionSelect: reactI18n('dateActionSelect')
|
|
3455
|
-
});
|
|
3456
|
-
const hexColor = useMemo(() => hsvToHex(hsv), [hsv]);
|
|
3457
|
-
const hexValue = useMemo(() => {
|
|
3458
|
-
return hexInput.replace('#', '');
|
|
3459
|
-
}, [hexInput]);
|
|
3460
|
-
const canvasStyle = useMemo(() => {
|
|
3461
|
-
const { r, g, b } = hsvToRgb({ h: hsv.h, s: 100, v: 100 });
|
|
3462
|
-
return {
|
|
3463
|
-
background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent), rgb(${r}, ${g}, ${b})`
|
|
3464
|
-
};
|
|
3465
|
-
}, [hsv.h]);
|
|
3466
|
-
const indicatorPosition = useMemo(() => {
|
|
3467
|
-
return {
|
|
3468
|
-
left: `${(hsv.s / 100) * 100}%`,
|
|
3469
|
-
top: `${100 - (hsv.v / 100) * 100}%`
|
|
3470
|
-
};
|
|
3471
|
-
}, [hsv.s, hsv.v]);
|
|
3472
|
-
const hueSliderStyle = useMemo(() => {
|
|
3473
|
-
return {
|
|
3474
|
-
background: 'linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%)'
|
|
3475
|
-
};
|
|
3476
|
-
}, []);
|
|
3477
|
-
const hueIndicatorStyle = useMemo(() => {
|
|
3478
|
-
return { left: `${(hsv.h / 360) * 100}%`, backgroundColor: hexColor };
|
|
3479
|
-
}, [hsv.h, hexColor]);
|
|
3480
|
-
const alphaSliderStyle = useMemo(() => {
|
|
3481
|
-
return {
|
|
3482
|
-
background: `linear-gradient(to right, transparent, ${hexColor})`
|
|
3483
|
-
};
|
|
3484
|
-
}, [hexColor]);
|
|
3485
|
-
const alphaIndicatorStyle = useMemo(() => {
|
|
3486
|
-
return { left: `${alpha * 100}%`, backgroundColor: hexColor };
|
|
3487
|
-
}, [alpha, hexColor]);
|
|
3488
|
-
useEffect(() => {
|
|
3489
|
-
!hexEditing.current && setHexInput(hexColor);
|
|
3490
|
-
}, [hexColor]);
|
|
3491
|
-
useEffect(() => {
|
|
3492
|
-
return i18nSubscribe(() => {
|
|
3493
|
-
setLabels({
|
|
3494
|
-
colorActionCancel: reactI18n('dateActionCancel'),
|
|
3495
|
-
colorActionSelect: reactI18n('dateActionSelect')
|
|
3496
|
-
});
|
|
3497
|
-
});
|
|
3498
|
-
}, []);
|
|
3499
|
-
const getPositionInElement = useCallback((element, clientX, clientY) => {
|
|
3500
|
-
const rect = element.getBoundingClientRect();
|
|
3501
|
-
return {
|
|
3502
|
-
x: (clientX - rect.left) / rect.width,
|
|
3503
|
-
y: (clientY - rect.top) / rect.height
|
|
3504
|
-
};
|
|
3271
|
+
const getPositionInElement = useCallback((element, clientX, clientY) => {
|
|
3272
|
+
const rect = element.getBoundingClientRect();
|
|
3273
|
+
return {
|
|
3274
|
+
x: (clientX - rect.left) / rect.width,
|
|
3275
|
+
y: (clientY - rect.top) / rect.height
|
|
3276
|
+
};
|
|
3505
3277
|
}, []);
|
|
3506
3278
|
const updateColorOnCanvas = useEffectEvent((clientX, clientY) => {
|
|
3507
3279
|
if (!canvasRef.current)
|
|
@@ -3599,55 +3371,324 @@ function RlsPickerColor({ color, formControl, onListener, rlsTheme }) {
|
|
|
3599
3371
|
updateAlphaOnSlider(touch.clientX, touch.clientY);
|
|
3600
3372
|
break;
|
|
3601
3373
|
}
|
|
3602
|
-
}, [updateColorOnCanvas, updateHueOnSlider, updateAlphaOnSlider]);
|
|
3603
|
-
const onInactiveSelection = useCallback(() => {
|
|
3604
|
-
selectionIsActive.current = false;
|
|
3605
|
-
activeSlider.current = null;
|
|
3606
|
-
}, []);
|
|
3607
|
-
const onHexChange = useCallback((value) => {
|
|
3608
|
-
setHexInput(value);
|
|
3609
|
-
const normalized = normalizeHex(value);
|
|
3610
|
-
if (normalized) {
|
|
3611
|
-
const hsv = hexToHsv(normalized);
|
|
3612
|
-
|
|
3374
|
+
}, [updateColorOnCanvas, updateHueOnSlider, updateAlphaOnSlider]);
|
|
3375
|
+
const onInactiveSelection = useCallback(() => {
|
|
3376
|
+
selectionIsActive.current = false;
|
|
3377
|
+
activeSlider.current = null;
|
|
3378
|
+
}, []);
|
|
3379
|
+
const onHexChange = useCallback((value) => {
|
|
3380
|
+
setHexInput(value);
|
|
3381
|
+
const normalized = normalizeHex(value);
|
|
3382
|
+
if (normalized) {
|
|
3383
|
+
const hsv = hexToHsv(normalized);
|
|
3384
|
+
if (hsv) {
|
|
3385
|
+
setHsv(hsv);
|
|
3386
|
+
}
|
|
3387
|
+
}
|
|
3388
|
+
}, []);
|
|
3389
|
+
const onHexFocus = useCallback(() => {
|
|
3390
|
+
hexEditing.current = true;
|
|
3391
|
+
}, []);
|
|
3392
|
+
const onHexBlur = useEffectEvent(() => {
|
|
3393
|
+
hexEditing.current = false;
|
|
3394
|
+
const normalized = normalizeHex(hexInput);
|
|
3395
|
+
if (normalized) {
|
|
3396
|
+
setHexInput(normalized);
|
|
3397
|
+
}
|
|
3398
|
+
else {
|
|
3399
|
+
setHexInput(hexColor);
|
|
3400
|
+
}
|
|
3401
|
+
});
|
|
3402
|
+
const onHexKeyDown = useCallback((event) => {
|
|
3403
|
+
if (event.key === 'Enter') {
|
|
3404
|
+
onHexBlur();
|
|
3405
|
+
}
|
|
3406
|
+
}, [onHexBlur]);
|
|
3407
|
+
const onHexInputChange = useCallback((event) => onHexChange(event.target.value ? `#${event.target.value}` : ''), [onHexChange]);
|
|
3408
|
+
const onCancel = useCallback(() => {
|
|
3409
|
+
onListener?.({ event: PickerListenerEvent.Cancel });
|
|
3410
|
+
}, [onListener]);
|
|
3411
|
+
const onSelect = useCallback(() => {
|
|
3412
|
+
formControl?.setValue(hexColor);
|
|
3413
|
+
onListener?.({ event: PickerListenerEvent.Select, value: hexColor });
|
|
3414
|
+
}, [formControl, hexColor, onListener]);
|
|
3415
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-color", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-color__preview", children: jsxRuntimeExports.jsx("div", { ref: canvasRef, className: "rls-picker-color__canvas", style: canvasStyle, "data-slider": "canvas", onMouseDown: onMouseDown, onMouseMove: onMouseMove, onMouseUp: onInactiveSelection, onMouseLeave: onInactiveSelection, onTouchStart: onTouchStart, onTouchMove: onTouchMove, onTouchEnd: onInactiveSelection, children: jsxRuntimeExports.jsx("div", { className: "rls-picker-color__indicator", style: {
|
|
3416
|
+
left: indicatorPosition.left,
|
|
3417
|
+
top: indicatorPosition.top
|
|
3418
|
+
}, children: jsxRuntimeExports.jsx("div", { className: "rls-picker-color__indicator__circle", style: { backgroundColor: hexColor } }) }) }) }), jsxRuntimeExports.jsxs("div", { className: "rls-picker-color__controls", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-color__slider", children: jsxRuntimeExports.jsx("div", { ref: hueRef, className: "rls-picker-color__slider__track", style: hueSliderStyle, "data-slider": "hue", onMouseDown: onMouseDown, onMouseMove: onMouseMove, onMouseUp: onInactiveSelection, onMouseLeave: onInactiveSelection, onTouchStart: onTouchStart, onTouchMove: onTouchMove, onTouchEnd: onInactiveSelection, children: jsxRuntimeExports.jsx("div", { className: "rls-picker-color__slider__thumb", style: hueIndicatorStyle }) }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-color__slider", children: jsxRuntimeExports.jsx("div", { ref: alphaRef, className: "rls-picker-color__slider__track rls-picker-color__slider__track--alpha", style: alphaSliderStyle, "data-slider": "alpha", onMouseDown: onMouseDown, onMouseMove: onMouseMove, onMouseUp: onInactiveSelection, onMouseLeave: onInactiveSelection, onTouchStart: onTouchStart, onTouchMove: onTouchMove, onTouchEnd: onInactiveSelection, children: jsxRuntimeExports.jsx("div", { className: "rls-picker-color__slider__thumb", style: alphaIndicatorStyle }) }) })] }), jsxRuntimeExports.jsx("div", { className: "rls-picker-color__footer", children: jsxRuntimeExports.jsxs("div", { className: "rls-picker-color__hex", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-color__hex__swatch", style: { backgroundColor: hexColor } }), jsxRuntimeExports.jsx("span", { className: "rls-picker-color__hex__prefix", children: "#" }), jsxRuntimeExports.jsx("input", { className: "rls-picker-color__hex__input", type: "text", maxLength: 6, value: hexValue, onChange: onHexInputChange, onFocus: onHexFocus, onBlur: onHexBlur, onKeyDown: onHexKeyDown })] }) }), jsxRuntimeExports.jsxs("div", { className: "rls-picker-color__actions", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-color__actions--cancel", children: jsxRuntimeExports.jsx(RlsButton, { type: "flat", onClick: onCancel, children: labels.colorActionCancel }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-color__actions--ok", children: jsxRuntimeExports.jsx(RlsButton, { type: "gradient", onClick: onSelect, children: labels.colorActionSelect }) })] })] }));
|
|
3419
|
+
}
|
|
3420
|
+
|
|
3421
|
+
function RlsFieldColor({ children, color, disabled: disabledProps, formControl, identifier, msgErrorDisabled, onValue, placeholder, readOnly, rlsTheme, value: valueInitial }) {
|
|
3422
|
+
const [value, setValue] = useState(formControl?.value ?? valueInitial);
|
|
3423
|
+
const [modalIsVisible, setModalIsVisible] = useState(false);
|
|
3424
|
+
const colorValue = useMemo(() => {
|
|
3425
|
+
return formControl ? formControl.value : value;
|
|
3426
|
+
}, [formControl?.value, value]);
|
|
3427
|
+
const disabled = useMemo(() => {
|
|
3428
|
+
return formControl?.disabled || disabledProps;
|
|
3429
|
+
}, [formControl?.disabled, disabledProps]);
|
|
3430
|
+
const className = useMemo(() => {
|
|
3431
|
+
return renderClassStatus('rls-field-box', {
|
|
3432
|
+
disabled,
|
|
3433
|
+
readonly: readOnly
|
|
3434
|
+
});
|
|
3435
|
+
}, [disabled, readOnly]);
|
|
3436
|
+
const displayHex = useMemo(() => {
|
|
3437
|
+
const hex = colorValue && hexIsValid(colorValue) ? colorValue : '';
|
|
3438
|
+
return normalizeHex(hex);
|
|
3439
|
+
}, [colorValue]);
|
|
3440
|
+
const onClickInput = useCallback(() => {
|
|
3441
|
+
if (!readOnly) {
|
|
3442
|
+
setModalIsVisible(true);
|
|
3443
|
+
}
|
|
3444
|
+
}, [readOnly]);
|
|
3445
|
+
const onChange = useCallback((value) => {
|
|
3446
|
+
setValue(value);
|
|
3447
|
+
onValue?.(value);
|
|
3448
|
+
}, [onValue]);
|
|
3449
|
+
const onClickAction = useCallback(() => {
|
|
3450
|
+
if (colorValue) {
|
|
3451
|
+
formControl?.setValue(valueInitial);
|
|
3452
|
+
formControl?.touch();
|
|
3453
|
+
onChange(valueInitial);
|
|
3454
|
+
}
|
|
3455
|
+
else {
|
|
3456
|
+
setModalIsVisible(true);
|
|
3457
|
+
}
|
|
3458
|
+
}, [colorValue, formControl, valueInitial, onChange]);
|
|
3459
|
+
const onListener = useCallback(({ event, value }) => {
|
|
3460
|
+
if (event !== PickerListenerEvent.Cancel) {
|
|
3461
|
+
onChange(value);
|
|
3462
|
+
}
|
|
3463
|
+
formControl?.touch();
|
|
3464
|
+
setModalIsVisible(false);
|
|
3465
|
+
}, [formControl, onChange]);
|
|
3466
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: "rls-field-color", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children && jsxRuntimeExports.jsx("span", { 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: [displayHex && (jsxRuntimeExports.jsx("div", { className: "rls-field-color__swatch", style: { backgroundColor: displayHex } })), jsxRuntimeExports.jsx("input", { className: "rls-field-color__control", type: "text", value: displayHex, readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), !readOnly && (jsxRuntimeExports.jsx(RlsButtonIcon, { icon: colorValue ? 'trash-2' : 'color-palette', onClick: onClickAction, disabled: disabled }))] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }), jsxRuntimeExports.jsx(RlsModal, { className: "rls-field-color-modal", visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntimeExports.jsx(RlsPickerColor, { formControl: formControl, color: color, disabled: disabled, onListener: onListener }) })] }));
|
|
3467
|
+
}
|
|
3468
|
+
|
|
3469
|
+
const DATE_FORMAT = '{dd}/{mx}/{yy}';
|
|
3470
|
+
const DATE_FORMAT_TITLE = '{dw}, {mx} {dd} de {yy}';
|
|
3471
|
+
const DATE_RANGE_FORMAT = '{dd}/{mx}/{yy}';
|
|
3472
|
+
|
|
3473
|
+
function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDate, onListener, rlsTheme }) {
|
|
3474
|
+
const today = useRef(new Date()); // Initial current date in component
|
|
3475
|
+
const _date = useMemo(() => {
|
|
3476
|
+
return formControl?.value ?? date ?? today.current;
|
|
3477
|
+
}, [formControl?.value, date]);
|
|
3478
|
+
const yearControl = useReactControl(_date.getFullYear());
|
|
3479
|
+
const dayControl = useReactControl(_date.getDate());
|
|
3480
|
+
const monthControl = useReactControl(_date.getMonth());
|
|
3481
|
+
const [visibility, setVisibility] = useState('DAY');
|
|
3482
|
+
const [labels, setLabels] = useState({
|
|
3483
|
+
dateActionCancel: reactI18n('dateActionCancel'),
|
|
3484
|
+
dateActionSelect: reactI18n('dateActionSelect'),
|
|
3485
|
+
dateActionToday: reactI18n('dateActionToday')
|
|
3486
|
+
});
|
|
3487
|
+
const value = useMemo(() => {
|
|
3488
|
+
return new Date(yearControl.value, monthControl.value, dayControl.value);
|
|
3489
|
+
}, [yearControl.value, monthControl.value, dayControl.value]);
|
|
3490
|
+
const classNameComponent = useMemo(() => {
|
|
3491
|
+
return renderClassStatus('rls-picker-date__component', {
|
|
3492
|
+
day: visibility === 'DAY',
|
|
3493
|
+
month: visibility === 'MONTH',
|
|
3494
|
+
year: visibility === 'YEAR'
|
|
3495
|
+
});
|
|
3496
|
+
}, [visibility]);
|
|
3497
|
+
const title = useMemo(() => {
|
|
3498
|
+
return dateFormatTemplate(value, DATE_FORMAT_TITLE);
|
|
3499
|
+
}, [value]);
|
|
3500
|
+
const itIsDisabledToday = useMemo(() => dateOutRange({
|
|
3501
|
+
date: today.current,
|
|
3502
|
+
maxDate,
|
|
3503
|
+
minDate
|
|
3504
|
+
}), [maxDate, minDate]);
|
|
3505
|
+
useEffect(() => {
|
|
3506
|
+
const date = verifyDateRange({ date: _date, minDate, maxDate });
|
|
3507
|
+
yearControl.setValue(date.getFullYear());
|
|
3508
|
+
monthControl.setValue(date.getMonth());
|
|
3509
|
+
dayControl.setValue(date.getDate());
|
|
3510
|
+
formControl?.setValue(date);
|
|
3511
|
+
return i18nSubscribe(() => {
|
|
3512
|
+
setLabels({
|
|
3513
|
+
dateActionCancel: reactI18n('dateActionCancel'),
|
|
3514
|
+
dateActionSelect: reactI18n('dateActionSelect'),
|
|
3515
|
+
dateActionToday: reactI18n('dateActionToday')
|
|
3516
|
+
});
|
|
3517
|
+
});
|
|
3518
|
+
}, []);
|
|
3519
|
+
const onVisibilityDay = useCallback(() => {
|
|
3520
|
+
setVisibility('DAY');
|
|
3521
|
+
}, []);
|
|
3522
|
+
const onVisibilityTitle = useCallback((type) => {
|
|
3523
|
+
if (type === 'month') {
|
|
3524
|
+
setVisibility('MONTH');
|
|
3525
|
+
}
|
|
3526
|
+
else {
|
|
3527
|
+
setVisibility('YEAR');
|
|
3528
|
+
}
|
|
3529
|
+
}, []);
|
|
3530
|
+
const onCancel = useCallback(() => {
|
|
3531
|
+
onListener?.({ event: PickerListenerEvent.Cancel });
|
|
3532
|
+
}, [onListener]);
|
|
3533
|
+
const onToday = useCallback(() => {
|
|
3534
|
+
yearControl.setValue(today.current.getFullYear());
|
|
3535
|
+
dayControl.setValue(today.current.getDate());
|
|
3536
|
+
monthControl.setValue(today.current.getMonth());
|
|
3537
|
+
formControl?.setValue(today.current);
|
|
3538
|
+
onListener?.({
|
|
3539
|
+
event: PickerListenerEvent.Now,
|
|
3540
|
+
value: today.current
|
|
3541
|
+
});
|
|
3542
|
+
}, [formControl, onListener]);
|
|
3543
|
+
const onSelect = useCallback(() => {
|
|
3544
|
+
formControl?.setValue(value);
|
|
3545
|
+
onListener?.({
|
|
3546
|
+
event: PickerListenerEvent.Select,
|
|
3547
|
+
value: value
|
|
3548
|
+
});
|
|
3549
|
+
}, [formControl, value, onListener]);
|
|
3550
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-date", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-date__header", children: [jsxRuntimeExports.jsx(RlsPickerSelectorTitle, { monthControl: monthControl, yearControl: yearControl, date: value, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: 'month', onClick: onVisibilityTitle }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__title", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityDay, children: title }) })] }), jsxRuntimeExports.jsxs("div", { className: classNameComponent, children: [jsxRuntimeExports.jsx(RlsPickerDay, { formControl: dayControl, date: value, month: monthControl.value, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsxRuntimeExports.jsx(RlsPickerMonth, { formControl: monthControl, date: value, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsxRuntimeExports.jsx(RlsPickerYear, { formControl: yearControl, date: value, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), !automatic && (jsxRuntimeExports.jsx("div", { className: "rls-picker-date__footer", children: jsxRuntimeExports.jsxs("div", { className: "rls-picker-date__actions", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--cancel", children: jsxRuntimeExports.jsx(RlsButton, { type: "flat", onClick: onCancel, children: labels.dateActionCancel }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--today", children: jsxRuntimeExports.jsx(RlsButtonAction, { icon: "calendar", onClick: onToday, disabled: itIsDisabledToday }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--ok", children: jsxRuntimeExports.jsx(RlsButton, { type: "gradient", onClick: onSelect, children: labels.dateActionSelect }) })] }) }))] }));
|
|
3551
|
+
}
|
|
3552
|
+
|
|
3553
|
+
function RlsFieldDate({ children, date, disabled: disabledProps, formControl, format, identifier, maxDate, minDate, msgErrorDisabled, onValue, placeholder, readOnly, rlsTheme, value: valueInitial }) {
|
|
3554
|
+
const today = useRef(new Date()); // Initial current date in component
|
|
3555
|
+
const [value, setValue] = useState(formControl?.value ?? valueInitial);
|
|
3556
|
+
const [modalIsVisible, setModalIsVisible] = useState(false);
|
|
3557
|
+
const disabled = useMemo(() => {
|
|
3558
|
+
return formControl?.disabled || disabledProps;
|
|
3559
|
+
}, [formControl?.disabled, disabledProps]);
|
|
3560
|
+
const className = useMemo(() => {
|
|
3561
|
+
return renderClassStatus('rls-field-box', {
|
|
3562
|
+
disabled,
|
|
3563
|
+
readonly: readOnly
|
|
3564
|
+
});
|
|
3565
|
+
}, [disabled, readOnly]);
|
|
3566
|
+
const dateValue = useMemo(() => {
|
|
3567
|
+
return formControl ? formControl.value : value;
|
|
3568
|
+
}, [formControl?.value, value]);
|
|
3569
|
+
const status = useMemo(() => {
|
|
3570
|
+
return {
|
|
3571
|
+
icon: dateValue ? 'trash-2' : 'calendar',
|
|
3572
|
+
label: dateValue
|
|
3573
|
+
? dateFormatTemplate(dateValue, format ?? DATE_FORMAT)
|
|
3574
|
+
: ''
|
|
3575
|
+
};
|
|
3576
|
+
}, [dateValue, format]);
|
|
3577
|
+
useEffect(() => {
|
|
3578
|
+
const dateSecure = verifyDateRange({
|
|
3579
|
+
date: formControl?.value ?? date ?? today.current,
|
|
3580
|
+
minDate,
|
|
3581
|
+
maxDate
|
|
3582
|
+
});
|
|
3583
|
+
setValue(dateSecure);
|
|
3584
|
+
formControl?.setValue(dateSecure);
|
|
3585
|
+
}, []);
|
|
3586
|
+
const onClickInput = useCallback(() => {
|
|
3587
|
+
if (!readOnly) {
|
|
3588
|
+
setModalIsVisible(true);
|
|
3589
|
+
}
|
|
3590
|
+
}, [readOnly]);
|
|
3591
|
+
const onChange = useCallback((value) => {
|
|
3592
|
+
setValue(value);
|
|
3593
|
+
onValue?.(value);
|
|
3594
|
+
}, [onValue]);
|
|
3595
|
+
const onClickAction = useCallback(() => {
|
|
3596
|
+
if (dateValue) {
|
|
3597
|
+
formControl?.setValue(valueInitial);
|
|
3598
|
+
formControl?.touch();
|
|
3599
|
+
onChange(valueInitial);
|
|
3600
|
+
}
|
|
3601
|
+
else {
|
|
3602
|
+
setModalIsVisible(true);
|
|
3603
|
+
}
|
|
3604
|
+
}, [dateValue, formControl, valueInitial, onChange]);
|
|
3605
|
+
const onListener = useCallback(({ event, value }) => {
|
|
3606
|
+
if (event !== PickerListenerEvent.Cancel) {
|
|
3607
|
+
onChange(value);
|
|
3608
|
+
}
|
|
3609
|
+
formControl?.touch();
|
|
3610
|
+
setModalIsVisible(false);
|
|
3611
|
+
}, [formControl, onChange]);
|
|
3612
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: "rls-field-date", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children && jsxRuntimeExports.jsx("span", { 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-date__control", type: "text", value: status.label, readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), !readOnly && (jsxRuntimeExports.jsx(RlsButtonIcon, { icon: status.icon, onClick: onClickAction, disabled: disabled }))] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }), jsxRuntimeExports.jsx(RlsModal, { className: "rls-field-date-modal", visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntimeExports.jsx(RlsPickerDate, { formControl: formControl, date: date, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: onListener }) })] }));
|
|
3613
|
+
}
|
|
3614
|
+
|
|
3615
|
+
function rangeFormatTemplate({ maxDate, minDate }) {
|
|
3616
|
+
const minFormat = dateFormatTemplate(minDate, DATE_RANGE_FORMAT);
|
|
3617
|
+
const maxFormat = dateFormatTemplate(maxDate, DATE_RANGE_FORMAT);
|
|
3618
|
+
return `${minFormat} - ${maxFormat}`;
|
|
3619
|
+
}
|
|
3620
|
+
|
|
3621
|
+
function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl, maxDate, minDate, onListener, rlsTheme }) {
|
|
3622
|
+
const _date = useMemo(() => normalizeMinTime(datePicker ?? new Date()), [datePicker]);
|
|
3623
|
+
const _range = useMemo(() => formControl?.value ?? DateRange.now(), [formControl?.value]);
|
|
3624
|
+
const yearControl = useReactControl(_date.getFullYear());
|
|
3625
|
+
const monthControl = useReactControl(_date.getMonth());
|
|
3626
|
+
const rangeControl = useReactControl(_range);
|
|
3627
|
+
const [visibility, setVisibility] = useState('DAY');
|
|
3628
|
+
const [labels, setLabels] = useState({
|
|
3629
|
+
dateActionCancel: reactI18n('dateActionCancel'),
|
|
3630
|
+
dateActionSelect: reactI18n('dateActionSelect')
|
|
3631
|
+
});
|
|
3632
|
+
const value = useMemo(() => {
|
|
3633
|
+
return rangeControl.value ?? _range;
|
|
3634
|
+
}, [rangeControl.value, _range]);
|
|
3635
|
+
const date = useMemo(() => {
|
|
3636
|
+
let value = _date;
|
|
3637
|
+
if (valueIsDefined(yearControl.value)) {
|
|
3638
|
+
value = assignYearInDate(value, yearControl.value);
|
|
3639
|
+
}
|
|
3640
|
+
if (valueIsDefined(monthControl.value)) {
|
|
3641
|
+
value = assignMonthInDate(value, monthControl.value);
|
|
3613
3642
|
}
|
|
3643
|
+
return value;
|
|
3644
|
+
}, [_date, yearControl.value, monthControl.value]);
|
|
3645
|
+
const classNameComponent = useMemo(() => {
|
|
3646
|
+
return renderClassStatus('rls-picker-date-range__component', {
|
|
3647
|
+
day: visibility === 'DAY',
|
|
3648
|
+
month: visibility === 'MONTH',
|
|
3649
|
+
year: visibility === 'YEAR'
|
|
3650
|
+
});
|
|
3651
|
+
}, [visibility]);
|
|
3652
|
+
const classNameFooter = useMemo(() => {
|
|
3653
|
+
return renderClassStatus('rls-picker-date-range__footer', { automatic });
|
|
3654
|
+
}, [automatic]);
|
|
3655
|
+
const title = useMemo(() => rangeFormatTemplate(value), [value]);
|
|
3656
|
+
useEffect(() => {
|
|
3657
|
+
return i18nSubscribe(() => {
|
|
3658
|
+
setLabels({
|
|
3659
|
+
dateActionCancel: reactI18n('dateActionCancel'),
|
|
3660
|
+
dateActionSelect: reactI18n('dateActionSelect')
|
|
3661
|
+
});
|
|
3662
|
+
});
|
|
3614
3663
|
}, []);
|
|
3615
|
-
|
|
3616
|
-
|
|
3664
|
+
useEffect(() => {
|
|
3665
|
+
setVisibility('DAY');
|
|
3666
|
+
}, [rangeControl.value]);
|
|
3667
|
+
const onVisibilityDay = useCallback(() => {
|
|
3668
|
+
setVisibility('DAY');
|
|
3617
3669
|
}, []);
|
|
3618
|
-
const
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
if (normalized) {
|
|
3622
|
-
setHexInput(normalized);
|
|
3670
|
+
const onVisibilityTitle = useCallback((type) => {
|
|
3671
|
+
if (type === 'month') {
|
|
3672
|
+
setVisibility('MONTH');
|
|
3623
3673
|
}
|
|
3624
3674
|
else {
|
|
3625
|
-
|
|
3675
|
+
setVisibility('YEAR');
|
|
3626
3676
|
}
|
|
3627
|
-
});
|
|
3628
|
-
const onHexKeyDown = useCallback((event) => {
|
|
3629
|
-
event.key === 'Enter' && onHexBlur();
|
|
3630
|
-
}, [onHexBlur]);
|
|
3631
|
-
const onHexInputChange = useCallback((event) => onHexChange(event.target.value ? `#${event.target.value}` : ''), [onHexChange]);
|
|
3677
|
+
}, []);
|
|
3632
3678
|
const onCancel = useCallback(() => {
|
|
3633
3679
|
onListener?.({ event: PickerListenerEvent.Cancel });
|
|
3634
3680
|
}, [onListener]);
|
|
3635
3681
|
const onSelect = useCallback(() => {
|
|
3636
|
-
formControl?.setValue(
|
|
3637
|
-
onListener?.({ event: PickerListenerEvent.Select, value
|
|
3638
|
-
}, [formControl,
|
|
3639
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-
|
|
3640
|
-
left: indicatorPosition.left,
|
|
3641
|
-
top: indicatorPosition.top
|
|
3642
|
-
}, children: jsxRuntimeExports.jsx("div", { className: "rls-picker-color__indicator__circle", style: { backgroundColor: hexColor } }) }) }) }), jsxRuntimeExports.jsxs("div", { className: "rls-picker-color__controls", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-color__slider", children: jsxRuntimeExports.jsx("div", { ref: hueRef, className: "rls-picker-color__slider__track", style: hueSliderStyle, "data-slider": "hue", onMouseDown: onMouseDown, onMouseMove: onMouseMove, onMouseUp: onInactiveSelection, onMouseLeave: onInactiveSelection, onTouchStart: onTouchStart, onTouchMove: onTouchMove, onTouchEnd: onInactiveSelection, children: jsxRuntimeExports.jsx("div", { className: "rls-picker-color__slider__thumb", style: hueIndicatorStyle }) }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-color__slider", children: jsxRuntimeExports.jsx("div", { ref: alphaRef, className: "rls-picker-color__slider__track rls-picker-color__slider__track--alpha", style: alphaSliderStyle, "data-slider": "alpha", onMouseDown: onMouseDown, onMouseMove: onMouseMove, onMouseUp: onInactiveSelection, onMouseLeave: onInactiveSelection, onTouchStart: onTouchStart, onTouchMove: onTouchMove, onTouchEnd: onInactiveSelection, children: jsxRuntimeExports.jsx("div", { className: "rls-picker-color__slider__thumb", style: alphaIndicatorStyle }) }) })] }), jsxRuntimeExports.jsx("div", { className: "rls-picker-color__footer", children: jsxRuntimeExports.jsxs("div", { className: "rls-picker-color__hex", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-color__hex__swatch", style: { backgroundColor: hexColor } }), jsxRuntimeExports.jsx("span", { className: "rls-picker-color__hex__prefix", children: "#" }), jsxRuntimeExports.jsx("input", { className: "rls-picker-color__hex__input", type: "text", maxLength: 6, value: hexValue, onChange: onHexInputChange, onFocus: onHexFocus, onBlur: onHexBlur, onKeyDown: onHexKeyDown })] }) }), jsxRuntimeExports.jsxs("div", { className: "rls-picker-color__actions", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-color__actions--cancel", children: jsxRuntimeExports.jsx(RlsButton, { type: "flat", onClick: onCancel, children: labels.colorActionCancel }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-color__actions--ok", children: jsxRuntimeExports.jsx(RlsButton, { type: "gradient", onClick: onSelect, children: labels.colorActionSelect }) })] })] }));
|
|
3682
|
+
formControl?.setValue(value);
|
|
3683
|
+
onListener?.({ event: PickerListenerEvent.Select, value });
|
|
3684
|
+
}, [formControl, value, onListener]);
|
|
3685
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range__header", children: [jsxRuntimeExports.jsx(RlsPickerSelectorTitle, { monthControl: monthControl, yearControl: yearControl, date: date, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: visibility === 'MONTH' ? 'year' : 'month', onClick: onVisibilityTitle }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__title", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityDay, children: title }) })] }), jsxRuntimeExports.jsxs("div", { className: classNameComponent, children: [jsxRuntimeExports.jsx(RlsPickerDayRange, { formControl: rangeControl, date: date, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsxRuntimeExports.jsx(RlsPickerMonth, { formControl: monthControl, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsxRuntimeExports.jsx(RlsPickerYear, { formControl: yearControl, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), jsxRuntimeExports.jsx("div", { className: classNameFooter, children: jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range__actions", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__actions--cancel", children: jsxRuntimeExports.jsx(RlsButton, { type: "flat", onClick: onCancel, children: labels.dateActionCancel }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__actions--ok", children: jsxRuntimeExports.jsx(RlsButton, { type: "gradient", onClick: onSelect, children: labels.dateActionSelect }) })] }) })] }));
|
|
3643
3686
|
}
|
|
3644
3687
|
|
|
3645
|
-
function
|
|
3646
|
-
const
|
|
3688
|
+
function RlsFieldDateRange({ children, date, disabled: disabledProps, formControl, identifier, maxDate, minDate, msgErrorDisabled, onValue, placeholder, readOnly, rlsTheme, value: valueInitial }) {
|
|
3689
|
+
const currentDate = useMemo(() => date ?? new Date(), [date]);
|
|
3690
|
+
const [value, setValue] = useState(formControl?.value || valueInitial);
|
|
3647
3691
|
const [modalIsVisible, setModalIsVisible] = useState(false);
|
|
3648
|
-
const colorValue = useMemo(() => {
|
|
3649
|
-
return formControl ? formControl.value : value;
|
|
3650
|
-
}, [formControl?.value, value]);
|
|
3651
3692
|
const disabled = useMemo(() => {
|
|
3652
3693
|
return formControl?.disabled || disabledProps;
|
|
3653
3694
|
}, [formControl?.disabled, disabledProps]);
|
|
@@ -3657,19 +3698,26 @@ function RlsFieldColor({ children, color, disabled: disabledProps, formControl,
|
|
|
3657
3698
|
readonly: readOnly
|
|
3658
3699
|
});
|
|
3659
3700
|
}, [disabled, readOnly]);
|
|
3660
|
-
const
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3701
|
+
const dateRangeValue = useMemo(() => {
|
|
3702
|
+
return formControl ? formControl.value : value;
|
|
3703
|
+
}, [formControl?.value, value]);
|
|
3704
|
+
const status = useMemo(() => {
|
|
3705
|
+
return {
|
|
3706
|
+
icon: dateRangeValue ? 'trash-2' : 'calendar',
|
|
3707
|
+
valueInput: dateRangeValue ? rangeFormatTemplate(dateRangeValue) : ''
|
|
3708
|
+
};
|
|
3709
|
+
}, [dateRangeValue]);
|
|
3664
3710
|
const onClickInput = useCallback(() => {
|
|
3665
|
-
!readOnly
|
|
3711
|
+
if (!readOnly) {
|
|
3712
|
+
setModalIsVisible(true);
|
|
3713
|
+
}
|
|
3666
3714
|
}, [readOnly]);
|
|
3667
3715
|
const onChange = useCallback((value) => {
|
|
3668
3716
|
setValue(value);
|
|
3669
3717
|
onValue?.(value);
|
|
3670
3718
|
}, [onValue]);
|
|
3671
3719
|
const onClickAction = useCallback(() => {
|
|
3672
|
-
if (
|
|
3720
|
+
if (dateRangeValue) {
|
|
3673
3721
|
formControl?.setValue(valueInitial);
|
|
3674
3722
|
formControl?.touch();
|
|
3675
3723
|
onChange(valueInitial);
|
|
@@ -3677,13 +3725,15 @@ function RlsFieldColor({ children, color, disabled: disabledProps, formControl,
|
|
|
3677
3725
|
else {
|
|
3678
3726
|
setModalIsVisible(true);
|
|
3679
3727
|
}
|
|
3680
|
-
}, [
|
|
3728
|
+
}, [dateRangeValue, formControl, valueInitial, onChange]);
|
|
3681
3729
|
const onListener = useCallback(({ event, value }) => {
|
|
3682
|
-
event !== PickerListenerEvent.Cancel
|
|
3730
|
+
if (event !== PickerListenerEvent.Cancel) {
|
|
3731
|
+
onChange(value);
|
|
3732
|
+
}
|
|
3683
3733
|
formControl?.touch();
|
|
3684
3734
|
setModalIsVisible(false);
|
|
3685
3735
|
}, [formControl, onChange]);
|
|
3686
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: "rls-field-
|
|
3736
|
+
return (jsxRuntimeExports.jsxs("div", { id: identifier, className: "rls-field-date-range", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children && jsxRuntimeExports.jsx("span", { 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-date-range__control", type: "text", value: status.valueInput, readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), !readOnly && (jsxRuntimeExports.jsx(RlsButtonIcon, { icon: status.icon, onClick: onClickAction, disabled: disabled }))] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }), jsxRuntimeExports.jsx(RlsModal, { className: "rls-field-date-range-modal", visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntimeExports.jsx(RlsPickerDateRange, { formControl: formControl, date: currentDate, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: onListener }) })] }));
|
|
3687
3737
|
}
|
|
3688
3738
|
|
|
3689
3739
|
const MAX_LIST_HEIGHT_REM = 90;
|
|
@@ -3724,8 +3774,9 @@ function useFieldList(props) {
|
|
|
3724
3774
|
const [selected, setSelected] = useState([]);
|
|
3725
3775
|
useEffect(() => {
|
|
3726
3776
|
function onCloseSuggestions({ target }) {
|
|
3727
|
-
!refContent?.current?.contains(target)
|
|
3777
|
+
if (!refContent?.current?.contains(target)) {
|
|
3728
3778
|
setState((state) => ({ ...state, listIsVisible: false }));
|
|
3779
|
+
}
|
|
3729
3780
|
}
|
|
3730
3781
|
document.addEventListener('click', onCloseSuggestions);
|
|
3731
3782
|
return () => {
|
|
@@ -3800,7 +3851,9 @@ function useFieldList(props) {
|
|
|
3800
3851
|
}, [selected, formControl, props.onValue]);
|
|
3801
3852
|
const onKeydownElement = useCallback((element) => {
|
|
3802
3853
|
return (event) => {
|
|
3803
|
-
event.code === 'Enter'
|
|
3854
|
+
if (event.code === 'Enter') {
|
|
3855
|
+
toggleElement(element);
|
|
3856
|
+
}
|
|
3804
3857
|
};
|
|
3805
3858
|
}, [toggleElement]);
|
|
3806
3859
|
return {
|
|
@@ -3849,6 +3902,141 @@ function RlsFieldList(props) {
|
|
|
3849
3902
|
return jsxRuntimeExports.jsx(RlsFieldListInner, { ...props, render: render, fieldList: fieldList });
|
|
3850
3903
|
}
|
|
3851
3904
|
|
|
3905
|
+
function useFieldSelect(props) {
|
|
3906
|
+
const controller = useListController(props);
|
|
3907
|
+
useEffect(() => {
|
|
3908
|
+
if (props.disabled) {
|
|
3909
|
+
controller.setState({ focused: false });
|
|
3910
|
+
}
|
|
3911
|
+
}, [props.disabled]);
|
|
3912
|
+
const onFocusInput = useCallback(() => {
|
|
3913
|
+
controller.setState({ focused: true });
|
|
3914
|
+
}, [controller.setState]);
|
|
3915
|
+
const onBlurInput = useCallback(() => {
|
|
3916
|
+
controller.setState({ focused: false });
|
|
3917
|
+
}, [controller.setState]);
|
|
3918
|
+
const onClickInput = useCallback(() => {
|
|
3919
|
+
if (!props.readOnly) {
|
|
3920
|
+
controller.setState({ listIsVisible: true });
|
|
3921
|
+
}
|
|
3922
|
+
}, [controller.setState, props.readOnly]);
|
|
3923
|
+
const onKeydownInput = useCallback((event) => {
|
|
3924
|
+
switch (event.code) {
|
|
3925
|
+
case 'Space':
|
|
3926
|
+
case 'Enter':
|
|
3927
|
+
controller.setState({ listIsVisible: true });
|
|
3928
|
+
break;
|
|
3929
|
+
case 'Escape':
|
|
3930
|
+
case 'Tab':
|
|
3931
|
+
controller.setState({ listIsVisible: false });
|
|
3932
|
+
break;
|
|
3933
|
+
default:
|
|
3934
|
+
controller.navigationInput(event);
|
|
3935
|
+
break;
|
|
3936
|
+
}
|
|
3937
|
+
}, [controller.setState, controller.navigationInput]);
|
|
3938
|
+
const onClickAction = useCallback(() => {
|
|
3939
|
+
const removable = !props.unremovable && !!controller.value;
|
|
3940
|
+
if (removable) {
|
|
3941
|
+
controller.setState({ listIsVisible: false });
|
|
3942
|
+
controller.setFormValue(undefined);
|
|
3943
|
+
props.onValue?.(props.value);
|
|
3944
|
+
}
|
|
3945
|
+
else {
|
|
3946
|
+
const listIsVisible = !controller.listIsVisible;
|
|
3947
|
+
controller.setState({ listIsVisible });
|
|
3948
|
+
if (listIsVisible) {
|
|
3949
|
+
controller.refInput?.current?.focus();
|
|
3950
|
+
}
|
|
3951
|
+
}
|
|
3952
|
+
}, [
|
|
3953
|
+
controller.listIsVisible,
|
|
3954
|
+
controller.value,
|
|
3955
|
+
controller.setState,
|
|
3956
|
+
controller.setFormValue,
|
|
3957
|
+
props.unremovable,
|
|
3958
|
+
props.onValue
|
|
3959
|
+
]);
|
|
3960
|
+
const onClickBackdrop = useCallback(() => {
|
|
3961
|
+
controller.setState({ listIsVisible: false });
|
|
3962
|
+
}, [controller.setState]);
|
|
3963
|
+
const onChange = useCallback((element) => {
|
|
3964
|
+
if (!props.disabled) {
|
|
3965
|
+
controller.refInput?.current?.focus();
|
|
3966
|
+
}
|
|
3967
|
+
if (props.onSelect) {
|
|
3968
|
+
controller.setState({ listIsVisible: false });
|
|
3969
|
+
if (element.value) {
|
|
3970
|
+
props.onSelect(element.value);
|
|
3971
|
+
}
|
|
3972
|
+
}
|
|
3973
|
+
else {
|
|
3974
|
+
controller.setFormValue(element);
|
|
3975
|
+
controller.setState({ listIsVisible: false });
|
|
3976
|
+
}
|
|
3977
|
+
props.onValue?.(element.value);
|
|
3978
|
+
}, [
|
|
3979
|
+
controller.setState,
|
|
3980
|
+
controller.setFormValue,
|
|
3981
|
+
props.onSelect,
|
|
3982
|
+
props.onValue,
|
|
3983
|
+
props.disabled
|
|
3984
|
+
]);
|
|
3985
|
+
const onClickElement = useCallback((element) => {
|
|
3986
|
+
return () => {
|
|
3987
|
+
onChange(element);
|
|
3988
|
+
};
|
|
3989
|
+
}, [onChange]);
|
|
3990
|
+
const onKeydownElement = useCallback((element) => {
|
|
3991
|
+
return (event) => {
|
|
3992
|
+
if (event.code === 'Enter') {
|
|
3993
|
+
onChange(element);
|
|
3994
|
+
}
|
|
3995
|
+
else {
|
|
3996
|
+
controller.navigationElement(event);
|
|
3997
|
+
}
|
|
3998
|
+
};
|
|
3999
|
+
}, [onChange, controller.navigationElement]);
|
|
4000
|
+
return {
|
|
4001
|
+
...controller,
|
|
4002
|
+
onBlurInput,
|
|
4003
|
+
onClickAction,
|
|
4004
|
+
onClickBackdrop,
|
|
4005
|
+
onClickInput,
|
|
4006
|
+
onClickElement,
|
|
4007
|
+
onFocusInput,
|
|
4008
|
+
onKeydownElement,
|
|
4009
|
+
onKeydownInput
|
|
4010
|
+
};
|
|
4011
|
+
}
|
|
4012
|
+
|
|
4013
|
+
function RlsFieldSelectTemplate(props) {
|
|
4014
|
+
const select = useFieldSelect(props);
|
|
4015
|
+
const { render, suggestions, action, children, formControl, msgErrorDisabled, placeholder, rlsTheme, unremovable } = props;
|
|
4016
|
+
const disabled = useMemo(() => {
|
|
4017
|
+
return formControl?.disabled || props.disabled;
|
|
4018
|
+
}, [formControl?.disabled, props.disabled]);
|
|
4019
|
+
const className = useMemo(() => {
|
|
4020
|
+
return renderClassStatus('rls-field-box', {
|
|
4021
|
+
focused: select.focused && !disabled,
|
|
4022
|
+
error: formControl?.wrong,
|
|
4023
|
+
disabled: disabled,
|
|
4024
|
+
readonly: props.readOnly
|
|
4025
|
+
}, `rls-field-list rls-field-select ${props.className ?? ''}`);
|
|
4026
|
+
}, [
|
|
4027
|
+
formControl?.wrong,
|
|
4028
|
+
select.focused,
|
|
4029
|
+
props.className,
|
|
4030
|
+
props.readOnly,
|
|
4031
|
+
disabled
|
|
4032
|
+
]);
|
|
4033
|
+
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: select.refContent, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("span", { 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.refInput, 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 }), !props.readOnly && (jsxRuntimeExports.jsx(RlsButtonIcon, { icon: !unremovable && !!select.value ? 'close' : 'arrow-ios-down', onClick: select.onClickAction, disabled: disabled }))] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })), jsxRuntimeExports.jsx(RlsFieldListSuggestions, { elements: suggestions, visible: select.listIsVisible, action: action, disabled: disabled, higher: select.higher, render: render, refList: select.refList, onClickElement: select.onClickElement, onKeydownElement: select.onKeydownElement, onClickBackdrop: select.onClickBackdrop })] }));
|
|
4034
|
+
}
|
|
4035
|
+
function RlsFieldSelect(props) {
|
|
4036
|
+
const render = useCallback((element) => (jsxRuntimeExports.jsx(RlsBallot, { className: "rls-field-list__ballot", subtitle: element.subtitle, img: element.img, initials: element.initials, children: jsxRuntimeExports.jsx("span", { children: element.title }) })), []);
|
|
4037
|
+
return jsxRuntimeExports.jsx(RlsFieldSelectTemplate, { ...props, render: render });
|
|
4038
|
+
}
|
|
4039
|
+
|
|
3852
4040
|
function RlsFormNavigation({ children, className, controller, visible, rlsTheme }) {
|
|
3853
4041
|
const classNameForm = useMemo(() => {
|
|
3854
4042
|
return renderClassStatus('rls-form-navigation', { visible: controller?.visible ?? visible }, className);
|
|
@@ -3953,7 +4141,7 @@ function useResize(props) {
|
|
|
3953
4141
|
const dimension = useRef({ height: 0, width: 0 });
|
|
3954
4142
|
const observer = useCallback((entries) => {
|
|
3955
4143
|
const { height, width } = entries[0].contentRect;
|
|
3956
|
-
onResize
|
|
4144
|
+
if (onResize) {
|
|
3957
4145
|
onResize({
|
|
3958
4146
|
current: dimension.current,
|
|
3959
4147
|
dimension: {
|
|
@@ -3961,6 +4149,7 @@ function useResize(props) {
|
|
|
3961
4149
|
width
|
|
3962
4150
|
}
|
|
3963
4151
|
});
|
|
4152
|
+
}
|
|
3964
4153
|
dimension.current = { height, width };
|
|
3965
4154
|
}, []);
|
|
3966
4155
|
useEffect(() => {
|
|
@@ -4252,7 +4441,9 @@ function useImageEditorController(options) {
|
|
|
4252
4441
|
}, []);
|
|
4253
4442
|
const onEditorValue = useCallback((image) => {
|
|
4254
4443
|
setSrcEditor(undefined);
|
|
4255
|
-
|
|
4444
|
+
if (options.onValue) {
|
|
4445
|
+
options.onValue(image);
|
|
4446
|
+
}
|
|
4256
4447
|
}, [options.onValue]);
|
|
4257
4448
|
const onCancel = useCallback(() => {
|
|
4258
4449
|
setSrcEditor(undefined);
|
|
@@ -4271,7 +4462,9 @@ function useImageEditorController(options) {
|
|
|
4271
4462
|
onCancel
|
|
4272
4463
|
]);
|
|
4273
4464
|
const onImageChooser = useCallback(() => {
|
|
4274
|
-
!options.disabled
|
|
4465
|
+
if (!options.disabled) {
|
|
4466
|
+
refInput.current.click();
|
|
4467
|
+
}
|
|
4275
4468
|
}, [options.disabled]);
|
|
4276
4469
|
return { onImageChooser, RlsImageEditorChooser };
|
|
4277
4470
|
}
|
|
@@ -4284,7 +4477,9 @@ function RlsImageChooser(props) {
|
|
|
4284
4477
|
}, [props.onValue]);
|
|
4285
4478
|
const controller = useImageEditorController({ ...props, onValue });
|
|
4286
4479
|
useEffect(() => {
|
|
4287
|
-
|
|
4480
|
+
if (props.src) {
|
|
4481
|
+
setSrc(props.src);
|
|
4482
|
+
}
|
|
4288
4483
|
}, [props.src]);
|
|
4289
4484
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-image-chooser", children: [jsxRuntimeExports.jsx("div", { className: "rls-image-chooser__avatar", onClick: controller.onImageChooser, children: src && jsxRuntimeExports.jsx("img", { src: src }) }), controller.RlsImageEditorChooser] }));
|
|
4290
4485
|
}
|
|
@@ -4294,12 +4489,68 @@ function RlsModalSheet({ autoclose, children, className, controller, onAutoClose
|
|
|
4294
4489
|
return renderClassStatus('rls-modal-sheet', { visible: controller?.visible ?? visible }, className);
|
|
4295
4490
|
}, [className, visible, controller?.visible]);
|
|
4296
4491
|
const onClickBackdrop = useCallback(() => {
|
|
4297
|
-
|
|
4492
|
+
if (autoclose) {
|
|
4493
|
+
controller?.close();
|
|
4494
|
+
}
|
|
4298
4495
|
onAutoClose?.();
|
|
4299
4496
|
}, [autoclose, controller, onAutoClose]);
|
|
4300
4497
|
return ReactDOM.createPortal(jsxRuntimeExports.jsxs("div", { className: classNameModal, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-modal-sheet__component", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-modal-sheet__backdrop", onClick: onClickBackdrop })] }), document.body);
|
|
4301
4498
|
}
|
|
4302
4499
|
|
|
4500
|
+
const DURATION_ANIMATION$1 = 240;
|
|
4501
|
+
const DURATION_DEFAULT = 4000;
|
|
4502
|
+
let _id = 0;
|
|
4503
|
+
function generateId() {
|
|
4504
|
+
return `rls-notification-${++_id}`;
|
|
4505
|
+
}
|
|
4506
|
+
function RlsNotification({ content, icon, onClose, rlsTheme, title, visible }) {
|
|
4507
|
+
const className = useMemo(() => {
|
|
4508
|
+
return renderClassStatus('rls-notification', { visible });
|
|
4509
|
+
}, [visible]);
|
|
4510
|
+
return (jsxRuntimeExports.jsxs("div", { className: className, "rls-theme": rlsTheme, children: [icon && (jsxRuntimeExports.jsx("div", { className: "rls-notification__avatar", children: jsxRuntimeExports.jsx(RlsIcon, { value: icon }) })), jsxRuntimeExports.jsxs("div", { className: "rls-notification__component", children: [jsxRuntimeExports.jsxs("div", { className: "rls-notification__header", children: [jsxRuntimeExports.jsx("div", { className: "rls-notification__title", children: title }), jsxRuntimeExports.jsx("button", { onClick: onClose, children: jsxRuntimeExports.jsx(RlsIcon, { value: "close" }) })] }), jsxRuntimeExports.jsx("div", { className: "rls-notification__content", children: content })] })] }));
|
|
4511
|
+
}
|
|
4512
|
+
function useNotifications() {
|
|
4513
|
+
const [notifications, setNotifications] = useState([]);
|
|
4514
|
+
const timersRef = useRef(new Map());
|
|
4515
|
+
useEffect(() => {
|
|
4516
|
+
const timers = timersRef.current;
|
|
4517
|
+
return () => {
|
|
4518
|
+
timers.forEach((timer) => clearTimeout(timer));
|
|
4519
|
+
timers.clear();
|
|
4520
|
+
};
|
|
4521
|
+
}, []);
|
|
4522
|
+
const remove = useCallback((id) => {
|
|
4523
|
+
const timer = timersRef.current.get(id);
|
|
4524
|
+
if (timer) {
|
|
4525
|
+
clearTimeout(timer);
|
|
4526
|
+
timersRef.current.delete(id);
|
|
4527
|
+
}
|
|
4528
|
+
setNotifications((notifications) => notifications.map((notification) => notification.id === id
|
|
4529
|
+
? { ...notification, visible: false }
|
|
4530
|
+
: notification));
|
|
4531
|
+
setTimeout(() => {
|
|
4532
|
+
setNotifications((notifications) => notifications.filter((notification) => notification.id !== id));
|
|
4533
|
+
}, DURATION_ANIMATION$1);
|
|
4534
|
+
}, []);
|
|
4535
|
+
const notify = useCallback((config) => {
|
|
4536
|
+
const id = generateId();
|
|
4537
|
+
const duration = config.duration ?? DURATION_DEFAULT;
|
|
4538
|
+
setNotifications((notifications) => [
|
|
4539
|
+
...notifications,
|
|
4540
|
+
{ id, config, visible: true }
|
|
4541
|
+
]);
|
|
4542
|
+
const timer = setTimeout(() => {
|
|
4543
|
+
remove(id);
|
|
4544
|
+
}, duration);
|
|
4545
|
+
timersRef.current.set(id, timer);
|
|
4546
|
+
}, [remove]);
|
|
4547
|
+
const RlsNotifications = ReactDOM.createPortal(jsxRuntimeExports.jsx("div", { className: "rls-notifications", children: notifications.map((notification) => (jsxRuntimeExports.jsx(RlsNotification, { ...notification.config, visible: notification.visible, onClose: () => remove(notification.id) }, notification.id))) }), document.body);
|
|
4548
|
+
return {
|
|
4549
|
+
RlsNotifications,
|
|
4550
|
+
notify
|
|
4551
|
+
};
|
|
4552
|
+
}
|
|
4553
|
+
|
|
4303
4554
|
const DURATION_ANIMATION = 240;
|
|
4304
4555
|
const DURATION_CHAR = 75;
|
|
4305
4556
|
const DURATION_MAX = 9000;
|
|
@@ -4329,7 +4580,9 @@ function useSnackbar() {
|
|
|
4329
4580
|
visible: false
|
|
4330
4581
|
});
|
|
4331
4582
|
const onClose = useCallback(() => {
|
|
4332
|
-
|
|
4583
|
+
if (timeoutId.current) {
|
|
4584
|
+
clearTimeout(timeoutId.current);
|
|
4585
|
+
}
|
|
4333
4586
|
timeoutId.current = undefined;
|
|
4334
4587
|
setState((state) => ({ ...state, visible: false }));
|
|
4335
4588
|
}, []);
|
|
@@ -4363,17 +4616,17 @@ function useSnackbar() {
|
|
|
4363
4616
|
};
|
|
4364
4617
|
}
|
|
4365
4618
|
|
|
4366
|
-
const RlsContext = createContext(
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
});
|
|
4619
|
+
const RlsContext = createContext(null);
|
|
4620
|
+
function useRlsContext() {
|
|
4621
|
+
const state = useContext(RlsContext);
|
|
4622
|
+
if (!state) {
|
|
4623
|
+
throw new Error('RlsApplication not wrapped in Project');
|
|
4624
|
+
}
|
|
4625
|
+
return state;
|
|
4626
|
+
}
|
|
4375
4627
|
function RlsApplication({ children }) {
|
|
4376
4628
|
const { RlsConfirmation, confirmation } = useConfirmation();
|
|
4629
|
+
const { RlsNotifications, notify } = useNotifications();
|
|
4377
4630
|
const { RlsSnackbar, snackbar } = useSnackbar();
|
|
4378
4631
|
const [navbarInApp, setNavbarInApp] = useState(false);
|
|
4379
4632
|
const [navbarIsCondense, setNavbarIsCondense] = useState(false);
|
|
@@ -4387,11 +4640,12 @@ function RlsApplication({ children }) {
|
|
|
4387
4640
|
}, [appIsMobile, navbarInApp, navbarIsCondense]);
|
|
4388
4641
|
return (jsxRuntimeExports.jsxs(RlsContext, { value: {
|
|
4389
4642
|
confirmation,
|
|
4643
|
+
notify,
|
|
4390
4644
|
snackbar,
|
|
4391
4645
|
setIsMobile,
|
|
4392
4646
|
setNavbarInApp,
|
|
4393
4647
|
setNavbarIsCondense
|
|
4394
|
-
}, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children, RlsSnackbar] }), RlsConfirmation] }));
|
|
4648
|
+
}, children: [jsxRuntimeExports.jsxs("div", { className: className, children: [children, RlsSnackbar] }), RlsNotifications, RlsConfirmation] }));
|
|
4395
4649
|
}
|
|
4396
4650
|
|
|
4397
4651
|
const DEFAULT_DESIGN_SYSTEM = 'bordered';
|
|
@@ -4443,9 +4697,9 @@ function useDropdownController(effect = '0% 0%') {
|
|
|
4443
4697
|
const openWithEvent = useCallback((event) => {
|
|
4444
4698
|
const rectContent = component.current.getBoundingClientRect();
|
|
4445
4699
|
const rectElement = event.target.getBoundingClientRect();
|
|
4446
|
-
let positionX
|
|
4447
|
-
let positionY
|
|
4448
|
-
let effect
|
|
4700
|
+
let positionX;
|
|
4701
|
+
let positionY;
|
|
4702
|
+
let effect;
|
|
4449
4703
|
let transform = 0;
|
|
4450
4704
|
const elementX = rectElement.x + rectElement.width / 2;
|
|
4451
4705
|
const elementY = rectElement.y + rectElement.height / 2;
|
|
@@ -4517,5 +4771,5 @@ function usePortalController() {
|
|
|
4517
4771
|
return { close, open, visible };
|
|
4518
4772
|
}
|
|
4519
4773
|
|
|
4520
|
-
export { ConfirmationResult, DEFAULT_COLOR, RlsAccordion, RlsAlert, RlsAmount, RlsApplication, RlsAreaText, RlsAvatar, RlsBadge, RlsBallot, RlsBody, RlsBottomSheet, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonIcon, RlsButtonOption, RlsButtonProgress, RlsButtonStepper, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsConfirmation, RlsContent, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableFloating, RlsDatatableHeader, RlsDatatableRecord, RlsDatatableSubheader, RlsDatatableTitle, RlsDatatableTotals, RlsDropdown, RlsFieldArea, RlsFieldAutocomplete, RlsFieldAutocompleteTemplate, RlsFieldClock, RlsFieldColor, RlsFieldDate, RlsFieldDateRange, RlsFieldDecimal, RlsFieldFile, RlsFieldList, RlsFieldListSuggestions, RlsFieldListTemplate, RlsFieldMoney, RlsFieldNumber, RlsFieldPassword, RlsFieldPercentage, RlsFieldReadonly, RlsFieldSelect, RlsFieldSelectTemplate, RlsFieldText, RlsFormNavigation, RlsIcon, RlsImage, RlsImageChooser, RlsImageEditor, RlsInput, RlsInputCounter, RlsInputDecimal, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputPercentage, RlsInputSearch, RlsInputText, RlsLabel, RlsLabelCheckBox, RlsLabelRadioButton, RlsLabelSwitch, RlsLed, RlsMessageEmpty, RlsMessageFormError, RlsMessageIcon, RlsModal, RlsModalSheet, RlsNavbar, RlsNavbarMenu, RlsPagination, RlsPickerClock, RlsPickerColor, RlsPickerDate, RlsPickerDateRange, RlsPickerDay, RlsPickerDayRange, RlsPickerMonth, RlsPickerSelectorTitle, RlsPickerYear, RlsPoster, RlsProgressBar, RlsProgressCircular, RlsRadioButton, RlsSkeleton, RlsSkeletonText, RlsSlider, RlsSnackbar, RlsSpinner, RlsSwitch, RlsSwitchControl, RlsTabs, RlsTabularText, RlsToolbar, calculateImgDimension, generateThemePalette, hexIsValid, hexToHsl, hexToHsv, hexToRgb, hslToHex, hsvToHex, hsvToRgb, normalizeHex, rangeFormatTemplate, renderClassStatus, rgbToHex, rgbToHsl, rgbToHsv, setDesignSystem, setErrorsI18n, setThemeColor, useConfirmation, useDatatable, useDesingSystemController, useDropdownController, useFieldAutocomplete, useFieldList, useFieldSelect, useFormSingleSelectionController, useFormToggleController, useImageEditorController, useListController, usePortalController, useRelocationOnComponent, useResize, useSnackbar };
|
|
4774
|
+
export { ConfirmationResult, DEFAULT_COLOR, RlsAccordion, RlsAlert, RlsAmount, RlsApplication, RlsAreaText, RlsAvatar, RlsBadge, RlsBallot, RlsBody, RlsBottomSheet, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonIcon, RlsButtonOption, RlsButtonProgress, RlsButtonStepper, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsConfirmation, RlsContent, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableFloating, RlsDatatableHeader, RlsDatatableRecord, RlsDatatableSubheader, RlsDatatableTitle, RlsDatatableTotals, RlsDropdown, RlsFieldArea, RlsFieldAutocomplete, RlsFieldAutocompleteTemplate, RlsFieldClock, RlsFieldColor, RlsFieldDate, RlsFieldDateRange, RlsFieldDecimal, RlsFieldFile, RlsFieldList, RlsFieldListSuggestions, RlsFieldListTemplate, RlsFieldMoney, RlsFieldNumber, RlsFieldPassword, RlsFieldPercentage, RlsFieldReadonly, RlsFieldSelect, RlsFieldSelectTemplate, RlsFieldText, RlsFormNavigation, RlsIcon, RlsImage, RlsImageChooser, RlsImageEditor, RlsInput, RlsInputCounter, RlsInputDecimal, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputPercentage, RlsInputSearch, RlsInputText, RlsLabel, RlsLabelCheckBox, RlsLabelRadioButton, RlsLabelSwitch, RlsLed, RlsMessageEmpty, RlsMessageFormError, RlsMessageIcon, RlsModal, RlsModalSheet, RlsNavbar, RlsNavbarMenu, RlsPagination, RlsPickerClock, RlsPickerColor, RlsPickerDate, RlsPickerDateRange, RlsPickerDay, RlsPickerDayRange, RlsPickerMonth, RlsPickerSelectorTitle, RlsPickerYear, RlsPoster, RlsProgressBar, RlsProgressCircular, RlsRadioButton, RlsSkeleton, RlsSkeletonText, RlsSlider, RlsSnackbar, RlsSpinner, RlsSwitch, RlsSwitchControl, RlsTabs, RlsTabularText, RlsToolbar, calculateImgDimension, generateThemePalette, hexIsValid, hexToHsl, hexToHsv, hexToRgb, hslToHex, hsvToHex, hsvToRgb, normalizeHex, rangeFormatTemplate, renderClassStatus, rgbToHex, rgbToHsl, rgbToHsv, setDesignSystem, setErrorsI18n, setThemeColor, useConfirmation, useDatatable, useDesingSystemController, useDropdownController, useFieldAutocomplete, useFieldList, useFieldSelect, useFormSingleSelectionController, useFormToggleController, useImageEditorController, useListController, useNotifications, usePortalController, useRelocationOnComponent, useResize, useRlsContext, useSnackbar };
|
|
4521
4775
|
//# sourceMappingURL=index.mjs.map
|