linear-react-components-ui 2.1.0-beta.5 → 2.2.0-beta.0

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