@rolster/react-components 18.14.1 → 18.15.2

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 (120) hide show
  1. package/dist/cjs/assets/{index--xgdaD5z.css → index-Dbh6DUCn.css} +66 -96
  2. package/dist/cjs/index.js +1790 -1180
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/es/assets/{index--xgdaD5z.css → index-Dbh6DUCn.css} +66 -96
  5. package/dist/es/index.js +1674 -1064
  6. package/dist/es/index.js.map +1 -1
  7. package/dist/esm/components/atoms/Amount/Amount.js +1 -1
  8. package/dist/esm/components/atoms/Amount/Amount.js.map +1 -1
  9. package/dist/esm/components/atoms/Avatar/Avatar.css +1 -1
  10. package/dist/esm/components/atoms/Button/Button.d.ts +2 -2
  11. package/dist/esm/components/atoms/CheckBox/CheckBox.js +2 -2
  12. package/dist/esm/components/atoms/CheckBox/CheckBox.js.map +1 -1
  13. package/dist/esm/components/atoms/Input/Input.js +4 -7
  14. package/dist/esm/components/atoms/Input/Input.js.map +1 -1
  15. package/dist/esm/components/atoms/InputMoney/InputMoney.css +2 -0
  16. package/dist/esm/components/atoms/InputMoney/InputMoney.js +2 -2
  17. package/dist/esm/components/atoms/InputMoney/InputMoney.js.map +1 -1
  18. package/dist/esm/components/atoms/InputNumber/InputNumber.js +2 -2
  19. package/dist/esm/components/atoms/InputPassword/InputPassword.js +1 -4
  20. package/dist/esm/components/atoms/InputPassword/InputPassword.js.map +1 -1
  21. package/dist/esm/components/atoms/{SearchInput/SearchInput.css → InputSearch/InputSearch.css} +1 -2
  22. package/dist/esm/components/atoms/InputSearch/InputSearch.d.ts +9 -0
  23. package/dist/esm/components/atoms/{SearchInput/SearchInput.js → InputSearch/InputSearch.js} +4 -4
  24. package/dist/esm/components/atoms/{SearchInput/SearchInput.js.map → InputSearch/InputSearch.js.map} +1 -1
  25. package/dist/esm/components/atoms/InputText/InputText.js +2 -2
  26. package/dist/esm/components/atoms/InputText/InputText.js.map +1 -1
  27. package/dist/esm/components/atoms/Label/Label.css +6 -0
  28. package/dist/esm/components/atoms/Poster/Poster.css +4 -3
  29. package/dist/esm/components/atoms/ProgressBar/ProgressBar.css +1 -2
  30. package/dist/esm/components/atoms/RadioButton/RadioButton.css +0 -1
  31. package/dist/esm/components/atoms/Skeleton/Skeleton.css +3 -4
  32. package/dist/esm/components/atoms/SkeletonText/SkeletonText.css +8 -48
  33. package/dist/esm/components/atoms/SkeletonText/SkeletonText.js +2 -2
  34. package/dist/esm/components/atoms/SkeletonText/SkeletonText.js.map +1 -1
  35. package/dist/esm/components/atoms/Switch/Switch.js +2 -2
  36. package/dist/esm/components/atoms/TabularText/TabularText.css +5 -2
  37. package/dist/esm/components/atoms/index.d.ts +1 -1
  38. package/dist/esm/components/atoms/index.js +1 -1
  39. package/dist/esm/components/atoms/index.js.map +1 -1
  40. package/dist/esm/components/molecules/Ballot/Ballot.css +1 -1
  41. package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.d.ts +2 -2
  42. package/dist/esm/components/molecules/ButtonToggle/ButtonToggle.js.map +1 -1
  43. package/dist/esm/components/molecules/FieldMoney/FieldMoney.js +1 -1
  44. package/dist/esm/components/molecules/FieldMoney/FieldMoney.js.map +1 -1
  45. package/dist/esm/components/molecules/FieldNumber/FieldNumber.js +1 -1
  46. package/dist/esm/components/molecules/FieldNumber/FieldNumber.js.map +1 -1
  47. package/dist/esm/components/molecules/FieldPassword/FieldPassword.js +1 -1
  48. package/dist/esm/components/molecules/FieldPassword/FieldPassword.js.map +1 -1
  49. package/dist/esm/components/molecules/FieldText/FieldText.js +1 -1
  50. package/dist/esm/components/molecules/FieldText/FieldText.js.map +1 -1
  51. package/dist/esm/components/molecules/LabelCheckBox/LabelCheckBox.js +4 -4
  52. package/dist/esm/components/molecules/LabelCheckBox/LabelCheckBox.js.map +1 -1
  53. package/dist/esm/components/molecules/LabelRadioButton/LabelRadioButton.js +4 -4
  54. package/dist/esm/components/molecules/LabelRadioButton/LabelRadioButton.js.map +1 -1
  55. package/dist/esm/components/molecules/LabelSwitch/LabelSwitch.js +4 -4
  56. package/dist/esm/components/molecules/LabelSwitch/LabelSwitch.js.map +1 -1
  57. package/dist/esm/components/molecules/MessageFormError/{MesageFormError.js → MessageFormError.js} +1 -1
  58. package/dist/esm/components/molecules/MessageFormError/MessageFormError.js.map +1 -0
  59. package/dist/esm/components/molecules/Pagination/Pagination.d.ts +7 -19
  60. package/dist/esm/components/molecules/Pagination/Pagination.js +42 -198
  61. package/dist/esm/components/molecules/Pagination/Pagination.js.map +1 -1
  62. package/dist/esm/components/molecules/PickerDay/PickerDay.css +5 -3
  63. package/dist/esm/components/molecules/PickerDay/PickerDay.js +9 -9
  64. package/dist/esm/components/molecules/PickerDay/PickerDay.js.map +1 -1
  65. package/dist/esm/components/molecules/PickerDayRange/PickerDayRange.d.ts +1 -1
  66. package/dist/esm/components/molecules/PickerDayRange/PickerDayRange.js +6 -6
  67. package/dist/esm/components/molecules/PickerDayRange/PickerDayRange.js.map +1 -1
  68. package/dist/esm/components/molecules/PickerMonth/PickerMonth.js +8 -8
  69. package/dist/esm/components/molecules/PickerMonth/PickerMonth.js.map +1 -1
  70. package/dist/esm/components/molecules/PickerMonthTitle/PickerMonthTitle.css +1 -1
  71. package/dist/esm/components/molecules/PickerMonthTitle/PickerMonthTitle.js +19 -19
  72. package/dist/esm/components/molecules/PickerMonthTitle/PickerMonthTitle.js.map +1 -1
  73. package/dist/esm/components/molecules/PickerYear/PickerYear.css +8 -3
  74. package/dist/esm/components/molecules/PickerYear/PickerYear.js +8 -8
  75. package/dist/esm/components/molecules/PickerYear/PickerYear.js.map +1 -1
  76. package/dist/esm/components/molecules/index.d.ts +1 -1
  77. package/dist/esm/components/molecules/index.js +1 -1
  78. package/dist/esm/components/molecules/index.js.map +1 -1
  79. package/dist/esm/components/organisms/Confirmation/Confirmation.css +15 -12
  80. package/dist/esm/components/organisms/Confirmation/Confirmation.d.ts +1 -1
  81. package/dist/esm/components/organisms/Confirmation/Confirmation.js +2 -10
  82. package/dist/esm/components/organisms/Confirmation/Confirmation.js.map +1 -1
  83. package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.d.ts +8 -8
  84. package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js +14 -14
  85. package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocomplete.js.map +1 -1
  86. package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteHook.d.ts +4 -4
  87. package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteHook.js +6 -6
  88. package/dist/esm/components/organisms/FieldAutocomplete/FieldAutocompleteHook.js.map +1 -1
  89. package/dist/esm/components/organisms/FieldDate/FieldDate.d.ts +3 -2
  90. package/dist/esm/components/organisms/FieldDate/FieldDate.js +19 -22
  91. package/dist/esm/components/organisms/FieldDate/FieldDate.js.map +1 -1
  92. package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.d.ts +2 -2
  93. package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.js +3 -3
  94. package/dist/esm/components/organisms/FieldDateRange/FieldDateRange.js.map +1 -1
  95. package/dist/esm/components/organisms/FieldSelect/FieldSelect.d.ts +6 -6
  96. package/dist/esm/components/organisms/FieldSelect/FieldSelect.js +9 -9
  97. package/dist/esm/components/organisms/FieldSelect/FieldSelect.js.map +1 -1
  98. package/dist/esm/components/organisms/FieldSelect/FieldSelectHook.d.ts +2 -2
  99. package/dist/esm/components/organisms/FieldSelect/FieldSelectHook.js +4 -4
  100. package/dist/esm/components/organisms/FieldSelect/FieldSelectHook.js.map +1 -1
  101. package/dist/esm/components/organisms/PickerDate/PickerDate.css +1 -3
  102. package/dist/esm/components/organisms/PickerDate/PickerDate.d.ts +2 -2
  103. package/dist/esm/components/organisms/PickerDate/PickerDate.js +26 -26
  104. package/dist/esm/components/organisms/PickerDate/PickerDate.js.map +1 -1
  105. package/dist/esm/components/organisms/PickerDateRange/PickerDateRange.d.ts +3 -3
  106. package/dist/esm/components/organisms/PickerDateRange/PickerDateRange.js +15 -15
  107. package/dist/esm/components/organisms/PickerDateRange/PickerDateRange.js.map +1 -1
  108. package/dist/esm/helpers/date-range-picker.d.ts +1 -1
  109. package/dist/esm/helpers/date-range-picker.js +1 -1
  110. package/dist/esm/helpers/date-range-picker.js.map +1 -1
  111. package/dist/esm/hooks/DatatableHook.js +7 -4
  112. package/dist/esm/hooks/DatatableHook.js.map +1 -1
  113. package/dist/esm/hooks/ListControlHook.d.ts +14 -12
  114. package/dist/esm/hooks/ListControlHook.js +44 -36
  115. package/dist/esm/hooks/ListControlHook.js.map +1 -1
  116. package/package.json +19 -18
  117. package/dist/esm/components/atoms/SearchInput/SearchInput.d.ts +0 -9
  118. package/dist/esm/components/molecules/MessageFormError/MesageFormError.css +0 -0
  119. package/dist/esm/components/molecules/MessageFormError/MesageFormError.js.map +0 -1
  120. /package/dist/esm/components/molecules/MessageFormError/{MesageFormError.d.ts → MessageFormError.d.ts} +0 -0
package/dist/es/index.js CHANGED
@@ -1,13 +1,1359 @@
1
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { useState, useRef, useEffect, createContext } from 'react';
3
- import { currencyFormat, itIsDefined, PartialSealed } from '@rolster/helpers-advanced';
4
- import { hasPattern } from '@rolster/helpers-string';
5
- import { dateIsBefore, normalizeMinTime, dateIsAfter, normalizeMaxTime, getDaysOfMonth, getDateWeight, dateIsEqualsWeight, dateIsBetween, assignDayInDate, Month, MONTH_NAMES, DAY_LABELS, DateRange, dateFormatTemplate, assignYearInDate, assignMonthInDate } from '@rolster/helpers-date';
1
+ import require$$0, { useState, useRef, useEffect, createContext } from 'react';
2
+ import { currencyFormat, itIsDefined, PartialSealed } from '@rolster/commons';
3
+ import { PaginationController, checkDayPicker, createDayPicker, createDayRangePicker, checkMonthPicker, createMonthPicker, monthLimitTemplate, createYearPicker, checkYearPicker, ListCollection, locationListCanTop, navigationListFromInput, navigationListFromElement, createAutocompleteStore, checkDateRange, dateOutRange, PickerListenerType } from '@rolster/components';
4
+ import { DAY_LABELS, DateRange, normalizeMinTime, dateFormatTemplate, assignDayInDate, dateIsBefore, MONTH_NAMES, Month, assignYearInDate, assignMonthInDate } from '@rolster/dates';
6
5
  import ReactDOM from 'react-dom';
7
6
  import { i18n } from '@rolster/i18n';
