linear-react-components-ui 2.1.0-beta.1 → 2.1.0-beta.3

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 (44) hide show
  1. package/lib/assets/styles/datepicker2.css +77 -4
  2. package/lib/inputs2/date/calendarbox.d.ts +23 -0
  3. package/lib/inputs2/date/calendarbox.js +254 -0
  4. package/lib/inputs2/date/calendarbox.js.map +1 -0
  5. package/lib/inputs2/date/datefield/base.js +599 -215
  6. package/lib/inputs2/date/datefield/base.js.map +1 -1
  7. package/lib/inputs2/date/datefield/triggers.js +4 -4
  8. package/lib/inputs2/date/datefield/triggers.js.map +1 -1
  9. package/lib/inputs2/date/datefield/types.d.ts +5 -12
  10. package/lib/inputs2/date/dateperiodfield/base.js +645 -751
  11. package/lib/inputs2/date/dateperiodfield/base.js.map +1 -1
  12. package/lib/inputs2/date/dateperiodfield/triggers.js +21 -9
  13. package/lib/inputs2/date/dateperiodfield/triggers.js.map +1 -1
  14. package/lib/inputs2/date/dateperiodfield/types.d.ts +7 -23
  15. package/lib/inputs2/date/helpers.d.ts +25 -4
  16. package/lib/inputs2/date/helpers.js +79 -4
  17. package/lib/inputs2/date/helpers.js.map +1 -1
  18. package/lib/inputs2/date/{base/constants.d.ts → hooks/useCalendarPosition.d.ts} +1 -1
  19. package/lib/inputs2/date/hooks/useCalendarPosition.js +93 -0
  20. package/lib/inputs2/date/hooks/useCalendarPosition.js.map +1 -0
  21. package/lib/inputs2/date/hooks/useDateCalendarState.d.ts +14 -0
  22. package/lib/inputs2/date/hooks/useDateCalendarState.js +250 -0
  23. package/lib/inputs2/date/hooks/useDateCalendarState.js.map +1 -0
  24. package/lib/inputs2/date/hooks/useDateMask.d.ts +22 -0
  25. package/lib/inputs2/date/hooks/useDateMask.js +215 -0
  26. package/lib/inputs2/date/hooks/useDateMask.js.map +1 -0
  27. package/lib/inputs2/date/timeselector.d.ts +15 -0
  28. package/lib/inputs2/date/timeselector.js +228 -0
  29. package/lib/inputs2/date/timeselector.js.map +1 -0
  30. package/lib/inputs2/date/types.d.ts +16 -1
  31. package/lib/inputs2/date/types.js.map +1 -1
  32. package/lib/menus/float/SubMenuContainer.js +8 -16
  33. package/lib/menus/float/SubMenuContainer.js.map +1 -1
  34. package/lib/node_modules/moment/dist/locale/pt-br.js +54 -0
  35. package/lib/node_modules/moment/dist/locale/pt-br.js.map +1 -0
  36. package/package.json +1 -1
  37. package/lib/inputs2/date/base/constants.js +0 -69
  38. package/lib/inputs2/date/base/constants.js.map +0 -1
  39. package/lib/inputs2/date/datefield/calendarbox.d.ts +0 -6
  40. package/lib/inputs2/date/datefield/calendarbox.js +0 -228
  41. package/lib/inputs2/date/datefield/calendarbox.js.map +0 -1
  42. package/lib/inputs2/date/dateperiodfield/calendarbox.d.ts +0 -6
  43. package/lib/inputs2/date/dateperiodfield/calendarbox.js +0 -282
  44. package/lib/inputs2/date/dateperiodfield/calendarbox.js.map +0 -1
@@ -2,7 +2,6 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { c as compilerRuntimeExports } from "../../../_virtual/compiler-runtime.js";
3
3
  import React from "react";
4
4
  import _ from "../../../_virtual/lodash.js";
5
- import { useIMask } from "react-imask";
6
5
  import { createPortal } from "react-dom";
7
6
  import hooks from "../../../node_modules/moment/dist/moment.js";
8
7
  import Hint from "../../../hint/index.js";
@@ -12,12 +11,15 @@ import { mergeRefs } from "../../../form2/helpers.js";
12
11
  import { Keys } from "../types.js";
13
12
  import * as inputs2_date_base_index from "../base/index.js";
14
13
  import { Label, Root, Container, Input } from "../base/index.js";
15
- import { TOKEN_ISO_FORMAT, TOKEN_PTBR_FORMAT, TOKEN_MASK, NAVIGATION_KEYS } from "../helpers.js";
14
+ import { useDateMask } from "../hooks/useDateMask.js";
15
+ import { useDateCalendarState } from "../hooks/useDateCalendarState.js";
16
+ import { TimeSelector } from "../timeselector.js";
17
+ import { getDateFormats, parseBoundary, TOKEN_ISO_FORMAT, getPredefinedPeriodRange, clampDateToBounds, isDayOutOfBounds, parseDateValue } from "../helpers.js";
18
+ import { CalendarBox } from "../calendarbox.js";
16
19
  import { Triggers } from "./triggers.js";
17
- import { CalendarBox } from "./calendarbox.js";
18
20
  import { DatePeriodFieldContext } from "./context.js";
