@fuf-stack/uniform 1.24.1 → 1.24.2

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 (123) hide show
  1. package/dist/Checkboxes/index.cjs.map +1 -1
  2. package/dist/Checkboxes/index.d.cts +11 -11
  3. package/dist/Checkboxes/index.d.cts.map +1 -1
  4. package/dist/Checkboxes/index.d.ts +11 -11
  5. package/dist/Checkboxes/index.d.ts.map +1 -1
  6. package/dist/DatePicker/index.cjs.map +1 -1
  7. package/dist/DatePicker/index.d.cts +18 -18
  8. package/dist/DatePicker/index.d.cts.map +1 -1
  9. package/dist/DatePicker/index.d.ts +18 -18
  10. package/dist/DatePicker/index.d.ts.map +1 -1
  11. package/dist/DatePicker/index.js.map +1 -1
  12. package/dist/FieldArray/index.cjs.map +1 -1
  13. package/dist/FieldArray/index.d.cts +7 -7
  14. package/dist/FieldArray/index.d.cts.map +1 -1
  15. package/dist/FieldArray/index.d.ts +7 -7
  16. package/dist/FieldArray/index.d.ts.map +1 -1
  17. package/dist/FieldArray/index.js.map +1 -1
  18. package/dist/FieldCard/index.cjs.map +1 -1
  19. package/dist/FieldCard/index.d.cts +7 -7
  20. package/dist/FieldCard/index.d.cts.map +1 -1
  21. package/dist/FieldCard/index.d.ts +7 -7
  22. package/dist/FieldCard/index.d.ts.map +1 -1
  23. package/dist/FieldCard/index.js.map +1 -1
  24. package/dist/FieldCopyTestIdButton-CRJBix9D.js.map +1 -1
  25. package/dist/FieldCopyTestIdButton-D3D_LmJh.cjs.map +1 -1
  26. package/dist/FieldValidationError-CfYKzl7P.cjs.map +1 -1
  27. package/dist/Form/index.cjs.map +1 -1
  28. package/dist/Form/index.d.cts +1 -1
  29. package/dist/Form/index.d.cts.map +1 -1
  30. package/dist/Form/index.d.ts +1 -1
  31. package/dist/Form/index.d.ts.map +1 -1
  32. package/dist/FormContext-DjJOJKxj.js.map +1 -1
  33. package/dist/FormContext-EGH0cVnH.cjs.map +1 -1
  34. package/dist/Grid/index.d.cts +1 -1
  35. package/dist/Grid/index.d.cts.map +1 -1
  36. package/dist/Grid/index.d.ts +1 -1
  37. package/dist/Grid/index.d.ts.map +1 -1
  38. package/dist/Grid-BbqCRkuY.cjs.map +1 -1
  39. package/dist/Input/index.cjs.map +1 -1
  40. package/dist/Input/index.d.cts +12 -12
  41. package/dist/Input/index.d.cts.map +1 -1
  42. package/dist/Input/index.d.ts +12 -12
  43. package/dist/Input/index.d.ts.map +1 -1
  44. package/dist/RadioBoxes/index.cjs.map +1 -1
  45. package/dist/RadioBoxes/index.d.cts +22 -22
  46. package/dist/RadioBoxes/index.d.cts.map +1 -1
  47. package/dist/RadioBoxes/index.d.ts +22 -22
  48. package/dist/RadioBoxes/index.d.ts.map +1 -1
  49. package/dist/RadioBoxes/index.js.map +1 -1
  50. package/dist/RadioTabs/index.cjs.map +1 -1
  51. package/dist/RadioTabs/index.d.cts +6 -6
  52. package/dist/RadioTabs/index.d.cts.map +1 -1
  53. package/dist/RadioTabs/index.d.ts +6 -6
  54. package/dist/RadioTabs/index.d.ts.map +1 -1
  55. package/dist/RadioTabs/index.js.map +1 -1
  56. package/dist/Radios/index.cjs.map +1 -1
  57. package/dist/Radios/index.d.cts +11 -11
  58. package/dist/Radios/index.d.ts +11 -11
  59. package/dist/Select/index.cjs.map +1 -1
  60. package/dist/Select/index.d.cts +24 -24
  61. package/dist/Select/index.d.cts.map +1 -1
  62. package/dist/Select/index.d.ts +24 -24
  63. package/dist/Select/index.d.ts.map +1 -1
  64. package/dist/Select/index.js.map +1 -1
  65. package/dist/Slider/index.cjs.map +1 -1
  66. package/dist/Slider/index.d.cts +18 -18
  67. package/dist/Slider/index.d.cts.map +1 -1
  68. package/dist/Slider/index.d.ts +18 -18
  69. package/dist/Slider/index.d.ts.map +1 -1
  70. package/dist/Slider/index.js.map +1 -1
  71. package/dist/SubmitButton/index.cjs.map +1 -1
  72. package/dist/SubmitButton/index.d.cts +1 -1
  73. package/dist/SubmitButton/index.d.cts.map +1 -1
  74. package/dist/SubmitButton/index.d.ts +1 -1
  75. package/dist/SubmitButton/index.d.ts.map +1 -1
  76. package/dist/Switch/index.cjs.map +1 -1
  77. package/dist/Switch/index.d.cts +24 -24
  78. package/dist/Switch/index.d.cts.map +1 -1
  79. package/dist/Switch/index.d.ts +24 -24
  80. package/dist/Switch/index.d.ts.map +1 -1
  81. package/dist/Switch/index.js.map +1 -1
  82. package/dist/SwitchBox/index.cjs.map +1 -1
  83. package/dist/SwitchBox/index.d.cts +11 -11
  84. package/dist/SwitchBox/index.d.cts.map +1 -1
  85. package/dist/SwitchBox/index.d.ts +11 -11
  86. package/dist/SwitchBox/index.d.ts.map +1 -1
  87. package/dist/SwitchBox/index.js.map +1 -1
  88. package/dist/TextArea/index.cjs.map +1 -1
  89. package/dist/TextArea/index.d.cts +12 -12
  90. package/dist/TextArea/index.d.cts.map +1 -1
  91. package/dist/TextArea/index.d.ts +12 -12
  92. package/dist/TextArea/index.d.ts.map +1 -1
  93. package/dist/Time/index.cjs.map +1 -1
  94. package/dist/Time/index.d.cts +18 -18
  95. package/dist/Time/index.d.cts.map +1 -1
  96. package/dist/Time/index.d.ts +18 -18
  97. package/dist/Time/index.d.ts.map +1 -1
  98. package/dist/Time/index.js.map +1 -1
  99. package/dist/helpers/index.cjs.map +1 -1
  100. package/dist/helpers/index.js.map +1 -1
  101. package/dist/hooks/useClientValidation/index.cjs.map +1 -1
  102. package/dist/hooks/useClientValidation/index.js.map +1 -1
  103. package/dist/hooks/useInputValueDebounce/index.cjs.map +1 -1
  104. package/dist/hooks/useInputValueDebounce/index.js.map +1 -1
  105. package/dist/hooks/useUniformField/index.cjs.map +1 -1
  106. package/dist/hooks/useUniformField/index.js.map +1 -1
  107. package/dist/hooks/useUniformFieldArray/index.cjs.map +1 -1
  108. package/dist/hooks/useWatchFormReset/index.cjs.map +1 -1
  109. package/dist/hooks/useWatchUserChange/index.cjs.map +1 -1
  110. package/dist/partials/FieldCopyTestIdButton/index.d.cts +1 -1
  111. package/dist/partials/FieldCopyTestIdButton/index.d.cts.map +1 -1
  112. package/dist/partials/FieldCopyTestIdButton/index.d.ts +1 -1
  113. package/dist/partials/FieldCopyTestIdButton/index.d.ts.map +1 -1
  114. package/dist/partials/FieldValidationError/index.d.cts +1 -1
  115. package/dist/partials/FieldValidationError/index.d.cts.map +1 -1
  116. package/dist/partials/FieldValidationError/index.d.ts +1 -1
  117. package/dist/partials/FieldValidationError/index.d.ts.map +1 -1
  118. package/dist/useController-Dbe7ADG6.cjs.map +1 -1
  119. package/dist/useController-DxFS0u7c.js.map +1 -1
  120. package/dist/useFormContext-BJqa1FoT.js.map +1 -1
  121. package/dist/useFormContext-kUHonwgu.cjs.map +1 -1
  122. package/dist/useInputValueTransform-P62UUZBl.cjs.map +1 -1
  123. package/package.json +6 -6