8
- import { createFormControlProps } from '@rolster/helpers-forms';
9
- import 'uuid';
10
- import { BehaviorSubject } from 'rxjs';
7
+ import { useReactControl } from '@rolster/react-forms';
8
+
9
+ var jsxRuntime = {exports: {}};
10
+
11
+ var reactJsxRuntime_production_min = {};
12
+
13
+ /**
14
+ * @license React
15
+ * react-jsx-runtime.production.min.js
16
+ *
17
+ * Copyright (c) Facebook, Inc. and its affiliates.
18
+ *
19
+ * This source code is licensed under the MIT license found in the
20
+ * LICENSE file in the root directory of this source tree.
21
+ */
22
+
23
+ var hasRequiredReactJsxRuntime_production_min;
24
+
25
+ function requireReactJsxRuntime_production_min () {
26
+ if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
27
+ hasRequiredReactJsxRuntime_production_min = 1;
28
+ var f=require$$0,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
29
+ function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
30
+ return reactJsxRuntime_production_min;
31
+ }
32
+
33
+ var reactJsxRuntime_development = {};
34
+
35
+ /**
36
+ * @license React
37
+ * react-jsx-runtime.development.js
38
+ *
39
+ * Copyright (c) Facebook, Inc. and its affiliates.
40
+ *
41
+ * This source code is licensed under the MIT license found in the
42
+ * LICENSE file in the root directory of this source tree.
43
+ */
44
+
45
+ var hasRequiredReactJsxRuntime_development;
46
+
47
+ function requireReactJsxRuntime_development () {
48
+ if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
49
+ hasRequiredReactJsxRuntime_development = 1;
50
+
51
+ if (process.env.NODE_ENV !== "production") {
52
+ (function() {
53
+
54
+ var React = require$$0;
55
+
56
+ // ATTENTION
57
+ // When adding new symbols to this file,
58
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
59
+ // The Symbol used to tag the ReactElement-like types.
60
+ var REACT_ELEMENT_TYPE = Symbol.for('react.element');
61
+ var REACT_PORTAL_TYPE = Symbol.for('react.portal');
62
+ var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
63
+ var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
64
+ var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
65
+ var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
66
+ var REACT_CONTEXT_TYPE = Symbol.for('react.context');
67
+ var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
68
+ var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
69
+ var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
70
+ var REACT_MEMO_TYPE = Symbol.for('react.memo');
71
+ var REACT_LAZY_TYPE = Symbol.for('react.lazy');
72
+ var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
73
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
74
+ var FAUX_ITERATOR_SYMBOL = '@@iterator';
75
+ function getIteratorFn(maybeIterable) {
76
+ if (maybeIterable === null || typeof maybeIterable !== 'object') {
77
+ return null;
78
+ }
79
+
80
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
81
+
82
+ if (typeof maybeIterator === 'function') {
83
+ return maybeIterator;
84
+ }
85
+
86
+ return null;
87
+ }
88
+
89
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
90
+
91
+ function error(format) {
92
+ {
93
+ {
94
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
95
+ args[_key2 - 1] = arguments[_key2];
96
+ }
97
+
98
+ printWarning('error', format, args);
99
+ }
100
+ }
101
+ }
102
+
103
+ function printWarning(level, format, args) {
104
+ // When changing this logic, you might want to also
105
+ // update consoleWithStackDev.www.js as well.
106
+ {
107
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
108
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
109
+
110
+ if (stack !== '') {
111
+ format += '%s';
112
+ args = args.concat([stack]);
113
+ } // eslint-disable-next-line react-internal/safe-string-coercion
114
+
115
+
116
+ var argsWithFormat = args.map(function (item) {
117
+ return String(item);
118
+ }); // Careful: RN currently depends on this prefix
119
+
120
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
121
+ // breaks IE9: https://github.com/facebook/react/issues/13610
122
+ // eslint-disable-next-line react-internal/no-production-logging
123
+
124
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
125
+ }
126
+ }
127
+
128
+ // -----------------------------------------------------------------------------
129
+
130
+ var enableScopeAPI = false; // Experimental Create Event Handle API.
131
+ var enableCacheElement = false;
132
+ var enableTransitionTracing = false; // No known bugs, but needs performance testing
133
+
134
+ var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
135
+ // stuff. Intended to enable React core members to more easily debug scheduling
136
+ // issues in DEV builds.
137
+
138
+ var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
139
+
140
+ var REACT_MODULE_REFERENCE;
141
+
142
+ {
143
+ REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
144
+ }
145
+
146
+ function isValidElementType(type) {
147
+ if (typeof type === 'string' || typeof type === 'function') {
148
+ return true;
149
+ } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
150
+
151
+
152
+ if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
153
+ return true;
154
+ }
155
+
156
+ if (typeof type === 'object' && type !== null) {
157
+ if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
158
+ // types supported by any Flight configuration anywhere since
159
+ // we don't know which Flight build this will end up being used
160
+ // with.
161
+ type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
162
+ return true;
163
+ }
164
+ }
165
+
166
+ return false;
167
+ }
168
+
169
+ function getWrappedName(outerType, innerType, wrapperName) {
170
+ var displayName = outerType.displayName;
171
+
172
+ if (displayName) {
173
+ return displayName;
174
+ }
175
+
176
+ var functionName = innerType.displayName || innerType.name || '';
177
+ return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
178
+ } // Keep in sync with react-reconciler/getComponentNameFromFiber
179
+
180
+
181
+ function getContextName(type) {
182
+ return type.displayName || 'Context';
183
+ } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
184
+
185
+
186
+ function getComponentNameFromType(type) {
187
+ if (type == null) {
188
+ // Host root, text node or just invalid type.
189
+ return null;
190
+ }
191
+
192
+ {
193
+ if (typeof type.tag === 'number') {
194
+ error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
195
+ }
196
+ }
197
+
198
+ if (typeof type === 'function') {
199
+ return type.displayName || type.name || null;
200
+ }
201
+
202
+ if (typeof type === 'string') {
203
+ return type;
204
+ }
205
+
206
+ switch (type) {
207
+ case REACT_FRAGMENT_TYPE:
208
+ return 'Fragment';
209
+
210
+ case REACT_PORTAL_TYPE:
211
+ return 'Portal';
212
+
213
+ case REACT_PROFILER_TYPE:
214
+ return 'Profiler';
215
+
216
+ case REACT_STRICT_MODE_TYPE:
217
+ return 'StrictMode';
218
+
219
+ case REACT_SUSPENSE_TYPE:
220
+ return 'Suspense';
221
+
222
+ case REACT_SUSPENSE_LIST_TYPE:
223
+ return 'SuspenseList';
224
+
225
+ }
226
+
227
+ if (typeof type === 'object') {
228
+ switch (type.$$typeof) {
229
+ case REACT_CONTEXT_TYPE:
230
+ var context = type;
231
+ return getContextName(context) + '.Consumer';
232
+
233
+ case REACT_PROVIDER_TYPE:
234
+ var provider = type;
235
+ return getContextName(provider._context) + '.Provider';
236
+
237
+ case REACT_FORWARD_REF_TYPE:
238
+ return getWrappedName(type, type.render, 'ForwardRef');
239
+
240
+ case REACT_MEMO_TYPE:
241
+ var outerName = type.displayName || null;
242
+
243
+ if (outerName !== null) {
244
+ return outerName;
245
+ }
246
+
247
+ return getComponentNameFromType(type.type) || 'Memo';
248
+
249
+ case REACT_LAZY_TYPE:
250
+ {
251
+ var lazyComponent = type;
252
+ var payload = lazyComponent._payload;
253
+ var init = lazyComponent._init;
254
+
255
+ try {
256
+ return getComponentNameFromType(init(payload));
257
+ } catch (x) {
258
+ return null;
259
+ }
260
+ }
261
+
262
+ // eslint-disable-next-line no-fallthrough
263
+ }
264
+ }
265
+
266
+ return null;
267
+ }
268
+
269
+ var assign = Object.assign;
270
+
271
+ // Helpers to patch console.logs to avoid logging during side-effect free
272
+ // replaying on render function. This currently only patches the object
273
+ // lazily which won't cover if the log function was extracted eagerly.
274
+ // We could also eagerly patch the method.
275
+ var disabledDepth = 0;
276
+ var prevLog;
277
+ var prevInfo;
278
+ var prevWarn;
279
+ var prevError;
280
+ var prevGroup;
281
+ var prevGroupCollapsed;
282
+ var prevGroupEnd;
283
+
284
+ function disabledLog() {}
285
+
286
+ disabledLog.__reactDisabledLog = true;
287
+ function disableLogs() {
288
+ {
289
+ if (disabledDepth === 0) {
290
+ /* eslint-disable react-internal/no-production-logging */
291
+ prevLog = console.log;
292
+ prevInfo = console.info;
293
+ prevWarn = console.warn;
294
+ prevError = console.error;
295
+ prevGroup = console.group;
296
+ prevGroupCollapsed = console.groupCollapsed;
297
+ prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
298
+
299
+ var props = {
300
+ configurable: true,
301
+ enumerable: true,
302
+ value: disabledLog,
303
+ writable: true
304
+ }; // $FlowFixMe Flow thinks console is immutable.
305
+
306
+ Object.defineProperties(console, {
307
+ info: props,
308
+ log: props,
309
+ warn: props,
310
+ error: props,
311
+ group: props,
312
+ groupCollapsed: props,
313
+ groupEnd: props
314
+ });
315
+ /* eslint-enable react-internal/no-production-logging */
316
+ }
317
+
318
+ disabledDepth++;
319
+ }
320
+ }
321
+ function reenableLogs() {
322
+ {
323
+ disabledDepth--;
324
+
325
+ if (disabledDepth === 0) {
326
+ /* eslint-disable react-internal/no-production-logging */
327
+ var props = {
328
+ configurable: true,
329
+ enumerable: true,
330
+ writable: true
331
+ }; // $FlowFixMe Flow thinks console is immutable.
332
+
333
+ Object.defineProperties(console, {
334
+ log: assign({}, props, {
335
+ value: prevLog
336
+ }),
337
+ info: assign({}, props, {
338
+ value: prevInfo
339
+ }),
340
+ warn: assign({}, props, {
341
+ value: prevWarn
342
+ }),
343
+ error: assign({}, props, {
344
+ value: prevError
345
+ }),
346
+ group: assign({}, props, {
347
+ value: prevGroup
348
+ }),
349
+ groupCollapsed: assign({}, props, {
350
+ value: prevGroupCollapsed
351
+ }),
352
+ groupEnd: assign({}, props, {
353
+ value: prevGroupEnd
354
+ })
355
+ });
356
+ /* eslint-enable react-internal/no-production-logging */
357
+ }
358
+
359
+ if (disabledDepth < 0) {
360
+ error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
361
+ }
362
+ }
363
+ }
364
+
365
+ var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
366
+ var prefix;
367
+ function describeBuiltInComponentFrame(name, source, ownerFn) {
368
+ {
369
+ if (prefix === undefined) {
370
+ // Extract the VM specific prefix used by each line.
371
+ try {
372
+ throw Error();
373
+ } catch (x) {
374
+ var match = x.stack.trim().match(/\n( *(at )?)/);
375
+ prefix = match && match[1] || '';
376
+ }
377
+ } // We use the prefix to ensure our stacks line up with native stack frames.
378
+
379
+
380
+ return '\n' + prefix + name;
381
+ }
382
+ }
383
+ var reentry = false;
384
+ var componentFrameCache;
385
+
386
+ {
387
+ var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
388
+ componentFrameCache = new PossiblyWeakMap();
389
+ }
390
+
391
+ function describeNativeComponentFrame(fn, construct) {
392
+ // If something asked for a stack inside a fake render, it should get ignored.
393
+ if ( !fn || reentry) {
394
+ return '';
395
+ }
396
+
397
+ {
398
+ var frame = componentFrameCache.get(fn);
399
+
400
+ if (frame !== undefined) {
401
+ return frame;
402
+ }
403
+ }
404
+
405
+ var control;
406
+ reentry = true;
407
+ var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
408
+
409
+ Error.prepareStackTrace = undefined;
410
+ var previousDispatcher;
411
+
412
+ {
413
+ previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
414
+ // for warnings.
415
+
416
+ ReactCurrentDispatcher.current = null;
417
+ disableLogs();
418
+ }
419
+
420
+ try {
421
+ // This should throw.
422
+ if (construct) {
423
+ // Something should be setting the props in the constructor.
424
+ var Fake = function () {
425
+ throw Error();
426
+ }; // $FlowFixMe
427
+
428
+
429
+ Object.defineProperty(Fake.prototype, 'props', {
430
+ set: function () {
431
+ // We use a throwing setter instead of frozen or non-writable props
432
+ // because that won't throw in a non-strict mode function.
433
+ throw Error();
434
+ }
435
+ });
436
+
437
+ if (typeof Reflect === 'object' && Reflect.construct) {
438
+ // We construct a different control for this case to include any extra
439
+ // frames added by the construct call.
440
+ try {
441
+ Reflect.construct(Fake, []);
442
+ } catch (x) {
443
+ control = x;
444
+ }
445
+
446
+ Reflect.construct(fn, [], Fake);
447
+ } else {
448
+ try {
449
+ Fake.call();
450
+ } catch (x) {
451
+ control = x;
452
+ }
453
+
454
+ fn.call(Fake.prototype);
455
+ }
456
+ } else {
457
+ try {
458
+ throw Error();
459
+ } catch (x) {
460
+ control = x;
461
+ }
462
+
463
+ fn();
464
+ }
465
+ } catch (sample) {
466
+ // This is inlined manually because closure doesn't do it for us.
467
+ if (sample && control && typeof sample.stack === 'string') {
468
+ // This extracts the first frame from the sample that isn't also in the control.
469
+ // Skipping one frame that we assume is the frame that calls the two.
470
+ var sampleLines = sample.stack.split('\n');
471
+ var controlLines = control.stack.split('\n');
472
+ var s = sampleLines.length - 1;
473
+ var c = controlLines.length - 1;
474
+
475
+ while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
476
+ // We expect at least one stack frame to be shared.
477
+ // Typically this will be the root most one. However, stack frames may be
478
+ // cut off due to maximum stack limits. In this case, one maybe cut off
479
+ // earlier than the other. We assume that the sample is longer or the same
480
+ // and there for cut off earlier. So we should find the root most frame in
481
+ // the sample somewhere in the control.
482
+ c--;
483
+ }
484
+
485
+ for (; s >= 1 && c >= 0; s--, c--) {
486
+ // Next we find the first one that isn't the same which should be the
487
+ // frame that called our sample function and the control.
488
+ if (sampleLines[s] !== controlLines[c]) {
489
+ // In V8, the first line is describing the message but other VMs don't.
490
+ // If we're about to return the first line, and the control is also on the same
491
+ // line, that's a pretty good indicator that our sample threw at same line as
492
+ // the control. I.e. before we entered the sample frame. So we ignore this result.
493
+ // This can happen if you passed a class to function component, or non-function.
494
+ if (s !== 1 || c !== 1) {
495
+ do {
496
+ s--;
497
+ c--; // We may still have similar intermediate frames from the construct call.
498
+ // The next one that isn't the same should be our match though.
499
+
500
+ if (c < 0 || sampleLines[s] !== controlLines[c]) {
501
+ // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
502
+ var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
503
+ // but we have a user-provided "displayName"
504
+ // splice it in to make the stack more readable.
505
+
506
+
507
+ if (fn.displayName && _frame.includes('<anonymous>')) {
508
+ _frame = _frame.replace('<anonymous>', fn.displayName);
509
+ }
510
+
511
+ {
512
+ if (typeof fn === 'function') {
513
+ componentFrameCache.set(fn, _frame);
514
+ }
515
+ } // Return the line we found.
516
+
517
+
518
+ return _frame;
519
+ }
520
+ } while (s >= 1 && c >= 0);
521
+ }
522
+
523
+ break;
524
+ }
525
+ }
526
+ }
527
+ } finally {
528
+ reentry = false;
529
+
530
+ {
531
+ ReactCurrentDispatcher.current = previousDispatcher;
532
+ reenableLogs();
533
+ }
534
+
535
+ Error.prepareStackTrace = previousPrepareStackTrace;
536
+ } // Fallback to just using the name if we couldn't make it throw.
537
+
538
+
539
+ var name = fn ? fn.displayName || fn.name : '';
540
+ var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
541
+
542
+ {
543
+ if (typeof fn === 'function') {
544
+ componentFrameCache.set(fn, syntheticFrame);
545
+ }
546
+ }
547
+
548
+ return syntheticFrame;
549
+ }
550
+ function describeFunctionComponentFrame(fn, source, ownerFn) {
551
+ {
552
+ return describeNativeComponentFrame(fn, false);
553
+ }
554
+ }
555
+
556
+ function shouldConstruct(Component) {
557
+ var prototype = Component.prototype;
558
+ return !!(prototype && prototype.isReactComponent);
559
+ }
560
+
561
+ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
562
+
563
+ if (type == null) {
564
+ return '';
565
+ }
566
+
567
+ if (typeof type === 'function') {
568
+ {
569
+ return describeNativeComponentFrame(type, shouldConstruct(type));
570
+ }
571
+ }
572
+
573
+ if (typeof type === 'string') {
574
+ return describeBuiltInComponentFrame(type);
575
+ }
576
+
577
+ switch (type) {
578
+ case REACT_SUSPENSE_TYPE:
579
+ return describeBuiltInComponentFrame('Suspense');
580
+
581
+ case REACT_SUSPENSE_LIST_TYPE:
582
+ return describeBuiltInComponentFrame('SuspenseList');
583
+ }
584
+
585
+ if (typeof type === 'object') {
586
+ switch (type.$$typeof) {
587
+ case REACT_FORWARD_REF_TYPE:
588
+ return describeFunctionComponentFrame(type.render);
589
+
590
+ case REACT_MEMO_TYPE:
591
+ // Memo may contain any component type so we recursively resolve it.
592
+ return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
593
+
594
+ case REACT_LAZY_TYPE:
595
+ {
596
+ var lazyComponent = type;
597
+ var payload = lazyComponent._payload;
598
+ var init = lazyComponent._init;
599
+
600
+ try {
601
+ // Lazy may contain any component type so we recursively resolve it.
602
+ return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
603
+ } catch (x) {}
604
+ }
605
+ }
606
+ }
607
+
608
+ return '';
609
+ }
610
+
611
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
612
+
613
+ var loggedTypeFailures = {};
614
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
615
+
616
+ function setCurrentlyValidatingElement(element) {
617
+ {
618
+ if (element) {
619
+ var owner = element._owner;
620
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
621
+ ReactDebugCurrentFrame.setExtraStackFrame(stack);
622
+ } else {
623
+ ReactDebugCurrentFrame.setExtraStackFrame(null);
624
+ }
625
+ }
626
+ }
627
+
628
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
629
+ {
630
+ // $FlowFixMe This is okay but Flow doesn't know it.
631
+ var has = Function.call.bind(hasOwnProperty);
632
+
633
+ for (var typeSpecName in typeSpecs) {
634
+ if (has(typeSpecs, typeSpecName)) {
635
+ var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
636
+ // fail the render phase where it didn't fail before. So we log it.
637
+ // After these have been cleaned up, we'll let them throw.
638
+
639
+ try {
640
+ // This is intentionally an invariant that gets caught. It's the same
641
+ // behavior as without this statement except with a better message.
642
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
643
+ // eslint-disable-next-line react-internal/prod-error-codes
644
+ var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
645
+ err.name = 'Invariant Violation';
646
+ throw err;
647
+ }
648
+
649
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
650
+ } catch (ex) {
651
+ error$1 = ex;
652
+ }
653
+
654
+ if (error$1 && !(error$1 instanceof Error)) {
655
+ setCurrentlyValidatingElement(element);
656
+
657
+ error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
658
+
659
+ setCurrentlyValidatingElement(null);
660
+ }
661
+
662
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
663
+ // Only monitor this failure once because there tends to be a lot of the
664
+ // same error.
665
+ loggedTypeFailures[error$1.message] = true;
666
+ setCurrentlyValidatingElement(element);
667
+
668
+ error('Failed %s type: %s', location, error$1.message);
669
+
670
+ setCurrentlyValidatingElement(null);
671
+ }
672
+ }
673
+ }
674
+ }
675
+ }
676
+
677
+ var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
678
+
679
+ function isArray(a) {
680
+ return isArrayImpl(a);
681
+ }
682
+
683
+ /*
684
+ * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
685
+ * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
686
+ *
687
+ * The functions in this module will throw an easier-to-understand,
688
+ * easier-to-debug exception with a clear errors message message explaining the
689
+ * problem. (Instead of a confusing exception thrown inside the implementation
690
+ * of the `value` object).
691
+ */
692
+ // $FlowFixMe only called in DEV, so void return is not possible.
693
+ function typeName(value) {
694
+ {
695
+ // toStringTag is needed for namespaced types like Temporal.Instant
696
+ var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
697
+ var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
698
+ return type;
699
+ }
700
+ } // $FlowFixMe only called in DEV, so void return is not possible.
701
+
702
+
703
+ function willCoercionThrow(value) {
704
+ {
705
+ try {
706
+ testStringCoercion(value);
707
+ return false;
708
+ } catch (e) {
709
+ return true;
710
+ }
711
+ }
712
+ }
713
+
714
+ function testStringCoercion(value) {
715
+ // If you ended up here by following an exception call stack, here's what's
716
+ // happened: you supplied an object or symbol value to React (as a prop, key,
717
+ // DOM attribute, CSS property, string ref, etc.) and when React tried to
718
+ // coerce it to a string using `'' + value`, an exception was thrown.
719
+ //
720
+ // The most common types that will cause this exception are `Symbol` instances
721
+ // and Temporal objects like `Temporal.Instant`. But any object that has a
722
+ // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
723
+ // exception. (Library authors do this to prevent users from using built-in
724
+ // numeric operators like `+` or comparison operators like `>=` because custom
725
+ // methods are needed to perform accurate arithmetic or comparison.)
726
+ //
727
+ // To fix the problem, coerce this object or symbol value to a string before
728
+ // passing it to React. The most reliable way is usually `String(value)`.
729
+ //
730
+ // To find which value is throwing, check the browser or debugger console.
731
+ // Before this exception was thrown, there should be `console.error` output
732
+ // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
733
+ // problem and how that type was used: key, atrribute, input value prop, etc.
734
+ // In most cases, this console output also shows the component and its
735
+ // ancestor components where the exception happened.
736
+ //
737
+ // eslint-disable-next-line react-internal/safe-string-coercion
738
+ return '' + value;
739
+ }
740
+ function checkKeyStringCoercion(value) {
741
+ {
742
+ if (willCoercionThrow(value)) {
743
+ error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
744
+
745
+ return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
746
+ }
747
+ }
748
+ }
749
+
750
+ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
751
+ var RESERVED_PROPS = {
752
+ key: true,
753
+ ref: true,
754
+ __self: true,
755
+ __source: true
756
+ };
757
+ var specialPropKeyWarningShown;
758
+ var specialPropRefWarningShown;
759
+ var didWarnAboutStringRefs;
760
+
761
+ {
762
+ didWarnAboutStringRefs = {};
763
+ }
764
+
765
+ function hasValidRef(config) {
766
+ {
767
+ if (hasOwnProperty.call(config, 'ref')) {
768
+ var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
769
+
770
+ if (getter && getter.isReactWarning) {
771
+ return false;
772
+ }
773
+ }
774
+ }
775
+
776
+ return config.ref !== undefined;
777
+ }
778
+
779
+ function hasValidKey(config) {
780
+ {
781
+ if (hasOwnProperty.call(config, 'key')) {
782
+ var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
783
+
784
+ if (getter && getter.isReactWarning) {
785
+ return false;
786
+ }
787
+ }
788
+ }
789
+
790
+ return config.key !== undefined;
791
+ }
792
+
793
+ function warnIfStringRefCannotBeAutoConverted(config, self) {
794
+ {
795
+ if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
796
+ var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
797
+
798
+ if (!didWarnAboutStringRefs[componentName]) {
799
+ error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
800
+
801
+ didWarnAboutStringRefs[componentName] = true;
802
+ }
803
+ }
804
+ }
805
+ }
806
+
807
+ function defineKeyPropWarningGetter(props, displayName) {
808
+ {
809
+ var warnAboutAccessingKey = function () {
810
+ if (!specialPropKeyWarningShown) {
811
+ specialPropKeyWarningShown = true;
812
+
813
+ error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
814
+ }
815
+ };
816
+
817
+ warnAboutAccessingKey.isReactWarning = true;
818
+ Object.defineProperty(props, 'key', {
819
+ get: warnAboutAccessingKey,
820
+ configurable: true
821
+ });
822
+ }
823
+ }
824
+
825
+ function defineRefPropWarningGetter(props, displayName) {
826
+ {
827
+ var warnAboutAccessingRef = function () {
828
+ if (!specialPropRefWarningShown) {
829
+ specialPropRefWarningShown = true;
830
+
831
+ error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
832
+ }
833
+ };
834
+
835
+ warnAboutAccessingRef.isReactWarning = true;
836
+ Object.defineProperty(props, 'ref', {
837
+ get: warnAboutAccessingRef,
838
+ configurable: true
839
+ });
840
+ }
841
+ }
842
+ /**
843
+ * Factory method to create a new React element. This no longer adheres to
844
+ * the class pattern, so do not use new to call it. Also, instanceof check
845
+ * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
846
+ * if something is a React Element.
847
+ *
848
+ * @param {*} type
849
+ * @param {*} props
850
+ * @param {*} key
851
+ * @param {string|object} ref
852
+ * @param {*} owner
853
+ * @param {*} self A *temporary* helper to detect places where `this` is
854
+ * different from the `owner` when React.createElement is called, so that we
855
+ * can warn. We want to get rid of owner and replace string `ref`s with arrow
856
+ * functions, and as long as `this` and owner are the same, there will be no
857
+ * change in behavior.
858
+ * @param {*} source An annotation object (added by a transpiler or otherwise)
859
+ * indicating filename, line number, and/or other information.
860
+ * @internal
861
+ */
862
+
863
+
864
+ var ReactElement = function (type, key, ref, self, source, owner, props) {
865
+ var element = {
866
+ // This tag allows us to uniquely identify this as a React Element
867
+ $$typeof: REACT_ELEMENT_TYPE,
868
+ // Built-in properties that belong on the element
869
+ type: type,
870
+ key: key,
871
+ ref: ref,
872
+ props: props,
873
+ // Record the component responsible for creating this element.
874
+ _owner: owner
875
+ };
876
+
877
+ {
878
+ // The validation flag is currently mutative. We put it on
879
+ // an external backing store so that we can freeze the whole object.
880
+ // This can be replaced with a WeakMap once they are implemented in
881
+ // commonly used development environments.
882
+ element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
883
+ // the validation flag non-enumerable (where possible, which should
884
+ // include every environment we run tests in), so the test framework
885
+ // ignores it.
886
+
887
+ Object.defineProperty(element._store, 'validated', {
888
+ configurable: false,
889
+ enumerable: false,
890
+ writable: true,
891
+ value: false
892
+ }); // self and source are DEV only properties.
893
+
894
+ Object.defineProperty(element, '_self', {
895
+ configurable: false,
896
+ enumerable: false,
897
+ writable: false,
898
+ value: self
899
+ }); // Two elements created in two different places should be considered
900
+ // equal for testing purposes and therefore we hide it from enumeration.
901
+
902
+ Object.defineProperty(element, '_source', {
903
+ configurable: false,
904
+ enumerable: false,
905
+ writable: false,
906
+ value: source
907
+ });
908
+
909
+ if (Object.freeze) {
910
+ Object.freeze(element.props);
911
+ Object.freeze(element);
912
+ }
913
+ }
914
+
915
+ return element;
916
+ };
917
+ /**
918
+ * https://github.com/reactjs/rfcs/pull/107
919
+ * @param {*} type
920
+ * @param {object} props
921
+ * @param {string} key
922
+ */
923
+
924
+ function jsxDEV(type, config, maybeKey, source, self) {
925
+ {
926
+ var propName; // Reserved names are extracted
927
+
928
+ var props = {};
929
+ var key = null;
930
+ var ref = null; // Currently, key can be spread in as a prop. This causes a potential
931
+ // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
932
+ // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
933
+ // but as an intermediary step, we will use jsxDEV for everything except
934
+ // <div {...props} key="Hi" />, because we aren't currently able to tell if
935
+ // key is explicitly declared to be undefined or not.
936
+
937
+ if (maybeKey !== undefined) {
938
+ {
939
+ checkKeyStringCoercion(maybeKey);
940
+ }
941
+
942
+ key = '' + maybeKey;
943
+ }
944
+
945
+ if (hasValidKey(config)) {
946
+ {
947
+ checkKeyStringCoercion(config.key);
948
+ }
949
+
950
+ key = '' + config.key;
951
+ }
952
+
953
+ if (hasValidRef(config)) {
954
+ ref = config.ref;
955
+ warnIfStringRefCannotBeAutoConverted(config, self);
956
+ } // Remaining properties are added to a new props object
957
+
958
+
959
+ for (propName in config) {
960
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
961
+ props[propName] = config[propName];
962
+ }
963
+ } // Resolve default props
964
+
965
+
966
+ if (type && type.defaultProps) {
967
+ var defaultProps = type.defaultProps;
968
+
969
+ for (propName in defaultProps) {
970
+ if (props[propName] === undefined) {
971
+ props[propName] = defaultProps[propName];
972
+ }
973
+ }
974
+ }
975
+
976
+ if (key || ref) {
977
+ var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
978
+
979
+ if (key) {
980
+ defineKeyPropWarningGetter(props, displayName);
981
+ }
982
+
983
+ if (ref) {
984
+ defineRefPropWarningGetter(props, displayName);
985
+ }
986
+ }
987
+
988
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
989
+ }
990
+ }
991
+
992
+ var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
993
+ var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
994
+
995
+ function setCurrentlyValidatingElement$1(element) {
996
+ {
997
+ if (element) {
998
+ var owner = element._owner;
999
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1000
+ ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
1001
+ } else {
1002
+ ReactDebugCurrentFrame$1.setExtraStackFrame(null);
1003
+ }
1004
+ }
1005
+ }
1006
+
1007
+ var propTypesMisspellWarningShown;
1008
+
1009
+ {
1010
+ propTypesMisspellWarningShown = false;
1011
+ }
1012
+ /**
1013
+ * Verifies the object is a ReactElement.
1014
+ * See https://reactjs.org/docs/react-api.html#isvalidelement
1015
+ * @param {?object} object
1016
+ * @return {boolean} True if `object` is a ReactElement.
1017
+ * @final
1018
+ */
1019
+
1020
+
1021
+ function isValidElement(object) {
1022
+ {
1023
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1024
+ }
1025
+ }
1026
+
1027
+ function getDeclarationErrorAddendum() {
1028
+ {
1029
+ if (ReactCurrentOwner$1.current) {
1030
+ var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
1031
+
1032
+ if (name) {
1033
+ return '\n\nCheck the render method of `' + name + '`.';
1034
+ }
1035
+ }
1036
+
1037
+ return '';
1038
+ }
1039
+ }
1040
+
1041
+ function getSourceInfoErrorAddendum(source) {
1042
+ {
1043
+
1044
+ return '';
1045
+ }
1046
+ }
1047
+ /**
1048
+ * Warn if there's no key explicitly set on dynamic arrays of children or
1049
+ * object keys are not valid. This allows us to keep track of children between
1050
+ * updates.
1051
+ */
1052
+
1053
+
1054
+ var ownerHasKeyUseWarning = {};
1055
+
1056
+ function getCurrentComponentErrorInfo(parentType) {
1057
+ {
1058
+ var info = getDeclarationErrorAddendum();
1059
+
1060
+ if (!info) {
1061
+ var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1062
+
1063
+ if (parentName) {
1064
+ info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1065
+ }
1066
+ }
1067
+
1068
+ return info;
1069
+ }
1070
+ }
1071
+ /**
1072
+ * Warn if the element doesn't have an explicit key assigned to it.
1073
+ * This element is in an array. The array could grow and shrink or be
1074
+ * reordered. All children that haven't already been validated are required to
1075
+ * have a "key" property assigned to it. Error statuses are cached so a warning
1076
+ * will only be shown once.
1077
+ *
1078
+ * @internal
1079
+ * @param {ReactElement} element Element that requires a key.
1080
+ * @param {*} parentType element's parent's type.
1081
+ */
1082
+
1083
+
1084
+ function validateExplicitKey(element, parentType) {
1085
+ {
1086
+ if (!element._store || element._store.validated || element.key != null) {
1087
+ return;
1088
+ }
1089
+
1090
+ element._store.validated = true;
1091
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1092
+
1093
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1094
+ return;
1095
+ }
1096
+
1097
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
1098
+ // property, it may be the creator of the child that's responsible for
1099
+ // assigning it a key.
1100
+
1101
+ var childOwner = '';
1102
+
1103
+ if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
1104
+ // Give the component that originally created this child.
1105
+ childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
1106
+ }
1107
+
1108
+ setCurrentlyValidatingElement$1(element);
1109
+
1110
+ error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
1111
+
1112
+ setCurrentlyValidatingElement$1(null);
1113
+ }
1114
+ }
1115
+ /**
1116
+ * Ensure that every element either is passed in a static location, in an
1117
+ * array with an explicit keys property defined, or in an object literal
1118
+ * with valid key property.
1119
+ *
1120
+ * @internal
1121
+ * @param {ReactNode} node Statically passed child of any type.
1122
+ * @param {*} parentType node's parent's type.
1123
+ */
1124
+
1125
+
1126
+ function validateChildKeys(node, parentType) {
1127
+ {
1128
+ if (typeof node !== 'object') {
1129
+ return;
1130
+ }
1131
+
1132
+ if (isArray(node)) {
1133
+ for (var i = 0; i < node.length; i++) {
1134
+ var child = node[i];
1135
+
1136
+ if (isValidElement(child)) {
1137
+ validateExplicitKey(child, parentType);
1138
+ }
1139
+ }
1140
+ } else if (isValidElement(node)) {
1141
+ // This element was passed in a valid location.
1142
+ if (node._store) {
1143
+ node._store.validated = true;
1144
+ }
1145
+ } else if (node) {
1146
+ var iteratorFn = getIteratorFn(node);
1147
+
1148
+ if (typeof iteratorFn === 'function') {
1149
+ // Entry iterators used to provide implicit keys,
1150
+ // but now we print a separate warning for them later.
1151
+ if (iteratorFn !== node.entries) {
1152
+ var iterator = iteratorFn.call(node);
1153
+ var step;
1154
+
1155
+ while (!(step = iterator.next()).done) {
1156
+ if (isValidElement(step.value)) {
1157
+ validateExplicitKey(step.value, parentType);
1158
+ }
1159
+ }
1160
+ }
1161
+ }
1162
+ }
1163
+ }
1164
+ }
1165
+ /**
1166
+ * Given an element, validate that its props follow the propTypes definition,
1167
+ * provided by the type.
1168
+ *
1169
+ * @param {ReactElement} element
1170
+ */
1171
+
1172
+
1173
+ function validatePropTypes(element) {
1174
+ {
1175
+ var type = element.type;
1176
+
1177
+ if (type === null || type === undefined || typeof type === 'string') {
1178
+ return;
1179
+ }
1180
+
1181
+ var propTypes;
1182
+
1183
+ if (typeof type === 'function') {
1184
+ propTypes = type.propTypes;
1185
+ } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1186
+ // Inner props are checked in the reconciler.
1187
+ type.$$typeof === REACT_MEMO_TYPE)) {
1188
+ propTypes = type.propTypes;
1189
+ } else {
1190
+ return;
1191
+ }
1192
+
1193
+ if (propTypes) {
1194
+ // Intentionally inside to avoid triggering lazy initializers:
1195
+ var name = getComponentNameFromType(type);
1196
+ checkPropTypes(propTypes, element.props, 'prop', name, element);
1197
+ } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1198
+ propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
1199
+
1200
+ var _name = getComponentNameFromType(type);
1201
+
1202
+ error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
1203
+ }
1204
+
1205
+ if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
1206
+ error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
1207
+ }
1208
+ }
1209
+ }
1210
+ /**
1211
+ * Given a fragment, validate that it can only be provided with fragment props
1212
+ * @param {ReactElement} fragment
1213
+ */
1214
+
1215
+
1216
+ function validateFragmentProps(fragment) {
1217
+ {
1218
+ var keys = Object.keys(fragment.props);
1219
+
1220
+ for (var i = 0; i < keys.length; i++) {
1221
+ var key = keys[i];
1222
+
1223
+ if (key !== 'children' && key !== 'key') {
1224
+ setCurrentlyValidatingElement$1(fragment);
1225
+
1226
+ error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1227
+
1228
+ setCurrentlyValidatingElement$1(null);
1229
+ break;
1230
+ }
1231
+ }
1232
+
1233
+ if (fragment.ref !== null) {
1234
+ setCurrentlyValidatingElement$1(fragment);
1235
+
1236
+ error('Invalid attribute `ref` supplied to `React.Fragment`.');
1237
+
1238
+ setCurrentlyValidatingElement$1(null);
1239
+ }
1240
+ }
1241
+ }
1242
+
1243
+ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
1244
+ {
1245
+ var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
1246
+ // succeed and there will likely be errors in render.
1247
+
1248
+ if (!validType) {
1249
+ var info = '';
1250
+
1251
+ if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1252
+ info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
1253
+ }
1254
+
1255
+ var sourceInfo = getSourceInfoErrorAddendum();
1256
+
1257
+ if (sourceInfo) {
1258
+ info += sourceInfo;
1259
+ } else {
1260
+ info += getDeclarationErrorAddendum();
1261
+ }
1262
+
1263
+ var typeString;
1264
+
1265
+ if (type === null) {
1266
+ typeString = 'null';
1267
+ } else if (isArray(type)) {
1268
+ typeString = 'array';
1269
+ } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1270
+ typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
1271
+ info = ' Did you accidentally export a JSX literal instead of a component?';
1272
+ } else {
1273
+ typeString = typeof type;
1274
+ }
1275
+
1276
+ error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
1277
+ }
1278
+
1279
+ var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
1280
+ // TODO: Drop this when these are no longer allowed as the type argument.
1281
+
1282
+ if (element == null) {
1283
+ return element;
1284
+ } // Skip key warning if the type isn't valid since our key validation logic
1285
+ // doesn't expect a non-string/function type and can throw confusing errors.
1286
+ // We don't want exception behavior to differ between dev and prod.
1287
+ // (Rendering will throw with a helpful message and as soon as the type is
1288
+ // fixed, the key warnings will appear.)
1289
+
1290
+
1291
+ if (validType) {
1292
+ var children = props.children;
1293
+
1294
+ if (children !== undefined) {
1295
+ if (isStaticChildren) {
1296
+ if (isArray(children)) {
1297
+ for (var i = 0; i < children.length; i++) {
1298
+ validateChildKeys(children[i], type);
1299
+ }
1300
+
1301
+ if (Object.freeze) {
1302
+ Object.freeze(children);
1303
+ }
1304
+ } else {
1305
+ error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
1306
+ }
1307
+ } else {
1308
+ validateChildKeys(children, type);
1309
+ }
1310
+ }
1311
+ }
1312
+
1313
+ if (type === REACT_FRAGMENT_TYPE) {
1314
+ validateFragmentProps(element);
1315
+ } else {
1316
+ validatePropTypes(element);
1317
+ }
1318
+
1319
+ return element;
1320
+ }
1321
+ } // These two functions exist to still get child warnings in dev
1322
+ // even with the prod transform. This means that jsxDEV is purely
1323
+ // opt-in behavior for better messages but that we won't stop
1324
+ // giving you warnings if you use production apis.
1325
+
1326
+ function jsxWithValidationStatic(type, props, key) {
1327
+ {
1328
+ return jsxWithValidation(type, props, key, true);
1329
+ }
1330
+ }
1331
+ function jsxWithValidationDynamic(type, props, key) {
1332
+ {
1333
+ return jsxWithValidation(type, props, key, false);
1334
+ }
1335
+ }
1336
+
1337
+ var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
1338
+ // for now we can ship identical prod functions
1339
+
1340
+ var jsxs = jsxWithValidationStatic ;
1341
+
1342
+ reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
1343
+ reactJsxRuntime_development.jsx = jsx;
1344
+ reactJsxRuntime_development.jsxs = jsxs;
1345
+ })();
1346
+ }
1347
+ return reactJsxRuntime_development;
1348
+ }
1349
+
1350
+ if (process.env.NODE_ENV === 'production') {
1351
+ jsxRuntime.exports = requireReactJsxRuntime_production_min();
1352
+ } else {
1353
+ jsxRuntime.exports = requireReactJsxRuntime_development();
1354
+ }
1355
+
1356
+ var jsxRuntimeExports = jsxRuntime.exports;
11
1357
 
