@rolster/react-components 18.13.4 → 18.14.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.
Files changed (107) hide show
  1. package/dist/cjs/assets/{index-LjAadYQE.css → index-L7r-Teuk.css} +413 -421
  2. package/dist/cjs/index.js +1089 -1059
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/es/assets/{index-LjAadYQE.css → index-L7r-Teuk.css} +413 -421
  5. package/dist/es/index.js +1070 -1040
  6. package/dist/es/index.js.map +1 -1
  7. package/dist/esm/components/atoms/Input/Input.css +2 -2
  8. package/dist/esm/components/atoms/Input/Input.js +1 -8
  9. package/dist/esm/components/atoms/Input/Input.js.map +1 -1
  10. package/dist/esm/components/atoms/InputMoney/InputMoney.css +0 -2
  11. package/dist/esm/components/atoms/InputNumber/InputNumber.css +0 -2
  12. package/dist/esm/components/atoms/InputPassword/InputPassword.css +0 -2
  13. package/dist/esm/components/atoms/InputText/InputText.css +0 -2
  14. package/dist/esm/components/molecules/FieldMoney/FieldMoney.css +6 -0
  15. package/dist/esm/components/molecules/{MoneyField/MoneyField.d.ts → FieldMoney/FieldMoney.d.ts} +3 -3
  16. package/dist/esm/components/molecules/{MoneyField/MoneyField.js → FieldMoney/FieldMoney.js} +5 -5
  17. package/dist/esm/components/molecules/{MoneyField/MoneyField.js.map → FieldMoney/FieldMoney.js.map} +1 -1
  18. package/dist/esm/components/molecules/FieldNumber/FieldNumber.css +6 -0
  19. package/dist/esm/components/molecules/{NumberField/NumberField.d.ts → FieldNumber/FieldNumber.d.ts} +3 -3
  20. package/dist/esm/components/molecules/{NumberField/NumberField.js → FieldNumber/FieldNumber.js} +5 -5
  21. package/dist/esm/components/molecules/{NumberField/NumberField.js.map → FieldNumber/FieldNumber.js.map} +1 -1
  22. package/dist/esm/components/molecules/{PasswordField/PasswordField.css → FieldPassword/FieldPassword.css} +3 -3
  23. package/dist/esm/components/molecules/{PasswordField/PasswordField.d.ts → FieldPassword/FieldPassword.d.ts} +3 -3
  24. package/dist/esm/components/molecules/{PasswordField/PasswordField.js → FieldPassword/FieldPassword.js} +5 -5
  25. package/dist/esm/components/molecules/{PasswordField/PasswordField.js.map → FieldPassword/FieldPassword.js.map} +1 -1
  26. package/dist/esm/components/molecules/FieldText/FieldText.css +6 -0
  27. package/dist/esm/components/molecules/{TextField/TextField.d.ts → FieldText/FieldText.d.ts} +3 -3
  28. package/dist/esm/components/molecules/{TextField/TextField.js → FieldText/FieldText.js} +5 -5
  29. package/dist/esm/components/molecules/{TextField/TextField.js.map → FieldText/FieldText.js.map} +1 -1
  30. package/dist/esm/components/molecules/{CheckBoxLabel/CheckBoxLabel.css → LabelCheckBox/LabelCheckBox.css} +5 -5
  31. package/dist/esm/components/molecules/{CheckBoxLabel/CheckBoxLabel.d.ts → LabelCheckBox/LabelCheckBox.d.ts} +3 -3
  32. package/dist/esm/components/molecules/{CheckBoxLabel/CheckBoxLabel.js → LabelCheckBox/LabelCheckBox.js} +5 -5
  33. package/dist/esm/components/molecules/{CheckBoxLabel/CheckBoxLabel.js.map → LabelCheckBox/LabelCheckBox.js.map} +1 -1
  34. package/dist/esm/components/molecules/{RadioButtonLabel/RadioButtonLabel.css → LabelRadioButton/LabelRadioButton.css} +5 -5
  35. package/dist/esm/components/molecules/{RadioButtonLabel/RadioButtonLabel.d.ts → LabelRadioButton/LabelRadioButton.d.ts} +3 -3
  36. package/dist/esm/components/molecules/{RadioButtonLabel/RadioButtonLabel.js → LabelRadioButton/LabelRadioButton.js} +5 -5
  37. package/dist/esm/components/molecules/{RadioButtonLabel/RadioButtonLabel.js.map → LabelRadioButton/LabelRadioButton.js.map} +1 -1
  38. package/dist/esm/components/molecules/{SwitchLabel/SwitchLabel.css → LabelSwitch/LabelSwitch.css} +5 -5
  39. package/dist/esm/components/molecules/{SwitchLabel/SwitchLabel.d.ts → LabelSwitch/LabelSwitch.d.ts} +3 -3
  40. package/dist/esm/components/molecules/{SwitchLabel/SwitchLabel.js → LabelSwitch/LabelSwitch.js} +4 -4
  41. package/dist/esm/components/molecules/{SwitchLabel/SwitchLabel.js.map → LabelSwitch/LabelSwitch.js.map} +1 -1
  42. package/dist/esm/components/molecules/{DayPicker/DayPicker.css → PickerDay/PickerDay.css} +13 -13
  43. package/dist/esm/components/molecules/{DayPicker/DayPicker.d.ts → PickerDay/PickerDay.d.ts} +3 -3
  44. package/dist/esm/components/molecules/{DayPicker/DayPicker.js → PickerDay/PickerDay.js} +5 -5
  45. package/dist/esm/components/molecules/{DayPicker/DayPicker.js.map → PickerDay/PickerDay.js.map} +1 -1
  46. package/dist/esm/components/molecules/{DayRangePicker/DayRangePicker.css → PickerDayRange/PickerDayRange.css} +14 -14
  47. package/dist/esm/components/molecules/{DayRangePicker/DayRangePicker.d.ts → PickerDayRange/PickerDayRange.d.ts} +3 -3
  48. package/dist/esm/components/molecules/{DayRangePicker/DayRangePicker.js → PickerDayRange/PickerDayRange.js} +5 -5
  49. package/dist/esm/components/molecules/{DayRangePicker/DayRangePicker.js.map → PickerDayRange/PickerDayRange.js.map} +1 -1
  50. package/dist/esm/components/molecules/{MonthPicker/MonthPicker.css → PickerMonth/PickerMonth.css} +8 -8
  51. package/dist/esm/components/molecules/{MonthPicker/MonthPicker.d.ts → PickerMonth/PickerMonth.d.ts} +3 -3
  52. package/dist/esm/components/molecules/{MonthPicker/MonthPicker.js → PickerMonth/PickerMonth.js} +5 -5
  53. package/dist/esm/components/molecules/{MonthPicker/MonthPicker.js.map → PickerMonth/PickerMonth.js.map} +1 -1
  54. package/dist/esm/components/molecules/{MonthTitlePicker/MonthTitlePicker.css → PickerMonthTitle/PickerMonthTitle.css} +3 -3
  55. package/dist/esm/components/molecules/PickerMonthTitle/PickerMonthTitle.d.ts +15 -0
  56. package/dist/esm/components/molecules/{MonthTitlePicker/MonthTitlePicker.js → PickerMonthTitle/PickerMonthTitle.js} +5 -5
  57. package/dist/esm/components/molecules/{MonthTitlePicker/MonthTitlePicker.js.map → PickerMonthTitle/PickerMonthTitle.js.map} +1 -1
  58. package/dist/esm/components/molecules/{YearPicker/YearPicker.css → PickerYear/PickerYear.css} +14 -14
  59. package/dist/esm/components/molecules/{YearPicker/YearPicker.d.ts → PickerYear/PickerYear.d.ts} +3 -3
  60. package/dist/esm/components/molecules/{YearPicker/YearPicker.js → PickerYear/PickerYear.js} +5 -5
  61. package/dist/esm/components/molecules/{YearPicker/YearPicker.js.map → PickerYear/PickerYear.js.map} +1 -1
  62. package/dist/esm/components/molecules/index.d.ts +12 -12
  63. package/dist/esm/components/molecules/index.js +12 -12
  64. package/dist/esm/components/molecules/index.js.map +1 -1
  65. package/dist/esm/components/organisms/{AutocompleteField/AutocompleteField.css → FieldAutocomplete/FieldAutocomplete.css} +15 -15
  66. package/dist/esm/components/organisms/{AutocompleteField/AutocompleteField.d.ts → FieldAutocomplete/FieldAutocomplete.d.ts} +5 -5
  67. package/dist/esm/components/organisms/{AutocompleteField/AutocompleteField.js → FieldAutocomplete/FieldAutocomplete.js} +11 -11
  68. package/dist/esm/components/organisms/{AutocompleteField/AutocompleteField.js.map → FieldAutocomplete/FieldAutocomplete.js.map} +1 -1
  69. package/dist/esm/components/organisms/{AutocompleteField/AutocompleteFieldHook.d.ts → FieldAutocomplete/FieldAutocompleteHook.d.ts} +3 -3
  70. package/dist/esm/components/organisms/{AutocompleteField/AutocompleteFieldHook.js → FieldAutocomplete/FieldAutocompleteHook.js} +43 -21
  71. package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteHook.js.map +1 -0
  72. package/dist/esm/components/organisms/{DateField/DateField.css → FieldDate/FieldDate.css} +8 -8
  73. package/dist/esm/components/organisms/{DateField/DateField.d.ts → FieldDate/FieldDate.d.ts} +3 -3
  74. package/dist/esm/components/organisms/{DateField/DateField.js → FieldDate/FieldDate.js} +5 -5
  75. package/dist/esm/components/organisms/{DateField/DateField.js.map → FieldDate/FieldDate.js.map} +1 -1
  76. package/dist/esm/components/organisms/{DateRangeField/DateRangeField.css → FieldDateRange/FieldDateRange.css} +6 -6
  77. package/dist/esm/components/organisms/{DateRangeField/DateRangeField.d.ts → FieldDateRange/FieldDateRange.d.ts} +3 -3
  78. package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.js +33 -0
  79. package/dist/esm/components/organisms/{DateRangeField/DateRangeField.js.map → FieldDateRange/FieldDateRange.js.map} +1 -1
  80. package/dist/esm/components/organisms/FieldSelect/FieldSelect.css +10 -0
  81. package/dist/esm/components/organisms/{SelectField/SelectField.d.ts → FieldSelect/FieldSelect.d.ts} +5 -5
  82. package/dist/esm/components/organisms/{SelectField/SelectField.js → FieldSelect/FieldSelect.js} +10 -10
  83. package/dist/esm/components/organisms/FieldSelect/FieldSelect.js.map +1 -0
  84. package/dist/esm/components/organisms/{SelectField/SelectFieldHook.d.ts → FieldSelect/FieldSelectHook.d.ts} +3 -3
  85. package/dist/esm/components/organisms/{SelectField/SelectFieldHook.js → FieldSelect/FieldSelectHook.js} +30 -15
  86. package/dist/esm/components/organisms/FieldSelect/FieldSelectHook.js.map +1 -0
  87. package/dist/esm/components/organisms/{DatePicker/DatePicker.css → PickerDate/PickerDate.css} +17 -17
  88. package/dist/esm/components/organisms/{DatePicker/DatePicker.d.ts → PickerDate/PickerDate.d.ts} +3 -3
  89. package/dist/esm/components/organisms/{DatePicker/DatePicker.js → PickerDate/PickerDate.js} +6 -6
  90. package/dist/esm/components/organisms/{DatePicker/DatePicker.js.map → PickerDate/PickerDate.js.map} +1 -1
  91. package/dist/esm/components/organisms/{DateRangePicker/DateRangePicker.css → PickerDateRange/PickerDateRange.css} +16 -16
  92. package/dist/esm/components/organisms/{DateRangePicker/DateRangePicker.d.ts → PickerDateRange/PickerDateRange.d.ts} +3 -3
  93. package/dist/esm/components/organisms/{DateRangePicker/DateRangePicker.js → PickerDateRange/PickerDateRange.js} +7 -7
  94. package/dist/esm/components/organisms/{DateRangePicker/DateRangePicker.js.map → PickerDateRange/PickerDateRange.js.map} +1 -1
  95. package/dist/esm/components/organisms/index.d.ts +6 -6
  96. package/dist/esm/components/organisms/index.js +6 -6
  97. package/dist/esm/components/organisms/index.js.map +1 -1
  98. package/package.json +2 -2
  99. package/dist/esm/components/molecules/MoneyField/MoneyField.css +0 -6
  100. package/dist/esm/components/molecules/MonthTitlePicker/MonthTitlePicker.d.ts +0 -15
  101. package/dist/esm/components/molecules/NumberField/NumberField.css +0 -6
  102. package/dist/esm/components/molecules/TextField/TextField.css +0 -6
  103. package/dist/esm/components/organisms/AutocompleteField/AutocompleteFieldHook.js.map +0 -1
  104. package/dist/esm/components/organisms/DateRangeField/DateRangeField.js +0 -33
  105. package/dist/esm/components/organisms/SelectField/SelectField.css +0 -10
  106. package/dist/esm/components/organisms/SelectField/SelectField.js.map +0 -1
  107. package/dist/esm/components/organisms/SelectField/SelectFieldHook.js.map +0 -1
package/dist/es/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { useState, useRef, useEffect, createContext } from 'react';
3
3
  import { currencyFormat, itIsDefined, PartialSealed } from '@rolster/helpers-advanced';
4
- import { dateIsBefore, normalizeMinTime, dateIsAfter, normalizeMaxTime, getDaysOfMonth, getDateWeight, dateIsEqualsWeight, dateIsBetween, assignDayInDate, Month, MONTH_NAMES, DAY_LABELS, DateRange, dateFormatTemplate, assignYearInDate, assignMonthInDate } from '@rolster/helpers-date';
5
4
  import { hasPattern } from '@rolster/helpers-string';
6
- import { i18n } from '@rolster/i18n';
5
+ import { dateIsBefore, normalizeMinTime, dateIsAfter, normalizeMaxTime, getDaysOfMonth, getDateWeight, dateIsEqualsWeight, dateIsBetween, assignDayInDate, Month, MONTH_NAMES, DAY_LABELS, DateRange, dateFormatTemplate, assignYearInDate, assignMonthInDate } from '@rolster/helpers-date';
7
6
  import ReactDOM from 'react-dom';
7
+ import { i18n } from '@rolster/i18n';
8
8
  import { createFormControlProps } from '@rolster/helpers-forms';
9
9
  import 'uuid';
10
10
  import { BehaviorSubject } from 'rxjs';
@@ -73,14 +73,7 @@ function RlsCheckBoxControl({ formControl, disabled, rlsTheme }) {
73
73
  function RlsInput({ children, disabled, formControl, placeholder, type, value, onValue }) {
74
74
  const [focused, setFocused] = useState(false);
75
75
  function onChange(event) {
76
- switch (type) {
77
- case 'number':
78
- setState(+event.target.value);
79
- break;
80
- default:
81
- setState(event.target.value);
82
- break;
83
- }
76
+ setState(type === 'number' ? +event.target.value : event.target.value);
84
77
  }
85
78
  function setState(value) {
86
79
  formControl?.setState(value);
@@ -254,7 +247,43 @@ function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsThem
254
247
  }), children: jsx("ul", { children: options.map((action, index) => (jsx("li", { className: "truncate", onClick: () => onSelectAction(action), children: action.label }, index))) }) })] }));
255
248
  }
256
249
 
