linear-react-components-ui 2.2.0-beta.1 → 2.2.0-beta.10

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 (63) hide show
  1. package/lib/assets/styles/datepicker2.css +81 -11
  2. package/lib/hooks/useScrollEndReached/index.d.ts +1 -1
  3. package/lib/hooks/useScrollEndReached/index.js +48 -82
  4. package/lib/hooks/useScrollEndReached/index.js.map +1 -1
  5. package/lib/hooks/useScrollEndReached/types.d.ts +1 -0
  6. package/lib/inputs/select/Dropdown.js +11 -1
  7. package/lib/inputs/select/Dropdown.js.map +1 -1
  8. package/lib/inputs/select/multiple/index.js +5 -2
  9. package/lib/inputs/select/multiple/index.js.map +1 -1
  10. package/lib/inputs/select/simple/index.js +5 -2
  11. package/lib/inputs/select/simple/index.js.map +1 -1
  12. package/lib/inputs/select/types.d.ts +3 -2
  13. package/lib/inputs/types.d.ts +2 -1
  14. package/lib/inputs2/date/calendarbox.d.ts +23 -0
  15. package/lib/inputs2/date/calendarbox.js +254 -0
  16. package/lib/inputs2/date/calendarbox.js.map +1 -0
  17. package/lib/inputs2/date/datefield/base.js +691 -214
  18. package/lib/inputs2/date/datefield/base.js.map +1 -1
  19. package/lib/inputs2/date/datefield/triggers.js +4 -4
  20. package/lib/inputs2/date/datefield/triggers.js.map +1 -1
  21. package/lib/inputs2/date/datefield/types.d.ts +5 -12
  22. package/lib/inputs2/date/dateperiodfield/base.js +694 -809
  23. package/lib/inputs2/date/dateperiodfield/base.js.map +1 -1
  24. package/lib/inputs2/date/dateperiodfield/triggers.js +21 -9
  25. package/lib/inputs2/date/dateperiodfield/triggers.js.map +1 -1
  26. package/lib/inputs2/date/dateperiodfield/types.d.ts +13 -23
  27. package/lib/inputs2/date/helpers.d.ts +44 -4
  28. package/lib/inputs2/date/helpers.js +200 -4
  29. package/lib/inputs2/date/helpers.js.map +1 -1
  30. package/lib/inputs2/date/{base/constants.d.ts → hooks/useCalendarPosition.d.ts} +1 -1
  31. package/lib/inputs2/date/hooks/useCalendarPosition.js +93 -0
  32. package/lib/inputs2/date/hooks/useCalendarPosition.js.map +1 -0
  33. package/lib/inputs2/date/hooks/useDateCalendarState.d.ts +14 -0
  34. package/lib/inputs2/date/hooks/useDateCalendarState.js +250 -0
  35. package/lib/inputs2/date/hooks/useDateCalendarState.js.map +1 -0
  36. package/lib/inputs2/date/hooks/useDateMask.d.ts +22 -0
  37. package/lib/inputs2/date/hooks/useDateMask.js +143 -0
  38. package/lib/inputs2/date/hooks/useDateMask.js.map +1 -0
  39. package/lib/inputs2/date/timeselector.d.ts +17 -0
  40. package/lib/inputs2/date/timeselector.js +226 -0
  41. package/lib/inputs2/date/timeselector.js.map +1 -0
  42. package/lib/inputs2/date/types.d.ts +22 -1
  43. package/lib/inputs2/date/types.js.map +1 -1
  44. package/lib/inputs2/selectfield/base.js +2 -1
  45. package/lib/inputs2/selectfield/base.js.map +1 -1
  46. package/lib/inputs2/selectfield/listbox.js +3 -1
  47. package/lib/inputs2/selectfield/listbox.js.map +1 -1
  48. package/lib/node_modules/moment/dist/locale/pt-br.js +54 -0
  49. package/lib/node_modules/moment/dist/locale/pt-br.js.map +1 -0
  50. package/lib/panel/Content.js +18 -15
  51. package/lib/panel/Content.js.map +1 -1
  52. package/lib/panel/Default.d.ts +1 -1
  53. package/lib/panel/Default.js +60 -54
  54. package/lib/panel/Default.js.map +1 -1
  55. package/package.json +1 -1
  56. package/lib/inputs2/date/base/constants.js +0 -69
  57. package/lib/inputs2/date/base/constants.js.map +0 -1
  58. package/lib/inputs2/date/datefield/calendarbox.d.ts +0 -6
  59. package/lib/inputs2/date/datefield/calendarbox.js +0 -228
  60. package/lib/inputs2/date/datefield/calendarbox.js.map +0 -1
  61. package/lib/inputs2/date/dateperiodfield/calendarbox.d.ts +0 -6
  62. package/lib/inputs2/date/dateperiodfield/calendarbox.js +0 -282
  63. 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 { parseBoundary, TOKEN_ISO_FORMAT, parseDateValue, getDateFormats, getPredefinedPeriodRange, clampDateToBounds, isDayOutOfBounds, resolveAssumedTime, completePartialDateTime, getTimeSelection, formatPartialDateTime } 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(155);
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;
203
- } else {
204
- t29 = $[16];
205
- }
206
- const hasLabel = !t29;
207
- const hasHintMessages = Boolean(props.hint?.length);
208
- 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;
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;
253
187
  } else {
254
- t35 = $[22];
188
+ t22 = $[10];
255
189
  }
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;
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;
268
197
  } else {
269
- t36 = $[24];
198
+ t23 = $[12];
270
199
  }
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");
200
+ const hasLabel = !t23;
201
+ const hasHintMessages = Boolean(props.hint?.length);
202
+ 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()
282
214
  }
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?.({
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?.({
313
222
  target: {
314
223
  name: props.name,
315
224
  value: {
@@ -318,684 +227,660 @@ 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] = t24;
243
+ } else {
244
+ t24 = $[20];
245
+ }
246
+ const handleOnClickClearSelectedPeriod = t24;
337
247
  const handleChangeUpdateDateState = (params) => {
338
248
  const {
339
249
  date: date_1,
340
- inputType,
250
+ inputType: inputType_0,
341
251
  typing
342
252
  } = params;
343
253
  const rawDate = date_1.clone();
344
- const verifyDateRangeOrder = _temp4;
345
- bb185: switch (inputType) {
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) {
346
269
  case "initial": {
347
270
  setSelectedDate((prevSelectedDate_0) => {
348
271
  const {
349
- inicial: inicial_2,
350
- final: final_2
351
- } = verifyDateRangeOrder(rawDate, prevSelectedDate_0.final);
272
+ inicial: inicial_3,
273
+ final: final_3
274
+ } = resolveDateRange(rawDate, prevSelectedDate_0.final);
352
275
  const updatedState_0 = {
353
- inicial: inicial_2,
354
- final: final_2
276
+ inicial: inicial_3,
277
+ final: final_3
355
278
  };
356
279
  return updatedState_0;
357
280
  });
358
281
  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
- });
282
+ inicial: inicial_4,
283
+ final: final_4
284
+ } = resolveDateRange(rawDate, selectedDate.final);
285
+ emitPeriodChange(inicial_4, final_4);
371
286
  requestAnimationFrame(() => {
372
- if (!typing) {
287
+ if (!typing && !isDateTime) {
373
288
  finalInputRef.current?.focus?.();
374
289
  }
375
290
  });
376
- break bb185;
291
+ break bb223;
377
292
  }
378
293
  case "final": {
379
294
  setSelectedDate((prevSelectedDate) => {
380
295
  const {
381
- inicial: inicial_0,
382
- final: final_0
383
- } = verifyDateRangeOrder(prevSelectedDate.inicial, rawDate);
296
+ inicial: inicial_1,
297
+ final: final_1
298
+ } = resolveDateRange(prevSelectedDate.inicial, rawDate);
384
299
  const updatedState = {
385
- inicial: inicial_0,
386
- final: final_0
300
+ inicial: inicial_1,
301
+ final: final_1
387
302
  };
388
303
  return updatedState;
389
304
  });
390
305
  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);
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);
405
312
  }