12
1358
  const baseCls = 'rls-tabular-text';
13
1359
  const pointers = ['.', ','];
@@ -15,11 +1361,11 @@ function charClass(char) {
15
1361
  return pointers.includes(char) ? `${baseCls}__pointer` : `${baseCls}__char`;
16
1362
  }
17
1363
  function RlsTabularText({ value }) {
18
- return (jsx("div", { className: "rls-tabular-text", children: value?.split('').map((char, index) => (jsx("span", { className: charClass(char), children: char }, index))) }));
1364
+ return (jsxRuntimeExports.jsx("div", { className: "rls-tabular-text", children: value?.split('').map((char, index) => (jsxRuntimeExports.jsx("span", { className: charClass(char), children: char }, index))) }));
19
1365
  }
20
1366
 
21
1367
  function RlsAmount({ value, decimals, rlsTheme, symbol }) {
22
- return (jsxs("div", { className: "rls-amount", "rls-theme": rlsTheme, children: [symbol && jsx("span", { children: symbol }), jsx(RlsTabularText, { value: currencyFormat({ value, decimals }) })] }));
1368
+ return (jsxRuntimeExports.jsxs("div", { className: "rls-amount", "rls-theme": rlsTheme, children: [symbol && jsxRuntimeExports.jsx("span", { children: symbol }), jsxRuntimeExports.jsx(RlsTabularText, { value: currencyFormat({ value, decimals }) })] }));
23
1369
  }
24
1370
 
25
1371
  function renderClassStatus(base, status = {}, aditionals) {
@@ -38,45 +1384,45 @@ function renderClassStatus(base, status = {}, aditionals) {
38
1384
  }
39
1385
 
40
1386
  function RlsAvatar({ children, rounded, skeleton, rlsTheme }) {
41
- return (jsx("div", { className: renderClassStatus('rls-avatar', { rounded, skeleton }), "rls-theme": rlsTheme, children: children }));
1387
+ return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-avatar', { rounded, skeleton }), "rls-theme": rlsTheme, children: children }));
42
1388
  }
43
1389
 
44
1390
  function RlsBadge({ children, rlsTheme }) {
45
- return (jsx("div", { className: "rls-badge", "rls-theme": rlsTheme, children: children }));
1391
+ return (jsxRuntimeExports.jsx("div", { className: "rls-badge", "rls-theme": rlsTheme, children: children }));
46
1392
  }
47
1393
 
48
1394
  function RlsBreadcrumb({ labels }) {
49
- return (jsx("div", { className: "rls-breadcrumb", children: labels.map(({ label, onClick }, index) => (jsx("label", { className: "rls-breadcrumb__label", onClick: onClick, children: jsx("a", { className: "rls-breadcrumb__label__a", children: label }) }, index))) }));
1395
+ return (jsxRuntimeExports.jsx("div", { className: "rls-breadcrumb", children: labels.map(({ label, onClick }, index) => (jsxRuntimeExports.jsx("label", { className: "rls-breadcrumb__label", onClick: onClick, children: jsxRuntimeExports.jsx("a", { className: "rls-breadcrumb__label__a", children: label }) }, index))) }));
50
1396
  }
51
1397
 
52
1398
  function RlsIcon({ value, skeleton }) {
53
- return (jsx("div", { className: renderClassStatus('rls-icon', { skeleton }), children: jsx("i", { className: `rls-icon-${value}` }) }));
1399
+ return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-icon', { skeleton }), children: jsxRuntimeExports.jsx("i", { className: `rls-icon-${value}` }) }));
54
1400
  }
55
1401
 
56
1402
  function RlsButton({ type, children, disabled, prefixIcon, suffixIcon, rlsTheme, onClick }) {
57
- return (jsx("button", { className: "rls-button", onClick: onClick, "rls-theme": rlsTheme, disabled: disabled, children: jsxs("div", { className: renderClassStatus('rls-button__content', { type }), children: [prefixIcon && jsx(RlsIcon, { value: prefixIcon }), children && jsx("div", { className: "rls-button__label", children: children }), suffixIcon && jsx(RlsIcon, { value: suffixIcon })] }) }));
1403
+ return (jsxRuntimeExports.jsx("button", { className: "rls-button", onClick: onClick, "rls-theme": rlsTheme, disabled: disabled, children: jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-button__content', { type }), children: [prefixIcon && jsxRuntimeExports.jsx(RlsIcon, { value: prefixIcon }), children && jsxRuntimeExports.jsx("div", { className: "rls-button__label", children: children }), suffixIcon && jsxRuntimeExports.jsx(RlsIcon, { value: suffixIcon })] }) }));
58
1404
  }
59
1405
 
60
1406
  function RlsButtonAction({ icon, disabled, tooltip, onClick }) {
61
- return (jsxs("button", { className: "rls-button-action", onClick: onClick, disabled: disabled, children: [jsx("div", { className: "rls-button-action__content", children: jsx(RlsIcon, { value: icon }) }), tooltip && (jsx("div", { className: "rls-button-action__tooltip caption-semibold", children: jsx("span", { children: tooltip }) }))] }));
1407
+ return (jsxRuntimeExports.jsxs("button", { className: "rls-button-action", onClick: onClick, disabled: disabled, children: [jsxRuntimeExports.jsx("div", { className: "rls-button-action__content", children: jsxRuntimeExports.jsx(RlsIcon, { value: icon }) }), tooltip && (jsxRuntimeExports.jsx("div", { className: "rls-button-action__tooltip caption-semibold", children: jsxRuntimeExports.jsx("span", { children: tooltip }) }))] }));
62
1408
  }
63
1409
 
64
1410
  function RlsCheckBox({ checked, disabled, onClick, rlsTheme }) {
65
- return (jsx("div", { className: renderClassStatus('rls-checkbox', { checked, disabled }), onClick: onClick, "rls-theme": rlsTheme, children: jsx("div", { className: "rls-checkbox__component" }) }));
1411
+ return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-checkbox', { checked, disabled }), onClick: onClick, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-checkbox__component" }) }));
66
1412
  }
67
1413
  function RlsCheckBoxControl({ formControl, disabled, rlsTheme }) {
68
- return (jsx(RlsCheckBox, { checked: formControl.state || false, disabled: disabled, onClick: () => {
69
- formControl.setState(!formControl.state);
1414
+ return (jsxRuntimeExports.jsx(RlsCheckBox, { checked: !!formControl.value, disabled: disabled, onClick: () => {
1415
+ formControl.setValue(!formControl.value);
70
1416
  }, rlsTheme: rlsTheme }));
71
1417
  }
72
1418
 
73
1419
  function RlsInput({ children, disabled, formControl, placeholder, type, value, onValue }) {
74
1420
  const [focused, setFocused] = useState(false);
75
1421
  function onChange(event) {
76
- setState(type === 'number' ? +event.target.value : event.target.value);
1422
+ setValue(type === 'number' ? +event.target.value : event.target.value);
77
1423
  }
78
- function setState(value) {
79
- formControl?.setState(value);
1424
+ function setValue(value) {
1425
+ formControl?.setValue(value);
80
1426
  if (onValue) {
81
1427
  onValue(value);
82
1428
  }
@@ -86,21 +1432,18 @@ function RlsInput({ children, disabled, formControl, placeholder, type, value, o
86
1432
  setFocused(true);
87
1433
  }
88
1434
  function onBlur() {
89
- if (formControl && !formControl.touched) {
90
- formControl.touch();
91
- }
92
1435
  formControl?.blur();
93
1436
  setFocused(false);
94
1437
  }
95
- return (jsxs("div", { className: renderClassStatus('rls-input', {
1438
+ return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-input', {
96
1439
  focused: formControl?.focused || focused,
97
1440
  disabled: formControl?.disabled || disabled
98
- }), children: [jsx("input", { ref: formControl?.elementRef, className: "rls-input__component", autoComplete: "off", type: type || 'text', placeholder: placeholder, disabled: formControl?.disabled || disabled, onFocus: onFocus, onBlur: onBlur, onChange: onChange, value: formControl?.state || value || '' }), jsx("span", { className: "rls-input__value", children: children })] }));
1441
+ }), children: [jsxRuntimeExports.jsx("input", { ref: formControl?.elementRef, className: "rls-input__component", autoComplete: "off", type: type || 'text', placeholder: placeholder, disabled: formControl?.disabled || disabled, onFocus: onFocus, onBlur: onBlur, onChange: onChange, value: formControl?.value || value || '' }), jsxRuntimeExports.jsx("span", { className: "rls-input__value", children: children })] }));
99
1442
  }
100
1443
 
101
1444
  function RlsInputMoney({ decimals, disabled, formControl, placeholder, symbol, value, onValue }) {
102
1445
  const [valueInput, setValueInput] = useState(value || 0);
103
- function onMoney(value) {
1446
+ function onChange(value) {
104
1447
  if (!formControl) {
105
1448
  setValueInput(value);
106
1449
  }
@@ -108,12 +1451,12 @@ function RlsInputMoney({ decimals, disabled, formControl, placeholder, symbol, v
108
1451
  onValue(value);
109
1452
  }
110
1453
  }
111
- return (jsx("div", { className: "rls-input-money", children: jsx(RlsInput, { formControl: formControl, type: "number", value: value, disabled: disabled, placeholder: placeholder, onValue: onMoney, children: jsx(RlsAmount, { value: formControl?.state || value || valueInput, symbol: symbol, decimals: decimals }) }) }));
1454
+ return (jsxRuntimeExports.jsx("div", { className: "rls-input-money", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "number", value: value, disabled: disabled, placeholder: placeholder, onValue: onChange, children: jsxRuntimeExports.jsx(RlsAmount, { value: formControl?.value || value || valueInput, symbol: symbol, decimals: decimals }) }) }));
112
1455
  }
113
1456
 
114
1457
  function RlsInputNumber({ disabled, formControl, placeholder, value, onValue }) {
115
1458
  const [valueInput, setValueInput] = useState(value || 0);
116
- function onNumber(value) {
1459
+ function onChange(value) {
117
1460
  if (!formControl) {
118
1461
  setValueInput(value);
119
1462
  }
@@ -121,13 +1464,13 @@ function RlsInputNumber({ disabled, formControl, placeholder, value, onValue })
121
1464
  onValue(value);
122
1465
  }
123
1466
  }
124
- return (jsx("div", { className: "rls-input-number", children: jsx(RlsInput, { formControl: formControl, type: "number", value: value, disabled: disabled, placeholder: placeholder, onValue: onNumber, children: formControl?.state || value || valueInput }) }));
1467
+ return (jsxRuntimeExports.jsx("div", { className: "rls-input-number", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "number", value: value, disabled: disabled, placeholder: placeholder, onValue: onChange, children: formControl?.value || value || valueInput }) }));
125
1468
  }
126
1469
 
127
1470
  function RlsInputPassword({ disabled, formControl, placeholder, type, onValue }) {
128
1471
  const [focused, setFocused] = useState(false);
129
1472
  function onChange(event) {
130
- formControl?.setState(event.target.value);
1473
+ formControl?.setValue(event.target.value);
131
1474
  if (onValue) {
132
1475
  onValue(event.target.value);
133
1476
  }
@@ -137,21 +1480,22 @@ function RlsInputPassword({ disabled, formControl, placeholder, type, onValue })
137
1480
  setFocused(true);
138
1481
  }
139
1482
  function onBlur() {
140
- if (formControl && !formControl.touched) {
141
- formControl.touch();
142
- }
143
1483
  formControl?.blur();
144
1484
  setFocused(false);
145
1485
  }
146
- return (jsx("div", { className: renderClassStatus('rls-input-password', {
1486
+ return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-input-password', {
147
1487
  focused: formControl?.focused || focused,
148
1488
  disabled
149
- }), children: jsx("input", { className: "rls-input-password__component", autoComplete: "off", type: type || 'password', placeholder: placeholder, disabled: disabled, onFocus: onFocus, onBlur: onBlur, onChange: onChange }) }));
1489
+ }), children: jsxRuntimeExports.jsx("input", { className: "rls-input-password__component", autoComplete: "off", type: type || 'password', placeholder: placeholder, disabled: disabled, onFocus: onFocus, onBlur: onBlur, onChange: onChange }) }));
1490
+ }
1491
+
1492
+ function RlsInputSearch({ formControl, placeholder, onSearch }) {
1493
+ return (jsxRuntimeExports.jsxs("div", { className: "rls-input-search", children: [jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, placeholder: placeholder }), onSearch && jsxRuntimeExports.jsx(RlsButtonAction, { icon: "search", onClick: onSearch })] }));
150
1494
  }
