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

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 { 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 { Time, createCalendar, toCalendarDate, toCalendarDateTime, today } from "@internationalized/date";
23
24
  import { useCalendarState, useDatePickerState } from "react-stately";
24
25
  //#region src/components/inputs/DateTime/DateTimePicker/DateTimePicker.tsx
@@ -236,7 +237,9 @@ var DateTimePickerBase = (props) => {
236
237
  })
237
238
  });
238
239
  };
239
- var DateTimePicker = ({ fullIso: _fullIso = true, renderStaticInput, ...props }) => {
240
+ var DateTimePickerInner = (t0) => {
241
+ const $ = c(9);
242
+ const { fullIso: t1, renderStaticInput, isFormControlDisabled, ...props } = t0;
240
243
  const ui = UIConfig.useConfig();
241
244
  const datePickerInputContentRowCva = UIStyle.useCva("datePickerInput.contentRowCva", datePickerInputContentRow);
242
245
  const { locale } = useLocale();
@@ -247,27 +250,11 @@ var DateTimePicker = ({ fullIso: _fullIso = true, renderStaticInput, ...props })
247
250
  inputRef,
248
251
  renderInput,
249
252
  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
- }
253
+ getFocusTarget: _temp
254
254
  });
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 effectiveTimeZone = "UTC";
263
- const formatDateValue = (dateValue) => {
264
- if (dateValue === null) return null;
265
- return DateTimeUtils.fromDateValueFieldsToUTCISO(dateValue);
266
- };
267
- const parseDateValue = (isoString) => {
268
- if (isoString == null) return isoString;
269
- return DateTimeUtils.fromUTCISOToCalendarDateTime(isoString, effectiveTimeZone);
270
- };
255
+ const rawValue = props.value ?? null;
256
+ const formatDateValue = _temp2;
257
+ const parseDateValue = _temp3;
271
258
  if (!renderInput) {
272
259
  const dateTimeValue = rawValue ? parseDateValue(rawValue) : null;
273
260
  const as = props.as ?? ui.input.as;
@@ -315,29 +302,133 @@ var DateTimePicker = ({ fullIso: _fullIso = true, renderStaticInput, ...props })
315
302
  children: staticSegments
316
303
  });
317
304
  }
