@povio/ui 2.3.0-rc.20 → 2.3.0-rc.21

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.
@@ -13,12 +13,13 @@ import { TooltipWrapper } from "../../shared/TooltipWrapper.js";
13
13
  import { InputFrame } from "../../Skeleton/InputFrame.js";
14
14
  import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
15
15
  import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
16
+ import { c } from "react/compiler-runtime";
16
17
  import { jsx, jsxs } from "react/jsx-runtime";
17
18
  import { clsx } from "clsx";
18
19
  import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
19
20
  import { useDatePicker, useLocale } from "react-aria";
20
21
  import { mergeRefs } from "@react-aria/utils";
21
- import { Controller, useWatch } from "react-hook-form";
22
+ import { Controller } from "react-hook-form";
22
23
  import { createCalendar, toCalendarDate, today } from "@internationalized/date";
23
24
  import { DateTime } from "luxon";
24
25
  import { useCalendarState, useDatePickerState } from "react-stately";
@@ -236,7 +237,11 @@ var DatePickerBase = (props) => {
236
237
  })
237
238
  });
238
239
  };
239
- var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, renderStaticInput, ...props }) => {
240
+ var DatePickerInner = (t0) => {
241
+ const $ = c(28);
242
+ const { fullIso: t1, granularity: t2, minValue, maxValue, renderStaticInput, isFormControlDisabled, ...props } = t0;
243
+ const fullIso = t1 === void 0 ? true : t1;
244
+ const granularity = t2 === void 0 ? "day" : t2;
240
245
  const ui = UIConfig.useConfig();
241
246
  const datePickerInputContentRowCva = UIStyle.useCva("datePickerInput.contentRowCva", datePickerInputContentRow);
242
247
  const { locale } = useLocale();
@@ -247,43 +252,75 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
247
252
  inputRef,
248
253
  renderInput,
249
254
  setRenderInput,
250
- getFocusTarget: (input) => {
251
- const container = input.getContainer?.() ?? input;
252
- return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
253
- }
255
+ getFocusTarget: _temp
254
256
  });