151
1495
 
152
1496
  function RlsInputText({ disabled, formControl, placeholder, value, onValue }) {
153
1497
  const [valueInput, setValueInput] = useState(value || '');
154
- function onText(value) {
1498
+ function onChange(value) {
155
1499
  if (!formControl) {
156
1500
  setValueInput(value);
157
1501
  }
@@ -159,60 +1503,56 @@ function RlsInputText({ disabled, formControl, placeholder, value, onValue }) {
159
1503
  onValue(value);
160
1504
  }
161
1505
  }
162
- return (jsx("div", { className: "rls-input-text", children: jsx(RlsInput, { formControl: formControl, type: "text", value: value, disabled: disabled, placeholder: placeholder, onValue: onText, children: formControl?.state || value || valueInput }) }));
1506
+ return (jsxRuntimeExports.jsx("div", { className: "rls-input-text", children: jsxRuntimeExports.jsx(RlsInput, { formControl: formControl, type: "text", value: value, disabled: disabled, placeholder: placeholder, onValue: onChange, children: formControl?.value || value || valueInput }) }));
163
1507
  }
164
1508
 
165
1509
  function RlsLabel({ children, rlsTheme }) {
166
- return (jsx("label", { className: "rls-label", "rls-theme": rlsTheme, children: children }));
1510
+ return (jsxRuntimeExports.jsx("label", { className: "rls-label", "rls-theme": rlsTheme, children: children }));
167
1511
  }
168
1512
 
169
1513
  function RlsMessageIcon({ icon, children, rlsTheme }) {
170
- return (jsxs("div", { className: "rls-message-icon", "rls-theme": rlsTheme, children: [icon && jsx(RlsIcon, { value: icon }), jsx("span", { className: "truncate", children: children })] }));
1514
+ return (jsxRuntimeExports.jsxs("div", { className: "rls-message-icon", "rls-theme": rlsTheme, children: [icon && jsxRuntimeExports.jsx(RlsIcon, { value: icon }), jsxRuntimeExports.jsx("span", { className: "truncate", children: children })] }));
171
1515
  }
172
1516
 
173
1517
  function RlsPoster({ children, rlsTheme }) {
174
- return (jsx("div", { className: "rls-poster", "rls-theme": rlsTheme, children: children }));
1518
+ return (jsxRuntimeExports.jsx("div", { className: "rls-poster", "rls-theme": rlsTheme, children: children }));
175
1519
  }
176
1520
 
177
1521
  function RlsProgressBar({ indeterminate, percentage, rlsTheme }) {
178
- return (jsx("div", { className: renderClassStatus('rls-progress-bar', { indeterminate }), "rls-theme": rlsTheme, children: jsx("div", { className: "rls-progress-bar__component", style: { width: `${percentage || 0}%` } }) }));
1522
+ return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-progress-bar', { indeterminate }), "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-progress-bar__component", style: { width: `${percentage || 0}%` } }) }));
179
1523
  }
180
1524
 
181
1525
  function RlsProgressCircular({ rlsTheme }) {
182
- return (jsx("div", { className: "rls-progress-circular", "rls-theme": rlsTheme, children: jsx("svg", { className: "rls-progress-circular__svg", viewBox: "0 0 36 36", children: jsx("circle", { className: "rls-progress-circular__circle", cx: "18", cy: "18", r: "12" }) }) }));
1526
+ return (jsxRuntimeExports.jsx("div", { className: "rls-progress-circular", "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("svg", { className: "rls-progress-circular__svg", viewBox: "0 0 36 36", children: jsxRuntimeExports.jsx("circle", { className: "rls-progress-circular__circle", cx: "18", cy: "18", r: "12" }) }) }));
183
1527
  }
184
1528
 
185
1529
  function RlsRadioButton({ checked, disabled, rlsTheme, onClick }) {
186
- return (jsx("div", { className: renderClassStatus('rls-radiobutton', { checked, disabled }), onClick: onClick, "rls-theme": rlsTheme, children: jsx("div", { className: "rls-radiobutton__component" }) }));
187
- }
188
-
189
- function RlsSearchInput({ formControl, placeholder, onSearch }) {
190
- return (jsxs("div", { className: "rls-search-input", children: [jsx(RlsInput, { formControl: formControl, placeholder: placeholder }), onSearch && jsx(RlsButtonAction, { icon: "search", onClick: onSearch })] }));
1530
+ return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-radiobutton', { checked, disabled }), onClick: onClick, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-radiobutton__component" }) }));
191
1531
  }
192
1532
 
193
1533
  function RlsSkeleton({ rlsTheme }) {
194
- return jsx("div", { className: "rls-skeleton", "rls-theme": rlsTheme });
1534
+ return jsxRuntimeExports.jsx("div", { className: "rls-skeleton", "rls-theme": rlsTheme });
195
1535
  }
196
1536
 
197
1537
  function RlsSkeletonText({ active, children, rlsTheme }) {
198
- return (jsx("div", { className: renderClassStatus('rls-skeleton-text', { active }), "rls-theme": rlsTheme, children: jsx("span", { className: "rls-skeleton-text__value", children: children }) }));
1538
+ return (jsxRuntimeExports.jsx("div", { className: "rls-skeleton-text", "rls-theme": rlsTheme, children: active ? (jsxRuntimeExports.jsx(RlsSkeleton, {})) : (jsxRuntimeExports.jsx("span", { className: "rls-skeleton-text__value", children: children })) }));
199
1539
  }
200
1540
 
201
1541
  function RlsSwitch({ checked, disabled, rlsTheme, onClick }) {
202
- return (jsx("div", { className: renderClassStatus('rls-switch', { checked, disabled }), onClick: onClick, "rls-theme": rlsTheme, children: jsxs("div", { className: "rls-switch__component", children: [jsx("div", { className: "rls-switch__component__element" }), jsx("div", { className: "rls-switch__component__bar" })] }) }));
1542
+ return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-switch', { checked, disabled }), onClick: onClick, "rls-theme": rlsTheme, children: jsxRuntimeExports.jsxs("div", { className: "rls-switch__component", children: [jsxRuntimeExports.jsx("div", { className: "rls-switch__component__element" }), jsxRuntimeExports.jsx("div", { className: "rls-switch__component__bar" })] }) }));
203
1543
  }
204
1544
  function RlsSwitchControl({ formControl, disabled, rlsTheme }) {
205
- return (jsx(RlsSwitch, { checked: formControl.state || false, disabled: disabled, onClick: () => {
206
- formControl.setState(!formControl.state);
1545
+ return (jsxRuntimeExports.jsx(RlsSwitch, { checked: formControl.value || false, disabled: disabled, onClick: () => {
1546
+ formControl.setValue(!formControl.value);
207
1547
  }, rlsTheme: rlsTheme }));
208
1548
  }
209
1549
 
210
1550
  function RlsBallot({ bordered, children, img, initials, skeleton, subtitle, rlsTheme }) {
211
- return (jsxs("div", { className: renderClassStatus('rls-ballot', { bordered, skeleton }), "rls-theme": rlsTheme, children: [(img || initials) && (jsxs(RlsAvatar, { skeleton: skeleton, children: [img && jsx("img", { src: img }), initials && jsx("span", { children: initials })] })), jsxs("div", { className: "rls-ballot__component", children: [jsx("label", { className: "rls-ballot__title", children: jsx(RlsSkeletonText, { active: skeleton, children: children }) }), subtitle && (jsx("label", { className: "rls-ballot__subtitle", children: jsx(RlsSkeletonText, { active: skeleton, children: subtitle }) }))] })] }));
1551
+ return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-ballot', { bordered, skeleton }), "rls-theme": rlsTheme, children: [(img || initials) && (jsxRuntimeExports.jsxs(RlsAvatar, { skeleton: skeleton, children: [img && jsxRuntimeExports.jsx("img", { src: img }), initials && jsxRuntimeExports.jsx("span", { children: initials })] })), jsxRuntimeExports.jsxs("div", { className: "rls-ballot__component", children: [jsxRuntimeExports.jsx("label", { className: "rls-ballot__title", children: jsxRuntimeExports.jsx(RlsSkeletonText, { active: skeleton, children: children }) }), subtitle && (jsxRuntimeExports.jsx("label", { className: "rls-ballot__subtitle", children: jsxRuntimeExports.jsx(RlsSkeletonText, { active: skeleton, children: subtitle }) }))] })] }));
212
1552
  }
213
1553
 
214
1554
  function RlsButtonProgress({ icon, disabled, onClick, progressing, rlsTheme }) {
215
- return (jsxs("div", { className: renderClassStatus('rls-button-progress', { progressing }), "rls-theme": rlsTheme, children: [!progressing && (jsx(RlsButtonAction, { icon: icon, onClick: onClick, disabled: disabled })), progressing && jsx(RlsProgressCircular, {})] }));
1555
+ return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-button-progress', { progressing }), "rls-theme": rlsTheme, children: [!progressing && (jsxRuntimeExports.jsx(RlsButtonAction, { icon: icon, onClick: onClick, disabled: disabled })), progressing && jsxRuntimeExports.jsx(RlsProgressCircular, {})] }));
216
1556
  }
217
1557
 
218
1558
  function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsTheme }) {
@@ -241,30 +1581,30 @@ function RlsButtonToggle({ onAction, options, type, automatic, disabled, rlsThem
241
1581
  onAction(action.value);
242
1582
  }
243
1583
  }
244
- return (jsxs("div", { className: "rls-button-toggle", ref: componentRef, "rls-theme": rlsTheme, children: [jsxs("div", { className: "rls-button-toggle__content", children: [action && (jsx("div", { className: "rls-button-toggle__action", children: jsx(RlsButton, { disabled: disabled, type: type, onClick: () => onAction(action.value), children: action.label }) })), jsx("div", { className: "rls-button-toggle__icon", children: jsx(RlsButton, { type: type, prefixIcon: "arrow-ios-down", disabled: disabled, onClick: onClickMenu }) })] }), jsx("div", { className: renderClassStatus('rls-button-toggle__list', {
1584
+ return (jsxRuntimeExports.jsxs("div", { className: "rls-button-toggle", ref: componentRef, "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-button-toggle__content", children: [action && (jsxRuntimeExports.jsx("div", { className: "rls-button-toggle__action", children: jsxRuntimeExports.jsx(RlsButton, { disabled: disabled, type: type, onClick: () => onAction(action.value), children: action.label }) })), jsxRuntimeExports.jsx("div", { className: "rls-button-toggle__icon", children: jsxRuntimeExports.jsx(RlsButton, { type: type, prefixIcon: "arrow-ios-down", disabled: disabled, onClick: onClickMenu }) })] }), jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-button-toggle__list', {
245
1585
  visible,
246
1586
  hide: !visible
247
- }), children: jsx("ul", { children: options.map((action, index) => (jsx("li", { className: "truncate", onClick: () => onSelectAction(action), children: action.label }, index))) }) })] }));
1587
+ }), children: jsxRuntimeExports.jsx("ul", { children: options.map((action, index) => (jsxRuntimeExports.jsx("li", { className: "truncate", onClick: () => onSelectAction(action), children: action.label }, index))) }) })] }));
248
1588
  }
249
1589
 
250
1590
  function RlsMessageFormError({ className, formControl }) {
251
- return (jsx(Fragment, { children: formControl?.wrong && (jsx("div", { className: className, children: jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl?.error?.message }) })) }));
1591
+ return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: formControl?.wrong && (jsxRuntimeExports.jsx("div", { className: className, children: jsxRuntimeExports.jsx(RlsMessageIcon, { icon: "alert-triangle", rlsTheme: "danger", children: formControl?.error?.message }) })) }));
252
1592
  }
253
1593
 
254
1594
  function RlsFieldMoney({ children, decimals, disabled, formControl, placeholder, symbol, rlsTheme, value, onValue }) {
255
- return (jsxs("div", { className: renderClassStatus('rls-field-box', {
1595
+ return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-box', {
256
1596
  focused: formControl?.focused,
257
1597
  error: formControl?.wrong,
258
1598
  disabled: formControl?.disabled || disabled
259
- }, '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 }) }) }), jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
1599
+ }, 'rls-field-money'), "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsInputMoney, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, symbol: symbol, decimals: decimals, onValue: onValue }) }) }), jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
260
1600
  }
261
1601
 
262
1602
  function RlsFieldNumber({ children, disabled, formControl, placeholder, rlsTheme, value, onValue }) {
263
- return (jsxs("div", { className: renderClassStatus('rls-field-box', {
1603
+ return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-box', {
264
1604
  focused: formControl?.focused,
265
1605
  error: formControl?.wrong,
266
1606
  disabled: formControl?.disabled || disabled
267
- }, '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 }) }) }), jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
1607
+ }, 'rls-field-number'), "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsInputNumber, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, onValue: onValue }) }) }), jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
268
1608
  }
269
1609
 
270
1610
  function RlsFieldPassword({ children, disabled, formControl, placeholder, rlsTheme }) {
@@ -272,770 +1612,133 @@ function RlsFieldPassword({ children, disabled, formControl, placeholder, rlsThe
272
1612
  function onToggleInput() {
273
1613
  setPassword(!password);
274
1614
  }
275
- return (jsxs("div", { className: renderClassStatus(' rls-field-box', {
1615
+ return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus(' rls-field-box', {
276
1616
  focused: formControl?.focused,
277
1617
  error: formControl?.wrong,
278
1618
  disabled: formControl?.disabled || disabled
279
- }, '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 })] }) }), jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
1619
+ }, 'rls-field-password'), "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx(RlsInputPassword, { formControl: formControl, disabled: disabled, placeholder: placeholder, type: password ? 'password' : 'text' }), jsxRuntimeExports.jsx(RlsButtonAction, { icon: password ? 'eye' : 'eye-off', onClick: onToggleInput })] }) }), jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
280
1620
  }
281
1621
 
282
1622
  function RlsFieldText({ children, disabled, formControl, placeholder, rlsTheme, value, onValue }) {
283
- return (jsxs("div", { className: renderClassStatus('rls-field-box', {
1623
+ return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-box', {
284
1624
  focused: formControl?.focused,
285
1625
  error: formControl?.wrong,
286
1626
  disabled: formControl?.disabled || disabled
287
- }, '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 }) }) }), jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
1627
+ }, 'rls-field-text'), "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsx("div", { className: "rls-field-box__body", children: jsxRuntimeExports.jsx(RlsInputText, { formControl: formControl, value: value, disabled: disabled, placeholder: placeholder, onValue: onValue }) }) }), jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }));
288
1628
  }
289
1629
 
290
1630
  function RlsLabelCheckBox({ children, disabled, extended, formControl, rlsTheme }) {
291
- const [checked, setChecked] = useState(formControl?.value || false);
1631
+ const [checked, setChecked] = useState(!!formControl?.value);
292
1632
  useEffect(() => {
293
- setChecked(formControl?.state || false);
294
- }, [formControl?.state]);
1633
+ setChecked(!!formControl?.value);
1634
+ }, [formControl?.value]);
295
1635
  function onToggle() {
296
1636
  if (formControl) {
297
- formControl?.setState(!formControl.state);
1637
+ formControl?.setValue(!formControl.value);
298
1638
  }
299
1639
  else {
300
1640
  setChecked(!checked);
301
1641
  }
302
1642
  }
303
- return (jsxs("div", { className: renderClassStatus('rls-label-checkbox', {
1643
+ return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-label-checkbox', {
304
1644
  disabled,
305
1645
  extended
306
- }), "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 })] }));
1646
+ }), "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-label-checkbox__component", onClick: onToggle, children: jsxRuntimeExports.jsx(RlsCheckBox, { checked: checked, disabled: disabled }) }), jsxRuntimeExports.jsx("label", { className: "rls-label-checkbox__text", children: children })] }));
307
1647
  }
308
1648
 
309
1649
  function RlsLabelRadioButton({ children, disabled, extended, formControl, rlsTheme, value }) {
310
- const [checked, setChecked] = useState(formControl?.state || false);
1650
+ const [checked, setChecked] = useState(formControl?.value === value);
311
1651
  useEffect(() => {
312
- setChecked(formControl?.state === value);
313
- }, [formControl?.state]);
1652
+ setChecked(formControl?.value === value);
1653
+ }, [formControl?.value]);
314
1654
  function onSelect() {
315
1655
  if (formControl) {
316
- formControl?.setState(value);
1656
+ formControl?.setValue(value);
317
1657
  }
318
1658
  }
319
- return (jsxs("div", { className: renderClassStatus('rls-label-radiobutton', {
1659
+ return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-label-radiobutton', {
320
1660
  disabled,
321
1661
  extended
322
- }), "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 })] }));
1662
+ }), "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-label-radiobutton__component", onClick: onSelect, children: jsxRuntimeExports.jsx(RlsRadioButton, { checked: checked, disabled: disabled }) }), jsxRuntimeExports.jsx("label", { className: "rls-label-radiobutton__text", children: children })] }));
323
1663
  }
324
1664
 
325
1665
  function RlsLabelSwitch({ children, disabled, extended, formControl, rlsTheme }) {
326
- const [checked, setChecked] = useState(formControl?.value || false);
1666
+ const [checked, setChecked] = useState(!!formControl?.value);
327
1667
  useEffect(() => {
328
- setChecked(formControl?.state || false);
329
- }, [formControl?.state]);
1668
+ setChecked(!!formControl?.value);
1669
+ }, [formControl?.value]);
330
1670
  function onToggle() {
331
1671
  if (formControl) {
332
- formControl?.setState(!formControl.state);
1672
+ formControl?.setValue(!formControl.value);
333
1673
  }
334
1674
  else {
335
1675
  setChecked(!checked);
336
1676
  }
337
1677
  }
338
- 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 })] }));
1678
+ return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-label-switch', { disabled, extended }), "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-label-switch__component", onClick: onToggle, children: jsxRuntimeExports.jsx(RlsSwitch, { checked: checked, disabled: disabled }) }), jsxRuntimeExports.jsx("label", { className: "rls-label-switch__text", children: children })] }));
339
1679
  }
340
1680
 
341
- const DEFAULT_COUNT_ELEMENT = 20;
342
- const MIN_NUMBER_PAGE = 1;
343
- const FIRST_PAGE = 0;
344
- const DEFAULT_MAX_VISIBLE = 4;
345
- function RlsPagination({ elements, count: defaultCount, filter, onElements, onPagination }) {
346
- const count = defaultCount || DEFAULT_COUNT_ELEMENT;
347
- const [collection, setCollection] = useState([]);
348
- const [index, setIndex] = useState(0);
349
- const [maxPage, setMaxPage] = useState(calculateMaxPage(elements, count));
350
- const [paginations, setPaginations] = useState([]);
351
- const [currentPagination, setCurrentPagination] = useState();
352
- const [description, setDescription] = useState('');
353
- const [firstPage, setFirstPage] = useState(true);
354
- const [lastPage, setLastPage] = useState(false);
355
- useEffect(() => {
356
- refreshFromElements(elements);
357
- }, [elements]);
1681
+ function RlsPagination({ suggestions, count, filter, onPagination }) {
1682
+ const controller = useRef(new PaginationController({ suggestions, count }));
1683
+ const [template, setTemplate] = useState(controller.current.template);
358
1684
  useEffect(() => {
359
- const isFirstPage = currentPagination?.value === FIRST_PAGE;
360
- const isLastPage = currentPagination?.value === maxPage - 1;
361
- setFirstPage(isFirstPage);
362
- setLastPage(isLastPage);
363
- if (onPagination) {
364
- onPagination({ firstPage: isFirstPage, lastPage: isLastPage });
365
- }
366
- }, [currentPagination]);
1685
+ controller.current = new PaginationController({
1686
+ suggestions,
1687
+ count,
1688
+ position: template.currentPage.value
1689
+ });
1690
+ onPagination &&
1691
+ onPagination({
1692
+ firstPage: controller.current.template.firstPage,
1693
+ lastPage: controller.current.template.lastPage,
1694
+ suggestions: controller.current.page.collection
1695
+ });
1696
+ setTemplate(controller.current.template);
1697
+ }, [suggestions, count]);
367
1698
  useEffect(() => {
368
- refreshFromFilter(filter);
1699
+ refreshPagination(controller.current.filtrable(filter));
369
1700
  }, [filter]);
