@rolster/react-components 19.0.2 → 19.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/assets/{index-DEldF_Je.css → index-C2Gi7f6R.css} +7 -2
- package/dist/cjs/index.js +90 -67
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/assets/{index-DEldF_Je.css → index-C2Gi7f6R.css} +7 -2
- package/dist/es/index.js +90 -67
- package/dist/es/index.js.map +1 -1
- package/dist/esm/components/atoms/Input/Input.js +1 -1
- package/dist/esm/components/atoms/Input/Input.js.map +1 -1
- package/dist/esm/components/atoms/InputDecimal/InputDecimal.js +1 -1
- package/dist/esm/components/atoms/InputDecimal/InputDecimal.js.map +1 -1
- package/dist/esm/components/atoms/InputMoney/InputMoney.js +1 -1
- package/dist/esm/components/atoms/InputMoney/InputMoney.js.map +1 -1
- package/dist/esm/components/atoms/InputNumber/InputNumber.js +1 -1
- package/dist/esm/components/atoms/InputNumber/InputNumber.js.map +1 -1
- package/dist/esm/components/atoms/InputPassword/InputPassword.js +1 -1
- package/dist/esm/components/atoms/InputPassword/InputPassword.js.map +1 -1
- package/dist/esm/components/atoms/InputPercentage/InputPercentage.js +1 -1
- package/dist/esm/components/atoms/InputPercentage/InputPercentage.js.map +1 -1
- package/dist/esm/components/atoms/InputText/InputText.js +1 -1
- package/dist/esm/components/atoms/InputText/InputText.js.map +1 -1
- package/dist/esm/components/molecules/PickerDay/PickerDay.js +1 -1
- package/dist/esm/components/molecules/PickerDay/PickerDay.js.map +1 -1
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.js +1 -1
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.js.map +1 -1
- package/dist/esm/components/molecules/PickerYear/PickerYear.js +1 -1
- package/dist/esm/components/molecules/PickerYear/PickerYear.js.map +1 -1
- package/dist/esm/components/molecules/Tabs/Tabs.css +2 -2
- package/dist/esm/components/molecules/Tabs/Tabs.css.map +1 -1
- package/dist/esm/components/molecules/Tabs/Tabs.js +2 -2
- package/dist/esm/components/molecules/Tabs/Tabs.js.map +1 -1
- package/dist/esm/components/organisms/FieldClock/FieldClock.css +1 -0
- package/dist/esm/components/organisms/FieldClock/FieldClock.css.map +1 -1
- package/dist/esm/components/organisms/FieldClock/FieldClock.js +16 -13
- package/dist/esm/components/organisms/FieldClock/FieldClock.js.map +1 -1
- package/dist/esm/components/organisms/FieldDate/FieldDate.js +22 -17
- package/dist/esm/components/organisms/FieldDate/FieldDate.js.map +1 -1
- package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.js +21 -18
- package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.js.map +1 -1
- package/dist/esm/components/organisms/FormNavigation/FormNavigation.css +4 -0
- package/dist/esm/components/organisms/FormNavigation/FormNavigation.css.map +1 -1
- package/dist/esm/components/organisms/PickerClock/PickerClock.js +12 -0
- package/dist/esm/components/organisms/PickerClock/PickerClock.js.map +1 -1
- package/dist/esm/context.js +4 -4
- package/dist/esm/context.js.map +1 -1
- package/dist/esm/controllers/ListController.js +3 -3
- package/dist/esm/controllers/ListController.js.map +1 -1
- package/package.json +4 -4
|
@@ -2154,7 +2154,7 @@
|
|
|
2154
2154
|
.rls-tabs {
|
|
2155
2155
|
--pvt-background: var(--rls-app-color-100);
|
|
2156
2156
|
--pvt-border: var(--rls-app-border-1-200);
|
|
2157
|
-
--pvt-children-font-color: var(--rls-app-color-
|
|
2157
|
+
--pvt-children-font-color: var(--rls-app-color-800);
|
|
2158
2158
|
display: flex;
|
|
2159
2159
|
background: var(--pvt-background);
|
|
2160
2160
|
padding: var(--rls-sizing-x2);
|
|
@@ -2176,7 +2176,7 @@
|
|
|
2176
2176
|
}
|
|
2177
2177
|
.rls-tabs__children--active {
|
|
2178
2178
|
color: var(--pvt-children-font-color);
|
|
2179
|
-
font-weight: var(--rls-font-weight-
|
|
2179
|
+
font-weight: var(--rls-font-weight-bold);
|
|
2180
2180
|
background: var(--rls-app-color-050);
|
|
2181
2181
|
}
|
|
2182
2182
|
.rls-tabs__children--disabled {
|
|
@@ -2808,6 +2808,7 @@
|
|
|
2808
2808
|
--rlc-modal-max-width: 150rem;
|
|
2809
2809
|
--rlc-picker-clock-radius: var(--rls-sizing-x4);
|
|
2810
2810
|
--rlc-picker-clock-background: var(--rls-app-color-050);
|
|
2811
|
+
--rlc-picker-clock-padding: var(--rls-sizing-x4) 0rem;
|
|
2811
2812
|
} /*# sourceMappingURL=FieldClock.css.map */
|
|
2812
2813
|
|
|
2813
2814
|
.rls-picker-date {
|
|
@@ -3094,6 +3095,10 @@
|
|
|
3094
3095
|
} /*# sourceMappingURL=FieldSelect.css.map */
|
|
3095
3096
|
|
|
3096
3097
|
.rls-form-navigation {
|
|
3098
|
+
--rlc-field-box-body-background: var(
|
|
3099
|
+
--rlc-form-navigation-field-box-background,
|
|
3100
|
+
var(--rls-app-color-050)
|
|
3101
|
+
);
|
|
3097
3102
|
--pvt-component-transition: 160ms;
|
|
3098
3103
|
position: fixed;
|
|
3099
3104
|
display: flex;
|
package/dist/es/index.js
CHANGED
|
@@ -599,7 +599,7 @@ function RlsInput({ children, decimals, disabled, formControl, identifier, onBlu
|
|
|
599
599
|
? parseFloat((+valueInput).toFixed(decimals))
|
|
600
600
|
: valueInput;
|
|
601
601
|
changeIsInternal.current = true;
|
|
602
|
-
onValue
|
|
602
|
+
onValue?.(value);
|
|
603
603
|
setValueInput(valueInput);
|
|
604
604
|
formControl?.setValue(value);
|
|
605
605
|
}, [formControl, onValue, type, decimals]);
|
|
@@ -638,7 +638,7 @@ function RlsInputDecimal(props) {
|
|
|
638
638
|
const onValueInput = useCallback((value) => {
|
|
639
639
|
const valueDecimal = BigDecimal.create(value);
|
|
640
640
|
formControl ? formControl.setValue(valueDecimal) : setValueInput(value);
|
|
641
|
-
onValue
|
|
641
|
+
onValue?.(valueDecimal);
|
|
642
642
|
}, [formControl, onValue]);
|
|
643
643
|
const decimalProps = { ...props, formControl: undefined };
|
|
644
644
|
return (jsxRuntimeExports.jsx("div", { id: identifier, className: "rls-input-decimal", children: jsxRuntimeExports.jsx(RlsInput, { ...decimalProps, type: "number", value: valueInput, onValue: onValueInput, children: jsxRuntimeExports.jsx(RlsAmount, { value: amount, symbol: symbol, decimals: decimals }) }) }));
|
|
@@ -649,7 +649,7 @@ function RlsInputMoney(props) {
|
|
|
649
649
|
const [valueInput, setValueInput] = useState(formControl?.value ?? value ?? 0);
|
|
650
650
|
const onValueInput = useCallback((value) => {
|
|
651
651
|
!formControl && setValueInput(value);
|
|
652
|
-
onValue
|
|
652
|
+
onValue?.(value);
|
|
653
653
|
}, [formControl, onValue]);
|
|
654
654
|
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 }) }) }));
|
|
655
655
|
}
|
|
@@ -659,7 +659,7 @@ function RlsInputNumber(props) {
|
|
|
659
659
|
const [valueInput, setValueInput] = useState(formControl?.value ?? value ?? 0);
|
|
660
660
|
const onValueInput = useCallback((value) => {
|
|
661
661
|
!formControl && setValueInput(value);
|
|
662
|
-
onValue
|
|
662
|
+
onValue?.(value);
|
|
663
663
|
}, [formControl, onValue]);
|
|
664
664
|
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 }) }));
|
|
665
665
|
}
|
|
@@ -668,7 +668,7 @@ function RlsInputPassword({ disabled, formControl, identifier, onEnter, onKeyDow
|
|
|
668
668
|
const [focused, setFocused] = useState(false);
|
|
669
669
|
const _onChange = useCallback((event) => {
|
|
670
670
|
formControl?.setValue(event.target.value);
|
|
671
|
-
onValue
|
|
671
|
+
onValue?.(event.target.value);
|
|
672
672
|
}, [formControl, onValue]);
|
|
673
673
|
const _onKeyDown = useCallback((event) => {
|
|
674
674
|
onKeyDown && onKeyDown(event);
|
|
@@ -699,7 +699,7 @@ function RlsInputPercentage(props) {
|
|
|
699
699
|
const [valueInput, setValueInput] = useState(formControl?.value ?? value ?? 0);
|
|
700
700
|
const onValueInput = useCallback((value) => {
|
|
701
701
|
!formControl && setValueInput(value);
|
|
702
|
-
onValue
|
|
702
|
+
onValue?.(value);
|
|
703
703
|
}, [formControl, onValue]);
|
|
704
704
|
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, "%"] }) }));
|
|
705
705
|
}
|
|
@@ -720,7 +720,7 @@ function RlsInputText(props) {
|
|
|
720
720
|
const [valueInput, setValueInput] = useState(formControl?.value ?? value ?? '');
|
|
721
721
|
const onValueInput = useCallback((value) => {
|
|
722
722
|
!formControl && setValueInput(value);
|
|
723
|
-
onValue
|
|
723
|
+
onValue?.(value);
|
|
724
724
|
}, [formControl, onValue]);
|
|
725
725
|
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 }) }));
|
|
726
726
|
}
|
|
@@ -1205,7 +1205,7 @@ function RlsPickerDay({ date: _date, disabled, formControl, maxDate, month, minD
|
|
|
1205
1205
|
}, [formControl]);
|
|
1206
1206
|
const onSelect = useCallback((value) => {
|
|
1207
1207
|
setDayValue(value);
|
|
1208
|
-
onValue
|
|
1208
|
+
onValue?.(value);
|
|
1209
1209
|
}, [setDayValue, onValue]);
|
|
1210
1210
|
useEffect(() => {
|
|
1211
1211
|
return i18nSubscribe(() => {
|
|
@@ -1330,7 +1330,7 @@ function RlsPickerMonth({ date: _date, disabled, formControl, maxDate, minDate,
|
|
|
1330
1330
|
}, [formControl]);
|
|
1331
1331
|
const onSelect = useCallback((value) => {
|
|
1332
1332
|
setMonthValue(value);
|
|
1333
|
-
onValue
|
|
1333
|
+
onValue?.(value);
|
|
1334
1334
|
}, [setMonthValue, onValue]);
|
|
1335
1335
|
useEffect(() => {
|
|
1336
1336
|
setComponent(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: months.map((month, index) => (jsxRuntimeExports.jsx(RlsPickerMonthElement, { month: month, onSelect: onSelect, disabled: disabled }, index))) }));
|
|
@@ -1461,7 +1461,7 @@ function RlsPickerYear({ date: _date, disabled, formControl, maxDate, minDate, o
|
|
|
1461
1461
|
}, [formControl]);
|
|
1462
1462
|
const onSelect = useCallback((value) => {
|
|
1463
1463
|
setYearValue(value);
|
|
1464
|
-
onValue
|
|
1464
|
+
onValue?.(value);
|
|
1465
1465
|
}, [setYearValue, onValue]);
|
|
1466
1466
|
useEffect(() => {
|
|
1467
1467
|
const options = createPickerOptions(); // YearPickerProps
|
|
@@ -1547,7 +1547,7 @@ function RlsTab({ onSelect, tab, value }) {
|
|
|
1547
1547
|
active: tab.value === value,
|
|
1548
1548
|
disabled: tab.disabled
|
|
1549
1549
|
});
|
|
1550
|
-
}, [
|
|
1550
|
+
}, [tab, value]);
|
|
1551
1551
|
const onClick = useCallback(() => {
|
|
1552
1552
|
!tab.disabled && onSelect(tab.value);
|
|
1553
1553
|
}, [tab.disabled]);
|
|
@@ -1557,7 +1557,7 @@ function RlsTabs({ tabs, onValue, rlsTheme }) {
|
|
|
1557
1557
|
const [value, setValue] = useState();
|
|
1558
1558
|
const onSelect = useCallback((value) => {
|
|
1559
1559
|
setValue(value);
|
|
1560
|
-
onValue
|
|
1560
|
+
onValue?.(value);
|
|
1561
1561
|
}, [onValue]);
|
|
1562
1562
|
useEffect(() => {
|
|
1563
1563
|
const initial = tabs.find((tab) => tab.defaultActive) ?? tabs[0];
|
|
@@ -1827,14 +1827,14 @@ function useListController(props) {
|
|
|
1827
1827
|
: state;
|
|
1828
1828
|
refreshState((state) => ({ ...state, ..._state }));
|
|
1829
1829
|
}, [count]);
|
|
1830
|
-
const setFormValue = useCallback((element,
|
|
1830
|
+
const setFormValue = useCallback((element, valueIsDefault = false) => {
|
|
1831
1831
|
refreshState((state) => ({
|
|
1832
1832
|
...state,
|
|
1833
1833
|
value: element?.description || ''
|
|
1834
1834
|
}));
|
|
1835
1835
|
changeValueInternal.current = true;
|
|
1836
|
-
|
|
1837
|
-
? formControl?.
|
|
1836
|
+
valueIsDefault
|
|
1837
|
+
? formControl?.setDefaultValue(element?.value)
|
|
1838
1838
|
: formControl?.setValue(element?.value);
|
|
1839
1839
|
}, [formControl]);
|
|
1840
1840
|
const navigationInput = useCallback((event) => {
|
|
@@ -2117,6 +2117,7 @@ function RlsPickerClock({ formControl, onListener, rlsTheme, time }) {
|
|
|
2117
2117
|
const [hour, setHour] = useState(zoneIsPM ? timeInitial.hour - 12 : timeInitial.hour);
|
|
2118
2118
|
const [minute, setMinute] = useState(timeInitial.minute);
|
|
2119
2119
|
const [selectionIsHours, setSelectionIsHours] = useState(true);
|
|
2120
|
+
const changeIsInternal = useRef(true);
|
|
2120
2121
|
const selectionIsActive = useRef(false);
|
|
2121
2122
|
const radianUnit = useMemo(() => {
|
|
2122
2123
|
return Math.PI / (selectionIsHours ? 6 : 30);
|
|
@@ -2164,6 +2165,15 @@ function RlsPickerClock({ formControl, onListener, rlsTheme, time }) {
|
|
|
2164
2165
|
useEffect(() => {
|
|
2165
2166
|
selectionIsHours ? refreshClockHour() : refreshClockMinute();
|
|
2166
2167
|
}, [selectionIsHours]);
|
|
2168
|
+
useEffect(() => {
|
|
2169
|
+
if (!changeIsInternal.current && formControl?.value) {
|
|
2170
|
+
const zoneIsPM = formControl.value.hour >= 12;
|
|
2171
|
+
setZoneIsPM(zoneIsPM);
|
|
2172
|
+
setHour(zoneIsPM ? formControl.value.hour - 12 : formControl.value.hour);
|
|
2173
|
+
setMinute(formControl.value.minute);
|
|
2174
|
+
}
|
|
2175
|
+
changeIsInternal.current = false;
|
|
2176
|
+
}, [formControl?.value]);
|
|
2167
2177
|
const refreshComponent = useCallback((clientX, clientY) => {
|
|
2168
2178
|
const rectangle = plateElement.current.getBoundingClientRect();
|
|
2169
2179
|
const centerX = rectangle.left + rectangle.width / 2;
|
|
@@ -2236,6 +2246,7 @@ function RlsPickerClock({ formControl, onListener, rlsTheme, time }) {
|
|
|
2236
2246
|
}, [onListener]);
|
|
2237
2247
|
const onCurrentTime = useCallback(() => {
|
|
2238
2248
|
const currentTime = Time.now();
|
|
2249
|
+
changeIsInternal.current = true;
|
|
2239
2250
|
formControl?.setValue(currentTime);
|
|
2240
2251
|
setHour(currentTime.hour);
|
|
2241
2252
|
setMinute(currentTime.minute);
|
|
@@ -2253,6 +2264,7 @@ function RlsPickerClock({ formControl, onListener, rlsTheme, time }) {
|
|
|
2253
2264
|
? 0
|
|
2254
2265
|
: hour;
|
|
2255
2266
|
const timeValue = new Time(hourValue, minute);
|
|
2267
|
+
changeIsInternal.current = true;
|
|
2256
2268
|
formControl?.setValue(timeValue);
|
|
2257
2269
|
onListener?.({
|
|
2258
2270
|
event: PickerListenerEvent.Select,
|
|
@@ -2266,24 +2278,27 @@ function RlsPickerClock({ formControl, onListener, rlsTheme, time }) {
|
|
|
2266
2278
|
}) })] }) }), jsxRuntimeExports.jsxs("div", { className: "rls-picker-clock__footer", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__footer--cancel", children: jsxRuntimeExports.jsx(RlsButton, { type: "flat", onClick: onCancel, children: labels.timeActionCancel }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__footer--today", children: jsxRuntimeExports.jsx(RlsButtonAction, { icon: "timer", onClick: onCurrentTime }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__footer--ok", children: jsxRuntimeExports.jsx(RlsButton, { type: "gradient", onClick: onSelect, children: labels.timeActionSelect }) })] })] }));
|
|
2267
2279
|
}
|
|
2268
2280
|
|
|
2269
|
-
function RlsFieldClock({ children, disabled, formControl, identifier, msgErrorDisabled, onValue, placeholder, readOnly, rlsTheme, time, value: valueInitial }) {
|
|
2281
|
+
function RlsFieldClock({ children, disabled: disabledProps, formControl, identifier, msgErrorDisabled, onValue, placeholder, readOnly, rlsTheme, time, value: valueInitial }) {
|
|
2270
2282
|
const [value, setValue] = useState(formControl?.value ?? valueInitial);
|
|
2271
2283
|
const [modalIsVisible, setModalIsVisible] = useState(false);
|
|
2272
|
-
const
|
|
2273
|
-
return formControl?.disabled ||
|
|
2274
|
-
}, [formControl?.disabled,
|
|
2284
|
+
const disabled = useMemo(() => {
|
|
2285
|
+
return formControl?.disabled || disabledProps;
|
|
2286
|
+
}, [formControl?.disabled, disabledProps]);
|
|
2275
2287
|
const className = useMemo(() => {
|
|
2276
2288
|
return renderClassStatus('rls-field-box', {
|
|
2277
|
-
disabled
|
|
2289
|
+
disabled,
|
|
2278
2290
|
readonly: readOnly
|
|
2279
2291
|
});
|
|
2280
|
-
}, [
|
|
2281
|
-
const
|
|
2292
|
+
}, [disabled, readOnly]);
|
|
2293
|
+
const timeValue = useMemo(() => {
|
|
2294
|
+
return formControl ? formControl.value : value;
|
|
2295
|
+
}, [formControl?.value, value]);
|
|
2296
|
+
const status = useMemo(() => {
|
|
2282
2297
|
return {
|
|
2283
|
-
icon:
|
|
2284
|
-
valueInput:
|
|
2298
|
+
icon: timeValue ? 'trash-2' : 'timer',
|
|
2299
|
+
valueInput: timeValue?.normalizeMeridiemFormat || ''
|
|
2285
2300
|
};
|
|
2286
|
-
}, [
|
|
2301
|
+
}, [timeValue]);
|
|
2287
2302
|
const onClickInput = useCallback(() => {
|
|
2288
2303
|
!readOnly && setModalIsVisible(true);
|
|
2289
2304
|
}, [readOnly]);
|
|
@@ -2292,7 +2307,7 @@ function RlsFieldClock({ children, disabled, formControl, identifier, msgErrorDi
|
|
|
2292
2307
|
onValue?.(value);
|
|
2293
2308
|
}, [onValue]);
|
|
2294
2309
|
const onClickAction = useCallback(() => {
|
|
2295
|
-
if (
|
|
2310
|
+
if (timeValue) {
|
|
2296
2311
|
formControl?.setValue(valueInitial);
|
|
2297
2312
|
formControl?.touch();
|
|
2298
2313
|
onChange(valueInitial);
|
|
@@ -2300,13 +2315,13 @@ function RlsFieldClock({ children, disabled, formControl, identifier, msgErrorDi
|
|
|
2300
2315
|
else {
|
|
2301
2316
|
setModalIsVisible(true);
|
|
2302
2317
|
}
|
|
2303
|
-
}, [
|
|
2318
|
+
}, [timeValue, formControl, valueInitial, onChange]);
|
|
2304
2319
|
const onListener = useCallback(({ event, value }) => {
|
|
2305
2320
|
event !== PickerListenerEvent.Cancel && onChange(value);
|
|
2306
2321
|
formControl?.touch();
|
|
2307
2322
|
setModalIsVisible(false);
|
|
2308
2323
|
}, [formControl, onChange]);
|
|
2309
|
-
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: valueInput, readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled:
|
|
2324
|
+
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.valueInput, readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), !readOnly && (jsxRuntimeExports.jsx("button", { className: "rls-field-date__action", onClick: onClickAction, disabled: disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: status.icon }) }))] }) }), !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 }) })] }));
|
|
2310
2325
|
}
|
|
2311
2326
|
|
|
2312
2327
|
const DATE_FORMAT = '{dd}/{mx}/{yy}';
|
|
@@ -2387,43 +2402,48 @@ function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDat
|
|
|
2387
2402
|
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: _date, month: monthControl.value, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsxRuntimeExports.jsx(RlsPickerMonth, { formControl: monthControl, date: _date, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsxRuntimeExports.jsx(RlsPickerYear, { formControl: yearControl, date: _date, 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 }) })] }) }))] }));
|
|
2388
2403
|
}
|
|
2389
2404
|
|
|
2390
|
-
function RlsFieldDate({ children, date, disabled, formControl, format, identifier, maxDate, minDate, msgErrorDisabled, onValue, placeholder, readOnly, rlsTheme, value: valueInitial }) {
|
|
2405
|
+
function RlsFieldDate({ children, date, disabled: disabledProps, formControl, format, identifier, maxDate, minDate, msgErrorDisabled, onValue, placeholder, readOnly, rlsTheme, value: valueInitial }) {
|
|
2391
2406
|
const today = useRef(new Date()); // Initial current date in component
|
|
2392
2407
|
const [value, setValue] = useState(formControl?.value ?? valueInitial);
|
|
2393
2408
|
const [modalIsVisible, setModalIsVisible] = useState(false);
|
|
2394
|
-
const
|
|
2395
|
-
return formControl?.disabled ||
|
|
2396
|
-
}, [formControl?.disabled,
|
|
2409
|
+
const disabled = useMemo(() => {
|
|
2410
|
+
return formControl?.disabled || disabledProps;
|
|
2411
|
+
}, [formControl?.disabled, disabledProps]);
|
|
2397
2412
|
const className = useMemo(() => {
|
|
2398
2413
|
return renderClassStatus('rls-field-box', {
|
|
2399
|
-
disabled
|
|
2414
|
+
disabled,
|
|
2400
2415
|
readonly: readOnly
|
|
2401
2416
|
});
|
|
2402
|
-
}, [
|
|
2403
|
-
const
|
|
2417
|
+
}, [disabled, readOnly]);
|
|
2418
|
+
const dateValue = useMemo(() => {
|
|
2419
|
+
return formControl ? formControl.value : value;
|
|
2420
|
+
}, [formControl?.value, value]);
|
|
2421
|
+
const status = useMemo(() => {
|
|
2404
2422
|
return {
|
|
2405
|
-
icon:
|
|
2406
|
-
|
|
2423
|
+
icon: dateValue ? 'trash-2' : 'calendar',
|
|
2424
|
+
label: dateValue
|
|
2425
|
+
? dateFormatTemplate(dateValue, format || DATE_FORMAT)
|
|
2426
|
+
: ''
|
|
2407
2427
|
};
|
|
2408
|
-
}, [
|
|
2428
|
+
}, [dateValue, format]);
|
|
2409
2429
|
useEffect(() => {
|
|
2410
|
-
const
|
|
2430
|
+
const dateSecure = verifyDateRange({
|
|
2411
2431
|
date: formControl?.value ?? date ?? today.current,
|
|
2412
2432
|
minDate,
|
|
2413
2433
|
maxDate
|
|
2414
2434
|
});
|
|
2415
|
-
setValue(
|
|
2416
|
-
formControl?.setValue(
|
|
2435
|
+
setValue(dateSecure);
|
|
2436
|
+
formControl?.setValue(dateSecure);
|
|
2417
2437
|
}, []);
|
|
2418
2438
|
const onClickInput = useCallback(() => {
|
|
2419
2439
|
!readOnly && setModalIsVisible(true);
|
|
2420
2440
|
}, [readOnly]);
|
|
2421
2441
|
const onChange = useCallback((value) => {
|
|
2422
2442
|
setValue(value);
|
|
2423
|
-
onValue
|
|
2443
|
+
onValue?.(value);
|
|
2424
2444
|
}, [onValue]);
|
|
2425
2445
|
const onClickAction = useCallback(() => {
|
|
2426
|
-
if (
|
|
2446
|
+
if (dateValue) {
|
|
2427
2447
|
formControl?.setValue(valueInitial);
|
|
2428
2448
|
formControl?.touch();
|
|
2429
2449
|
onChange(valueInitial);
|
|
@@ -2431,13 +2451,13 @@ function RlsFieldDate({ children, date, disabled, formControl, format, identifie
|
|
|
2431
2451
|
else {
|
|
2432
2452
|
setModalIsVisible(true);
|
|
2433
2453
|
}
|
|
2434
|
-
}, [
|
|
2454
|
+
}, [dateValue, formControl, valueInitial, onChange]);
|
|
2435
2455
|
const onListener = useCallback(({ event, value }) => {
|
|
2436
2456
|
event !== PickerListenerEvent.Cancel && onChange(value);
|
|
2437
2457
|
formControl?.touch();
|
|
2438
2458
|
setModalIsVisible(false);
|
|
2439
2459
|
}, [formControl, onChange]);
|
|
2440
|
-
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:
|
|
2460
|
+
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("button", { className: "rls-field-date__action", onClick: onClickAction, disabled: disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: status.icon }) }))] }) }), !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 }) })] }));
|
|
2441
2461
|
}
|
|
2442
2462
|
|
|
2443
2463
|
function rangeFormatTemplate({ maxDate, minDate }) {
|
|
@@ -2512,48 +2532,51 @@ function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl
|
|
|
2512
2532
|
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 }) })] }) })] }));
|
|
2513
2533
|
}
|
|
2514
2534
|
|
|
2515
|
-
function RlsFieldDateRange({ children, date
|
|
2516
|
-
const currentDate = useMemo(() =>
|
|
2517
|
-
const [value, setValue] = useState(formControl?.value ||
|
|
2535
|
+
function RlsFieldDateRange({ children, date, disabled: disabledProps, formControl, identifier, maxDate, minDate, msgErrorDisabled, onValue, placeholder, readOnly, rlsTheme, value: valueInitial }) {
|
|
2536
|
+
const currentDate = useMemo(() => date ?? new Date(), [date]);
|
|
2537
|
+
const [value, setValue] = useState(formControl?.value || valueInitial);
|
|
2518
2538
|
const [modalIsVisible, setModalIsVisible] = useState(false);
|
|
2519
|
-
const
|
|
2520
|
-
return formControl?.disabled ||
|
|
2521
|
-
}, [formControl?.disabled,
|
|
2539
|
+
const disabled = useMemo(() => {
|
|
2540
|
+
return formControl?.disabled || disabledProps;
|
|
2541
|
+
}, [formControl?.disabled, disabledProps]);
|
|
2522
2542
|
const className = useMemo(() => {
|
|
2523
2543
|
return renderClassStatus('rls-field-box', {
|
|
2524
|
-
disabled
|
|
2544
|
+
disabled,
|
|
2525
2545
|
readonly: readOnly
|
|
2526
2546
|
});
|
|
2527
|
-
}, [
|
|
2528
|
-
const
|
|
2547
|
+
}, [disabled, readOnly]);
|
|
2548
|
+
const dateRangeValue = useMemo(() => {
|
|
2549
|
+
return formControl ? formControl.value : value;
|
|
2550
|
+
}, [formControl?.value, value]);
|
|
2551
|
+
const status = useMemo(() => {
|
|
2529
2552
|
return {
|
|
2530
|
-
icon:
|
|
2531
|
-
valueInput:
|
|
2553
|
+
icon: dateRangeValue ? 'trash-2' : 'calendar',
|
|
2554
|
+
valueInput: dateRangeValue ? rangeFormatTemplate(dateRangeValue) : ''
|
|
2532
2555
|
};
|
|
2533
|
-
}, [
|
|
2556
|
+
}, [dateRangeValue]);
|
|
2534
2557
|
const onClickInput = useCallback(() => {
|
|
2535
2558
|
!readOnly && setModalIsVisible(true);
|
|
2536
2559
|
}, [readOnly]);
|
|
2537
2560
|
const onChange = useCallback((value) => {
|
|
2538
2561
|
setValue(value);
|
|
2539
|
-
onValue
|
|
2562
|
+
onValue?.(value);
|
|
2540
2563
|
}, [onValue]);
|
|
2541
2564
|
const onClickAction = useCallback(() => {
|
|
2542
|
-
if (
|
|
2543
|
-
formControl?.setValue(
|
|
2565
|
+
if (dateRangeValue) {
|
|
2566
|
+
formControl?.setValue(valueInitial);
|
|
2544
2567
|
formControl?.touch();
|
|
2545
|
-
onChange(
|
|
2568
|
+
onChange(valueInitial);
|
|
2546
2569
|
}
|
|
2547
2570
|
else {
|
|
2548
2571
|
setModalIsVisible(true);
|
|
2549
2572
|
}
|
|
2550
|
-
}, [
|
|
2573
|
+
}, [dateRangeValue, formControl, valueInitial, onChange]);
|
|
2551
2574
|
const onListener = useCallback(({ event, value }) => {
|
|
2552
2575
|
event !== PickerListenerEvent.Cancel && onChange(value);
|
|
2553
2576
|
formControl?.touch();
|
|
2554
2577
|
setModalIsVisible(false);
|
|
2555
2578
|
}, [formControl, onChange]);
|
|
2556
|
-
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: valueInput, readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled:
|
|
2579
|
+
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("button", { className: "rls-field-date-range__action", onClick: onClickAction, disabled: disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: status.icon }) }))] }) }), !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 }) })] }));
|
|
2557
2580
|
}
|
|
2558
2581
|
|
|
2559
2582
|
function useFieldSelect(props) {
|
|
@@ -3223,15 +3246,15 @@ function RlsApplication({ children }) {
|
|
|
3223
3246
|
const { RlsSnackbar, snackbar } = useSnackbar();
|
|
3224
3247
|
const [navbarInApp, setNavbarInApp] = useState(false);
|
|
3225
3248
|
const [navbarIsCondense, setNavbarIsCondense] = useState(false);
|
|
3226
|
-
const [
|
|
3249
|
+
const [appIsMobile, setIsMobile] = useState(false);
|
|
3227
3250
|
const className = useMemo(() => {
|
|
3228
3251
|
return renderClassStatus('rls-app__body', {
|
|
3229
|
-
mobile:
|
|
3252
|
+
mobile: appIsMobile,
|
|
3230
3253
|
'navbar-snackbar': navbarInApp,
|
|
3231
3254
|
'navbar-condense': navbarIsCondense
|
|
3232
3255
|
});
|
|
3233
|
-
}, [
|
|
3234
|
-
return (jsxRuntimeExports.jsxs(RlsContext
|
|
3256
|
+
}, [appIsMobile, navbarInApp, navbarIsCondense]);
|
|
3257
|
+
return (jsxRuntimeExports.jsxs(RlsContext, { value: {
|
|
3235
3258
|
confirmation,
|
|
3236
3259
|
snackbar,
|
|
3237
3260
|
setIsMobile,
|