@rolster/react-components 18.21.44 → 18.21.46
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-CEj_H1DS.css → index-CaA_sxmM.css} +5 -0
- package/dist/cjs/index.js +78 -71
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/assets/{index-CEj_H1DS.css → index-CaA_sxmM.css} +5 -0
- package/dist/es/index.js +78 -71
- package/dist/es/index.js.map +1 -1
- package/dist/esm/components/atoms/Amount/Amount.css +3 -0
- package/dist/esm/components/atoms/Amount/Amount.css.map +1 -1
- package/dist/esm/components/atoms/TabularText/TabularText.css +2 -0
- package/dist/esm/components/atoms/TabularText/TabularText.css.map +1 -1
- package/dist/esm/components/molecules/PickerDay/PickerDay.js +13 -13
- package/dist/esm/components/molecules/PickerDay/PickerDay.js.map +1 -1
- package/dist/esm/components/molecules/PickerDayRange/PickerDayRange.js +12 -12
- package/dist/esm/components/molecules/PickerDayRange/PickerDayRange.js.map +1 -1
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.js +10 -10
- package/dist/esm/components/molecules/PickerMonth/PickerMonth.js.map +1 -1
- package/dist/esm/components/molecules/PickerYear/PickerYear.js +11 -11
- package/dist/esm/components/molecules/PickerYear/PickerYear.js.map +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js +1 -1
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteController.js +5 -2
- package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteController.js.map +1 -1
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.js +3 -3
- package/dist/esm/components/organisms/FieldSelect/FieldSelect.js.map +1 -1
- package/dist/esm/components/organisms/FieldSelect/FieldSelectController.js +7 -3
- package/dist/esm/components/organisms/FieldSelect/FieldSelectController.js.map +1 -1
- package/dist/esm/components/organisms/PickerDate/PickerDate.js +1 -1
- package/dist/esm/components/organisms/PickerDate/PickerDate.js.map +1 -1
- package/dist/esm/controllers/ListController.d.ts +3 -3
- package/dist/esm/controllers/ListController.js +16 -16
- package/dist/esm/controllers/ListController.js.map +1 -1
- package/dist/esm/definitions.d.ts +3 -3
- package/package.json +2 -2
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
--rlc-tabular-text-font-size,
|
|
4
4
|
var(--rls-body-font-size)
|
|
5
5
|
);
|
|
6
|
+
--pvt-char-font-weight: var(--rlc-tabular-text-font-weight, inherit);
|
|
6
7
|
--pvt-char-height: var(--pvt-char-font-size);
|
|
7
8
|
--pvt-char-width: var(--rlc-tabular-text-char-width, 5.5rem);
|
|
8
9
|
--pvt-pointer-width: var(--rlc-tabular-text-pointer-width, 2rem);
|
|
@@ -11,6 +12,7 @@
|
|
|
11
12
|
height: var(--pvt-char-height);
|
|
12
13
|
line-height: var(--pvt-char-height);
|
|
13
14
|
font-size: var(--pvt-char-font-size);
|
|
15
|
+
font-weight: var(--pvt-char-font-weight);
|
|
14
16
|
justify-content: var(--rlc-tabular-text-align, flex-start);
|
|
15
17
|
}
|
|
16
18
|
.rls-tabular-text__char {
|
|
@@ -26,14 +28,17 @@
|
|
|
26
28
|
|
|
27
29
|
.rls-amount {
|
|
28
30
|
--pvt-font-size: var(--rlc-amount-font-size, inherit);
|
|
31
|
+
--pvt-font-weight: var(--rlc-amount-font-weight, inherit);
|
|
29
32
|
--pvt-decimal-width: var(--rlc-amount-decimal-width, 0.5);
|
|
30
33
|
--pvt-decimal-size: var(--rlc-amount-decimal-size, 0.6);
|
|
31
34
|
--rlc-tabular-text-font-size: var(--pvt-font-size);
|
|
35
|
+
--rlc-tabular-text-font-weight: var(--pvt-font-weight);
|
|
32
36
|
display: flex;
|
|
33
37
|
width: var(--rlc-amount-width, auto);
|
|
34
38
|
justify-content: var(--rlc-amount-text-align, flex-start);
|
|
35
39
|
column-gap: var(--rls-sizing-x2);
|
|
36
40
|
font-size: var(--pvt-font-size);
|
|
41
|
+
font-weight: var(--pvt-font-weight);
|
|
37
42
|
}
|
|
38
43
|
.rls-amount[rls-theme] {
|
|
39
44
|
color: var(--rls-theme-color-500);
|
package/dist/es/index.js
CHANGED
|
@@ -1966,7 +1966,10 @@ function RlsPagination({ suggestions, count, filter, onPagination }) {
|
|
|
1966
1966
|
}) }), jsxRuntimeExports.jsx("div", { className: "rls-pagination__description", children: template?.description }), jsxRuntimeExports.jsxs("div", { className: "rls-pagination__actions", children: [jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goNextPagination, disabled: template?.lastPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-right" }) }), jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goLastPagination, disabled: template?.lastPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrowhead-right" }) })] })] }));
|
|
1967
1967
|
}
|
|
1968
1968
|
|
|
1969
|
-
function
|
|
1969
|
+
function RlsPickerDayHeaders() {
|
|
1970
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-day__header", children: DAY_LABELS().map((title, index) => (jsxRuntimeExports.jsx("label", { className: "rls-picker-day__label", children: title }, index))) }));
|
|
1971
|
+
}
|
|
1972
|
+
function RlsPickerDayElement({ day, onSelect, disabled }) {
|
|
1970
1973
|
const className = useMemo(() => {
|
|
1971
1974
|
return renderClassStatus('rls-picker-day__element', {
|
|
1972
1975
|
disabled: day.disabled || disabled,
|
|
@@ -1988,23 +1991,27 @@ function RlsPickerDayItem({ day, onSelect, disabled }) {
|
|
|
1988
1991
|
}, [day.value, day.disabled, disabled, onSelect]);
|
|
1989
1992
|
return (jsxRuntimeExports.jsx("div", { className: className, onClick: onClick, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-day__element__span", children: day.value || '??' }) }));
|
|
1990
1993
|
}
|
|
1991
|
-
function RlsPickerDayHeaders() {
|
|
1992
|
-
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-day__header", children: DAY_LABELS().map((title, index) => (jsxRuntimeExports.jsx("label", { className: "rls-picker-day__label", children: title }, index))) }));
|
|
1993
|
-
}
|
|
1994
1994
|
function RlsPickerDay({ date: _date, disabled, formControl, maxDate, month, minDate, onValue, rlsTheme, year }) {
|
|
1995
1995
|
const date = useMemo(() => _date ?? new Date(), [_date]);
|
|
1996
1996
|
const [weeks, setWeeks] = useState([]);
|
|
1997
1997
|
const [value, setValue] = useState(formControl?.value || date.getDate());
|
|
1998
1998
|
const [headers, setHeaders] = useState(jsxRuntimeExports.jsx(RlsPickerDayHeaders, {}));
|
|
1999
1999
|
const [component, setComponent] = useState(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}));
|
|
2000
|
+
const setDayValue = useCallback((value) => {
|
|
2001
|
+
formControl ? formControl.setValue(value) : setValue(value);
|
|
2002
|
+
}, [formControl]);
|
|
2003
|
+
const onSelect = useCallback((value) => {
|
|
2004
|
+
setDayValue(value);
|
|
2005
|
+
onValue && onValue(value);
|
|
2006
|
+
}, [setDayValue, onValue]);
|
|
2000
2007
|
useEffect(() => {
|
|
2001
2008
|
return i18nSubscribe(() => {
|
|
2002
2009
|
setHeaders(jsxRuntimeExports.jsx(RlsPickerDayHeaders, {}));
|
|
2003
2010
|
});
|
|
2004
2011
|
}, []);
|
|
2005
2012
|
useEffect(() => {
|
|
2006
|
-
setComponent(jsxRuntimeExports.jsx("div", { className: "rls-picker-day__component", children: weeks.map(({ days }, index) => (jsxRuntimeExports.jsx("div", { className: "rls-picker-day__week", children: days.map((day, index) => (jsxRuntimeExports.jsx(
|
|
2007
|
-
}, [weeks]);
|
|
2013
|
+
setComponent(jsxRuntimeExports.jsx("div", { className: "rls-picker-day__component", children: weeks.map(({ days }, index) => (jsxRuntimeExports.jsx("div", { className: "rls-picker-day__week", children: days.map((day, index) => (jsxRuntimeExports.jsx(RlsPickerDayElement, { day: day, onSelect: onSelect, disabled: disabled }, index))) }, index))) }));
|
|
2014
|
+
}, [weeks, onSelect, disabled]);
|
|
2008
2015
|
useEffect(() => {
|
|
2009
2016
|
const options = createPickerOptions();
|
|
2010
2017
|
const day = verifyDayPicker(options);
|
|
@@ -2026,13 +2033,6 @@ function RlsPickerDay({ date: _date, disabled, formControl, maxDate, month, minD
|
|
|
2026
2033
|
maxDate
|
|
2027
2034
|
};
|
|
2028
2035
|
}, [date, formControl?.value, value, month, year, minDate, maxDate]);
|
|
2029
|
-
const setDayValue = useCallback((value) => {
|
|
2030
|
-
formControl ? formControl.setValue(value) : setValue(value);
|
|
2031
|
-
}, [formControl]);
|
|
2032
|
-
const onSelect = useCallback((value) => {
|
|
2033
|
-
setDayValue(value);
|
|
2034
|
-
onValue && onValue(value);
|
|
2035
|
-
}, [setDayValue, onValue]);
|
|
2036
2036
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-day", "rls-theme": rlsTheme, children: [headers, component] }));
|
|
2037
2037
|
}
|
|
2038
2038
|
|
|
@@ -2040,7 +2040,7 @@ const formatRange = '{dd}/{mx}/{aa}';
|
|
|
2040
2040
|
function RlsPickerDayRangeHeaders() {
|
|
2041
2041
|
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-day__header", children: DAY_LABELS().map((title, index) => (jsxRuntimeExports.jsx("label", { className: "rls-picker-day__label", children: title }, index))) }));
|
|
2042
2042
|
}
|
|
2043
|
-
function
|
|
2043
|
+
function RlsPickerDayRangeElement({ day, onSelect, disabled }) {
|
|
2044
2044
|
const className = useMemo(() => {
|
|
2045
2045
|
return renderClassStatus('rls-picker-day-range__element', {
|
|
2046
2046
|
disabled: day.disabled || disabled,
|
|
@@ -2067,14 +2067,23 @@ function RlsPickerDayRange({ date: _date, disabled, formControl, maxDate, minDat
|
|
|
2067
2067
|
const [range, setRange] = useState(_range);
|
|
2068
2068
|
const [headers, setHeaders] = useState(jsxRuntimeExports.jsx(RlsPickerDayRangeHeaders, {}));
|
|
2069
2069
|
const [component, setComponent] = useState(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}));
|
|
2070
|
+
const onSelect = useCallback((value) => {
|
|
2071
|
+
const _date = assignDayInDate(date, value);
|
|
2072
|
+
const range = dateIsBefore(_date, sourceDate.current)
|
|
2073
|
+
? new DateRange(sourceDate.current, _date)
|
|
2074
|
+
: new DateRange(_date, sourceDate.current);
|
|
2075
|
+
sourceDate.current = _date;
|
|
2076
|
+
setRange(range);
|
|
2077
|
+
formControl?.setValue(range);
|
|
2078
|
+
}, [date, sourceDate.current, formControl]);
|
|
2070
2079
|
useEffect(() => {
|
|
2071
2080
|
return i18nSubscribe(() => {
|
|
2072
2081
|
setHeaders(jsxRuntimeExports.jsx(RlsPickerDayRangeHeaders, {}));
|
|
2073
2082
|
});
|
|
2074
2083
|
}, []);
|
|
2075
2084
|
useEffect(() => {
|
|
2076
|
-
setComponent(jsxRuntimeExports.jsx("div", { className: "rls-picker-day-range__component", children: weeks.map(({ days }, index) => (jsxRuntimeExports.jsx("div", { className: "rls-picker-day-range__week", children: days.map((day, index) => (jsxRuntimeExports.jsx(
|
|
2077
|
-
}, [weeks]);
|
|
2085
|
+
setComponent(jsxRuntimeExports.jsx("div", { className: "rls-picker-day-range__component", children: weeks.map(({ days }, index) => (jsxRuntimeExports.jsx("div", { className: "rls-picker-day-range__week", children: days.map((day, index) => (jsxRuntimeExports.jsx(RlsPickerDayRangeElement, { day: day, onSelect: onSelect, disabled: disabled }, index))) }, index))) }));
|
|
2086
|
+
}, [weeks, onSelect, disabled]);
|
|
2078
2087
|
useEffect(() => {
|
|
2079
2088
|
setWeeks(createDayRangePicker({
|
|
2080
2089
|
date,
|
|
@@ -2087,19 +2096,10 @@ function RlsPickerDayRange({ date: _date, disabled, formControl, maxDate, minDat
|
|
|
2087
2096
|
const title = useMemo(() => {
|
|
2088
2097
|
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-day-range__title", children: dateFormatTemplate(sourceDate.current, formatRange) }));
|
|
2089
2098
|
}, [sourceDate.current]);
|
|
2090
|
-
const onSelect = useCallback((value) => {
|
|
2091
|
-
const _date = assignDayInDate(date, value);
|
|
2092
|
-
const range = dateIsBefore(_date, sourceDate.current)
|
|
2093
|
-
? new DateRange(sourceDate.current, _date)
|
|
2094
|
-
: new DateRange(_date, sourceDate.current);
|
|
2095
|
-
sourceDate.current = _date;
|
|
2096
|
-
setRange(range);
|
|
2097
|
-
formControl?.setValue(range);
|
|
2098
|
-
}, [date, sourceDate.current, formControl]);
|
|
2099
2099
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-day-range", "rls-theme": rlsTheme, children: [title, headers, component] }));
|
|
2100
2100
|
}
|
|
2101
2101
|
|
|
2102
|
-
function
|
|
2102
|
+
function RlsPickerMonthElement({ month, onSelect, disabled }) {
|
|
2103
2103
|
const [label, setLabel] = useState(MONTH_NAMES(month.value));
|
|
2104
2104
|
useEffect(() => {
|
|
2105
2105
|
return i18nSubscribe(() => {
|
|
@@ -2126,9 +2126,16 @@ function RlsPickerMonth({ date: _date, disabled, formControl, maxDate, minDate,
|
|
|
2126
2126
|
const [months, setMonths] = useState([]);
|
|
2127
2127
|
const [value, setValue] = useState(formControl?.value ?? date.getMonth());
|
|
2128
2128
|
const [component, setComponent] = useState(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}));
|
|
2129
|
+
const setMonthValue = useCallback((value) => {
|
|
2130
|
+
formControl ? formControl.setValue(value) : setValue(value);
|
|
2131
|
+
}, [formControl]);
|
|
2132
|
+
const onSelect = useCallback((value) => {
|
|
2133
|
+
setMonthValue(value);
|
|
2134
|
+
onValue && onValue(value);
|
|
2135
|
+
}, [setMonthValue, onValue]);
|
|
2129
2136
|
useEffect(() => {
|
|
2130
|
-
setComponent(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: months.map((month, index) => (jsxRuntimeExports.jsx(
|
|
2131
|
-
}, [months]);
|
|
2137
|
+
setComponent(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: months.map((month, index) => (jsxRuntimeExports.jsx(RlsPickerMonthElement, { month: month, onSelect: onSelect, disabled: disabled }, index))) }));
|
|
2138
|
+
}, [months, onSelect, disabled]);
|
|
2132
2139
|
useEffect(() => {
|
|
2133
2140
|
const options = {
|
|
2134
2141
|
date,
|
|
@@ -2154,13 +2161,6 @@ function RlsPickerMonth({ date: _date, disabled, formControl, maxDate, minDate,
|
|
|
2154
2161
|
? formControl?.setValue(month)
|
|
2155
2162
|
: setValue(formControl?.value ?? date.getMonth());
|
|
2156
2163
|
}, [formControl?.value]);
|
|
2157
|
-
const setMonthValue = useCallback((value) => {
|
|
2158
|
-
formControl ? formControl.setValue(value) : setValue(value);
|
|
2159
|
-
}, [formControl]);
|
|
2160
|
-
const onSelect = useCallback((value) => {
|
|
2161
|
-
setMonthValue(value);
|
|
2162
|
-
onValue && onValue(value);
|
|
2163
|
-
}, [setMonthValue, onValue]);
|
|
2164
2164
|
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-month", "rls-theme": rlsTheme, children: component }));
|
|
2165
2165
|
}
|
|
2166
2166
|
|
|
@@ -2221,7 +2221,7 @@ function RlsPickerSelectorTitle({ monthControl, type, yearControl, date, disable
|
|
|
2221
2221
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-selector-title", children: [jsxRuntimeExports.jsx(RlsButtonAction, { icon: "arrow-ios-left", onClick: onPrevious, disabled: limitPrevious || disabled }), jsxRuntimeExports.jsx("span", { onClick: onClick, children: label }), jsxRuntimeExports.jsx(RlsButtonAction, { icon: "arrow-ios-right", onClick: onNext, disabled: limitNext || disabled })] }));
|
|
2222
2222
|
}
|
|
2223
2223
|
|
|
2224
|
-
function
|
|
2224
|
+
function RlsPickerYearElement({ onSelect, year, disabled }) {
|
|
2225
2225
|
const className = useMemo(() => {
|
|
2226
2226
|
return renderClassStatus('rls-picker-year__element', {
|
|
2227
2227
|
disabled: year.disabled || disabled,
|
|
@@ -2248,34 +2248,34 @@ function RlsPickerYear({ date: _date, disabled, formControl, maxDate, minDate, o
|
|
|
2248
2248
|
};
|
|
2249
2249
|
}, [date, year, minDate, maxDate]);
|
|
2250
2250
|
const [template, setTemplate] = useState(createYearPicker(createPickerOptions()));
|
|
2251
|
+
const setYearValue = useCallback((value) => {
|
|
2252
|
+
formControl ? formControl.setValue(value) : setValue(value);
|
|
2253
|
+
setYear(value);
|
|
2254
|
+
}, [formControl]);
|
|
2255
|
+
const onSelect = useCallback((value) => {
|
|
2256
|
+
setYearValue(value);
|
|
2257
|
+
onValue && onValue(value);
|
|
2258
|
+
}, [setYearValue, onValue]);
|
|
2251
2259
|
useEffect(() => {
|
|
2252
2260
|
const options = createPickerOptions(); // YearPickerProps
|
|
2253
2261
|
const year = verifyYearPicker(options);
|
|
2254
2262
|
year ? setYearValue(year) : setTemplate(createYearPicker(options));
|
|
2255
2263
|
}, [date, year, value, minDate, maxDate]);
|
|
2256
2264
|
useEffect(() => {
|
|
2257
|
-
setComponent(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: template.years.map((year, index) => (jsxRuntimeExports.jsx(
|
|
2258
|
-
}, [template.years]);
|
|
2265
|
+
setComponent(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: template.years.map((year, index) => (jsxRuntimeExports.jsx(RlsPickerYearElement, { year: year, onSelect: onSelect, disabled: disabled }, index))) }));
|
|
2266
|
+
}, [template.years, onSelect, disabled]);
|
|
2259
2267
|
useEffect(() => {
|
|
2260
2268
|
const year = verifyYearPicker(createPickerOptions());
|
|
2261
2269
|
itIsDefined(year)
|
|
2262
2270
|
? formControl?.setValue(year)
|
|
2263
2271
|
: setValue(formControl?.value ?? date.getFullYear());
|
|
2264
2272
|
}, [formControl?.value]);
|
|
2265
|
-
const setYearValue = useCallback((value) => {
|
|
2266
|
-
formControl ? formControl.setValue(value) : setValue(value);
|
|
2267
|
-
setYear(value);
|
|
2268
|
-
}, [formControl]);
|
|
2269
2273
|
const onClickPrev = useCallback(() => {
|
|
2270
2274
|
setYear((year) => year - 8);
|
|
2271
2275
|
}, []);
|
|
2272
2276
|
const onClickNext = useCallback(() => {
|
|
2273
2277
|
setYear((year) => year + 8);
|
|
2274
2278
|
}, []);
|
|
2275
|
-
const onSelect = useCallback((value) => {
|
|
2276
|
-
setYearValue(value);
|
|
2277
|
-
onValue && onValue(value);
|
|
2278
|
-
}, [setYearValue, onValue]);
|
|
2279
2279
|
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-year", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-year__header", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-year__action rls-picker-year__action--prev", children: jsxRuntimeExports.jsx(RlsButtonAction, { icon: "arrow-ios-left", onClick: onClickPrev, disabled: !template.canPrevious || disabled }) }), jsxRuntimeExports.jsxs("label", { className: "rls-title-bold", children: [template.minRange, " - ", template.maxRange] }), jsxRuntimeExports.jsx("div", { className: "rls-picker-year__action rls-picker-year__action--next", children: jsxRuntimeExports.jsx(RlsButtonAction, { icon: "arrow-ios-right", onClick: onClickNext, disabled: !template.canNext || disabled }) })] }), jsxRuntimeExports.jsx("div", { className: "rls-picker-year__component", children: component })] }));
|
|
2280
2280
|
}
|
|
2281
2281
|
|
|
@@ -2448,23 +2448,23 @@ function calculateMinHeightList(count, height) {
|
|
|
2448
2448
|
}
|
|
2449
2449
|
function useListController(props) {
|
|
2450
2450
|
const { count, suggestions, automatic, formControl, lineHeight, reference } = props;
|
|
2451
|
+
const refContent = useRef(null);
|
|
2452
|
+
const refList = useRef(null);
|
|
2453
|
+
const refInput = useRef(null);
|
|
2451
2454
|
const listIsOpen = useRef(false);
|
|
2452
|
-
const contentRef = useRef(null);
|
|
2453
|
-
const listRef = useRef(null);
|
|
2454
|
-
const inputRef = useRef(null);
|
|
2455
2455
|
const [collection, setCollection] = useState(new ListCollection(suggestions));
|
|
2456
2456
|
const [state, refreshState] = useState({
|
|
2457
2457
|
focused: false,
|
|
2458
2458
|
higher: false,
|
|
2459
|
-
|
|
2460
|
-
|
|
2459
|
+
modalIsVisible: false,
|
|
2460
|
+
value: ''
|
|
2461
2461
|
});
|
|
2462
|
+
const changeValueInternal = useRef(false);
|
|
2462
2463
|
const position = useRef(0);
|
|
2463
2464
|
const valueProtected = useRef();
|
|
2464
|
-
const changeValueInternal = useRef(false);
|
|
2465
2465
|
useEffect(() => {
|
|
2466
2466
|
function onCloseSuggestions({ target }) {
|
|
2467
|
-
!
|
|
2467
|
+
!refContent?.current?.contains(target) &&
|
|
2468
2468
|
refreshState((state) => ({ ...state, modalIsVisible: false }));
|
|
2469
2469
|
}
|
|
2470
2470
|
document.addEventListener('click', onCloseSuggestions);
|
|
@@ -2514,7 +2514,7 @@ function useListController(props) {
|
|
|
2514
2514
|
const _state = state.modalIsVisible
|
|
2515
2515
|
? {
|
|
2516
2516
|
...state,
|
|
2517
|
-
higher: locationListCanTop(
|
|
2517
|
+
higher: locationListCanTop(refContent.current, refList.current, minHeightList)
|
|
2518
2518
|
}
|
|
2519
2519
|
: state;
|
|
2520
2520
|
refreshState((state) => ({ ...state, ..._state }));
|
|
@@ -2532,29 +2532,29 @@ function useListController(props) {
|
|
|
2532
2532
|
const navigationInput = useCallback((event) => {
|
|
2533
2533
|
if (state.modalIsVisible) {
|
|
2534
2534
|
const _position = navigationListFromInput({
|
|
2535
|
-
content:
|
|
2535
|
+
content: refContent.current,
|
|
2536
2536
|
event: event,
|
|
2537
|
-
list:
|
|
2537
|
+
list: refList.current
|
|
2538
2538
|
});
|
|
2539
2539
|
position.current = _position ?? 0;
|
|
2540
2540
|
}
|
|
2541
2541
|
}, [state.modalIsVisible]);
|
|
2542
2542
|
const navigationElement = useCallback((event) => {
|
|
2543
2543
|
position.current = navigationListFromElement({
|
|
2544
|
-
content:
|
|
2544
|
+
content: refContent.current,
|
|
2545
2545
|
event: event,
|
|
2546
|
-
input:
|
|
2547
|
-
list:
|
|
2546
|
+
input: refInput.current,
|
|
2547
|
+
list: refList.current,
|
|
2548
2548
|
position: position.current
|
|
2549
2549
|
});
|
|
2550
2550
|
}, [state.modalIsVisible]);
|
|
2551
2551
|
return {
|
|
2552
2552
|
...state,
|
|
2553
|
-
contentRef,
|
|
2554
|
-
inputRef,
|
|
2555
|
-
listRef,
|
|
2556
2553
|
navigationElement,
|
|
2557
2554
|
navigationInput,
|
|
2555
|
+
refContent,
|
|
2556
|
+
refInput,
|
|
2557
|
+
refList,
|
|
2558
2558
|
setFormValue,
|
|
2559
2559
|
setState
|
|
2560
2560
|
};
|
|
@@ -2593,6 +2593,9 @@ function useFieldAutocomplete(props) {
|
|
|
2593
2593
|
useEffect(() => {
|
|
2594
2594
|
refreshCoincidences(props.suggestions, pattern);
|
|
2595
2595
|
}, [pattern]);
|
|
2596
|
+
useEffect(() => {
|
|
2597
|
+
props.disabled && controller.setState({ focused: false });
|
|
2598
|
+
}, [props.disabled]);
|
|
2596
2599
|
const onFocusInput = useCallback(() => {
|
|
2597
2600
|
controller.setState({ focused: true });
|
|
2598
2601
|
}, [controller.setState]);
|
|
@@ -2613,7 +2616,7 @@ function useFieldAutocomplete(props) {
|
|
|
2613
2616
|
const onClickControl = useCallback(() => {
|
|
2614
2617
|
controller.setState({ modalIsVisible: true });
|
|
2615
2618
|
setTimeout(() => {
|
|
2616
|
-
controller.
|
|
2619
|
+
controller.refInput?.current?.focus();
|
|
2617
2620
|
}, DURATION_ANIMATION$1);
|
|
2618
2621
|
}, [controller.setState]);
|
|
2619
2622
|
const onClickAction = useCallback(() => {
|
|
@@ -2643,7 +2646,7 @@ function useFieldAutocomplete(props) {
|
|
|
2643
2646
|
}
|
|
2644
2647
|
if (props.selectionContinuos) {
|
|
2645
2648
|
setPattern('');
|
|
2646
|
-
controller.
|
|
2649
|
+
controller.refInput?.current?.focus();
|
|
2647
2650
|
}
|
|
2648
2651
|
else {
|
|
2649
2652
|
controller.setState({ modalIsVisible: false });
|
|
@@ -2729,7 +2732,7 @@ function RlsFieldAutocompleteTemplate(props) {
|
|
|
2729
2732
|
event.key === 'Enter' && onSearch && onSearch(autocomplete.pattern);
|
|
2730
2733
|
autocomplete.onKeydownInput(event);
|
|
2731
2734
|
}, [autocomplete.onKeydownInput, onSearch, autocomplete.pattern]);
|
|
2732
|
-
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: autocomplete.
|
|
2735
|
+
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: autocomplete.refContent, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { className: "rls-field-list__control", readOnly: true, disabled: disabled, placeholder: placeholder, value: autocomplete.value, onClick: autocomplete.onClickControl }), jsxRuntimeExports.jsx("button", { className: "rls-field-list__action", disabled: disabled, onClick: autocomplete.onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: autocomplete.value ? 'trash-2' : 'arrow-ios-down' }) })] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })), jsxRuntimeExports.jsxs("div", { className: classNameList, children: [jsxRuntimeExports.jsx("div", { className: "rls-field-list__suggestions__body", children: jsxRuntimeExports.jsxs("ul", { ref: autocomplete.refList, className: "rls-field-list__ul", children: [jsxRuntimeExports.jsxs("div", { className: "rls-field-list__ul__search", children: [jsxRuntimeExports.jsx("input", { ref: autocomplete.refInput, className: "rls-field-list__ul__control", type: "text", placeholder: labels.listInputPlaceholder, value: autocomplete.pattern, onChange: onChangePattern, onFocus: autocomplete.onFocusInput, onBlur: autocomplete.onBlurInput, onKeyDown: onKeyDownPattern, disabled: disabled || searching }), onSearch && (jsxRuntimeExports.jsx("button", { disabled: disabled || searching, onClick: onClickPattern, children: jsxRuntimeExports.jsx(RlsIcon, { value: "search" }) }))] }), searching && jsxRuntimeExports.jsx(RlsProgressBar, { indeterminate: true }), autocomplete.coincidences.map((element, index) => (jsxRuntimeExports.jsx("li", { className: "rls-field-list__element", tabIndex: -1, onClick: autocomplete.onClickElement(element), onKeyDown: autocomplete.onKeydownElement(element), children: render(element) }, index))), !autocomplete.coincidences.length && (jsxRuntimeExports.jsx("li", { className: "rls-field-list__empty", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-list__empty__description", children: [jsxRuntimeExports.jsx("label", { className: "rls-label-bold rls-truncate", children: labels.listEmptyTitle }), jsxRuntimeExports.jsx("p", { className: "rls-caption-regular", children: labels.listEmptyDescription })] }) }))] }) }), jsxRuntimeExports.jsx("div", { className: "rls-field-list__backdrop", onClick: autocomplete.onClickBackdrop })] })] }));
|
|
2733
2736
|
}
|
|
2734
2737
|
function RlsFieldAutocomplete(props) {
|
|
2735
2738
|
const render = useCallback((element) => (jsxRuntimeExports.jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: jsxRuntimeExports.jsx("span", { children: element.title }) })), []);
|
|
@@ -2993,6 +2996,9 @@ function useFieldSelect(props) {
|
|
|
2993
2996
|
useEffect(() => {
|
|
2994
2997
|
count.current = props.suggestions.length;
|
|
2995
2998
|
}, [props.suggestions]);
|
|
2999
|
+
useEffect(() => {
|
|
3000
|
+
props.disabled && controller.setState({ focused: false });
|
|
3001
|
+
}, [props.disabled]);
|
|
2996
3002
|
const onFocusInput = useCallback(() => {
|
|
2997
3003
|
controller.setState({ focused: true });
|
|
2998
3004
|
}, [controller.setState]);
|
|
@@ -3027,7 +3033,7 @@ function useFieldSelect(props) {
|
|
|
3027
3033
|
else {
|
|
3028
3034
|
const modalIsVisible = !controller.modalIsVisible;
|
|
3029
3035
|
controller.setState({ modalIsVisible });
|
|
3030
|
-
modalIsVisible && controller.
|
|
3036
|
+
modalIsVisible && controller.refInput?.current?.focus();
|
|
3031
3037
|
}
|
|
3032
3038
|
}, [
|
|
3033
3039
|
controller.modalIsVisible,
|
|
@@ -3041,7 +3047,7 @@ function useFieldSelect(props) {
|
|
|
3041
3047
|
controller.setState({ modalIsVisible: false });
|
|
3042
3048
|
}, [controller.setState]);
|
|
3043
3049
|
const onChange = useCallback((element) => {
|
|
3044
|
-
controller.
|
|
3050
|
+
!props.disabled && controller.refInput?.current?.focus();
|
|
3045
3051
|
if (props.onSelect) {
|
|
3046
3052
|
controller.setState({ modalIsVisible: false });
|
|
3047
3053
|
element.value && props.onSelect(element.value);
|
|
@@ -3055,7 +3061,8 @@ function useFieldSelect(props) {
|
|
|
3055
3061
|
controller.setState,
|
|
3056
3062
|
controller.setFormValue,
|
|
3057
3063
|
props.onSelect,
|
|
3058
|
-
props.onValue
|
|
3064
|
+
props.onValue,
|
|
3065
|
+
props.disabled
|
|
3059
3066
|
]);
|
|
3060
3067
|
const onClickElement = useCallback((element) => {
|
|
3061
3068
|
return () => {
|
|
@@ -3102,9 +3109,9 @@ function RlsFieldSelectTemplate(props) {
|
|
|
3102
3109
|
}, [formControl?.disabled, props.disabled]);
|
|
3103
3110
|
const className = useMemo(() => {
|
|
3104
3111
|
return renderClassStatus('rls-field-box', {
|
|
3105
|
-
|
|
3112
|
+
focused: select.focused && !disabled,
|
|
3106
3113
|
error: formControl?.wrong,
|
|
3107
|
-
|
|
3114
|
+
disabled: disabled
|
|
3108
3115
|
}, 'rls-field-list rls-field-select');
|
|
3109
3116
|
}, [formControl?.wrong, select.focused, disabled]);
|
|
3110
3117
|
const classNameList = useMemo(() => {
|
|
@@ -3113,7 +3120,7 @@ function RlsFieldSelectTemplate(props) {
|
|
|
3113
3120
|
visible: select.modalIsVisible
|
|
3114
3121
|
});
|
|
3115
3122
|
}, [select.modalIsVisible, select.higher]);
|
|
3116
|
-
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: select.
|
|
3123
|
+
return (jsxRuntimeExports.jsxs("div", { id: props.identifier, ref: select.refContent, className: className, "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { ref: select.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 }), jsxRuntimeExports.jsx("button", { className: 'rls-field-list__action', disabled: disabled, onClick: select.onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: !unremovable && !!select.value ? 'close' : 'arrow-ios-down' }) })] }) }), !msgErrorDisabled && (jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })), jsxRuntimeExports.jsxs("div", { className: classNameList, children: [jsxRuntimeExports.jsx("div", { className: "rls-field-list__suggestions__body", children: jsxRuntimeExports.jsxs("ul", { ref: select.refList, className: "rls-field-list__ul", children: [suggestions.map((element, index) => (jsxRuntimeExports.jsx("li", { className: "rls-field-list__element", tabIndex: -1, onClick: select.onClickElement(element), onKeyDown: select.onKeydownElement(element), children: render(element) }, index))), !suggestions.length && (jsxRuntimeExports.jsx("li", { className: "rls-field-list__empty", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-list__empty__description", children: [jsxRuntimeExports.jsx("label", { className: "rls-label-bold rls-truncate", children: labels.listEmptyTitle }), jsxRuntimeExports.jsx("p", { className: "rls-caption-regular", children: labels.listEmptyDescription })] }) }))] }) }), jsxRuntimeExports.jsx("div", { className: "rls-field-list__backdrop", onClick: select.onClickBackdrop })] })] }));
|
|
3117
3124
|
}
|
|
3118
3125
|
function RlsFieldSelect(props) {
|
|
3119
3126
|
const render = useCallback((element) => (jsxRuntimeExports.jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: jsxRuntimeExports.jsx("span", { children: element.title }) })), []);
|