19
21
  const InputBase = React.forwardRef((props, __) => {
20
- const $ = compilerRuntimeExports.c(193);
22
+ const $ = compilerRuntimeExports.c(211);
21
23
  const {
22
24
  label,
23
25
  errors,
@@ -36,11 +38,15 @@ const InputBase = React.forwardRef((props, __) => {
36
38
  showCalendarButton: t12,
37
39
  textAlign: t13,
38
40
  openCalendarOnFocus: t14,
39
- shouldCloseOnSelect: t15,
40
- showPredefinedPeriodsButton: t16,
41
- showClearDateButton: t17,
42
- placeholder: t18,
43
- returnValueType: t19,
41
+ showPredefinedPeriodsButton: t15,
42
+ showClearDateButton: t16,
43
+ returnValueType: t17,
44
+ variant: t18,
45
+ placeholder,
46
+ shouldCloseOnSelect,
47
+ min,
48
+ max,
49
+ onChange,
44
50
  tooltip,
45
51
  tooltipPosition,
46
52
  tooltipWidth,
@@ -63,253 +69,156 @@ const InputBase = React.forwardRef((props, __) => {
63
69
  const showCalendarButton = t12 === void 0 ? true : t12;
64
70
  const textAlign = t13 === void 0 ? "left" : t13;
65
71
  const openCalendarOnFocus = t14 === void 0 ? true : t14;
66
- const shouldCloseOnSelect = t15 === void 0 ? true : t15;
67
- const showPredefinedPeriodsButton = t16 === void 0 ? true : t16;
68
- const showClearDateButton = t17 === void 0 ? true : t17;
69
- const placeholder = t18 === void 0 ? TOKEN_PTBR_FORMAT : t18;
70
- const returnValueType = t19 === void 0 ? "default" : t19;
71
- let t20;
72
+ const showPredefinedPeriodsButton = t15 === void 0 ? true : t15;
73
+ const showClearDateButton = t16 === void 0 ? true : t16;
74
+ const returnValueType = t17 === void 0 ? "default" : t17;
75
+ const variant = t18 === void 0 ? "date" : t18;
76
+ const isDateTime = variant === "datetime";
77
+ const {
78
+ isoFormat,
79
+ ptbrFormat,
80
+ digits
81
+ } = getDateFormats(variant);
82
+ const shouldCloseCalendarOnSelect = shouldCloseOnSelect ?? !isDateTime;
83
+ const inputPlaceholder = placeholder ?? ptbrFormat;
84
+ const minDate = parseBoundary(min);
85
+ const maxDate = parseBoundary(max);
86
+ const hasBounds = Boolean(minDate || maxDate);
87
+ let t19;
72
88
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
73
- t20 = {
89
+ t19 = {
74
90
  inicial: null,
75
91
  final: null
76
92
  };
77
- $[0] = t20;
78
- } else {
79
- t20 = $[0];
80
- }
81
- const [selectedDate, setSelectedDate] = React.useState(t20);
82
- const [calendarBoxOpen, setCalendarBoxOpen] = React.useState(false);
83
- let t21;
84
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
85
- t21 = hooks().format(TOKEN_ISO_FORMAT);
86
- $[1] = t21;
87
- } else {
88
- t21 = $[1];
89
- }
90
- const [activeDescendant, setActiveDescendant] = React.useState(t21);
91
- let t22;
92
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
93
- t22 = hooks();
94
- $[2] = t22;
93
+ $[0] = t19;
95
94
  } else {
96
- t22 = $[2];
95
+ t19 = $[0];
97
96
  }
98
- const [calendarDisplayDate, setCalendarDisplayDate] = React.useState(t22);
99
- const calendarRef = React.useRef(null);
97
+ const [selectedDate, setSelectedDate] = React.useState(t19);
98
+ const [activeInputType, setActiveInputType] = React.useState("initial");
100
99
  const inputRootRef = React.useRef(null);
101
100
  const finalInputRef = React.useRef(null);
102
101
  const initialInputRef = React.useRef(null);
103
- const dateContainerRef = React.useRef(null);
104
- let t23;
105
- if ($[3] !== initialName || $[4] !== props.name) {
106
- t23 = String(props.name).concat(".").concat(initialName);
107
- $[3] = initialName;
108
- $[4] = props.name;
109
- $[5] = t23;
110
- } else {
111
- t23 = $[5];
112
- }
113
- const initialInputName = t23;
114
- let t24;
115
- if ($[6] !== finalName || $[7] !== props.name) {
116
- t24 = String(props.name).concat(".").concat(finalName);
117
- $[6] = finalName;
118
- $[7] = props.name;
119
- $[8] = t24;
120
- } else {
121
- t24 = $[8];
122
- }
123
- const finalInputName = t24;
124
- let t25;
125
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
126
- t25 = {
127
- mask: TOKEN_MASK,
128
- lazy: false,
129
- placeholderChar: "_"
130
- };
131
- $[9] = t25;
102
+ const calendarState = useDateCalendarState({
103
+ inputRef: initialInputRef,
104
+ min: minDate,
105
+ max: maxDate
106
+ });
107
+ const {
108
+ calendarBoxOpen,
109
+ activeDescendant,
110
+ calendarDisplayDate,
111
+ calendarRef,
112
+ dateContainerRef,
113
+ handleNextMonth,
114
+ handlePreviousMonth,
115
+ handleSetCalendarBoxOpen,
116
+ handleChangeActiveDescendant,
117
+ handleChangeCalendarDisplayDate,
118
+ handleKeyDownNavigation
119
+ } = calendarState;
120
+ let t20;
121
+ if ($[1] !== initialName || $[2] !== props.name) {
122
+ t20 = String(props.name).concat(".").concat(initialName);
123
+ $[1] = initialName;
124
+ $[2] = props.name;
125
+ $[3] = t20;
132
126
  } else {
133
- t25 = $[9];
127
+ t20 = $[3];
134
128
  }
135
- let t26;
136
- if ($[10] !== selectedDate.inicial) {
137
- t26 = selectedDate.inicial?.format(TOKEN_PTBR_FORMAT);
138
- $[10] = selectedDate.inicial;
139
- $[11] = t26;
129
+ const initialInputName = t20;
130
+ let t21;
131
+ if ($[4] !== finalName || $[5] !== props.name) {
132
+ t21 = String(props.name).concat(".").concat(finalName);
133
+ $[4] = finalName;
134
+ $[5] = props.name;
135
+ $[6] = t21;
140
136
  } else {
141
- t26 = $[11];
137
+ t21 = $[6];
142
138
  }
139
+ const finalInputName = t21;
143
140
  const {
144
- value: initialMaskedValue,
145
- setValue: setInitialMaskValue,
146
- unmaskedValue: initialUnmaskedValue
147
- } = useIMask(t25, {
148
- ref: initialInputRef,
149
- defaultValue: t26,
150
- onComplete: (value) => {
151
- const date = hooks(value, TOKEN_PTBR_FORMAT);
152
- if (date.isValid()) {
153
- handleChangeUpdateDateState({
154
- date,
155
- inputType: "initial",
156
- typing: true
157
- });
158
- }
159
- }
141
+ maskedValue: initialMaskedValue,
142
+ setMaskValue: setInitialMaskValue,
143
+ unmaskedValue: initialUnmaskedValue,
144
+ handleOnPaste,
145
+ handleOnBeforeInput,
146
+ handleOnKeyDownCapture: handleInitialKeyDownCapture
147
+ } = useDateMask({
148
+ inputRef: initialInputRef,
149
+ variant,
150
+ defaultValue: selectedDate.inicial?.format(ptbrFormat),
151
+ undigitable,
152
+ readOnly,
153
+ onCommit: (date) => handleChangeUpdateDateState({
154
+ date,
155
+ inputType: "initial",
156
+ typing: true
157
+ }),
158
+ onPaste: props.onPaste,
159
+ onBeforeInput: props.onBeforeInput
160
160
  });
161
- let t27;
162
- if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
163
- t27 = {
164
- mask: TOKEN_MASK,
165
- lazy: false,
166
- placeholderChar: "_"
167
- };
168
- $[12] = t27;
169
- } else {
170
- t27 = $[12];
171
- }
172
- let t28;
173
- if ($[13] !== selectedDate.final) {
174
- t28 = selectedDate.final?.format(TOKEN_PTBR_FORMAT);
175
- $[13] = selectedDate.final;
176
- $[14] = t28;
177
- } else {
178
- t28 = $[14];
179
- }
180
161
  const {
181
- value: finalMaskedValue,
182
- setValue: setFinalMaskValue,
183
- unmaskedValue: finalUnmaskedValue
184
- } = useIMask(t27, {
185
- ref: finalInputRef,
186
- defaultValue: t28,
187
- onComplete: (value_0) => {
188
- const date_0 = hooks(value_0, TOKEN_PTBR_FORMAT);
189
- if (date_0.isValid()) {
190
- handleChangeUpdateDateState({
191
- date: date_0,
192
- inputType: "final",
193
- typing: true
194
- });
195
- }
196
- }
162
+ maskedValue: finalMaskedValue,
163
+ setMaskValue: setFinalMaskValue,
164
+ unmaskedValue: finalUnmaskedValue,
165
+ handleOnKeyDownCapture: handleFinalKeyDownCapture
166
+ } = useDateMask({
167
+ inputRef: finalInputRef,
168
+ variant,
169
+ defaultValue: selectedDate.final?.format(ptbrFormat),
170
+ undigitable,
171
+ readOnly,
172
+ onCommit: (date_0) => handleChangeUpdateDateState({
173
+ date: date_0,
174
+ inputType: "final",
175
+ typing: true
176
+ }),
177
+ onPaste: props.onPaste,
178
+ onBeforeInput: props.onBeforeInput
197
179
  });
198
- let t29;
199
- if ($[15] !== props.label) {
200
- t29 = _.isEmpty(props?.label);
201
- $[15] = props.label;
202
- $[16] = t29;
180
+ let t22;
181
+ if ($[7] !== props.label) {
182
+ t22 = _.isEmpty(props?.label);
183
+ $[7] = props.label;
184
+ $[8] = t22;
203
185
  } else {
204
- t29 = $[16];
186
+ t22 = $[8];
205
187
  }
206
- const hasLabel = !t29;
188
+ const hasLabel = !t22;
207
189
  const hasHintMessages = Boolean(props.hint?.length);
208
190
  const hasValidationErrors = Boolean(errors?.length);
209
- let t30;
210
- if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
211
- t30 = (object) => setSelectedDate(object);
212
- $[17] = t30;
213
- } else {
214
- t30 = $[17];
215
- }
216
- const handleChangeSelectedDate = t30;
217
- let t31;
218
- if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
219
- t31 = (value_1) => setCalendarBoxOpen(value_1);
220
- $[18] = t31;
221
- } else {
222
- t31 = $[18];
223
- }
224
- const handleChangeCalendarBoxState = t31;
225
- let t32;
226
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
227
- t32 = (value_2) => setActiveDescendant(value_2);
228
- $[19] = t32;
229
- } else {
230
- t32 = $[19];
231
- }
232
- const handleChangeActiveDescendant = t32;
233
- let t33;
234
- if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
235
- t33 = (value_3) => setCalendarDisplayDate(value_3);
236
- $[20] = t33;
237
- } else {
238
- t33 = $[20];
239
- }
240
- const handleChangeCalendarDisplayDate = t33;
241
- let t34;
242
- if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
243
- t34 = () => setCalendarDisplayDate(_temp);
244
- $[21] = t34;
245
- } else {
246
- t34 = $[21];
247
- }
248
- const handleChangePreviousMonth = t34;
249
- let t35;
250
- if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
251
- t35 = () => setCalendarDisplayDate(_temp2);
252
- $[22] = t35;
253
- } else {
254
- t35 = $[22];
255
- }
256
- const handleChangeNextMonth = t35;
257
- let t36;
258
- if ($[23] !== handleChangeActiveDescendant) {
259
- t36 = (offset) => {
260
- setCalendarDisplayDate((prevDisplayDate_1) => {
261
- const daySelected = prevDisplayDate_1.clone().add(offset, "day");
262
- handleChangeActiveDescendant(daySelected.format(TOKEN_ISO_FORMAT));
263
- return daySelected;
264
- });
265
- };
266
- $[23] = handleChangeActiveDescendant;
267
- $[24] = t36;
268
- } else {
269
- t36 = $[24];
270
- }
271
- const handleNavigateWithDays = t36;
272
- let t37;
273
- if ($[25] !== handleChangeActiveDescendant) {
274
- t37 = (when) => {
275
- setCalendarDisplayDate((prevDisplayDate_2) => {
276
- let daySelected_0 = prevDisplayDate_2;
277
- if (when === "end") {
278
- daySelected_0 = prevDisplayDate_2.clone().endOf("week");
279
- }
280
- if (when === "start") {
281
- daySelected_0 = prevDisplayDate_2.clone().startOf("week");
282
- }
283
- handleChangeActiveDescendant(daySelected_0.format(TOKEN_ISO_FORMAT));
284
- return daySelected_0;
285
- });
286
- };
287
- $[25] = handleChangeActiveDescendant;
288
- $[26] = t37;
289
- } else {
290
- t37 = $[26];
291
- }
292
- const handleNavigateWithWeeks = t37;
293
- let t38;
294
- if ($[27] !== finalName || $[28] !== initialName || $[29] !== props.value) {
295
- t38 = () => {
191
+ let t23;
192
+ if ($[9] !== finalName || $[10] !== initialName || $[11] !== props.value) {
193
+ t23 = () => {
296
194
  const objectValue = props?.value;
297
195
  const isValidInitialValue = !_.isEmpty(objectValue[initialName]);
298
196
  const isValidFinalValue = !_.isEmpty(objectValue[finalName]);
299
197
  return isValidInitialValue && isValidFinalValue;
300
198
  };
301
- $[27] = finalName;
302
- $[28] = initialName;
303
- $[29] = props.value;
304
- $[30] = t38;
305
- } else {
306
- t38 = $[30];
307
- }
308
- const verifyPeriodSelectedIsValid = t38;
309
- let t39;
310
- if ($[31] !== finalName || $[32] !== handleChangeCalendarBoxState || $[33] !== initialName || $[34] !== props || $[35] !== setFinalMaskValue || $[36] !== setInitialMaskValue) {
311
- t39 = () => {
312
- props.onChange?.({
199
+ $[9] = finalName;
200
+ $[10] = initialName;
201
+ $[11] = props.value;
202
+ $[12] = t23;
203
+ } else {
204
+ t23 = $[12];
205
+ }
206
+ const verifyPeriodSelectedIsValid = t23;
207
+ const emitPeriodChange = (inicial, final) => {
208
+ onChange?.({
209
+ target: {
210
+ name: props.name,
211
+ value: {
212
+ [initialName]: returnValueType === "default" ? inicial?.format(isoFormat) : inicial?.toISOString(),
213
+ [finalName]: returnValueType === "default" ? final?.format(isoFormat) : final?.toISOString()
214
+ }
215
+ }
216
+ });
217
+ };
218
+ let t24;
219
+ if ($[13] !== finalName || $[14] !== handleSetCalendarBoxOpen || $[15] !== initialName || $[16] !== onChange || $[17] !== props.name || $[18] !== setFinalMaskValue || $[19] !== setInitialMaskValue || $[20] !== setSelectedDate) {
220
+ t24 = () => {
221
+ onChange?.({
313
222
  target: {
314
223
  name: props.name,
315
224
  value: {
@@ -318,22 +227,24 @@ const InputBase = React.forwardRef((props, __) => {
318
227
  }
319
228
  }
320
229
  });
321
- setSelectedDate(_temp3);
230
+ setSelectedDate(_temp);
322
231
  setInitialMaskValue("");
323
232
  setFinalMaskValue("");
324
- handleChangeCalendarBoxState(false);
233
+ handleSetCalendarBoxOpen(false);
325
234
  };
326
- $[31] = finalName;
327
- $[32] = handleChangeCalendarBoxState;
328
- $[33] = initialName;
329
- $[34] = props;
330
- $[35] = setFinalMaskValue;
331
- $[36] = setInitialMaskValue;
332
- $[37] = t39;
333
- } else {
334
- t39 = $[37];
335
- }
336
- const handleOnClickClearSelectedPeriod = t39;
235
+ $[13] = finalName;
236
+ $[14] = handleSetCalendarBoxOpen;
237
+ $[15] = initialName;
238
+ $[16] = onChange;
239
+ $[17] = props.name;
240
+ $[18] = setFinalMaskValue;
241
+ $[19] = setInitialMaskValue;
242
+ $[20] = setSelectedDate;
243
+ $[21] = t24;
244
+ } else {
245
+ t24 = $[21];
246
+ }
247
+ const handleOnClickClearSelectedPeriod = t24;
337
248
  const handleChangeUpdateDateState = (params) => {
338
249
  const {
339
250
  date: date_1,
@@ -341,80 +252,78 @@ const InputBase = React.forwardRef((props, __) => {
341
252
  typing
342
253
  } = params;
343
254
  const rawDate = date_1.clone();
344
- const verifyDateRangeOrder = _temp4;
345
- bb185: switch (inputType) {
255
+ const resolveDateRange = (initialDate, finalDate) => {
256
+ if (typing) {
257
+ return {
258
+ inicial: initialDate,
259
+ final: finalDate
260
+ };
261
+ }
262
+ const inicial_0 = initialDate?.isAfter(finalDate) ? finalDate : initialDate;
263
+ const final_0 = initialDate?.isAfter(finalDate) ? initialDate : finalDate;
264
+ return {
265
+ inicial: inicial_0,
266
+ final: final_0
267
+ };
268
+ };
269
+ bb209: switch (inputType) {
346
270
  case "initial": {
347
271
  setSelectedDate((prevSelectedDate_0) => {
348
272
  const {
349
- inicial: inicial_2,
350
- final: final_2
351
- } = verifyDateRangeOrder(rawDate, prevSelectedDate_0.final);
273
+ inicial: inicial_3,
274
+ final: final_3
275
+ } = resolveDateRange(rawDate, prevSelectedDate_0.final);
352
276
  const updatedState_0 = {
353
- inicial: inicial_2,
354
- final: final_2
277
+ inicial: inicial_3,
278
+ final: final_3
355
279
  };
356
280
  return updatedState_0;
357
281
  });
358
282
  const {
359
- inicial: inicial_3,
360
- final: final_3
361
- } = verifyDateRangeOrder(rawDate, selectedDate.final);
362
- props.onChange?.({
363
- target: {
364
- name: props.name,
365
- value: {
366
- [initialName]: returnValueType === "default" ? inicial_3?.format(TOKEN_ISO_FORMAT) : inicial_3?.toISOString(),
367
- [finalName]: returnValueType === "default" ? final_3?.format(TOKEN_ISO_FORMAT) : final_3?.toISOString()
368
- }
369
- }
370
- });
283
+ inicial: inicial_4,
284
+ final: final_4
285
+ } = resolveDateRange(rawDate, selectedDate.final);
286
+ emitPeriodChange(inicial_4, final_4);
371
287
  requestAnimationFrame(() => {
372
288
  if (!typing) {
373
289
  finalInputRef.current?.focus?.();
374
290
  }
375
291
  });
376
- break bb185;
292
+ break bb209;
377
293
  }
378
294
  case "final": {
379
295
  setSelectedDate((prevSelectedDate) => {
380
296
  const {
381
- inicial: inicial_0,
382
- final: final_0
383
- } = verifyDateRangeOrder(prevSelectedDate.inicial, rawDate);
297
+ inicial: inicial_1,
298
+ final: final_1
299
+ } = resolveDateRange(prevSelectedDate.inicial, rawDate);
384
300
  const updatedState = {
385
- inicial: inicial_0,
386
- final: final_0
301
+ inicial: inicial_1,
302
+ final: final_1
387
303
  };
388
304
  return updatedState;
389
305
  });
390
306
  const {
391
- inicial: inicial_1,
392
- final: final_1
393
- } = verifyDateRangeOrder(selectedDate.inicial, rawDate);
394
- props.onChange?.({
395
- target: {
396
- name: props.name,
397
- value: {
398
- [initialName]: returnValueType === "default" ? inicial_1?.format(TOKEN_ISO_FORMAT) : inicial_1?.toISOString(),
399
- [finalName]: returnValueType === "default" ? final_1?.format(TOKEN_ISO_FORMAT) : final_1?.toISOString()
400
- }
401
- }
402
- });
403
- if (shouldCloseOnSelect) {
404
- handleChangeCalendarBoxState(false);
307
+ inicial: inicial_2,
308
+ final: final_2
309
+ } = resolveDateRange(selectedDate.inicial, rawDate);
310
+ emitPeriodChange(inicial_2, final_2);
311
+ if (shouldCloseCalendarOnSelect) {
312
+ handleSetCalendarBoxOpen(false);
405
313
  }
406
- break bb185;
314
+ break bb209;
407
315
  }
408
316
  }
409
- setCalendarDisplayDate(rawDate.clone());
317
+ handleChangeActiveDescendant(rawDate.format(TOKEN_ISO_FORMAT));
318
+ handleChangeCalendarDisplayDate(rawDate.clone());
410
319
  };
411
- let t40;
412
- if ($[38] !== finalName || $[39] !== handleChangeCalendarBoxState || $[40] !== initialName || $[41] !== props || $[42] !== returnValueType || $[43] !== shouldCloseOnSelect) {
413
- t40 = (period) => {
320
+ let t25;
321
+ if ($[22] !== finalName || $[23] !== handleSetCalendarBoxOpen || $[24] !== initialName || $[25] !== isoFormat || $[26] !== maxDate || $[27] !== minDate || $[28] !== onChange || $[29] !== props.name || $[30] !== returnValueType || $[31] !== setSelectedDate || $[32] !== shouldCloseCalendarOnSelect) {
322
+ t25 = (period) => {
414
323
  const localOnChange = (initialDate_0, finalDate_0) => {
415
324
  const valueToUpdate = {
416
- [initialName]: returnValueType === "default" ? initialDate_0.format(TOKEN_ISO_FORMAT) : initialDate_0.toISOString(),
417
- [finalName]: returnValueType === "default" ? finalDate_0.format(TOKEN_ISO_FORMAT) : finalDate_0.toISOString()
325
+ [initialName]: returnValueType === "default" ? initialDate_0.format(isoFormat) : initialDate_0.toISOString(),
326
+ [finalName]: returnValueType === "default" ? finalDate_0.format(isoFormat) : finalDate_0.toISOString()
418
327
  };
419
328
  setSelectedDate(() => {
420
329
  const updatedState_1 = {
@@ -423,579 +332,564 @@ const InputBase = React.forwardRef((props, __) => {
423
332
  };
424
333
  return updatedState_1;
425
334
  });
426
- props.onChange?.({
335
+ onChange?.({
427
336
  target: {
428
337
  name: props.name,
429
338
  value: valueToUpdate
430
339
  }
431
340
  });
432
341
  };
433
- bb304: switch (period) {
434
- case "today": {
435
- const date_2 = hooks();
436
- localOnChange(date_2, date_2);
437
- break bb304;
438
- }
439
- case "week": {
440
- const startOfWeek = hooks().startOf("week");
441
- const endOfWeek = hooks().endOf("week");
442
- localOnChange(startOfWeek, endOfWeek);
443
- break bb304;
444
- }
445
- case "lastweek": {
446
- const startOfLastWeek = hooks().add(-1, "week").startOf("week");
447
- const endOfLastWeek = hooks().add(-1, "week").endOf("week");
448
- localOnChange(startOfLastWeek, endOfLastWeek);
449
- break bb304;
450
- }
451
- case "last15": {
452
- const startOfLastFifteenDays = hooks().add(-14, "d");
453
- const endOfLastFifteenDays = hooks();
454
- localOnChange(startOfLastFifteenDays, endOfLastFifteenDays);
455
- break bb304;
456
- }
457
- case "month": {
458
- const startOfMonth_0 = hooks().startOf("month");
459
- const endOfMonth_0 = hooks().endOf("month");
460
- localOnChange(startOfMonth_0, endOfMonth_0);
461
- break bb304;
462
- }
463
- case "lastmonth": {
464
- const startOfMonth = hooks().add(-1, "month").startOf("month");
465
- const endOfMonth = hooks().add(-1, "month").endOf("month");
466
- localOnChange(startOfMonth, endOfMonth);
467
- break bb304;
468
- }
469
- }
342
+ const {
343
+ initialDate: initialDate_1,
344
+ finalDate: finalDate_1
345
+ } = getPredefinedPeriodRange(period);
346
+ localOnChange(clampDateToBounds(initialDate_1, minDate, maxDate), clampDateToBounds(finalDate_1, minDate, maxDate));
470
347
  finalInputRef?.current?.focus?.();
471
- if (shouldCloseOnSelect) {
472
- handleChangeCalendarBoxState(false);
348
+ if (shouldCloseCalendarOnSelect) {
349
+ handleSetCalendarBoxOpen(false);
473
350
  }
474
351
  };
475
- $[38] = finalName;
476
- $[39] = handleChangeCalendarBoxState;
477
- $[40] = initialName;
478
- $[41] = props;
479
- $[42] = returnValueType;
480
- $[43] = shouldCloseOnSelect;
481
- $[44] = t40;
482
- } else {
483
- t40 = $[44];
484
- }
485
- const handleChangeUpdateDateStateWithPredefinedPeriod = t40;
486
- let t41;
487
- if ($[45] !== calendarBoxOpen || $[46] !== finalInputName || $[47] !== finalUnmaskedValue || $[48] !== handleChangeActiveDescendant || $[49] !== handleChangeCalendarBoxState || $[50] !== initialInputName || $[51] !== initialUnmaskedValue || $[52] !== props || $[53] !== selectedDate.final || $[54] !== selectedDate.inicial || $[55] !== setFinalMaskValue || $[56] !== setInitialMaskValue) {
488
- t41 = (event, inputType_0) => {
352
+ $[22] = finalName;
353
+ $[23] = handleSetCalendarBoxOpen;
354
+ $[24] = initialName;
355
+ $[25] = isoFormat;
356
+ $[26] = maxDate;
357
+ $[27] = minDate;
358
+ $[28] = onChange;
359
+ $[29] = props.name;
360
+ $[30] = returnValueType;
361
+ $[31] = setSelectedDate;
362
+ $[32] = shouldCloseCalendarOnSelect;
363
+ $[33] = t25;
364
+ } else {
365
+ t25 = $[33];
366
+ }
367
+ const handleChangeUpdateDateStateWithPredefinedPeriod = t25;
368
+ let handleOnBlurMaskInput;
369
+ if ($[34] !== calendarBoxOpen || $[35] !== digits || $[36] !== emitPeriodChange || $[37] !== finalInputName || $[38] !== finalUnmaskedValue || $[39] !== handleChangeActiveDescendant || $[40] !== handleChangeCalendarDisplayDate || $[41] !== handleSetCalendarBoxOpen || $[42] !== initialInputName || $[43] !== initialUnmaskedValue || $[44] !== props || $[45] !== ptbrFormat || $[46] !== selectedDate || $[47] !== setFinalMaskValue || $[48] !== setInitialMaskValue || $[49] !== setSelectedDate) {
370
+ handleOnBlurMaskInput = (event, inputType_0) => {
489
371
  props?.onBlur?.(event);
490
372
  if (inputType_0 === "initial") {
491
373
  if (event.relatedTarget?.id !== finalInputName) {
492
- handleChangeCalendarBoxState(false);
374
+ handleSetCalendarBoxOpen(false);
493
375
  }
494
376
  if (calendarBoxOpen) {
495
377
  handleChangeActiveDescendant((selectedDate.inicial ?? hooks()).format(TOKEN_ISO_FORMAT));
496
- setCalendarDisplayDate(selectedDate.inicial ?? hooks());
378
+ handleChangeCalendarDisplayDate(selectedDate.inicial ?? hooks());
497
379
  }
498
- if (_.size(initialUnmaskedValue) !== 8) {
499
- const date_3 = hooks(selectedDate.inicial, TOKEN_ISO_FORMAT);
500
- if (date_3.isValid()) {
501
- setInitialMaskValue(date_3.format(TOKEN_PTBR_FORMAT));
380
+ if (_.size(initialUnmaskedValue) !== digits) {
381
+ const date_2 = hooks(selectedDate.inicial, TOKEN_ISO_FORMAT);
382
+ if (date_2.isValid()) {
383
+ setInitialMaskValue(date_2.format(ptbrFormat));
502
384
  }
503
385
  }
504
386
  }
505
387
  if (inputType_0 === "final") {
506
388
  if (event.relatedTarget?.id !== initialInputName) {
507
- handleChangeCalendarBoxState(false);
389
+ handleSetCalendarBoxOpen(false);
508
390
  }
509
391
  if (calendarBoxOpen) {
510
392
  handleChangeActiveDescendant((selectedDate.final ?? hooks()).format(TOKEN_ISO_FORMAT));
511
- setCalendarDisplayDate(selectedDate.final ?? hooks());
393
+ handleChangeCalendarDisplayDate(selectedDate.final ?? hooks());
512
394
  }
513
- if (_.size(finalUnmaskedValue) !== 8) {
514
- const date_4 = hooks(selectedDate.final, TOKEN_ISO_FORMAT);
515
- if (date_4.isValid()) {
516
- setFinalMaskValue(date_4.format(TOKEN_PTBR_FORMAT));
395
+ if (_.size(finalUnmaskedValue) !== digits) {
396
+ const date_3 = hooks(selectedDate.final, TOKEN_ISO_FORMAT);
397
+ if (date_3.isValid()) {
398
+ setFinalMaskValue(date_3.format(ptbrFormat));
517
399
  }
518
400
  }
519
401
  }
402
+ handleReorderPeriodOnBlur();
520
403
  };
521
- $[45] = calendarBoxOpen;
522
- $[46] = finalInputName;
523
- $[47] = finalUnmaskedValue;
524
- $[48] = handleChangeActiveDescendant;
525
- $[49] = handleChangeCalendarBoxState;
526
- $[50] = initialInputName;
527
- $[51] = initialUnmaskedValue;
528
- $[52] = props;
529
- $[53] = selectedDate.final;
530
- $[54] = selectedDate.inicial;
531
- $[55] = setFinalMaskValue;
532
- $[56] = setInitialMaskValue;
533
- $[57] = t41;
534
- } else {
535
- t41 = $[57];
404
+ const handleReorderPeriodOnBlur = () => {
405
+ const {
406
+ inicial: inicial_5,
407
+ final: final_5
408
+ } = selectedDate;
409
+ if (!inicial_5 || !final_5 || !inicial_5.isAfter(final_5)) {
410
+ return;
411
+ }
412
+ setSelectedDate({
413
+ inicial: final_5,
414
+ final: inicial_5
415
+ });
416
+ setInitialMaskValue(final_5.format(ptbrFormat));
417
+ setFinalMaskValue(inicial_5.format(ptbrFormat));
418
+ emitPeriodChange(final_5, inicial_5);
419
+ };
420
+ $[34] = calendarBoxOpen;
421
+ $[35] = digits;
422
+ $[36] = emitPeriodChange;
423
+ $[37] = finalInputName;
424
+ $[38] = finalUnmaskedValue;
425
+ $[39] = handleChangeActiveDescendant;
426
+ $[40] = handleChangeCalendarDisplayDate;
427
+ $[41] = handleSetCalendarBoxOpen;
428
+ $[42] = initialInputName;
429
+ $[43] = initialUnmaskedValue;
430
+ $[44] = props;
431
+ $[45] = ptbrFormat;
432
+ $[46] = selectedDate;
433
+ $[47] = setFinalMaskValue;
434
+ $[48] = setInitialMaskValue;
435
+ $[49] = setSelectedDate;
436
+ $[50] = handleOnBlurMaskInput;
437
+ } else {
438
+ handleOnBlurMaskInput = $[50];
536
439
  }
537
- const handleOnBlurMaskInput = t41;
538
- let t42;
539
- if ($[58] !== calendarBoxOpen || $[59] !== handleChangeActiveDescendant || $[60] !== openCalendarOnFocus || $[61] !== props || $[62] !== readOnly || $[63] !== selectedDate.final || $[64] !== selectedDate.inicial) {
540
- t42 = (event_0, inputType_1) => {
440
+ let t26;
441
+ if ($[51] !== calendarBoxOpen || $[52] !== handleChangeActiveDescendant || $[53] !== handleChangeCalendarDisplayDate || $[54] !== handleSetCalendarBoxOpen || $[55] !== openCalendarOnFocus || $[56] !== props || $[57] !== readOnly || $[58] !== selectedDate.final || $[59] !== selectedDate.inicial || $[60] !== setActiveInputType) {
442
+ t26 = (event_0, inputType_1) => {
541
443
  props?.onFocus?.(event_0);
542
444
  if (!readOnly && !calendarBoxOpen && openCalendarOnFocus) {
543
- setCalendarBoxOpen(true);
445
+ handleSetCalendarBoxOpen(true);
544
446
  }
447
+ setActiveInputType(inputType_1);
545
448
  if (inputType_1 === "initial") {
546
449
  handleChangeActiveDescendant((selectedDate.inicial ?? hooks()).format(TOKEN_ISO_FORMAT));
547
- setCalendarDisplayDate(selectedDate.inicial ?? hooks());
450
+ handleChangeCalendarDisplayDate(selectedDate.inicial ?? hooks());
548
451
  }
549
452
  if (inputType_1 === "final") {
550
453
  handleChangeActiveDescendant((selectedDate.final ?? hooks()).format(TOKEN_ISO_FORMAT));
551
- setCalendarDisplayDate(selectedDate.final ?? hooks());
454
+ handleChangeCalendarDisplayDate(selectedDate.final ?? hooks());
552
455
  }
553
456
  };
554
- $[58] = calendarBoxOpen;
555
- $[59] = handleChangeActiveDescendant;
556
- $[60] = openCalendarOnFocus;
557
- $[61] = props;
558
- $[62] = readOnly;
559
- $[63] = selectedDate.final;
560
- $[64] = selectedDate.inicial;
561
- $[65] = t42;
562
- } else {
563
- t42 = $[65];
564
- }
565
- const handleOnFocusMaskInput = t42;
566
- let t43;
567
- if ($[66] !== activeDescendant || $[67] !== calendarBoxOpen || $[68] !== handleChangeUpdateDateState || $[69] !== props) {
568
- t43 = (event_1, inputType_2) => {
457
+ $[51] = calendarBoxOpen;
458
+ $[52] = handleChangeActiveDescendant;
459
+ $[53] = handleChangeCalendarDisplayDate;
460
+ $[54] = handleSetCalendarBoxOpen;
461
+ $[55] = openCalendarOnFocus;
462
+ $[56] = props;
463
+ $[57] = readOnly;
464
+ $[58] = selectedDate.final;
465
+ $[59] = selectedDate.inicial;
466
+ $[60] = setActiveInputType;
467
+ $[61] = t26;
468
+ } else {
469
+ t26 = $[61];
470
+ }
471
+ const handleOnFocusMaskInput = t26;
472
+ let getDayState;
473
+ let handleOnKeyDownMaskInput;
474
+ let handleSelectDay;
475
+ if ($[62] !== activeDescendant || $[63] !== calendarBoxOpen || $[64] !== finalInputName || $[65] !== handleChangeUpdateDateState || $[66] !== hasBounds || $[67] !== initialInputName || $[68] !== isDateTime || $[69] !== maxDate || $[70] !== minDate || $[71] !== props || $[72] !== selectedDate) {
476
+ handleOnKeyDownMaskInput = (event_1, inputType_2) => {
569
477
  props?.onKeyDown?.(event_1);
570
478
  if (calendarBoxOpen && event_1.key && !event_1.shiftKey && !event_1.altKey && event_1.key === Keys.enter) {
571
479
  event_1.preventDefault();
572
- const rawDate_0 = hooks(_.toString(activeDescendant), TOKEN_ISO_FORMAT);
573
- handleChangeUpdateDateState({
574
- date: rawDate_0,
575
- inputType: inputType_2
576
- });
480
+ handleSelectDay(hooks(_.toString(activeDescendant), TOKEN_ISO_FORMAT), inputType_2);
577
481
  }
578
482
  };
579
- $[66] = activeDescendant;
580
- $[67] = calendarBoxOpen;
581
- $[68] = handleChangeUpdateDateState;
582
- $[69] = props;
583
- $[70] = t43;
584
- } else {
585
- t43 = $[70];
586
- }
587
- const handleOnKeyDownMaskInput = t43;
588
- let t44;
589
- if ($[71] !== props || $[72] !== undigitable) {
590
- t44 = (event_2) => {
591
- if (undigitable) {
592
- event_2.preventDefault();
593
- } else {
594
- props.onPaste?.(event_2);
483
+ let t272;
484
+ if ($[76] !== hasBounds || $[77] !== maxDate || $[78] !== minDate || $[79] !== selectedDate) {
485
+ t272 = (day) => {
486
+ const {
487
+ inicial: inicial_6,
488
+ final: final_6
489
+ } = selectedDate;
490
+ return {
491
+ isSelected: Boolean(inicial_6 && day.isSame(inicial_6, "day") || final_6 && day.isSame(final_6, "day")),
492
+ isInRange: Boolean(inicial_6 && final_6 && day.isAfter(inicial_6, "day") && day.isBefore(final_6, "day")),
493
+ ...hasBounds && {
494
+ isDisabled: isDayOutOfBounds(day, minDate, maxDate)
495
+ }
496
+ };
497
+ };
498
+ $[76] = hasBounds;
499
+ $[77] = maxDate;
500
+ $[78] = minDate;
501
+ $[79] = selectedDate;
502
+ $[80] = t272;
503
+ } else {
504
+ t272 = $[80];
505
+ }
506
+ getDayState = t272;
507
+ let t282;
508
+ if ($[81] !== finalInputName || $[82] !== initialInputName) {
509
+ t282 = () => {
510
+ const focusedInputId = document.activeElement?.id;
511
+ if (focusedInputId === initialInputName) {
512
+ return "initial";
513
+ }
514
+ if (focusedInputId === finalInputName) {
515
+ return "final";
516
+ }
517
+ };
518
+ $[81] = finalInputName;
519
+ $[82] = initialInputName;
520
+ $[83] = t282;
521
+ } else {
522
+ t282 = $[83];
523
+ }
524
+ const resolveInputTypeFromFocus = t282;
525
+ handleSelectDay = (daySelected, targetInputType) => {
526
+ const inputType_3 = targetInputType ?? resolveInputTypeFromFocus();
527
+ if (_.isUndefined(inputType_3)) {
528
+ return;
595
529
  }
530
+ const current = inputType_3 === "initial" ? selectedDate.inicial : selectedDate.final;
531
+ const dayWithTime = isDateTime && current ? daySelected.clone().hour(current.hour()).minute(current.minute()) : daySelected;
532
+ handleChangeUpdateDateState({
533
+ date: clampDateToBounds(dayWithTime, minDate, maxDate),
534
+ inputType: inputType_3
535
+ });
596
536
  };
537
+ $[62] = activeDescendant;
538
+ $[63] = calendarBoxOpen;
539
+ $[64] = finalInputName;
540
+ $[65] = handleChangeUpdateDateState;
541
+ $[66] = hasBounds;
542
+ $[67] = initialInputName;
543
+ $[68] = isDateTime;
544
+ $[69] = maxDate;
545
+ $[70] = minDate;
597
546
  $[71] = props;
598
- $[72] = undigitable;
599
- $[73] = t44;
600
- } else {
601
- t44 = $[73];
602
- }
603
- const handleOnPaste = t44;
604
- let t45;
605
- if ($[74] !== props || $[75] !== undigitable) {
606
- t45 = (event_3) => {
607
- if (undigitable) {
608
- event_3.preventDefault();
609
- } else {
610
- props.onBeforeInput?.(event_3);
611
- }
612
- };
613
- $[74] = props;
614
- $[75] = undigitable;
615
- $[76] = t45;
547
+ $[72] = selectedDate;
548
+ $[73] = getDayState;
549
+ $[74] = handleOnKeyDownMaskInput;
550
+ $[75] = handleSelectDay;
616
551
  } else {
617
- t45 = $[76];
552
+ getDayState = $[73];
553
+ handleOnKeyDownMaskInput = $[74];
554
+ handleSelectDay = $[75];
618
555
  }
619
- const handleOnBeforeInput = t45;
620
- let t46;
621
- if ($[77] !== calendarBoxOpen || $[78] !== handleChangeCalendarBoxState || $[79] !== handleChangeNextMonth || $[80] !== handleChangePreviousMonth || $[81] !== handleNavigateWithDays || $[82] !== handleNavigateWithWeeks) {
622
- t46 = (event_4) => {
623
- if (calendarBoxOpen && event_4.key && !event_4.shiftKey && !event_4.altKey && NAVIGATION_KEYS.includes(event_4.key)) {
624
- event_4.preventDefault();
625
- bb466: switch (event_4.key) {
626
- case Keys.arrowLeft: {
627
- handleNavigateWithDays(-1);
628
- break bb466;
629
- }
630
- case Keys.arrowRight: {
631
- handleNavigateWithDays(1);
632
- break bb466;
633
- }
634
- case Keys.arrowUp: {
635
- handleNavigateWithDays(-7);
636
- break bb466;
637
- }
638
- case Keys.arrowDown: {
639
- handleNavigateWithDays(7);
640
- break bb466;
641
- }
642
- case Keys.pageUp: {
643
- handleChangeNextMonth();
644
- break bb466;
645
- }
646
- case Keys.pageDown: {
647
- handleChangePreviousMonth();
648
- break bb466;
649
- }
650
- case Keys.home: {
651
- handleNavigateWithWeeks("start");
652
- break bb466;
653
- }
654
- case Keys.end: {
655
- handleNavigateWithWeeks("end");
656
- break bb466;
657
- }
658
- case Keys.escape: {
659
- handleChangeCalendarBoxState(false);
660
- break bb466;
661
- }
662
- }
556
+ const activeSelectedDate = activeInputType === "initial" ? selectedDate.inicial : selectedDate.final;
557
+ let t27;
558
+ if ($[84] !== activeInputType || $[85] !== activeSelectedDate || $[86] !== handleChangeUpdateDateState) {
559
+ t27 = (hour, minute) => {
560
+ if (!activeSelectedDate) {
561
+ return;
663
562
  }
563
+ handleChangeUpdateDateState({
564
+ date: activeSelectedDate.clone().hour(hour).minute(minute).second(0),
565
+ inputType: activeInputType,
566
+ typing: true
567
+ });
664
568
  };
665
- $[77] = calendarBoxOpen;
666
- $[78] = handleChangeCalendarBoxState;
667
- $[79] = handleChangeNextMonth;
668
- $[80] = handleChangePreviousMonth;
669
- $[81] = handleNavigateWithDays;
670
- $[82] = handleNavigateWithWeeks;
671
- $[83] = t46;
569
+ $[84] = activeInputType;
570
+ $[85] = activeSelectedDate;
571
+ $[86] = handleChangeUpdateDateState;
572
+ $[87] = t27;
672
573
  } else {
673
- t46 = $[83];
574
+ t27 = $[87];
674
575
  }
675
- const handleOnKeyDown = t46;
676
- let t47;
677
- if ($[84] !== finalName || $[85] !== initialName || $[86] !== props.value || $[87] !== setFinalMaskValue || $[88] !== setInitialMaskValue) {
678
- t47 = () => {
576
+ const handleSelectTime = t27;
577
+ let t28;
578
+ if ($[88] !== finalName || $[89] !== initialName || $[90] !== props.value || $[91] !== ptbrFormat || $[92] !== setFinalMaskValue || $[93] !== setInitialMaskValue || $[94] !== setSelectedDate || $[95] !== variant) {
579
+ t28 = () => {
679
580
  if (props?.value) {
680
581
  const objectValue_0 = props.value;
681
- const initialDate_1 = hooks(_.toString(objectValue_0[initialName]), TOKEN_ISO_FORMAT);
682
- const finalDate_1 = hooks(_.toString(objectValue_0[finalName]), TOKEN_ISO_FORMAT);
582
+ const initialDate_2 = parseDateValue(objectValue_0[initialName], variant);
583
+ const finalDate_2 = parseDateValue(objectValue_0[finalName], variant);
683
584
  setSelectedDate(() => ({
684
- inicial: initialDate_1.isValid() ? initialDate_1 : null,
685
- final: finalDate_1.isValid() ? finalDate_1 : null
585
+ inicial: initialDate_2.isValid() ? initialDate_2 : null,
586
+ final: finalDate_2.isValid() ? finalDate_2 : null
686
587
  }));
687
- setInitialMaskValue(initialDate_1.format(TOKEN_PTBR_FORMAT));
688
- setFinalMaskValue(finalDate_1.format(TOKEN_PTBR_FORMAT));
588
+ setInitialMaskValue(initialDate_2.format(ptbrFormat));
589
+ setFinalMaskValue(finalDate_2.format(ptbrFormat));
689
590
  }
690
591
  };
691
- $[84] = finalName;
692
- $[85] = initialName;
693
- $[86] = props.value;
694
- $[87] = setFinalMaskValue;
695
- $[88] = setInitialMaskValue;
696
- $[89] = t47;
697
- } else {
698
- t47 = $[89];
699
- }
700
- const t48 = props?.value;
701
- let t49;
702
- if ($[90] !== t48) {
703
- t49 = [t48];
704
- $[90] = t48;
705
- $[91] = t49;
592
+ $[88] = finalName;
593
+ $[89] = initialName;
594
+ $[90] = props.value;
595
+ $[91] = ptbrFormat;
596
+ $[92] = setFinalMaskValue;
597
+ $[93] = setInitialMaskValue;
598
+ $[94] = setSelectedDate;
599
+ $[95] = variant;
600
+ $[96] = t28;
601
+ } else {
602
+ t28 = $[96];
603
+ }
604
+ const t29 = props?.value;
605
+ let t30;
606
+ if ($[97] !== t29) {
607
+ t30 = [t29];
608
+ $[97] = t29;
609
+ $[98] = t30;
706
610
  } else {
707
- t49 = $[91];
611
+ t30 = $[98];
708
612
  }
709
- React.useEffect(t47, t49);
710
- const t50 = Boolean(readOnly);
711
- const t51 = Boolean(readOnly);
712
- const t52 = verifyPeriodSelectedIsValid();
713
- let t53;
714
- if ($[92] !== activeDescendant || $[93] !== calendarBoxOpen || $[94] !== calendarDisplayDate || $[95] !== finalInputName || $[96] !== handleChangeActiveDescendant || $[97] !== handleChangeCalendarBoxState || $[98] !== handleChangeCalendarDisplayDate || $[99] !== handleChangeNextMonth || $[100] !== handleChangePreviousMonth || $[101] !== handleChangeSelectedDate || $[102] !== handleChangeUpdateDateState || $[103] !== handleChangeUpdateDateStateWithPredefinedPeriod || $[104] !== handleOnClickClearSelectedPeriod || $[105] !== hasValidationErrors || $[106] !== initialInputName || $[107] !== openCalendarOnFocus || $[108] !== selectedDate || $[109] !== showCalendarButton || $[110] !== showClearDateButton || $[111] !== showPredefinedPeriodsButton || $[112] !== skeletonize || $[113] !== t50 || $[114] !== t51 || $[115] !== t52 || $[116] !== undigitable) {
715
- t53 = {
716
- isReadOnly: t50,
717
- isDisabled: t51,
613
+ React.useEffect(t28, t30);
614
+ const t31 = Boolean(readOnly);
615
+ const t32 = Boolean(disabled);
616
+ const t33 = verifyPeriodSelectedIsValid();
617
+ let t34;
618
+ if ($[99] !== calendarState || $[100] !== finalInputName || $[101] !== handleChangeUpdateDateState || $[102] !== handleChangeUpdateDateStateWithPredefinedPeriod || $[103] !== handleOnClickClearSelectedPeriod || $[104] !== hasValidationErrors || $[105] !== initialInputName || $[106] !== initialInputRef || $[107] !== maxDate || $[108] !== minDate || $[109] !== openCalendarOnFocus || $[110] !== selectedDate || $[111] !== showCalendarButton || $[112] !== showClearDateButton || $[113] !== showPredefinedPeriodsButton || $[114] !== skeletonize || $[115] !== t31 || $[116] !== t32 || $[117] !== t33 || $[118] !== undigitable) {
619
+ t34 = {
620
+ ...calendarState,
621
+ isReadOnly: t31,
622
+ isDisabled: t32,
718
623
  undigitable,
719
624
  skeletonize,
720
- dateContainerRef,
721
- calendarBoxOpen,
722
- activeDescendant,
723
625
  selectedDate,
626
+ minDate,
627
+ maxDate,
724
628
  initialInputId: initialInputName,
725
629
  finalInputId: finalInputName,
726
630
  initialInputRef,
727
631
  finalInputRef,
728
632
  showCalendarButton,
729
- calendarDisplayDate,
730
633
  hasValidationErrors,
731
634
  openCalendarOnFocus,
732
635
  showPredefinedPeriodsButton,
733
636
  showClearDateButton,
734
- handleChangeSelectedDate,
735
- handleChangePreviousMonth,
736
- handleChangeNextMonth,
737
- handleChangeCalendarBoxState,
738
- handleChangeActiveDescendant,
739
- handleChangeCalendarDisplayDate,
740
637
  handleChangeUpdateDateState,
741
638
  handleOnClickClearSelectedPeriod,
742
639
  handleChangeUpdateDateStateWithPredefinedPeriod,
743
- hasValidPeriodSelected: t52
640
+ hasValidPeriodSelected: t33
744
641
  };
745
- $[92] = activeDescendant;
746
- $[93] = calendarBoxOpen;
747
- $[94] = calendarDisplayDate;
748
- $[95] = finalInputName;
749
- $[96] = handleChangeActiveDescendant;
750
- $[97] = handleChangeCalendarBoxState;
751
- $[98] = handleChangeCalendarDisplayDate;
752
- $[99] = handleChangeNextMonth;
753
- $[100] = handleChangePreviousMonth;
754
- $[101] = handleChangeSelectedDate;
755
- $[102] = handleChangeUpdateDateState;
756
- $[103] = handleChangeUpdateDateStateWithPredefinedPeriod;
757
- $[104] = handleOnClickClearSelectedPeriod;
758
- $[105] = hasValidationErrors;
759
- $[106] = initialInputName;
760
- $[107] = openCalendarOnFocus;
761
- $[108] = selectedDate;
762
- $[109] = showCalendarButton;
763
- $[110] = showClearDateButton;
764
- $[111] = showPredefinedPeriodsButton;
765
- $[112] = skeletonize;
766
- $[113] = t50;
767
- $[114] = t51;
768
- $[115] = t52;
769
- $[116] = undigitable;
770
- $[117] = t53;
771
- } else {
772
- t53 = $[117];
773
- }
774
- const contextValues = t53;
775
- let t54;
776
- if ($[118] !== customClassLabel || $[119] !== disabled || $[120] !== hasHintMessages || $[121] !== hasLabel || $[122] !== hintPosition || $[123] !== initialInputName || $[124] !== label || $[125] !== labelUppercase || $[126] !== popoverAlign || $[127] !== props.hint || $[128] !== props.required || $[129] !== readOnly || $[130] !== skeletonize || $[131] !== themePopover) {
777
- t54 = hasLabel && /* @__PURE__ */ jsx(Label, { "data-testid": "test-date-period-field-label", label, inputId: initialInputName, hint: props?.hint, isDisabled: disabled, isReadOnly: readOnly, skeletonize, required: props?.required, hintPosition, themePopover, popoverAlign, labelUppercase, hasHintMessages, customClassLabel });
778
- $[118] = customClassLabel;
779
- $[119] = disabled;
780
- $[120] = hasHintMessages;
781
- $[121] = hasLabel;
782
- $[122] = hintPosition;
783
- $[123] = initialInputName;
784
- $[124] = label;
785
- $[125] = labelUppercase;
786
- $[126] = popoverAlign;
787
- $[127] = props.hint;
788
- $[128] = props.required;
789
- $[129] = readOnly;
790
- $[130] = skeletonize;
791
- $[131] = themePopover;
792
- $[132] = t54;
793
- } else {
794
- t54 = $[132];
795
- }
796
- const t55 = _.omit(rest, ["initialRef", "finalRef"]);
797
- const t56 = props?.initialRef;
798
- let t57;
799
- if ($[133] !== t56) {
800
- t57 = mergeRefs(initialInputRef, t56);
801
- $[133] = t56;
802
- $[134] = t57;
803
- } else {
804
- t57 = $[134];
805
- }
806
- let t58;
807
- if ($[135] !== handleOnBlurMaskInput) {
808
- t58 = (event_5) => handleOnBlurMaskInput(event_5, "initial");
809
- $[135] = handleOnBlurMaskInput;
810
- $[136] = t58;
811
- } else {
812
- t58 = $[136];
813
- }
814
- let t59;
815
- if ($[137] !== handleOnFocusMaskInput) {
816
- t59 = (event_6) => handleOnFocusMaskInput(event_6, "initial");
817
- $[137] = handleOnFocusMaskInput;
818
- $[138] = t59;
819
- } else {
820
- t59 = $[138];
821
- }
822
- let t60;
823
- if ($[139] !== handleOnKeyDownMaskInput) {
824
- t60 = (event_7) => handleOnKeyDownMaskInput(event_7, "initial");
825
- $[139] = handleOnKeyDownMaskInput;
826
- $[140] = t60;
827
- } else {
828
- t60 = $[140];
829
- }
830
- let t61;
831
- if ($[141] === Symbol.for("react.memo_cache_sentinel")) {
832
- t61 = /* @__PURE__ */ jsx(Icon, { name: "arrow_right", size: 10 });
833
- $[141] = t61;
834
- } else {
835
- t61 = $[141];
836
- }
837
- let t62;
838
- if ($[142] !== disabled || $[143] !== readOnly) {
839
- t62 = /* @__PURE__ */ jsx("span", { className: "separator", "data-state-disabled": disabled, "data-state-read-only": readOnly, onMouseDown: _temp5, children: t61 });
840
- $[142] = disabled;
841
- $[143] = readOnly;
842
- $[144] = t62;
642
+ $[99] = calendarState;
643
+ $[100] = finalInputName;
644
+ $[101] = handleChangeUpdateDateState;
645
+ $[102] = handleChangeUpdateDateStateWithPredefinedPeriod;
646
+ $[103] = handleOnClickClearSelectedPeriod;
647
+ $[104] = hasValidationErrors;
648
+ $[105] = initialInputName;
649
+ $[106] = initialInputRef;
650
+ $[107] = maxDate;
651
+ $[108] = minDate;
652
+ $[109] = openCalendarOnFocus;
653
+ $[110] = selectedDate;
654
+ $[111] = showCalendarButton;
655
+ $[112] = showClearDateButton;
656
+ $[113] = showPredefinedPeriodsButton;
657
+ $[114] = skeletonize;
658
+ $[115] = t31;
659
+ $[116] = t32;
660
+ $[117] = t33;
661
+ $[118] = undigitable;
662
+ $[119] = t34;
663
+ } else {
664
+ t34 = $[119];
665
+ }
666
+ const contextValues = t34;
667
+ let t35;
668
+ if ($[120] !== customClassLabel || $[121] !== disabled || $[122] !== hasHintMessages || $[123] !== hasLabel || $[124] !== hintPosition || $[125] !== initialInputName || $[126] !== label || $[127] !== labelUppercase || $[128] !== popoverAlign || $[129] !== props.hint || $[130] !== props.required || $[131] !== readOnly || $[132] !== skeletonize || $[133] !== themePopover) {
669
+ t35 = hasLabel && /* @__PURE__ */ jsx(Label, { "data-testid": "test-date-period-field-label", label, inputId: initialInputName, hint: props?.hint, isDisabled: disabled, isReadOnly: readOnly, skeletonize, required: props?.required, hintPosition, themePopover, popoverAlign, labelUppercase, hasHintMessages, customClassLabel });
670
+ $[120] = customClassLabel;
671
+ $[121] = disabled;
672
+ $[122] = hasHintMessages;
673
+ $[123] = hasLabel;
674
+ $[124] = hintPosition;
675
+ $[125] = initialInputName;
676
+ $[126] = label;
677
+ $[127] = labelUppercase;
678
+ $[128] = popoverAlign;
679
+ $[129] = props.hint;
680
+ $[130] = props.required;
681
+ $[131] = readOnly;
682
+ $[132] = skeletonize;
683
+ $[133] = themePopover;
684
+ $[134] = t35;
685
+ } else {
686
+ t35 = $[134];
687
+ }
688
+ const t36 = _.omit(rest, ["initialRef", "finalRef"]);
689
+ const t37 = props?.initialRef;
690
+ let t38;
691
+ if ($[135] !== initialInputRef || $[136] !== t37) {
692
+ t38 = mergeRefs(initialInputRef, t37);
693
+ $[135] = initialInputRef;
694
+ $[136] = t37;
695
+ $[137] = t38;
843
696
  } else {
844
- t62 = $[144];
697
+ t38 = $[137];
845
698
  }
846
- const t63 = inputs2_date_base_index;
847
- const t64 = _.omit(rest, ["initialRef", "finalRef"]);
848
- const t65 = props?.finalRef;
849
- let t66;
850
- if ($[145] !== t65) {
851
- t66 = mergeRefs(finalInputRef, t65);
852
- $[145] = t65;
853
- $[146] = t66;
699
+ let t39;
700
+ if ($[138] !== handleOnBlurMaskInput) {
701
+ t39 = (event_2) => handleOnBlurMaskInput(event_2, "initial");
702
+ $[138] = handleOnBlurMaskInput;
703
+ $[139] = t39;
854
704
  } else {
855
- t66 = $[146];
705
+ t39 = $[139];
856
706
  }
857
- const t67 = !readOnly && !skeletonize ? 0 : -1;
858
- let t68;
859
- if ($[147] !== handleOnBlurMaskInput) {
860
- t68 = (event_9) => handleOnBlurMaskInput(event_9, "final");
861
- $[147] = handleOnBlurMaskInput;
862
- $[148] = t68;
707
+ let t40;
708
+ if ($[140] !== handleOnFocusMaskInput) {
709
+ t40 = (event_3) => handleOnFocusMaskInput(event_3, "initial");
710
+ $[140] = handleOnFocusMaskInput;
711
+ $[141] = t40;
863
712
  } else {
864
- t68 = $[148];
713
+ t40 = $[141];
865
714
  }
866
- let t69;
867
- if ($[149] !== handleOnFocusMaskInput) {
868
- t69 = (event_10) => handleOnFocusMaskInput(event_10, "final");
869
- $[149] = handleOnFocusMaskInput;
870
- $[150] = t69;
715
+ let t41;
716
+ if ($[142] !== handleOnKeyDownMaskInput) {
717
+ t41 = (event_4) => handleOnKeyDownMaskInput(event_4, "initial");
718
+ $[142] = handleOnKeyDownMaskInput;
719
+ $[143] = t41;
871
720
  } else {
872
- t69 = $[150];
721
+ t41 = $[143];
873
722
  }
874
- let t70;
875
- if ($[151] !== handleOnKeyDownMaskInput) {
876
- t70 = (event_11) => handleOnKeyDownMaskInput(event_11, "final");
877
- $[151] = handleOnKeyDownMaskInput;
878
- $[152] = t70;
723
+ let t42;
724
+ if ($[144] === Symbol.for("react.memo_cache_sentinel")) {
725
+ t42 = /* @__PURE__ */ jsx(Icon, { name: "arrow_right", size: 10 });
726
+ $[144] = t42;
879
727
  } else {
880
- t70 = $[152];
728
+ t42 = $[144];
881
729
  }
882
- let t71;
883
- if ($[153] !== activeDescendant || $[154] !== calendarBoxOpen || $[155] !== customClass || $[156] !== disabled || $[157] !== finalInputName || $[158] !== finalMaskedValue || $[159] !== handleOnBeforeInput || $[160] !== handleOnPaste || $[161] !== hasValidationErrors || $[162] !== placeholder || $[163] !== readOnly || $[164] !== skeletonize || $[165] !== t63.Input || $[166] !== t64 || $[167] !== t66 || $[168] !== t67 || $[169] !== t68 || $[170] !== t69 || $[171] !== t70 || $[172] !== textAlign || $[173] !== undigitable) {
884
- t71 = /* @__PURE__ */ jsx(t63.Input, { ...t64, ref: t66, id: finalInputName, name: finalInputName, value: finalMaskedValue, readOnly, disabled, customClass, tabIndex: t67, placeholder, "aria-autocomplete": "list", "aria-activedescendant": activeDescendant, "aria-expanded": calendarBoxOpen, "aria-controls": finalInputName, "aria-labelledby": finalInputName, "data-testid": "test-date-period-field-final-input", "data-state-is-period-input": true, "data-state-error": hasValidationErrors, "data-state-read-only": readOnly, "data-state-text-align": textAlign, "data-state-undigitable": undigitable, "data-state-skeletonize": skeletonize, onPaste: handleOnPaste, onBeforeInput: handleOnBeforeInput, onBlur: t68, onFocus: t69, onKeyDown: t70 });
885
- $[153] = activeDescendant;
886
- $[154] = calendarBoxOpen;
887
- $[155] = customClass;
888
- $[156] = disabled;
889
- $[157] = finalInputName;
890
- $[158] = finalMaskedValue;
891
- $[159] = handleOnBeforeInput;
892
- $[160] = handleOnPaste;
893
- $[161] = hasValidationErrors;
894
- $[162] = placeholder;
895
- $[163] = readOnly;
896
- $[164] = skeletonize;
897
- $[165] = t63.Input;
898
- $[166] = t64;
899
- $[167] = t66;
900
- $[168] = t67;
901
- $[169] = t68;
902
- $[170] = t69;
903
- $[171] = t70;
904
- $[172] = textAlign;
905
- $[173] = undigitable;
906
- $[174] = t71;
730
+ let t43;
731
+ if ($[145] !== disabled || $[146] !== readOnly) {
732
+ t43 = /* @__PURE__ */ jsx("span", { className: "separator", "data-state-disabled": disabled, "data-state-read-only": readOnly, onMouseDown: _temp2, children: t42 });
733
+ $[145] = disabled;
734
+ $[146] = readOnly;
735
+ $[147] = t43;
907
736
  } else {
908
- t71 = $[174];
737
+ t43 = $[147];
909
738
  }
910
- let t72;
911
- if ($[175] === Symbol.for("react.memo_cache_sentinel")) {
912
- t72 = /* @__PURE__ */ jsx(Triggers, {});
913
- $[175] = t72;
739
+ const t44 = inputs2_date_base_index;
740
+ const t45 = _.omit(rest, ["initialRef", "finalRef"]);
741
+ const t46 = props?.finalRef;
742
+ let t47;
743
+ if ($[148] !== t46) {
744
+ t47 = mergeRefs(finalInputRef, t46);
745
+ $[148] = t46;
746
+ $[149] = t47;
914
747
  } else {
915
- t72 = $[175];
748
+ t47 = $[149];
916
749
  }
917
- let t73;
918
- if ($[176] !== calendarBoxOpen) {
919
- t73 = calendarBoxOpen && createPortal(/* @__PURE__ */ jsx(CalendarBox, { ref: calendarRef }), document.body);
920
- $[176] = calendarBoxOpen;
921
- $[177] = t73;
922
- } else {
923
- t73 = $[177];
750
+ const t48 = !readOnly && !skeletonize ? 0 : -1;
751
+ let t49;
752
+ if ($[150] !== handleOnBlurMaskInput) {
753
+ t49 = (event_6) => handleOnBlurMaskInput(event_6, "final");
754
+ $[150] = handleOnBlurMaskInput;
755
+ $[151] = t49;
756
+ } else {
757
+ t49 = $[151];
758
+ }
759
+ let t50;
760
+ if ($[152] !== handleOnFocusMaskInput) {
761
+ t50 = (event_7) => handleOnFocusMaskInput(event_7, "final");
762
+ $[152] = handleOnFocusMaskInput;
763
+ $[153] = t50;
764
+ } else {
765
+ t50 = $[153];
766
+ }
767
+ let t51;
768
+ if ($[154] !== handleOnKeyDownMaskInput) {
769
+ t51 = (event_8) => handleOnKeyDownMaskInput(event_8, "final");
770
+ $[154] = handleOnKeyDownMaskInput;
771
+ $[155] = t51;
772
+ } else {
773
+ t51 = $[155];
774
+ }
775
+ let t52;
776
+ if ($[156] !== activeDescendant || $[157] !== calendarBoxOpen || $[158] !== customClass || $[159] !== disabled || $[160] !== finalInputName || $[161] !== finalMaskedValue || $[162] !== handleFinalKeyDownCapture || $[163] !== handleOnBeforeInput || $[164] !== handleOnPaste || $[165] !== hasValidationErrors || $[166] !== inputPlaceholder || $[167] !== readOnly || $[168] !== skeletonize || $[169] !== t44.Input || $[170] !== t45 || $[171] !== t47 || $[172] !== t48 || $[173] !== t49 || $[174] !== t50 || $[175] !== t51 || $[176] !== textAlign || $[177] !== undigitable) {
777
+ t52 = /* @__PURE__ */ jsx(t44.Input, { ...t45, ref: t47, id: finalInputName, name: finalInputName, value: finalMaskedValue, readOnly, disabled, customClass, tabIndex: t48, placeholder: inputPlaceholder, "aria-autocomplete": "list", "aria-activedescendant": activeDescendant, "aria-expanded": calendarBoxOpen, "aria-controls": finalInputName, "aria-labelledby": finalInputName, "data-testid": "test-date-period-field-final-input", "data-state-is-period-input": true, "data-state-error": hasValidationErrors, "data-state-read-only": readOnly, "data-state-text-align": textAlign, "data-state-undigitable": undigitable, "data-state-skeletonize": skeletonize, onPaste: handleOnPaste, onBeforeInput: handleOnBeforeInput, onBlur: t49, onFocus: t50, onKeyDown: t51, onKeyDownCapture: handleFinalKeyDownCapture });
778
+ $[156] = activeDescendant;
779
+ $[157] = calendarBoxOpen;
780
+ $[158] = customClass;
781
+ $[159] = disabled;
782
+ $[160] = finalInputName;
783
+ $[161] = finalMaskedValue;
784
+ $[162] = handleFinalKeyDownCapture;
785
+ $[163] = handleOnBeforeInput;
786
+ $[164] = handleOnPaste;
787
+ $[165] = hasValidationErrors;
788
+ $[166] = inputPlaceholder;
789
+ $[167] = readOnly;
790
+ $[168] = skeletonize;
791
+ $[169] = t44.Input;
792
+ $[170] = t45;
793
+ $[171] = t47;
794
+ $[172] = t48;
795
+ $[173] = t49;
796
+ $[174] = t50;
797
+ $[175] = t51;
798
+ $[176] = textAlign;
799
+ $[177] = undigitable;
800
+ $[178] = t52;
801
+ } else {
802
+ t52 = $[178];
924
803
  }
925
- let t74;
926
- if ($[178] !== disabled || $[179] !== hasHintMessages || $[180] !== hintPosition || $[181] !== props.hint || $[182] !== skeletonize) {
927
- t74 = hintPosition === "below" && /* @__PURE__ */ jsx(Hint, { customClass: "hint", description: props.hint, disabled, skeletonize, visible: hasHintMessages });
928
- $[178] = disabled;
929
- $[179] = hasHintMessages;
930
- $[180] = hintPosition;
931
- $[181] = props.hint;
932
- $[182] = skeletonize;
933
- $[183] = t74;
804
+ let t53;
805
+ if ($[179] === Symbol.for("react.memo_cache_sentinel")) {
806
+ t53 = /* @__PURE__ */ jsx(Triggers, {});
807
+ $[179] = t53;
934
808
  } else {
935
- t74 = $[183];
809
+ t53 = $[179];
936
810
  }
937
- let t75;
938
- if ($[184] !== errors || $[185] !== hasValidationErrors || $[186] !== label || $[187] !== skeletonize) {
939
- t75 = hasValidationErrors && /* @__PURE__ */ jsx("span", { "data-testid": "test-date-period-field-list-errors", className: "error", "data-state-skeletonize": skeletonize, "aria-describedby": String(label).concat("-errors"), children: errors?.map(_temp6) });
940
- $[184] = errors;
941
- $[185] = hasValidationErrors;
942
- $[186] = label;
943
- $[187] = skeletonize;
944
- $[188] = t75;
945
- } else {
946
- t75 = $[188];
811
+ let t54;
812
+ if ($[180] !== activeDescendant || $[181] !== activeSelectedDate || $[182] !== calendarBoxOpen || $[183] !== calendarDisplayDate || $[184] !== calendarRef || $[185] !== dateContainerRef || $[186] !== getDayState || $[187] !== handleNextMonth || $[188] !== handlePreviousMonth || $[189] !== handleSelectDay || $[190] !== handleSelectTime || $[191] !== initialInputName || $[192] !== isDateTime || $[193] !== maxDate || $[194] !== minDate) {
813
+ t54 = calendarBoxOpen && createPortal(/* @__PURE__ */ jsx(CalendarBox, { ref: calendarRef, testIdPrefix: "test-date-period-field", headerId: initialInputName, calendarBoxOpen, activeDescendant, calendarDisplayDate, containerRef: dateContainerRef, onNextMonth: handleNextMonth, onPreviousMonth: handlePreviousMonth, getDayState, onSelectDay: handleSelectDay, children: isDateTime && /* @__PURE__ */ jsx(TimeSelector, { value: activeSelectedDate, onSelectTime: handleSelectTime, min: minDate, max: maxDate, testIdPrefix: "test-date-period-field" }) }), document.body);
814
+ $[180] = activeDescendant;
815
+ $[181] = activeSelectedDate;
816
+ $[182] = calendarBoxOpen;
817
+ $[183] = calendarDisplayDate;
818
+ $[184] = calendarRef;
819
+ $[185] = dateContainerRef;
820
+ $[186] = getDayState;
821
+ $[187] = handleNextMonth;
822
+ $[188] = handlePreviousMonth;
823
+ $[189] = handleSelectDay;
824
+ $[190] = handleSelectTime;
825
+ $[191] = initialInputName;
826
+ $[192] = isDateTime;
827
+ $[193] = maxDate;
828
+ $[194] = minDate;
829
+ $[195] = t54;
830
+ } else {
831
+ t54 = $[195];
832
+ }
833
+ let t55;
834
+ if ($[196] !== disabled || $[197] !== hasHintMessages || $[198] !== hintPosition || $[199] !== props.hint || $[200] !== skeletonize) {
835
+ t55 = hintPosition === "below" && /* @__PURE__ */ jsx(Hint, { customClass: "hint", description: props.hint, disabled, skeletonize, visible: hasHintMessages });
836
+ $[196] = disabled;
837
+ $[197] = hasHintMessages;
838
+ $[198] = hintPosition;
839
+ $[199] = props.hint;
840
+ $[200] = skeletonize;
841
+ $[201] = t55;
842
+ } else {
843
+ t55 = $[201];
844
+ }
845
+ let t56;
846
+ if ($[202] !== errors || $[203] !== hasValidationErrors || $[204] !== label || $[205] !== skeletonize) {
847
+ t56 = hasValidationErrors && /* @__PURE__ */ jsx("span", { "data-testid": "test-date-period-field-list-errors", className: "error", "data-state-skeletonize": skeletonize, "aria-describedby": String(label).concat("-errors"), children: errors?.map(_temp3) });
848
+ $[202] = errors;
849
+ $[203] = hasValidationErrors;
850
+ $[204] = label;
851
+ $[205] = skeletonize;
852
+ $[206] = t56;
853
+ } else {
854
+ t56 = $[206];
947
855
  }
948
- let t76;
949
- if ($[189] !== tooltip || $[190] !== tooltipPosition || $[191] !== tooltipWidth) {
950
- t76 = /* @__PURE__ */ jsx(Tooltip, { targetRef: inputRootRef, text: tooltip, width: tooltipWidth, position: tooltipPosition });
951
- $[189] = tooltip;
952
- $[190] = tooltipPosition;
953
- $[191] = tooltipWidth;
954
- $[192] = t76;
856
+ let t57;
857
+ if ($[207] !== tooltip || $[208] !== tooltipPosition || $[209] !== tooltipWidth) {
858
+ t57 = /* @__PURE__ */ jsx(Tooltip, { targetRef: inputRootRef, text: tooltip, width: tooltipWidth, position: tooltipPosition });
859
+ $[207] = tooltip;
860
+ $[208] = tooltipPosition;
861
+ $[209] = tooltipWidth;
862
+ $[210] = t57;
955
863
  } else {
956
- t76 = $[192];
864
+ t57 = $[210];
957
865
  }
958
866
  return /* @__PURE__ */ jsxs(React.Fragment, { children: [
959
867
  /* @__PURE__ */ jsx(DatePeriodFieldContext.Provider, { value: contextValues, children: /* @__PURE__ */ jsxs(Root, { ref: inputRootRef, "data-testid": "test-date-period-field-root", "data-state-error": hasValidationErrors, customClassWrapper, children: [
960
- t54,
961
- /* @__PURE__ */ jsxs(Container, { ref: dateContainerRef, "data-testid": "test-date-period-field-container", onKeyDown: handleOnKeyDown, skeletonize, customClassInputContainer, children: [
962
- /* @__PURE__ */ jsx(Input, { ...t55, ref: t57, id: initialInputName, name: initialInputName, value: initialMaskedValue, disabled, readOnly, customClass, tabIndex: !readOnly && !skeletonize ? 0 : -1, placeholder, "aria-autocomplete": "list", "aria-activedescendant": activeDescendant, "aria-expanded": calendarBoxOpen, "aria-controls": initialInputName, "aria-labelledby": initialInputName, "data-testid": "test-date-period-field-initial-input", "data-state-is-period-input": true, "data-state-error": hasValidationErrors, "data-state-read-only": readOnly, "data-state-text-align": textAlign, "data-state-undigitable": undigitable, "data-state-skeletonize": skeletonize, onPaste: handleOnPaste, onBeforeInput: handleOnBeforeInput, onBlur: t58, onFocus: t59, onKeyDown: t60 }),
963
- t62,
964
- t71,
965
- t72
868
+ t35,
869
+ /* @__PURE__ */ jsxs(Container, { ref: dateContainerRef, "data-testid": "test-date-period-field-container", onKeyDown: handleKeyDownNavigation, skeletonize, customClassInputContainer, children: [
870
+ /* @__PURE__ */ jsx(Input, { ...t36, ref: t38, id: initialInputName, name: initialInputName, value: initialMaskedValue, disabled, readOnly, customClass, tabIndex: !readOnly && !skeletonize ? 0 : -1, placeholder: inputPlaceholder, "aria-autocomplete": "list", "aria-activedescendant": activeDescendant, "aria-expanded": calendarBoxOpen, "aria-controls": initialInputName, "aria-labelledby": initialInputName, "data-testid": "test-date-period-field-initial-input", "data-state-is-period-input": true, "data-state-error": hasValidationErrors, "data-state-read-only": readOnly, "data-state-text-align": textAlign, "data-state-undigitable": undigitable, "data-state-skeletonize": skeletonize, onPaste: handleOnPaste, onBeforeInput: handleOnBeforeInput, onBlur: t39, onFocus: t40, onKeyDown: t41, onKeyDownCapture: handleInitialKeyDownCapture }),
871
+ t43,
872
+ t52,
873
+ t53
966
874
  ] }),
967
- t73,
968
- t74,
969
- t75
875
+ t54,
876
+ t55,
877
+ t56
970
878
  ] }) }),
971
- t76
879
+ t57
972
880
  ] });
973
881
  });
974
882
  InputBase.displayName = "DatePeriodFieldInputBase";
975
- function _temp(prevDisplayDate) {
976
- return prevDisplayDate.clone().subtract(1, "month");
977
- }
978
- function _temp2(prevDisplayDate_0) {
979
- return prevDisplayDate_0.clone().add(1, "month");
980
- }
981
- function _temp3() {
883
+ function _temp() {
982
884
  return {
983
885
  inicial: null,
984
886
  final: null
985
887
  };
986
888
  }
987
- function _temp4(initialDate, finalDate) {
988
- const inicial = initialDate?.isAfter(finalDate) ? finalDate : initialDate;
989
- const final = initialDate?.isAfter(finalDate) ? initialDate : finalDate;
990
- return {
991
- inicial,
992
- final
993
- };
994
- }
995
- function _temp5(event_8) {
996
- event_8.preventDefault();
889
+ function _temp2(event_5) {
890
+ event_5.preventDefault();
997
891
  }
998
- function _temp6(error, index) {
892
+ function _temp3(error, index) {
999
893
  return /* @__PURE__ */ jsxs(React.Fragment, { children: [
1000
894
  error,
1001
895
  " "