318
- if ("formControl" in props && props.formControl) {
319
- const { formControl, ref, ...innerProps } = props;
320
- return /* @__PURE__ */ jsx(Controller, {
321
- control: formControl.control,
322
- name: formControl.name,
323
- render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DateTimePickerBase, {
324
- ...innerProps,
325
- ref: mergeRefs(ref, field.ref, inputRef),
326
- value: parseDateValue(field.value),
327
- onChange: (value) => field.onChange(formatDateValue(value)),
328
- onBlur: field.onBlur,
329
- isDirty,
330
- isDisabled: field.disabled || props.isDisabled,
331
- error: props.error ?? error?.message
332
- })
305
+ const T0 = DateTimePickerBase;
306
+ const t2 = mergeRefs(props.ref, inputRef);
307
+ const t3 = parseDateValue(props.value);
308
+ let t4;
309
+ if ($[0] !== formatDateValue || $[1] !== props) {
310
+ t4 = (value) => props.onChange?.(formatDateValue(value));
311
+ $[0] = formatDateValue;
312
+ $[1] = props;
313
+ $[2] = t4;
314
+ } else t4 = $[2];
315
+ let t5;
316
+ if ($[3] !== T0 || $[4] !== props || $[5] !== t2 || $[6] !== t3 || $[7] !== t4) {
317
+ t5 = /* @__PURE__ */ jsx(T0, {
318
+ ...props,
319
+ ref: t2,
320
+ value: t3,
321
+ onChange: t4
333
322
  });
323
+ $[3] = T0;
324
+ $[4] = props;
325
+ $[5] = t2;
326
+ $[6] = t3;
327
+ $[7] = t4;
328
+ $[8] = t5;
329
+ } else t5 = $[8];
330
+ return t5;
331
+ };
332
+ var DateTimePicker = (t0) => {
333
+ const $ = c(24);
334
+ let props;
335
+ let renderStaticInput;
336
+ let t1;
337
+ if ($[0] !== t0) {
338
+ ({fullIso: t1, renderStaticInput, ...props} = t0);
339
+ $[0] = t0;
340
+ $[1] = props;
341
+ $[2] = renderStaticInput;
342
+ $[3] = t1;
343
+ } else {
344
+ props = $[1];
345
+ renderStaticInput = $[2];
346
+ t1 = $[3];
334
347
  }
335
- return /* @__PURE__ */ jsx(DateTimePickerBase, {
336
- ...props,
337
- ref: mergeRefs(props.ref, inputRef),
338
- value: parseDateValue(props.value),
339
- onChange: (value_0) => props.onChange?.(formatDateValue(value_0))
340
- });
348
+ const fullIso = t1 === void 0 ? true : t1;
349
+ if ("formControl" in props && props.formControl) {
350
+ let formControl;
351
+ let innerProps;
352
+ let ref;
353
+ if ($[4] !== props) {
354
+ ({formControl, ref, ...innerProps} = props);
355
+ $[4] = props;
356
+ $[5] = formControl;
357
+ $[6] = innerProps;
358
+ $[7] = ref;
359
+ } else {
360
+ formControl = $[5];
361
+ innerProps = $[6];
362
+ ref = $[7];
363
+ }
364
+ const controlWithOptions = formControl.control;
365
+ let t2;
366
+ if ($[8] !== controlWithOptions._options?.disabled || $[9] !== fullIso || $[10] !== innerProps || $[11] !== props.error || $[12] !== props.isDisabled || $[13] !== ref || $[14] !== renderStaticInput) {
367
+ t2 = (t3) => {
368
+ const { field, fieldState: t4 } = t3;
369
+ const { error, isDirty } = t4;
370
+ return /* @__PURE__ */ jsx(DateTimePickerInner, {
371
+ ...innerProps,
372
+ ref: mergeRefs(ref, field.ref),
373
+ value: field.value,
374
+ onChange: field.onChange,
375
+ onBlur: field.onBlur,
376
+ isDirty,
377
+ isDisabled: field.disabled || props.isDisabled,
378
+ isFormControlDisabled: !!controlWithOptions._options?.disabled,
379
+ error: props.error ?? error?.message,
380
+ fullIso,
381
+ renderStaticInput
382
+ });
383
+ };
384
+ $[8] = controlWithOptions._options?.disabled;
385
+ $[9] = fullIso;
386
+ $[10] = innerProps;
387
+ $[11] = props.error;
388
+ $[12] = props.isDisabled;
389
+ $[13] = ref;
390
+ $[14] = renderStaticInput;
391
+ $[15] = t2;
392
+ } else t2 = $[15];
393
+ let t3;
394
+ if ($[16] !== formControl.control || $[17] !== formControl.name || $[18] !== t2) {
395
+ t3 = /* @__PURE__ */ jsx(Controller, {
396
+ control: formControl.control,
397
+ name: formControl.name,
398
+ render: t2
399
+ });
400
+ $[16] = formControl.control;
401
+ $[17] = formControl.name;
402
+ $[18] = t2;
403
+ $[19] = t3;
404
+ } else t3 = $[19];
405
+ return t3;
406
+ }
407
+ let t2;
408
+ if ($[20] !== fullIso || $[21] !== props || $[22] !== renderStaticInput) {
409
+ t2 = /* @__PURE__ */ jsx(DateTimePickerInner, {
410
+ ...props,
411
+ fullIso,
412
+ renderStaticInput
413
+ });
414
+ $[20] = fullIso;
415
+ $[21] = props;
416
+ $[22] = renderStaticInput;
417
+ $[23] = t2;
418
+ } else t2 = $[23];
419
+ return t2;
341
420
  };
421
+ function _temp(input) {
422
+ const container = input.getContainer?.() ?? input;
423
+ return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
424
+ }
425
+ function _temp2(dateValue) {
426
+ if (dateValue === null) return null;
427
+ return DateTimeUtils.fromDateValueFieldsToUTCISO(dateValue);
428
+ }
429
+ function _temp3(isoString) {
430
+ if (isoString == null) return isoString;
431
+ return DateTimeUtils.fromUTCISOToCalendarDateTime(isoString, "UTC");
432
+ }
342
433
  //#endregion
343
434
  export { DateTimePicker };
@@ -16,7 +16,7 @@ import { clsx } from "clsx";
16
16
  import { useEffect, useRef, useState } from "react";
17
17
  import { useLocale, useTimeField } from "react-aria";
18
18
  import { mergeRefs } from "@react-aria/utils";
19
- import { Controller, useWatch } from "react-hook-form";
19
+ import { Controller } from "react-hook-form";
20
20
  import { now, toTime } from "@internationalized/date";
21
21
  import { DateTime } from "luxon";
22
22
  import { useTimeFieldState } from "react-stately";
@@ -421,9 +421,10 @@ var TimePickerBase = (props) => {
421
421
  } else t24 = $[132];
422
422
  return t24;
423
423
  };