406
- break bb185;
313
+ break bb223;
407
314
  }
408
315
  }
409
- setCalendarDisplayDate(rawDate.clone());
316
+ handleChangeActiveDescendant(rawDate.format(TOKEN_ISO_FORMAT));
317
+ handleChangeCalendarDisplayDate(rawDate.clone());
410
318
  };
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()
418
- };
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
- });
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()
432
354
  };
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;
355
+ setSelectedDate(() => {
356
+ const updatedState_1 = {
357
+ inicial: initialDate_0.clone(),
358
+ final: finalDate_0.clone()
359
+ };
360
+ return updatedState_1;
361
+ });
362
+ onChange?.({
363
+ target: {
364
+ name: props.name,
365
+ value: valueToUpdate
468
366
  }
469
- }
470
- finalInputRef?.current?.focus?.();
471
- if (shouldCloseOnSelect) {
472
- handleChangeCalendarBoxState(false);
473
- }
367
+ });
474
368
  };
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
- }
504
- }
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
- }
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
520
399
  };
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) => {
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));
431
+ }
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) => {
541
454
  props?.onFocus?.(event_0);
542
455
  if (!readOnly && !calendarBoxOpen && openCalendarOnFocus) {
543
- setCalendarBoxOpen(true);
456
+ handleSetCalendarBoxOpen(true);
544
457
  }
545
- if (inputType_1 === "initial") {
458
+ setActiveInputType(inputType_4);
459
+ if (inputType_4 === "initial") {
546
460
  handleChangeActiveDescendant((selectedDate.inicial ?? hooks()).format(TOKEN_ISO_FORMAT));
547
- setCalendarDisplayDate(selectedDate.inicial ?? hooks());
461
+ handleChangeCalendarDisplayDate(selectedDate.inicial ?? hooks());
548
462
  }
549
- if (inputType_1 === "final") {
463
+ if (inputType_4 === "final") {
550
464
  handleChangeActiveDescendant((selectedDate.final ?? hooks()).format(TOKEN_ISO_FORMAT));
551
- setCalendarDisplayDate(selectedDate.final ?? hooks());
465
+ handleChangeCalendarDisplayDate(selectedDate.final ?? hooks());
552
466
  }
553
467
  };
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
- });
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)
577
499
  }