370
- function onChangeElements(elements) {
371
- if (onElements) {
372
- onElements(elements);
373
- }
374
- }
375
- function calculateMaxPage(collection, count) {
376
- return collection.length ? Math.ceil(collection.length / count) : 0;
1701
+ function refreshPagination(pagination) {
1702
+ if (pagination) {
1703
+ const { page, template } = pagination;
1704
+ const { firstPage, lastPage } = template;
1705
+ onPagination &&
1706
+ onPagination({
1707
+ firstPage,
1708
+ lastPage,
1709
+ suggestions: page.collection
1710
+ });
1711
+ setTemplate(template);
1712
+ }
1713
+ }
1714
+ function goToPagination(page) {
1715
+ refreshPagination(controller.current.goToPage(page));
377
1716
  }
378
- function onSelectPagination(pagination) {
379
- const { value } = pagination;
380
- pagination.active = true;
381
- setIndex(value);
382
- setCurrentPagination(pagination);
383
- refreshFromChanged(clonePage({ index: value }));
384
- }
385
- function goPagination(pagination) {
386
- if (currentPagination) {
387
- currentPagination.active = false;
388
- }
389
- onSelectPagination(pagination);
1717
+ function goFirstPagination() {
1718
+ refreshPagination(controller.current.goFirstPage());
390
1719
  }
391
1720
  function goPreviousPagination() {
392
- if (currentPagination) {
393
- const { prev, value } = currentPagination;
394
- if (prev) {
395
- onSelectPagination(prev);
396
- currentPagination.active = false;
397
- }
398
- else {
399
- const prevIndex = value - MIN_NUMBER_PAGE;
400
- if (prevIndex >= FIRST_PAGE) {
401
- refreshFromChanged(clonePageFromIndex(prevIndex));
402
- }
403
- }
404
- }
405
- }
406
- function goFirstPagination() {
407
- if (collection.length) {
408
- refreshFromChanged(clonePageFromIndex(FIRST_PAGE));
409
- }
1721
+ refreshPagination(controller.current.goPreviousPage());
410
1722
  }
411
1723
  function goNextPagination() {
412
- if (currentPagination) {
413
- const { next, value } = currentPagination;
414
- if (next) {
415
- onSelectPagination(next);
416
- currentPagination.active = false;
417
- }
418
- else {
419
- const nextIndex = value + 1;
420
- if (nextIndex <= maxPage) {
421
- refreshFromChanged(clonePageFromIndex(nextIndex));
422
- }
423
- }
424
- }
1724
+ refreshPagination(controller.current.goNextPage());
425
1725
  }
426
1726
  function goLastPagination() {
427
- if (collection.length) {
428
- refreshFromChanged(clonePageFromIndex(maxPage - MIN_NUMBER_PAGE));
429
- }
430
- }
431
- function createPageCollection(props) {
432
- const { collection, count, index } = props;
433
- if (collection.length) {
434
- const finish = (index + MIN_NUMBER_PAGE) * count;
435
- const start = index * count;
436
- return collection.slice(start, finish);
437
- }
438
- return [];
439
- }
440
- function refreshFromElements(elements) {
441
- elements.length
442
- ? refreshFromChanged(refreshPage(elements, filter))
443
- : rebootPagination();
444
- }
445
- function refreshFromFilter(filter) {
446
- refreshFromChanged(refreshPage(elements, filter));
447
- }
448
- function refreshFromChanged(page) {
449
- refreshPaginations(page);
450
- refreshDescription(page);
451
- onChangeElements(createPageCollection(page));
452
- }
453
- function refreshCollection(elements, filter) {
454
- const collection = filter
455
- ? elements.filter((element) => hasPattern(JSON.stringify(element), filter))
456
- : elements;
457
- setCollection(collection);
458
- return collection;
459
- }
460
- function refreshMaxPage(collection, count) {
461
- const maxPage = calculateMaxPage(collection, count);
462
- setMaxPage(maxPage);
463
- return maxPage;
464
- }
465
- function refreshIndex(collection, currentMaxPage) {
466
- const maxPage = currentMaxPage || refreshMaxPage(collection, count);
467
- if (index < maxPage || index === FIRST_PAGE) {
468
- return index;
469
- }
470
- const newIndex = maxPage - 1;
471
- setIndex(newIndex);
472
- return newIndex;
473
- }
474
- function refreshDescription(page) {
475
- const { collection, count, index } = page;
476
- const totalCount = elements.length;
477
- const start = index * count + MIN_NUMBER_PAGE;
478
- let end = (index + MIN_NUMBER_PAGE) * count;
479
- if (end > collection.length) {
480
- end = collection.length;
481
- }
482
- setDescription(`${start} - ${end} de ${totalCount}`);
483
- }
484
- function refreshPaginations({ index, maxPage }) {
485
- let maxPageVisible = index + DEFAULT_MAX_VISIBLE;
486
- if (maxPageVisible > maxPage) {
487
- maxPageVisible = maxPage;
488
- }
489
- let minIndexPage = maxPageVisible - DEFAULT_MAX_VISIBLE;
490
- if (minIndexPage < 0) {
491
- minIndexPage = 0;
492
- }
493
- if (minIndexPage > index) {
494
- minIndexPage = index;
495
- }
496
- let prevPagination = undefined;
497
- const paginations = [];
498
- for (let i = minIndexPage; i < maxPageVisible; i++) {
499
- const pagination = createPagination(i, index);
500
- paginations.push(pagination);
501
- pagination.prev = prevPagination;
502
- if (prevPagination) {
503
- prevPagination.next = pagination;
504
- }
505
- prevPagination = pagination;
506
- }
507
- setPaginations(paginations);
508
- }
509
- function clonePage(pagePartial) {
510
- return {
511
- collection: pagePartial.collection || collection,
512
- index: typeof pagePartial.index === 'number' ? pagePartial.index : index,
513
- count: pagePartial.count || count,
514
- maxPage: typeof pagePartial.maxPage === 'number' ? pagePartial.maxPage : maxPage
515
- };
516
- }
517
- function clonePageFromIndex(index) {
518
- return clonePage({ index });
519
- }
520
- function refreshPage(elements, filter) {
521
- const collection = refreshCollection(elements, filter);
522
- const maxPage = refreshMaxPage(collection, count);
523
- const index = refreshIndex(collection, maxPage);
524
- return clonePage({ collection, index, maxPage });
525
- }
526
- function createPagination(value, index) {
527
- const active = value === index;
528
- const pagination = {
529
- label: (value + 1).toString(),
530
- value,
531
- active
532
- };
533
- if (active) {
534
- setCurrentPagination(pagination);
535
- }
536
- return pagination;
537
- }
538
- function rebootPagination() {
539
- setCollection([]);
540
- setMaxPage(0);
541
- setIndex(0);
542
- setPaginations([]);
543
- onChangeElements([]);
1727
+ refreshPagination(controller.current.goLastPage());
544
1728
  }
545
- 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) => {
546
- return (jsx("div", { className: renderClassStatus('rls-pagination__page', {
1729
+ return (jsxRuntimeExports.jsxs("div", { className: "rls-pagination", children: [jsxRuntimeExports.jsxs("div", { className: "rls-pagination__actions", children: [jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goFirstPagination, disabled: template.firstPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrowhead-left" }) }), jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goPreviousPagination, disabled: template.firstPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-left" }) })] }), jsxRuntimeExports.jsx("div", { className: "rls-pagination__pages", children: template.pages.map((page, index) => {
1730
+ return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-pagination__page', {
547
1731
  active: page.active
548
1732
  }), onClick: () => {
549
- goPagination(page);
1733
+ goToPagination(page);
550
1734
  }, children: page.label }, index));
551
- }) }), 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" }) })] })] }));
552
- }
553
-
554
- function dateIsOutRangeMin(props) {
555
- const { date, minDate } = props;
556
- return !!minDate && dateIsBefore(normalizeMinTime(minDate), date);
557
- }
558
- function dateIsOutRangeMax(props) {
559
- const { date, maxDate } = props;
560
- return !!maxDate && dateIsAfter(normalizeMaxTime(maxDate), date);
561
- }
562
- function dateOutRange(props) {
563
- return dateIsOutRangeMin(props) || dateIsOutRangeMax(props);
564
- }
565
- function checkDateRange(props) {
566
- const { date, maxDate, minDate } = props;
567
- return minDate && dateIsOutRangeMax(props)
568
- ? minDate
569
- : maxDate && dateIsOutRangeMax(props)
570
- ? maxDate
571
- : date;
572
- }
573
-
574
- const DAYS_WEEK = 7;
575
- const COUNT_YEAR_RANGE = 4;
576
-
577
- function createDayState(props, today, value) {
578
- const { date, day, month, year } = props;
579
- const dateValue = value && new Date(year, month, value);
580
- return {
581
- disabled: dayIsOutside(props, value || 0),
582
- focused: !!value && day === value,
583
- forbidden: !value,
584
- selected: !!dateValue && dateIsEqualsWeight(date, dateValue),
585
- today: !!dateValue && dateIsEqualsWeight(today, dateValue),
586
- value
587
- };
588
- }
589
- function createFirstWeek$1(props, date, today) {
590
- const days = [];
591
- let day = 1;
592
- for (let start = 0; start < date.getDay(); start++) {
593
- days.push(createDayState(props, today));
594
- }
595
- for (let end = date.getDay(); end < 7; end++) {
596
- days.push(createDayState(props, today, day));
597
- day++;
598
- }
599
- return { days };
600
- }
601
- function createDaysPending$1(props, today, days) {
602
- const daysPending = [];
603
- const length = 7 - days;
604
- for (let index = 0; index < length; index++) {
605
- daysPending.push(createDayState(props, today));
606
- }
607
- return daysPending;
608
- }
609
- function createNextWeeks$1(props, date, today) {
610
- const daysMonth = getDaysOfMonth(date.getFullYear(), date.getMonth());
611
- const weeks = [];
612
- let days = [];
613
- let countDays = 1;
614
- let day = DAYS_WEEK - date.getDay() + 1;
615
- do {
616
- days.push(createDayState(props, today, day));
617
- day++;
618
- countDays++;
619
- if (countDays > DAYS_WEEK) {
620
- weeks.push({ days });
621
- days = [];
622
- countDays = 1;
623
- }
624
- } while (day <= daysMonth);
625
- if (days.length && days.length < DAYS_WEEK) {
626
- weeks.push({
627
- days: [...days, ...createDaysPending$1(props, today, days.length)]
628
- });
629
- }
630
- return weeks;
631
- }
632
- function dayIsOutsideMin(props, day) {
633
- const { month, year, minDate } = props;
634
- return minDate
635
- ? getDateWeight(new Date(year, month, day)) < getDateWeight(minDate)
636
- : false;
637
- }
638
- function dayIsOutsideMax(props, day) {
639
- const { month, year, maxDate } = props;
640
- return maxDate
641
- ? getDateWeight(new Date(year, month, day)) > getDateWeight(maxDate)
642
- : false;
643
- }
644
- function dayIsOutside(props, day) {
645
- return dayIsOutsideMin(props, day) || dayIsOutsideMax(props, day);
646
- }
647
- function checkDayPicker(props) {
648
- const { day, maxDate, minDate } = props;
649
- return minDate && dayIsOutsideMin(props, day)
650
- ? minDate.getDate()
651
- : maxDate && dayIsOutsideMax(props, day)
652
- ? maxDate.getDate()
653
- : undefined;
654
- }
655
- function createDayPicker(props) {
656
- const date = new Date(props.year, props.month, 1);
657
- const today = new Date();
658
- const firstWeek = createFirstWeek$1(props, date, today);
659
- const nextWeeks = createNextWeeks$1(props, date, today);
660
- return [firstWeek, ...nextWeeks];
661
- }
662
-
663
- function dateIsSelected(base, date, day) {
664
- return (date.getFullYear() === base.getFullYear() &&
665
- date.getMonth() === base.getMonth() &&
666
- day === date.getDate());
667
- }
668
- function sourceIsSelected({ sourceDate }, base, day) {
669
- return dateIsSelected(base, sourceDate, day);
670
- }
671
- function rangeIsSelected({ range }, base, day) {
672
- return (dateIsSelected(base, range.minDate, day) ||
673
- dateIsSelected(base, range.maxDate, day));
674
- }
675
- function dayIsRange({ range }, base, day) {
676
- return dateIsBetween(range.minDate, range.maxDate, assignDayInDate(base, day));
677
- }
678
- function createDayRangeState(props, base, day) {
679
- return {
680
- disabled: dayRangeIsOutside(props, day || 0),
681
- end: day ? rangeIsSelected(props, base, day) : false,
682
- forbidden: !day,
683
- ranged: day ? dayIsRange(props, base, day) : false,
684
- source: day ? sourceIsSelected(props, base, day) : false,
685
- value: day
686
- };
687
- }
688
- function createFirstWeek(props, base) {
689
- const days = [];
690
- let day = 1;
691
- for (let start = 0; start < base.getDay(); start++) {
692
- days.push(createDayRangeState(props, base));
693
- }
694
- for (let end = base.getDay(); end < 7; end++) {
695
- days.push(createDayRangeState(props, base, day));
696
- day++;
697
- }
698
- return { days };
699
- }
700
- function createDaysPending(props, base, days) {
701
- const daysPending = [];
702
- const length = 7 - days;
703
- for (let index = 0; index < length; index++) {
704
- daysPending.push(createDayRangeState(props, base));
705
- }
706
- return daysPending;
707
- }
708
- function createNextWeeks(props, base) {
709
- const weeks = [];
710
- const { date } = props;
711
- const dayCount = getDaysOfMonth(date.getFullYear(), date.getMonth());
712
- let days = [];
713
- let countDays = 1;
714
- let day = DAYS_WEEK - base.getDay() + 1;
715
- do {
716
- days.push(createDayRangeState(props, date, day));
717
- day++;
718
- countDays++;
719
- if (countDays > 7) {
720
- weeks.push({ days });
721
- days = [];
722
- countDays = 1;
723
- }
724
- } while (day <= dayCount);
725
- if (days.length && days.length < DAYS_WEEK) {
726
- weeks.push({
727
- days: [...days, ...createDaysPending(props, base, days.length)]
728
- });
729
- }
730
- return weeks;
731
- }
732
- function dayRangeIsOutsideMin(props, day) {
733
- const { date, minDate } = props;
734
- return minDate
735
- ? getDateWeight(assignDayInDate(date, day)) < getDateWeight(minDate)
736
- : false;
737
- }
738
- function dayRangeIsOutsideMax(props, day) {
739
- const { date, maxDate } = props;
740
- return maxDate
741
- ? getDateWeight(assignDayInDate(date, day)) > getDateWeight(maxDate)
742
- : false;
743
- }
744
- function dayRangeIsOutside(props, day) {
745
- return dayRangeIsOutsideMin(props, day) || dayRangeIsOutsideMax(props, day);
746
- }
747
- function createDayRangePicker(props) {
748
- const date = new Date(props.date.getFullYear(), props.date.getMonth(), 1);
749
- const firstWeek = createFirstWeek(props, date);
750
- const nextWeeks = createNextWeeks(props, date);
751
- return [firstWeek, ...nextWeeks];
752
- }
753
-
754
- function createMonthState(props, value) {
755
- const { date, month, year } = props;
756
- return {
757
- disabled: monthIsOutside(props, value),
758
- focused: value === month,
759
- label: MONTH_NAMES()[value],
760
- selected: date.getFullYear() === year && value === date.getMonth(),
761
- value
762
- };
763
- }
764
- function monthIsOutsideMin(props, month) {
765
- const { year, minDate } = props;
766
- return minDate
767
- ? minDate.getFullYear() === year && month < minDate.getMonth()
768
- : false;
769
- }
770
- function monthIsOutsideMax(props, month) {
771
- const { year, maxDate } = props;
772
- return maxDate
773
- ? maxDate.getFullYear() === year && month > maxDate.getMonth()
774
- : false;
775
- }
776
- function monthIsOutside(props, month) {
777
- return monthIsOutsideMin(props, month) || monthIsOutsideMax(props, month);
778
- }
779
- function checkMonthPicker(props) {
780
- const { maxDate, minDate, month } = props;
781
- return minDate && monthIsOutsideMin(props, month)
782
- ? minDate.getMonth()
783
- : maxDate && monthIsOutsideMax(props, month)
784
- ? maxDate.getMonth()
785
- : undefined;
786
- }
787
- function createMonthPicker(props) {
788
- return [
789
- createMonthState(props, Month.January),
790
- createMonthState(props, Month.February),
791
- createMonthState(props, Month.March),
792
- createMonthState(props, Month.April),
793
- createMonthState(props, Month.May),
794
- createMonthState(props, Month.June),
795
- createMonthState(props, Month.July),
796
- createMonthState(props, Month.August),
797
- createMonthState(props, Month.September),
798
- createMonthState(props, Month.October),
799
- createMonthState(props, Month.November),
800
- createMonthState(props, Month.December)
801
- ];
802
- }
803
- function monthIsLimitMin(props) {
804
- const { month, date, minDate } = props;
805
- if (itIsDefined(month) && date) {
806
- const minYear = minDate ? minDate.getFullYear() : 0;
807
- const minMonth = minDate ? minDate.getMonth() : 0;
808
- return date.getFullYear() === minYear && month <= minMonth;
809
- }
810
- return false;
811
- }
812
- function monthIsLimitMax(props) {
813
- const { month, date, maxDate } = props;
814
- if (itIsDefined(month) && date) {
815
- const maxYear = maxDate ? maxDate.getFullYear() : 10000;
816
- const maxMonth = maxDate ? maxDate.getMonth() : 11;
817
- return date.getFullYear() === maxYear && month >= maxMonth;
818
- }
819
- return false;
820
- }
821
- function monthLimitTemplate(props) {
822
- return {
823
- limitNext: monthIsLimitMax(props),
824
- limitPrevious: monthIsLimitMin(props)
825
- };
826
- }
827
-
828
- var PickerListenerType;
829
- (function (PickerListenerType) {
830
- PickerListenerType["Select"] = "PickerSelect";
831
- PickerListenerType["Now"] = "PickerNow";
832
- PickerListenerType["Cancel"] = "PickerCancel";
833
- })(PickerListenerType || (PickerListenerType = {}));
834
-
835
- function createYear(props, value) {
836
- const { date, year } = props;
837
- return {
838
- disabled: !value,
839
- focused: value === year,
840
- selected: value === date.getFullYear(),
841
- value
842
- };
843
- }
844
- function yearIsOutlineMin(props) {
845
- const { year, minDate } = props;
846
- return minDate ? year < minDate.getFullYear() : false;
847
- }
848
- function yearIsOutlineMax(props) {
849
- const { year, maxDate } = props;
850
- return maxDate ? year > maxDate.getFullYear() : false;
851
- }
852
- function checkYearPicker(props) {
853
- const { maxDate, minDate } = props;
854
- return minDate && yearIsOutlineMin(props)
855
- ? minDate.getFullYear()
856
- : maxDate && yearIsOutlineMax(props)
857
- ? maxDate.getFullYear()
858
- : undefined;
859
- }
860
- function createYearPicker(props) {
861
- const { year, maxDate, minDate } = props;
862
- const prevYears = [];
863
- const nextYears = [];
864
- let minRange = year;
865
- let maxRange = year;
866
- const minYear = minDate?.getFullYear() || 0;
867
- const maxYear = maxDate?.getFullYear() || 10000;
868
- for (let index = 0; index < COUNT_YEAR_RANGE; index++) {
869
- const prevValue = year - COUNT_YEAR_RANGE + index;
870
- const nextValue = year + index + 1;
871
- const prevYear = prevValue >= minYear ? prevValue : undefined;
872
- const nextYear = nextValue <= maxYear ? nextValue : undefined;
873
- const prevState = createYear(props, prevYear);
874
- const nextState = createYear(props, nextYear);
875
- prevYears.push(prevState);
876
- nextYears.push(nextState);
877
- if (!!prevState.value && minRange > prevState.value) {
878
- minRange = prevState.value;
879
- }
880
- if (!!nextState.value && maxRange < nextState.value) {
881
- maxRange = nextState.value;
882
- }
883
- }
884
- const yearCenter = createYear(props, year);
885
- return {
886
- canPrevious: minYear < minRange,
887
- canNext: maxYear > maxRange,
888
- maxRange,
889
- minRange,
890
- years: [...prevYears, yearCenter, ...nextYears]
891
- };
892
- }
893
-
894
- function createEmptyStore() {
895
- return {
896
- coincidences: undefined,
897
- pattern: '',
898
- previous: null
899
- };
900
- }
901
- function searchForPattern(props) {
902
- const { pattern, store } = props;
903
- if (!store?.pattern) {
904
- return null;
905
- }
906
- let newStore = store;
907
- let search = false;
908
- while (!search && newStore) {
909
- search = hasPattern(pattern || '', newStore.pattern, true);
910
- if (!search) {
911
- newStore = newStore.previous;
912
- }
913
- }
914
- return newStore || createEmptyStore();
915
- }
916
- function createStoreAutocomplete(props) {
917
- const { pattern, suggestions, reboot } = props;
918
- if (!pattern) {
919
- return { collection: suggestions, store: createEmptyStore() };
920
- }
921
- const store = reboot ? createEmptyStore() : searchForPattern(props);
922
- const elements = store?.coincidences || suggestions;
923
- const coincidences = elements.filter((element) => element.hasCoincidence(pattern));
924
- return {
925
- collection: coincidences,
926
- store: {
927
- coincidences,
928
- pattern,
929
- previous: store
930
- }
931
- };
932
- }
933
-
934
- const classElement = '.rls-list-field__element';
935
- const POSITION_INITIAL = 0;
936
- function locationListIsBottom(contentElement, listElement) {
937
- if (contentElement && listElement) {
938
- const { top, height } = contentElement.getBoundingClientRect();
939
- const { clientHeight } = listElement;
940
- return top + height + clientHeight < window.innerHeight;
941
- }
942
- return true;
943
- }
944
- function navigationInputDown(props) {
945
- const { contentElement, listElement } = props;
946
- if (!locationListIsBottom(contentElement, listElement)) {
947
- return undefined;
948
- }
949
- const elements = listElement?.querySelectorAll(classElement);
950
- if (elements?.length) {
951
- elements.item(0).focus();
952
- setTimeout(() => {
953
- listElement?.scroll({ top: 0, behavior: 'smooth' });
954
- }, 100);
955
- }
956
- return POSITION_INITIAL;
957
- }
958
- function navigationInputUp(props) {
959
- const { contentElement, listElement } = props;
960
- if (locationListIsBottom(contentElement, listElement)) {
961
- return undefined;
962
- }
963
- const elements = listElement?.querySelectorAll(classElement);
964
- if (!elements?.length) {
965
- return POSITION_INITIAL;
966
- }
967
- const position = elements.length - 1;
968
- const element = elements.item(position);
969
- element?.focus();
970
- setTimeout(() => {
971
- listElement?.scroll({
972
- top: element?.offsetTop + element?.offsetLeft,
973
- behavior: 'smooth'
974
- });
975
- }, 100);
976
- return position;
977
- }
978
- function navigationElementDown(props) {
979
- const { contentElement, inputElement, listElement, position } = props;
980
- const elements = listElement?.querySelectorAll(classElement);
981
- const newPosition = position + 1;
982
- if (newPosition < (elements?.length || 0)) {
983
- elements?.item(newPosition)?.focus();
984
- return newPosition;
985
- }
986
- if (!locationListIsBottom(contentElement, listElement)) {
987
- inputElement?.focus();
988
- }
989
- return position;
990
- }
991
- function navigationElementUp(props) {
992
- const { contentElement, inputElement, listElement, position } = props;
993
- if (position > 0) {
994
- const elements = listElement?.querySelectorAll(classElement);
995
- const newPosition = position - 1;
996
- elements?.item(newPosition)?.focus();
997
- return newPosition;
998
- }
999
- if (locationListIsBottom(contentElement, listElement)) {
1000
- inputElement?.focus();
1001
- }
1002
- return POSITION_INITIAL;
1003
- }
1004
- function listNavigationInput(props) {
1005
- switch (props.event.code) {
1006
- case 'ArrowDown':
1007
- return navigationInputDown(props);
1008
- case 'ArrowUp':
1009
- return navigationInputUp(props);
1010
- default:
1011
- return undefined;
1012
- }
1013
- }
1014
- function listNavigationElement(props) {
1015
- const { event } = props;
1016
- switch (event.code) {
1017
- case 'ArrowDown':
1018
- return navigationElementDown(props);
1019
- case 'ArrowUp':
1020
- return navigationElementUp(props);
1021
- default:
1022
- return POSITION_INITIAL;
1023
- }
1024
- }
1025
-
1026
- class ListCollection {
1027
- constructor(value) {
1028
- this.value = value;
1029
- }
1030
- find(element) {
1031
- return this.value.find((current) => current.compareTo(element));
1032
- }
1735
+ }) }), jsxRuntimeExports.jsx("div", { className: "rls-pagination__description", children: template.description }), jsxRuntimeExports.jsxs("div", { className: "rls-pagination__actions", children: [jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goNextPagination, disabled: template.lastPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-right" }) }), jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goLastPagination, disabled: template.lastPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrowhead-right" }) })] })] }));
1033
1736
  }