@@ -856,11 +856,11 @@ declare const timeVariants: ((props?: ({
856
856
  defaultVariants: {};
857
857
  compoundVariants: ({} & ({
858
858
  class?: (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined) | {
859
+ label?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
859
860
  base?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
860
861
  input?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
861
- inputWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
862
- label?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
863
862
  helperWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
863
+ inputWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
864
864
  innerWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
865
865
  segment?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
866
866
  };
@@ -868,17 +868,17 @@ declare const timeVariants: ((props?: ({
868
868
  } | {
869
869
  class?: never;
870
870
  className?: (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined) | {
871
+ label?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
871
872
  base?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
872
873
  input?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
873
- inputWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
874
- label?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
875
874
  helperWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
875
+ inputWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
876
876
  innerWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
877
877
  segment?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
878
878
  };
879
879
  }))[];
880
880
  compoundSlots: ({
881
- slots: ("base" | "input" | "inputWrapper" | "label" | "helperWrapper" | "innerWrapper" | "segment")[];
881
+ slots: ("label" | "base" | "input" | "helperWrapper" | "inputWrapper" | "innerWrapper" | "segment")[];
882
882
  } & ({} & ({
883
883
  class?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
884
884
  className?: never;
@@ -901,11 +901,11 @@ declare const timeVariants: ((props?: ({
901
901
  variants: {
902
902
  [key: string]: {
903
903
  [key: string]: (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined) | {
904
+ label?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
904
905
  base?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
905
906
  input?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
906
- inputWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
907
- label?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
908
907
  helperWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
908
+ inputWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
909
909
  innerWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
910
910
  segment?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
911
911
  };
@@ -913,11 +913,11 @@ declare const timeVariants: ((props?: ({
913
913
  } | {
914
914
  [x: string]: {
915
915
  [x: string]: (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined) | {
916
+ label?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
916
917
  base?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
917
918
  input?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
918
- inputWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
919
- label?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
920
919
  helperWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
920
+ inputWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
921
921
  innerWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
922
922
  segment?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
923
923
  };
@@ -926,11 +926,11 @@ declare const timeVariants: ((props?: ({
926
926
  defaultVariants: {};
927
927
  compoundVariants: ({} & ({
928
928
  class?: (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined) | {
929
+ label?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
929
930
  base?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
930
931
  input?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
931
- inputWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
932
- label?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
933
932
  helperWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
933
+ inputWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
934
934
  innerWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
935
935
  segment?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
936
936
  };
@@ -938,17 +938,17 @@ declare const timeVariants: ((props?: ({
938
938
  } | {
939
939
  class?: never;
940
940
  className?: (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined) | {
941
+ label?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
941
942
  base?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
942
943
  input?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
943
- inputWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
944
- label?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
945
944
  helperWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
945
+ inputWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
946
946
  innerWrapper?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
947
947
  segment?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
948
948
  };
949
949
  }))[];
950
950
  compoundSlots: (({
951
- slots: ("base" | "input" | "inputWrapper" | "label" | "helperWrapper" | "innerWrapper" | "segment")[];
951
+ slots: ("label" | "base" | "input" | "helperWrapper" | "inputWrapper" | "innerWrapper" | "segment")[];
952
952
  } & ({
953
953
  [x: string]: string | number | (string | number)[] | undefined;
954
954
  } & ({
@@ -958,7 +958,7 @@ declare const timeVariants: ((props?: ({
958
958
  class?: never;
959
959
  className?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
960
960
  }))) | ({
961
- slots: ("base" | "input" | "inputWrapper" | "label" | "helperWrapper" | "innerWrapper" | "segment")[];
961
+ slots: ("label" | "base" | "input" | "helperWrapper" | "inputWrapper" | "innerWrapper" | "segment")[];
962
962
  } & ({
963
963
  [x: string]: string | number | (string | number)[] | undefined;
964
964
  } & ({
@@ -968,7 +968,7 @@ declare const timeVariants: ((props?: ({
968
968
  class?: never;
969
969
  className?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
970
970
  }))) | ({
971
- slots: ("base" | "input" | "inputWrapper" | "label" | "helperWrapper" | "innerWrapper" | "segment")[];
971
+ slots: ("label" | "base" | "input" | "helperWrapper" | "inputWrapper" | "innerWrapper" | "segment")[];
972
972
  } & ({} & ({
973
973
  class?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
974
974
  className?: never;
@@ -976,7 +976,7 @@ declare const timeVariants: ((props?: ({
976
976
  class?: never;
977
977
  className?: string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | readonly (string | false | 0 | 0n | /*elided*/any | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined)[] | null | undefined;
978
978
  }))))[];
979
- variantKeys: (string | number)[] | never[];
979
+ variantKeys: never[] | (string | number)[];
980
980
  };
981
981
  type VariantProps = TVProps<typeof timeVariants>;
982
982
  type ClassName = TVClassName<typeof timeVariants>;
@@ -1022,7 +1022,7 @@ declare const Time: ({
1022
1022
  timeZone,
1023
1023
  valueType,
1024
1024
  ...uniformFieldProps
1025
- }: TimeProps) => import("react/jsx-runtime").JSX.Element;
1025
+ }: TimeProps) => import("react").JSX.Element;
1026
1026
  //#endregion
1027
1027
  export { type TimeProps, Time as default, timeVariants };
1028
1028
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/Time/Time.tsx"],"mappings":";;;;cAgBa,YAAA,IAAY,KAAA;EAAA;;;gbAoBvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gbApBuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;sbAsBsB;EAAA;IAAA;;;kbACC;;;;sbAErB;EAAA;IAAA;;;kbAAoB;;;;sbAIjC;EAAA;kbAIZ;;;;sbAQA;EAAA;;;;;kbAWS;;;;sbAiHV;EAAA;IAAA;;;kbA3Ga;;;;sbAUX;EAAA;IAAA;;;kbAVW;;;;sbAAA;EAAA;IAAA;;;kbAAA;;;;sbAAA;EAAA;IAAA;;;kbA2Gb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA/II,YAAA,GAAe,OAAO,QAAQ,YAAA;AAAA,KAC9B,SAAA,GAAY,WAAW,QAAQ,YAAA;AAAA,UAEnB,SAAA,SAAkB,YAAA;;EAEjC,SAAA;;EAEA,SAAA,GAAY,SAAA;;EAEZ,QAAA;;EAEA,WAAA;;EAEA,YAAA;;EAEA,YAAA;;EAEA,SAAA;;EAEA,KAAA,GAAQ,SAAA;;EAER,IAAA;;EAEA,MAAA;;;;;EAKA,QAAA;;EAEA,SAAA;AAAA;;;;cAMI,IAAA;EAAQ,SAAA,EAAA,UAAA;EAAA,WAAA;EAAA,YAAA;EAAA,YAAA;EAAA,SAAA;EAAA,IAAA;EAAA,QAAA;EAAA,SAAA;EAAA,GAAA;AAAA,GAUX,SAAA,qBAAS,GAAA,CAAA,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["HeroTimeInput"],"sources":["../../src/Time/timeHelpers.ts","../../src/Time/Time.tsx","../../src/Time/index.ts"],"sourcesContent":["import type { TimeInput as HeroTimeInput } from '@heroui/date-input';\nimport type { ComponentProps } from 'react';\n\nimport {\n getLocalTimeZone,\n parseAbsolute,\n parseAbsoluteToLocal,\n parseDateTime,\n parseZonedDateTime,\n} from '@internationalized/date';\n\n/** Value type accepted by HeroUI TimeInput */\nexport type TimeValue = ComponentProps<typeof HeroTimeInput>['value'];\n\n/** Cast unknown input to the TimeInput value union type. */\nconst asTimeValue = (value: unknown): TimeValue => {\n return value as TimeValue;\n};\n\n/** Check whether a value already looks like an @internationalized/date value. */\nconst isTimeValueLike = (value: unknown): value is object => {\n if (!value || typeof value !== 'object') {\n return false;\n }\n\n return 'hour' in value || 'calendar' in value;\n};\n\n/** Check if the incoming string represents a plain time (e.g. 09:30 or 09:30:45). */\nconst isTimeOnlyString = (value: string): boolean => {\n return /^\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d{1,3})?)?$/.test(value);\n};\n\n/** Check if the incoming string is a UTC time-only value (e.g. 09:30Z). */\nconst isUtcTimeOnlyString = (value: string): boolean => {\n return /^\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d{1,3})?)?Z$/.test(value);\n};\n\n/** Zero-pad integer segments for time serialization. */\nconst pad = (value: number): string => {\n return String(value).padStart(2, '0');\n};\n\n/** Convert an absolute ISO string into UTC time-only store format. */\nconst toUtcTimeString = (\n absoluteIsoString: string,\n granularity: 'hour' | 'minute',\n): string | null => {\n const utcDate = new Date(absoluteIsoString);\n if (Number.isNaN(utcDate.getTime())) {\n return null;\n }\n\n const hour = pad(utcDate.getUTCHours());\n if (granularity === 'hour') {\n return `${hour}:00Z`;\n }\n\n return `${hour}:${pad(utcDate.getUTCMinutes())}Z`;\n};\n\n/** True when an input already carries timezone/offset information. */\nconst hasExplicitTimeZone = (value: string): boolean => {\n if (value.includes('[') && value.includes(']')) {\n return true;\n }\n\n return /(?:[zZ]|[+-]\\d{2}:\\d{2})$/.test(value);\n};\n\n/** True for date-time strings without timezone/offset. */\nconst isNaiveDateTimeString = (value: string): boolean => {\n return /^\\d{4}-\\d{2}-\\d{2}T/.test(value) && !hasExplicitTimeZone(value);\n};\n\n/** Safely run a parser and return `null` on parsing errors. */\nconst tryParse = (parser: () => unknown): TimeValue => {\n try {\n return asTimeValue(parser());\n } catch {\n return null;\n }\n};\n\n/**\n * Parse a form value into a HeroUI TimeInput compatible `TimeValue`.\n *\n * Supports existing `TimeValue` objects, native `Date` instances, plain time\n * strings (`HH:mm[:ss]`), absolute ISO date-time strings, zoned date-time\n * strings, and local date-time strings.\n *\n * Time-only strings are interpreted in the active timezone and normalized to a\n * `ZonedDateTime` (using a fixed reference date) so timezone abbreviations can\n * remain visible in the UI.\n */\nexport const parseTimeValue = (\n value: unknown,\n timeZone?: string,\n): TimeValue => {\n if (value == null || value === '') {\n return null;\n }\n\n if (isTimeValueLike(value)) {\n return asTimeValue(value);\n }\n\n if (value instanceof Date) {\n return asTimeValue(\n timeZone\n ? parseAbsolute(value.toISOString(), timeZone)\n : parseAbsoluteToLocal(value.toISOString()),\n );\n }\n\n if (typeof value !== 'string') {\n return null;\n }\n\n const normalizedValue = value.trim();\n if (normalizedValue === '') {\n return null;\n }\n\n if (isTimeOnlyString(normalizedValue)) {\n return tryParse(() => {\n const [hourValue, minuteValue, secondValue] = normalizedValue\n .split(':')\n .map(Number);\n const resolvedTimeZone = resolveTimeFieldTimeZone(timeZone);\n const hour = pad(hourValue);\n const minute = pad(minuteValue);\n const second = pad(secondValue ?? 0);\n\n return parseZonedDateTime(\n `1970-01-01T${hour}:${minute}:${second}[${resolvedTimeZone}]`,\n );\n });\n }\n\n if (isUtcTimeOnlyString(normalizedValue)) {\n return tryParse(() => {\n const resolvedTimeZone = resolveTimeFieldTimeZone(timeZone);\n return parseAbsolute(`1970-01-01T${normalizedValue}`, resolvedTimeZone);\n });\n }\n\n const parsers: (() => unknown)[] = [\n ...(timeZone && isNaiveDateTimeString(normalizedValue)\n ? [\n () => {\n return parseZonedDateTime(`${normalizedValue}[${timeZone}]`);\n },\n ]\n : []),\n () => {\n return timeZone\n ? parseAbsolute(normalizedValue, timeZone)\n : parseAbsoluteToLocal(normalizedValue);\n },\n () => {\n return parseZonedDateTime(normalizedValue);\n },\n () => {\n return parseDateTime(normalizedValue);\n },\n ];\n\n return (\n parsers\n .map((parser) => {\n return tryParse(parser);\n })\n .find((parsedValue) => {\n return parsedValue != null;\n }) ?? null\n );\n};\n\n/** Resolve the timezone used for parsing and string conversion. */\nexport const resolveTimeFieldTimeZone = (timeZone?: string): string => {\n return timeZone ?? getLocalTimeZone();\n};\n\n/**\n * Build default placeholder value for TimeInput.\n *\n * Uses a fixed reference time to keep snapshots deterministic.\n */\nexport const getTimeFieldPlaceholderValue = (timeZone?: string): TimeValue => {\n const resolvedTimeZone = resolveTimeFieldTimeZone(timeZone);\n return asTimeValue(\n parseZonedDateTime(`1970-01-01T00:00:00[${resolvedTimeZone}]`),\n );\n};\n\n/**\n * Convert a TimeValue into a UTC time-only string for form state.\n *\n * The stored format is `HH:mmZ` (or `HH:00Z` when granularity is `hour`).\n */\nexport const timeValueToString = (\n value: TimeValue,\n timeZone: string,\n granularity: 'hour' | 'minute' = 'minute',\n): string | null => {\n if (value == null) {\n return null;\n }\n\n const maybeWithAbsoluteString = value as { toAbsoluteString?: () => string };\n if (typeof maybeWithAbsoluteString.toAbsoluteString === 'function') {\n return toUtcTimeString(\n maybeWithAbsoluteString.toAbsoluteString(),\n granularity,\n );\n }\n\n const maybeWithToDate = value as { toDate?: (zone: string) => Date };\n if (typeof maybeWithToDate.toDate === 'function') {\n return toUtcTimeString(\n maybeWithToDate.toDate(timeZone).toISOString(),\n granularity,\n );\n }\n\n const maybeTime = value as {\n hour?: number;\n minute?: number;\n second?: number;\n };\n if (\n typeof maybeTime.hour === 'number' &&\n typeof maybeTime.minute === 'number'\n ) {\n const hour = pad(maybeTime.hour);\n const minute = pad(maybeTime.minute);\n const second = pad(maybeTime.second ?? 0);\n return toUtcTimeString(\n parseZonedDateTime(\n `1970-01-01T${hour}:${minute}:${second}[${timeZone}]`,\n ).toAbsoluteString(),\n granularity,\n );\n }\n\n return null;\n};\n","import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\nimport type { TimeValue } from './timeHelpers';\n\nimport { TimeInput as HeroTimeInput } from '@heroui/date-input';\n\nimport { tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../hooks/useUniformField';\nimport {\n getTimeFieldPlaceholderValue,\n parseTimeValue,\n resolveTimeFieldTimeZone,\n timeValueToString,\n} from './timeHelpers';\n\nexport const timeVariants = tv({\n slots: {\n /** wrapper around the whole time input */\n base: '',\n /** helper wrapper for error/description */\n helperWrapper: [\n // set padding to 0 for error message exit animation\n 'p-0',\n ],\n /** the segmented input element */\n input: '',\n /** inner wrapper around segments and optional content */\n innerWrapper: '',\n /** outer input wrapper */\n inputWrapper: 'bg-content1 focus-within:border-focus',\n /** field label */\n label: 'cursor-default',\n /** individual segment */\n segment: '',\n },\n});\n\ntype VariantProps = TVProps<typeof timeVariants>;\ntype ClassName = TVClassName<typeof timeVariants>;\n\nexport interface TimeProps extends VariantProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** input is disabled */\n disabled?: boolean;\n /** smallest visible unit in the segmented time input */\n granularity?: 'hour' | 'minute';\n /** hide timezone abbreviation for zoned values */\n hideTimeZone?: boolean;\n /** force hour granularity and store UTC hour as number (0-23) */\n hourAsNumber?: boolean;\n /** hour cycle formatting */\n hourCycle?: 12 | 24;\n /** form field label */\n label?: ReactNode;\n /** form field name */\n name: string;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /**\n * Optional timezone used for parsing date-time strings and serializing values.\n * When omitted, local timezone is used.\n */\n timeZone?: string;\n /** value format stored in form state (`string` stores UTC minute values, e.g. `10:15Z`) */\n valueType?: 'string' | 'timeValue';\n}\n\n/**\n * Time component based on [HeroUI TimeInput](https://v2.heroui.com/docs/components/time-input)\n */\nconst Time = ({\n className: _className = undefined,\n granularity = 'minute',\n hideTimeZone = false,\n hourAsNumber = false,\n hourCycle = undefined,\n name,\n timeZone = undefined,\n valueType = 'string',\n ...uniformFieldProps\n}: TimeProps) => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, ref, value },\n invalid,\n label,\n required,\n testId,\n } = useUniformField({ name, ...uniformFieldProps });\n\n // classNames from slots\n const variants = timeVariants();\n const classNames = variantsToClassNames(variants, _className, 'base');\n const resolvedTimeZone = resolveTimeFieldTimeZone(timeZone);\n const effectiveGranularity = hourAsNumber ? 'hour' : granularity;\n\n // `hourAsNumber` stores 0-23; convert this into a parseable UTC time for display.\n const normalizedFieldValue =\n hourAsNumber && typeof value === 'number'\n ? `${String(Math.max(0, Math.min(23, value))).padStart(2, '0')}:00Z`\n : value;\n\n // Normalize incoming form value into HeroUI TimeInput value shape.\n const parsedValue = parseTimeValue(normalizedFieldValue, timeZone);\n const placeholderValue = getTimeFieldPlaceholderValue(timeZone);\n\n // Normalize TimeInput output into the configured storage format.\n const handleChange = (nextValue: TimeValue) => {\n if (nextValue == null) {\n onChange(null);\n return;\n }\n\n if (hourAsNumber) {\n const serializedValue = timeValueToString(\n nextValue,\n resolvedTimeZone,\n 'hour',\n );\n\n if (!serializedValue) {\n onChange(null);\n return;\n }\n\n const [hoursSegment] = serializedValue.split(':');\n const parsedHours = Number(hoursSegment);\n onChange(Number.isNaN(parsedHours) ? null : parsedHours);\n return;\n }\n\n if (valueType === 'timeValue') {\n onChange(nextValue);\n return;\n }\n\n onChange(\n timeValueToString(nextValue, resolvedTimeZone, effectiveGranularity) ??\n String(nextValue),\n );\n };\n\n return (\n <HeroTimeInput\n ref={ref}\n aria-label={label ? undefined : ariaLabel}\n classNames={{\n base: classNames.base,\n helperWrapper: classNames.helperWrapper,\n innerWrapper: classNames.innerWrapper,\n input: classNames.input,\n inputWrapper: classNames.inputWrapper,\n label: classNames.label,\n segment: classNames.segment,\n }}\n data-testid={testId}\n errorMessage={errorMessage}\n granularity={effectiveGranularity}\n hideTimeZone={hideTimeZone}\n hourCycle={hourCycle}\n id={testId}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label}\n labelPlacement=\"outside\"\n name={name}\n onBlur={onBlur}\n onChange={handleChange}\n placeholderValue={placeholderValue ?? undefined}\n radius=\"sm\"\n value={parsedValue ?? undefined}\n variant=\"bordered\"\n />\n );\n};\n\nexport default Time;\n","import Time from './Time';\n\nexport type { TimeProps } from './Time';\n\nexport { timeVariants } from './Time';\n\nexport default Time;\n"],"mappings":";;;;;;;AAeA,MAAM,eAAe,UAA8B;CACjD,OAAO;AACT;;AAGA,MAAM,mBAAmB,UAAoC;CAC3D,IAAI,CAAC,SAAS,OAAO,UAAU,UAC7B,OAAO;CAGT,OAAO,UAAU,SAAS,cAAc;AAC1C;;AAGA,MAAM,oBAAoB,UAA2B;CACnD,OAAO,yCAAyC,KAAK,KAAK;AAC5D;;AAGA,MAAM,uBAAuB,UAA2B;CACtD,OAAO,0CAA0C,KAAK,KAAK;AAC7D;;AAGA,MAAM,OAAO,UAA0B;CACrC,OAAO,OAAO,KAAK,EAAE,SAAS,GAAG,GAAG;AACtC;;AAGA,MAAM,mBACJ,mBACA,gBACkB;CAClB,MAAM,UAAU,IAAI,KAAK,iBAAiB;CAC1C,IAAI,OAAO,MAAM,QAAQ,QAAQ,CAAC,GAChC,OAAO;CAGT,MAAM,OAAO,IAAI,QAAQ,YAAY,CAAC;CACtC,IAAI,gBAAgB,QAClB,OAAO,GAAG,KAAK;CAGjB,OAAO,GAAG,KAAK,GAAG,IAAI,QAAQ,cAAc,CAAC,EAAE;AACjD;;AAGA,MAAM,uBAAuB,UAA2B;CACtD,IAAI,MAAM,SAAS,GAAG,KAAK,MAAM,SAAS,GAAG,GAC3C,OAAO;CAGT,OAAO,4BAA4B,KAAK,KAAK;AAC/C;;AAGA,MAAM,yBAAyB,UAA2B;CACxD,OAAO,sBAAsB,KAAK,KAAK,KAAK,CAAC,oBAAoB,KAAK;AACxE;;AAGA,MAAM,YAAY,WAAqC;CAC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AAyB,QAAQ;CAC1D,MAAM,uBAAuB,eAAe,SAAS;CASrD,MAAM,cAAc,eALlB,gBAAgB,OAAO,UAAU,WAC7B,GAAG,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,EAAE,SAAS,GAAG,GAAG,EAAE,QAC7D,OAGmD,QAAQ;CACjE,MAAM,mBAAmB,6BAA6B,QAAQ;CAG9D,MAAM,gBAAgB,cAAyB;EAC7C,IAAI,aAAa,MAAM;GACrB,SAAS,IAAI;GACb;EACF;EAEA,IAAI,cAAc;GAChB,MAAM,kBAAkB,kBACtB,WACA,kBACA,MACF;GAEA,IAAI,CAAC,iBAAiB;IACpB,SAAS,IAAI;IACb;GACF;GAEA,MAAM,CAAC,gBAAgB,gBAAgB,MAAM,GAAG;GAChD,MAAM,cAAc,OAAO,YAAY;GACvC,SAAS,OAAO,MAAM,WAAW,IAAI,OAAO,WAAW;GACvD;EACF;EAEA,IAAI,cAAc,aAAa;GAC7B,SAAS,SAAS;GAClB;EACF;EAEA,SACE,kBAAkB,WAAW,kBAAkB,oBAAoB,KACjE,OAAO,SAAS,CACpB;CACF;CAEA,OACE,oBAACA,WAAD;EACO;EACL,cAAY,QAAQ,KAAA,IAAY;EAChC,YAAY;GACV,MAAM,WAAW;GACjB,eAAe,WAAW;GAC1B,cAAc,WAAW;GACzB,OAAO,WAAW;GAClB,cAAc,WAAW;GACzB,OAAO,WAAW;GAClB,SAAS,WAAW;EACtB;EACA,eAAa;EACC;EACd,aAAa;EACC;EACH;EACX,IAAI;EACJ,YAAY;EACZ,WAAW;EACX,YAAY;EACL;EACP,gBAAe;EACT;EACE;EACR,UAAU;EACV,kBAAkB,oBAAoB,KAAA;EACtC,QAAO;EACP,OAAO,eAAe,KAAA;EACtB,SAAQ;CACT,CAAA;AAEL;;;AC/KA,IAAA,eAAe"}
1
+ {"version":3,"file":"index.js","names":["HeroTimeInput"],"sources":["../../src/Time/timeHelpers.ts","../../src/Time/Time.tsx","../../src/Time/index.ts"],"sourcesContent":["import type { TimeInput as HeroTimeInput } from '@heroui/date-input';\nimport type { ComponentProps } from 'react';\n\nimport {\n getLocalTimeZone,\n parseAbsolute,\n parseAbsoluteToLocal,\n parseDateTime,\n parseZonedDateTime,\n} from '@internationalized/date';\n\n/** Value type accepted by HeroUI TimeInput */\nexport type TimeValue = ComponentProps<typeof HeroTimeInput>['value'];\n\n/** Cast unknown input to the TimeInput value union type. */\nconst asTimeValue = (value: unknown): TimeValue => {\n return value as TimeValue;\n};\n\n/** Check whether a value already looks like an @internationalized/date value. */\nconst isTimeValueLike = (value: unknown): value is object => {\n if (!value || typeof value !== 'object') {\n return false;\n }\n\n return 'hour' in value || 'calendar' in value;\n};\n\n/** Check if the incoming string represents a plain time (e.g. 09:30 or 09:30:45). */\nconst isTimeOnlyString = (value: string): boolean => {\n return /^\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d{1,3})?)?$/.test(value);\n};\n\n/** Check if the incoming string is a UTC time-only value (e.g. 09:30Z). */\nconst isUtcTimeOnlyString = (value: string): boolean => {\n return /^\\d{2}:\\d{2}(?::\\d{2}(?:\\.\\d{1,3})?)?Z$/.test(value);\n};\n\n/** Zero-pad integer segments for time serialization. */\nconst pad = (value: number): string => {\n return String(value).padStart(2, '0');\n};\n\n/** Convert an absolute ISO string into UTC time-only store format. */\nconst toUtcTimeString = (\n absoluteIsoString: string,\n granularity: 'hour' | 'minute',\n): string | null => {\n const utcDate = new Date(absoluteIsoString);\n if (Number.isNaN(utcDate.getTime())) {\n return null;\n }\n\n const hour = pad(utcDate.getUTCHours());\n if (granularity === 'hour') {\n return `${hour}:00Z`;\n }\n\n return `${hour}:${pad(utcDate.getUTCMinutes())}Z`;\n};\n\n/** True when an input already carries timezone/offset information. */\nconst hasExplicitTimeZone = (value: string): boolean => {\n if (value.includes('[') && value.includes(']')) {\n return true;\n }\n\n return /(?:[zZ]|[+-]\\d{2}:\\d{2})$/.test(value);\n};\n\n/** True for date-time strings without timezone/offset. */\nconst isNaiveDateTimeString = (value: string): boolean => {\n return /^\\d{4}-\\d{2}-\\d{2}T/.test(value) && !hasExplicitTimeZone(value);\n};\n\n/** Safely run a parser and return `null` on parsing errors. */\nconst tryParse = (parser: () => unknown): TimeValue => {\n try {\n return asTimeValue(parser());\n } catch {\n return null;\n }\n};\n\n/**\n * Parse a form value into a HeroUI TimeInput compatible `TimeValue`.\n *\n * Supports existing `TimeValue` objects, native `Date` instances, plain time\n * strings (`HH:mm[:ss]`), absolute ISO date-time strings, zoned date-time\n * strings, and local date-time strings.\n *\n * Time-only strings are interpreted in the active timezone and normalized to a\n * `ZonedDateTime` (using a fixed reference date) so timezone abbreviations can\n * remain visible in the UI.\n */\nexport const parseTimeValue = (\n value: unknown,\n timeZone?: string,\n): TimeValue => {\n if (value == null || value === '') {\n return null;\n }\n\n if (isTimeValueLike(value)) {\n return asTimeValue(value);\n }\n\n if (value instanceof Date) {\n return asTimeValue(\n timeZone\n ? parseAbsolute(value.toISOString(), timeZone)\n : parseAbsoluteToLocal(value.toISOString()),\n );\n }\n\n if (typeof value !== 'string') {\n return null;\n }\n\n const normalizedValue = value.trim();\n if (normalizedValue === '') {\n return null;\n }\n\n if (isTimeOnlyString(normalizedValue)) {\n return tryParse(() => {\n const [hourValue, minuteValue, secondValue] = normalizedValue\n .split(':')\n .map(Number);\n const resolvedTimeZone = resolveTimeFieldTimeZone(timeZone);\n const hour = pad(hourValue);\n const minute = pad(minuteValue);\n const second = pad(secondValue ?? 0);\n\n return parseZonedDateTime(\n `1970-01-01T${hour}:${minute}:${second}[${resolvedTimeZone}]`,\n );\n });\n }\n\n if (isUtcTimeOnlyString(normalizedValue)) {\n return tryParse(() => {\n const resolvedTimeZone = resolveTimeFieldTimeZone(timeZone);\n return parseAbsolute(`1970-01-01T${normalizedValue}`, resolvedTimeZone);\n });\n }\n\n const parsers: (() => unknown)[] = [\n ...(timeZone && isNaiveDateTimeString(normalizedValue)\n ? [\n () => {\n return parseZonedDateTime(`${normalizedValue}[${timeZone}]`);\n },\n ]\n : []),\n () => {\n return timeZone\n ? parseAbsolute(normalizedValue, timeZone)\n : parseAbsoluteToLocal(normalizedValue);\n },\n () => {\n return parseZonedDateTime(normalizedValue);\n },\n () => {\n return parseDateTime(normalizedValue);\n },\n ];\n\n return (\n parsers\n .map((parser) => {\n return tryParse(parser);\n })\n .find((parsedValue) => {\n return parsedValue != null;\n }) ?? null\n );\n};\n\n/** Resolve the timezone used for parsing and string conversion. */\nexport const resolveTimeFieldTimeZone = (timeZone?: string): string => {\n return timeZone ?? getLocalTimeZone();\n};\n\n/**\n * Build default placeholder value for TimeInput.\n *\n * Uses a fixed reference time to keep snapshots deterministic.\n */\nexport const getTimeFieldPlaceholderValue = (timeZone?: string): TimeValue => {\n const resolvedTimeZone = resolveTimeFieldTimeZone(timeZone);\n return asTimeValue(\n parseZonedDateTime(`1970-01-01T00:00:00[${resolvedTimeZone}]`),\n );\n};\n\n/**\n * Convert a TimeValue into a UTC time-only string for form state.\n *\n * The stored format is `HH:mmZ` (or `HH:00Z` when granularity is `hour`).\n */\nexport const timeValueToString = (\n value: TimeValue,\n timeZone: string,\n granularity: 'hour' | 'minute' = 'minute',\n): string | null => {\n if (value == null) {\n return null;\n }\n\n const maybeWithAbsoluteString = value as { toAbsoluteString?: () => string };\n if (typeof maybeWithAbsoluteString.toAbsoluteString === 'function') {\n return toUtcTimeString(\n maybeWithAbsoluteString.toAbsoluteString(),\n granularity,\n );\n }\n\n const maybeWithToDate = value as { toDate?: (zone: string) => Date };\n if (typeof maybeWithToDate.toDate === 'function') {\n return toUtcTimeString(\n maybeWithToDate.toDate(timeZone).toISOString(),\n granularity,\n );\n }\n\n const maybeTime = value as {\n hour?: number;\n minute?: number;\n second?: number;\n };\n if (\n typeof maybeTime.hour === 'number' &&\n typeof maybeTime.minute === 'number'\n ) {\n const hour = pad(maybeTime.hour);\n const minute = pad(maybeTime.minute);\n const second = pad(maybeTime.second ?? 0);\n return toUtcTimeString(\n parseZonedDateTime(\n `1970-01-01T${hour}:${minute}:${second}[${timeZone}]`,\n ).toAbsoluteString(),\n granularity,\n );\n }\n\n return null;\n};\n","import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\nimport type { TimeValue } from './timeHelpers';\n\nimport { TimeInput as HeroTimeInput } from '@heroui/date-input';\n\nimport { tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../hooks/useUniformField';\nimport {\n getTimeFieldPlaceholderValue,\n parseTimeValue,\n resolveTimeFieldTimeZone,\n timeValueToString,\n} from './timeHelpers';\n\nexport const timeVariants = tv({\n slots: {\n /** wrapper around the whole time input */\n base: '',\n /** helper wrapper for error/description */\n helperWrapper: [\n // set padding to 0 for error message exit animation\n 'p-0',\n ],\n /** the segmented input element */\n input: '',\n /** inner wrapper around segments and optional content */\n innerWrapper: '',\n /** outer input wrapper */\n inputWrapper: 'bg-content1 focus-within:border-focus',\n /** field label */\n label: 'cursor-default',\n /** individual segment */\n segment: '',\n },\n});\n\ntype VariantProps = TVProps<typeof timeVariants>;\ntype ClassName = TVClassName<typeof timeVariants>;\n\nexport interface TimeProps extends VariantProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** input is disabled */\n disabled?: boolean;\n /** smallest visible unit in the segmented time input */\n granularity?: 'hour' | 'minute';\n /** hide timezone abbreviation for zoned values */\n hideTimeZone?: boolean;\n /** force hour granularity and store UTC hour as number (0-23) */\n hourAsNumber?: boolean;\n /** hour cycle formatting */\n hourCycle?: 12 | 24;\n /** form field label */\n label?: ReactNode;\n /** form field name */\n name: string;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /**\n * Optional timezone used for parsing date-time strings and serializing values.\n * When omitted, local timezone is used.\n */\n timeZone?: string;\n /** value format stored in form state (`string` stores UTC minute values, e.g. `10:15Z`) */\n valueType?: 'string' | 'timeValue';\n}\n\n/**\n * Time component based on [HeroUI TimeInput](https://v2.heroui.com/docs/components/time-input)\n */\nconst Time = ({\n className: _className = undefined,\n granularity = 'minute',\n hideTimeZone = false,\n hourAsNumber = false,\n hourCycle = undefined,\n name,\n timeZone = undefined,\n valueType = 'string',\n ...uniformFieldProps\n}: TimeProps) => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, ref, value },\n invalid,\n label,\n required,\n testId,\n } = useUniformField({ name, ...uniformFieldProps });\n\n // classNames from slots\n const variants = timeVariants();\n const classNames = variantsToClassNames(variants, _className, 'base');\n const resolvedTimeZone = resolveTimeFieldTimeZone(timeZone);\n const effectiveGranularity = hourAsNumber ? 'hour' : granularity;\n\n // `hourAsNumber` stores 0-23; convert this into a parseable UTC time for display.\n const normalizedFieldValue =\n hourAsNumber && typeof value === 'number'\n ? `${String(Math.max(0, Math.min(23, value))).padStart(2, '0')}:00Z`\n : value;\n\n // Normalize incoming form value into HeroUI TimeInput value shape.\n const parsedValue = parseTimeValue(normalizedFieldValue, timeZone);\n const placeholderValue = getTimeFieldPlaceholderValue(timeZone);\n\n // Normalize TimeInput output into the configured storage format.\n const handleChange = (nextValue: TimeValue) => {\n if (nextValue == null) {\n onChange(null);\n return;\n }\n\n if (hourAsNumber) {\n const serializedValue = timeValueToString(\n nextValue,\n resolvedTimeZone,\n 'hour',\n );\n\n if (!serializedValue) {\n onChange(null);\n return;\n }\n\n const [hoursSegment] = serializedValue.split(':');\n const parsedHours = Number(hoursSegment);\n onChange(Number.isNaN(parsedHours) ? null : parsedHours);\n return;\n }\n\n if (valueType === 'timeValue') {\n onChange(nextValue);\n return;\n }\n\n onChange(\n timeValueToString(nextValue, resolvedTimeZone, effectiveGranularity) ??\n String(nextValue),\n );\n };\n\n return (\n <HeroTimeInput\n ref={ref}\n aria-label={label ? undefined : ariaLabel}\n classNames={{\n base: classNames.base,\n helperWrapper: classNames.helperWrapper,\n innerWrapper: classNames.innerWrapper,\n input: classNames.input,\n inputWrapper: classNames.inputWrapper,\n label: classNames.label,\n segment: classNames.segment,\n }}\n data-testid={testId}\n errorMessage={errorMessage}\n granularity={effectiveGranularity}\n hideTimeZone={hideTimeZone}\n hourCycle={hourCycle}\n id={testId}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label}\n labelPlacement=\"outside\"\n name={name}\n onBlur={onBlur}\n onChange={handleChange}\n placeholderValue={placeholderValue ?? undefined}\n radius=\"sm\"\n value={parsedValue ?? undefined}\n variant=\"bordered\"\n />\n );\n};\n\nexport default Time;\n","import Time from './Time';\n\nexport type { TimeProps } from './Time';\n\nexport { timeVariants } from './Time';\n\nexport default Time;\n"],"mappings":";;;;;;;AAeA,MAAM,eAAe,UAA8B;CACjD,OAAO;AACT;;AAGA,MAAM,mBAAmB,UAAoC;CAC3D,IAAI,CAAC,SAAS,OAAO,UAAU,UAC7B,OAAO;CAGT,OAAO,UAAU,SAAS,cAAc;AAC1C;;AAGA,MAAM,oBAAoB,UAA2B;CACnD,OAAO,yCAAyC,KAAK,KAAK;AAC5D;;AAGA,MAAM,uBAAuB,UAA2B;CACtD,OAAO,0CAA0C,KAAK,KAAK;AAC7D;;AAGA,MAAM,OAAO,UAA0B;CACrC,OAAO,OAAO,KAAK,CAAC,CAAC,SAAS,GAAG,GAAG;AACtC;;AAGA,MAAM,mBACJ,mBACA,gBACkB;CAClB,MAAM,UAAU,IAAI,KAAK,iBAAiB;CAC1C,IAAI,OAAO,MAAM,QAAQ,QAAQ,CAAC,GAChC,OAAO;CAGT,MAAM,OAAO,IAAI,QAAQ,YAAY,CAAC;CACtC,IAAI,gBAAgB,QAClB,OAAO,GAAG,KAAK;CAGjB,OAAO,GAAG,KAAK,GAAG,IAAI,QAAQ,cAAc,CAAC,EAAE;AACjD;;AAGA,MAAM,uBAAuB,UAA2B;CACtD,IAAI,MAAM,SAAS,GAAG,KAAK,MAAM,SAAS,GAAG,GAC3C,OAAO;CAGT,OAAO,4BAA4B,KAAK,KAAK;AAC/C;;AAGA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OAAO,eAAe,KAAA;EACtB,SAAQ;CACT,CAAA;AAEL;;;AC/KA,IAAA,eAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["record"],"sources":["../../src/helpers/createOptionValueConverter/createOptionValueConverter.ts","../../src/helpers/flattenFieldErrors/flattenFieldErrors.ts","../../src/helpers/nullishFields/nullishFields.ts"],"sourcesContent":["/* eslint-disable import-x/prefer-default-export */\n\n/**\n * Creates a converter function that preserves the original type (string, number, or boolean)\n * of option values when converting from string keys back to their original type.\n *\n * This is useful for radio/select components where the underlying UI library\n * uses string keys internally, but we want to preserve number/boolean values in the form state.\n *\n * @param options - Array of options with a value property that can be string, number, or boolean\n * @returns An object with:\n * - `convertToOriginalType`: Function to convert a string key back to its original type\n * - `numberValueKeys`: Set of string representations of number values (for internal use)\n * - `booleanValueKeys`: Map of string representations to boolean values (for internal use)\n */\nexport const createOptionValueConverter = <\n T extends { value: string | number | boolean },\n>(\n options: T[],\n) => {\n // Create a set of string keys that represent number values\n const numberValueKeys = new Set(\n options\n .filter((option) => {\n return typeof option.value === 'number';\n })\n .map((option) => {\n return String(option.value);\n }),\n );\n\n // Create a map of string keys to boolean values\n const booleanValueKeys = new Map(\n options\n .filter((option) => {\n return typeof option.value === 'boolean';\n })\n .map((option) => {\n return [String(option.value), option.value as boolean];\n }),\n );\n\n /**\n * Converts a string key back to its original type (string, number, or boolean)\n * based on whether the original option value was a number or boolean\n */\n const convertToOriginalType = (\n key: string | number | boolean,\n ): string | number | boolean => {\n const keyStr = String(key);\n const booleanValue = booleanValueKeys.get(keyStr);\n if (booleanValue !== undefined) {\n return booleanValue;\n }\n if (numberValueKeys.has(keyStr)) {\n return Number(keyStr);\n }\n return keyStr;\n };\n\n return {\n booleanValueKeys,\n convertToOriginalType,\n numberValueKeys,\n };\n};\n","/* eslint-disable import-x/prefer-default-export */\n\nimport type { FieldError } from 'react-hook-form';\n\n/**\n * Narrow an unknown value to a react-hook-form `FieldError`.\n *\n * RHF `FieldError` entries carry metadata like `message` and/or `type`,\n * while container nodes (objects keyed by index, `_errors`, etc.) do not.\n * This guard distinguishes leaf errors from nested wrappers.\n */\nconst isFieldError = (error: unknown): error is FieldError => {\n return (\n typeof error === 'object' &&\n error !== null &&\n ('message' in error || 'type' in error)\n );\n};\n\n/**\n * Normalize RHF validation payloads to a flat `FieldError[]`.\n *\n * Depending on field shape, RHF may return:\n * - a single `FieldError`\n * - an array of `FieldError`\n * - nested objects keyed by array indices\n * - objects containing `_errors` arrays for array/object-level issues\n */\nexport const flattenFieldErrors = (error: unknown): FieldError[] => {\n if (!error) {\n return [];\n }\n\n if (Array.isArray(error)) {\n return error.flatMap((item) => {\n return flattenFieldErrors(item);\n });\n }\n\n if (isFieldError(error)) {\n return [error];\n }\n\n if (typeof error === 'object') {\n return Object.values(error as Record<string, unknown>).flatMap((item) => {\n return flattenFieldErrors(item);\n });\n }\n\n return [];\n};\n","import { slugify } from '@fuf-stack/pixel-utils';\n\n/** Key used to wrap flat array elements when converting to form format */\nexport const flatArrayKey = '__FLAT__';\n\n/**\n * String markers used to preserve null, false, and 0 values during JSON processing\n */\nconst nullString = '__NULL__';\nconst falseString = '__FALSE__';\nconst zeroString = '__ZERO__';\n\n/**\n * Checks if a value is considered \"empty\" for validation display purposes.\n *\n * Used by useUniformField to determine when to show validation errors.\n * Empty values don't trigger immediate error display (user must interact first).\n *\n * Handles:\n * - Primitives: null, undefined, ''\n * - Marker strings: __NULL__, __FALSE__, __ZERO__ (converted via fromNullishString)\n * - Empty arrays: []\n * - Objects with all empty values: {a: null, b: ''}\n * - Flat array wrappers: {__FLAT__: null} or {__FLAT__: ''}\n *\n * @param value - The value to check (will be converted via fromNullishString first)\n * @returns true if the value is empty\n *\n * @example\n * isValueEmpty(null) // true\n * isValueEmpty('') // true\n * isValueEmpty('__NULL__') // true (marker string)\n * isValueEmpty([]) // true (empty array)\n * isValueEmpty({a: null}) // true (object with all empty values)\n * isValueEmpty({__FLAT__: null}) // true (flat array wrapper with empty value)\n * isValueEmpty({__FLAT__: ''}) // true\n * isValueEmpty('hello') // false\n * isValueEmpty([1, 2]) // false\n * isValueEmpty({a: 'value'}) // false\n * isValueEmpty({__FLAT__: 'value'}) // false\n */\nexport const isValueEmpty = (value: unknown): boolean => {\n // Convert marker strings first\n const converted = fromNullishString(value);\n\n if (converted === undefined || converted === null || converted === '') {\n return true;\n }\n if (Array.isArray(converted)) {\n return converted.length === 0;\n }\n if (typeof converted === 'object' && converted !== null) {\n const record = converted as Record<string, unknown>;\n // Handle flat array wrapper: { __FLAT__: innerValue }\n if (flatArrayKey in record) {\n return isValueEmpty(record[flatArrayKey]);\n }\n // For objects (e.g., FieldCard), check if all values are null/undefined/empty\n const values = Object.values(record);\n return values.length === 0 || values.every(isValueEmpty);\n }\n return false;\n};\n\n/**\n * Converts marker strings back to their original values when processing arrays\n */\nexport const fromNullishString = (value: unknown): unknown => {\n // Support arrays: unwrap flat wrappers and convert marker strings per entry\n if (Array.isArray(value)) {\n return (value as unknown[]).map((entry) => {\n if (entry && typeof entry === 'object') {\n const record = entry as Record<string, unknown>;\n if (flatArrayKey in record) {\n const inner = record[flatArrayKey];\n // For arrays, treat empty string as null (placeholder input)\n if (inner === '') {\n return null;\n }\n return fromNullishString(inner);\n }\n }\n return fromNullishString(entry);\n });\n }\n\n if (typeof value !== 'string') {\n return value;\n }\n\n switch (value) {\n case nullString:\n return null;\n case falseString:\n return false;\n case zeroString:\n return 0;\n default:\n return value;\n }\n};\n\n/**\n * Converts null/falsy values to marker strings for JSON processing\n */\nexport const toNullishString = (value: unknown): unknown => {\n if (Array.isArray(value)) {\n // Only wrap arrays of primitives; leave arrays of objects as-is\n const isPrimitive = (v: unknown) => {\n return v === null || ['string', 'number', 'boolean'].includes(typeof v);\n };\n const isPrimitiveArray = (value as unknown[]).every(isPrimitive);\n if (isPrimitiveArray) {\n return (value as unknown[]).map((v) => {\n // Store raw primitive; do not convert to marker strings inside the wrapper\n return { [flatArrayKey]: v };\n });\n }\n return value;\n }\n if (value === null || value === '') {\n return nullString;\n }\n if (value === false) {\n return falseString;\n }\n if (value === 0) {\n return zeroString;\n }\n return value;\n};\n\n/**\n * Converts field values to a format suitable for forms by:\n * - Wrapping arrays of primitives as objects using the flatArrayKey `__FLAT__`\n * to satisfy RHF's requirement that array fields contain objects\n * - Removing empty strings and null values from objects\n *\n * This conversion is required because React Hook Form does not support arrays with\n * flat values (string, number, boolean, null). Array fields must contain objects.\n * We work around this by wrapping primitive entries: `{ __FLAT__: <value> }`.\n *\n * @example\n * const fields = {\n * name: 'John',\n * scores: [0, null, 75, false],\n * scoresDetailed: [\n * { score: 1 },\n * { score: null },\n * { score: 0 },\n * { score: false },\n * { score: '' },\n * ],\n * contact: {\n * email: '',\n * phone: null,\n * address: '123 Main St'\n * }\n * };\n *\n * // Result:\n * {\n * name: 'John',\n * scores: [\n * { __FLAT__: 0 },\n * { __FLAT__: null },\n * { __FLAT__: 75 },\n * { __FLAT__: false }\n * ],\n * // Arrays of objects are left as objects; empty/null properties are removed\n * scoresDetailed: [\n * { score: 1 },\n * {}, // null score removed\n * { score: 0 },\n * { score: false },\n * {}, // empty string removed\n * ],\n * contact: {\n * address: '123 Main St'\n * }\n * }\n */\nexport const toFormFormat = (fields: Record<string, unknown>) => {\n const formFormatJson = JSON.stringify(fields, (_, value) => {\n if (Array.isArray(value)) {\n // Delegate to toNullishString to ensure consistent handling\n return toNullishString(value);\n }\n\n if (value && typeof value === 'object') {\n // Preserve flat-array wrappers as-is (do not filter their inner values here)\n const record = value as Record<string, unknown>;\n if (flatArrayKey in record) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return value;\n }\n return Object.fromEntries(\n Object.entries(value).filter(([_key, v]) => {\n return v !== '' && v !== null;\n }),\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return value;\n });\n\n return JSON.parse(formFormatJson) as Record<string, unknown>;\n};\n\n/**\n * Converts form state to a format suitable for validation by:\n * - Unwrapping flat array wrappers `{ __FLAT__: <value> }` back to primitives\n * - Converting legacy string markers (__NULL__, __FALSE__, __ZERO__) back to their original values\n * - Removing fields whose converted value is empty string or null\n * - Removing empty arrays\n *\n * @example\n * const formState = {\n * name: 'John',\n * scores: [\n * { __FLAT__: 75 },\n * { __FLAT__: 0 },\n * { __FLAT__: null },\n * { __FLAT__: false }\n * ],\n * emptyArray: [],\n * scoresDetailed: [\n * { score: 1 },\n * {},\n * { score: 0 },\n * { score: false },\n * {},\n * ],\n * contact: {\n * address: '123 Main St',\n * fax: null\n * }\n * };\n *\n * // Result:\n * {\n * name: 'John',\n * scores: [75, 0, null, false],\n * // emptyArray is removed\n * // Objects inside arrays remain objects; empty entries remain empty objects\n * scoresDetailed: [\n * { score: 1 },\n * {},\n * { score: 0 },\n * { score: false },\n * {},\n * ],\n * contact: {\n * address: '123 Main St'\n * }\n * }\n */\nexport const toValidationFormat = (\n formState: Record<string, unknown> | null | undefined,\n): Record<string, unknown> | null | undefined => {\n // Handle null or undefined input\n if (formState === undefined || formState === null) {\n return formState;\n }\n\n const validationFormatJson = JSON.stringify(formState, (_, value) => {\n if (Array.isArray(value)) {\n return value.map((v) => {\n // Unwrap new wrapper format { __FLAT__: <value> }\n if (v && typeof v === 'object') {\n const record = v as Record<string, unknown>;\n if (flatArrayKey in record) {\n const inner = record[flatArrayKey];\n // Treat empty string from forms as null in validation format\n if (inner === '') {\n return null;\n }\n return fromNullishString(inner);\n }\n }\n // Backward compatibility for string markers\n return fromNullishString(v);\n });\n }\n\n if (value && typeof value === 'object') {\n // Object branch: remove keys that resolve to empty/null after marker conversion\n // and unwrap flat-array wrappers if present.\n //\n // Why this shape?\n // - Forms may contain objects with placeholder/empty values that should not\n // be part of the validation payload (e.g. \"\" or __NULL__ markers).\n // - Arrays of primitives are stored as wrapper objects { __FLAT__: <value> }\n // to satisfy RHF structure constraints. When converting back for\n // validation, we need to treat wrappers whose inner value resolves to\n // empty/null as removable, and unwrap non-empty wrappers to the primitive.\n return Object.fromEntries(\n Object.entries(value)\n .filter(([_key, v]) => {\n // If this is a flat-array wrapper, convert the inner value first and\n // drop the key when the inner resolves to empty string or null.\n if (v && typeof v === 'object') {\n const record = v as Record<string, unknown>;\n if (flatArrayKey in record) {\n const convertedInner = fromNullishString(record[flatArrayKey]);\n return convertedInner !== '' && convertedInner !== null;\n }\n }\n // Drop empty arrays\n if (Array.isArray(v) && v.length === 0) {\n return false;\n }\n // For regular values, convert markers and drop when empty/null.\n const converted = fromNullishString(v);\n return converted !== '' && converted !== null;\n })\n .map(([k, v]) => {\n // Unwrap flat-array wrappers to raw primitives after conversion.\n if (v && typeof v === 'object') {\n const record = v as Record<string, unknown>;\n if (flatArrayKey in record) {\n return [k, fromNullishString(record[flatArrayKey])];\n }\n }\n // For other values, just convert markers.\n return [k, fromNullishString(v)];\n }),\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return value;\n });\n\n return JSON.parse(validationFormatJson) as Record<string, unknown>;\n};\n\n/**\n * Helper function to check if a value is an empty object (not an array).\n */\nconst isEmptyObject = (value: unknown): boolean => {\n return (\n value !== null &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n Object.keys(value).length === 0\n );\n};\n\n/**\n * Recursively removes empty objects from a data structure.\n * - Filters empty objects from arrays\n * - Removes properties with empty object values\n * - Removes arrays that become empty after filtering\n */\nconst removeEmptyObjects = (obj: unknown): unknown => {\n if (Array.isArray(obj)) {\n // Filter out empty objects from arrays, then recursively process remaining items\n return obj\n .filter((item) => {\n return !isEmptyObject(item);\n })\n .map((item) => {\n return removeEmptyObjects(item);\n });\n }\n\n if (obj !== null && typeof obj === 'object') {\n return Object.fromEntries(\n Object.entries(obj)\n .map(([key, value]) => {\n return [key, removeEmptyObjects(value)] as [string, unknown];\n })\n .filter(([_, processed]) => {\n // Skip empty objects\n if (isEmptyObject(processed)) {\n return false;\n }\n // Skip arrays that are now empty after filtering\n if (Array.isArray(processed) && processed.length === 0) {\n return false;\n }\n return true;\n }),\n );\n }\n\n return obj;\n};\n\n/**\n * Converts form state to a format suitable for submission by:\n * - Applying all transformations from toValidationFormat\n * - Additionally removing empty objects from the result\n * - Filtering empty objects from arrays\n * - Recursively cleaning nested structures\n *\n * **Why separate from toValidationFormat?**\n *\n * Empty objects must be preserved during validation so that custom refinements\n * can run. For example, a FieldCard with \"at least email or phone required\"\n * validation needs the object to exist (even if empty) for the refine to execute.\n *\n * However, for submission, empty objects are meaningless and should be removed\n * to produce clean data for APIs.\n *\n * @example\n * const formState = {\n * name: 'John',\n * contact: {}, // Empty FieldCard - will be removed\n * tags: [{}, {}, {}], // All empty - array will be removed\n * items: [\n * { value: 'a' },\n * {}, // Empty entry - will be filtered out\n * { value: 'b' }\n * ],\n * nested: {\n * deep: {} // Nested empty - will be removed recursively\n * }\n * };\n *\n * // Result:\n * {\n * name: 'John',\n * items: [{ value: 'a' }, { value: 'b' }]\n * }\n */\nexport const toSubmitFormat = (\n formState: Record<string, unknown> | null | undefined,\n): Record<string, unknown> | null | undefined => {\n const validated = toValidationFormat(formState);\n if (!validated) {\n return validated;\n }\n return removeEmptyObjects(validated) as Record<string, unknown>;\n};\n\n/**\n * Converts a field name to a testId by removing flat array key segments and slugifying.\n * Removes all occurrences of `flatArrayKey` from the field name and applies slugify transformation.\n *\n * This is used to generate stable testIds for form fields that don't include\n * the internal `__FLAT__` marker used for flat arrays.\n *\n * @param name - The field name as a string (e.g., 'tags.0.__FLAT__') or array path (e.g., ['tags', '0', '__FLAT__'])\n * @returns The slugified field name with all flat array key segments removed (e.g., 'tags_0')\n *\n * @example\n * ```ts\n * nameToTestId('tags.0.__FLAT__') // => 'tags_0'\n * nameToTestId('array.0.__FLAT__') // => 'array_0'\n * nameToTestId('nested.array.0.__FLAT__.field') // => 'nested_array_0_field'\n * nameToTestId('simple.field') // => 'simple_field'\n * nameToTestId(['tags', '0', '__FLAT__']) // => 'tags_0'\n * ```\n */\nexport const nameToTestId = (name: string | readonly string[]): string => {\n let cleanName: string;\n\n // Handle array paths - filter out flatArrayKey and join with dots\n if (Array.isArray(name)) {\n cleanName = name\n .filter((segment: string) => {\n return segment !== flatArrayKey;\n })\n .join('.');\n } else {\n // Handle string paths - split by dots and filter out flatArrayKey segments\n const segments = (name as string).split('.');\n cleanName = segments\n .filter((segment: string) => {\n return segment !== flatArrayKey;\n })\n .join('.');\n }\n\n // Apply slugify transformation\n return slugify(cleanName, { replaceDots: true });\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAa,8BAGX,YACG;CAEH,MAAM,kBAAkB,IAAI,IAC1B,QACG,QAAQ,WAAW;EAClB,OAAO,OAAO,OAAO,UAAU;CACjC,CAAC,EACA,KAAK,WAAW;EACf,OAAO,OAAO,OAAO,KAAK;CAC5B,CAAC,CACL;CAGA,MAAM,mBAAmB,IAAI,IAC3B,QACG,QAAQ,WAAW;EAClB,OAAO,OAAO,OAAO,UAAU;CACjC,CAAC,EACA,KAAK,WAAW;EACf,OAAO,CAAC,OAAO,OAAO,KAAK,GAAG,OAAO,KAAgB;CACvD,CAAC,CACL;;;;;CAMA,MAAM,yBACJ,QAC8B;EAC9B,MAAM,SAAS,OAAO,GAAG;EACzB,MAAM,eAAe,iBAAiB,IAAI,MAAM;EAChD,IAAI,iBAAiB,KAAA,GACnB,OAAO;EAET,IAAI,gBAAgB,IAAI,MAAM,GAC5B,OAAO,OAAO,MAAM;EAEtB,OAAO;CACT;CAEA,OAAO;EACL;EACA;EACA;CACF;AACF;;;;;;;;;;ACtDA,MAAM,gBAAgB,UAAwC;CAC5D,OACE,OAAO,UAAU,YACjB,UAAU,SACT,aAAa,SAAS,UAAU;AAErC;;;;;;;;;;AAWA,MAAa,sBAAsB,UAAiC;CAClE,IAAI,CAAC,OACH,OAAO,CAAC;CAGV,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,MAAM,SAAS,SAAS;EAC7B,OAAO,mBAAmB,IAAI;CAChC,CAAC;CAGH,IAAI,aAAa,KAAK,GACpB,OAAO,CAAC,KAAK;CAGf,IAAI,OAA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AAM,QAAQ,SAAS,KAAK,UAAU,WAAW,GACnD,OAAO;EAET,OAAO;CACT,CAAC,CACL;CAGF,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAa,kBACX,cAC+C;CAC/C,MAAM,YAAY,mBAAmB,SAAS;CAC9C,IAAI,CAAC,WACH,OAAO;CAET,OAAO,mBAAmB,SAAS;AACrC;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,gBAAgB,SAA6C;CACxE,IAAI;CAGJ,IAAI,MAAM,QAAQ,IAAI,GACpB,YAAY,KACT,QAAQ,YAAoB;EAC3B,OAAO,YAAY;CACrB,CAAC,EACA,KAAK,GAAG;MAIX,YADkB,KAAgB,MAAM,GACrB,EAChB,QAAQ,YAAoB;EAC3B,OAAO,YAAY;CACrB,CAAC,EACA,KAAK,GAAG;CAIb,QAAA,GAAA,uBAAA,SAAe,WAAW,EAAE,aAAa,KAAK,CAAC;AACjD"}
1
+ {"version":3,"file":"index.cjs","names":["record"],"sources":["../../src/helpers/createOptionValueConverter/createOptionValueConverter.ts","../../src/helpers/flattenFieldErrors/flattenFieldErrors.ts","../../src/helpers/nullishFields/nullishFields.ts"],"sourcesContent":["/* eslint-disable import-x/prefer-default-export */\n\n/**\n * Creates a converter function that preserves the original type (string, number, or boolean)\n * of option values when converting from string keys back to their original type.\n *\n * This is useful for radio/select components where the underlying UI library\n * uses string keys internally, but we want to preserve number/boolean values in the form state.\n *\n * @param options - Array of options with a value property that can be string, number, or boolean\n * @returns An object with:\n * - `convertToOriginalType`: Function to convert a string key back to its original type\n * - `numberValueKeys`: Set of string representations of number values (for internal use)\n * - `booleanValueKeys`: Map of string representations to boolean values (for internal use)\n */\nexport const createOptionValueConverter = <\n T extends { value: string | number | boolean },\n>(\n options: T[],\n) => {\n // Create a set of string keys that represent number values\n const numberValueKeys = new Set(\n options\n .filter((option) => {\n return typeof option.value === 'number';\n })\n .map((option) => {\n return String(option.value);\n }),\n );\n\n // Create a map of string keys to boolean values\n const booleanValueKeys = new Map(\n options\n .filter((option) => {\n return typeof option.value === 'boolean';\n })\n .map((option) => {\n return [String(option.value), option.value as boolean];\n }),\n );\n\n /**\n * Converts a string key back to its original type (string, number, or boolean)\n * based on whether the original option value was a number or boolean\n */\n const convertToOriginalType = (\n key: string | number | boolean,\n ): string | number | boolean => {\n const keyStr = String(key);\n const booleanValue = booleanValueKeys.get(keyStr);\n if (booleanValue !== undefined) {\n return booleanValue;\n }\n if (numberValueKeys.has(keyStr)) {\n return Number(keyStr);\n }\n return keyStr;\n };\n\n return {\n booleanValueKeys,\n convertToOriginalType,\n numberValueKeys,\n };\n};\n","/* eslint-disable import-x/prefer-default-export */\n\nimport type { FieldError } from 'react-hook-form';\n\n/**\n * Narrow an unknown value to a react-hook-form `FieldError`.\n *\n * RHF `FieldError` entries carry metadata like `message` and/or `type`,\n * while container nodes (objects keyed by index, `_errors`, etc.) do not.\n * This guard distinguishes leaf errors from nested wrappers.\n */\nconst isFieldError = (error: unknown): error is FieldError => {\n return (\n typeof error === 'object' &&\n error !== null &&\n ('message' in error || 'type' in error)\n );\n};\n\n/**\n * Normalize RHF validation payloads to a flat `FieldError[]`.\n *\n * Depending on field shape, RHF may return:\n * - a single `FieldError`\n * - an array of `FieldError`\n * - nested objects keyed by array indices\n * - objects containing `_errors` arrays for array/object-level issues\n */\nexport const flattenFieldErrors = (error: unknown): FieldError[] => {\n if (!error) {\n return [];\n }\n\n if (Array.isArray(error)) {\n return error.flatMap((item) => {\n return flattenFieldErrors(item);\n });\n }\n\n if (isFieldError(error)) {\n return [error];\n }\n\n if (typeof error === 'object') {\n return Object.values(error as Record<string, unknown>).flatMap((item) => {\n return flattenFieldErrors(item);\n });\n }\n\n return [];\n};\n","import { slugify } from '@fuf-stack/pixel-utils';\n\n/** Key used to wrap flat array elements when converting to form format */\nexport const flatArrayKey = '__FLAT__';\n\n/**\n * String markers used to preserve null, false, and 0 values during JSON processing\n */\nconst nullString = '__NULL__';\nconst falseString = '__FALSE__';\nconst zeroString = '__ZERO__';\n\n/**\n * Checks if a value is considered \"empty\" for validation display purposes.\n *\n * Used by useUniformField to determine when to show validation errors.\n * Empty values don't trigger immediate error display (user must interact first).\n *\n * Handles:\n * - Primitives: null, undefined, ''\n * - Marker strings: __NULL__, __FALSE__, __ZERO__ (converted via fromNullishString)\n * - Empty arrays: []\n * - Objects with all empty values: {a: null, b: ''}\n * - Flat array wrappers: {__FLAT__: null} or {__FLAT__: ''}\n *\n * @param value - The value to check (will be converted via fromNullishString first)\n * @returns true if the value is empty\n *\n * @example\n * isValueEmpty(null) // true\n * isValueEmpty('') // true\n * isValueEmpty('__NULL__') // true (marker string)\n * isValueEmpty([]) // true (empty array)\n * isValueEmpty({a: null}) // true (object with all empty values)\n * isValueEmpty({__FLAT__: null}) // true (flat array wrapper with empty value)\n * isValueEmpty({__FLAT__: ''}) // true\n * isValueEmpty('hello') // false\n * isValueEmpty([1, 2]) // false\n * isValueEmpty({a: 'value'}) // false\n * isValueEmpty({__FLAT__: 'value'}) // false\n */\nexport const isValueEmpty = (value: unknown): boolean => {\n // Convert marker strings first\n const converted = fromNullishString(value);\n\n if (converted === undefined || converted === null || converted === '') {\n return true;\n }\n if (Array.isArray(converted)) {\n return converted.length === 0;\n }\n if (typeof converted === 'object' && converted !== null) {\n const record = converted as Record<string, unknown>;\n // Handle flat array wrapper: { __FLAT__: innerValue }\n if (flatArrayKey in record) {\n return isValueEmpty(record[flatArrayKey]);\n }\n // For objects (e.g., FieldCard), check if all values are null/undefined/empty\n const values = Object.values(record);\n return values.length === 0 || values.every(isValueEmpty);\n }\n return false;\n};\n\n/**\n * Converts marker strings back to their original values when processing arrays\n */\nexport const fromNullishString = (value: unknown): unknown => {\n // Support arrays: unwrap flat wrappers and convert marker strings per entry\n if (Array.isArray(value)) {\n return (value as unknown[]).map((entry) => {\n if (entry && typeof entry === 'object') {\n const record = entry as Record<string, unknown>;\n if (flatArrayKey in record) {\n const inner = record[flatArrayKey];\n // For arrays, treat empty string as null (placeholder input)\n if (inner === '') {\n return null;\n }\n return fromNullishString(inner);\n }\n }\n return fromNullishString(entry);\n });\n }\n\n if (typeof value !== 'string') {\n return value;\n }\n\n switch (value) {\n case nullString:\n return null;\n case falseString:\n return false;\n case zeroString:\n return 0;\n default:\n return value;\n }\n};\n\n/**\n * Converts null/falsy values to marker strings for JSON processing\n */\nexport const toNullishString = (value: unknown): unknown => {\n if (Array.isArray(value)) {\n // Only wrap arrays of primitives; leave arrays of objects as-is\n const isPrimitive = (v: unknown) => {\n return v === null || ['string', 'number', 'boolean'].includes(typeof v);\n };\n const isPrimitiveArray = (value as unknown[]).every(isPrimitive);\n if (isPrimitiveArray) {\n return (value as unknown[]).map((v) => {\n // Store raw primitive; do not convert to marker strings inside the wrapper\n return { [flatArrayKey]: v };\n });\n }\n return value;\n }\n if (value === null || value === '') {\n return nullString;\n }\n if (value === false) {\n return falseString;\n }\n if (value === 0) {\n return zeroString;\n }\n return value;\n};\n\n/**\n * Converts field values to a format suitable for forms by:\n * - Wrapping arrays of primitives as objects using the flatArrayKey `__FLAT__`\n * to satisfy RHF's requirement that array fields contain objects\n * - Removing empty strings and null values from objects\n *\n * This conversion is required because React Hook Form does not support arrays with\n * flat values (string, number, boolean, null). Array fields must contain objects.\n * We work around this by wrapping primitive entries: `{ __FLAT__: <value> }`.\n *\n * @example\n * const fields = {\n * name: 'John',\n * scores: [0, null, 75, false],\n * scoresDetailed: [\n * { score: 1 },\n * { score: null },\n * { score: 0 },\n * { score: false },\n * { score: '' },\n * ],\n * contact: {\n * email: '',\n * phone: null,\n * address: '123 Main St'\n * }\n * };\n *\n * // Result:\n * {\n * name: 'John',\n * scores: [\n * { __FLAT__: 0 },\n * { __FLAT__: null },\n * { __FLAT__: 75 },\n * { __FLAT__: false }\n * ],\n * // Arrays of objects are left as objects; empty/null properties are removed\n * scoresDetailed: [\n * { score: 1 },\n * {}, // null score removed\n * { score: 0 },\n * { score: false },\n * {}, // empty string removed\n * ],\n * contact: {\n * address: '123 Main St'\n * }\n * }\n */\nexport const toFormFormat = (fields: Record<string, unknown>) => {\n const formFormatJson = JSON.stringify(fields, (_, value) => {\n if (Array.isArray(value)) {\n // Delegate to toNullishString to ensure consistent handling\n return toNullishString(value);\n }\n\n if (value && typeof value === 'object') {\n // Preserve flat-array wrappers as-is (do not filter their inner values here)\n const record = value as Record<string, unknown>;\n if (flatArrayKey in record) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return value;\n }\n return Object.fromEntries(\n Object.entries(value).filter(([_key, v]) => {\n return v !== '' && v !== null;\n }),\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return value;\n });\n\n return JSON.parse(formFormatJson) as Record<string, unknown>;\n};\n\n/**\n * Converts form state to a format suitable for validation by:\n * - Unwrapping flat array wrappers `{ __FLAT__: <value> }` back to primitives\n * - Converting legacy string markers (__NULL__, __FALSE__, __ZERO__) back to their original values\n * - Removing fields whose converted value is empty string or null\n * - Removing empty arrays\n *\n * @example\n * const formState = {\n * name: 'John',\n * scores: [\n * { __FLAT__: 75 },\n * { __FLAT__: 0 },\n * { __FLAT__: null },\n * { __FLAT__: false }\n * ],\n * emptyArray: [],\n * scoresDetailed: [\n * { score: 1 },\n * {},\n * { score: 0 },\n * { score: false },\n * {},\n * ],\n * contact: {\n * address: '123 Main St',\n * fax: null\n * }\n * };\n *\n * // Result:\n * {\n * name: 'John',\n * scores: [75, 0, null, false],\n * // emptyArray is removed\n * // Objects inside arrays remain objects; empty entries remain empty objects\n * scoresDetailed: [\n * { score: 1 },\n * {},\n * { score: 0 },\n * { score: false },\n * {},\n * ],\n * contact: {\n * address: '123 Main St'\n * }\n * }\n */\nexport const toValidationFormat = (\n formState: Record<string, unknown> | null | undefined,\n): Record<string, unknown> | null | undefined => {\n // Handle null or undefined input\n if (formState === undefined || formState === null) {\n return formState;\n }\n\n const validationFormatJson = JSON.stringify(formState, (_, value) => {\n if (Array.isArray(value)) {\n return value.map((v) => {\n // Unwrap new wrapper format { __FLAT__: <value> }\n if (v && typeof v === 'object') {\n const record = v as Record<string, unknown>;\n if (flatArrayKey in record) {\n const inner = record[flatArrayKey];\n // Treat empty string from forms as null in validation format\n if (inner === '') {\n return null;\n }\n return fromNullishString(inner);\n }\n }\n // Backward compatibility for string markers\n return fromNullishString(v);\n });\n }\n\n if (value && typeof value === 'object') {\n // Object branch: remove keys that resolve to empty/null after marker conversion\n // and unwrap flat-array wrappers if present.\n //\n // Why this shape?\n // - Forms may contain objects with placeholder/empty values that should not\n // be part of the validation payload (e.g. \"\" or __NULL__ markers).\n // - Arrays of primitives are stored as wrapper objects { __FLAT__: <value> }\n // to satisfy RHF structure constraints. When converting back for\n // validation, we need to treat wrappers whose inner value resolves to\n // empty/null as removable, and unwrap non-empty wrappers to the primitive.\n return Object.fromEntries(\n Object.entries(value)\n .filter(([_key, v]) => {\n // If this is a flat-array wrapper, convert the inner value first and\n // drop the key when the inner resolves to empty string or null.\n if (v && typeof v === 'object') {\n const record = v as Record<string, unknown>;\n if (flatArrayKey in record) {\n const convertedInner = fromNullishString(record[flatArrayKey]);\n return convertedInner !== '' && convertedInner !== null;\n }\n }\n // Drop empty arrays\n if (Array.isArray(v) && v.length === 0) {\n return false;\n }\n // For regular values, convert markers and drop when empty/null.\n const converted = fromNullishString(v);\n return converted !== '' && converted !== null;\n })\n .map(([k, v]) => {\n // Unwrap flat-array wrappers to raw primitives after conversion.\n if (v && typeof v === 'object') {\n const record = v as Record<string, unknown>;\n if (flatArrayKey in record) {\n return [k, fromNullishString(record[flatArrayKey])];\n }\n }\n // For other values, just convert markers.\n return [k, fromNullishString(v)];\n }),\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return value;\n });\n\n return JSON.parse(validationFormatJson) as Record<string, unknown>;\n};\n\n/**\n * Helper function to check if a value is an empty object (not an array).\n */\nconst isEmptyObject = (value: unknown): boolean => {\n return (\n value !== null &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n Object.keys(value).length === 0\n );\n};\n\n/**\n * Recursively removes empty objects from a data structure.\n * - Filters empty objects from arrays\n * - Removes properties with empty object values\n * - Removes arrays that become empty after filtering\n */\nconst removeEmptyObjects = (obj: unknown): unknown => {\n if (Array.isArray(obj)) {\n // Filter out empty objects from arrays, then recursively process remaining items\n return obj\n .filter((item) => {\n return !isEmptyObject(item);\n })\n .map((item) => {\n return removeEmptyObjects(item);\n });\n }\n\n if (obj !== null && typeof obj === 'object') {\n return Object.fromEntries(\n Object.entries(obj)\n .map(([key, value]) => {\n return [key, removeEmptyObjects(value)] as [string, unknown];\n })\n .filter(([_, processed]) => {\n // Skip empty objects\n if (isEmptyObject(processed)) {\n return false;\n }\n // Skip arrays that are now empty after filtering\n if (Array.isArray(processed) && processed.length === 0) {\n return false;\n }\n return true;\n }),\n );\n }\n\n return obj;\n};\n\n/**\n * Converts form state to a format suitable for submission by:\n * - Applying all transformations from toValidationFormat\n * - Additionally removing empty objects from the result\n * - Filtering empty objects from arrays\n * - Recursively cleaning nested structures\n *\n * **Why separate from toValidationFormat?**\n *\n * Empty objects must be preserved during validation so that custom refinements\n * can run. For example, a FieldCard with \"at least email or phone required\"\n * validation needs the object to exist (even if empty) for the refine to execute.\n *\n * However, for submission, empty objects are meaningless and should be removed\n * to produce clean data for APIs.\n *\n * @example\n * const formState = {\n * name: 'John',\n * contact: {}, // Empty FieldCard - will be removed\n * tags: [{}, {}, {}], // All empty - array will be removed\n * items: [\n * { value: 'a' },\n * {}, // Empty entry - will be filtered out\n * { value: 'b' }\n * ],\n * nested: {\n * deep: {} // Nested empty - will be removed recursively\n * }\n * };\n *\n * // Result:\n * {\n * name: 'John',\n * items: [{ value: 'a' }, { value: 'b' }]\n * }\n */\nexport const toSubmitFormat = (\n formState: Record<string, unknown> | null | undefined,\n): Record<string, unknown> | null | undefined => {\n const validated = toValidationFormat(formState);\n if (!validated) {\n return validated;\n }\n return removeEmptyObjects(validated) as Record<string, unknown>;\n};\n\n/**\n * Converts a field name to a testId by removing flat array key segments and slugifying.\n * Removes all occurrences of `flatArrayKey` from the field name and applies slugify transformation.\n *\n * This is used to generate stable testIds for form fields that don't include\n * the internal `__FLAT__` marker used for flat arrays.\n *\n * @param name - The field name as a string (e.g., 'tags.0.__FLAT__') or array path (e.g., ['tags', '0', '__FLAT__'])\n * @returns The slugified field name with all flat array key segments removed (e.g., 'tags_0')\n *\n * @example\n * ```ts\n * nameToTestId('tags.0.__FLAT__') // => 'tags_0'\n * nameToTestId('array.0.__FLAT__') // => 'array_0'\n * nameToTestId('nested.array.0.__FLAT__.field') // => 'nested_array_0_field'\n * nameToTestId('simple.field') // => 'simple_field'\n * nameToTestId(['tags', '0', '__FLAT__']) // => 'tags_0'\n * ```\n */\nexport const nameToTestId = (name: string | readonly string[]): string => {\n let cleanName: string;\n\n // Handle array paths - filter out flatArrayKey and join with dots\n if (Array.isArray(name)) {\n cleanName = name\n .filter((segment: string) => {\n return segment !== flatArrayKey;\n })\n .join('.');\n } else {\n // Handle string paths - split by dots and filter out flatArrayKey segments\n const segments = (name as string).split('.');\n cleanName = segments\n .filter((segment: string) => {\n return segment !== flatArrayKey;\n })\n .join('.');\n }\n\n // Apply slugify transformation\n return slugify(cleanName, { replaceDots: true });\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,MAAa,8BAGX,YACG;CAEH,MAAM,kBAAkB,IAAI,IAC1B,QACG,QAAQ,WAAW;EAClB,OAAO,OAAO,OAAO,UAAU;CACjC,CAAC,CAAC,CACD,KAAK,WAAW;EACf,OAAO,OAAO,OAAO,KAAK;CAC5B,CAAC,CACL;CAGA,MAAM,mBAAmB,IAAI,IAC3B,QACG,QAAQ,WAAW;EAClB,OAAO,OAAO,OAAO,UAAU;CACjC,CAAC,CAAC,CACD,KAAK,WAAW;EACf,OAAO,CAAC,OAAO,OAAO,KAAK,GAAG,OAAO,KAAgB;CACvD,CAAC,CACL;;;;;CAMA,MAAM,yBACJ,QAC8B;EAC9B,MAAM,SAAS,OAAO,GAAG;E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version":3,"file":"index.js","names":["record"],"sources":["../../src/helpers/createOptionValueConverter/createOptionValueConverter.ts","../../src/helpers/flattenFieldErrors/flattenFieldErrors.ts","../../src/helpers/nullishFields/nullishFields.ts"],"sourcesContent":["/* eslint-disable import-x/prefer-default-export */\n\n/**\n * Creates a converter function that preserves the original type (string, number, or boolean)\n * of option values when converting from string keys back to their original type.\n *\n * This is useful for radio/select components where the underlying UI library\n * uses string keys internally, but we want to preserve number/boolean values in the form state.\n *\n * @param options - Array of options with a value property that can be string, number, or boolean\n * @returns An object with:\n * - `convertToOriginalType`: Function to convert a string key back to its original type\n * - `numberValueKeys`: Set of string representations of number values (for internal use)\n * - `booleanValueKeys`: Map of string representations to boolean values (for internal use)\n */\nexport const createOptionValueConverter = <\n T extends { value: string | number | boolean },\n>(\n options: T[],\n) => {\n // Create a set of string keys that represent number values\n const numberValueKeys = new Set(\n options\n .filter((option) => {\n return typeof option.value === 'number';\n })\n .map((option) => {\n return String(option.value);\n }),\n );\n\n // Create a map of string keys to boolean values\n const booleanValueKeys = new Map(\n options\n .filter((option) => {\n return typeof option.value === 'boolean';\n })\n .map((option) => {\n return [String(option.value), option.value as boolean];\n }),\n );\n\n /**\n * Converts a string key back to its original type (string, number, or boolean)\n * based on whether the original option value was a number or boolean\n */\n const convertToOriginalType = (\n key: string | number | boolean,\n ): string | number | boolean => {\n const keyStr = String(key);\n const booleanValue = booleanValueKeys.get(keyStr);\n if (booleanValue !== undefined) {\n return booleanValue;\n }\n if (numberValueKeys.has(keyStr)) {\n return Number(keyStr);\n }\n return keyStr;\n };\n\n return {\n booleanValueKeys,\n convertToOriginalType,\n numberValueKeys,\n };\n};\n","/* eslint-disable import-x/prefer-default-export */\n\nimport type { FieldError } from 'react-hook-form';\n\n/**\n * Narrow an unknown value to a react-hook-form `FieldError`.\n *\n * RHF `FieldError` entries carry metadata like `message` and/or `type`,\n * while container nodes (objects keyed by index, `_errors`, etc.) do not.\n * This guard distinguishes leaf errors from nested wrappers.\n */\nconst isFieldError = (error: unknown): error is FieldError => {\n return (\n typeof error === 'object' &&\n error !== null &&\n ('message' in error || 'type' in error)\n );\n};\n\n/**\n * Normalize RHF validation payloads to a flat `FieldError[]`.\n *\n * Depending on field shape, RHF may return:\n * - a single `FieldError`\n * - an array of `FieldError`\n * - nested objects keyed by array indices\n * - objects containing `_errors` arrays for array/object-level issues\n */\nexport const flattenFieldErrors = (error: unknown): FieldError[] => {\n if (!error) {\n return [];\n }\n\n if (Array.isArray(error)) {\n return error.flatMap((item) => {\n return flattenFieldErrors(item);\n });\n }\n\n if (isFieldError(error)) {\n return [error];\n }\n\n if (typeof error === 'object') {\n return Object.values(error as Record<string, unknown>).flatMap((item) => {\n return flattenFieldErrors(item);\n });\n }\n\n return [];\n};\n","import { slugify } from '@fuf-stack/pixel-utils';\n\n/** Key used to wrap flat array elements when converting to form format */\nexport const flatArrayKey = '__FLAT__';\n\n/**\n * String markers used to preserve null, false, and 0 values during JSON processing\n */\nconst nullString = '__NULL__';\nconst falseString = '__FALSE__';\nconst zeroString = '__ZERO__';\n\n/**\n * Checks if a value is considered \"empty\" for validation display purposes.\n *\n * Used by useUniformField to determine when to show validation errors.\n * Empty values don't trigger immediate error display (user must interact first).\n *\n * Handles:\n * - Primitives: null, undefined, ''\n * - Marker strings: __NULL__, __FALSE__, __ZERO__ (converted via fromNullishString)\n * - Empty arrays: []\n * - Objects with all empty values: {a: null, b: ''}\n * - Flat array wrappers: {__FLAT__: null} or {__FLAT__: ''}\n *\n * @param value - The value to check (will be converted via fromNullishString first)\n * @returns true if the value is empty\n *\n * @example\n * isValueEmpty(null) // true\n * isValueEmpty('') // true\n * isValueEmpty('__NULL__') // true (marker string)\n * isValueEmpty([]) // true (empty array)\n * isValueEmpty({a: null}) // true (object with all empty values)\n * isValueEmpty({__FLAT__: null}) // true (flat array wrapper with empty value)\n * isValueEmpty({__FLAT__: ''}) // true\n * isValueEmpty('hello') // false\n * isValueEmpty([1, 2]) // false\n * isValueEmpty({a: 'value'}) // false\n * isValueEmpty({__FLAT__: 'value'}) // false\n */\nexport const isValueEmpty = (value: unknown): boolean => {\n // Convert marker strings first\n const converted = fromNullishString(value);\n\n if (converted === undefined || converted === null || converted === '') {\n return true;\n }\n if (Array.isArray(converted)) {\n return converted.length === 0;\n }\n if (typeof converted === 'object' && converted !== null) {\n const record = converted as Record<string, unknown>;\n // Handle flat array wrapper: { __FLAT__: innerValue }\n if (flatArrayKey in record) {\n return isValueEmpty(record[flatArrayKey]);\n }\n // For objects (e.g., FieldCard), check if all values are null/undefined/empty\n const values = Object.values(record);\n return values.length === 0 || values.every(isValueEmpty);\n }\n return false;\n};\n\n/**\n * Converts marker strings back to their original values when processing arrays\n */\nexport const fromNullishString = (value: unknown): unknown => {\n // Support arrays: unwrap flat wrappers and convert marker strings per entry\n if (Array.isArray(value)) {\n return (value as unknown[]).map((entry) => {\n if (entry && typeof entry === 'object') {\n const record = entry as Record<string, unknown>;\n if (flatArrayKey in record) {\n const inner = record[flatArrayKey];\n // For arrays, treat empty string as null (placeholder input)\n if (inner === '') {\n return null;\n }\n return fromNullishString(inner);\n }\n }\n return fromNullishString(entry);\n });\n }\n\n if (typeof value !== 'string') {\n return value;\n }\n\n switch (value) {\n case nullString:\n return null;\n case falseString:\n return false;\n case zeroString:\n return 0;\n default:\n return value;\n }\n};\n\n/**\n * Converts null/falsy values to marker strings for JSON processing\n */\nexport const toNullishString = (value: unknown): unknown => {\n if (Array.isArray(value)) {\n // Only wrap arrays of primitives; leave arrays of objects as-is\n const isPrimitive = (v: unknown) => {\n return v === null || ['string', 'number', 'boolean'].includes(typeof v);\n };\n const isPrimitiveArray = (value as unknown[]).every(isPrimitive);\n if (isPrimitiveArray) {\n return (value as unknown[]).map((v) => {\n // Store raw primitive; do not convert to marker strings inside the wrapper\n return { [flatArrayKey]: v };\n });\n }\n return value;\n }\n if (value === null || value === '') {\n return nullString;\n }\n if (value === false) {\n return falseString;\n }\n if (value === 0) {\n return zeroString;\n }\n return value;\n};\n\n/**\n * Converts field values to a format suitable for forms by:\n * - Wrapping arrays of primitives as objects using the flatArrayKey `__FLAT__`\n * to satisfy RHF's requirement that array fields contain objects\n * - Removing empty strings and null values from objects\n *\n * This conversion is required because React Hook Form does not support arrays with\n * flat values (string, number, boolean, null). Array fields must contain objects.\n * We work around this by wrapping primitive entries: `{ __FLAT__: <value> }`.\n *\n * @example\n * const fields = {\n * name: 'John',\n * scores: [0, null, 75, false],\n * scoresDetailed: [\n * { score: 1 },\n * { score: null },\n * { score: 0 },\n * { score: false },\n * { score: '' },\n * ],\n * contact: {\n * email: '',\n * phone: null,\n * address: '123 Main St'\n * }\n * };\n *\n * // Result:\n * {\n * name: 'John',\n * scores: [\n * { __FLAT__: 0 },\n * { __FLAT__: null },\n * { __FLAT__: 75 },\n * { __FLAT__: false }\n * ],\n * // Arrays of objects are left as objects; empty/null properties are removed\n * scoresDetailed: [\n * { score: 1 },\n * {}, // null score removed\n * { score: 0 },\n * { score: false },\n * {}, // empty string removed\n * ],\n * contact: {\n * address: '123 Main St'\n * }\n * }\n */\nexport const toFormFormat = (fields: Record<string, unknown>) => {\n const formFormatJson = JSON.stringify(fields, (_, value) => {\n if (Array.isArray(value)) {\n // Delegate to toNullishString to ensure consistent handling\n return toNullishString(value);\n }\n\n if (value && typeof value === 'object') {\n // Preserve flat-array wrappers as-is (do not filter their inner values here)\n const record = value as Record<string, unknown>;\n if (flatArrayKey in record) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return value;\n }\n return Object.fromEntries(\n Object.entries(value).filter(([_key, v]) => {\n return v !== '' && v !== null;\n }),\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return value;\n });\n\n return JSON.parse(formFormatJson) as Record<string, unknown>;\n};\n\n/**\n * Converts form state to a format suitable for validation by:\n * - Unwrapping flat array wrappers `{ __FLAT__: <value> }` back to primitives\n * - Converting legacy string markers (__NULL__, __FALSE__, __ZERO__) back to their original values\n * - Removing fields whose converted value is empty string or null\n * - Removing empty arrays\n *\n * @example\n * const formState = {\n * name: 'John',\n * scores: [\n * { __FLAT__: 75 },\n * { __FLAT__: 0 },\n * { __FLAT__: null },\n * { __FLAT__: false }\n * ],\n * emptyArray: [],\n * scoresDetailed: [\n * { score: 1 },\n * {},\n * { score: 0 },\n * { score: false },\n * {},\n * ],\n * contact: {\n * address: '123 Main St',\n * fax: null\n * }\n * };\n *\n * // Result:\n * {\n * name: 'John',\n * scores: [75, 0, null, false],\n * // emptyArray is removed\n * // Objects inside arrays remain objects; empty entries remain empty objects\n * scoresDetailed: [\n * { score: 1 },\n * {},\n * { score: 0 },\n * { score: false },\n * {},\n * ],\n * contact: {\n * address: '123 Main St'\n * }\n * }\n */\nexport const toValidationFormat = (\n formState: Record<string, unknown> | null | undefined,\n): Record<string, unknown> | null | undefined => {\n // Handle null or undefined input\n if (formState === undefined || formState === null) {\n return formState;\n }\n\n const validationFormatJson = JSON.stringify(formState, (_, value) => {\n if (Array.isArray(value)) {\n return value.map((v) => {\n // Unwrap new wrapper format { __FLAT__: <value> }\n if (v && typeof v === 'object') {\n const record = v as Record<string, unknown>;\n if (flatArrayKey in record) {\n const inner = record[flatArrayKey];\n // Treat empty string from forms as null in validation format\n if (inner === '') {\n return null;\n }\n return fromNullishString(inner);\n }\n }\n // Backward compatibility for string markers\n return fromNullishString(v);\n });\n }\n\n if (value && typeof value === 'object') {\n // Object branch: remove keys that resolve to empty/null after marker conversion\n // and unwrap flat-array wrappers if present.\n //\n // Why this shape?\n // - Forms may contain objects with placeholder/empty values that should not\n // be part of the validation payload (e.g. \"\" or __NULL__ markers).\n // - Arrays of primitives are stored as wrapper objects { __FLAT__: <value> }\n // to satisfy RHF structure constraints. When converting back for\n // validation, we need to treat wrappers whose inner value resolves to\n // empty/null as removable, and unwrap non-empty wrappers to the primitive.\n return Object.fromEntries(\n Object.entries(value)\n .filter(([_key, v]) => {\n // If this is a flat-array wrapper, convert the inner value first and\n // drop the key when the inner resolves to empty string or null.\n if (v && typeof v === 'object') {\n const record = v as Record<string, unknown>;\n if (flatArrayKey in record) {\n const convertedInner = fromNullishString(record[flatArrayKey]);\n return convertedInner !== '' && convertedInner !== null;\n }\n }\n // Drop empty arrays\n if (Array.isArray(v) && v.length === 0) {\n return false;\n }\n // For regular values, convert markers and drop when empty/null.\n const converted = fromNullishString(v);\n return converted !== '' && converted !== null;\n })\n .map(([k, v]) => {\n // Unwrap flat-array wrappers to raw primitives after conversion.\n if (v && typeof v === 'object') {\n const record = v as Record<string, unknown>;\n if (flatArrayKey in record) {\n return [k, fromNullishString(record[flatArrayKey])];\n }\n }\n // For other values, just convert markers.\n return [k, fromNullishString(v)];\n }),\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return value;\n });\n\n return JSON.parse(validationFormatJson) as Record<string, unknown>;\n};\n\n/**\n * Helper function to check if a value is an empty object (not an array).\n */\nconst isEmptyObject = (value: unknown): boolean => {\n return (\n value !== null &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n Object.keys(value).length === 0\n );\n};\n\n/**\n * Recursively removes empty objects from a data structure.\n * - Filters empty objects from arrays\n * - Removes properties with empty object values\n * - Removes arrays that become empty after filtering\n */\nconst removeEmptyObjects = (obj: unknown): unknown => {\n if (Array.isArray(obj)) {\n // Filter out empty objects from arrays, then recursively process remaining items\n return obj\n .filter((item) => {\n return !isEmptyObject(item);\n })\n .map((item) => {\n return removeEmptyObjects(item);\n });\n }\n\n if (obj !== null && typeof obj === 'object') {\n return Object.fromEntries(\n Object.entries(obj)\n .map(([key, value]) => {\n return [key, removeEmptyObjects(value)] as [string, unknown];\n })\n .filter(([_, processed]) => {\n // Skip empty objects\n if (isEmptyObject(processed)) {\n return false;\n }\n // Skip arrays that are now empty after filtering\n if (Array.isArray(processed) && processed.length === 0) {\n return false;\n }\n return true;\n }),\n );\n }\n\n return obj;\n};\n\n/**\n * Converts form state to a format suitable for submission by:\n * - Applying all transformations from toValidationFormat\n * - Additionally removing empty objects from the result\n * - Filtering empty objects from arrays\n * - Recursively cleaning nested structures\n *\n * **Why separate from toValidationFormat?**\n *\n * Empty objects must be preserved during validation so that custom refinements\n * can run. For example, a FieldCard with \"at least email or phone required\"\n * validation needs the object to exist (even if empty) for the refine to execute.\n *\n * However, for submission, empty objects are meaningless and should be removed\n * to produce clean data for APIs.\n *\n * @example\n * const formState = {\n * name: 'John',\n * contact: {}, // Empty FieldCard - will be removed\n * tags: [{}, {}, {}], // All empty - array will be removed\n * items: [\n * { value: 'a' },\n * {}, // Empty entry - will be filtered out\n * { value: 'b' }\n * ],\n * nested: {\n * deep: {} // Nested empty - will be removed recursively\n * }\n * };\n *\n * // Result:\n * {\n * name: 'John',\n * items: [{ value: 'a' }, { value: 'b' }]\n * }\n */\nexport const toSubmitFormat = (\n formState: Record<string, unknown> | null | undefined,\n): Record<string, unknown> | null | undefined => {\n const validated = toValidationFormat(formState);\n if (!validated) {\n return validated;\n }\n return removeEmptyObjects(validated) as Record<string, unknown>;\n};\n\n/**\n * Converts a field name to a testId by removing flat array key segments and slugifying.\n * Removes all occurrences of `flatArrayKey` from the field name and applies slugify transformation.\n *\n * This is used to generate stable testIds for form fields that don't include\n * the internal `__FLAT__` marker used for flat arrays.\n *\n * @param name - The field name as a string (e.g., 'tags.0.__FLAT__') or array path (e.g., ['tags', '0', '__FLAT__'])\n * @returns The slugified field name with all flat array key segments removed (e.g., 'tags_0')\n *\n * @example\n * ```ts\n * nameToTestId('tags.0.__FLAT__') // => 'tags_0'\n * nameToTestId('array.0.__FLAT__') // => 'array_0'\n * nameToTestId('nested.array.0.__FLAT__.field') // => 'nested_array_0_field'\n * nameToTestId('simple.field') // => 'simple_field'\n * nameToTestId(['tags', '0', '__FLAT__']) // => 'tags_0'\n * ```\n */\nexport const nameToTestId = (name: string | readonly string[]): string => {\n let cleanName: string;\n\n // Handle array paths - filter out flatArrayKey and join with dots\n if (Array.isArray(name)) {\n cleanName = name\n .filter((segment: string) => {\n return segment !== flatArrayKey;\n })\n .join('.');\n } else {\n // Handle string paths - split by dots and filter out flatArrayKey segments\n const segments = (name as string).split('.');\n cleanName = segments\n .filter((segment: string) => {\n return segment !== flatArrayKey;\n })\n .join('.');\n }\n\n // Apply slugify transformation\n return slugify(cleanName, { replaceDots: true });\n};\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,8BAGX,YACG;CAEH,MAAM,kBAAkB,IAAI,IAC1B,QACG,QAAQ,WAAW;EAClB,OAAO,OAAO,OAAO,UAAU;CACjC,CAAC,EACA,KAAK,WAAW;EACf,OAAO,OAAO,OAAO,KAAK;CAC5B,CAAC,CACL;CAGA,MAAM,mBAAmB,IAAI,IAC3B,QACG,QAAQ,WAAW;EAClB,OAAO,OAAO,OAAO,UAAU;CACjC,CAAC,EACA,KAAK,WAAW;EACf,OAAO,CAAC,OAAO,OAAO,KAAK,GAAG,OAAO,KAAgB;CACvD,CAAC,CACL;;;;;CAMA,MAAM,yBACJ,QAC8B;EAC9B,MAAM,SAAS,OAAO,GAAG;EACzB,MAAM,eAAe,iBAAiB,IAAI,MAAM;EAChD,IAAI,iBAAiB,KAAA,GACnB,OAAO;EAET,IAAI,gBAAgB,IAAI,MAAM,GAC5B,OAAO,OAAO,MAAM;EAEtB,OAAO;CACT;CAEA,OAAO;EACL;EACA;EACA;CACF;AACF;;;;;;;;;;ACtDA,MAAM,gBAAgB,UAAwC;CAC5D,OACE,OAAO,UAAU,YACjB,UAAU,SACT,aAAa,SAAS,UAAU;AAErC;;;;;;;;;;AAWA,MAAa,sBAAsB,UAAiC;CAClE,IAAI,CAAC,OACH,OAAO,CAAC;CAGV,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,MAAM,SAAS,SAAS;EAC7B,OAAO,mBAAmB,IAAI;CAChC,CAAC;CAGH,IAAI,aAAa,KAAK,GACpB,OAAO,CAAC,KAAK;CAGf,IAAI,OAAO,UAAU,UACnB,OAAO,OAAO,OAAO,KAAgC,EAAE,SAAS,SAAS;EACvE,OAAO,mBAAmB,IAAI;CAChC,CAAC;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAa,kBACX,cAC+C;CAC/C,MAAM,YAAY,mBAAmB,SAAS;CAC9C,IAAI,CAAC,WACH,OAAO;CAET,OAAO,mBAAmB,SAAS;AACrC;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,gBAAgB,SAA6C;CACxE,IAAI;CAGJ,IAAI,MAAM,QAAQ,IAAI,GACpB,YAAY,KACT,QAAQ,YAAoB;EAC3B,OAAO,YAAY;CACrB,CAAC,EACA,KAAK,GAAG;MAIX,YADkB,KAAgB,MAAM,GACrB,EAChB,QAAQ,YAAoB;EAC3B,OAAO,YAAY;CACrB,CAAC,EACA,KAAK,GAAG;CAIb,OAAO,QAAQ,WAAW,EAAE,aAAa,KAAK,CAAC;AACjD"}
1
+ {"version":3,"file":"index.js","names":["record"],"sources":["../../src/helpers/createOptionValueConverter/createOptionValueConverter.ts","../../src/helpers/flattenFieldErrors/flattenFieldErrors.ts","../../src/helpers/nullishFields/nullishFields.ts"],"sourcesContent":["/* eslint-disable import-x/prefer-default-export */\n\n/**\n * Creates a converter function that preserves the original type (string, number, or boolean)\n * of option values when converting from string keys back to their original type.\n *\n * This is useful for radio/select components where the underlying UI library\n * uses string keys internally, but we want to preserve number/boolean values in the form state.\n *\n * @param options - Array of options with a value property that can be string, number, or boolean\n * @returns An object with:\n * - `convertToOriginalType`: Function to convert a string key back to its original type\n * - `numberValueKeys`: Set of string representations of number values (for internal use)\n * - `booleanValueKeys`: Map of string representations to boolean values (for internal use)\n */\nexport const createOptionValueConverter = <\n T extends { value: string | number | boolean },\n>(\n options: T[],\n) => {\n // Create a set of string keys that represent number values\n const numberValueKeys = new Set(\n options\n .filter((option) => {\n return typeof option.value === 'number';\n })\n .map((option) => {\n return String(option.value);\n }),\n );\n\n // Create a map of string keys to boolean values\n const booleanValueKeys = new Map(\n options\n .filter((option) => {\n return typeof option.value === 'boolean';\n })\n .map((option) => {\n return [String(option.value), option.value as boolean];\n }),\n );\n\n /**\n * Converts a string key back to its original type (string, number, or boolean)\n * based on whether the original option value was a number or boolean\n */\n const convertToOriginalType = (\n key: string | number | boolean,\n ): string | number | boolean => {\n const keyStr = String(key);\n const booleanValue = booleanValueKeys.get(keyStr);\n if (booleanValue !== undefined) {\n return booleanValue;\n }\n if (numberValueKeys.has(keyStr)) {\n return Number(keyStr);\n }\n return keyStr;\n };\n\n return {\n booleanValueKeys,\n convertToOriginalType,\n numberValueKeys,\n };\n};\n","/* eslint-disable import-x/prefer-default-export */\n\nimport type { FieldError } from 'react-hook-form';\n\n/**\n * Narrow an unknown value to a react-hook-form `FieldError`.\n *\n * RHF `FieldError` entries carry metadata like `message` and/or `type`,\n * while container nodes (objects keyed by index, `_errors`, etc.) do not.\n * This guard distinguishes leaf errors from nested wrappers.\n */\nconst isFieldError = (error: unknown): error is FieldError => {\n return (\n typeof error === 'object' &&\n error !== null &&\n ('message' in error || 'type' in error)\n );\n};\n\n/**\n * Normalize RHF validation payloads to a flat `FieldError[]`.\n *\n * Depending on field shape, RHF may return:\n * - a single `FieldError`\n * - an array of `FieldError`\n * - nested objects keyed by array indices\n * - objects containing `_errors` arrays for array/object-level issues\n */\nexport const flattenFieldErrors = (error: unknown): FieldError[] => {\n if (!error) {\n return [];\n }\n\n if (Array.isArray(error)) {\n return error.flatMap((item) => {\n return flattenFieldErrors(item);\n });\n }\n\n if (isFieldError(error)) {\n return [error];\n }\n\n if (typeof error === 'object') {\n return Object.values(error as Record<string, unknown>).flatMap((item) => {\n return flattenFieldErrors(item);\n });\n }\n\n return [];\n};\n","import { slugify } from '@fuf-stack/pixel-utils';\n\n/** Key used to wrap flat array elements when converting to form format */\nexport const flatArrayKey = '__FLAT__';\n\n/**\n * String markers used to preserve null, false, and 0 values during JSON processing\n */\nconst nullString = '__NULL__';\nconst falseString = '__FALSE__';\nconst zeroString = '__ZERO__';\n\n/**\n * Checks if a value is considered \"empty\" for validation display purposes.\n *\n * Used by useUniformField to determine when to show validation errors.\n * Empty values don't trigger immediate error display (user must interact first).\n *\n * Handles:\n * - Primitives: null, undefined, ''\n * - Marker strings: __NULL__, __FALSE__, __ZERO__ (converted via fromNullishString)\n * - Empty arrays: []\n * - Objects with all empty values: {a: null, b: ''}\n * - Flat array wrappers: {__FLAT__: null} or {__FLAT__: ''}\n *\n * @param value - The value to check (will be converted via fromNullishString first)\n * @returns true if the value is empty\n *\n * @example\n * isValueEmpty(null) // true\n * isValueEmpty('') // true\n * isValueEmpty('__NULL__') // true (marker string)\n * isValueEmpty([]) // true (empty array)\n * isValueEmpty({a: null}) // true (object with all empty values)\n * isValueEmpty({__FLAT__: null}) // true (flat array wrapper with empty value)\n * isValueEmpty({__FLAT__: ''}) // true\n * isValueEmpty('hello') // false\n * isValueEmpty([1, 2]) // false\n * isValueEmpty({a: 'value'}) // false\n * isValueEmpty({__FLAT__: 'value'}) // false\n */\nexport const isValueEmpty = (value: unknown): boolean => {\n // Convert marker strings first\n const converted = fromNullishString(value);\n\n if (converted === undefined || converted === null || converted === '') {\n return true;\n }\n if (Array.isArray(converted)) {\n return converted.length === 0;\n }\n if (typeof converted === 'object' && converted !== null) {\n const record = converted as Record<string, unknown>;\n // Handle flat array wrapper: { __FLAT__: innerValue }\n if (flatArrayKey in record) {\n return isValueEmpty(record[flatArrayKey]);\n }\n // For objects (e.g., FieldCard), check if all values are null/undefined/empty\n const values = Object.values(record);\n return values.length === 0 || values.every(isValueEmpty);\n }\n return false;\n};\n\n/**\n * Converts marker strings back to their original values when processing arrays\n */\nexport const fromNullishString = (value: unknown): unknown => {\n // Support arrays: unwrap flat wrappers and convert marker strings per entry\n if (Array.isArray(value)) {\n return (value as unknown[]).map((entry) => {\n if (entry && typeof entry === 'object') {\n const record = entry as Record<string, unknown>;\n if (flatArrayKey in record) {\n const inner = record[flatArrayKey];\n // For arrays, treat empty string as null (placeholder input)\n if (inner === '') {\n return null;\n }\n return fromNullishString(inner);\n }\n }\n return fromNullishString(entry);\n });\n }\n\n if (typeof value !== 'string') {\n return value;\n }\n\n switch (value) {\n case nullString:\n return null;\n case falseString:\n return false;\n case zeroString:\n return 0;\n default:\n return value;\n }\n};\n\n/**\n * Converts null/falsy values to marker strings for JSON processing\n */\nexport const toNullishString = (value: unknown): unknown => {\n if (Array.isArray(value)) {\n // Only wrap arrays of primitives; leave arrays of objects as-is\n const isPrimitive = (v: unknown) => {\n return v === null || ['string', 'number', 'boolean'].includes(typeof v);\n };\n const isPrimitiveArray = (value as unknown[]).every(isPrimitive);\n if (isPrimitiveArray) {\n return (value as unknown[]).map((v) => {\n // Store raw primitive; do not convert to marker strings inside the wrapper\n return { [flatArrayKey]: v };\n });\n }\n return value;\n }\n if (value === null || value === '') {\n return nullString;\n }\n if (value === false) {\n return falseString;\n }\n if (value === 0) {\n return zeroString;\n }\n return value;\n};\n\n/**\n * Converts field values to a format suitable for forms by:\n * - Wrapping arrays of primitives as objects using the flatArrayKey `__FLAT__`\n * to satisfy RHF's requirement that array fields contain objects\n * - Removing empty strings and null values from objects\n *\n * This conversion is required because React Hook Form does not support arrays with\n * flat values (string, number, boolean, null). Array fields must contain objects.\n * We work around this by wrapping primitive entries: `{ __FLAT__: <value> }`.\n *\n * @example\n * const fields = {\n * name: 'John',\n * scores: [0, null, 75, false],\n * scoresDetailed: [\n * { score: 1 },\n * { score: null },\n * { score: 0 },\n * { score: false },\n * { score: '' },\n * ],\n * contact: {\n * email: '',\n * phone: null,\n * address: '123 Main St'\n * }\n * };\n *\n * // Result:\n * {\n * name: 'John',\n * scores: [\n * { __FLAT__: 0 },\n * { __FLAT__: null },\n * { __FLAT__: 75 },\n * { __FLAT__: false }\n * ],\n * // Arrays of objects are left as objects; empty/null properties are removed\n * scoresDetailed: [\n * { score: 1 },\n * {}, // null score removed\n * { score: 0 },\n * { score: false },\n * {}, // empty string removed\n * ],\n * contact: {\n * address: '123 Main St'\n * }\n * }\n */\nexport const toFormFormat = (fields: Record<string, unknown>) => {\n const formFormatJson = JSON.stringify(fields, (_, value) => {\n if (Array.isArray(value)) {\n // Delegate to toNullishString to ensure consistent handling\n return toNullishString(value);\n }\n\n if (value && typeof value === 'object') {\n // Preserve flat-array wrappers as-is (do not filter their inner values here)\n const record = value as Record<string, unknown>;\n if (flatArrayKey in record) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return value;\n }\n return Object.fromEntries(\n Object.entries(value).filter(([_key, v]) => {\n return v !== '' && v !== null;\n }),\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return value;\n });\n\n return JSON.parse(formFormatJson) as Record<string, unknown>;\n};\n\n/**\n * Converts form state to a format suitable for validation by:\n * - Unwrapping flat array wrappers `{ __FLAT__: <value> }` back to primitives\n * - Converting legacy string markers (__NULL__, __FALSE__, __ZERO__) back to their original values\n * - Removing fields whose converted value is empty string or null\n * - Removing empty arrays\n *\n * @example\n * const formState = {\n * name: 'John',\n * scores: [\n * { __FLAT__: 75 },\n * { __FLAT__: 0 },\n * { __FLAT__: null },\n * { __FLAT__: false }\n * ],\n * emptyArray: [],\n * scoresDetailed: [\n * { score: 1 },\n * {},\n * { score: 0 },\n * { score: false },\n * {},\n * ],\n * contact: {\n * address: '123 Main St',\n * fax: null\n * }\n * };\n *\n * // Result:\n * {\n * name: 'John',\n * scores: [75, 0, null, false],\n * // emptyArray is removed\n * // Objects inside arrays remain objects; empty entries remain empty objects\n * scoresDetailed: [\n * { score: 1 },\n * {},\n * { score: 0 },\n * { score: false },\n * {},\n * ],\n * contact: {\n * address: '123 Main St'\n * }\n * }\n */\nexport const toValidationFormat = (\n formState: Record<string, unknown> | null | undefined,\n): Record<string, unknown> | null | undefined => {\n // Handle null or undefined input\n if (formState === undefined || formState === null) {\n return formState;\n }\n\n const validationFormatJson = JSON.stringify(formState, (_, value) => {\n if (Array.isArray(value)) {\n return value.map((v) => {\n // Unwrap new wrapper format { __FLAT__: <value> }\n if (v && typeof v === 'object') {\n const record = v as Record<string, unknown>;\n if (flatArrayKey in record) {\n const inner = record[flatArrayKey];\n // Treat empty string from forms as null in validation format\n if (inner === '') {\n return null;\n }\n return fromNullishString(inner);\n }\n }\n // Backward compatibility for string markers\n return fromNullishString(v);\n });\n }\n\n if (value && typeof value === 'object') {\n // Object branch: remove keys that resolve to empty/null after marker conversion\n // and unwrap flat-array wrappers if present.\n //\n // Why this shape?\n // - Forms may contain objects with placeholder/empty values that should not\n // be part of the validation payload (e.g. \"\" or __NULL__ markers).\n // - Arrays of primitives are stored as wrapper objects { __FLAT__: <value> }\n // to satisfy RHF structure constraints. When converting back for\n // validation, we need to treat wrappers whose inner value resolves to\n // empty/null as removable, and unwrap non-empty wrappers to the primitive.\n return Object.fromEntries(\n Object.entries(value)\n .filter(([_key, v]) => {\n // If this is a flat-array wrapper, convert the inner value first and\n // drop the key when the inner resolves to empty string or null.\n if (v && typeof v === 'object') {\n const record = v as Record<string, unknown>;\n if (flatArrayKey in record) {\n const convertedInner = fromNullishString(record[flatArrayKey]);\n return convertedInner !== '' && convertedInner !== null;\n }\n }\n // Drop empty arrays\n if (Array.isArray(v) && v.length === 0) {\n return false;\n }\n // For regular values, convert markers and drop when empty/null.\n const converted = fromNullishString(v);\n return converted !== '' && converted !== null;\n })\n .map(([k, v]) => {\n // Unwrap flat-array wrappers to raw primitives after conversion.\n if (v && typeof v === 'object') {\n const record = v as Record<string, unknown>;\n if (flatArrayKey in record) {\n return [k, fromNullishString(record[flatArrayKey])];\n }\n }\n // For other values, just convert markers.\n return [k, fromNullishString(v)];\n }),\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return value;\n });\n\n return JSON.parse(validationFormatJson) as Record<string, unknown>;\n};\n\n/**\n * Helper function to check if a value is an empty object (not an array).\n */\nconst isEmptyObject = (value: unknown): boolean => {\n return (\n value !== null &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n Object.keys(value).length === 0\n );\n};\n\n/**\n * Recursively removes empty objects from a data structure.\n * - Filters empty objects from arrays\n * - Removes properties with empty object values\n * - Removes arrays that become empty after filtering\n */\nconst removeEmptyObjects = (obj: unknown): unknown => {\n if (Array.isArray(obj)) {\n // Filter out empty objects from arrays, then recursively process remaining items\n return obj\n .filter((item) => {\n return !isEmptyObject(item);\n })\n .map((item) => {\n return removeEmptyObjects(item);\n });\n }\n\n if (obj !== null && typeof obj === 'object') {\n return Object.fromEntries(\n Object.entries(obj)\n .map(([key, value]) => {\n return [key, removeEmptyObjects(value)] as [string, unknown];\n })\n .filter(([_, processed]) => {\n // Skip empty objects\n if (isEmptyObject(processed)) {\n return false;\n }\n // Skip arrays that are now empty after filtering\n if (Array.isArray(processed) && processed.length === 0) {\n return false;\n }\n return true;\n }),\n );\n }\n\n return obj;\n};\n\n/**\n * Converts form state to a format suitable for submission by:\n * - Applying all transformations from toValidationFormat\n * - Additionally removing empty objects from the result\n * - Filtering empty objects from arrays\n * - Recursively cleaning nested structures\n *\n * **Why separate from toValidationFormat?**\n *\n * Empty objects must be preserved during validation so that custom refinements\n * can run. For example, a FieldCard with \"at least email or phone required\"\n * validation needs the object to exist (even if empty) for the refine to execute.\n *\n * However, for submission, empty objects are meaningless and should be removed\n * to produce clean data for APIs.\n *\n * @example\n * const formState = {\n * name: 'John',\n * contact: {}, // Empty FieldCard - will be removed\n * tags: [{}, {}, {}], // All empty - array will be removed\n * items: [\n * { value: 'a' },\n * {}, // Empty entry - will be filtered out\n * { value: 'b' }\n * ],\n * nested: {\n * deep: {} // Nested empty - will be removed recursively\n * }\n * };\n *\n * // Result:\n * {\n * name: 'John',\n * items: [{ value: 'a' }, { value: 'b' }]\n * }\n */\nexport const toSubmitFormat = (\n formState: Record<string, unknown> | null | undefined,\n): Record<string, unknown> | null | undefined => {\n const validated = toValidationFormat(formState);\n if (!validated) {\n return validated;\n }\n return removeEmptyObjects(validated) as Record<string, unknown>;\n};\n\n/**\n * Converts a field name to a testId by removing flat array key segments and slugifying.\n * Removes all occurrences of `flatArrayKey` from the field name and applies slugify transformation.\n *\n * This is used to generate stable testIds for form fields that don't include\n * the internal `__FLAT__` marker used for flat arrays.\n *\n * @param name - The field name as a string (e.g., 'tags.0.__FLAT__') or array path (e.g., ['tags', '0', '__FLAT__'])\n * @returns The slugified field name with all flat array key segments removed (e.g., 'tags_0')\n *\n * @example\n * ```ts\n * nameToTestId('tags.0.__FLAT__') // => 'tags_0'\n * nameToTestId('array.0.__FLAT__') // => 'array_0'\n * nameToTestId('nested.array.0.__FLAT__.field') // => 'nested_array_0_field'\n * nameToTestId('simple.field') // => 'simple_field'\n * nameToTestId(['tags', '0', '__FLAT__']) // => 'tags_0'\n * ```\n */\nexport const nameToTestId = (name: string | readonly string[]): string => {\n let cleanName: string;\n\n // Handle array paths - filter out flatArrayKey and join with dots\n if (Array.isArray(name)) {\n cleanName = name\n .filter((segment: string) => {\n return segment !== flatArrayKey;\n })\n .join('.');\n } else {\n // Handle string paths - split by dots and filter out flatArrayKey segments\n const segments = (name as string).split('.');\n cleanName = segments\n .filter((segment: string) => {\n return segment !== flatArrayKey;\n })\n .join('.');\n }\n\n // Apply slugify transformation\n return slugify(cleanName, { replaceDots: true });\n};\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,8BAGX,YACG;CAEH,MAAM,kBAAkB,IAAI,IAC1B,QACG,QAAQ,WAAW;EAClB,OAAO,OAAO,OAAO,UAAU;CACjC,CAAC,CAAC,CACD,KAAK,WAAW;EACf,OAAO,OAAO,OAAO,KAAK;CAC5B,CAAC,CACL;CAGA,MAAM,mBAAmB,IAAI,IAC3B,QACG,QAAQ,WAAW;EAClB,OAAO,OAAO,OAAO,UAAU;CACjC,CAAC,CAAC,CACD,KAAK,WAAW;EACf,OAAO,CAAC,OAAO,OAAO,KAAK,GAAG,OAAO,KAAgB;CACvD,CAAC,CACL;;;;;CAMA,MAAM,yBACJ,QAC8B;EAC9B,MAAM,SAAS,OAAO,GAAG;EACzB,MAAM,eAAe,iBAAiB,IAAI,MAAM;EAChD,IAAI,iBAAiB,KAAA,GACnB,OAAO;EAET,IAAI,gBAAgB,IAAI,MAAM,GAC5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