255
- const watchedValue = "formControl" in props && props.formControl ? useWatch({
256
- control: props.formControl.control,
257
- name: props.formControl.name
258
- }) : props.value;
259
- let isFormControlDisabled = false;
260
- if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
261
- const rawValue = watchedValue ?? props.value ?? null;
262
- const normalizeByGranularity = (date) => {
263
- if (granularity === "year") return date.set({
264
- month: 1,
265
- day: 1
266
- });
267
- if (granularity === "month") return date.set({ day: 1 });
268
- return date;
269
- };
270
- const formatCalendarDate = (calendarDate) => {
271
- if (calendarDate === null) return null;
272
- const normalizedDate = normalizeByGranularity(calendarDate);
273
- if (fullIso) return DateTimeUtils.fromCalendarDateToUTCISO(normalizedDate);
274
- const date_0 = DateTimeUtils.fromDateValueToLocal(normalizedDate, "UTC");
275
- return DateTime.fromJSDate(date_0, { zone: "UTC" }).toISODate();
276
- };
277
- const parseCalendarDate = (formattedDate) => {
278
- if (formattedDate == null) return formattedDate;
279
- if (fullIso) return normalizeByGranularity(DateTimeUtils.fromUTCISOToCalendarDate(formattedDate));
280
- const date_1 = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
281
- return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date_1, "UTC")));
282
- };
283
- const dateLimits = {
284
- minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
285
- maxValue: typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue
286
- };
257
+ const rawValue = props.value ?? null;
258
+ let t3;
259
+ if ($[0] !== granularity) {
260
+ t3 = (date) => {
261
+ if (granularity === "year") return date.set({
262
+ month: 1,
263
+ day: 1
264
+ });
265
+ if (granularity === "month") return date.set({ day: 1 });
266
+ return date;
267
+ };
268
+ $[0] = granularity;
269
+ $[1] = t3;
270
+ } else t3 = $[1];
271
+ const normalizeByGranularity = t3;
272
+ let t4;
273
+ if ($[2] !== fullIso || $[3] !== normalizeByGranularity) {
274
+ t4 = (calendarDate) => {
275
+ if (calendarDate === null) return null;
276
+ const normalizedDate = normalizeByGranularity(calendarDate);
277
+ if (fullIso) return DateTimeUtils.fromCalendarDateToUTCISO(normalizedDate);
278
+ const date_0 = DateTimeUtils.fromDateValueToLocal(normalizedDate, "UTC");
279
+ return DateTime.fromJSDate(date_0, { zone: "UTC" }).toISODate();
280
+ };
281
+ $[2] = fullIso;
282
+ $[3] = normalizeByGranularity;
283
+ $[4] = t4;
284
+ } else t4 = $[4];
285
+ const formatCalendarDate = t4;
286
+ let t5;
287
+ if ($[5] !== fullIso || $[6] !== normalizeByGranularity) {
288
+ t5 = (formattedDate) => {
289
+ if (formattedDate == null) return formattedDate;
290
+ if (fullIso) return normalizeByGranularity(DateTimeUtils.fromUTCISOToCalendarDate(formattedDate));
291
+ const date_1 = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
292
+ return normalizeByGranularity(toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date_1, "UTC")));
293
+ };
294
+ $[5] = fullIso;
295
+ $[6] = normalizeByGranularity;
296
+ $[7] = t5;
297
+ } else t5 = $[7];
298
+ const parseCalendarDate = t5;
299
+ let t6;
300
+ if ($[8] !== minValue || $[9] !== parseCalendarDate) {
301
+ t6 = typeof minValue === "string" ? parseCalendarDate(minValue) : minValue;
302
+ $[8] = minValue;
303
+ $[9] = parseCalendarDate;
304
+ $[10] = t6;
305
+ } else t6 = $[10];
306
+ let t7;
307
+ if ($[11] !== maxValue || $[12] !== parseCalendarDate) {
308
+ t7 = typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue;
309
+ $[11] = maxValue;
310
+ $[12] = parseCalendarDate;
311
+ $[13] = t7;
312
+ } else t7 = $[13];
313
+ let t8;
314
+ if ($[14] !== t6 || $[15] !== t7) {
315
+ t8 = {
316
+ minValue: t6,
317
+ maxValue: t7
318
+ };
319
+ $[14] = t6;
320
+ $[15] = t7;
321
+ $[16] = t8;
322
+ } else t8 = $[16];
323
+ const dateLimits = t8;
287
324
  if (!renderInput) {
288
325
  const dateValue = rawValue ? parseCalendarDate(rawValue) : null;
289
326
  const as = props.as ?? ui.input.as;
@@ -331,32 +368,151 @@ var DatePicker = ({ fullIso = true, granularity = "day", minValue, maxValue, ren
331
368
  children: staticSegments
332
369
  });
333
370
  }