1034
1737
 
1035
1738
  function RlsPickerDay({ date, disabled: disabledPicker, formControl, maxDate, month, minDate, onValue, rlsTheme, year }) {
1036
1739
  const currentDate = date || new Date(); // Initial date
1037
1740
  const [weeks, setWeeks] = useState([]);
1038
- const [value, setValue] = useState(formControl?.state || currentDate.getDate());
1741
+ const [value, setValue] = useState(formControl?.value || currentDate.getDate());
1039
1742
  useEffect(() => {
1040
1743
  const props = createPickerProps();
1041
1744
  const day = checkDayPicker(props);
@@ -1044,13 +1747,13 @@ function RlsPickerDay({ date, disabled: disabledPicker, formControl, maxDate, mo
1044
1747
  useEffect(() => {
1045
1748
  const day = checkDayPicker(createPickerProps());
1046
1749
  day
1047
- ? formControl?.setState(day)
1048
- : setValue(formControl?.state || currentDate.getDate());
1049
- }, [formControl?.state]);
1750
+ ? formControl?.setValue(day)
1751
+ : setValue(formControl?.value || currentDate.getDate());
1752
+ }, [formControl?.value]);
1050
1753
  function createPickerProps() {
1051
1754
  return {
1052
1755
  date: currentDate,
1053
- day: formControl?.state || value,
1756
+ day: formControl?.value || value,
1054
1757
  month: itIsDefined(month) ? month : currentDate.getMonth(),
1055
1758
  year: year || currentDate.getFullYear(),
1056
1759
  minDate,
@@ -1058,7 +1761,7 @@ function RlsPickerDay({ date, disabled: disabledPicker, formControl, maxDate, mo
1058
1761
  };
1059
1762
  }
1060
1763
  function setDayValue(value) {
1061
- formControl ? formControl.setState(value) : setValue(value);
1764
+ formControl ? formControl.setValue(value) : setValue(value);
1062
1765
  }
1063
1766
  function onChange(value) {
1064
1767
  setDayValue(value);
@@ -1066,19 +1769,18 @@ function RlsPickerDay({ date, disabled: disabledPicker, formControl, maxDate, mo
1066
1769
  onValue(value);
1067
1770
  }
1068
1771
  }
1069
- 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', {
1772
+ return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-day", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-day__header", children: DAY_LABELS().map((title, index) => (jsxRuntimeExports.jsx("label", { className: "rls-picker-day__label", children: title }, index))) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-day__component", children: weeks.map(({ days }, index) => (jsxRuntimeExports.jsx("div", { className: "rls-picker-day__week", children: days.map(({ value, disabled, focused, forbidden, selected, today }, index) => (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-picker-day__element', {
1070
1773
  disabled: disabled || disabledPicker,
1071
1774
  focused,
1072
1775
  forbidden,
1073
1776
  selected,
1074
1777
  today
1075
- }), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsx("span", { className: "rls-picker-day__element__span", children: value || '??' }) }, index))) }, index))) })] }));
1778
+ }), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-day__element__span", children: value || '??' }) }, index))) }, index))) })] }));
1076
1779
  }
1077
1780
 
1078
- const DATE_RANGE_FORMAT = '{dd}/{mx}/{aa}';
1079
-
1781
+ const FORMAT_RANGE = '{dd}/{mx}/{aa}';
1080
1782
  function RlsPickerDayRange({ date, disabled: disabledPicker, formControl, maxDate, minDate, rlsTheme }) {
1081
- const currentRange = formControl?.state || DateRange.now();
1783
+ const currentRange = formControl?.value || DateRange.now();
1082
1784
  const currentDate = normalizeMinTime(date || currentRange.minDate);
1083
1785
  const sourceDate = useRef(currentRange.minDate);
1084
1786
  const [weeks, setWeeks] = useState([]);
@@ -1099,21 +1801,21 @@ function RlsPickerDayRange({ date, disabled: disabledPicker, formControl, maxDat
1099
1801
  : new DateRange(date, sourceDate.current);
1100
1802
  sourceDate.current = date;
1101
1803
  setRange(range);
1102
- formControl?.setState(range);
1804
+ formControl?.setValue(range);
1103
1805
  }
1104
- 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', {
1806
+ return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-day-range", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-day-range__title", children: dateFormatTemplate(sourceDate.current, FORMAT_RANGE) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-day-range__header", children: DAY_LABELS().map((title, index) => (jsxRuntimeExports.jsx("label", { className: "rls-picker-day-range__label", children: title }, index))) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-day-range__component", children: weeks.map(({ days }, index) => (jsxRuntimeExports.jsx("div", { className: "rls-picker-day-range__week", children: days.map(({ disabled, end, forbidden, source, ranged, value }, index) => (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-picker-day-range__element', {
1105
1807
  disabled: disabled || disabledPicker,
1106
1808
  end,
1107
1809
  forbidden,
1108
1810
  ranged,
1109
1811
  source
1110
- }), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsx("span", { className: "rls-picker-day-range__element__span", children: value || '??' }) }, index))) }, index))) })] }));
1812
+ }), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-day-range__element__span", children: value || '??' }) }, index))) }, index))) })] }));
1111
1813
  }
1112
1814
 
1113
1815
  function RlsPickerMonth({ date, disabled: disabledPicker, formControl, maxDate, minDate, onValue, rlsTheme, year }) {
1114
1816
  const currentDate = date || new Date();
1115
1817
  const [months, setMonths] = useState([]);
1116
- const [value, setValue] = useState(formControl?.state || currentDate.getMonth());
1818
+ const [value, setValue] = useState(formControl?.value || currentDate.getMonth());
1117
1819
  useEffect(() => {
1118
1820
  const props = createPickerProps(); // MonthPickerProps
1119
1821
  const month = checkMonthPicker(props);
@@ -1122,20 +1824,20 @@ function RlsPickerMonth({ date, disabled: disabledPicker, formControl, maxDate,
1122
1824
  useEffect(() => {
1123
1825
  const month = checkMonthPicker(createPickerProps());
1124
1826
  itIsDefined(month)
1125
- ? formControl?.setState(month)
1126
- : setValue(formControl?.state || currentDate.getMonth());
1127
- }, [formControl?.state]);
1827
+ ? formControl?.setValue(month)
1828
+ : setValue(formControl?.value || currentDate.getMonth());
1829
+ }, [formControl?.value]);
1128
1830
  function createPickerProps() {
1129
1831
  return {
1130
1832
  date: currentDate,
1131
- month: itIsDefined(formControl?.state) ? formControl?.state : value,
1833
+ month: itIsDefined(formControl?.value) ? formControl?.value : value,
1132
1834
  year: year || currentDate.getFullYear(),
1133
1835
  minDate,
1134
1836
  maxDate
1135
1837
  };
1136
1838
  }
1137
1839
  function setMonthValue(value) {
1138
- formControl ? formControl.setState(value) : setValue(value);
1840
+ formControl ? formControl.setValue(value) : setValue(value);
1139
1841
  }
1140
1842
  function onChange(value) {
1141
1843
  setMonthValue(value);
@@ -1143,11 +1845,11 @@ function RlsPickerMonth({ date, disabled: disabledPicker, formControl, maxDate,
1143
1845
  onValue(value);
1144
1846
  }
1145
1847
  }
1146
- 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', {
1848
+ return (jsxRuntimeExports.jsx("div", { className: "rls-picker-month", "rls-theme": rlsTheme, children: months.map(({ label, value, disabled, focused, selected }, index) => (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-picker-month__component', {
1147
1849
  disabled: disabled || disabledPicker,
1148
1850
  focused,
1149
1851
  selected
1150
- }), onClick: !(disabled || disabledPicker) ? () => onChange(value) : undefined, children: jsx("span", { className: "rls-picker-month__span", children: label }) }, index))) }));
1852
+ }), onClick: !(disabled || disabledPicker) ? () => onChange(value) : undefined, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-month__span", children: label }) }, index))) }));
1151
1853
  }
1152
1854
 
1153
1855
  function RlsPickerMonthTitle({ monthControl, type, yearControl, date, disabled, maxDate, minDate, onClick }) {
@@ -1155,54 +1857,54 @@ function RlsPickerMonthTitle({ monthControl, type, yearControl, date, disabled,
1155
1857
  date,
1156
1858
  maxDate,
1157
1859
  minDate,
1158
- month: monthControl.state
1860
+ month: monthControl.value
1159
1861
  });
1160
- const monthName = MONTH_NAMES()[monthControl.state || 0];
1862
+ const monthName = MONTH_NAMES()[monthControl.value || 0];
1161
1863
  function onPreviousMonth() {
1162
- if (itIsDefined(monthControl.state) && itIsDefined(yearControl.state)) {
1163
- if (monthControl.state > Month.January) {
1164
- monthControl.setState(monthControl.state - 1);
1864
+ if (itIsDefined(monthControl.value) && itIsDefined(yearControl.value)) {
1865
+ if (monthControl.value > Month.January) {
1866
+ monthControl.setValue(monthControl.value - 1);
1165
1867
  }
1166
1868
  else {
1167
- monthControl.setState(Month.December);
1168
- yearControl.setState(yearControl.state - 1);
1869
+ monthControl.setValue(Month.December);
1870
+ yearControl.setValue(yearControl.value - 1);
1169
1871
  }
1170
1872
  }
1171
1873
  }
1172
1874
  function onPreviousYear() {
1173
- if (itIsDefined(yearControl.state)) {
1174
- yearControl.setState(yearControl.state - 1);
1875
+ if (itIsDefined(yearControl.value)) {
1876
+ yearControl.setValue(yearControl.value - 1);
1175
1877
  }
1176
1878
  }
1177
1879
  function onPrevious() {
1178
1880
  type === 'month' ? onPreviousMonth() : onPreviousYear();
1179
1881
  }
1180
1882
  function onNextMonth() {
1181
- if (itIsDefined(monthControl.state) && itIsDefined(yearControl.state)) {
1182
- if (monthControl.state < Month.December) {
1183
- monthControl.setState(monthControl.state + 1);
1883
+ if (itIsDefined(monthControl.value) && itIsDefined(yearControl.value)) {
1884
+ if (monthControl.value < Month.December) {
1885
+ monthControl.setValue(monthControl.value + 1);
1184
1886
  }
1185
1887
  else {
1186
- monthControl.setState(Month.January);
1187
- yearControl.setState(yearControl.state + 1);
1888
+ monthControl.setValue(Month.January);
1889
+ yearControl.setValue(yearControl.value + 1);
1188
1890
  }
1189
1891
  }
1190
1892
  }
1191
1893
  function onNextYear() {
1192
- if (itIsDefined(yearControl.state)) {
1193
- yearControl.setState(yearControl.state + 1);
1894
+ if (itIsDefined(yearControl.value)) {
1895
+ yearControl.setValue(yearControl.value + 1);
1194
1896
  }
1195
1897
  }
1196
1898
  function onNext() {
1197
1899
  type === 'month' ? onNextMonth() : onNextYear();
1198
1900
  }
1199
- 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 })] }));
1901
+ return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-month-title", children: [jsxRuntimeExports.jsx(RlsButtonAction, { icon: "arrow-ios-left", onClick: onPrevious, disabled: limitPrevious || disabled }), jsxRuntimeExports.jsx("span", { onClick: onClick, children: monthName }), jsxRuntimeExports.jsx(RlsButtonAction, { icon: "arrow-ios-right", onClick: onNext, disabled: limitNext || disabled })] }));
1200
1902
  }
1201
1903
 
1202
1904
  function RlsPickerYear({ date, disabled: disabledPicker, formControl, maxDate, minDate, onValue, rlsTheme }) {
1203
1905
  const currentDate = date || new Date();
1204
- const [value, setValue] = useState(formControl?.state || currentDate.getFullYear());
1205
- const [year, setYear] = useState(formControl?.state || currentDate.getFullYear());
1906
+ const [value, setValue] = useState(formControl?.value || currentDate.getFullYear());
1907
+ const [year, setYear] = useState(formControl?.value || currentDate.getFullYear());
1206
1908
  const [template, setTemplate] = useState(createYearPicker(createPickerProps()));
1207
1909
  useEffect(() => {
1208
1910
  const props = createPickerProps(); // YearPickerProps
@@ -1214,9 +1916,9 @@ function RlsPickerYear({ date, disabled: disabledPicker, formControl, maxDate, m
1214
1916
  useEffect(() => {
1215
1917
  const year = checkYearPicker(createPickerProps());
1216
1918
  itIsDefined(year)
1217
- ? formControl?.setState(year)
1218
- : setValue(formControl?.state || currentDate.getFullYear());
1219
- }, [formControl?.state]);
1919
+ ? formControl?.setValue(year)
1920
+ : setValue(formControl?.value || currentDate.getFullYear());
1921
+ }, [formControl?.value]);
1220
1922
  function createPickerProps() {
1221
1923
  return {
1222
1924
  date: currentDate,
@@ -1226,7 +1928,7 @@ function RlsPickerYear({ date, disabled: disabledPicker, formControl, maxDate, m
1226
1928
  };
1227
1929
  }
1228
1930
  function setYearValue(value) {
1229
- formControl ? formControl.setState(value) : setValue(value);
1931
+ formControl ? formControl.setValue(value) : setValue(value);
1230
1932
  setYear(value);
1231
1933
  }
1232
1934
  function onClickPrev() {
@@ -1241,19 +1943,19 @@ function RlsPickerYear({ date, disabled: disabledPicker, formControl, maxDate, m
1241
1943
  onValue(value);
1242
1944
  }
1243
1945
  }
1244
- 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', {
1946
+ return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-year", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-year__header", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-year__action rls-picker-year__action--prev", children: jsxRuntimeExports.jsx(RlsButtonAction, { icon: "arrow-ios-left", onClick: onClickPrev, disabled: !template.canPrevious || disabledPicker }) }), jsxRuntimeExports.jsxs("label", { className: "rls-title-bold", children: [template.minRange, " - ", template.maxRange] }), jsxRuntimeExports.jsx("div", { className: "rls-picker-year__action rls-picker-year__action--next", children: jsxRuntimeExports.jsx(RlsButtonAction, { icon: "arrow-ios-right", onClick: onClickNext, disabled: !template.canNext || disabledPicker }) })] }), jsxRuntimeExports.jsx("div", { className: "rls-picker-year__component", children: template.years.map(({ value, disabled, focused, selected }, index) => (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-picker-year__year', {
1245
1947
  disabled: disabled || disabledPicker,
1246
1948
  focused,
1247
1949
  selected
1248
- }), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsx("span", { className: "rls-picker-year__year__span rls-body1-medium", children: value || '????' }) }, index))) })] }));
1950
+ }), onClick: value && !disabledPicker ? () => onChange(value) : undefined, children: jsxRuntimeExports.jsx("span", { className: "rls-picker-year__year__span rls-body1-medium", children: value || '????' }) }, index))) })] }));
1249
1951
  }
1250
1952
 
1251
1953
  function RlsToolbar({ actions, children, subtitle }) {
1252
- 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))) }))] }));
1954
+ return (jsxRuntimeExports.jsxs("div", { className: "rls-toolbar", children: [jsxRuntimeExports.jsxs("div", { className: "rls-toolbar__description", children: [children && jsxRuntimeExports.jsx("label", { className: "rls-toolbar__title", children: children }), subtitle && (jsxRuntimeExports.jsx("label", { className: "rls-toolbar__subtitle smalltext-semibold", children: subtitle }))] }), actions && (jsxRuntimeExports.jsx("div", { className: "rls-toolbar__actions", children: actions.map((action, index) => (jsxRuntimeExports.jsx("div", { children: action }, index))) }))] }));
1253
1955
  }
1254
1956
 
1255
1957
  function RlsCard({ children, outline, rlsTheme }) {
1256
- return (jsx("div", { className: renderClassStatus('rls-card', { outline }), "rls-theme": rlsTheme, children: jsx("div", { className: "rls-card__content", children: children }) }));
1958
+ return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-card', { outline }), "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-card__content", children: children }) }));
1257
1959
  }
1258
1960
 
1259
1961
  const reactI18n = i18n({
@@ -1286,20 +1988,12 @@ class ConfirmationResult extends PartialSealed {
1286
1988
  }
1287
1989
  }
1288
1990
  function RlsConfirmation({ approved, content, reject, rlsTheme, subtitle, title, visible }) {
1289
- 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: () => {
1290
- if (approved.onClick) {
1291
- approved.onClick();
1292
- }
1293
- }, children: approved.label })), reject && (jsx(RlsButton, { type: "outline", onClick: () => {
1294
- if (reject.onClick) {
1295
- reject.onClick();
1296
- }
1297
- }, children: reject.label }))] }) }))] }), jsx("div", { className: "rls-confirmation__backdrop" })] }));
1991
+ return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-confirmation', { visible }), "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__component", children: [jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__header", children: [title && jsxRuntimeExports.jsx("div", { className: "rls-confirmation__title", children: title }), subtitle && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__subtitle", children: subtitle }))] }), jsxRuntimeExports.jsx("div", { className: "rls-confirmation__body", children: content && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__message", children: content })) }), (approved || reject) && (jsxRuntimeExports.jsx("div", { className: "rls-confirmation__footer", children: jsxRuntimeExports.jsxs("div", { className: "rls-confirmation__actions", children: [approved && (jsxRuntimeExports.jsx(RlsButton, { type: "raised", onClick: approved.onClick, children: approved.label })), reject && (jsxRuntimeExports.jsx(RlsButton, { type: "outline", onClick: reject.onClick, children: reject.label }))] }) }))] }), jsxRuntimeExports.jsx("div", { className: "rls-confirmation__backdrop" })] }));
1298
1992
  }