424
- var TimePicker = ({ renderStaticInput, ...props }) => {
424
+ var TimePickerInner = (t0) => {
425
+ const $ = c(9);
426
+ const { renderStaticInput, isFormControlDisabled, ...props } = t0;
425
427
  const ui = UIConfig.useConfig();
426
- const effectiveTimeZone = "UTC";
427
428
  const { locale } = useLocale();
428
429
  const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
429
430
  const inputRef = useRef(null);
@@ -431,28 +432,19 @@ var TimePicker = ({ renderStaticInput, ...props }) => {
431
432
  inputRef,
432
433
  renderInput,
433
434
  setRenderInput,
434
- getFocusTarget: (input) => input.querySelector("input, button, [tabindex]:not([tabindex='-1'])")
435
+ getFocusTarget: _temp
435
436
  });
436
- const watchedValue = "formControl" in props && props.formControl ? useWatch({
437
- control: props.formControl.control,
438
- name: props.formControl.name
439
- }) : props.value;
440
- let isFormControlDisabled = false;
441
- if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
442
- const rawValue = watchedValue ?? props.value ?? null;
437
+ const rawValue = props.value ?? null;
443
438
  const formatTimeValue = (timeValue) => {
444
439
  if (timeValue === null) return null;
445
440
  let parsedDate;
446
- if (props.date) parsedDate = DateTime.fromISO(props.date, { zone: effectiveTimeZone }).toJSDate();
447
- let dateValue = now(effectiveTimeZone);
448
- if (parsedDate) dateValue = DateTimeUtils.fromLocalToZonedDateTime(parsedDate, effectiveTimeZone);
441
+ if (props.date) parsedDate = DateTime.fromISO(props.date, { zone: "UTC" }).toJSDate();
442
+ let dateValue = now("UTC");
443
+ if (parsedDate) dateValue = DateTimeUtils.fromLocalToZonedDateTime(parsedDate, "UTC");
449
444
  const dateTimeValue = dateValue.set(timeValue);
450
- return DateTimeUtils.fromDateValueToISO(dateTimeValue, effectiveTimeZone);
451
- };
452
- const parseTimeValue = (isoString) => {
453
- if (isoString == null) return isoString;
454
- return toTime(DateTimeUtils.fromISOtoZonedDateTime(isoString, effectiveTimeZone));
445
+ return DateTimeUtils.fromDateValueToISO(dateTimeValue, "UTC");
455
446
  };
447
+ const parseTimeValue = _temp2;
456
448
  if (!renderInput) {
457
449
  const timeValue_0 = rawValue ? parseTimeValue(rawValue) : null;
458
450
  const as = props.as ?? ui.input.as;
@@ -490,29 +482,120 @@ var TimePicker = ({ renderStaticInput, ...props }) => {
490
482
  children: staticSegments
491
483
  });
492
484
  }