334
- if ("formControl" in props && props.formControl) {
335
- const { formControl, ref, ...innerProps } = props;
336
- return /* @__PURE__ */ jsx(Controller, {
337
- control: formControl.control,
338
- name: formControl.name,
339
- render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DatePickerBase, {
340
- ...innerProps,
341
- ...dateLimits,
342
- ref: mergeRefs(ref, field.ref, inputRef),
343
- value: parseCalendarDate(field.value),
344
- onChange: (value) => field.onChange(formatCalendarDate(value)),
345
- onBlur: field.onBlur,
346
- isDirty,
347
- isDisabled: field.disabled || props.isDisabled,
348
- error: props.error ?? error?.message
349
- })
371
+ const T0 = DatePickerBase;
372
+ const t9 = mergeRefs(props.ref, inputRef);
373
+ const t10 = parseCalendarDate(props.value);
374
+ let t11;
375
+ if ($[17] !== formatCalendarDate || $[18] !== props) {
376
+ t11 = (value) => props.onChange?.(formatCalendarDate(value));
377
+ $[17] = formatCalendarDate;
378
+ $[18] = props;
379
+ $[19] = t11;
380
+ } else t11 = $[19];
381
+ let t12;
382
+ if ($[20] !== T0 || $[21] !== dateLimits || $[22] !== granularity || $[23] !== props || $[24] !== t10 || $[25] !== t11 || $[26] !== t9) {
383
+ t12 = /* @__PURE__ */ jsx(T0, {
384
+ ...props,
385
+ ...dateLimits,
386
+ ref: t9,
387
+ granularity,
388
+ value: t10,
389
+ onChange: t11
350
390
  });
391
+ $[20] = T0;
392
+ $[21] = dateLimits;
393
+ $[22] = granularity;
394
+ $[23] = props;
395
+ $[24] = t10;
396
+ $[25] = t11;
397
+ $[26] = t9;
398
+ $[27] = t12;
399
+ } else t12 = $[27];
400
+ return t12;
401
+ };
402
+ var DatePicker = (t0) => {
403
+ const $ = c(33);
404
+ let maxValue;
405
+ let minValue;
406
+ let props;
407
+ let renderStaticInput;
408
+ let t1;
409
+ let t2;
410
+ if ($[0] !== t0) {
411
+ ({fullIso: t1, granularity: t2, minValue, maxValue, renderStaticInput, ...props} = t0);
412
+ $[0] = t0;
413
+ $[1] = maxValue;
414
+ $[2] = minValue;
415
+ $[3] = props;
416
+ $[4] = renderStaticInput;
417
+ $[5] = t1;
418
+ $[6] = t2;
419
+ } else {
420
+ maxValue = $[1];
421
+ minValue = $[2];
422
+ props = $[3];
423
+ renderStaticInput = $[4];
424
+ t1 = $[5];
425
+ t2 = $[6];
351
426
  }
352
- return /* @__PURE__ */ jsx(DatePickerBase, {
353
- ...props,
354
- ...dateLimits,
355
- ref: mergeRefs(props.ref, inputRef),
356
- granularity,
357
- value: parseCalendarDate(props.value),
358
- onChange: (value_0) => props.onChange?.(formatCalendarDate(value_0))
359
- });
427
+ const fullIso = t1 === void 0 ? true : t1;
428
+ const granularity = t2 === void 0 ? "day" : t2;
429
+ if ("formControl" in props && props.formControl) {
430
+ let formControl;
431
+ let innerProps;
432
+ let ref;
433
+ if ($[7] !== props) {
434
+ ({formControl, ref, ...innerProps} = props);
435
+ $[7] = props;
436
+ $[8] = formControl;
437
+ $[9] = innerProps;
438
+ $[10] = ref;
439
+ } else {
440
+ formControl = $[8];
441
+ innerProps = $[9];
442
+ ref = $[10];
443
+ }
444
+ const controlWithOptions = formControl.control;
445
+ let t3;
446
+ if ($[11] !== controlWithOptions._options?.disabled || $[12] !== fullIso || $[13] !== granularity || $[14] !== innerProps || $[15] !== maxValue || $[16] !== minValue || $[17] !== props.error || $[18] !== props.isDisabled || $[19] !== ref || $[20] !== renderStaticInput) {
447
+ t3 = (t4) => {
448
+ const { field, fieldState: t5 } = t4;
449
+ const { error, isDirty } = t5;
450
+ return /* @__PURE__ */ jsx(DatePickerInner, {
451
+ ...innerProps,
452
+ ref: mergeRefs(ref, field.ref),
453
+ value: field.value,
454
+ onChange: field.onChange,
455
+ onBlur: field.onBlur,
456
+ isDirty,
457
+ isDisabled: field.disabled || props.isDisabled,
458
+ isFormControlDisabled: !!controlWithOptions._options?.disabled,
459
+ error: props.error ?? error?.message,
460
+ fullIso,
461
+ granularity,
462
+ minValue,
463
+ maxValue,
464
+ renderStaticInput
465
+ });
466
+ };
467
+ $[11] = controlWithOptions._options?.disabled;
468
+ $[12] = fullIso;
469
+ $[13] = granularity;
470
+ $[14] = innerProps;
471
+ $[15] = maxValue;
472
+ $[16] = minValue;
473
+ $[17] = props.error;
474
+ $[18] = props.isDisabled;
475
+ $[19] = ref;
476
+ $[20] = renderStaticInput;
477
+ $[21] = t3;
478
+ } else t3 = $[21];
479
+ let t4;
480
+ if ($[22] !== formControl.control || $[23] !== formControl.name || $[24] !== t3) {
481
+ t4 = /* @__PURE__ */ jsx(Controller, {
482
+ control: formControl.control,
483
+ name: formControl.name,
484
+ render: t3
485
+ });
486
+ $[22] = formControl.control;
487
+ $[23] = formControl.name;
488
+ $[24] = t3;
489
+ $[25] = t4;
490
+ } else t4 = $[25];
491
+ return t4;
492
+ }
493
+ let t3;
494
+ if ($[26] !== fullIso || $[27] !== granularity || $[28] !== maxValue || $[29] !== minValue || $[30] !== props || $[31] !== renderStaticInput) {
495
+ t3 = /* @__PURE__ */ jsx(DatePickerInner, {
496
+ ...props,
497
+ fullIso,
498
+ granularity,
499
+ minValue,
500
+ maxValue,
501
+ renderStaticInput
502
+ });
503
+ $[26] = fullIso;
504
+ $[27] = granularity;
505
+ $[28] = maxValue;
506
+ $[29] = minValue;
507
+ $[30] = props;
508
+ $[31] = renderStaticInput;
509
+ $[32] = t3;
510
+ } else t3 = $[32];
511
+ return t3;
360
512
  };
513
+ function _temp(input) {
514
+ const container = input.getContainer?.() ?? input;
515
+ return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
516
+ }
361
517
  //#endregion
362
518
  export { DatePicker };
@@ -15,6 +15,7 @@ import { InputFrame } from "../../Skeleton/InputFrame.js";
15
15
  import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
16
16
  import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
17
17
  import { RangeCalendar } from "../shared/RangeCalendar.js";
18
+ import { c } from "react/compiler-runtime";
18
19
  import { jsx, jsxs } from "react/jsx-runtime";
19
20
  import { clsx } from "clsx";
20
21
  import { useCallback, useImperativeHandle, useMemo, useRef, useState } from "react";
@@ -22,7 +23,7 @@ import { Button } from "react-aria-components";
22
23
  import { useDateRangePicker, useLocale as useLocale$1 } from "react-aria";
23
24
  import { mergeRefs } from "@react-aria/utils";
24
25
  import { useTranslation } from "react-i18next";
25
- import { Controller, useWatch } from "react-hook-form";
26
+ import { Controller } from "react-hook-form";
26
27
  import { createCalendar, endOfMonth, endOfWeek, endOfYear, startOfMonth, startOfWeek, startOfYear, toCalendarDate, today } from "@internationalized/date";
27
28
  import { DateTime } from "luxon";
28
29
  import { useDateRangePickerState, useRangeCalendarState } from "react-stately";
@@ -565,7 +566,10 @@ var DateRangePickerBase = (props) => {
565
566
  })