1299
1993
  function useConfirmationService() {
1300
1994
  const [config, setConfig] = useState({});
1301
1995
  const [visible, setVisible] = useState(false);
1302
- const rlsConfirmation = ReactDOM.createPortal(jsx(RlsConfirmation, { ...config, visible: visible }), document.body);
1996
+ const rlsConfirmation = ReactDOM.createPortal(jsxRuntimeExports.jsx(RlsConfirmation, { ...config, visible: visible }), document.body);
1303
1997
  function confirmation(config) {
1304
1998
  return new Promise((resolve) => {
1305
1999
  const { content, rlsTheme, subtitle, title, approved, reject } = config;
@@ -1335,27 +2029,27 @@ function useConfirmationService() {
1335
2029
  }
1336
2030
 
1337
2031
  function RlsDatatableHeader({ children }) {
1338
- return jsx("tr", { className: "rls-datatable__header", children: children });
2032
+ return jsxRuntimeExports.jsx("tr", { className: "rls-datatable__header", children: children });
1339
2033
  }
1340
2034
  function RlsDatatableTitle({ children, className, control }) {
1341
- return (jsx("th", { className: renderClassStatus('rls-datatable__title', { control }, className).trim(), children: children }));
2035
+ return (jsxRuntimeExports.jsx("th", { className: renderClassStatus('rls-datatable__title', { control }, className).trim(), children: children }));
1342
2036
  }
1343
2037
  function RlsDatatableData({ children, className, error }) {
1344
- return (jsx("tr", { className: renderClassStatus('rls-datatable__data', { error }, className).trim(), children: children }));
2038
+ return (jsxRuntimeExports.jsx("tr", { className: renderClassStatus('rls-datatable__data', { error }, className).trim(), children: children }));
1345
2039
  }
1346
2040
  function RlsDatatableCell({ children, className, control, overflow }) {
1347
- return (jsx("th", { className: renderClassStatus('rls-datatable__cell', { control, overflow }, className).trim(), children: children }));
2041
+ return (jsxRuntimeExports.jsx("th", { className: renderClassStatus('rls-datatable__cell', { control, overflow }, className).trim(), children: children }));
1348
2042
  }
1349
2043
  function RlsDatatableTotals({ children, className, error }) {
1350
- return (jsx("div", { className: renderClassStatus('rls-datatable__totals', { error }, className).trim(), children: children }));
2044
+ return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-datatable__totals', { error }, className).trim(), children: children }));
1351
2045
  }
1352
2046
  function RlsDatatableInfo({ children, className, control, overflow }) {
1353
- return (jsx("div", { className: renderClassStatus('rls-datatable__info', { control, overflow }, className).trim(), children: children }));
2047
+ return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-datatable__info', { control, overflow }, className).trim(), children: children }));
1354
2048
  }
1355
2049
  function RlsDatatable({ children, datatable, footer, header, rlsTheme, summary }) {
1356
- return (jsxs("div", { className: renderClassStatus('rls-datatable', {
2050
+ return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-datatable', {
1357
2051
  scrolleable: datatable?.scrolleable
1358
- }), "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 })] }));
2052
+ }), "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("table", { children: [header && jsxRuntimeExports.jsx("thead", { className: "rls-datatable__thead", children: header }), jsxRuntimeExports.jsx("tbody", { ref: datatable?.bodyRef, className: "rls-datatable__tbody", children: children })] }), summary && jsxRuntimeExports.jsx("div", { className: "rls-datatable__tsummary", children: summary }), footer && jsxRuntimeExports.jsx("div", { className: "rls-datatable__tfooter", children: footer })] }));
1359
2053
  }
1360
2054
 
1361
2055
  function useDatatable() {
@@ -1363,34 +2057,38 @@ function useDatatable() {
1363
2057
  const bodyRef = useRef(null);
1364
2058
  useEffect(() => {
1365
2059
  let observer;
1366
- if (bodyRef?.current) {
2060
+ const body = bodyRef?.current;
2061
+ if (body) {
1367
2062
  observer = new ResizeObserver(() => {
1368
- const scrollHeight = bodyRef?.current?.scrollHeight || 0;
1369
- const clientHeight = bodyRef?.current?.clientHeight || 0;
2063
+ const scrollHeight = body.scrollHeight || 0;
2064
+ const clientHeight = body.clientHeight || 0;
1370
2065
  setScrolleable(scrollHeight > clientHeight);
1371
2066
  });
1372
2067
  observer.observe(bodyRef?.current);
1373
2068
  }
1374
- return () => observer?.disconnect();
2069
+ return () => {
2070
+ observer?.disconnect();
2071
+ };
1375
2072
  }, []);
1376
2073
  return { bodyRef, scrolleable };
1377
2074
  }
1378
2075
 
1379
2076
  function useListControl({ suggestions, formControl }) {
1380
- const boxContentRef = useRef(null);
2077
+ const contentRef = useRef(null);
1381
2078
  const listRef = useRef(null);
1382
2079
  const inputRef = useRef(null);
1383
- const [collection, setCollection] = useState(new ListCollection([]));
1384
- const [value, setValue] = useState('');
1385
- const [opened, setOpened] = useState(false);
1386
- const [visible, setVisible] = useState(false);
1387
- const [higher, setHigher] = useState(false);
1388
- const [focused, setFocused] = useState(false);
2080
+ const [state, setState] = useState({
2081
+ collection: new ListCollection([]),
2082
+ focused: false,
2083
+ higher: false,
2084
+ value: '',
2085
+ visible: false
2086
+ });
1389
2087
  const position = useRef(0);
1390
2088
  useEffect(() => {
1391
2089
  function onCloseSuggestions({ target }) {
1392
- if (!boxContentRef?.current?.contains(target)) {
1393
- setVisible(false);
2090
+ if (!contentRef?.current?.contains(target)) {
2091
+ setState((state) => ({ ...state, visible: false }));
1394
2092
  }
1395
2093
  }
1396
2094
  document.addEventListener('click', onCloseSuggestions);
@@ -1399,50 +2097,58 @@ function useListControl({ suggestions, formControl }) {
1399
2097
  };
1400
2098
  }, []);
1401
2099
  useEffect(() => {
1402
- if (visible && !opened) {
1403
- setOpened(true);
1404
- }
1405
- if (!visible && opened && !!formControl?.touched) {
1406
- formControl.touch();
1407
- }
1408
- setHigher(!locationListIsBottom(boxContentRef.current, listRef.current));
1409
- }, [visible]);
2100
+ const content = contentRef.current;
2101
+ const list = listRef.current;
2102
+ formControl?.touch();
2103
+ setState((state) => ({
2104
+ ...state,
2105
+ higher: locationListCanTop(content, list)
2106
+ }));
2107
+ }, [state.visible]);
1410
2108
  useEffect(() => {
1411
- setCollection(new ListCollection(suggestions));
2109
+ setState((state) => ({
2110
+ ...state,
2111
+ collection: new ListCollection(suggestions)
2112
+ }));
1412
2113
  }, [suggestions]);
2114
+ function setFocused(focused) {
2115
+ setState((state) => ({ ...state, focused }));
2116
+ }
2117
+ function setValue(value) {
2118
+ setState((state) => ({ ...state, value }));
2119
+ }
2120
+ function setVisible(visible) {
2121
+ setState((state) => ({ ...state, visible }));
2122
+ }
1413
2123
  function navigationInput(event) {
1414
- if (visible) {
1415
- const newPosition = listNavigationInput({
1416
- contentElement: boxContentRef.current,
2124
+ if (state.visible) {
2125
+ const newPosition = navigationListFromInput({
2126
+ content: contentRef.current,
1417
2127
  event: event,
1418
- listElement: listRef.current
2128
+ list: listRef.current
1419
2129
  });
1420
- position.current = itIsDefined(newPosition) ? newPosition : 0;
2130
+ position.current = newPosition || 0;
1421
2131
  }
1422
2132
  }
1423
2133
  function navigationElement(event) {
1424
- position.current = listNavigationElement({
1425
- contentElement: boxContentRef.current,
2134
+ position.current = navigationListFromElement({
2135
+ content: contentRef.current,
1426
2136
  event: event,
1427
- inputElement: inputRef.current,
1428
- listElement: listRef.current,
2137
+ input: inputRef.current,
2138
+ list: listRef.current,
1429
2139
  position: position.current
1430
2140
  });
1431
2141
  }
1432
2142
  return {
1433
- boxContentRef,
1434
- collection,
1435
- focused,
1436
- higher,
2143
+ ...state,
2144
+ contentRef,
1437
2145
  inputRef,
1438
2146
  listRef,
1439
2147
  navigationElement,
1440
2148
  navigationInput,
1441
2149
  setFocused,
1442
2150
  setValue,
1443
- setVisible,
1444
- value,
1445
- visible
2151
+ setVisible
1446
2152
  };
1447
2153
  }
1448
2154
 
@@ -1476,14 +2182,14 @@ function useFieldAutocomplete({ disabled, formControl, onSelect, onValue, sugges
1476
2182
  changeInternal.current = false;
1477
2183
  return;
1478
2184
  }
1479
- refresh(collection, formControl?.state);
1480
- }, [formControl?.state]);
2185
+ refresh(collection, formControl?.value);
2186
+ }, [formControl?.value]);
1481
2187
  useEffect(() => {
1482
2188
  if (!initializedCollection.current || !initializedState.current) {
1483
2189
  initializedCollection.current = true;
1484
2190
  return;
1485
2191
  }
1486
- refresh(collection, formControl?.state);
2192
+ refresh(collection, formControl?.value);
1487
2193
  }, [collection]);
1488
2194
  function refresh(collection, state) {
1489
2195
  if (!state) {
@@ -1499,7 +2205,7 @@ function useFieldAutocomplete({ disabled, formControl, onSelect, onValue, sugges
1499
2205
  function setFormState(value) {
1500
2206
  if (formControl) {
1501
2207
  changeInternal.current = true;
1502
- formControl.setState(value);
2208
+ formControl.setValue(value);
1503
2209
  }
1504
2210
  }
1505
2211
  function onClickControl() {
@@ -1562,7 +2268,7 @@ function useFieldAutocomplete({ disabled, formControl, onSelect, onValue, sugges
1562
2268
  }
1563
2269
  }
1564
2270
  function refreshCoincidences(pattern, reboot = false) {
1565
- const { collection, store } = createStoreAutocomplete({
2271
+ const { collection, store } = createAutocompleteStore({
1566
2272
  pattern,
1567
2273
  suggestions,
1568
2274
  reboot,
@@ -1587,32 +2293,34 @@ function useFieldAutocomplete({ disabled, formControl, onSelect, onValue, sugges
1587
2293
  };
1588
2294
  }
1589
2295
 
1590
- function RlsFieldAutocompleteTemplate({ suggestions, children, disabled, formControl, hiddenIcon, placeholder, searching, rlsTheme, onSearch, onSelect, onValue, render }) {
1591
- const { coincidences, listControl, pattern, onBlurInput, onClickAction, onClickBackdrop, onClickControl, onClickElement, onFocusInput, onKeydownElement, onKeydownInput, setPattern } = useFieldAutocomplete({
2296
+ function RlsFieldAutocompleteTemplate({ render, suggestions, children, disabled, formControl, hiddenIcon, onSearch, onSelect, onValue, placeholder, rlsTheme, searching }) {
2297
+ const fieldAutocomplete = useFieldAutocomplete({
1592
2298
  suggestions,
1593
2299
  disabled,
1594
2300
  formControl,
1595
2301
  onSelect,
1596
2302
  onValue
1597
2303
  });
1598
- return (jsxs("div", { ref: listControl.boxContentRef, className: renderClassStatus('rls-field-box', {
2304
+ return (jsxRuntimeExports.jsxs("div", { ref: fieldAutocomplete.listControl.contentRef, className: renderClassStatus('rls-field-box', {
1599
2305
  disabled,
1600
- focused: listControl.focused,
1601
- selected: !!listControl.value
1602
- }, '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" }) }))] }) }), jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }), jsxs("div", { className: renderClassStatus('rls-field-list__suggestions', {
1603
- visible: listControl.visible,
1604
- hide: !listControl.visible,
1605
- higher: listControl.higher
1606
- }), 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 } }) => {
1607
- setPattern(value);
1608
- }, disabled: disabled || searching, onFocus: onFocusInput, onBlur: onBlurInput, onKeyDown: onKeydownInput }), onSearch && (jsx("button", { disabled: disabled || searching, onClick: () => {
1609
- onSearch(pattern);
1610
- }, 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 })] })] }));
2306
+ focused: fieldAutocomplete.listControl.focused,
2307
+ selected: !!fieldAutocomplete.listControl.value
2308
+ }, 'rls-field-list rls-field-autocomplete'), "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("label", { className: "rls-field-list__control", onClick: fieldAutocomplete.onClickControl, children: fieldAutocomplete.listControl.value ? (jsxRuntimeExports.jsx("span", { className: "rls-field-list__control__description", children: fieldAutocomplete.listControl.value })) : (jsxRuntimeExports.jsx("span", { className: "rls-field-list__control__placeholder", children: placeholder })) }), !hiddenIcon && fieldAutocomplete.listControl.value && (jsxRuntimeExports.jsx("button", { className: "rls-field-list__action", disabled: disabled, onClick: fieldAutocomplete.onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: "trash-2" }) }))] }) }), jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }), jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-list__suggestions', {
2309
+ visible: fieldAutocomplete.listControl.visible,
2310
+ hide: !fieldAutocomplete.listControl.visible,
2311
+ higher: fieldAutocomplete.listControl.higher
2312
+ }), children: [jsxRuntimeExports.jsx("div", { className: "rls-field-list__suggestions__body", children: jsxRuntimeExports.jsxs("ul", { ref: fieldAutocomplete.listControl.listRef, className: "rls-field-list__ul", children: [jsxRuntimeExports.jsxs("div", { className: "rls-field-list__ul__search", children: [jsxRuntimeExports.jsx("input", { ref: fieldAutocomplete.listControl.inputRef, className: "rls-field-list__ul__control", type: "text", placeholder: reactI18n('listInputPlaceholder'), value: fieldAutocomplete.pattern, onChange: ({ target: { value } }) => {
2313
+ fieldAutocomplete.setPattern(value);
2314
+ }, disabled: disabled || searching, onFocus: fieldAutocomplete.onFocusInput, onBlur: fieldAutocomplete.onBlurInput, onKeyDown: fieldAutocomplete.onKeydownInput }), onSearch && (jsxRuntimeExports.jsx("button", { disabled: disabled || searching, onClick: () => {
2315
+ onSearch(fieldAutocomplete.pattern);
2316
+ }, children: jsxRuntimeExports.jsx(RlsIcon, { value: "search" }) }))] }), searching && jsxRuntimeExports.jsx(RlsProgressBar, { indeterminate: true }), fieldAutocomplete.coincidences.map((element, index) => (jsxRuntimeExports.jsx("li", { className: "rls-field-list__element", tabIndex: -1, onClick: fieldAutocomplete.onClickElement(element), onKeyDown: fieldAutocomplete.onKeydownElement(element), children: render(element) }, index))), !fieldAutocomplete.coincidences.length && (jsxRuntimeExports.jsx("li", { className: "rls-field-list__empty", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-list__empty__description", children: [jsxRuntimeExports.jsx("label", { className: "rls-label-bold truncate", children: reactI18n('listEmptyTitle') }), jsxRuntimeExports.jsx("p", { className: "rls-caption-regular", children: reactI18n('listEmptyDescription') })] }) }))] }) }), jsxRuntimeExports.jsx("div", { className: "rls-field-list__backdrop", onClick: fieldAutocomplete.onClickBackdrop })] })] }));
1611
2317
  }
1612
2318
  function RlsFieldAutocomplete(props) {
1613
- return (jsx(RlsFieldAutocompleteTemplate, { ...props, render: (element) => (jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: element.title })) }));
2319
+ return (jsxRuntimeExports.jsx(RlsFieldAutocompleteTemplate, { ...props, render: (element) => (jsxRuntimeExports.jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: element.title })) }));
1614
2320
  }
1615
2321
 
2322
+ const DATE_RANGE_FORMAT = '{dd}/{mx}/{aa}';
2323
+
1616
2324
  function rangeFormatTemplate({ maxDate, minDate }) {
1617
2325
  const minFormat = dateFormatTemplate(minDate, DATE_RANGE_FORMAT);
1618
2326
  const maxFormat = dateFormatTemplate(maxDate, DATE_RANGE_FORMAT);
@@ -1620,109 +2328,13 @@ function rangeFormatTemplate({ maxDate, minDate }) {
1620
2328
  }
1621
2329
 
1622
2330
  function RlsModal({ children, visible, rlsTheme }) {
1623
- 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);
1624
- }
1625
-
1626
- const controlIsValid = (props) => {
1627
- const { state, validators } = props;
1628
- return validators.reduce((errors, validator) => {
1629
- const error = validator(state);
1630
- if (error) {
1631
- errors.push(error);
1632
- }
1633
- return errors;
1634
- }, []);
1635
- };
1636
-
1637
- function useControl(controlProps, controlValidators) {
1638
- const props = createFormControlProps(controlProps, controlValidators);
1639
- const [state, setCurrentState] = useState(props.state);
1640
- const [value, setValue] = useState(props.state);
1641
- const [touched, setTouched] = useState(props.touched || false);
1642
- const [dirty, setDirty] = useState(false);
1643
- const [focused, setFocused] = useState(false);
1644
- const [disabled, setDisabled] = useState(false);
1645
- const [initialValue] = useState(props.state);
1646
- const [validators, setValidators] = useState(props.validators);
1647
- const [subscribers] = useState(new BehaviorSubject(props.state));
1648
- const elementRef = useRef(null);
1649
- const errors = (() => validators ? controlIsValid({ state, validators }) : [])();
1650
- const error = (() => errors[0])();
1651
- const valid = (() => errors.length === 0)();
1652
- useEffect(() => {
1653
- if (state !== null && state !== undefined) {
1654
- setValue(state);
1655
- }
1656
- subscribers.next(state);
1657
- }, [state]);
1658
- function focus() {
1659
- setFocused(true);
1660
- }
1661
- function blur() {
1662
- setFocused(false);
1663
- }
1664
- function disable() {
1665
- setDisabled(true);
1666
- }
1667
- function enable() {
1668
- setDisabled(false);
1669
- }
1670
- function touch() {
1671
- setTouched(true);
1672
- }
1673
- function untouch() {
1674
- setTouched(false);
1675
- }
1676
- function setState(state) {
1677
- setDirty(true);
1678
- setCurrentState(state);
1679
- }
1680
- function reset() {
1681
- setTouched(false);
1682
- setDirty(false);
1683
- setCurrentState(initialValue);
1684
- }
1685
- function subscribe(subscriber) {
1686
- const subscription = subscribers.subscribe(subscriber);
1687
- return () => subscription.unsubscribe();
1688
- }
1689
- return {
1690
- blur,
1691
- dirty,
1692
- disable,
1693
- disabled,
1694
- elementRef,
1695
- enable,
1696
- enabled: !disabled,
1697
- error,
1698
- errors,
1699
- focus,
1700
- focused,
1701
- invalid: !valid,
1702
- pristine: !dirty,
1703
- reset,
1704
- setState,
1705
- setValidators,
1706
- state,
1707
- subscribe,
1708
- touch,
1709
- touched,
1710
- unfocused: !focused,
1711
- untouch,
1712
- untouched: !touched,
1713
- valid,
1714
- value,
1715
- wrong: touched && !valid
1716
- };
1717
- }
1718
- function useReactControl(controlProps, controlValidators) {
1719
- return useControl(controlProps, controlValidators);
1720
- }
1721
-
1722
- const FORMAT_DESCRIPTION = '{dw}, {mx} {dd} de {aa}';
2331
+ return ReactDOM.createPortal(jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-modal', { visible }), "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsx("div", { className: "rls-modal__component", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-modal__backdrop" })] }), document.body);
2332
+ }
2333
+
2334
+ const FORMAT_TITLE = '{dw}, {mx} {dd} de {aa}';
1723
2335
  function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDate, onListener, rlsTheme }) {
1724
2336
  const today = new Date(); // Initial current date in component
1725
- const dateInitial = formControl?.state || date || today;
2337
+ const dateInitial = formControl?.value || date || today;
1726
2338
  const yearControl = useReactControl(dateInitial.getFullYear());
1727
2339
  const dayControl = useReactControl(dateInitial.getDate());
1728
2340
  const monthControl = useReactControl(dateInitial.getMonth());
@@ -1730,28 +2342,28 @@ function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDat
1730
2342
  const [visibility, setVisibility] = useState('DAY');
1731
2343
  useEffect(() => {
1732
2344
  const dateCheck = checkDateRange({
1733
- date: formControl?.state || date || today,
2345
+ date: formControl?.value || date || today,
1734
2346
  minDate,
1735
2347
  maxDate
1736
2348
  });
1737
2349
  setValue(dateCheck);
1738
- formControl?.setState(dateCheck);
2350
+ formControl?.setValue(dateCheck);
1739
2351
  }, []);
1740
2352
  useEffect(() => {
1741
- setValue((prevValue) => itIsDefined(yearControl.state)
1742
- ? assignYearInDate(prevValue, yearControl.state)
1743
- : prevValue);
1744
- }, [yearControl.state]);
2353
+ if (itIsDefined(yearControl.value)) {
2354
+ setValue(assignYearInDate(value, yearControl.value));
2355
+ }
2356
+ }, [yearControl.value]);
1745
2357
  useEffect(() => {
1746
- setValue((prevValue) => itIsDefined(monthControl.state)
1747
- ? assignMonthInDate(prevValue, monthControl.state)
1748
- : prevValue);
1749
- }, [monthControl.state]);
2358
+ if (itIsDefined(monthControl.value)) {
2359
+ setValue(assignMonthInDate(value, monthControl.value));
2360
+ }
2361
+ }, [monthControl.value]);
1750
2362
  useEffect(() => {
1751
- setValue((prevValue) => itIsDefined(dayControl.state)
1752
- ? assignDayInDate(prevValue, dayControl.state)
1753
- : prevValue);
1754
- }, [dayControl.state]);
2363
+ if (itIsDefined(dayControl.value)) {
2364
+ setValue(assignDayInDate(value, dayControl.value));
2365
+ }
2366
+ }, [dayControl.value]);
1755
2367
  function onVisibilityDay() {
1756
2368
  setVisibility('DAY');
1757
2369
  }
@@ -1767,77 +2379,75 @@ function RlsPickerDate({ automatic, date, disabled, formControl, maxDate, minDat
1767
2379
  }
1768
2380
  }
1769
2381
  function onToday() {
1770
- yearControl.setState(today.getFullYear());
1771
- dayControl.setState(today.getDate());
1772
- monthControl.setState(today.getMonth());
1773
- formControl?.setState(today);
2382
+ yearControl.setValue(today.getFullYear());
2383
+ dayControl.setValue(today.getDate());
2384
+ monthControl.setValue(today.getMonth());
2385
+ formControl?.setValue(today);
1774
2386
  if (onListener) {
1775
2387
  onListener({ type: PickerListenerType.Now, value: today });
1776
2388
  }
1777
2389
  }
1778
2390
  function onSelect() {
1779
- formControl?.setState(value);
2391
+ formControl?.setValue(value);
1780
2392
  if (onListener) {
1781
2393
  onListener({ type: PickerListenerType.Select, value });
1782
2394
  }
1783
2395
  }
1784
- 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', {
2396
+ return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-date", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-date__header", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date__title rls-picker-date__title--description", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityDay, children: dateFormatTemplate(dateInitial, FORMAT_TITLE) }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__title rls-picker-date__title--year", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityYear, children: yearControl.value }) }), jsxRuntimeExports.jsx(RlsPickerMonthTitle, { monthControl: monthControl, yearControl: yearControl, date: value, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: 'month', onClick: onVisibilityMonth })] }), jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-picker-date__component', {
1785
2397
  day: visibility === 'DAY',
1786
2398
  month: visibility === 'MONTH',
1787
2399
  year: visibility === 'YEAR'
1788
- }), 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') }) })] }) })] }));
2400
+ }), children: [jsxRuntimeExports.jsx(RlsPickerDay, { formControl: dayControl, date: dateInitial, month: monthControl.value, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsxRuntimeExports.jsx(RlsPickerMonth, { formControl: monthControl, date: dateInitial, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsxRuntimeExports.jsx(RlsPickerYear, { formControl: yearControl, date: dateInitial, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), !automatic && (jsxRuntimeExports.jsx("div", { className: "rls-picker-date__footer", children: jsxRuntimeExports.jsxs("div", { className: "rls-picker-date__actions", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--cancel", children: jsxRuntimeExports.jsx(RlsButton, { type: "ghost", onClick: onCancel, children: reactI18n('dateActionCancel') }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--today", children: jsxRuntimeExports.jsx(RlsButton, { type: "ghost", onClick: onToday, disabled: dateOutRange({ date: today, maxDate, minDate }), children: reactI18n('dateActionToday') }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date__actions--ok", children: jsxRuntimeExports.jsx(RlsButton, { type: "raised", onClick: onSelect, children: reactI18n('dateActionSelect') }) })] }) }))] }));
1789
2401
  }
1790
2402
 
1791
- function RlsFieldDate({ children, date, disabled, formControl, maxDate, minDate, onValue, placeholder, rlsTheme }) {
2403
+ const FORMAT_DATE = '{dd}/{mx}/{aa}';
2404
+ function RlsFieldDate({ children, date, disabled, formControl, format, maxDate, minDate, onValue, placeholder, rlsTheme }) {
1792
2405
  const today = new Date(); // Initial current date in component
1793
2406
  const [value, setValue] = useState();
1794
2407
  const [modalIsVisible, setModalIsVisible] = useState(false);
1795
2408
  useEffect(() => {
1796
2409
  const dateCheck = checkDateRange({
1797
- date: formControl?.state || date || today,
2410
+ date: formControl?.value || date || today,
1798
2411
  minDate,
1799
2412
  maxDate
1800
2413
  });
1801
2414
  setValue(dateCheck);
1802
- formControl?.setState(dateCheck);
2415
+ formControl?.setValue(dateCheck);
1803
2416
  }, []);
1804
- function onClickInput() {
1805
- setModalIsVisible(true);
1806
- }
1807
- function onChange(value, ignoreControl = false) {
1808
- if (!ignoreControl) {
1809
- formControl?.setState(value);
1810
- }
2417
+ function onChange(value) {
1811
2418
  setValue(value);
1812
2419
  if (onValue) {
1813
2420
  onValue(value);
1814
2421
  }
1815
2422
  }
1816
- function onClean() {
2423
+ function onClickInput() {
2424
+ setModalIsVisible(true);
2425
+ }
2426
+ function onClickAction() {
1817
2427
  if (value) {
2428
+ formControl?.setValue(undefined);
2429
+ formControl?.touch();
1818
2430
  onChange(undefined);
1819
- if (formControl && !formControl.touched) {
1820
- formControl.touch();
1821
- }
1822
2431
  }
1823
2432
  else {
1824
2433
  setModalIsVisible(true);
1825
2434
  }
1826
2435
  }
1827
- 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' }) })] }) }), jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }), jsx(RlsModal, { visible: modalIsVisible, rlsTheme: rlsTheme, children: jsx(RlsPickerDate, { formControl: formControl, date: date, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: ({ value, type }) => {
2436
+ const valueInput = value
2437
+ ? dateFormatTemplate(value, format || FORMAT_DATE)
2438
+ : '';
2439
+ return (jsxRuntimeExports.jsxs("div", { className: "rls-field-date", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-box', { disabled }), children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { className: "rls-field-date__control", type: "text", value: valueInput, readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), jsxRuntimeExports.jsx("button", { className: "rls-field-date__action", onClick: onClickAction, disabled: disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: value ? 'trash-2' : 'calendar' }) })] }) }), jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }), jsxRuntimeExports.jsx(RlsModal, { visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntimeExports.jsx(RlsPickerDate, { formControl: formControl, date: date, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: ({ value, type }) => {
1828
2440
  if (type !== PickerListenerType.Cancel) {
1829
- onChange(value, true);
2441
+ onChange(value);
1830
2442
  }
2443
+ formControl?.touch();
1831
2444
  setModalIsVisible(false);
1832
- if (!formControl?.touched) {
1833
- formControl?.touch();
1834
- }
1835
2445
  } }) })] }));
1836
2446
  }
1837
2447
 
1838
2448
  function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl, maxDate, minDate, onListener, rlsTheme }) {
1839
2449
  const dateInitial = normalizeMinTime(datePicker || new Date());
1840
- const rangeInitial = formControl?.state || DateRange.now();
2450
+ const rangeInitial = formControl?.value || DateRange.now();
1841
2451
  const yearControl = useReactControl(dateInitial.getFullYear());
1842
2452
  const monthControl = useReactControl(dateInitial.getMonth());
1843
2453
  const dayControl = useReactControl(rangeInitial);
@@ -1846,24 +2456,24 @@ function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl
1846
2456
  const [visibility, setVisibility] = useState('DAY');
1847
2457
  useEffect(() => {
1848
2458
  setDate((prevValue) => {
1849
- return typeof yearControl.state === 'number'
1850
- ? assignYearInDate(prevValue, yearControl.state)
2459
+ return typeof yearControl.value === 'number'
2460
+ ? assignYearInDate(prevValue, yearControl.value)
1851
2461
  : prevValue;
1852
2462
  });
1853
- }, [yearControl.state]);
2463
+ }, [yearControl.value]);
1854
2464
  useEffect(() => {
1855
2465
  setDate((prevValue) => {
1856
- return typeof monthControl.state === 'number'
1857
- ? assignMonthInDate(prevValue, monthControl.state)
2466
+ return typeof monthControl.value === 'number'
2467
+ ? assignMonthInDate(prevValue, monthControl.value)
1858
2468
  : prevValue;
1859
2469
  });
1860
- }, [monthControl.state]);
2470
+ }, [monthControl.value]);
1861
2471
  useEffect(() => {
1862
- if (dayControl.state) {
1863
- setValue(dayControl.state);
2472
+ if (dayControl.value) {
2473
+ setValue(dayControl.value);
1864
2474
  }
1865
2475
  setVisibility('DAY');
1866
- }, [dayControl.state]);
2476
+ }, [dayControl.value]);
1867
2477
  function onVisibilityDay() {
1868
2478
  setVisibility('DAY');
1869
2479
  }
@@ -1879,22 +2489,22 @@ function RlsPickerDateRange({ automatic, date: datePicker, disabled, formControl
1879
2489
  }
1880
2490
  }
1881
2491
  function onSelect() {
1882
- formControl?.setState(value);
2492
+ formControl?.setValue(value);
1883
2493
  if (onListener) {
1884
2494
  onListener({ type: PickerListenerType.Select, value });
1885
2495
  }
1886
2496
  }
1887
- 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', {
2497
+ return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range__header", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__title rls-picker-date-range__title--description", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityDay, children: rangeFormatTemplate(value) }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__title rls-picker-date-range__title--year", children: jsxRuntimeExports.jsx("span", { onClick: onVisibilityYear, children: yearControl.value }) }), jsxRuntimeExports.jsx(RlsPickerMonthTitle, { monthControl: monthControl, yearControl: yearControl, date: date, maxDate: maxDate, minDate: minDate, disabled: visibility === 'YEAR', type: visibility === 'MONTH' ? 'year' : 'month', onClick: onVisibilityMonth })] }), jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-picker-date-range__component', {
1888
2498
  day: visibility === 'DAY',
1889
2499
  month: visibility === 'MONTH',
1890
2500
  year: visibility === 'YEAR'
1891
- }), 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', {
2501
+ }), children: [jsxRuntimeExports.jsx(RlsPickerDayRange, { formControl: dayControl, date: date, maxDate: maxDate, minDate: minDate, disabled: disabled }), jsxRuntimeExports.jsx(RlsPickerMonth, { formControl: monthControl, year: yearControl.value, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay }), jsxRuntimeExports.jsx(RlsPickerYear, { formControl: yearControl, maxDate: maxDate, minDate: minDate, disabled: disabled, onValue: onVisibilityDay })] }), jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-picker-date-range__footer', {
1892
2502
  automatic