578
500
  };
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);
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";
595
508
  }
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);
509
+ if (focusedInputId === finalInputName) {
510
+ return "final";
611
511
  }
612
512
  };
613
- $[74] = props;
614
- $[75] = undigitable;
615
- $[76] = t45;
513
+ $[36] = finalInputName;
514
+ $[37] = initialInputName;
515
+ $[38] = t27;
616
516
  } else {
617
- t45 = $[76];
517
+ t27 = $[38];
618
518
  }
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,
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,
718
610
  undigitable,
719
611
  skeletonize,
720
- dateContainerRef,
721
- calendarBoxOpen,
722
- activeDescendant,
723
612
  selectedDate,
613
+ minDate,
614
+ maxDate,
724
615
  initialInputId: initialInputName,
725
616
  finalInputId: finalInputName,
726
617
  initialInputRef,
727
618
  finalInputRef,
728
619
  showCalendarButton,
729
- calendarDisplayDate,
730
620
  hasValidationErrors,
731
621
  openCalendarOnFocus,
732
622
  showPredefinedPeriodsButton,
733
623
  showClearDateButton,
734
- handleChangeSelectedDate,
735
- handleChangePreviousMonth,
736
- handleChangeNextMonth,
737
- handleChangeCalendarBoxState,
738
- handleChangeActiveDescendant,
739
- handleChangeCalendarDisplayDate,
740
- handleChangeUpdateDateState,
624
+ handleChangeUpdateDateState: t30,
741
625
  handleOnClickClearSelectedPeriod,
742
626
  handleChangeUpdateDateStateWithPredefinedPeriod,