566
567
  });
567
568
  };
568
- var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput, ...props }) => {
569
+ var DateRangePickerInner = (t0) => {
570
+ const $ = c(25);
571
+ const { fullIso: t1, minValue, maxValue, renderStaticInput, isFormControlDisabled, ...props } = t0;
572
+ const fullIso = t1 === void 0 ? true : t1;
569
573
  const ui = UIConfig.useConfig();
570
574
  const datePickerInputContentRowCva = UIStyle.useCva("datePickerInput.contentRowCva", datePickerInputContentRow);
571
575
  const { locale } = useLocale$1();
@@ -576,56 +580,86 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
576
580
  inputRef,
577
581
  renderInput,
578
582
  setRenderInput,
579
- getFocusTarget: (input) => {
580
- const container = input.getContainer?.() ?? input;
581
- return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
582
- }
583
+ getFocusTarget: _temp
583
584
  });
584
- const watchedValue = "formControl" in props && props.formControl ? useWatch({
585
- control: props.formControl.control,
586
- name: props.formControl.name
587
- }) : props.value;
588
- let isFormControlDisabled = false;
589
- if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
590
- const rawValue = watchedValue ?? props.value ?? null;
591
- const formatDateRange = (range) => {
592
- if (!range?.start || !range?.end) return null;
593
- if (fullIso) return {
594
- start: DateTimeUtils.fromCalendarDateToUTCISO(range.start),
595
- end: DateTimeUtils.fromCalendarDateToUTCISO(range.end, { endOfDay: true })
585
+ const rawValue = props.value ?? null;
586
+ let t2;
587
+ if ($[0] !== fullIso) {
588
+ t2 = (range) => {
589
+ if (!range?.start || !range?.end) return null;
590
+ if (fullIso) return {
591
+ start: DateTimeUtils.fromCalendarDateToUTCISO(range.start),
592
+ end: DateTimeUtils.fromCalendarDateToUTCISO(range.end, { endOfDay: true })
593
+ };
594
+ const startDate = DateTimeUtils.fromDateValueToLocal(range.start, "UTC");
595
+ const endDate = DateTimeUtils.fromDateValueToLocal(range.end, "UTC");
596
+ return {
597
+ start: DateTime.fromJSDate(startDate, { zone: "UTC" }).toISODate(),
598
+ end: DateTime.fromJSDate(endDate, { zone: "UTC" }).toISODate()
599
+ };
596
600
  };
597
- const startDate = DateTimeUtils.fromDateValueToLocal(range.start, "UTC");
598
- const endDate = DateTimeUtils.fromDateValueToLocal(range.end, "UTC");
599
- return {
600
- start: DateTime.fromJSDate(startDate, { zone: "UTC" }).toISODate(),
601
- end: DateTime.fromJSDate(endDate, { zone: "UTC" }).toISODate()
601
+ $[0] = fullIso;
602
+ $[1] = t2;
603
+ } else t2 = $[1];
604
+ const formatDateRange = t2;
605
+ let t3;
606
+ if ($[2] !== fullIso) {
607
+ t3 = (formattedRange) => {
608
+ if (!formattedRange?.start || !formattedRange?.end) return formattedRange;
609
+ if (fullIso) return {
610
+ start: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.start),
611
+ end: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.end)
612
+ };
613
+ const startDate_0 = DateTime.fromISO(formattedRange.start, { zone: "UTC" }).toJSDate();
614
+ const endDate_0 = DateTime.fromISO(formattedRange.end, { zone: "UTC" }).toJSDate();
615
+ const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(startDate_0, "UTC");
616
+ const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(endDate_0, "UTC");
617
+ return {
618
+ start: toCalendarDate(startZonedDateTime),
619
+ end: toCalendarDate(endZonedDateTime)
620
+ };
602
621
  };
603
- };
604
- const parseDateRange = (formattedRange) => {
605
- if (!formattedRange?.start || !formattedRange?.end) return formattedRange;
606
- if (fullIso) return {
607
- start: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.start),
608
- end: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.end)
622
+ $[2] = fullIso;
623
+ $[3] = t3;
624
+ } else t3 = $[3];
625
+ const parseDateRange = t3;
626
+ let t4;
627
+ if ($[4] !== fullIso) {
628
+ t4 = (formattedDate) => {
629
+ if (formattedDate == null) return formattedDate;
630
+ if (fullIso) return DateTimeUtils.fromUTCISOToCalendarDate(formattedDate);
631
+ const date = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
632
+ return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date, "UTC"));
609
633
  };