493
- if ("formControl" in props && props.formControl) {
494
- const { formControl, ref, ...innerProps } = props;
495
- return /* @__PURE__ */ jsx(Controller, {
496
- control: formControl.control,
497
- name: formControl.name,
498
- render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(TimePickerBase, {
499
- ...innerProps,
500
- ref: mergeRefs(ref, field.ref, inputRef),
501
- value: parseTimeValue(field.value),
502
- onChange: (value) => field.onChange(formatTimeValue(value)),
503
- onBlur: field.onBlur,
504
- isDirty,
505
- isDisabled: field.disabled || props.isDisabled,
506
- error: props.error ?? error?.message
507
- })
485
+ const T0 = TimePickerBase;
486
+ const t1 = mergeRefs(props.ref, inputRef);
487
+ const t2 = parseTimeValue(props.value);
488
+ let t3;
489
+ if ($[0] !== formatTimeValue || $[1] !== props) {
490
+ t3 = (value) => props.onChange?.(formatTimeValue(value));
491
+ $[0] = formatTimeValue;
492
+ $[1] = props;
493
+ $[2] = t3;
494
+ } else t3 = $[2];
495
+ let t4;
496
+ if ($[3] !== T0 || $[4] !== props || $[5] !== t1 || $[6] !== t2 || $[7] !== t3) {
497
+ t4 = /* @__PURE__ */ jsx(T0, {
498
+ ...props,
499
+ ref: t1,
500
+ value: t2,
501
+ onChange: t3
508
502
  });
503
+ $[3] = T0;
504
+ $[4] = props;
505
+ $[5] = t1;
506
+ $[6] = t2;
507
+ $[7] = t3;
508
+ $[8] = t4;
509
+ } else t4 = $[8];
510
+ return t4;
511
+ };
512
+ var TimePicker = (t0) => {
513
+ const $ = c(21);
514
+ let props;
515
+ let renderStaticInput;
516
+ if ($[0] !== t0) {
517
+ ({renderStaticInput, ...props} = t0);
518
+ $[0] = t0;
519
+ $[1] = props;
520
+ $[2] = renderStaticInput;
521
+ } else {
522
+ props = $[1];
523
+ renderStaticInput = $[2];
509
524
  }
510
- return /* @__PURE__ */ jsx(TimePickerBase, {
511
- ...props,
512
- ref: mergeRefs(props.ref, inputRef),
513
- value: parseTimeValue(props.value),
514
- onChange: (value_0) => props.onChange?.(formatTimeValue(value_0))
515
- });
525
+ if ("formControl" in props && props.formControl) {
526
+ let formControl;
527
+ let innerProps;
528
+ let ref;
529
+ if ($[3] !== props) {
530
+ ({formControl, ref, ...innerProps} = props);
531
+ $[3] = props;
532
+ $[4] = formControl;
533
+ $[5] = innerProps;
534
+ $[6] = ref;
535
+ } else {
536
+ formControl = $[4];
537
+ innerProps = $[5];
538
+ ref = $[6];
539
+ }
540
+ const controlWithOptions = formControl.control;
541
+ let t1;
542
+ if ($[7] !== controlWithOptions._options?.disabled || $[8] !== innerProps || $[9] !== props.error || $[10] !== props.isDisabled || $[11] !== ref || $[12] !== renderStaticInput) {
543
+ t1 = (t2) => {
544
+ const { field, fieldState: t3 } = t2;
545
+ const { error, isDirty } = t3;
546
+ return /* @__PURE__ */ jsx(TimePickerInner, {
547
+ ...innerProps,
548
+ ref: mergeRefs(ref, field.ref),
549
+ value: field.value,
550
+ onChange: field.onChange,
551
+ onBlur: field.onBlur,
552
+ isDirty,
553
+ isDisabled: field.disabled || props.isDisabled,
554
+ isFormControlDisabled: !!controlWithOptions._options?.disabled,
555
+ error: props.error ?? error?.message,
556
+ renderStaticInput
557
+ });
558
+ };
559
+ $[7] = controlWithOptions._options?.disabled;
560
+ $[8] = innerProps;
561
+ $[9] = props.error;
562
+ $[10] = props.isDisabled;
563
+ $[11] = ref;
564
+ $[12] = renderStaticInput;
565
+ $[13] = t1;
566
+ } else t1 = $[13];
567
+ let t2;
568
+ if ($[14] !== formControl.control || $[15] !== formControl.name || $[16] !== t1) {
569
+ t2 = /* @__PURE__ */ jsx(Controller, {
570
+ control: formControl.control,
571
+ name: formControl.name,
572
+ render: t1
573
+ });
574
+ $[14] = formControl.control;
575
+ $[15] = formControl.name;
576
+ $[16] = t1;
577
+ $[17] = t2;
578
+ } else t2 = $[17];
579
+ return t2;
580
+ }
581
+ let t1;
582
+ if ($[18] !== props || $[19] !== renderStaticInput) {
583
+ t1 = /* @__PURE__ */ jsx(TimePickerInner, {
584
+ ...props,
585
+ renderStaticInput
586
+ });
587
+ $[18] = props;
588
+ $[19] = renderStaticInput;
589
+ $[20] = t1;
590
+ } else t1 = $[20];
591
+ return t1;
516
592
  };
593
+ function _temp(input) {
594
+ return input.querySelector("input, button, [tabindex]:not([tabindex='-1'])");
595
+ }
596
+ function _temp2(isoString) {
597
+ if (isoString == null) return isoString;
598
+ return toTime(DateTimeUtils.fromISOtoZonedDateTime(isoString, "UTC"));
599
+ }
517
600
  //#endregion
518
601
  export { TimePicker };
@@ -14,7 +14,7 @@ import { useEffect, useRef, useState } from "react";
14
14
  import { Input, useLocale } from "react-aria-components";
15
15
  import { useFocusVisible, useNumberField } from "react-aria";
16
16
  import { mergeRefs } from "@react-aria/utils";
17
- import { Controller, useWatch } from "react-hook-form";
17
+ import { Controller } from "react-hook-form";
18
18
  import { useNumberFieldState } from "react-stately";
19
19
  //#region src/components/inputs/Input/NumberInput/NumberInput.tsx
20
20
  var NumberInputBase = (props) => {
@@ -305,24 +305,26 @@ var NumberInputBase = (props) => {
305
305
  } else t28 = $[86];
306
306
  return t28;
307
307
  };
308
- var NumberInput = ({ renderStaticInput, ...props }) => {
308
+ var NumberInputInner = (t0) => {
309
+ const $ = c(9);
310
+ const { renderStaticInput, isFormControlDisabled, ...props } = t0;
309
311
  const ui = UIConfig.useConfig();
310
312
  const { locale } = useLocale();
311
313
  const [renderInput, setRenderInput] = useState(!(renderStaticInput ?? ui.renderStaticInput));
312
314
  const inputRef = useRef(null);
313
- const { shouldFocus, renderRealInput, replayStaticInputChange } = useStaticInputHandoff({
314
- inputRef,
315
- renderInput,
316
- setRenderInput
317
- });
318
- const watchedValue = "formControl" in props && props.formControl ? useWatch({
319
- control: props.formControl.control,
320
- name: props.formControl.name
321
- }) : props.value;
322
- let isFormControlDisabled = false;
323
- if ("formControl" in props && props.formControl) isFormControlDisabled = !!props.formControl.control._options?.disabled;
315
+ let t1;
316
+ if ($[0] !== renderInput) {
317
+ t1 = {
318
+ inputRef,
319
+ renderInput,
320
+ setRenderInput
321
+ };
322
+ $[0] = renderInput;
323
+ $[1] = t1;
324
+ } else t1 = $[1];
325
+ const { shouldFocus, renderRealInput, replayStaticInputChange } = useStaticInputHandoff(t1);
324
326
  if (!renderInput) {
325
- const staticValue = watchedValue ?? props.value ?? props.defaultValue;
327
+ const staticValue = props.value ?? props.defaultValue;
326
328
  const formatOptions = props.formatOptions ?? ui.numberInput.formatOptions;
327
329
  const displayValue = getStaticNumberDisplayValue(staticValue, new Intl.NumberFormat(locale, formatOptions)) ?? "";
328
330
  const hasValue = displayValue !== "";
@@ -339,15 +341,25 @@ var NumberInput = ({ renderStaticInput, ...props }) => {
339
341
  dataInvalid: !!props.error,
340
342
  dataHasSelection: hasValue
341
343
  };
344
+ const t2 = isDisabled;
345
+ const t3 = clsx("group w-full", as === "inline" && "h-full", props.className);
346
+ const t4 = props.inputClassName;
347
+ const t5 = as === "inline" && "h-full";
348
+ let t6;
349
+ if ($[2] !== t5) {
350
+ t6 = clsx(t5, "pr-0!");
351
+ $[2] = t5;
352
+ $[3] = t6;
353
+ } else t6 = $[3];
342
354
  return /* @__PURE__ */ jsx(InputFrame, {
343
355
  ...props,
344
- isDisabled,
345
- className: clsx("group w-full", as === "inline" && "h-full", props.className),
356
+ isDisabled: t2,
357
+ className: t3,
346
358
  dataAttributes,
347
359
  renderStatic: true,
348
360
  onStaticInteract: renderRealInput,
349
- inputClassName: props.inputClassName,
350
- contentClassName: clsx(as === "inline" && "h-full", "pr-0!"),
361
+ inputClassName: t4,
362
+ contentClassName: t6,
351
363
  trailingClassName: "py-0! pl-0!",
352
364
  wrapContentAndTrailing: true,
353
365
  children: (dataAttributeProps) => /* @__PURE__ */ jsx("input", {
@@ -365,29 +377,103 @@ var NumberInput = ({ renderStaticInput, ...props }) => {
365
377
  })
366
378
  });
367
379
  }
368
- if ("formControl" in props && props.formControl) {
369
- const { formControl, ref, ...innerProps } = props;
370
- return /* @__PURE__ */ jsx(Controller, {
371
- control: formControl.control,
372
- name: formControl.name,
373
- render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(NumberInputBase, {
374
- ...innerProps,
375
- ref: mergeRefs(ref, field.ref, inputRef),
376
- value: field.value,
377
- onChange: field.onChange,
378
- onBlur: field.onBlur,
379
- isDirty,
380
- isDisabled: field.disabled || props.isDisabled,
381
- error: props.error ?? error?.message,
382
- autoFocusOnMount: shouldFocus
383
- }, field.value === null || field.value === void 0 ? "empty" : "filled")
380
+ const T0 = NumberInputBase;
381
+ const t2 = mergeRefs(props.ref, inputRef);
382
+ let t3;
383
+ if ($[4] !== T0 || $[5] !== props || $[6] !== shouldFocus || $[7] !== t2) {
384
+ t3 = /* @__PURE__ */ jsx(T0, {
385
+ ...props,
386
+ ref: t2,
387
+ autoFocusOnMount: shouldFocus
384
388
  });
389
+ $[4] = T0;
390
+ $[5] = props;
391
+ $[6] = shouldFocus;
392
+ $[7] = t2;
393
+ $[8] = t3;
394
+ } else t3 = $[8];
395
+ return t3;
396
+ };
397
+ var NumberInput = (t0) => {
398
+ const $ = c(21);
399
+ let props;
400
+ let renderStaticInput;
401
+ if ($[0] !== t0) {
402
+ ({renderStaticInput, ...props} = t0);
403
+ $[0] = t0;
404
+ $[1] = props;
405
+ $[2] = renderStaticInput;
406
+ } else {
407
+ props = $[1];
408
+ renderStaticInput = $[2];
409
+ }
410
+ if ("formControl" in props && props.formControl) {
411
+ let formControl;
412
+ let innerProps;
413
+ let ref;
414
+ if ($[3] !== props) {
415
+ ({formControl, ref, ...innerProps} = props);
416
+ $[3] = props;
417
+ $[4] = formControl;
418
+ $[5] = innerProps;
419
+ $[6] = ref;
420
+ } else {
421
+ formControl = $[4];
422
+ innerProps = $[5];
423
+ ref = $[6];
424
+ }
425
+ const controlWithOptions = formControl.control;
426
+ let t1;
427
+ if ($[7] !== controlWithOptions._options?.disabled || $[8] !== innerProps || $[9] !== props.error || $[10] !== props.isDisabled || $[11] !== ref || $[12] !== renderStaticInput) {
428
+ t1 = (t2) => {
429
+ const { field, fieldState: t3 } = t2;
430
+ const { error, isDirty } = t3;
431
+ return /* @__PURE__ */ jsx(NumberInputInner, {
432
+ ...innerProps,
433
+ ref: mergeRefs(ref, field.ref),
434
+ value: field.value,
435
+ onChange: field.onChange,
436
+ onBlur: field.onBlur,
437
+ isDirty,
438
+ isDisabled: field.disabled || props.isDisabled,
439
+ isFormControlDisabled: !!controlWithOptions._options?.disabled,
440
+ error: props.error ?? error?.message,
441
+ renderStaticInput
442
+ });
443
+ };
444
+ $[7] = controlWithOptions._options?.disabled;
445
+ $[8] = innerProps;
446
+ $[9] = props.error;
447
+ $[10] = props.isDisabled;
448
+ $[11] = ref;
449
+ $[12] = renderStaticInput;
450
+ $[13] = t1;
451
+ } else t1 = $[13];
452
+ let t2;
453
+ if ($[14] !== formControl.control || $[15] !== formControl.name || $[16] !== t1) {
454
+ t2 = /* @__PURE__ */ jsx(Controller, {
455
+ control: formControl.control,
456
+ name: formControl.name,
457
+ render: t1
458
+ });
459
+ $[14] = formControl.control;
460
+ $[15] = formControl.name;
461
+ $[16] = t1;
462
+ $[17] = t2;
463
+ } else t2 = $[17];
464
+ return t2;
385
465
  }
386
- return /* @__PURE__ */ jsx(NumberInputBase, {
387
- ...props,
388
- ref: mergeRefs(props.ref, inputRef),
389
- autoFocusOnMount: shouldFocus
390
- }, props.value === null || props.value === void 0 ? "empty" : "filled");
466
+ let t1;
467
+ if ($[18] !== props || $[19] !== renderStaticInput) {
468
+ t1 = /* @__PURE__ */ jsx(NumberInputInner, {
469
+ ...props,
470
+ renderStaticInput
471
+ });
472
+ $[18] = props;
473
+ $[19] = renderStaticInput;
474
+ $[20] = t1;
475
+ } else t1 = $[20];
476
+ return t1;
391
477
  };
392
478
  //#endregion
393
479
  export { NumberInput };