743
- hasValidPeriodSelected: t52
627
+ hasValidPeriodSelected: t31
744
628
  };
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;
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;
834
684
  } else {
835
- t61 = $[141];
685
+ t36 = $[78];
836
686
  }
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;
687
+ let t37;
688
+ if ($[79] !== handleOnBlurMaskInput) {
689
+ t37 = (event_2) => handleOnBlurMaskInput(event_2, "initial");
690
+ $[79] = handleOnBlurMaskInput;
691
+ $[80] = t37;
843
692
  } else {
844
- t62 = $[144];
693
+ t37 = $[80];
845
694
  }
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;
695
+ let t38;
696
+ if ($[81] !== handleOnFocusMaskInput) {
697
+ t38 = (event_3) => handleOnFocusMaskInput(event_3, "initial");
698
+ $[81] = handleOnFocusMaskInput;
699
+ $[82] = t38;
854
700
  } else {
855
- t66 = $[146];
701
+ t38 = $[82];
856
702
  }
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;
703
+ let t39;
704
+ if ($[83] !== handleOnKeyDownMaskInput) {
705
+ t39 = (event_4) => handleOnKeyDownMaskInput(event_4, "initial");
706
+ $[83] = handleOnKeyDownMaskInput;
707
+ $[84] = t39;
863
708
  } else {
864
- t68 = $[148];
709
+ t39 = $[84];
865
710
  }
866
- let t69;
867
- if ($[149] !== handleOnFocusMaskInput) {
868
- t69 = (event_10) => handleOnFocusMaskInput(event_10, "final");
869
- $[149] = handleOnFocusMaskInput;
870
- $[150] = t69;
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;
871
715
  } else {
872
- t69 = $[150];
716
+ t40 = $[85];
873
717
  }
874
- let t70;
875
- if ($[151] !== handleOnKeyDownMaskInput) {
876
- t70 = (event_11) => handleOnKeyDownMaskInput(event_11, "final");
877
- $[151] = handleOnKeyDownMaskInput;
878
- $[152] = t70;
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;
879
724
  } else {
880
- t70 = $[152];
725
+ t41 = $[88];
881
726
  }
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;
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;
907
736
  } else {
908
- t71 = $[174];
737
+ t45 = $[91];
909
738
  }
910
- let t72;
911
- if ($[175] === Symbol.for("react.memo_cache_sentinel")) {
912
- t72 = /* @__PURE__ */ jsx(Triggers, {});
913
- $[175] = t72;
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;
914
745
  } else {
915
- t72 = $[175];
746
+ t47 = $[93];
916
747
  }
917
- let t73;
918
- if ($[176] !== calendarBoxOpen) {
919
- t73 = calendarBoxOpen && createPortal(/* @__PURE__ */ jsx(CalendarBox, { ref: calendarRef }), document.body);
920
- $[176] = calendarBoxOpen;
921
- $[177] = t73;
748
+ let t48;
749
+ if ($[94] !== handleOnFocusMaskInput) {
750
+ t48 = (event_7) => handleOnFocusMaskInput(event_7, "final");
751
+ $[94] = handleOnFocusMaskInput;
752
+ $[95] = t48;
922
753
  } else {
923
- t73 = $[177];
754
+ t48 = $[95];
924
755
  }
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];
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];
936
823
  }
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;
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;
945
833
  } else {
946
- t75 = $[188];
834
+ t53 = $[145];
947
835
  }
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];
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];
957
856
  }
958
857
  return /* @__PURE__ */ jsxs(React.Fragment, { children: [
959
858
  /* @__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
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
966
865
  ] }),
967
- t73,
968
- t74,
969
- t75
866
+ t52,
867
+ t53,
868
+ t54
970
869
  ] }) }),
971
- t76
870
+ t55
972
871
  ] });
973
872
  });
974
873
  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() {
874
+ function _temp() {
982
875
  return {
983
876
  inicial: null,
984
877
  final: null
985
878
  };
986
879
  }
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();
880
+ function _temp2(event_5) {
881
+ event_5.preventDefault();
997
882
  }
998
- function _temp6(error, index) {
883
+ function _temp3(error, index) {
999
884
  return /* @__PURE__ */ jsxs(React.Fragment, { children: [
1000
885
  error,
1001
886
  " "