610
- const startDate_0 = DateTime.fromISO(formattedRange.start, { zone: "UTC" }).toJSDate();
611
- const endDate_0 = DateTime.fromISO(formattedRange.end, { zone: "UTC" }).toJSDate();
612
- const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(startDate_0, "UTC");
613
- const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(endDate_0, "UTC");
614
- return {
615
- start: toCalendarDate(startZonedDateTime),
616
- end: toCalendarDate(endZonedDateTime)
634
+ $[4] = fullIso;
635
+ $[5] = t4;
636
+ } else t4 = $[5];
637
+ const parseCalendarDate = t4;
638
+ let t5;
639
+ if ($[6] !== minValue || $[7] !== parseCalendarDate) {
640
+ t5 = typeof minValue === "string" ? parseCalendarDate(minValue) : minValue;
641
+ $[6] = minValue;
642
+ $[7] = parseCalendarDate;
643
+ $[8] = t5;
644
+ } else t5 = $[8];
645
+ let t6;
646
+ if ($[9] !== maxValue || $[10] !== parseCalendarDate) {
647
+ t6 = typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue;
648
+ $[9] = maxValue;
649
+ $[10] = parseCalendarDate;
650
+ $[11] = t6;
651
+ } else t6 = $[11];
652
+ let t7;
653
+ if ($[12] !== t5 || $[13] !== t6) {
654
+ t7 = {
655
+ minValue: t5,
656
+ maxValue: t6
617
657
  };
618
- };
619
- const parseCalendarDate = (formattedDate) => {
620
- if (formattedDate == null) return formattedDate;
621
- if (fullIso) return DateTimeUtils.fromUTCISOToCalendarDate(formattedDate);
622
- const date = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
623
- return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date, "UTC"));
624
- };
625
- const dateLimits = {
626
- minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
627
- maxValue: typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue
628
- };
658
+ $[12] = t5;
659
+ $[13] = t6;
660
+ $[14] = t7;
661
+ } else t7 = $[14];
662
+ const dateLimits = t7;
629
663
  if (!renderInput) {
630
664
  const startDateValue = parseCalendarDate(rawValue?.start ?? null);
631
665
  const endDateValue = parseCalendarDate(rawValue?.end ?? null);
@@ -676,31 +710,141 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
676
710
  children: staticSegments
677
711
  });
