@rolster/react-components 18.24.11 → 18.25.1
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-A_JkPXhq.css → index-ItWqNiAF.css} +7 -0
- package/dist/cjs/index.js +21 -15
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/assets/{index-A_JkPXhq.css → index-ItWqNiAF.css} +7 -0
- package/dist/es/index.js +22 -16
- package/dist/es/index.js.map +1 -1
- package/dist/esm/components/atoms/InputSearch/InputSearch.css +7 -0
- package/dist/esm/components/atoms/InputSearch/InputSearch.css.map +1 -1
- package/dist/esm/components/atoms/InputSearch/InputSearch.d.ts +2 -1
- package/dist/esm/components/atoms/InputSearch/InputSearch.js +7 -3
- package/dist/esm/components/atoms/InputSearch/InputSearch.js.map +1 -1
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.js +4 -4
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.js.map +1 -1
- package/dist/esm/components/molecules/PickerSelectorTitle/PickerSelectorTitle.js +7 -5
- package/dist/esm/components/molecules/PickerSelectorTitle/PickerSelectorTitle.js.map +1 -1
- package/dist/esm/components/molecules/PickerYear/PickerYear.js +2 -2
- package/dist/esm/components/molecules/PickerYear/PickerYear.js.map +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.d.ts +1 -0
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js +2 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js.map +1 -1
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.d.ts +1 -0
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.js +2 -2
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.js.map +1 -1
- package/dist/esm/components/organisms/PickerDateRange/PickerDateRange.js +3 -3
- package/dist/esm/components/organisms/PickerDateRange/PickerDateRange.js.map +1 -1
- package/package.json +7 -7
|
@@ -739,6 +739,13 @@
|
|
|
739
739
|
box-sizing: border-box;
|
|
740
740
|
background: var(--rlc-input-search-background, var(--rls-app-color-100));
|
|
741
741
|
border-radius: var(--rls-sizing-x4);
|
|
742
|
+
}
|
|
743
|
+
.rls-input-search--disabled {
|
|
744
|
+
opacity: 0.5;
|
|
745
|
+
}
|
|
746
|
+
.rls-input-search .rls-input__component:disabled,
|
|
747
|
+
.rls-input-search .rls-button-action:disabled {
|
|
748
|
+
opacity: 1 !important;
|
|
742
749
|
} /*# sourceMappingURL=InputSearch.css.map */
|
|
743
750
|
|
|
744
751
|
.rls-input-text {
|
package/dist/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import require$$0, { useMemo, useCallback, useState, useRef, useEffect, createContext } from 'react';
|
|
2
|
-
import { currencyFormat,
|
|
2
|
+
import { currencyFormat, valueIsDefined, PartialSealed } from '@rolster/commons';
|
|
3
3
|
import { i18n, i18nSubscribe } from '@rolster/i18n';
|
|
4
4
|
import { PaginationController, verifyDayPicker, createDayPicker, createDayRangePicker, verifyMonthPicker, createMonthPicker, monthLimitTemplate, createYearPicker, verifyYearPicker, ListCollection, locationListCanTop, navigationListFromInput, navigationListFromElement, createAutocompleteStore, dateOutRange, verifyDateRange, PickerListenerEvent } from '@rolster/components';
|
|
5
5
|
import { DAY_LABELS, DateRange, normalizeMinTime, assignDayInDate, dateIsBefore, dateFormatTemplate, MONTH_NAMES, Month, assignYearInDate, assignMonthInDate } from '@rolster/dates';
|
|
@@ -1576,12 +1576,15 @@ function RlsInputPercentage(props) {
|
|
|
1576
1576
|
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, "%"] }) }));
|
|
1577
1577
|
}
|
|
1578
1578
|
|
|
1579
|
-
function RlsInputSearch({ formControl, identifier, onEnter, onSearch, placeholder }) {
|
|
1579
|
+
function RlsInputSearch({ formControl, disabled, identifier, onEnter, onSearch, placeholder }) {
|
|
1580
1580
|
const [value, setValue] = useState('');
|
|
1581
|
+
const className = useMemo(() => {
|
|
1582
|
+
return renderClassStatus('rls-input-search', { disabled });
|
|
1583
|
+
}, [disabled]);
|
|
1581
1584
|
const onValue = useCallback((value) => {
|
|
1582
1585
|
!formControl && setValue(() => value);
|
|
1583
1586
|
}, [formControl]);
|
|
1584
|
-
return (jsxRuntimeExports.jsxs("div", { id: identifier, className:
|
|
1587
|
+
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 }))] }));
|
|
1585
1588
|
}
|
|
1586
1589
|
|
|
1587
1590
|
function RlsInputText(props) {
|
|
@@ -2179,7 +2182,7 @@ function RlsPickerMonthElement({ month, onSelect, disabled }) {
|
|
|
2179
2182
|
});
|
|
2180
2183
|
}, [month.disabled, month.focused, month.selected, disabled]);
|
|
2181
2184
|
const onClick = useCallback(() => {
|
|
2182
|
-
|
|
2185
|
+
valueIsDefined(month.value) &&
|
|
2183
2186
|
!month.disabled &&
|
|
2184
2187
|
!disabled &&
|
|
2185
2188
|
onSelect(month.value);
|
|
@@ -2210,7 +2213,7 @@ function RlsPickerMonth({ date: _date, disabled, formControl, maxDate, minDate,
|
|
|
2210
2213
|
maxDate
|
|
2211
2214
|
};
|
|
2212
2215
|
const month = verifyMonthPicker(options);
|
|
2213
|
-
|
|
2216
|
+
valueIsDefined(month)
|
|
2214
2217
|
? setMonthValue(month)
|
|
2215
2218
|
: setMonths(createMonthPicker(options));
|
|
2216
2219
|
}, [date, year, value, minDate, maxDate]);
|
|
@@ -2222,7 +2225,7 @@ function RlsPickerMonth({ date: _date, disabled, formControl, maxDate, minDate,
|
|
|
2222
2225
|
minDate,
|
|
2223
2226
|
maxDate
|
|
2224
2227
|
});
|
|
2225
|
-
|
|
2228
|
+
valueIsDefined(month)
|
|
2226
2229
|
? formControl?.setValue(month)
|
|
2227
2230
|
: setValue(formControl?.value ?? date.getMonth());
|
|
2228
2231
|
}, [formControl?.value]);
|
|
@@ -2248,7 +2251,8 @@ function RlsPickerSelectorTitle({ monthControl, type, yearControl, date, disable
|
|
|
2248
2251
|
setLabel(MONTH_NAMES(monthControl.value ?? Month.January));
|
|
2249
2252
|
}, [monthControl.value]);
|
|
2250
2253
|
const onPreviousMonth = useCallback(() => {
|
|
2251
|
-
if (
|
|
2254
|
+
if (valueIsDefined(monthControl.value) &&
|
|
2255
|
+
valueIsDefined(yearControl.value)) {
|
|
2252
2256
|
if (monthControl.value > Month.January) {
|
|
2253
2257
|
monthControl.setValue(monthControl.value - 1);
|
|
2254
2258
|
}
|
|
@@ -2259,14 +2263,15 @@ function RlsPickerSelectorTitle({ monthControl, type, yearControl, date, disable
|
|
|
2259
2263
|
}
|
|
2260
2264
|
}, [monthControl.value, yearControl.value]);
|
|
2261
2265
|
const onPreviousYear = useCallback(() => {
|
|
2262
|
-
|
|
2266
|
+
valueIsDefined(yearControl.value) &&
|
|
2263
2267
|
yearControl.setValue(yearControl.value - 1);
|
|
2264
2268
|
}, [yearControl.value]);
|
|
2265
2269
|
const onPrevious = useCallback(() => {
|
|
2266
2270
|
type === 'month' ? onPreviousMonth() : onPreviousYear();
|
|
2267
2271
|
}, [type, onPreviousMonth, onPreviousYear]);
|
|
2268
2272
|
const onNextMonth = useCallback(() => {
|
|
2269
|
-
if (
|
|
2273
|
+
if (valueIsDefined(monthControl.value) &&
|
|
2274
|
+
valueIsDefined(yearControl.value)) {
|
|
2270
2275
|
if (monthControl.value < Month.December) {
|
|
2271
2276
|
monthControl.setValue(monthControl.value + 1);
|
|
2272
2277
|
}
|
|
@@ -2277,7 +2282,7 @@ function RlsPickerSelectorTitle({ monthControl, type, yearControl, date, disable
|
|
|
2277
2282
|
}
|
|
2278
2283
|
}, [monthControl.value, yearControl.value]);
|
|
2279
2284
|
const onNextYear = useCallback(() => {
|
|
2280
|
-
|
|
2285
|
+
valueIsDefined(yearControl.value) &&
|
|
2281
2286
|
yearControl.setValue(yearControl.value + 1);
|
|
2282
2287
|
}, [yearControl.value]);
|
|
2283
2288
|
const onNext = useCallback(() => {
|
|
@@ -2331,7 +2336,7 @@ function RlsPickerYear({ date: _date, disabled, formControl, maxDate, minDate, o
|
|
|
2331
2336
|
}, [template.years, onSelect, disabled]);
|
|
2332
2337
|
useEffect(() => {
|
|
2333
2338
|
const year = verifyYearPicker(createPickerOptions());
|
|
2334
|
-
|
|
2339
|
+
valueIsDefined(year)
|
|
2335
2340
|
? formControl?.setValue(year)
|
|
2336
2341
|
: setValue(formControl?.value ?? date.getFullYear());
|
|
2337
2342
|
}, [formControl?.value]);
|
|
@@ -2828,11 +2833,12 @@ function RlsFieldAutocompleteTemplate(props) {
|
|
|
2828
2833
|
disabled,
|
|
2829
2834
|
readonly: readOnly,
|
|
2830
2835
|
selected: !!autocomplete.value
|
|
2831
|
-
},
|
|
2836
|
+
}, `rls-field-list rls-field-autocomplete ${props.className ?? ''}`);
|
|
2832
2837
|
}, [
|
|
2833
2838
|
formControl?.wrong,
|
|
2834
2839
|
autocomplete.value,
|
|
2835
2840
|
autocomplete.focused,
|
|
2841
|
+
props.className,
|
|
2836
2842
|
disabled,
|
|
2837
2843
|
readOnly
|
|
2838
2844
|
]);
|
|
@@ -3038,14 +3044,14 @@ function RlsPickerDateRange({ automatic, date: _picker, disabled, formControl, m
|
|
|
3038
3044
|
}, []);
|
|
3039
3045
|
useEffect(() => {
|
|
3040
3046
|
setDate((date) => {
|
|
3041
|
-
return
|
|
3047
|
+
return valueIsDefined(yearControl.value)
|
|
3042
3048
|
? assignYearInDate(date, yearControl.value)
|
|
3043
3049
|
: date;
|
|
3044
3050
|
});
|
|
3045
3051
|
}, [yearControl.value]);
|
|
3046
3052
|
useEffect(() => {
|
|
3047
3053
|
setDate((date) => {
|
|
3048
|
-
return
|
|
3054
|
+
return valueIsDefined(monthControl.value)
|
|
3049
3055
|
? assignMonthInDate(date, monthControl.value)
|
|
3050
3056
|
: date;
|
|
3051
3057
|
});
|
|
@@ -3243,8 +3249,8 @@ function RlsFieldSelectTemplate(props) {
|
|
|
3243
3249
|
error: formControl?.wrong,
|
|
3244
3250
|
disabled: disabled,
|
|
3245
3251
|
readonly: readOnly
|
|
3246
|
-
},
|
|
3247
|
-
}, [formControl?.wrong, select.focused, disabled, readOnly]);
|
|
3252
|
+
}, `rls-field-list rls-field-select ${props.className ?? ''}`);
|
|
3253
|
+
}, [formControl?.wrong, select.focused, props.className, disabled, readOnly]);
|
|
3248
3254
|
const classNameList = useMemo(() => {
|
|
3249
3255
|
return renderClassStatus('rls-field-list__suggestions', {
|
|
3250
3256
|
higher: select.higher,
|