257
- function RlsCheckBoxLabel({ children, disabled, extended, formControl, rlsTheme }) {
250
+ function RlsFieldMoney({ children, decimals, disabled, formControl, placeholder, symbol, rlsTheme, value, onValue }) {
251
+ return (jsxs("div", { className: renderClassStatus('rls-field-box', {
252
+ focused: formControl?.focused,
253
+ error: formControl?.wrong,
254
+ disabled: formControl?.disabled || disabled
255
+ }, 'rls-field-money'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-field-box__label", children: children }), jsx("div", { className: "rls-field-box__component", children: jsx("div", { className: "rls-field-box__body", children: jsx(RlsInputMoney, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, symbol: symbol, decimals: decimals, onValue: onValue }) }) }), formControl?.touched && formControl?.error && (jsx("div", { className: "rls-field-box__error", children: jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl.error.message }) }))] }));
256
+ }
257
+
258
+ function RlsFieldNumber({ children, disabled, formControl, placeholder, rlsTheme, value, onValue }) {
259
+ return (jsxs("div", { className: renderClassStatus('rls-field-box', {
260
+ focused: formControl?.focused,
261
+ error: formControl?.wrong,
262
+ disabled: formControl?.disabled || disabled
263
+ }, 'rls-field-number'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-field-box__label", children: children }), jsx("div", { className: "rls-field-box__component", children: jsx("div", { className: "rls-field-box__body", children: jsx(RlsInputNumber, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, onValue: onValue }) }) }), formControl?.touched && formControl?.error && (jsx("div", { className: "rls-field-box__error", children: jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl.error.message }) }))] }));
264
+ }
265
+
266
+ function RlsFieldPassword({ children, disabled, formControl, placeholder, rlsTheme }) {
267
+ const [password, setPassword] = useState(true);
268
+ function onToggleInput() {
269
+ setPassword(!password);
270
+ }
271
+ return (jsxs("div", { className: renderClassStatus(' rls-field-box', {
272
+ focused: formControl?.focused,
273
+ error: formControl?.wrong,
274
+ disabled: formControl?.disabled || disabled
275
+ }, 'rls-field-password'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-field-box__label", children: children }), jsx("div", { className: "rls-field-box__component", children: jsxs("div", { className: "rls-field-box__body", children: [jsx(RlsInputPassword, { formControl: formControl, disabled: disabled, placeholder: placeholder, type: password ? 'password' : 'text' }), jsx(RlsButtonAction, { icon: password ? 'eye' : 'eye-off', onClick: onToggleInput })] }) }), formControl?.touched && formControl?.error && (jsx("div", { className: "rls-field-box__error", children: jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl.error.message }) }))] }));
276
+ }
277
+
278
+ function RlsFieldText({ children, disabled, formControl, placeholder, rlsTheme, value, onValue }) {
279
+ return (jsxs("div", { className: renderClassStatus('rls-field-box', {
280
+ focused: formControl?.focused,
281
+ error: formControl?.wrong,
282
+ disabled: formControl?.disabled || disabled
283
+ }, 'rls-field-text'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-field-box__label", children: children }), jsx("div", { className: "rls-field-box__component", children: jsx("div", { className: "rls-field-box__body", children: jsx(RlsInputText, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, onValue: onValue }) }) }), formControl?.touched && formControl?.error && (jsx("div", { className: "rls-field-box__error", children: jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl.error.message }) }))] }));
284
+ }
285
+
286
+ function RlsLabelCheckBox({ children, disabled, extended, formControl, rlsTheme }) {
258
287
  const [checked, setChecked] = useState(formControl?.value || false);
259
288
  useEffect(() => {
260
289
  setChecked(formControl?.state || false);
@@ -267,217 +296,462 @@ function RlsCheckBoxLabel({ children, disabled, extended, formControl, rlsTheme
267
296
  setChecked(!checked);
268
297
  }
269
298
  }
270
- return (jsxs("div", { className: renderClassStatus('rls-checkbox-label', {
299
+ return (jsxs("div", { className: renderClassStatus('rls-label-checkbox', {
271
300
  disabled,
272
301
  extended
273
- }), "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-checkbox-label__component", onClick: onToggle, children: jsx(RlsCheckBox, { checked: checked, disabled: disabled }) }), jsx("label", { className: "rls-checkbox-label__text", children: children })] }));
302
+ }), "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-label-checkbox__component", onClick: onToggle, children: jsx(RlsCheckBox, { checked: checked, disabled: disabled }) }), jsx("label", { className: "rls-label-checkbox__text", children: children })] }));
274
303
  }
275
304
 
276
- function dateIsOutRangeMin(props) {
277
- const { date, minDate } = props;
278
- return !!minDate && dateIsBefore(normalizeMinTime(minDate), date);
279
- }
280
- function dateIsOutRangeMax(props) {
281
- const { date, maxDate } = props;
282
- return !!maxDate && dateIsAfter(normalizeMaxTime(maxDate), date);
283
- }
284
- function dateOutRange(props) {
285
- return dateIsOutRangeMin(props) || dateIsOutRangeMax(props);
286
- }
287
- function checkDateRange(props) {
288
- const { date, maxDate, minDate } = props;
289
- return minDate && dateIsOutRangeMax(props)
290
- ? minDate
291
- : maxDate && dateIsOutRangeMax(props)
292
- ? maxDate
293
- : date;
294
- }
295
-
296
- const DAYS_WEEK = 7;
297
- const COUNT_YEAR_RANGE = 4;
298
-
299
- function createDayState(props, today, value) {
300
- const { date, day, month, year } = props;
301
- const dateValue = value && new Date(year, month, value);
302
- return {
303
- disabled: dayIsOutside(props, value || 0),
304
- focused: !!value && day === value,
305
- forbidden: !value,
306
- selected: !!dateValue && dateIsEqualsWeight(date, dateValue),
307
- today: !!dateValue && dateIsEqualsWeight(today, dateValue),
308
- value
309
- };
310
- }
311
- function createFirstWeek$1(props, date, today) {
312
- const days = [];
313
- let day = 1;
314
- for (let start = 0; start < date.getDay(); start++) {
315
- days.push(createDayState(props, today));
316
- }
317
- for (let end = date.getDay(); end < 7; end++) {
318
- days.push(createDayState(props, today, day));
319
- day++;
320
- }
321
- return { days };
322
- }
323
- function createDaysPending$1(props, today, days) {
324
- const daysPending = [];
325
- const length = 7 - days;
326
- for (let index = 0; index < length; index++) {
327
- daysPending.push(createDayState(props, today));
328
- }
329
- return daysPending;
330
- }
331
- function createNextWeeks$1(props, date, today) {
332
- const daysMonth = getDaysOfMonth(date.getFullYear(), date.getMonth());
333
- const weeks = [];
334
- let days = [];
335
- let countDays = 1;
336
- let day = DAYS_WEEK - date.getDay() + 1;
337
- do {
338
- days.push(createDayState(props, today, day));
339
- day++;
340
- countDays++;
341
- if (countDays > DAYS_WEEK) {
342
- weeks.push({ days });
343
- days = [];
344
- countDays = 1;
345
- }
346
- } while (day <= daysMonth);
347
- if (days.length && days.length < DAYS_WEEK) {
348
- weeks.push({
349
- days: [...days, ...createDaysPending$1(props, today, days.length)]
350
- });
351
- }
352
- return weeks;
353
- }
354
- function dayIsOutsideMin(props, day) {
355
- const { month, year, minDate } = props;
356
- return minDate
357
- ? getDateWeight(new Date(year, month, day)) < getDateWeight(minDate)
358
- : false;
359
- }
360
- function dayIsOutsideMax(props, day) {
361
- const { month, year, maxDate } = props;
362
- return maxDate
363
- ? getDateWeight(new Date(year, month, day)) > getDateWeight(maxDate)
364
- : false;
365
- }
366
- function dayIsOutside(props, day) {
367
- return dayIsOutsideMin(props, day) || dayIsOutsideMax(props, day);
368
- }
369
- function checkDayPicker(props) {
370
- const { day, maxDate, minDate } = props;
371
- return minDate && dayIsOutsideMin(props, day)
372
- ? minDate.getDate()
373
- : maxDate && dayIsOutsideMax(props, day)
374
- ? maxDate.getDate()
375
- : undefined;
376
- }
377
- function createDayPicker(props) {
378
- const date = new Date(props.year, props.month, 1);
379
- const today = new Date();
380
- const firstWeek = createFirstWeek$1(props, date, today);
381
- const nextWeeks = createNextWeeks$1(props, date, today);
382
- return [firstWeek, ...nextWeeks];
305
+ function RlsLabelRadioButton({ children, disabled, extended, formControl, rlsTheme, value }) {
306
+ const [checked, setChecked] = useState(formControl?.state || false);
307
+ useEffect(() => {
308
+ setChecked(formControl?.state === value);
309
+ }, [formControl?.state]);
310
+ function onSelect() {
311
+ if (formControl) {
312
+ formControl?.setState(value);
313
+ }
314
+ }
315
+ return (jsxs("div", { className: renderClassStatus('rls-label-radiobutton', {
316
+ disabled,
317
+ extended
318
+ }), "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-label-radiobutton__component", onClick: onSelect, children: jsx(RlsRadioButton, { checked: checked, disabled: disabled }) }), jsx("label", { className: "rls-label-radiobutton__text", children: children })] }));
383
319
  }
384
320
 
385
- function dateIsSelected(base, date, day) {
386
- return (date.getFullYear() === base.getFullYear() &&
387
- date.getMonth() === base.getMonth() &&
388
- day === date.getDate());
389
- }
390
- function sourceIsSelected({ sourceDate }, base, day) {
391
- return dateIsSelected(base, sourceDate, day);
392
- }
393
- function rangeIsSelected({ range }, base, day) {
394
- return (dateIsSelected(base, range.minDate, day) ||
395
- dateIsSelected(base, range.maxDate, day));
396
- }
397
- function dayIsRange({ range }, base, day) {
398
- return dateIsBetween(range.minDate, range.maxDate, assignDayInDate(base, day));
399
- }
400
- function createDayRangeState(props, base, day) {
401
- return {
402
- disabled: dayRangeIsOutside(props, day || 0),
403
- end: day ? rangeIsSelected(props, base, day) : false,
404
- forbidden: !day,
405
- ranged: day ? dayIsRange(props, base, day) : false,
406
- source: day ? sourceIsSelected(props, base, day) : false,
407
- value: day
408
- };
409
- }
410
- function createFirstWeek(props, base) {
411
- const days = [];
412
- let day = 1;
413
- for (let start = 0; start < base.getDay(); start++) {
414
- days.push(createDayRangeState(props, base));
415
- }
416
- for (let end = base.getDay(); end < 7; end++) {
417
- days.push(createDayRangeState(props, base, day));
418
- day++;
419
- }
420
- return { days };
421
- }
422
- function createDaysPending(props, base, days) {
423
- const daysPending = [];
424
- const length = 7 - days;
425
- for (let index = 0; index < length; index++) {
426
- daysPending.push(createDayRangeState(props, base));
427
- }
428
- return daysPending;
429
- }
430
- function createNextWeeks(props, base) {
431
- const weeks = [];
432
- const { date } = props;
433
- const dayCount = getDaysOfMonth(date.getFullYear(), date.getMonth());
434
- let days = [];
435
- let countDays = 1;
436
- let day = DAYS_WEEK - base.getDay() + 1;
437
- do {
438
- days.push(createDayRangeState(props, date, day));
439
- day++;
440
- countDays++;
441
- if (countDays > 7) {
442
- weeks.push({ days });
443
- days = [];
444
- countDays = 1;
445
- }
446
- } while (day <= dayCount);
447
- if (days.length && days.length < DAYS_WEEK) {
448
- weeks.push({
449
- days: [...days, ...createDaysPending(props, base, days.length)]
450
- });
451
- }
452
- return weeks;
453
- }
454
- function dayRangeIsOutsideMin(props, day) {
455
- const { date, minDate } = props;
456
- return minDate
457
- ? getDateWeight(assignDayInDate(date, day)) < getDateWeight(minDate)
458
- : false;
459
- }
460
- function dayRangeIsOutsideMax(props, day) {
461
- const { date, maxDate } = props;
462
- return maxDate
463
- ? getDateWeight(assignDayInDate(date, day)) > getDateWeight(maxDate)
464
- : false;
465
- }
466
- function dayRangeIsOutside(props, day) {
467
- return dayRangeIsOutsideMin(props, day) || dayRangeIsOutsideMax(props, day);
468
- }
469
- function createDayRangePicker(props) {
470
- const date = new Date(props.date.getFullYear(), props.date.getMonth(), 1);
471
- const firstWeek = createFirstWeek(props, date);
472
- const nextWeeks = createNextWeeks(props, date);
473
- return [firstWeek, ...nextWeeks];
321
+ function RlsLabelSwitch({ children, disabled, extended, formControl, rlsTheme }) {
322
+ const [checked, setChecked] = useState(formControl?.value || false);
323
+ useEffect(() => {
324
+ setChecked(formControl?.state || false);
325
+ }, [formControl?.state]);
326
+ function onToggle() {
327
+ if (formControl) {
328
+ formControl?.setState(!formControl.state);
329
+ }
330
+ else {
331
+ setChecked(!checked);
332
+ }
333
+ }
334
+ return (jsxs("div", { className: renderClassStatus('rls-label-switch', { disabled, extended }), "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-label-switch__component", onClick: onToggle, children: jsx(RlsSwitch, { checked: checked, disabled: disabled }) }), jsx("label", { className: "rls-label-switch__text", children: children })] }));
474
335
  }
475
336
 
476
- function createMonthState(props, value) {
477
- const { date, month, year } = props;
478
- return {
479
- disabled: monthIsOutside(props, value),
480
- focused: value === month,
337
+ const DEFAULT_COUNT_ELEMENT = 20;
338
+ const MIN_NUMBER_PAGE = 1;
339
+ const FIRST_PAGE = 0;
340
+ const DEFAULT_MAX_VISIBLE = 4;
341
+ function RlsPagination({ elements, count: defaultCount, filter, onElements, onPagination }) {
342
+ const count = defaultCount || DEFAULT_COUNT_ELEMENT;
343
+ const [collection, setCollection] = useState([]);
344
+ const [index, setIndex] = useState(0);
345
+ const [maxPage, setMaxPage] = useState(calculateMaxPage(elements, count));
346
+ const [paginations, setPaginations] = useState([]);
347
+ const [currentPagination, setCurrentPagination] = useState();
348
+ const [description, setDescription] = useState('');
349
+ const [firstPage, setFirstPage] = useState(true);
350
+ const [lastPage, setLastPage] = useState(false);
351
+ useEffect(() => {
352
+ refreshFromElements(elements);
353
+ }, [elements]);
354
+ useEffect(() => {
355
+ const isFirstPage = currentPagination?.value === FIRST_PAGE;
356
+ const isLastPage = currentPagination?.value === maxPage - 1;
357
+ setFirstPage(isFirstPage);
358
+ setLastPage(isLastPage);
359
+ if (onPagination) {
360
+ onPagination({ firstPage: isFirstPage, lastPage: isLastPage });
361
+ }
362
+ }, [currentPagination]);
363
+ useEffect(() => {
364
+ refreshFromFilter(filter);
365
+ }, [filter]);
366
+ function onChangeElements(elements) {
367
+ if (onElements) {
368
+ onElements(elements);
369
+ }
370
+ }
371
+ function calculateMaxPage(collection, count) {
372
+ return collection.length ? Math.ceil(collection.length / count) : 0;
373
+ }
374
+ function onSelectPagination(pagination) {
375
+ const { value } = pagination;
376
+ pagination.active = true;
377
+ setIndex(value);
378
+ setCurrentPagination(pagination);
379
+ refreshFromChanged(clonePage({ index: value }));
380
+ }
381
+ function goPagination(pagination) {
382
+ if (currentPagination) {
383
+ currentPagination.active = false;
384
+ }
385
+ onSelectPagination(pagination);
386
+ }
387
+ function goPreviousPagination() {
388
+ if (currentPagination) {
389
+ const { prev, value } = currentPagination;
390
+ if (prev) {
391
+ onSelectPagination(prev);
392
+ currentPagination.active = false;
393
+ }
394
+ else {
395
+ const prevIndex = value - MIN_NUMBER_PAGE;
396
+ if (prevIndex >= FIRST_PAGE) {
397
+ refreshFromChanged(clonePageFromIndex(prevIndex));
398
+ }
399
+ }
400
+ }
401
+ }
402
+ function goFirstPagination() {
403
+ if (collection.length) {
404
+ refreshFromChanged(clonePageFromIndex(FIRST_PAGE));
405
+ }
406
+ }
407
+ function goNextPagination() {
408
+ if (currentPagination) {
409
+ const { next, value } = currentPagination;
410
+ if (next) {
411
+ onSelectPagination(next);
412
+ currentPagination.active = false;
413
+ }
414
+ else {
415
+ const nextIndex = value + 1;
416
+ if (nextIndex <= maxPage) {
417
+ refreshFromChanged(clonePageFromIndex(nextIndex));
418
+ }
419
+ }
420
+ }
421
+ }
422
+ function goLastPagination() {
423
+ if (collection.length) {
424
+ refreshFromChanged(clonePageFromIndex(maxPage - MIN_NUMBER_PAGE));
425
+ }
426
+ }
427
+ function createPageCollection(props) {
428
+ const { collection, count, index } = props;
429
+ if (collection.length) {
430
+ const finish = (index + MIN_NUMBER_PAGE) * count;
431
+ const start = index * count;
432
+ return collection.slice(start, finish);
433
+ }
434
+ return [];
435
+ }
436
+ function refreshFromElements(elements) {
437
+ elements.length
438
+ ? refreshFromChanged(refreshPage(elements, filter))
439
+ : rebootPagination();
440
+ }
441
+ function refreshFromFilter(filter) {
442
+ refreshFromChanged(refreshPage(elements, filter));
443
+ }
444
+ function refreshFromChanged(page) {
445
+ refreshPaginations(page);
446
+ refreshDescription(page);
447
+ onChangeElements(createPageCollection(page));
448
+ }
449
+ function refreshCollection(elements, filter) {
450
+ const collection = filter
451
+ ? elements.filter((element) => hasPattern(JSON.stringify(element), filter))
452
+ : elements;
453
+ setCollection(collection);
454
+ return collection;
455
+ }
456
+ function refreshMaxPage(collection, count) {
457
+ const maxPage = calculateMaxPage(collection, count);
458
+ setMaxPage(maxPage);
459
+ return maxPage;
460
+ }
461
+ function refreshIndex(collection, currentMaxPage) {
462
+ const maxPage = currentMaxPage || refreshMaxPage(collection, count);
463
+ if (index < maxPage || index === FIRST_PAGE) {
464
+ return index;
465
+ }
466
+ const newIndex = maxPage - 1;
467
+ setIndex(newIndex);
468
+ return newIndex;
469
+ }
470
+ function refreshDescription(page) {
471
+ const { collection, count, index } = page;
472
+ const totalCount = elements.length;
473
+ const start = index * count + MIN_NUMBER_PAGE;
474
+ let end = (index + MIN_NUMBER_PAGE) * count;
475
+ if (end > collection.length) {
476
+ end = collection.length;
477
+ }
478
+ setDescription(`${start} - ${end} de ${totalCount}`);
479
+ }
480
+ function refreshPaginations({ index, maxPage }) {
481
+ let maxPageVisible = index + DEFAULT_MAX_VISIBLE;
482
+ if (maxPageVisible > maxPage) {
483
+ maxPageVisible = maxPage;
484
+ }
485
+ let minIndexPage = maxPageVisible - DEFAULT_MAX_VISIBLE;
486
+ if (minIndexPage < 0) {
487
+ minIndexPage = 0;
488
+ }
489
+ if (minIndexPage > index) {
490
+ minIndexPage = index;
491
+ }
492
+ let prevPagination = undefined;
493
+ const paginations = [];
494
+ for (let i = minIndexPage; i < maxPageVisible; i++) {
495
+ const pagination = createPagination(i, index);
496
+ paginations.push(pagination);
497
+ pagination.prev = prevPagination;
498
+ if (prevPagination) {
499
+ prevPagination.next = pagination;
500
+ }
501
+ prevPagination = pagination;
502
+ }
503
+ setPaginations(paginations);
504
+ }
505
+ function clonePage(pagePartial) {
506
+ return {
507
+ collection: pagePartial.collection || collection,
508
+ index: typeof pagePartial.index === 'number' ? pagePartial.index : index,
509
+ count: pagePartial.count || count,
510
+ maxPage: typeof pagePartial.maxPage === 'number' ? pagePartial.maxPage : maxPage
511
+ };
512
+ }
513
+ function clonePageFromIndex(index) {
514
+ return clonePage({ index });
515
+ }
516
+ function refreshPage(elements, filter) {
517
+ const collection = refreshCollection(elements, filter);
518
+ const maxPage = refreshMaxPage(collection, count);
519
+ const index = refreshIndex(collection, maxPage);
520
+ return clonePage({ collection, index, maxPage });
521
+ }
522
+ function createPagination(value, index) {
523
+ const active = value === index;
524
+ const pagination = {
525
+ label: (value + 1).toString(),
526
+ value,
527
+ active
528
+ };
529
+ if (active) {
530
+ setCurrentPagination(pagination);
531
+ }
532
+ return pagination;
533
+ }
534
+ function rebootPagination() {
535
+ setCollection([]);
536
+ setMaxPage(0);
537
+ setIndex(0);
538
+ setPaginations([]);
539
+ onChangeElements([]);
540
+ }
541
+ return (jsxs("div", { className: "rls-pagination", children: [jsxs("div", { className: "rls-pagination__actions", children: [jsx("button", { className: "rls-pagination__action", onClick: goFirstPagination, disabled: firstPage, children: jsx(RlsIcon, { value: "arrowhead-left" }) }), jsx("button", { className: "rls-pagination__action", onClick: goPreviousPagination, disabled: firstPage, children: jsx(RlsIcon, { value: "arrow-ios-left" }) })] }), jsx("div", { className: "rls-pagination__pages", children: paginations.map((page, index) => {
542
+ return (jsx("div", { className: renderClassStatus('rls-pagination__page', {
543
+ active: page.active
544
+ }), onClick: () => {
545
+ goPagination(page);
546
+ }, children: page.label }, index));
547
+ }) }), jsx("div", { className: "rls-pagination__description", children: description }), jsxs("div", { className: "rls-pagination__actions", children: [jsx("button", { className: "rls-pagination__action", onClick: goNextPagination, disabled: lastPage, children: jsx(RlsIcon, { value: "arrow-ios-right" }) }), jsx("button", { className: "rls-pagination__action", onClick: goLastPagination, disabled: lastPage, children: jsx(RlsIcon, { value: "arrowhead-right" }) })] })] }));
548
+ }
549
+
550
+ function dateIsOutRangeMin(props) {
551
+ const { date, minDate } = props;
552
+ return !!minDate && dateIsBefore(normalizeMinTime(minDate), date);
553
+ }
554
+ function dateIsOutRangeMax(props) {
555
+ const { date, maxDate } = props;
556
+ return !!maxDate && dateIsAfter(normalizeMaxTime(maxDate), date);
557
+ }
558
+ function dateOutRange(props) {
559
+ return dateIsOutRangeMin(props) || dateIsOutRangeMax(props);
560
+ }
561
+ function checkDateRange(props) {
562
+ const { date, maxDate, minDate } = props;
563
+ return minDate && dateIsOutRangeMax(props)
564
+ ? minDate
565
+ : maxDate && dateIsOutRangeMax(props)
566
+ ? maxDate
567
+ : date;
568
+ }
569
+
570
+ const DAYS_WEEK = 7;
571
+ const COUNT_YEAR_RANGE = 4;
572
+
573
+ function createDayState(props, today, value) {
574
+ const { date, day, month, year } = props;
575
+ const dateValue = value && new Date(year, month, value);
576
+ return {
577
+ disabled: dayIsOutside(props, value || 0),
578
+ focused: !!value && day === value,
579
+ forbidden: !value,
580
+ selected: !!dateValue && dateIsEqualsWeight(date, dateValue),
581
+ today: !!dateValue && dateIsEqualsWeight(today, dateValue),
582
+ value
583
+ };
584
+ }
585
+ function createFirstWeek$1(props, date, today) {
586
+ const days = [];
587
+ let day = 1;
588
+ for (let start = 0; start < date.getDay(); start++) {
589
+ days.push(createDayState(props, today));
590
+ }
591
+ for (let end = date.getDay(); end < 7; end++) {
592
+ days.push(createDayState(props, today, day));
593
+ day++;
594
+ }
595
+ return { days };
596
+ }
597
+ function createDaysPending$1(props, today, days) {
598
+ const daysPending = [];
599
+ const length = 7 - days;
600
+ for (let index = 0; index < length; index++) {
601
+ daysPending.push(createDayState(props, today));
602
+ }
603
+ return daysPending;
604
+ }
605
+ function createNextWeeks$1(props, date, today) {
606
+ const daysMonth = getDaysOfMonth(date.getFullYear(), date.getMonth());
607
+ const weeks = [];
608
+ let days = [];
609
+ let countDays = 1;
610
+ let day = DAYS_WEEK - date.getDay() + 1;
611
+ do {
612
+ days.push(createDayState(props, today, day));
613
+ day++;
614
+ countDays++;
615
+ if (countDays > DAYS_WEEK) {
616
+ weeks.push({ days });
617
+ days = [];
618
+ countDays = 1;
619
+ }
620
+ } while (day <= daysMonth);
621
+ if (days.length && days.length < DAYS_WEEK) {
622
+ weeks.push({
623
+ days: [...days, ...createDaysPending$1(props, today, days.length)]
624
+ });
625
+ }
626
+ return weeks;
627
+ }
628
+ function dayIsOutsideMin(props, day) {
629
+ const { month, year, minDate } = props;
630
+ return minDate
631
+ ? getDateWeight(new Date(year, month, day)) < getDateWeight(minDate)
632
+ : false;
633
+ }
634
+ function dayIsOutsideMax(props, day) {
635
+ const { month, year, maxDate } = props;
636
+ return maxDate
637
+ ? getDateWeight(new Date(year, month, day)) > getDateWeight(maxDate)
638
+ : false;
639
+ }
640
+ function dayIsOutside(props, day) {
641
+ return dayIsOutsideMin(props, day) || dayIsOutsideMax(props, day);
642
+ }
643
+ function checkDayPicker(props) {
644
+ const { day, maxDate, minDate } = props;
645
+ return minDate && dayIsOutsideMin(props, day)
646
+ ? minDate.getDate()
647
+ : maxDate && dayIsOutsideMax(props, day)
648
+ ? maxDate.getDate()
649
+ : undefined;
650
+ }
651
+ function createDayPicker(props) {
652
+ const date = new Date(props.year, props.month, 1);
653
+ const today = new Date();
654
+ const firstWeek = createFirstWeek$1(props, date, today);
655
+ const nextWeeks = createNextWeeks$1(props, date, today);
656
+ return [firstWeek, ...nextWeeks];
657
+ }
658
+
659
+ function dateIsSelected(base, date, day) {
660
+ return (date.getFullYear() === base.getFullYear() &&
661
+ date.getMonth() === base.getMonth() &&
662
+ day === date.getDate());
663
+ }
664
+ function sourceIsSelected({ sourceDate }, base, day) {
665
+ return dateIsSelected(base, sourceDate, day);
666
+ }
667
+ function rangeIsSelected({ range }, base, day) {
668
+ return (dateIsSelected(base, range.minDate, day) ||
669
+ dateIsSelected(base, range.maxDate, day));
670
+ }
671
+ function dayIsRange({ range }, base, day) {
672
+ return dateIsBetween(range.minDate, range.maxDate, assignDayInDate(base, day));
673
+ }
674
+ function createDayRangeState(props, base, day) {
675
+ return {
676
+ disabled: dayRangeIsOutside(props, day || 0),
677
+ end: day ? rangeIsSelected(props, base, day) : false,
678
+ forbidden: !day,
679
+ ranged: day ? dayIsRange(props, base, day) : false,
680
+ source: day ? sourceIsSelected(props, base, day) : false,
681
+ value: day
682
+ };
683
+ }
684
+ function createFirstWeek(props, base) {
685
+ const days = [];
686
+ let day = 1;
687
+ for (let start = 0; start < base.getDay(); start++) {
688
+ days.push(createDayRangeState(props, base));
689
+ }
690
+ for (let end = base.getDay(); end < 7; end++) {
691
+ days.push(createDayRangeState(props, base, day));
692
+ day++;
693
+ }
694
+ return { days };
695
+ }
696
+ function createDaysPending(props, base, days) {
697
+ const daysPending = [];
698
+ const length = 7 - days;
699
+ for (let index = 0; index < length; index++) {
700
+ daysPending.push(createDayRangeState(props, base));
701
+ }
702
+ return daysPending;
703
+ }
704
+ function createNextWeeks(props, base) {
705
+ const weeks = [];
706
+ const { date } = props;
707
+ const dayCount = getDaysOfMonth(date.getFullYear(), date.getMonth());
708
+ let days = [];
709
+ let countDays = 1;
710
+ let day = DAYS_WEEK - base.getDay() + 1;
711
+ do {
712
+ days.push(createDayRangeState(props, date, day));
713
+ day++;
714
+ countDays++;
715
+ if (countDays > 7) {
716
+ weeks.push({ days });
717
+ days = [];
718
+ countDays = 1;
719
+ }
720
+ } while (day <= dayCount);
721
+ if (days.length && days.length < DAYS_WEEK) {
722
+ weeks.push({
723
+ days: [...days, ...createDaysPending(props, base, days.length)]
724
+ });
725
+ }
726
+ return weeks;
727
+ }
728
+ function dayRangeIsOutsideMin(props, day) {
729
+ const { date, minDate } = props;
730
+ return minDate
731
+ ? getDateWeight(assignDayInDate(date, day)) < getDateWeight(minDate)
732
+ : false;
733
+ }
734
+ function dayRangeIsOutsideMax(props, day) {
735
+ const { date, maxDate } = props;
736
+ return maxDate
737
+ ? getDateWeight(assignDayInDate(date, day)) > getDateWeight(maxDate)
738
+ : false;
739
+ }
740
+ function dayRangeIsOutside(props, day) {
741
+ return dayRangeIsOutsideMin(props, day) || dayRangeIsOutsideMax(props, day);
742
+ }
743
+ function createDayRangePicker(props) {
744
+ const date = new Date(props.date.getFullYear(), props.date.getMonth(), 1);
745
+ const firstWeek = createFirstWeek(props, date);
746
+ const nextWeeks = createNextWeeks(props, date);
747
+ return [firstWeek, ...nextWeeks];
748
+ }
749
+
750
+ function createMonthState(props, value) {
751
+ const { date, month, year } = props;
752
+ return {
753
+ disabled: monthIsOutside(props, value),
754
+ focused: value === month,
481
755
  label: MONTH_NAMES()[value],
482
756
  selected: date.getFullYear() === year && value === date.getMonth(),
483
757
  value
@@ -501,712 +775,427 @@ function monthIsOutside(props, month) {
501
775
  function checkMonthPicker(props) {
502
776
  const { maxDate, minDate, month } = props;
503
777
  return minDate && monthIsOutsideMin(props, month)
504
- ? minDate.getMonth()
505
- : maxDate && monthIsOutsideMax(props, month)
506
- ? maxDate.getMonth()
507
- : undefined;
508
- }
509
- function createMonthPicker(props) {
510
- return [
511
- createMonthState(props, Month.January),
512
- createMonthState(props, Month.February),
513
- createMonthState(props, Month.March),
514
- createMonthState(props, Month.April),
515
- createMonthState(props, Month.May),
516
- createMonthState(props, Month.June),
517
- createMonthState(props, Month.July),
518
- createMonthState(props, Month.August),
519
- createMonthState(props, Month.September),
520
- createMonthState(props, Month.October),
521
- createMonthState(props, Month.November),
522
- createMonthState(props, Month.December)
523
- ];
524
- }
525
- function monthIsLimitMin(props) {
526
- const { month, date, minDate } = props;
527
- if (itIsDefined(month) && date) {
528
- const minYear = minDate ? minDate.getFullYear() : 0;
529
- const minMonth = minDate ? minDate.getMonth() : 0;
530
- return date.getFullYear() === minYear && month <= minMonth;
531
- }
532
- return false;
533
- }
534
- function monthIsLimitMax(props) {
535
- const { month, date, maxDate } = props;
536
- if (itIsDefined(month) && date) {
537
- const maxYear = maxDate ? maxDate.getFullYear() : 10000;
538
- const maxMonth = maxDate ? maxDate.getMonth() : 11;
539
- return date.getFullYear() === maxYear && month >= maxMonth;
540
- }
541
- return false;
542
- }
543
- function monthLimitTemplate(props) {
544
- return {
545
- limitNext: monthIsLimitMax(props),
546
- limitPrevious: monthIsLimitMin(props)
547
- };
548
- }
549
-
550
- var PickerListenerType;
551
- (function (PickerListenerType) {
552
- PickerListenerType["Select"] = "PickerSelect";
553
- PickerListenerType["Now"] = "PickerNow";
554
- PickerListenerType["Cancel"] = "PickerCancel";
555
- })(PickerListenerType || (PickerListenerType = {}));
556
-
557
- function createYear(props, value) {
558
- const { date, year } = props;
559
- return {
560
- disabled: !value,
561
- focused: value === year,
562
- selected: value === date.getFullYear(),
563
- value
564
- };
565
- }
566
- function yearIsOutlineMin(props) {
567
- const { year, minDate } = props;
568
- return minDate ? year < minDate.getFullYear() : false;
569
- }
570
- function yearIsOutlineMax(props) {
571
- const { year, maxDate } = props;
572
- return maxDate ? year > maxDate.getFullYear() : false;
573
- }
574
- function checkYearPicker(props) {
575
- const { maxDate, minDate } = props;
576
- return minDate && yearIsOutlineMin(props)
577
- ? minDate.getFullYear()
578
- : maxDate && yearIsOutlineMax(props)
579
- ? maxDate.getFullYear()
580
- : undefined;
581
- }
582
- function createYearPicker(props) {
583
- const { year, maxDate, minDate } = props;
584
- const prevYears = [];
585
- const nextYears = [];
586
- let minRange = year;
587
- let maxRange = year;
588
- const minYear = minDate?.getFullYear() || 0;
589
- const maxYear = maxDate?.getFullYear() || 10000;
590
- for (let index = 0; index < COUNT_YEAR_RANGE; index++) {
591
- const prevValue = year - COUNT_YEAR_RANGE + index;
592
- const nextValue = year + index + 1;
593
- const prevYear = prevValue >= minYear ? prevValue : undefined;
594
- const nextYear = nextValue <= maxYear ? nextValue : undefined;
595
- const prevState = createYear(props, prevYear);
596
- const nextState = createYear(props, nextYear);
597
- prevYears.push(prevState);
598
- nextYears.push(nextState);
599
- if (!!prevState.value && minRange > prevState.value) {
600
- minRange = prevState.value;
601
- }
602
- if (!!nextState.value && maxRange < nextState.value) {
603
- maxRange = nextState.value;
604
- }
605
- }
606
- const yearCenter = createYear(props, year);
607
- return {
608
- canPrevious: minYear < minRange,
609
- canNext: maxYear > maxRange,
610
- maxRange,
611
- minRange,
612
- years: [...prevYears, yearCenter, ...nextYears]
613
- };
614
- }
615
-
616
- function createEmptyStore() {
617
- return {
618
- coincidences: undefined,
619
- pattern: '',
620
- previous: null
621
- };
622
- }
623
- function searchForPattern(props) {
624
- const { pattern, store } = props;
625
- if (!store?.pattern) {
626
- return null;
627
- }
628
- let newStore = store;
629
- let search = false;
630
- while (!search && newStore) {
631
- search = hasPattern(pattern || '', newStore.pattern, true);
632
- if (!search) {
633
- newStore = newStore.previous;
634
- }
635
- }
636
- return newStore || createEmptyStore();
637
- }
638
- function createStoreAutocomplete(props) {
639
- const { pattern, suggestions, reboot } = props;
640
- if (!pattern) {
641
- return { collection: suggestions, store: createEmptyStore() };
642
- }
643
- const store = reboot ? createEmptyStore() : searchForPattern(props);
644
- const elements = store?.coincidences || suggestions;
645
- const coincidences = elements.filter((element) => element.hasCoincidence(pattern));
646
- return {
647
- collection: coincidences,
648
- store: {
649
- coincidences,
650
- pattern,
651
- previous: store
652
- }
653
- };
654
- }
655
-
656
- const classElement = '.rls-list-field__element';
657
- const POSITION_INITIAL = 0;
658
- function locationListIsBottom(contentElement, listElement) {
659
- if (contentElement && listElement) {
660
- const { top, height } = contentElement.getBoundingClientRect();
661
- const { clientHeight } = listElement;
662
- return top + height + clientHeight < window.innerHeight;
663
- }
664
- return true;
665
- }
666
- function navigationInputDown(props) {
667
- const { contentElement, listElement } = props;
668
- if (!locationListIsBottom(contentElement, listElement)) {
669
- return undefined;
670
- }
671
- const elements = listElement?.querySelectorAll(classElement);
672
- if (elements?.length) {
673
- elements.item(0).focus();
674
- setTimeout(() => {
675
- listElement?.scroll({ top: 0, behavior: 'smooth' });
676
- }, 100);
677
- }
678
- return POSITION_INITIAL;
679
- }
680
- function navigationInputUp(props) {
681
- const { contentElement, listElement } = props;
682
- if (locationListIsBottom(contentElement, listElement)) {
683
- return undefined;
684
- }
685
- const elements = listElement?.querySelectorAll(classElement);
686
- if (!elements?.length) {
687
- return POSITION_INITIAL;
688
- }
689
- const position = elements.length - 1;
690
- const element = elements.item(position);
691
- element?.focus();
692
- setTimeout(() => {
693
- listElement?.scroll({
694
- top: element?.offsetTop + element?.offsetLeft,
695
- behavior: 'smooth'
696
- });
697
- }, 100);
698
- return position;
699
- }
700
- function navigationElementDown(props) {
701
- const { contentElement, inputElement, listElement, position } = props;
702
- const elements = listElement?.querySelectorAll(classElement);
703
- const newPosition = position + 1;
704
- if (newPosition < (elements?.length || 0)) {
705
- elements?.item(newPosition)?.focus();
706
- return newPosition;
707
- }
708
- if (!locationListIsBottom(contentElement, listElement)) {
709
- inputElement?.focus();
710
- }
711
- return position;
778
+ ? minDate.getMonth()
779
+ : maxDate && monthIsOutsideMax(props, month)
780
+ ? maxDate.getMonth()
781
+ : undefined;
712
782
  }
713
- function navigationElementUp(props) {
714
- const { contentElement, inputElement, listElement, position } = props;
715
- if (position > 0) {
716
- const elements = listElement?.querySelectorAll(classElement);
717
- const newPosition = position - 1;
718
- elements?.item(newPosition)?.focus();
719
- return newPosition;
720
- }
721
- if (locationListIsBottom(contentElement, listElement)) {
722
- inputElement?.focus();
723
- }
724
- return POSITION_INITIAL;
783
+ function createMonthPicker(props) {
784
+ return [
785
+ createMonthState(props, Month.January),
786
+ createMonthState(props, Month.February),
787
+ createMonthState(props, Month.March),
788
+ createMonthState(props, Month.April),
789
+ createMonthState(props, Month.May),
790
+ createMonthState(props, Month.June),
791
+ createMonthState(props, Month.July),
792
+ createMonthState(props, Month.August),
793
+ createMonthState(props, Month.September),
794
+ createMonthState(props, Month.October),
795
+ createMonthState(props, Month.November),
796
+ createMonthState(props, Month.December)
797
+ ];
725
798
  }
726
- function listNavigationInput(props) {
727
- switch (props.event.code) {
728
- case 'ArrowDown':
729
- return navigationInputDown(props);
730
- case 'ArrowUp':
731
- return navigationInputUp(props);
732
- default:
733
- return undefined;
799
+ function monthIsLimitMin(props) {
800
+ const { month, date, minDate } = props;
801
+ if (itIsDefined(month) && date) {
802
+ const minYear = minDate ? minDate.getFullYear() : 0;
803
+ const minMonth = minDate ? minDate.getMonth() : 0;
804
+ return date.getFullYear() === minYear && month <= minMonth;
734
805
  }
806
+ return false;
735
807
  }
736
- function listNavigationElement(props) {
737
- const { event } = props;
738
- switch (event.code) {
739
- case 'ArrowDown':
740
- return navigationElementDown(props);
741
- case 'ArrowUp':
742
- return navigationElementUp(props);
743
- default:
744
- return POSITION_INITIAL;
745
- }
746
- }
747
-
748
- class ListCollection {
749
- constructor(value) {
750
- this.value = value;
751
- }
752
- find(element) {
753
- return this.value.find((current) => current.compareTo(element));
808
+ function monthIsLimitMax(props) {
809
+ const { month, date, maxDate } = props;
810
+ if (itIsDefined(month) && date) {
811
+ const maxYear = maxDate ? maxDate.getFullYear() : 10000;
812
+ const maxMonth = maxDate ? maxDate.getMonth() : 11;
813
+ return date.getFullYear() === maxYear && month >= maxMonth;
754
814
  }
815
+ return false;
816
+ }
817
+ function monthLimitTemplate(props) {
818
+ return {
819
+ limitNext: monthIsLimitMax(props),
820
+ limitPrevious: monthIsLimitMin(props)
821
+ };
755
822
  }
756
823
 
757
- function RlsDayPicker({ date, disabled: disabledPicker, formControl, maxDate, month, minDate, onValue, rlsTheme, year }) {
758
- const currentDate = date || new Date(); // Initial date
759
- const [weeks, setWeeks] = useState([]);
760
- const [value, setValue] = useState(formControl?.state || currentDate.getDate());
761
- useEffect(() => {
762
- const props = createPickerProps();
763
- const day = checkDayPicker(props);
764
- day ? setDayValue(day) : setWeeks(createDayPicker(props));
765
- }, [date, month, year, value, minDate, maxDate]);
766
- useEffect(() => {
767
- const day = checkDayPicker(createPickerProps());
768
- day
769
- ? formControl?.setState(day)
770
- : setValue(formControl?.state || currentDate.getDate());
771
- }, [formControl?.state]);
772
- function createPickerProps() {
773
- return {
774
- date: currentDate,
775
- day: formControl?.state || value,
776
- month: itIsDefined(month) ? month : currentDate.getMonth(),
777
- year: year || currentDate.getFullYear(),
778
- minDate,
779
- maxDate
780
- };
781
- }
782
- function setDayValue(value) {
783
- formControl ? formControl.setState(value) : setValue(value);
784
- }
785
- function onChange(value) {
786
- setDayValue(value);
787
- if (onValue) {
788
- onValue(value);
789
- }
790
- }
791
- return (jsxs("div", { className: "rls-day-picker", "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-day-picker__header", children: DAY_LABELS().map((title, index) => (jsx("label", { className: "rls-day-picker__label", children: title }, index))) }), jsx("div", { className: "rls-day-picker__component", children: weeks.map(({ days }, index) => (jsx("div", { className: "rls-day-picker__week", children: days.map(({ value, disabled, focused, forbidden, selected, today }, index) => (jsx("div", { className: renderClassStatus('rls-day-picker__day', {
792
- disabled: disabled || disabledPicker,
793
- focused,
794
- forbidden,
795
- selected,
796
- today
797
- }), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsx("span", { className: "rls-day-picker__day__span", children: value || '??' }) }, index))) }, index))) })] }));
798
- }
799
-
800
- const DATE_RANGE_FORMAT = '{dd}/{mx}/{aa}';
801
-
802
- function RlsDayRangePicker({ date, disabled: disabledPicker, formControl, maxDate, minDate, rlsTheme }) {
803
- const currentRange = formControl?.state || DateRange.now();
804
- const currentDate = normalizeMinTime(date || currentRange.minDate);
805
- const sourceDate = useRef(currentRange.minDate);
806
- const [weeks, setWeeks] = useState([]);
807
- const [range, setRange] = useState(currentRange);
808
- useEffect(() => {
809
- setWeeks(createDayRangePicker({
810
- date: currentDate,
811
- range,
812
- sourceDate: sourceDate.current,
813
- minDate,
814
- maxDate
815
- }));
816
- }, [range, date, minDate, maxDate]);
817
- function onChange(value) {
818
- const date = assignDayInDate(currentDate, value);
819
- const range = dateIsBefore(date, sourceDate.current)
820
- ? new DateRange(sourceDate.current, date)
821
- : new DateRange(date, sourceDate.current);
822
- sourceDate.current = date;
823
- setRange(range);
824
- formControl?.setState(range);
825
- }
826
- return (jsxs("div", { className: "rls-day-range-picker", "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-day-range-picker__title", children: dateFormatTemplate(sourceDate.current, DATE_RANGE_FORMAT) }), jsx("div", { className: "rls-day-range-picker__header", children: DAY_LABELS().map((title, index) => (jsx("label", { className: "rls-day-range-picker__label", children: title }, index))) }), jsx("div", { className: "rls-day-range-picker__component", children: weeks.map(({ days }, index) => (jsx("div", { className: "rls-day-range-picker__week", children: days.map(({ disabled, end, forbidden, source, ranged, value }, index) => (jsx("div", { className: renderClassStatus('rls-day-range-picker__day', {
827
- disabled: disabled || disabledPicker,
828
- end,
829
- forbidden,
830
- ranged,
831
- source
832
- }), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsx("span", { className: "rls-day-range-picker__day__span", children: value || '??' }) }, index))) }, index))) })] }));
833
- }
834
-
835
- function RlsMoneyField({ children, decimals, disabled, formControl, placeholder, symbol, rlsTheme, value, onValue }) {
836
- return (jsxs("div", { className: renderClassStatus('rls-box-field', {
837
- focused: formControl?.focused,
838
- error: formControl?.wrong,
839
- disabled: formControl?.disabled || disabled
840
- }, 'rls-money-field'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-box-field__label", children: children }), jsx("div", { className: "rls-box-field__component", children: jsx("div", { className: "rls-box-field__body", children: jsx(RlsInputMoney, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, symbol: symbol, decimals: decimals, onValue: onValue }) }) }), formControl?.touched && formControl?.error && (jsx("div", { className: "rls-box-field__error", children: jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl.error.message }) }))] }));
841
- }
842
-
843
- function RlsMonthPicker({ date, disabled: disabledPicker, formControl, maxDate, minDate, onValue, rlsTheme, year }) {
844
- const currentDate = date || new Date();
845
- const [months, setMonths] = useState([]);
846
- const [value, setValue] = useState(formControl?.state || currentDate.getMonth());
847
- useEffect(() => {
848
- const props = createPickerProps(); // MonthPickerProps
849
- const month = checkMonthPicker(props);
850
- month ? setMonthValue(month) : setMonths(createMonthPicker(props));
851
- }, [date, year, value, minDate, maxDate]);
852
- useEffect(() => {
853
- const month = checkMonthPicker(createPickerProps());
854
- itIsDefined(month)
855
- ? formControl?.setState(month)
856
- : setValue(formControl?.state || currentDate.getMonth());
857
- }, [formControl?.state]);
858
- function createPickerProps() {
859
- return {
860
- date: currentDate,
861
- month: itIsDefined(formControl?.state) ? formControl?.state : value,
862
- year: year || currentDate.getFullYear(),
863
- minDate,
864
- maxDate
865
- };
866
- }
867
- function setMonthValue(value) {
868
- formControl ? formControl.setState(value) : setValue(value);
869
- }
870
- function onChange(value) {
871
- setMonthValue(value);
872
- if (onValue) {
873
- onValue(value);
874
- }
875
- }
876
- return (jsx("div", { className: "rls-month-picker", "rls-theme": rlsTheme, children: months.map(({ label, value, disabled, focused, selected }, index) => (jsx("div", { className: renderClassStatus('rls-month-picker__component', {
877
- disabled: disabled || disabledPicker,
878
- focused,
879
- selected
880
- }), onClick: !(disabled || disabledPicker) ? () => onChange(value) : undefined, children: jsx("span", { className: "rls-month-picker__span", children: label }) }, index))) }));
881
- }
824
+ var PickerListenerType;
825
+ (function (PickerListenerType) {
826
+ PickerListenerType["Select"] = "PickerSelect";
827
+ PickerListenerType["Now"] = "PickerNow";
828
+ PickerListenerType["Cancel"] = "PickerCancel";
829
+ })(PickerListenerType || (PickerListenerType = {}));
882
830
 
883
- function RlsMonthTitlePicker({ monthControl, type, yearControl, date, disabled, maxDate, minDate, onClick }) {
884
- const { limitNext, limitPrevious } = monthLimitTemplate({
885
- date,
886
- maxDate,
887
- minDate,
888
- month: monthControl.state
889
- });
890
- const monthName = MONTH_NAMES()[monthControl.state || 0];
891
- function onPreviousMonth() {
892
- if (itIsDefined(monthControl.state) && itIsDefined(yearControl.state)) {
893
- if (monthControl.state > Month.January) {
894
- monthControl.setState(monthControl.state - 1);
895
- }
896
- else {
897
- monthControl.setState(Month.December);
898
- yearControl.setState(yearControl.state - 1);
899
- }
900
- }
901
- }
902
- function onPreviousYear() {
903
- if (itIsDefined(yearControl.state)) {
904
- yearControl.setState(yearControl.state - 1);
905
- }
906
- }
907
- function onPrevious() {
908
- type === 'month' ? onPreviousMonth() : onPreviousYear();
909
- }
910
- function onNextMonth() {
911
- if (itIsDefined(monthControl.state) && itIsDefined(yearControl.state)) {
912
- if (monthControl.state < Month.December) {
913
- monthControl.setState(monthControl.state + 1);
914
- }
915
- else {
916
- monthControl.setState(Month.January);
917
- yearControl.setState(yearControl.state + 1);
918
- }
919
- }
920
- }
921
- function onNextYear() {
922
- if (itIsDefined(yearControl.state)) {
923
- yearControl.setState(yearControl.state + 1);
924
- }
925
- }
926
- function onNext() {
927
- type === 'month' ? onNextMonth() : onNextYear();
928
- }
929
- return (jsxs("div", { className: "rls-month-title-picker", children: [jsx(RlsButtonAction, { icon: "arrow-ios-left", onClick: onPrevious, disabled: limitPrevious || disabled }), jsx("span", { onClick: onClick, children: monthName }), jsx(RlsButtonAction, { icon: "arrow-ios-right", onClick: onNext, disabled: limitNext || disabled })] }));
831
+ function createYear(props, value) {
832
+ const { date, year } = props;
833
+ return {
834
+ disabled: !value,
835
+ focused: value === year,
836
+ selected: value === date.getFullYear(),
837
+ value
838
+ };
839
+ }
840
+ function yearIsOutlineMin(props) {
841
+ const { year, minDate } = props;
842
+ return minDate ? year < minDate.getFullYear() : false;
843
+ }
844
+ function yearIsOutlineMax(props) {
845
+ const { year, maxDate } = props;
846
+ return maxDate ? year > maxDate.getFullYear() : false;
847
+ }
848
+ function checkYearPicker(props) {
849
+ const { maxDate, minDate } = props;
850
+ return minDate && yearIsOutlineMin(props)
851
+ ? minDate.getFullYear()
852
+ : maxDate && yearIsOutlineMax(props)
853
+ ? maxDate.getFullYear()
854
+ : undefined;
855
+ }
856
+ function createYearPicker(props) {
857
+ const { year, maxDate, minDate } = props;
858
+ const prevYears = [];
859
+ const nextYears = [];
860
+ let minRange = year;
861
+ let maxRange = year;
862
+ const minYear = minDate?.getFullYear() || 0;
863
+ const maxYear = maxDate?.getFullYear() || 10000;
864
+ for (let index = 0; index < COUNT_YEAR_RANGE; index++) {
865
+ const prevValue = year - COUNT_YEAR_RANGE + index;
866
+ const nextValue = year + index + 1;
867
+ const prevYear = prevValue >= minYear ? prevValue : undefined;
868
+ const nextYear = nextValue <= maxYear ? nextValue : undefined;
869
+ const prevState = createYear(props, prevYear);
870
+ const nextState = createYear(props, nextYear);
871
+ prevYears.push(prevState);
872
+ nextYears.push(nextState);
873
+ if (!!prevState.value && minRange > prevState.value) {
874
+ minRange = prevState.value;
875
+ }
876
+ if (!!nextState.value && maxRange < nextState.value) {
877
+ maxRange = nextState.value;
878
+ }
879
+ }
880
+ const yearCenter = createYear(props, year);
881
+ return {
882
+ canPrevious: minYear < minRange,
883
+ canNext: maxYear > maxRange,
884
+ maxRange,
885
+ minRange,
886
+ years: [...prevYears, yearCenter, ...nextYears]
887
+ };
930
888
  }
931
889
 
932
- function RlsNumberField({ children, disabled, formControl, placeholder, rlsTheme, value, onValue }) {
933
- return (jsxs("div", { className: renderClassStatus('rls-box-field', {
934
- focused: formControl?.focused,
935
- error: formControl?.wrong,
936
- disabled: formControl?.disabled || disabled
937
- }, 'rls-number-field'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-box-field__label", children: children }), jsx("div", { className: "rls-box-field__component", children: jsx("div", { className: "rls-box-field__body", children: jsx(RlsInputNumber, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, onValue: onValue }) }) }), formControl?.touched && formControl?.error && (jsx("div", { className: "rls-box-field__error", children: jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl.error.message }) }))] }));
890
+ function createEmptyStore() {
891
+ return {
892
+ coincidences: undefined,
893
+ pattern: '',
894
+ previous: null
895
+ };
896
+ }
897
+ function searchForPattern(props) {
898
+ const { pattern, store } = props;
899
+ if (!store?.pattern) {
900
+ return null;
901
+ }
902
+ let newStore = store;
903
+ let search = false;
904
+ while (!search && newStore) {
905
+ search = hasPattern(pattern || '', newStore.pattern, true);
906
+ if (!search) {
907
+ newStore = newStore.previous;
908
+ }
909
+ }
910
+ return newStore || createEmptyStore();
911
+ }
912
+ function createStoreAutocomplete(props) {
913
+ const { pattern, suggestions, reboot } = props;
914
+ if (!pattern) {
915
+ return { collection: suggestions, store: createEmptyStore() };
916
+ }
917
+ const store = reboot ? createEmptyStore() : searchForPattern(props);
918
+ const elements = store?.coincidences || suggestions;
919
+ const coincidences = elements.filter((element) => element.hasCoincidence(pattern));
920
+ return {
921
+ collection: coincidences,
922
+ store: {
923
+ coincidences,
924
+ pattern,
925
+ previous: store
926
+ }
927
+ };
938
928
  }
939
929
 
940
- const DEFAULT_COUNT_ELEMENT = 20;
941
- const MIN_NUMBER_PAGE = 1;
942
- const FIRST_PAGE = 0;
943
- const DEFAULT_MAX_VISIBLE = 4;
944
- function RlsPagination({ elements, count: defaultCount, filter, onElements, onPagination }) {
945
- const count = defaultCount || DEFAULT_COUNT_ELEMENT;
946
- const [collection, setCollection] = useState([]);
947
- const [index, setIndex] = useState(0);
948
- const [maxPage, setMaxPage] = useState(calculateMaxPage(elements, count));
949
- const [paginations, setPaginations] = useState([]);
950
- const [currentPagination, setCurrentPagination] = useState();
951
- const [description, setDescription] = useState('');
952
- const [firstPage, setFirstPage] = useState(true);
953
- const [lastPage, setLastPage] = useState(false);
954
- useEffect(() => {
955
- refreshFromElements(elements);
956
- }, [elements]);
957
- useEffect(() => {
958
- const isFirstPage = currentPagination?.value === FIRST_PAGE;
959
- const isLastPage = currentPagination?.value === maxPage - 1;
960
- setFirstPage(isFirstPage);
961
- setLastPage(isLastPage);
962
- if (onPagination) {
963
- onPagination({ firstPage: isFirstPage, lastPage: isLastPage });
964
- }
965
- }, [currentPagination]);
966
- useEffect(() => {
967
- refreshFromFilter(filter);
968
- }, [filter]);
969
- function onChangeElements(elements) {
970
- if (onElements) {
971
- onElements(elements);
972
- }
973
- }
974
- function calculateMaxPage(collection, count) {
975
- return collection.length ? Math.ceil(collection.length / count) : 0;
976
- }
977
- function onSelectPagination(pagination) {
978
- const { value } = pagination;
979
- pagination.active = true;
980
- setIndex(value);
981
- setCurrentPagination(pagination);
982
- refreshFromChanged(clonePage({ index: value }));
983
- }
984
- function goPagination(pagination) {
985
- if (currentPagination) {
986
- currentPagination.active = false;
987
- }
988
- onSelectPagination(pagination);
989
- }
990
- function goPreviousPagination() {
991
- if (currentPagination) {
992
- const { prev, value } = currentPagination;
993
- if (prev) {
994
- onSelectPagination(prev);
995
- currentPagination.active = false;
996
- }
997
- else {
998
- const prevIndex = value - MIN_NUMBER_PAGE;
999
- if (prevIndex >= FIRST_PAGE) {
1000
- refreshFromChanged(clonePageFromIndex(prevIndex));
1001
- }
1002
- }
1003
- }
1004
- }
1005
- function goFirstPagination() {
1006
- if (collection.length) {
1007
- refreshFromChanged(clonePageFromIndex(FIRST_PAGE));
1008
- }
1009
- }
1010
- function goNextPagination() {
1011
- if (currentPagination) {
1012
- const { next, value } = currentPagination;
1013
- if (next) {
1014
- onSelectPagination(next);
1015
- currentPagination.active = false;
1016
- }
1017
- else {
1018
- const nextIndex = value + 1;
1019
- if (nextIndex <= maxPage) {
1020
- refreshFromChanged(clonePageFromIndex(nextIndex));
1021
- }
1022
- }
1023
- }
1024
- }
1025
- function goLastPagination() {
1026
- if (collection.length) {
1027
- refreshFromChanged(clonePageFromIndex(maxPage - MIN_NUMBER_PAGE));
1028
- }
1029
- }
1030
- function createPageCollection(props) {
1031
- const { collection, count, index } = props;
1032
- if (collection.length) {
1033
- const finish = (index + MIN_NUMBER_PAGE) * count;
1034
- const start = index * count;
1035
- return collection.slice(start, finish);
1036
- }
1037
- return [];
1038
- }
1039
- function refreshFromElements(elements) {
1040
- elements.length
1041
- ? refreshFromChanged(refreshPage(elements, filter))
1042
- : rebootPagination();
1043
- }
1044
- function refreshFromFilter(filter) {
1045
- refreshFromChanged(refreshPage(elements, filter));
1046
- }
1047
- function refreshFromChanged(page) {
1048
- refreshPaginations(page);
1049
- refreshDescription(page);
1050
- onChangeElements(createPageCollection(page));
1051
- }
1052
- function refreshCollection(elements, filter) {
1053
- const collection = filter
1054
- ? elements.filter((element) => hasPattern(JSON.stringify(element), filter))
1055
- : elements;
1056
- setCollection(collection);
1057
- return collection;
1058
- }
1059
- function refreshMaxPage(collection, count) {
1060
- const maxPage = calculateMaxPage(collection, count);
1061
- setMaxPage(maxPage);
1062
- return maxPage;
1063
- }
1064
- function refreshIndex(collection, currentMaxPage) {
1065
- const maxPage = currentMaxPage || refreshMaxPage(collection, count);
1066
- if (index < maxPage || index === FIRST_PAGE) {
1067
- return index;
1068
- }
1069
- const newIndex = maxPage - 1;
1070
- setIndex(newIndex);
1071
- return newIndex;
1072
- }
1073
- function refreshDescription(page) {
1074
- const { collection, count, index } = page;
1075
- const totalCount = elements.length;
1076
- const start = index * count + MIN_NUMBER_PAGE;
1077
- let end = (index + MIN_NUMBER_PAGE) * count;
1078
- if (end > collection.length) {
1079
- end = collection.length;
1080
- }
1081
- setDescription(`${start} - ${end} de ${totalCount}`);
1082
- }
1083
- function refreshPaginations({ index, maxPage }) {
1084
- let maxPageVisible = index + DEFAULT_MAX_VISIBLE;
1085
- if (maxPageVisible > maxPage) {
1086
- maxPageVisible = maxPage;
1087
- }
1088
- let minIndexPage = maxPageVisible - DEFAULT_MAX_VISIBLE;
1089
- if (minIndexPage < 0) {
1090
- minIndexPage = 0;
1091
- }
1092
- if (minIndexPage > index) {
1093
- minIndexPage = index;
1094
- }
1095
- let prevPagination = undefined;
1096
- const paginations = [];
1097
- for (let i = minIndexPage; i < maxPageVisible; i++) {
1098
- const pagination = createPagination(i, index);
1099
- paginations.push(pagination);
1100
- pagination.prev = prevPagination;
1101
- if (prevPagination) {
1102
- prevPagination.next = pagination;
1103
- }
1104
- prevPagination = pagination;
1105
- }
1106
- setPaginations(paginations);
1107
- }
1108
- function clonePage(pagePartial) {
930
+ const classElement = '.rls-list-field__element';
931
+ const POSITION_INITIAL = 0;
932
+ function locationListIsBottom(contentElement, listElement) {
933
+ if (contentElement && listElement) {
934
+ const { top, height } = contentElement.getBoundingClientRect();
935
+ const { clientHeight } = listElement;
936
+ return top + height + clientHeight < window.innerHeight;
937
+ }
938
+ return true;
939
+ }
940
+ function navigationInputDown(props) {
941
+ const { contentElement, listElement } = props;
942
+ if (!locationListIsBottom(contentElement, listElement)) {
943
+ return undefined;
944
+ }
945
+ const elements = listElement?.querySelectorAll(classElement);
946
+ if (elements?.length) {
947
+ elements.item(0).focus();
948
+ setTimeout(() => {
949
+ listElement?.scroll({ top: 0, behavior: 'smooth' });
950
+ }, 100);
951
+ }
952
+ return POSITION_INITIAL;
953
+ }
954
+ function navigationInputUp(props) {
955
+ const { contentElement, listElement } = props;
956
+ if (locationListIsBottom(contentElement, listElement)) {
957
+ return undefined;
958
+ }
959
+ const elements = listElement?.querySelectorAll(classElement);
960
+ if (!elements?.length) {
961
+ return POSITION_INITIAL;
962
+ }
963
+ const position = elements.length - 1;
964
+ const element = elements.item(position);
965
+ element?.focus();
966
+ setTimeout(() => {
967
+ listElement?.scroll({
968
+ top: element?.offsetTop + element?.offsetLeft,
969
+ behavior: 'smooth'
970
+ });
971
+ }, 100);
972
+ return position;
973
+ }
974
+ function navigationElementDown(props) {
975
+ const { contentElement, inputElement, listElement, position } = props;
976
+ const elements = listElement?.querySelectorAll(classElement);
977
+ const newPosition = position + 1;
978
+ if (newPosition < (elements?.length || 0)) {
979
+ elements?.item(newPosition)?.focus();
980
+ return newPosition;
981
+ }
982
+ if (!locationListIsBottom(contentElement, listElement)) {
983
+ inputElement?.focus();
984
+ }
985
+ return position;
986
+ }
987
+ function navigationElementUp(props) {
988
+ const { contentElement, inputElement, listElement, position } = props;
989
+ if (position > 0) {
990
+ const elements = listElement?.querySelectorAll(classElement);
991
+ const newPosition = position - 1;
992
+ elements?.item(newPosition)?.focus();
993
+ return newPosition;
994
+ }
995
+ if (locationListIsBottom(contentElement, listElement)) {
996
+ inputElement?.focus();
997
+ }
998
+ return POSITION_INITIAL;
999
+ }
1000
+ function listNavigationInput(props) {
1001
+ switch (props.event.code) {
1002
+ case 'ArrowDown':
1003
+ return navigationInputDown(props);
1004
+ case 'ArrowUp':
1005
+ return navigationInputUp(props);
1006
+ default:
1007
+ return undefined;
1008
+ }
1009
+ }
1010
+ function listNavigationElement(props) {
1011
+ const { event } = props;
1012
+ switch (event.code) {
1013
+ case 'ArrowDown':
1014
+ return navigationElementDown(props);
1015
+ case 'ArrowUp':
1016
+ return navigationElementUp(props);
1017
+ default:
1018
+ return POSITION_INITIAL;
1019
+ }
1020
+ }
1021
+
1022
+ class ListCollection {
1023
+ constructor(value) {
1024
+ this.value = value;
1025
+ }
1026
+ find(element) {
1027
+ return this.value.find((current) => current.compareTo(element));
1028
+ }
1029
+ }
1030
+
1031
+ function RlsPickerDay({ date, disabled: disabledPicker, formControl, maxDate, month, minDate, onValue, rlsTheme, year }) {
1032
+ const currentDate = date || new Date(); // Initial date
1033
+ const [weeks, setWeeks] = useState([]);
1034
+ const [value, setValue] = useState(formControl?.state || currentDate.getDate());
1035
+ useEffect(() => {
1036
+ const props = createPickerProps();
1037
+ const day = checkDayPicker(props);
1038
+ day ? setDayValue(day) : setWeeks(createDayPicker(props));
1039
+ }, [date, month, year, value, minDate, maxDate]);
1040
+ useEffect(() => {
1041
+ const day = checkDayPicker(createPickerProps());
1042
+ day
1043
+ ? formControl?.setState(day)
1044
+ : setValue(formControl?.state || currentDate.getDate());
1045
+ }, [formControl?.state]);
1046
+ function createPickerProps() {
1109
1047
  return {
1110
- collection: pagePartial.collection || collection,
1111
- index: typeof pagePartial.index === 'number' ? pagePartial.index : index,
1112
- count: pagePartial.count || count,
1113
- maxPage: typeof pagePartial.maxPage === 'number' ? pagePartial.maxPage : maxPage
1048
+ date: currentDate,
1049
+ day: formControl?.state || value,
1050
+ month: itIsDefined(month) ? month : currentDate.getMonth(),
1051
+ year: year || currentDate.getFullYear(),
1052
+ minDate,
1053
+ maxDate
1114
1054
  };
1115
1055
  }
1116
- function clonePageFromIndex(index) {
1117
- return clonePage({ index });
1118
- }
1119
- function refreshPage(elements, filter) {
1120
- const collection = refreshCollection(elements, filter);
1121
- const maxPage = refreshMaxPage(collection, count);
1122
- const index = refreshIndex(collection, maxPage);
1123
- return clonePage({ collection, index, maxPage });
1056
+ function setDayValue(value) {
1057
+ formControl ? formControl.setState(value) : setValue(value);
1124
1058
  }
1125
- function createPagination(value, index) {
1126
- const active = value === index;
1127
- const pagination = {
1128
- label: (value + 1).toString(),
1129
- value,
1130
- active
1131
- };
1132
- if (active) {
1133
- setCurrentPagination(pagination);
1059
+ function onChange(value) {
1060
+ setDayValue(value);
1061
+ if (onValue) {
1062
+ onValue(value);
1134
1063
  }
1135
- return pagination;
1136
- }
1137
- function rebootPagination() {
1138
- setCollection([]);
1139
- setMaxPage(0);
1140
- setIndex(0);
1141
- setPaginations([]);
1142
- onChangeElements([]);
1143
1064
  }
1144
- return (jsxs("div", { className: "rls-pagination", children: [jsxs("div", { className: "rls-pagination__actions", children: [jsx("button", { className: "rls-pagination__action", onClick: goFirstPagination, disabled: firstPage, children: jsx(RlsIcon, { value: "arrowhead-left" }) }), jsx("button", { className: "rls-pagination__action", onClick: goPreviousPagination, disabled: firstPage, children: jsx(RlsIcon, { value: "arrow-ios-left" }) })] }), jsx("div", { className: "rls-pagination__pages", children: paginations.map((page, index) => {
1145
- return (jsx("div", { className: renderClassStatus('rls-pagination__page', {
1146
- active: page.active
1147
- }), onClick: () => {
1148
- goPagination(page);
1149
- }, children: page.label }, index));
1150
- }) }), jsx("div", { className: "rls-pagination__description", children: description }), jsxs("div", { className: "rls-pagination__actions", children: [jsx("button", { className: "rls-pagination__action", onClick: goNextPagination, disabled: lastPage, children: jsx(RlsIcon, { value: "arrow-ios-right" }) }), jsx("button", { className: "rls-pagination__action", onClick: goLastPagination, disabled: lastPage, children: jsx(RlsIcon, { value: "arrowhead-right" }) })] })] }));
1065
+ return (jsxs("div", { className: "rls-picker-day", "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-picker-day__header", children: DAY_LABELS().map((title, index) => (jsx("label", { className: "rls-picker-day__label", children: title }, index))) }), jsx("div", { className: "rls-picker-day__component", children: weeks.map(({ days }, index) => (jsx("div", { className: "rls-picker-day__week", children: days.map(({ value, disabled, focused, forbidden, selected, today }, index) => (jsx("div", { className: renderClassStatus('rls-picker-day__element', {
1066
+ disabled: disabled || disabledPicker,
1067
+ focused,
1068
+ forbidden,
1069
+ selected,
1070
+ today
1071
+ }), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsx("span", { className: "rls-picker-day__element__span", children: value || '??' }) }, index))) }, index))) })] }));
1151
1072
  }
1152
1073
 
1153
- function RlsPasswordField({ children, disabled, formControl, placeholder, rlsTheme }) {
1154
- const [password, setPassword] = useState(true);
1155
- function onToggleInput() {
1156
- setPassword(!password);
1074
+ const DATE_RANGE_FORMAT = '{dd}/{mx}/{aa}';
1075
+
1076
+ function RlsPickerDayRange({ date, disabled: disabledPicker, formControl, maxDate, minDate, rlsTheme }) {
1077
+ const currentRange = formControl?.state || DateRange.now();
1078
+ const currentDate = normalizeMinTime(date || currentRange.minDate);
1079
+ const sourceDate = useRef(currentRange.minDate);
1080
+ const [weeks, setWeeks] = useState([]);
1081
+ const [range, setRange] = useState(currentRange);
1082
+ useEffect(() => {
1083
+ setWeeks(createDayRangePicker({
1084
+ date: currentDate,
1085
+ range,
1086
+ sourceDate: sourceDate.current,
1087
+ minDate,
1088
+ maxDate
1089
+ }));
1090
+ }, [range, date, minDate, maxDate]);
1091
+ function onChange(value) {
1092
+ const date = assignDayInDate(currentDate, value);
1093
+ const range = dateIsBefore(date, sourceDate.current)
1094
+ ? new DateRange(sourceDate.current, date)
1095
+ : new DateRange(date, sourceDate.current);
1096
+ sourceDate.current = date;
1097
+ setRange(range);
1098
+ formControl?.setState(range);
1157
1099
  }
1158
- return (jsxs("div", { className: renderClassStatus(' rls-box-field', {
1159
- focused: formControl?.focused,
1160
- error: formControl?.wrong,
1161
- disabled: formControl?.disabled || disabled
1162
- }, 'rls-password-field'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-box-field__label", children: children }), jsx("div", { className: "rls-box-field__component", children: jsxs("div", { className: "rls-box-field__body", children: [jsx(RlsInputPassword, { formControl: formControl, disabled: disabled, placeholder: placeholder, type: password ? 'password' : 'text' }), jsx(RlsButtonAction, { icon: password ? 'eye' : 'eye-off', onClick: onToggleInput })] }) }), formControl?.touched && formControl?.error && (jsx("div", { className: "rls-box-field__error", children: jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl.error.message }) }))] }));
1100
+ return (jsxs("div", { className: "rls-picker-day-range", "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-picker-day-range__title", children: dateFormatTemplate(sourceDate.current, DATE_RANGE_FORMAT) }), jsx("div", { className: "rls-picker-day-range__header", children: DAY_LABELS().map((title, index) => (jsx("label", { className: "rls-picker-day-range__label", children: title }, index))) }), jsx("div", { className: "rls-picker-day-range__component", children: weeks.map(({ days }, index) => (jsx("div", { className: "rls-picker-day-range__week", children: days.map(({ disabled, end, forbidden, source, ranged, value }, index) => (jsx("div", { className: renderClassStatus('rls-picker-day-range__element', {
1101
+ disabled: disabled || disabledPicker,
1102
+ end,
1103
+ forbidden,
1104
+ ranged,
1105
+ source
1106
+ }), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsx("span", { className: "rls-picker-day-range__element__span", children: value || '??' }) }, index))) }, index))) })] }));
1163
1107
  }
1164
1108
 
1165
- function RlsRadioButtonLabel({ children, disabled, extended, formControl, rlsTheme, value }) {
1166
- const [checked, setChecked] = useState(formControl?.state || false);
1109
+ function RlsPickerMonth({ date, disabled: disabledPicker, formControl, maxDate, minDate, onValue, rlsTheme, year }) {
1110
+ const currentDate = date || new Date();
1111
+ const [months, setMonths] = useState([]);
1112
+ const [value, setValue] = useState(formControl?.state || currentDate.getMonth());
1167
1113
  useEffect(() => {
1168
- setChecked(formControl?.state === value);
1114
+ const props = createPickerProps(); // MonthPickerProps
1115
+ const month = checkMonthPicker(props);
1116
+ month ? setMonthValue(month) : setMonths(createMonthPicker(props));
1117
+ }, [date, year, value, minDate, maxDate]);
1118
+ useEffect(() => {
1119
+ const month = checkMonthPicker(createPickerProps());
1120
+ itIsDefined(month)
1121
+ ? formControl?.setState(month)
1122
+ : setValue(formControl?.state || currentDate.getMonth());
1169
1123
  }, [formControl?.state]);
1170
- function onSelect() {
1171
- if (formControl) {
1172
- formControl?.setState(value);
1124
+ function createPickerProps() {
1125
+ return {
1126
+ date: currentDate,
1127
+ month: itIsDefined(formControl?.state) ? formControl?.state : value,
1128
+ year: year || currentDate.getFullYear(),
1129
+ minDate,
1130
+ maxDate
1131
+ };
1132
+ }
1133
+ function setMonthValue(value) {
1134
+ formControl ? formControl.setState(value) : setValue(value);
1135
+ }
1136
+ function onChange(value) {
1137
+ setMonthValue(value);
1138
+ if (onValue) {
1139
+ onValue(value);
1140
+ }
1141
+ }
1142
+ return (jsx("div", { className: "rls-picker-month", "rls-theme": rlsTheme, children: months.map(({ label, value, disabled, focused, selected }, index) => (jsx("div", { className: renderClassStatus('rls-picker-month__component', {
1143
+ disabled: disabled || disabledPicker,
1144
+ focused,
1145
+ selected
1146
+ }), onClick: !(disabled || disabledPicker) ? () => onChange(value) : undefined, children: jsx("span", { className: "rls-picker-month__span", children: label }) }, index))) }));
1147
+ }
1148
+
1149
+ function RlsPickerMonthTitle({ monthControl, type, yearControl, date, disabled, maxDate, minDate, onClick }) {
1150
+ const { limitNext, limitPrevious } = monthLimitTemplate({
1151
+ date,
1152
+ maxDate,
1153
+ minDate,
1154
+ month: monthControl.state
1155
+ });
1156
+ const monthName = MONTH_NAMES()[monthControl.state || 0];
1157
+ function onPreviousMonth() {
1158
+ if (itIsDefined(monthControl.state) && itIsDefined(yearControl.state)) {
1159
+ if (monthControl.state > Month.January) {
1160
+ monthControl.setState(monthControl.state - 1);
1161
+ }
1162
+ else {
1163
+ monthControl.setState(Month.December);
1164
+ yearControl.setState(yearControl.state - 1);
1165
+ }
1173
1166
  }
1174
1167
  }
1175
- return (jsxs("div", { className: renderClassStatus('rls-radiobutton-label', {
1176
- disabled,
1177
- extended
1178
- }), "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-radiobutton-label__component", onClick: onSelect, children: jsx(RlsRadioButton, { checked: checked, disabled: disabled }) }), jsx("label", { className: "rls-radiobutton-label__text", children: children })] }));
1179
- }
1180
-
1181
- function RlsSwitchLabel({ children, disabled, extended, formControl, rlsTheme }) {
1182
- const [checked, setChecked] = useState(formControl?.value || false);
1183
- useEffect(() => {
1184
- setChecked(formControl?.state || false);
1185
- }, [formControl?.state]);
1186
- function onToggle() {
1187
- if (formControl) {
1188
- formControl?.setState(!formControl.state);
1168
+ function onPreviousYear() {
1169
+ if (itIsDefined(yearControl.state)) {
1170
+ yearControl.setState(yearControl.state - 1);
1189
1171
  }
1190
- else {
1191
- setChecked(!checked);
1172
+ }
1173
+ function onPrevious() {
1174
+ type === 'month' ? onPreviousMonth() : onPreviousYear();
1175
+ }
1176
+ function onNextMonth() {
1177
+ if (itIsDefined(monthControl.state) && itIsDefined(yearControl.state)) {
1178
+ if (monthControl.state < Month.December) {
1179
+ monthControl.setState(monthControl.state + 1);
1180
+ }
1181
+ else {
1182
+ monthControl.setState(Month.January);
1183
+ yearControl.setState(yearControl.state + 1);
1184
+ }
1192
1185
  }
1193
1186
  }
1194
- return (jsxs("div", { className: renderClassStatus('rls-switch-label', { disabled, extended }), "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-switch-label__component", onClick: onToggle, children: jsx(RlsSwitch, { checked: checked, disabled: disabled }) }), jsx("label", { className: "rls-switch-label__text", children: children })] }));
1195
- }
1196
-
1197
- function RlsTextField({ children, disabled, formControl, placeholder, rlsTheme, value, onValue }) {
1198
- return (jsxs("div", { className: renderClassStatus('rls-box-field', {
1199
- focused: formControl?.focused,
1200
- error: formControl?.wrong,
1201
- disabled: formControl?.disabled || disabled
1202
- }, 'rls-text-field'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-box-field__label", children: children }), jsx("div", { className: "rls-box-field__component", children: jsx("div", { className: "rls-box-field__body", children: jsx(RlsInputText, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, onValue: onValue }) }) }), formControl?.touched && formControl?.error && (jsx("div", { className: "rls-box-field__error", children: jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl.error.message }) }))] }));
1203
- }
1204
-
1205
- function RlsToolbar({ actions, children, subtitle }) {
1206
- return (jsxs("div", { className: "rls-toolbar", children: [jsxs("div", { className: "rls-toolbar__description", children: [children && jsx("label", { className: "rls-toolbar__title", children: children }), subtitle && (jsx("label", { className: "rls-toolbar__subtitle smalltext-semibold", children: subtitle }))] }), actions && (jsx("div", { className: "rls-toolbar__actions", children: actions.map((action, index) => (jsx("div", { children: action }, index))) }))] }));
1187
+ function onNextYear() {
1188
+ if (itIsDefined(yearControl.state)) {
1189
+ yearControl.setState(yearControl.state + 1);
1190
+ }
1191
+ }
1192
+ function onNext() {
1193
+ type === 'month' ? onNextMonth() : onNextYear();
1194
+ }
1195
+ return (jsxs("div", { className: "rls-picker-month-title", children: [jsx(RlsButtonAction, { icon: "arrow-ios-left", onClick: onPrevious, disabled: limitPrevious || disabled }), jsx("span", { onClick: onClick, children: monthName }), jsx(RlsButtonAction, { icon: "arrow-ios-right", onClick: onNext, disabled: limitNext || disabled })] }));
1207
1196
  }
1208
1197
 
1209
- function RlsYearPicker({ date, disabled: disabledPicker, formControl, maxDate, minDate, onValue, rlsTheme }) {
1198
+ function RlsPickerYear({ date, disabled: disabledPicker, formControl, maxDate, minDate, onValue, rlsTheme }) {
1210
1199
  const currentDate = date || new Date();
1211
1200
  const [value, setValue] = useState(formControl?.state || currentDate.getFullYear());
1212
1201
  const [year, setYear] = useState(formControl?.state || currentDate.getFullYear());
@@ -1248,11 +1237,19 @@ function RlsYearPicker({ date, disabled: disabledPicker, formControl, maxDate, m
1248
1237
  onValue(value);
1249
1238
  }
1250
1239
  }
1251
- return (jsxs("div", { className: "rls-year-picker", "rls-theme": rlsTheme, children: [jsxs("div", { className: "rls-year-picker__header", children: [jsx("div", { className: "rls-year-picker__action rls-year-picker__action--prev", children: jsx(RlsButtonAction, { icon: "arrow-ios-left", onClick: onClickPrev, disabled: !template.canPrevious || disabledPicker }) }), jsxs("label", { className: "rls-title-bold", children: [template.minRange, " - ", template.maxRange] }), jsx("div", { className: "rls-year-picker__action rls-year-picker__action--next", children: jsx(RlsButtonAction, { icon: "arrow-ios-right", onClick: onClickNext, disabled: !template.canNext || disabledPicker }) })] }), jsx("div", { className: "rls-year-picker__component", children: template.years.map(({ value, disabled, focused, selected }, index) => (jsx("div", { className: renderClassStatus('rls-year-picker__year', {
1240
+ return (jsxs("div", { className: "rls-picker-year", "rls-theme": rlsTheme, children: [jsxs("div", { className: "rls-picker-year__header", children: [jsx("div", { className: "rls-picker-year__action rls-picker-year__action--prev", children: jsx(RlsButtonAction, { icon: "arrow-ios-left", onClick: onClickPrev, disabled: !template.canPrevious || disabledPicker }) }), jsxs("label", { className: "rls-title-bold", children: [template.minRange, " - ", template.maxRange] }), jsx("div", { className: "rls-picker-year__action rls-picker-year__action--next", children: jsx(RlsButtonAction, { icon: "arrow-ios-right", onClick: onClickNext, disabled: !template.canNext || disabledPicker }) })] }), jsx("div", { className: "rls-picker-year__component", children: template.years.map(({ value, disabled, focused, selected }, index) => (jsx("div", { className: renderClassStatus('rls-picker-year__year', {
1252
1241
  disabled: disabled || disabledPicker,
1253
1242
  focused,
1254
1243
  selected
1255
- }), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsx("span", { className: "rls-year-picker__year__span rls-body1-medium", children: value || '????' }) }, index))) })] }));
1244
+ }), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsx("span", { className: "rls-picker-year__year__span rls-body1-medium", children: value || '????' }) }, index))) })] }));
1245
+ }
1246
+
1247
+ function RlsToolbar({ actions, children, subtitle }) {
1248
+ return (jsxs("div", { className: "rls-toolbar", children: [jsxs("div", { className: "rls-toolbar__description", children: [children && jsx("label", { className: "rls-toolbar__title", children: children }), subtitle && (jsx("label", { className: "rls-toolbar__subtitle smalltext-semibold", children: subtitle }))] }), actions && (jsx("div", { className: "rls-toolbar__actions", children: actions.map((action, index) => (jsx("div", { children: action }, index))) }))] }));
1249
+ }
1250
+
1251
+ function RlsCard({ children, outline, rlsTheme }) {
1252
+ return (jsx("div", { className: renderClassStatus('rls-card', { outline }), "rls-theme": rlsTheme, children: jsx("div", { className: "rls-card__content", children: children }) }));
1256
1253
  }
1257
1254
 
1258
1255
  const reactI18n = i18n({
@@ -1276,6 +1273,87 @@ const reactI18n = i18n({
1276
1273
  }
1277
1274
  });
1278
1275
 
1276
+ class ConfirmationResult extends PartialSealed {
1277
+ static approved() {
1278
+ return new ConfirmationResult('approved');
1279
+ }
1280
+ static reject() {
1281
+ return new ConfirmationResult('reject');
1282
+ }
1283
+ }
1284
+ function RlsConfirmation({ approved, content, reject, rlsTheme, subtitle, title, visible }) {
1285
+ return (jsxs("div", { className: renderClassStatus('rls-confirmation', { visible }), "rls-theme": rlsTheme, children: [jsxs("div", { className: "rls-confirmation__component", children: [jsxs("div", { className: "rls-confirmation__header", children: [title && (jsx("div", { className: "rls-confirmation__header__title", children: title })), subtitle && (jsx("div", { className: "rls-confirmation__header__subtitle", children: subtitle }))] }), jsx("div", { className: "rls-confirmation__body", children: content && (jsx("div", { className: "rls-confirmation__body__content", children: content })) }), (approved || reject) && (jsx("div", { className: "rls-confirmation__footer", children: jsxs("div", { className: "rls-confirmation__footer__actions", children: [approved && (jsx(RlsButton, { type: "raised", onClick: () => {
1286
+ if (approved.onClick) {
1287
+ approved.onClick();
1288
+ }
1289
+ }, children: approved.label })), reject && (jsx(RlsButton, { type: "outline", onClick: () => {
1290
+ if (reject.onClick) {
1291
+ reject.onClick();
1292
+ }
1293
+ }, children: reject.label }))] }) }))] }), jsx("div", { className: "rls-confirmation__backdrop" })] }));
1294
+ }
1295
+ function useConfirmationService() {
1296
+ const [config, setConfig] = useState({});
1297
+ const [visible, setVisible] = useState(false);
1298
+ const rlsConfirmation = ReactDOM.createPortal(jsx(RlsConfirmation, { ...config, visible: visible }), document.body);
1299
+ function confirmation(config) {
1300
+ return new Promise((resolve) => {
1301
+ const { content, rlsTheme, subtitle, title, approved, reject } = config;
1302
+ setConfig({
1303
+ content,
1304
+ rlsTheme,
1305
+ subtitle,
1306
+ title,
1307
+ approved: {
1308
+ label: approved || reactI18n('confirmationActionApproved'),
1309
+ onClick: () => {
1310
+ setVisible(false);
1311
+ resolve(ConfirmationResult.approved());
1312
+ }
1313
+ },
1314
+ reject: reject
1315
+ ? {
1316
+ label: reject,
1317
+ onClick: () => {
1318
+ setVisible(false);
1319
+ resolve(ConfirmationResult.reject());
1320
+ }
1321
+ }
1322
+ : undefined
1323
+ });
1324
+ setVisible(true);
1325
+ });
1326
+ }
1327
+ return {
1328
+ RlsConfirmation: rlsConfirmation,
1329
+ confirmation
1330
+ };
1331
+ }
1332
+
1333
+ function RlsDatatableHeader({ children }) {
1334
+ return jsx("tr", { className: "rls-datatable__header", children: children });
1335
+ }
1336
+ function RlsDatatableTitle({ children, className, control }) {
1337
+ return (jsx("th", { className: renderClassStatus('rls-datatable__title', { control }, className).trim(), children: children }));
1338
+ }
1339
+ function RlsDatatableData({ children, className, error }) {
1340
+ return (jsx("tr", { className: renderClassStatus('rls-datatable__data', { error }, className).trim(), children: children }));
1341
+ }
1342
+ function RlsDatatableCell({ children, className, control, overflow }) {
1343
+ return (jsx("th", { className: renderClassStatus('rls-datatable__cell', { control, overflow }, className).trim(), children: children }));
1344
+ }
1345
+ function RlsDatatableTotals({ children, className, error }) {
1346
+ return (jsx("div", { className: renderClassStatus('rls-datatable__totals', { error }, className).trim(), children: children }));
1347
+ }
1348
+ function RlsDatatableInfo({ children, className, control, overflow }) {
1349
+ return (jsx("div", { className: renderClassStatus('rls-datatable__info', { control, overflow }, className).trim(), children: children }));
1350
+ }
1351
+ function RlsDatatable({ children, datatable, footer, header, rlsTheme, summary }) {
1352
+ return (jsxs("div", { className: renderClassStatus('rls-datatable', {
1353
+ scrolleable: datatable?.scrolleable
1354
+ }), "rls-theme": rlsTheme, children: [jsxs("table", { children: [header && jsx("thead", { className: "rls-datatable__thead", children: header }), jsx("tbody", { ref: datatable?.bodyRef, className: "rls-datatable__tbody", children: children })] }), summary && jsx("div", { className: "rls-datatable__tsummary", children: summary }), footer && jsx("div", { className: "rls-datatable__tfooter", children: footer })] }));
1355
+ }
1356
+
1279
1357
  function useDatatable() {
1280
1358
  const [scrolleable, setScrolleable] = useState(false);
1281
1359
  const bodyRef = useRef(null);
@@ -1366,44 +1444,66 @@ function useListControl({ suggestions, formControl }) {
1366
1444
 
1367
1445
  const DURATION_ANIMATION$1 = 240;
1368
1446
  const MAX_ELEMENTS = 6;
1369
- function useAutocompleteField({ disabled, formControl, onSelect, onValue, suggestions }) {
1447
+ function useFieldAutocomplete({ disabled, formControl, onSelect, onValue, suggestions }) {
1370
1448
  const [pattern, setPattern] = useState('');
1371
1449
  const [coincidences, setCoincidences] = useState([]);
1372
- const [store, setStore] = useState({
1450
+ const currentStore = useRef({
1373
1451
  pattern: '',
1374
1452
  coincidences: [],
1375
1453
  previous: null
1376
1454
  });
1377
1455
  const listControl = useListControl({ suggestions, formControl });
1378
1456
  const { collection, inputRef, navigationElement, navigationInput, setFocused, setValue, setVisible } = listControl;
1457
+ const initializedState = useRef(false);
1458
+ const initializedCollection = useRef(false);
1379
1459
  const changeInternal = useRef(false);
1380
- useEffect(() => filterSuggestions(pattern, true), [suggestions]);
1381
- useEffect(() => filterSuggestions(pattern), [pattern]);
1382
1460
  useEffect(() => {
1461
+ refreshCoincidences(pattern, true);
1462
+ }, [suggestions]);
1463
+ useEffect(() => {
1464
+ refreshCoincidences(pattern);
1465
+ }, [pattern]);
1466
+ useEffect(() => {
1467
+ if (!initializedState.current || !initializedCollection.current) {
1468
+ initializedState.current = true;
1469
+ return;
1470
+ }
1383
1471
  if (changeInternal.current) {
1384
1472
  changeInternal.current = false;
1473
+ return;
1385
1474
  }
1386
- else {
1387
- resetState(formControl?.state);
1388
- }
1475
+ refresh(collection, formControl?.state);
1389
1476
  }, [formControl?.state]);
1390
- useEffect(() => resetCollection(collection, formControl?.state), [collection]);
1477
+ useEffect(() => {
1478
+ if (!initializedCollection.current || !initializedState.current) {
1479
+ initializedCollection.current = true;
1480
+ return;
1481
+ }
1482
+ refresh(collection, formControl?.state);
1483
+ }, [collection]);
1484
+ function refresh(collection, state) {
1485
+ if (!state) {
1486
+ return setValue('');
1487
+ }
1488
+ const element = collection.find(state);
1489
+ if (element) {
1490
+ return setValue(element.description);
1491
+ }
1492
+ setValue('');
1493
+ setFormState(undefined);
1494
+ }
1391
1495
  function setFormState(value) {
1392
1496
  if (formControl) {
1393
1497
  changeInternal.current = true;
1394
1498
  formControl.setState(value);
1395
1499
  }
1396
1500
  }
1397
- function resetCollection(collection, state) {
1398
- setValue(state ? collection.find(state)?.description || '' : '');
1399
- }
1400
- function resetState(state) {
1401
- resetCollection(collection, state);
1402
- }
1403
1501
  function onClickControl() {
1404
1502
  if (!disabled) {
1405
1503
  setVisible(true);
1406
- setTimeout(() => inputRef?.current?.focus(), DURATION_ANIMATION$1);
1504
+ setTimeout(() => {
1505
+ inputRef?.current?.focus();
1506
+ }, DURATION_ANIMATION$1);
1407
1507
  }
1408
1508
  }
1409
1509
  function onFocusInput() {
@@ -1457,15 +1557,15 @@ function useAutocompleteField({ disabled, formControl, onSelect, onValue, sugges
1457
1557
  onValue(value);
1458
1558
  }
1459
1559
  }
1460
- function filterSuggestions(pattern, reboot = false) {
1461
- const result = createStoreAutocomplete({
1560
+ function refreshCoincidences(pattern, reboot = false) {
1561
+ const { collection, store } = createStoreAutocomplete({
1462
1562
  pattern,
1463
1563
  suggestions,
1464
1564
  reboot,
1465
- store
1565
+ store: currentStore.current
1466
1566
  });
1467
- setCoincidences(result.collection.slice(0, MAX_ELEMENTS));
1468
- setStore(result.store);
1567
+ currentStore.current = store;
1568
+ setCoincidences(collection.slice(0, MAX_ELEMENTS));
1469
1569
  }
1470
1570
  return {
1471
1571
  coincidences,
@@ -1483,115 +1583,30 @@ function useAutocompleteField({ disabled, formControl, onSelect, onValue, sugges
1483
1583
  };
1484
1584
  }
1485
1585
 
1486
- function RlsAutocompleteFieldTemplate({ suggestions, children, disabled, formControl, hiddenIcon, placeholder, searching, rlsTheme, onSearch, onSelect, onValue, render }) {
1487
- const { coincidences, listControl, pattern, onBlurInput, onClickAction, onClickBackdrop, onClickControl, onClickElement, onFocusInput, onKeydownElement, onKeydownInput, setPattern } = useAutocompleteField({
1586
+ function RlsFieldAutocompleteTemplate({ suggestions, children, disabled, formControl, hiddenIcon, placeholder, searching, rlsTheme, onSearch, onSelect, onValue, render }) {
1587
+ const { coincidences, listControl, pattern, onBlurInput, onClickAction, onClickBackdrop, onClickControl, onClickElement, onFocusInput, onKeydownElement, onKeydownInput, setPattern } = useFieldAutocomplete({
1488
1588
  suggestions,
1489
1589
  disabled,
1490
1590
  formControl,
1491
1591
  onSelect,
1492
1592
  onValue
1493
1593
  });
1494
- return (jsxs("div", { ref: listControl.boxContentRef, className: renderClassStatus('rls-box-field', {
1594
+ return (jsxs("div", { ref: listControl.boxContentRef, className: renderClassStatus('rls-field-box', {
1495
1595
  disabled,
1496
1596
  focused: listControl.focused,
1497
1597
  selected: !!listControl.value
1498
- }, 'rls-autocomplete-field rls-list-field'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-box-field__label", children: children }), jsx("div", { className: "rls-box-field__component", children: jsxs("div", { className: "rls-box-field__body", children: [jsx("label", { className: "rls-list-field__control", onClick: onClickControl, children: listControl.value ? (jsx("span", { className: "rls-list-field__control__description", children: listControl.value })) : (jsx("span", { className: "rls-list-field__control__placeholder", children: placeholder })) }), !hiddenIcon && listControl.value && (jsx("button", { className: "rls-list-field__action", disabled: disabled, onClick: onClickAction, children: jsx(RlsIcon, { value: "trash-2" }) }))] }) }), formControl?.touched && formControl?.error && (jsx("div", { className: "rls-box-field__error", children: jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl.error.message }) })), jsxs("div", { className: renderClassStatus('rls-list-field__suggestions', {
1598
+ }, 'rls-field-list rls-field-autocomplete'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-field-box__label", children: children }), jsx("div", { className: "rls-field-box__component", children: jsxs("div", { className: "rls-field-box__body", children: [jsx("label", { className: "rls-field-list__control", onClick: onClickControl, children: listControl.value ? (jsx("span", { className: "rls-field-list__control__description", children: listControl.value })) : (jsx("span", { className: "rls-field-list__control__placeholder", children: placeholder })) }), !hiddenIcon && listControl.value && (jsx("button", { className: "rls-field-list__action", disabled: disabled, onClick: onClickAction, children: jsx(RlsIcon, { value: "trash-2" }) }))] }) }), formControl?.touched && formControl?.error && (jsx("div", { className: "rls-field-box__error", children: jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl.error.message }) })), jsxs("div", { className: renderClassStatus('rls-field-list__suggestions', {
1499
1599
  visible: listControl.visible,
1500
1600
  hide: !listControl.visible,
1501
1601
  higher: listControl.higher
1502
- }), children: [jsx("div", { className: "rls-list-field__suggestions__body", children: jsxs("ul", { ref: listControl.listRef, className: "rls-list-field__ul", children: [jsxs("div", { className: "rls-list-field__ul__search", children: [jsx("input", { ref: listControl.inputRef, className: "rls-list-field__ul__control", type: "text", placeholder: reactI18n('listInputPlaceholder'), value: pattern, onChange: ({ target: { value } }) => {
1602
+ }), children: [jsx("div", { className: "rls-field-list__suggestions__body", children: jsxs("ul", { ref: listControl.listRef, className: "rls-field-list__ul", children: [jsxs("div", { className: "rls-field-list__ul__search", children: [jsx("input", { ref: listControl.inputRef, className: "rls-field-list__ul__control", type: "text", placeholder: reactI18n('listInputPlaceholder'), value: pattern, onChange: ({ target: { value } }) => {
1503
1603
  setPattern(value);
1504
1604
  }, disabled: disabled || searching, onFocus: onFocusInput, onBlur: onBlurInput, onKeyDown: onKeydownInput }), onSearch && (jsx("button", { disabled: disabled || searching, onClick: () => {
1505
1605
  onSearch(pattern);
1506
- }, children: jsx(RlsIcon, { value: "search" }) }))] }), searching && jsx(RlsProgressBar, { indeterminate: true }), coincidences.map((element, index) => (jsx("li", { className: "rls-list-field__element", tabIndex: -1, onClick: onClickElement(element), onKeyDown: onKeydownElement(element), children: render(element) }, index))), !coincidences.length && (jsx("li", { className: "rls-list-field__empty", children: jsxs("div", { className: "rls-list-field__empty__description", children: [jsx("label", { className: "rls-label-bold truncate", children: reactI18n('listEmptyTitle') }), jsx("p", { className: "rls-caption-regular", children: reactI18n('listEmptyDescription') })] }) }))] }) }), jsx("div", { className: "rls-list-field__backdrop", onClick: onClickBackdrop })] })] }));
1507
- }
1508
- function RlsAutocompleteField(props) {
1509
- return (jsx(RlsAutocompleteFieldTemplate, { ...props, render: (element) => (jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: element.title })) }));
1510
- }
1511
-
1512
- function RlsCard({ children, outline, rlsTheme }) {
1513
- return (jsx("div", { className: renderClassStatus('rls-card', { outline }), "rls-theme": rlsTheme, children: jsx("div", { className: "rls-card__content", children: children }) }));
1514
- }
1515
-
1516
- class ConfirmationResult extends PartialSealed {
1517
- static approved() {
1518
- return new ConfirmationResult('approved');
1519
- }
1520
- static reject() {
1521
- return new ConfirmationResult('reject');
1522
- }
1523
- }
1524
- function RlsConfirmation({ approved, content, reject, rlsTheme, subtitle, title, visible }) {
1525
- return (jsxs("div", { className: renderClassStatus('rls-confirmation', { visible }), "rls-theme": rlsTheme, children: [jsxs("div", { className: "rls-confirmation__component", children: [jsxs("div", { className: "rls-confirmation__header", children: [title && (jsx("div", { className: "rls-confirmation__header__title", children: title })), subtitle && (jsx("div", { className: "rls-confirmation__header__subtitle", children: subtitle }))] }), jsx("div", { className: "rls-confirmation__body", children: content && (jsx("div", { className: "rls-confirmation__body__content", children: content })) }), (approved || reject) && (jsx("div", { className: "rls-confirmation__footer", children: jsxs("div", { className: "rls-confirmation__footer__actions", children: [approved && (jsx(RlsButton, { type: "raised", onClick: () => {
1526
- if (approved.onClick) {
1527
- approved.onClick();
1528
- }
1529
- }, children: approved.label })), reject && (jsx(RlsButton, { type: "outline", onClick: () => {
1530
- if (reject.onClick) {
1531
- reject.onClick();
1532
- }
1533
- }, children: reject.label }))] }) }))] }), jsx("div", { className: "rls-confirmation__backdrop" })] }));
1534
- }
1535
- function useConfirmationService() {
1536
- const [config, setConfig] = useState({});
1537
- const [visible, setVisible] = useState(false);
1538
- const rlsConfirmation = ReactDOM.createPortal(jsx(RlsConfirmation, { ...config, visible: visible }), document.body);
1539
- function confirmation(config) {
1540
- return new Promise((resolve) => {
1541
- const { content, rlsTheme, subtitle, title, approved, reject } = config;
1542
- setConfig({
1543
- content,
1544
- rlsTheme,
1545
- subtitle,
1546
- title,
1547
- approved: {
1548
- label: approved || reactI18n('confirmationActionApproved'),
1549
- onClick: () => {
1550
- setVisible(false);
1551
- resolve(ConfirmationResult.approved());
1552
- }
1553
- },
1554
- reject: reject
1555
- ? {
1556
- label: reject,
1557
- onClick: () => {
1558
- setVisible(false);
1559
- resolve(ConfirmationResult.reject());
1560
- }
1561
- }
1562
- : undefined
1563
- });
1564
- setVisible(true);
1565
- });
1566
- }
1567
- return {
1568
- RlsConfirmation: rlsConfirmation,
1569
- confirmation
1570
- };
1571
- }
1572
-
1573
- function RlsDatatableHeader({ children }) {
1574
- return jsx("tr", { className: "rls-datatable__header", children: children });
1575
- }
1576
- function RlsDatatableTitle({ children, className, control }) {
1577
- return (jsx("th", { className: renderClassStatus('rls-datatable__title', { control }, className).trim(), children: children }));
1578
- }
1579
- function RlsDatatableData({ children, className, error }) {
1580
- return (jsx("tr", { className: renderClassStatus('rls-datatable__data', { error }, className).trim(), children: children }));
1581
- }
1582
- function RlsDatatableCell({ children, className, control, overflow }) {
1583
- return (jsx("th", { className: renderClassStatus('rls-datatable__cell', { control, overflow }, className).trim(), children: children }));
1584
- }
1585
- function RlsDatatableTotals({ children, className, error }) {
1586
- return (jsx("div", { className: renderClassStatus('rls-datatable__totals', { error }, className).trim(), children: children }));
1606
+ }, children: jsx(RlsIcon, { value: "search" }) }))] }), searching && jsx(RlsProgressBar, { indeterminate: true }), coincidences.map((element, index) => (jsx("li", { className: "rls-field-list__element", tabIndex: -1, onClick: onClickElement(element), onKeyDown: onKeydownElement(element), children: render(element) }, index))), !coincidences.length && (jsx("li", { className: "rls-field-list__empty", children: jsxs("div", { className: "rls-field-list__empty__description", children: [jsx("label", { className: "rls-label-bold truncate", children: reactI18n('listEmptyTitle') }), jsx("p", { className: "rls-caption-regular", children: reactI18n('listEmptyDescription') })] }) }))] }) }), jsx("div", { className: "rls-field-list__backdrop", onClick: onClickBackdrop })] })] }));
1587
1607
  }
1588
- function RlsDatatableInfo({ children, className, control, overflow }) {
1589
- return (jsx("div", { className: renderClassStatus('rls-datatable__info', { control, overflow }, className).trim(), children: children }));
1590
- }
1591
- function RlsDatatable({ children, datatable, footer, header, rlsTheme, summary }) {
1592
- return (jsxs("div", { className: renderClassStatus('rls-datatable', {
1593
- scrolleable: datatable?.scrolleable
1594
- }), "rls-theme": rlsTheme, children: [jsxs("table", { children: [header && jsx("thead", { className: "rls-datatable__thead", children: header }), jsx("tbody", { ref: datatable?.bodyRef, className: "rls-datatable__tbody", children: children })] }), summary && jsx("div", { className: "rls-datatable__tsummary", children: summary }), footer && jsx("div", { className: "rls-datatable__tfooter", children: footer })] }));
1608
+ function RlsFieldAutocomplete(props) {
1609
+ return (jsx(RlsFieldAutocompleteTemplate, { ...props, render: (element) => (jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: element.title })) }));
1595
1610
  }
1596
1611
 
1597
1612
  function rangeFormatTemplate({ maxDate, minDate }) {
@@ -1697,7 +1712,7 @@ function useReactControl(controlProps, controlValidators) {
1697
1712
  }
1698
1713
 
1699
1714
  const FORMAT_DESCRIPTION = '{dw}, {mx} {dd} de {aa}';
1700
- function RlsDatePicker({ automatic, date, disabled, formControl, maxDate, minDate, onListener, rlsTheme }) {
1715
+ function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDate, onListener, rlsTheme }) {
1701
1716
  const today = new Date(); // Initial current date in component
1702
1717
  const dateInitial = formControl?.state || date || today;
1703
1718
  const yearControl = useReactControl(dateInitial.getFullYear());
@@ -1758,18 +1773,18 @@ function RlsDatePicker({ automatic, date, disabled, formControl, maxDate, minDat
1758
1773
  onListener({ type: PickerListenerType.Select, value });
1759
1774
  }
1760
1775
  }
1761
- return (jsxs("div", { className: "rls-date-picker", "rls-theme": rlsTheme, children: [jsxs("div", { className: "rls-date-picker__header", children: [jsx("div", { className: "rls-date-picker__title rls-date-picker__title--description", children: jsx("span", { onClick: onVisibilityDay, children: dateFormatTemplate(dateInitial, FORMAT_DESCRIPTION) }) }), jsx("div", { className: "rls-date-picker__title rls-date-picker__title--year", children: jsx("span", { onClick: onVisibilityYear, children: yearControl.value }) }), jsx(RlsMonthTitlePicker, { monthControl: monthControl, yearControl: yearControl, date: value, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: 'month', onClick: onVisibilityMonth })] }), jsxs("div", { className: renderClassStatus('rls-date-picker__component', {
1776
+ return (jsxs("div", { className: "rls-picker-date", "rls-theme": rlsTheme, children: [jsxs("div", { className: "rls-picker-date__header", children: [jsx("div", { className: "rls-picker-date__title rls-picker-date__title--description", children: jsx("span", { onClick: onVisibilityDay, children: dateFormatTemplate(dateInitial, FORMAT_DESCRIPTION) }) }), jsx("div", { className: "rls-picker-date__title rls-picker-date__title--year", children: jsx("span", { onClick: onVisibilityYear, children: yearControl.value }) }), jsx(RlsPickerMonthTitle, { monthControl: monthControl, yearControl: yearControl, date: value, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: 'month', onClick: onVisibilityMonth })] }), jsxs("div", { className: renderClassStatus('rls-picker-date__component', {
1762
1777
  day: visibility === 'DAY',
1763
1778
  month: visibility === 'MONTH',
1764
1779
  year: visibility === 'YEAR'
1765
- }), children: [jsx(RlsDayPicker, { formControl: dayControl, date: dateInitial, month: monthControl.state, year: yearControl.state, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsx(RlsMonthPicker, { formControl: monthControl, date: dateInitial, year: yearControl.state, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsx(RlsYearPicker, { formControl: yearControl, date: dateInitial, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), jsx("div", { className: renderClassStatus('rls-date-picker__footer', { automatic }), children: jsxs("div", { className: "rls-date-picker__actions", children: [jsx("div", { className: "rls-date-picker__actions--cancel", children: jsx(RlsButton, { type: "ghost", onClick: onCancel, children: reactI18n('dateActionCancel') }) }), jsx("div", { className: "rls-date-picker__actions--today", children: jsx(RlsButton, { type: "ghost", onClick: onToday, disabled: dateOutRange({ date: today, maxDate, minDate }), children: reactI18n('dateActionToday') }) }), jsx("div", { className: "rls-date-picker__actions--ok", children: jsx(RlsButton, { type: "raised", onClick: onSelect, children: reactI18n('dateActionSelect') }) })] }) })] }));
1780
+ }), children: [jsx(RlsPickerDay, { formControl: dayControl, date: dateInitial, month: monthControl.state, year: yearControl.state, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsx(RlsPickerMonth, { formControl: monthControl, date: dateInitial, year: yearControl.state, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsx(RlsPickerYear, { formControl: yearControl, date: dateInitial, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), jsx("div", { className: renderClassStatus('rls-picker-date__footer', { automatic }), children: jsxs("div", { className: "rls-picker-date__actions", children: [jsx("div", { className: "rls-picker-date__actions--cancel", children: jsx(RlsButton, { type: "ghost", onClick: onCancel, children: reactI18n('dateActionCancel') }) }), jsx("div", { className: "rls-picker-date__actions--today", children: jsx(RlsButton, { type: "ghost", onClick: onToday, disabled: dateOutRange({ date: today, maxDate, minDate }), children: reactI18n('dateActionToday') }) }), jsx("div", { className: "rls-picker-date__actions--ok", children: jsx(RlsButton, { type: "raised", onClick: onSelect, children: reactI18n('dateActionSelect') }) })] }) })] }));
1766
1781
  }
1767
1782
 
1768
1783
  function RlsModal({ children, visible, rlsTheme }) {
1769
1784
  return ReactDOM.createPortal(jsxs("div", { className: renderClassStatus('rls-modal', { visible }), "rls-theme": rlsTheme, children: [jsx("div", { className: "rls-modal__component", children: children }), jsx("div", { className: "rls-modal__backdrop" })] }), document.body);
1770
1785
  }
1771
1786
 
1772
- function RlsDateField({ children, date, disabled, formControl, maxDate, minDate, onValue, placeholder, rlsTheme }) {
1787
+ function RlsFieldDate({ children, date, disabled, formControl, maxDate, minDate, onValue, placeholder, rlsTheme }) {
1773
1788
  const today = new Date(); // Initial current date in component
1774
1789
  const [value, setValue] = useState();
1775
1790
  const [modalIsVisible, setModalIsVisible] = useState(false);
@@ -1805,7 +1820,7 @@ function RlsDateField({ children, date, disabled, formControl, maxDate, minDate,
1805
1820
  setModalIsVisible(true);
1806
1821
  }
1807
1822
  }
1808
- return (jsxs("div", { className: "rls-date-field", "rls-theme": rlsTheme, children: [jsxs("div", { className: renderClassStatus('rls-box-field', { disabled }), children: [children && jsx("label", { className: "rls-box-field__label", children: children }), jsx("div", { className: "rls-box-field__component", children: jsxs("div", { className: "rls-box-field__body", children: [jsx("input", { className: "rls-date-field__control", type: "text", value: value ? dateFormatTemplate(value, DATE_RANGE_FORMAT) : '', readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), jsx("button", { className: "rls-date-field__action", onClick: onClean, disabled: disabled, children: jsx(RlsIcon, { value: value ? 'trash-2' : 'calendar' }) })] }) }), formControl?.touched && formControl?.error && (jsx("div", { className: "rls-box-field__error", children: jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl.error.message }) }))] }), jsx(RlsModal, { visible: modalIsVisible, rlsTheme: rlsTheme, children: jsx(RlsDatePicker, { formControl: formControl, date: date, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: ({ value, type }) => {
1823
+ return (jsxs("div", { className: "rls-field-date", "rls-theme": rlsTheme, children: [jsxs("div", { className: renderClassStatus('rls-field-box', { disabled }), children: [children && jsx("label", { className: "rls-field-box__label", children: children }), jsx("div", { className: "rls-field-box__component", children: jsxs("div", { className: "rls-field-box__body", children: [jsx("input", { className: "rls-field-date__control", type: "text", value: value ? dateFormatTemplate(value, DATE_RANGE_FORMAT) : '', readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), jsx("button", { className: "rls-field-date__action", onClick: onClean, disabled: disabled, children: jsx(RlsIcon, { value: value ? 'trash-2' : 'calendar' }) })] }) }), formControl?.touched && formControl?.error && (jsx("div", { className: "rls-field-box__error", children: jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl.error.message }) }))] }), jsx(RlsModal, { visible: modalIsVisible, rlsTheme: rlsTheme, children: jsx(RlsPickerDate, { formControl: formControl, date: date, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: ({ value, type }) => {
1809
1824
  if (type !== PickerListenerType.Cancel) {
1810
1825
  onChange(value, true);
1811
1826
  }
@@ -1816,7 +1831,7 @@ function RlsDateField({ children, date, disabled, formControl, maxDate, minDate,
1816
1831
  } }) })] }));
1817
1832
  }
1818
1833
 
1819
- function RlsDateRangePicker({ automatic, date: datePicker, disabled, formControl, maxDate, minDate, onListener, rlsTheme }) {
1834
+ function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl, maxDate, minDate, onListener, rlsTheme }) {
1820
1835
  const dateInitial = normalizeMinTime(datePicker || new Date());
1821
1836
  const rangeInitial = formControl?.state || DateRange.now();
1822
1837
  const yearControl = useReactControl(dateInitial.getFullYear());
@@ -1865,16 +1880,16 @@ function RlsDateRangePicker({ automatic, date: datePicker, disabled, formControl
1865
1880
  onListener({ type: PickerListenerType.Select, value });
1866
1881
  }
1867
1882
  }
1868
- return (jsxs("div", { className: "rls-date-range-picker", "rls-theme": rlsTheme, children: [jsxs("div", { className: "rls-date-range-picker__header", children: [jsx("div", { className: "rls-date-range-picker__title rls-date-range-picker__title--description", children: jsx("span", { onClick: onVisibilityDay, children: rangeFormatTemplate(value) }) }), jsx("div", { className: "rls-date-range-picker__title rls-date-range-picker__title--year", children: jsx("span", { onClick: onVisibilityYear, children: yearControl.state }) }), jsx(RlsMonthTitlePicker, { monthControl: monthControl, yearControl: yearControl, date: date, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: visibility === 'MONTH' ? 'year' : 'month', onClick: onVisibilityMonth })] }), jsxs("div", { className: renderClassStatus('rls-date-range-picker__component', {
1883
+ return (jsxs("div", { className: "rls-picker-date-range", "rls-theme": rlsTheme, children: [jsxs("div", { className: "rls-picker-date-range__header", children: [jsx("div", { className: "rls-picker-date-range__title rls-picker-date-range__title--description", children: jsx("span", { onClick: onVisibilityDay, children: rangeFormatTemplate(value) }) }), jsx("div", { className: "rls-picker-date-range__title rls-picker-date-range__title--year", children: jsx("span", { onClick: onVisibilityYear, children: yearControl.state }) }), jsx(RlsPickerMonthTitle, { monthControl: monthControl, yearControl: yearControl, date: date, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: visibility === 'MONTH' ? 'year' : 'month', onClick: onVisibilityMonth })] }), jsxs("div", { className: renderClassStatus('rls-picker-date-range__component', {
1869
1884
  day: visibility === 'DAY',
1870
1885
  month: visibility === 'MONTH',
1871
1886
  year: visibility === 'YEAR'
1872
- }), children: [jsx(RlsDayRangePicker, { formControl: dayControl, date: date, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsx(RlsMonthPicker, { formControl: monthControl, year: yearControl.state, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsx(RlsYearPicker, { formControl: yearControl, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), jsx("div", { className: renderClassStatus('rls-date-range-picker__footer', {
1887
+ }), children: [jsx(RlsPickerDayRange, { formControl: dayControl, date: date, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsx(RlsPickerMonth, { formControl: monthControl, year: yearControl.state, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsx(RlsPickerYear, { formControl: yearControl, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), jsx("div", { className: renderClassStatus('rls-picker-date-range__footer', {
1873
1888
  automatic
1874
- }), children: jsxs("div", { className: "rls-date-range-picker__actions", children: [jsx("div", { className: "rls-date-range-picker__actions--cancel", children: jsx(RlsButton, { type: "ghost", onClick: onCancel, children: reactI18n('dateActionCancel') }) }), jsx("div", { className: "rls-date-range-picker__actions--ok", children: jsx(RlsButton, { type: "raised", onClick: onSelect, children: reactI18n('dateActionSelect') }) })] }) })] }));
1889
+ }), children: jsxs("div", { className: "rls-picker-date-range__actions", children: [jsx("div", { className: "rls-picker-date-range__actions--cancel", children: jsx(RlsButton, { type: "ghost", onClick: onCancel, children: reactI18n('dateActionCancel') }) }), jsx("div", { className: "rls-picker-date-range__actions--ok", children: jsx(RlsButton, { type: "raised", onClick: onSelect, children: reactI18n('dateActionSelect') }) })] }) })] }));
1875
1890
  }
1876
1891
 
1877
- function RlsDateRangeField({ children, date: datePicker, disabled, formControl, maxDate, minDate, placeholder, rlsTheme }) {
1892
+ function RlsFieldDateRange({ children, date: datePicker, disabled, formControl, maxDate, minDate, placeholder, rlsTheme }) {
1878
1893
  const currentRange = formControl?.state || DateRange.now();
1879
1894
  const currentDate = datePicker || new Date();
1880
1895
  const [value, setValue] = useState(currentRange);
@@ -1891,7 +1906,7 @@ function RlsDateRangeField({ children, date: datePicker, disabled, formControl,
1891
1906
  setModalIsVisible(true);
1892
1907
  }
1893
1908
  }
1894
- return (jsxs("div", { className: "rls-date-field", "rls-theme": rlsTheme, children: [jsxs("div", { className: renderClassStatus('rls-box-field', { disabled }), children: [children && jsx("label", { className: "rls-box-field__label", children: children }), jsx("div", { className: "rls-box-field__component", children: jsxs("div", { className: "rls-box-field__body", children: [jsx("input", { className: "rls-date-field__control", type: "text", value: value ? rangeFormatTemplate(value) : '', readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), jsx("button", { className: "rls-date-field__action", onClick: onClickAction, disabled: disabled, children: jsx(RlsIcon, { value: value ? 'trash-2' : 'calendar' }) })] }) })] }), jsx(RlsModal, { visible: modalIsVisible, rlsTheme: rlsTheme, children: jsx(RlsDateRangePicker, { formControl: formControl, date: currentDate, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: ({ value }) => {
1909
+ return (jsxs("div", { className: "rls-field-date-range", "rls-theme": rlsTheme, children: [jsxs("div", { className: renderClassStatus('rls-field-box', { disabled }), children: [children && jsx("label", { className: "rls-field-box__label", children: children }), jsx("div", { className: "rls-field-box__component", children: jsxs("div", { className: "rls-field-box__body", children: [jsx("input", { className: "rls-field-date-range__control", type: "text", value: value ? rangeFormatTemplate(value) : '', readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), jsx("button", { className: "rls-field-date-range__action", onClick: onClickAction, disabled: disabled, children: jsx(RlsIcon, { value: value ? 'trash-2' : 'calendar' }) })] }) })] }), jsx(RlsModal, { visible: modalIsVisible, rlsTheme: rlsTheme, children: jsx(RlsPickerDateRange, { formControl: formControl, date: currentDate, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: ({ value }) => {
1895
1910
  if (value) {
1896
1911
  setValue(value);
1897
1912
  }
@@ -1899,35 +1914,47 @@ function RlsDateRangeField({ children, date: datePicker, disabled, formControl,
1899
1914
  } }) })] }));
1900
1915
  }
1901
1916
 
1902
- function RlsFormNavigation({ children, visible, rlsTheme }) {
1903
- return (jsx("div", { className: renderClassStatus('rls-form-navigation', { visible }), "rls-theme": rlsTheme, children: jsx("div", { className: "rls-form-navigation__body", children: children }) }));
1904
- }
1905
-
1906
- function useSelectField({ suggestions, formControl, onSelect, onValue }) {
1917
+ function useFieldSelect({ suggestions, formControl, onSelect, onValue }) {
1907
1918
  const listControl = useListControl({ suggestions, formControl });
1908
1919
  const { collection, inputRef, visible, navigationElement, navigationInput, setFocused, setValue, setVisible } = listControl;
1920
+ const initializedState = useRef(false);
1921
+ const initializedCollection = useRef(false);
1909
1922
  const changeInternal = useRef(false);
1910
1923
  useEffect(() => {
1924
+ if (!initializedState.current || !initializedCollection.current) {
1925
+ initializedState.current = true;
1926
+ return;
1927
+ }
1911
1928
  if (changeInternal.current) {
1912
1929
  changeInternal.current = false;
1930
+ return;
1913
1931
  }
1914
- else {
1915
- resetState(formControl?.state);
1916
- }
1932
+ refresh(collection, formControl?.state);
1917
1933
  }, [formControl?.state]);
1918
- useEffect(() => resetCollection(collection, formControl?.state), [collection]);
1934
+ useEffect(() => {
1935
+ if (!initializedCollection.current || !initializedState.current) {
1936
+ initializedCollection.current = true;
1937
+ return;
1938
+ }
1939
+ refresh(collection, formControl?.state);
1940
+ }, [collection]);
1941
+ function refresh(collection, state) {
1942
+ if (!state) {
1943
+ return setValue('');
1944
+ }
1945
+ const element = collection.find(state);
1946
+ if (element) {
1947
+ return setValue(element.description);
1948
+ }
1949
+ setValue('');
1950
+ setFormState(undefined);
1951
+ }
1919
1952
  function setFormState(value) {
1920
1953
  if (formControl) {
1921
1954
  changeInternal.current = true;
1922
1955
  formControl.setState(value);
1923
1956
  }
1924
1957
  }
1925
- function resetCollection(collection, state) {
1926
- setValue(state ? collection.find(state)?.description || '' : '');
1927
- }
1928
- function resetState(state) {
1929
- resetCollection(collection, state);
1930
- }
1931
1958
  function onFocusInput() {
1932
1959
  setFocused(true);
1933
1960
  }
@@ -1953,9 +1980,8 @@ function useSelectField({ suggestions, formControl, onSelect, onValue }) {
1953
1980
  }
1954
1981
  }
1955
1982
  function onClickAction() {
1956
- const newVisible = !visible;
1957
- setVisible(newVisible);
1958
- if (newVisible) {
1983
+ setVisible(!visible);
1984
+ if (!visible) {
1959
1985
  inputRef?.current?.focus();
1960
1986
  }
1961
1987
  }
@@ -1999,24 +2025,28 @@ function useSelectField({ suggestions, formControl, onSelect, onValue }) {
1999
2025
  };
2000
2026
  }
2001
2027
 
2002
- function RlsSelectFieldTemplate({ suggestions, children, disabled, formControl, placeholder, rlsTheme, onSelect, onValue, render }) {
2003
- const { listControl, onBlurInput, onClickAction, onClickBackdrop, onClickElement, onClickInput, onFocusInput, onKeydownElement, onKeydownInput } = useSelectField({
2028
+ function RlsFieldSelectTemplate({ suggestions, children, disabled, formControl, placeholder, rlsTheme, onSelect, onValue, render }) {
2029
+ const { listControl, onBlurInput, onClickAction, onClickBackdrop, onClickElement, onClickInput, onFocusInput, onKeydownElement, onKeydownInput } = useFieldSelect({
2004
2030
  suggestions,
2005
2031
  disabled,
2006
2032
  formControl,
2007
2033
  onSelect,
2008
2034
  onValue
2009
2035
  });
2010
- return (jsxs("div", { ref: listControl.boxContentRef, className: renderClassStatus('rls-box-field', { focused: listControl.focused, disabled }, 'rls-select-field rls-list-field'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-box-field__label", children: children }), jsx("div", { className: "rls-box-field__component", children: jsxs("div", { className: "rls-box-field__body", children: [jsx("input", { ref: listControl.inputRef, className: "rls-list-field__control", readOnly: true, disabled: disabled, placeholder: placeholder, value: listControl.value, onFocus: onFocusInput, onBlur: onBlurInput, onClick: onClickInput, onKeyDown: onKeydownInput }), jsx("button", { className: renderClassStatus('rls-list-field__action', {
2036
+ return (jsxs("div", { ref: listControl.boxContentRef, className: renderClassStatus('rls-field-box', { focused: listControl.focused, disabled }, 'rls-field-list rls-field-select'), "rls-theme": rlsTheme, children: [children && jsx("label", { className: "rls-field-box__label", children: children }), jsx("div", { className: "rls-field-box__component", children: jsxs("div", { className: "rls-field-box__body", children: [jsx("input", { ref: listControl.inputRef, className: "rls-field-list__control", readOnly: true, disabled: disabled, placeholder: placeholder, value: listControl.value, onFocus: onFocusInput, onBlur: onBlurInput, onClick: onClickInput, onKeyDown: onKeydownInput }), jsx("button", { className: renderClassStatus('rls-field-list__action', {
2011
2037
  visible: listControl.visible
2012
- }), disabled: disabled, onClick: onClickAction, children: jsx(RlsIcon, { value: "arrow-ios-down" }) })] }) }), formControl?.touched && formControl?.error && (jsx("div", { className: "rls-box-field__error", children: jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl.error.message }) })), jsxs("div", { className: renderClassStatus('rls-list-field__suggestions', {
2038
+ }), disabled: disabled, onClick: onClickAction, children: jsx(RlsIcon, { value: "arrow-ios-down" }) })] }) }), formControl?.wrong && (jsx("div", { className: "rls-field-box__error", children: jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl?.error?.message }) })), jsxs("div", { className: renderClassStatus('rls-field-list__suggestions', {
2013
2039
  visible: listControl.visible,
2014
2040
  hide: !listControl.visible,
2015
2041
  higher: listControl.higher
2016
- }), children: [jsx("div", { className: "rls-list-field__suggestions__body", children: jsxs("ul", { ref: listControl.listRef, className: "rls-list-field__ul", children: [suggestions.map((element, index) => (jsx("li", { className: "rls-list-field__element", tabIndex: -1, onClick: onClickElement(element), onKeyDown: onKeydownElement(element), children: render(element) }, index))), !suggestions.length && (jsx("li", { className: "rls-list-field__empty", children: jsxs("div", { className: "rls-list-field__empty__description", children: [jsx("label", { className: "rls-label-bold truncate", children: reactI18n('listEmptyTitle') }), jsx("p", { className: "rls-caption-regular", children: reactI18n('listEmptyDescription') })] }) }))] }) }), jsx("div", { className: "rls-list-field__backdrop", onClick: onClickBackdrop })] })] }));
2042
+ }), children: [jsx("div", { className: "rls-field-list__suggestions__body", children: jsxs("ul", { ref: listControl.listRef, className: "rls-field-list__ul", children: [suggestions.map((element, index) => (jsx("li", { className: "rls-field-list__element", tabIndex: -1, onClick: onClickElement(element), onKeyDown: onKeydownElement(element), children: render(element) }, index))), !suggestions.length && (jsx("li", { className: "rls-field-list__empty", children: jsxs("div", { className: "rls-field-list__empty__description", children: [jsx("label", { className: "rls-label-bold truncate", children: reactI18n('listEmptyTitle') }), jsx("p", { className: "rls-caption-regular", children: reactI18n('listEmptyDescription') })] }) }))] }) }), jsx("div", { className: "rls-field-list__backdrop", onClick: onClickBackdrop })] })] }));
2017
2043
  }
2018
- function RlsSelectField(props) {
2019
- return (jsx(RlsSelectFieldTemplate, { ...props, render: (element) => (jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: element.title })) }));
2044
+ function RlsFieldSelect(props) {
2045
+ return (jsx(RlsFieldSelectTemplate, { ...props, render: (element) => (jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: element.title })) }));
2046
+ }
2047
+
2048
+ function RlsFormNavigation({ children, visible, rlsTheme }) {
2049
+ return (jsx("div", { className: renderClassStatus('rls-form-navigation', { visible }), "rls-theme": rlsTheme, children: jsx("div", { className: "rls-form-navigation__body", children: children }) }));
2020
2050
  }
2021
2051
 
2022
2052
  const DURATION_ANIMATION = 240;
@@ -2080,5 +2110,5 @@ function RlsApplication({ children }) {
2080
2110
  return (jsxs(RlsContext.Provider, { value: { confirmation, snackbar }, children: [jsx("div", { className: "rls-app__body", children: children }), RlsSnackbar, RlsConfirmation] }));
2081
2111
  }
2082
2112
 
2083
- export { ConfirmationResult, RlsAmount, RlsApplication, RlsAutocompleteField, RlsAutocompleteFieldTemplate, RlsAvatar, RlsBadge, RlsBallot, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonProgress, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsCheckBoxLabel, RlsConfirmation, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableHeader, RlsDatatableInfo, RlsDatatableTitle, RlsDatatableTotals, RlsDateField, RlsDatePicker, RlsDateRangeField, RlsDateRangePicker, RlsDayPicker, RlsDayRangePicker, RlsFormNavigation, RlsIcon, RlsInput, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputText, RlsLabel, RlsMessageIcon, RlsModal, RlsMoneyField, RlsMonthPicker, RlsMonthTitlePicker, RlsNumberField, RlsPagination, RlsPasswordField, RlsPoster, RlsProgressBar, RlsProgressCircular, RlsRadioButton, RlsRadioButtonLabel, RlsSearchInput, RlsSelectField, RlsSelectFieldTemplate, RlsSkeleton, RlsSkeletonText, RlsSnackbar, RlsSwitch, RlsSwitchControl, RlsSwitchLabel, RlsTabularText, RlsTextField, RlsToolbar, RlsYearPicker, rangeFormatTemplate, renderClassStatus, useConfirmationService, useDatatable, useListControl, useSnackbarService };
2113
+ export { ConfirmationResult, RlsAmount, RlsApplication, RlsAvatar, RlsBadge, RlsBallot, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonProgress, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsConfirmation, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableHeader, RlsDatatableInfo, RlsDatatableTitle, RlsDatatableTotals, RlsFieldAutocomplete, RlsFieldAutocompleteTemplate, RlsFieldDate, RlsFieldDateRange, RlsFieldMoney, RlsFieldNumber, RlsFieldPassword, RlsFieldSelect, RlsFieldSelectTemplate, RlsFieldText, RlsFormNavigation, RlsIcon, RlsInput, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputText, RlsLabel, RlsLabelCheckBox, RlsLabelRadioButton, RlsLabelSwitch, RlsMessageIcon, RlsModal, RlsPagination, RlsPickerDate, RlsPickerDateRange, RlsPickerDay, RlsPickerDayRange, RlsPickerMonth, RlsPickerMonthTitle, RlsPickerYear, RlsPoster, RlsProgressBar, RlsProgressCircular, RlsRadioButton, RlsSearchInput, RlsSkeleton, RlsSkeletonText, RlsSnackbar, RlsSwitch, RlsSwitchControl, RlsTabularText, RlsToolbar, rangeFormatTemplate, renderClassStatus, useConfirmationService, useDatatable, useListControl, useSnackbarService };
2084
2114
  //# sourceMappingURL=index.js.map