678
712
  }
679
- if ("formControl" in props && props.formControl) {
680
- const { formControl, ref, ...innerProps } = props;
681
- return /* @__PURE__ */ jsx(Controller, {
682
- control: formControl.control,
683
- name: formControl.name,
684
- render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DateRangePickerBase, {
685
- ...innerProps,
686
- ...dateLimits,
687
- ref: mergeRefs(ref, field.ref, inputRef),
688
- value: parseDateRange(field.value),
689
- onChange: (value) => field.onChange(formatDateRange(value)),
690
- onBlur: field.onBlur,
691
- isDirty,
692
- isDisabled: field.disabled || props.isDisabled,
693
- error: props.error ?? error?.message
694
- })
713
+ const T0 = DateRangePickerBase;
714
+ const t8 = mergeRefs(props.ref, inputRef);
715
+ const t9 = parseDateRange(props.value);
716
+ let t10;
717
+ if ($[15] !== formatDateRange || $[16] !== props) {
718
+ t10 = (value) => props.onChange?.(formatDateRange(value));
719
+ $[15] = formatDateRange;
720
+ $[16] = props;
721
+ $[17] = t10;
722
+ } else t10 = $[17];
723
+ let t11;
724
+ if ($[18] !== T0 || $[19] !== dateLimits || $[20] !== props || $[21] !== t10 || $[22] !== t8 || $[23] !== t9) {
725
+ t11 = /* @__PURE__ */ jsx(T0, {
726
+ ...props,
727
+ ...dateLimits,
728
+ ref: t8,
729
+ value: t9,
730
+ onChange: t10
695
731
  });
732
+ $[18] = T0;
733
+ $[19] = dateLimits;
734
+ $[20] = props;
735
+ $[21] = t10;
736
+ $[22] = t8;
737
+ $[23] = t9;
738
+ $[24] = t11;
739
+ } else t11 = $[24];
740
+ return t11;
741
+ };
742
+ var DateRangePicker = (t0) => {
743
+ const $ = c(30);
744
+ let maxValue;
745
+ let minValue;
746
+ let props;
747
+ let renderStaticInput;
748
+ let t1;
749
+ if ($[0] !== t0) {
750
+ ({fullIso: t1, minValue, maxValue, renderStaticInput, ...props} = t0);
751
+ $[0] = t0;
752
+ $[1] = maxValue;
753
+ $[2] = minValue;
754
+ $[3] = props;
755
+ $[4] = renderStaticInput;
756
+ $[5] = t1;
757
+ } else {
758
+ maxValue = $[1];
759
+ minValue = $[2];
760
+ props = $[3];
761
+ renderStaticInput = $[4];
762
+ t1 = $[5];
696
763
  }
697
- return /* @__PURE__ */ jsx(DateRangePickerBase, {
698
- ...props,
699
- ...dateLimits,
700
- ref: mergeRefs(props.ref, inputRef),
701
- value: parseDateRange(props.value),
702
- onChange: (value_0) => props.onChange?.(formatDateRange(value_0))
703
- });
764
+ const fullIso = t1 === void 0 ? true : t1;
765
+ if ("formControl" in props && props.formControl) {
766
+ let formControl;
767
+ let innerProps;
768
+ let ref;
769
+ if ($[6] !== props) {
770
+ ({formControl, ref, ...innerProps} = props);
771
+ $[6] = props;
772
+ $[7] = formControl;
773
+ $[8] = innerProps;
774
+ $[9] = ref;
775
+ } else {
776
+ formControl = $[7];
777
+ innerProps = $[8];
778
+ ref = $[9];
779
+ }
780
+ const controlWithOptions = formControl.control;
781
+ let t2;
782
+ if ($[10] !== controlWithOptions._options?.disabled || $[11] !== fullIso || $[12] !== innerProps || $[13] !== maxValue || $[14] !== minValue || $[15] !== props.error || $[16] !== props.isDisabled || $[17] !== ref || $[18] !== renderStaticInput) {
783
+ t2 = (t3) => {
784
+ const { field, fieldState: t4 } = t3;
785
+ const { error, isDirty } = t4;
786
+ return /* @__PURE__ */ jsx(DateRangePickerInner, {
787
+ ...innerProps,
788
+ ref: mergeRefs(ref, field.ref),
789
+ value: field.value,
790
+ onChange: field.onChange,
791
+ onBlur: field.onBlur,
792
+ isDirty,
793
+ isDisabled: field.disabled || props.isDisabled,
794
+ isFormControlDisabled: !!controlWithOptions._options?.disabled,
795
+ error: props.error ?? error?.message,
796
+ fullIso,
797
+ minValue,
798
+ maxValue,
799
+ renderStaticInput
800
+ });
801
+ };
802
+ $[10] = controlWithOptions._options?.disabled;
803
+ $[11] = fullIso;
804
+ $[12] = innerProps;
805
+ $[13] = maxValue;
806
+ $[14] = minValue;
807
+ $[15] = props.error;
808
+ $[16] = props.isDisabled;
809
+ $[17] = ref;
810
+ $[18] = renderStaticInput;
811
+ $[19] = t2;
812
+ } else t2 = $[19];
813
+ let t3;
814
+ if ($[20] !== formControl.control || $[21] !== formControl.name || $[22] !== t2) {
815
+ t3 = /* @__PURE__ */ jsx(Controller, {
816
+ control: formControl.control,
817
+ name: formControl.name,
818
+ render: t2
819
+ });
820
+ $[20] = formControl.control;
821
+ $[21] = formControl.name;
822
+ $[22] = t2;
823
+ $[23] = t3;
824
+ } else t3 = $[23];
825
+ return t3;
826
+ }
827
+ let t2;
828
+ if ($[24] !== fullIso || $[25] !== maxValue || $[26] !== minValue || $[27] !== props || $[28] !== renderStaticInput) {
829
+ t2 = /* @__PURE__ */ jsx(DateRangePickerInner, {
830
+ ...props,
831
+ fullIso,
832
+ minValue,
833
+ maxValue,
834
+ renderStaticInput
835
+ });
836
+ $[24] = fullIso;
837
+ $[25] = maxValue;
838
+ $[26] = minValue;
839
+ $[27] = props;
840
+ $[28] = renderStaticInput;
841
+ $[29] = t2;
842
+ } else t2 = $[29];
843
+ return t2;
704
844
  };
845
+ function _temp(input) {
846
+ const container = input.getContainer?.() ?? input;
847
+ return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
848
+ }
705
849
  //#endregion
706
850
  export { DateRangePicker };
@@ -35,5 +35,5 @@ export interface DateTimePickerProps extends Omit<DateTimePickerBaseProps, "valu
35
35
  timeZone?: string;
36
36
  }
37
37
  export type ControlledDateTimePickerProps<TFieldValues extends FieldValues> = ControlProps<DateTimePickerProps, TFieldValues>;
38
- export declare const DateTimePicker: <TFieldValues extends FieldValues>({ fullIso: _fullIso, renderStaticInput, ...props }: ControlledDateTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
38
+ export declare const DateTimePicker: <TFieldValues extends FieldValues>({ fullIso, renderStaticInput, ...props }: ControlledDateTimePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
39
39
  export {};