1893
- }), 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') }) })] }) })] }));
2503
+ }), children: jsxRuntimeExports.jsxs("div", { className: "rls-picker-date-range__actions", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__actions--cancel", children: jsxRuntimeExports.jsx(RlsButton, { type: "ghost", onClick: onCancel, children: reactI18n('dateActionCancel') }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-date-range__actions--ok", children: jsxRuntimeExports.jsx(RlsButton, { type: "raised", onClick: onSelect, children: reactI18n('dateActionSelect') }) })] }) })] }));
1894
2504
  }
1895
2505
 
1896
2506
  function RlsFieldDateRange({ children, date: datePicker, disabled, formControl, maxDate, minDate, placeholder, rlsTheme }) {
1897
- const currentRange = formControl?.state || DateRange.now();
2507
+ const currentRange = formControl?.value || DateRange.now();
1898
2508
  const currentDate = datePicker || new Date();
1899
2509
  const [value, setValue] = useState(currentRange);
1900
2510
  const [modalIsVisible, setModalIsVisible] = useState(false);
@@ -1903,14 +2513,14 @@ function RlsFieldDateRange({ children, date: datePicker, disabled, formControl,
1903
2513
  }
1904
2514
  function onClickAction() {
1905
2515
  if (value) {
1906
- formControl?.setState(undefined);
2516
+ formControl?.setValue(undefined);
1907
2517
  setValue(undefined);
1908
2518
  }
1909
2519
  else {
1910
2520
  setModalIsVisible(true);
1911
2521
  }
1912
2522
  }
1913
- 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(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }), jsx(RlsModal, { visible: modalIsVisible, rlsTheme: rlsTheme, children: jsx(RlsPickerDateRange, { formControl: formControl, date: currentDate, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: ({ value }) => {
2523
+ return (jsxRuntimeExports.jsxs("div", { className: "rls-field-date-range", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-box', { disabled }), children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { className: "rls-field-date-range__control", type: "text", value: value ? rangeFormatTemplate(value) : '', readOnly: true, placeholder: placeholder, onClick: onClickInput, disabled: disabled }), jsxRuntimeExports.jsx("button", { className: "rls-field-date-range__action", onClick: onClickAction, disabled: disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: value ? 'trash-2' : 'calendar' }) })] }) }), jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl })] }), jsxRuntimeExports.jsx(RlsModal, { visible: modalIsVisible, rlsTheme: rlsTheme, children: jsxRuntimeExports.jsx(RlsPickerDateRange, { formControl: formControl, date: currentDate, disabled: disabled, maxDate: maxDate, minDate: minDate, onListener: ({ value }) => {
1914
2524
  if (value) {
1915
2525
  setValue(value);
1916
2526
  }
@@ -1933,14 +2543,14 @@ function useFieldSelect({ suggestions, formControl, onSelect, onValue }) {
1933
2543
  changeInternal.current = false;
1934
2544
  return;
1935
2545
  }
1936
- refresh(collection, formControl?.state);
1937
- }, [formControl?.state]);
2546
+ refresh(collection, formControl?.value);
2547
+ }, [formControl?.value]);
1938
2548
  useEffect(() => {
1939
2549
  if (!initializedCollection.current || !initializedState.current) {
1940
2550
  initializedCollection.current = true;
1941
2551
  return;
1942
2552
  }
1943
- refresh(collection, formControl?.state);
2553
+ refresh(collection, formControl?.value);
1944
2554
  }, [collection]);
1945
2555
  function refresh(collection, state) {
1946
2556
  if (!state) {
@@ -1956,7 +2566,7 @@ function useFieldSelect({ suggestions, formControl, onSelect, onValue }) {
1956
2566
  function setFormState(value) {
1957
2567
  if (formControl) {
1958
2568
  changeInternal.current = true;
1959
- formControl.setState(value);
2569
+ formControl.setValue(value);
1960
2570
  }
1961
2571
  }
1962
2572
  function onFocusInput() {
@@ -2029,28 +2639,28 @@ function useFieldSelect({ suggestions, formControl, onSelect, onValue }) {
2029
2639
  };
2030
2640
  }
2031
2641
 
2032
- function RlsFieldSelectTemplate({ suggestions, children, disabled, formControl, placeholder, rlsTheme, onSelect, onValue, render }) {
2033
- const { listControl, onBlurInput, onClickAction, onClickBackdrop, onClickElement, onClickInput, onFocusInput, onKeydownElement, onKeydownInput } = useFieldSelect({
2642
+ function RlsFieldSelectTemplate({ render, suggestions, children, disabled, formControl, onSelect, onValue, placeholder, rlsTheme }) {
2643
+ const fieldSelect = useFieldSelect({
2034
2644
  suggestions,
2035
2645
  disabled,
2036
2646
  formControl,
2037
2647
  onSelect,
2038
2648
  onValue
2039
2649
  });
2040
- 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', {
2041
- visible: listControl.visible
2042
- }), disabled: disabled, onClick: onClickAction, children: jsx(RlsIcon, { value: "arrow-ios-down" }) })] }) }), jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }), jsxs("div", { className: renderClassStatus('rls-field-list__suggestions', {
2043
- visible: listControl.visible,
2044
- hide: !listControl.visible,
2045
- higher: listControl.higher
2046
- }), 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 })] })] }));
2650
+ return (jsxRuntimeExports.jsxs("div", { ref: fieldSelect.listControl.contentRef, className: renderClassStatus('rls-field-box', { focused: fieldSelect.listControl.focused, disabled }, 'rls-field-list rls-field-select'), "rls-theme": rlsTheme, children: [children && jsxRuntimeExports.jsx("label", { className: "rls-field-box__label", children: children }), jsxRuntimeExports.jsx("div", { className: "rls-field-box__component", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-box__body", children: [jsxRuntimeExports.jsx("input", { ref: fieldSelect.listControl.inputRef, className: "rls-field-list__control", readOnly: true, disabled: disabled, placeholder: placeholder, value: fieldSelect.listControl.value, onFocus: fieldSelect.onFocusInput, onBlur: fieldSelect.onBlurInput, onClick: fieldSelect.onClickInput, onKeyDown: fieldSelect.onKeydownInput }), jsxRuntimeExports.jsx("button", { className: renderClassStatus('rls-field-list__action', {
2651
+ visible: fieldSelect.listControl.visible
2652
+ }), disabled: disabled, onClick: fieldSelect.onClickAction, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-down" }) })] }) }), jsxRuntimeExports.jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }), jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-field-list__suggestions', {
2653
+ visible: fieldSelect.listControl.visible,
2654
+ hide: !fieldSelect.listControl.visible,
2655
+ higher: fieldSelect.listControl.higher
2656
+ }), children: [jsxRuntimeExports.jsx("div", { className: "rls-field-list__suggestions__body", children: jsxRuntimeExports.jsxs("ul", { ref: fieldSelect.listControl.listRef, className: "rls-field-list__ul", children: [suggestions.map((element, index) => (jsxRuntimeExports.jsx("li", { className: "rls-field-list__element", tabIndex: -1, onClick: fieldSelect.onClickElement(element), onKeyDown: fieldSelect.onKeydownElement(element), children: render(element) }, index))), !suggestions.length && (jsxRuntimeExports.jsx("li", { className: "rls-field-list__empty", children: jsxRuntimeExports.jsxs("div", { className: "rls-field-list__empty__description", children: [jsxRuntimeExports.jsx("label", { className: "rls-label-bold truncate", children: reactI18n('listEmptyTitle') }), jsxRuntimeExports.jsx("p", { className: "rls-caption-regular", children: reactI18n('listEmptyDescription') })] }) }))] }) }), jsxRuntimeExports.jsx("div", { className: "rls-field-list__backdrop", onClick: fieldSelect.onClickBackdrop })] })] }));
2047
2657
  }
2048
2658
  function RlsFieldSelect(props) {
2049
- return (jsx(RlsFieldSelectTemplate, { ...props, render: (element) => (jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: element.title })) }));
2659
+ return (jsxRuntimeExports.jsx(RlsFieldSelectTemplate, { ...props, render: (element) => (jsxRuntimeExports.jsx(RlsBallot, { subtitle: element.subtitle, img: element.img, initials: element.initials, children: element.title })) }));
2050
2660
  }
2051
2661
 
2052
2662
  function RlsFormNavigation({ children, visible, rlsTheme }) {
2053
- return (jsx("div", { className: renderClassStatus('rls-form-navigation', { visible }), "rls-theme": rlsTheme, children: jsx("div", { className: "rls-form-navigation__body", children: children }) }));
2663
+ return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-form-navigation', { visible }), "rls-theme": rlsTheme, children: jsxRuntimeExports.jsx("div", { className: "rls-form-navigation__body", children: children }) }));
2054
2664
  }
2055
2665
 
2056
2666
  const DURATION_ANIMATION = 240;
@@ -2069,14 +2679,14 @@ function calculateDuration({ length }) {
2069
2679
  return duration + DURATION_RESET;
2070
2680
  }
2071
2681
  function RlsSnackbar({ content, icon, title, visible, rlsTheme }) {
2072
- return (jsxs("div", { className: renderClassStatus('rls-snackbar', { visible }), "rls-theme": rlsTheme, children: [icon && (jsx("div", { className: "rls-snackbar__avatar", children: jsx(RlsIcon, { value: icon }) })), jsxs("div", { className: "rls-snackbar__component", children: [title && jsx("div", { className: "rls-snackbar__title", children: title }), jsx("div", { className: "rls-snackbar__content", children: content })] })] }));
2682
+ return (jsxRuntimeExports.jsxs("div", { className: renderClassStatus('rls-snackbar', { visible }), "rls-theme": rlsTheme, children: [icon && (jsxRuntimeExports.jsx("div", { className: "rls-snackbar__avatar", children: jsxRuntimeExports.jsx(RlsIcon, { value: icon }) })), jsxRuntimeExports.jsxs("div", { className: "rls-snackbar__component", children: [title && jsxRuntimeExports.jsx("div", { className: "rls-snackbar__title", children: title }), jsxRuntimeExports.jsx("div", { className: "rls-snackbar__content", children: content })] })] }));
2073
2683
  }
2074
2684
  function useSnackbarService() {
2075
2685
  const [config, setConfig] = useState({});
2076
2686
  const [duration, setDuration] = useState(4000);
2077
2687
  const [timeoutId, setTimeoutId] = useState();
2078
2688
  const [visible, setVisible] = useState(false);
2079
- const rlsSnackbar = jsx(RlsSnackbar, { ...config, visible: visible });
2689
+ const rlsSnackbar = jsxRuntimeExports.jsx(RlsSnackbar, { ...config, visible: visible });
2080
2690
  useEffect(() => {
2081
2691
  if (visible) {
2082
2692
  const timeoutId = setTimeout(() => {
@@ -2111,8 +2721,8 @@ const RlsContext = createContext({
2111
2721
  function RlsApplication({ children }) {
2112
2722
  const { RlsConfirmation, confirmation } = useConfirmationService();
2113
2723
  const { RlsSnackbar, snackbar } = useSnackbarService();
2114
- return (jsxs(RlsContext.Provider, { value: { confirmation, snackbar }, children: [jsx("div", { className: "rls-app__body", children: children }), RlsSnackbar, RlsConfirmation] }));
2724
+ return (jsxRuntimeExports.jsxs(RlsContext.Provider, { value: { confirmation, snackbar }, children: [jsxRuntimeExports.jsx("div", { className: "rls-app__body", children: children }), RlsSnackbar, RlsConfirmation] }));
2115
2725
  }
2116
2726
 
2117
- 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, RlsMessageFormError, 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 };
2727
+ 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, RlsInputSearch, RlsInputText, RlsLabel, RlsLabelCheckBox, RlsLabelRadioButton, RlsLabelSwitch, RlsMessageFormError, RlsMessageIcon, RlsModal, RlsPagination, RlsPickerDate, RlsPickerDateRange, RlsPickerDay, RlsPickerDayRange, RlsPickerMonth, RlsPickerMonthTitle, RlsPickerYear, RlsPoster, RlsProgressBar, RlsProgressCircular, RlsRadioButton, RlsSkeleton, RlsSkeletonText, RlsSnackbar, RlsSwitch, RlsSwitchControl, RlsTabularText, RlsToolbar, rangeFormatTemplate, renderClassStatus, useConfirmationService, useDatatable, useListControl, useSnackbarService };
2118
2728
  //# sourceMappingURL=index.js.map