@fuf-stack/uniform 1.22.4 → 1.22.5

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 (241) hide show
  1. package/dist/Checkboxes/index.cjs +2 -1
  2. package/dist/Checkboxes/index.d.cts +2 -2
  3. package/dist/Checkboxes/index.d.ts +2 -2
  4. package/dist/Checkboxes/index.js +2 -2
  5. package/dist/{Checkboxes-DHk09GmH.cjs → Checkboxes-DrJqx6O2.cjs} +7 -1
  6. package/dist/{Checkboxes-DHk09GmH.cjs.map → Checkboxes-DrJqx6O2.cjs.map} +1 -1
  7. package/dist/{Checkboxes-D1hppxDE.js → Checkboxes-X6FRwI50.js} +2 -2
  8. package/dist/{Checkboxes-D1hppxDE.js.map → Checkboxes-X6FRwI50.js.map} +1 -1
  9. package/dist/DatePicker/index.cjs +2 -1
  10. package/dist/DatePicker/index.d.cts +2 -2
  11. package/dist/DatePicker/index.d.ts +2 -2
  12. package/dist/DatePicker/index.js +2 -2
  13. package/dist/{DatePicker-BUSi8SWQ.js → DatePicker-CGIWizz9.js} +2 -2
  14. package/dist/{DatePicker-BUSi8SWQ.js.map → DatePicker-CGIWizz9.js.map} +1 -1
  15. package/dist/{DatePicker-DuBjvS5g.cjs → DatePicker-CYUuwwsm.cjs} +7 -1
  16. package/dist/{DatePicker-DuBjvS5g.cjs.map → DatePicker-CYUuwwsm.cjs.map} +1 -1
  17. package/dist/FieldArray/index.cjs +2 -1
  18. package/dist/FieldArray/index.d.cts +2 -2
  19. package/dist/FieldArray/index.d.ts +2 -2
  20. package/dist/FieldArray/index.js +2 -2
  21. package/dist/{FieldArray-BxmK1NRd.js → FieldArray-Dkw6JBnT.js} +2 -2
  22. package/dist/{FieldArray-BxmK1NRd.js.map → FieldArray-Dkw6JBnT.js.map} +1 -1
  23. package/dist/{FieldArray-DgiQpIdr.cjs → FieldArray-V66fsvtd.cjs} +7 -1
  24. package/dist/{FieldArray-DgiQpIdr.cjs.map → FieldArray-V66fsvtd.cjs.map} +1 -1
  25. package/dist/FieldCard/index.cjs +6 -2
  26. package/dist/FieldCard/index.d.cts +2 -2
  27. package/dist/FieldCard/index.d.ts +2 -2
  28. package/dist/FieldCard/index.js +2 -2
  29. package/dist/{FieldCard-C-DZ5ARr.cjs → FieldCard-CAHnM8C0.cjs} +10 -1
  30. package/dist/FieldCard-CAHnM8C0.cjs.map +1 -0
  31. package/dist/{FieldCard-BK6SNqFY.js → FieldCard-Cg31ce9J.js} +5 -2
  32. package/dist/FieldCard-Cg31ce9J.js.map +1 -0
  33. package/dist/Input/index.d.cts +1 -1
  34. package/dist/Input/index.d.ts +1 -1
  35. package/dist/RadioBoxes/index.cjs +1 -1
  36. package/dist/RadioBoxes/index.d.cts +2 -2
  37. package/dist/RadioBoxes/index.d.ts +2 -2
  38. package/dist/RadioBoxes/index.js +1 -1
  39. package/dist/{RadioBoxes-CR--FBhQ.cjs → RadioBoxes-BmLrbYXt.cjs} +3 -3
  40. package/dist/RadioBoxes-BmLrbYXt.cjs.map +1 -0
  41. package/dist/{RadioBoxes-BJz-aJp3.js → RadioBoxes-DWxJBTKR.js} +3 -3
  42. package/dist/RadioBoxes-DWxJBTKR.js.map +1 -0
  43. package/dist/RadioTabs/index.cjs +2 -1
  44. package/dist/RadioTabs/index.d.cts +2 -2
  45. package/dist/RadioTabs/index.d.ts +2 -2
  46. package/dist/RadioTabs/index.js +2 -2
  47. package/dist/{RadioTabs-Btt582Nl.cjs → RadioTabs-14XTbTJU.cjs} +20 -14
  48. package/dist/RadioTabs-14XTbTJU.cjs.map +1 -0
  49. package/dist/{RadioTabs-CYmzrPBG.js → RadioTabs-DAY6MYJI.js} +15 -15
  50. package/dist/RadioTabs-DAY6MYJI.js.map +1 -0
  51. package/dist/Radios/index.cjs +2 -1
  52. package/dist/Radios/index.d.cts +2 -2
  53. package/dist/Radios/index.d.ts +2 -2
  54. package/dist/Radios/index.js +2 -2
  55. package/dist/{Radios-DZxhrX96.js → Radios-C938-msm.js} +2 -2
  56. package/dist/{Radios-DZxhrX96.js.map → Radios-C938-msm.js.map} +1 -1
  57. package/dist/{Radios-Jg9mwE0B.cjs → Radios-D_B9Y8s2.cjs} +7 -1
  58. package/dist/{Radios-Jg9mwE0B.cjs.map → Radios-D_B9Y8s2.cjs.map} +1 -1
  59. package/dist/Select/index.cjs +2 -1
  60. package/dist/Select/index.d.cts +2 -2
  61. package/dist/Select/index.d.ts +2 -2
  62. package/dist/Select/index.js +2 -2
  63. package/dist/{Select-CgeqhZIC.js → Select-BL6k_e-D.js} +2 -2
  64. package/dist/Select-BL6k_e-D.js.map +1 -0
  65. package/dist/{Select-CZwuEAB5.cjs → Select-D66A-hYm.cjs} +7 -1
  66. package/dist/Select-D66A-hYm.cjs.map +1 -0
  67. package/dist/Slider/index.cjs +2 -1
  68. package/dist/Slider/index.d.cts +2 -2
  69. package/dist/Slider/index.d.ts +2 -2
  70. package/dist/Slider/index.js +2 -2
  71. package/dist/{Slider-Bpxt-Qgj.cjs → Slider-ChC2PZNb.cjs} +7 -1
  72. package/dist/{Slider-Bpxt-Qgj.cjs.map → Slider-ChC2PZNb.cjs.map} +1 -1
  73. package/dist/{Slider-DRfSw0uE.js → Slider-DmEwhC1T.js} +2 -2
  74. package/dist/{Slider-DRfSw0uE.js.map → Slider-DmEwhC1T.js.map} +1 -1
  75. package/dist/Switch/index.cjs +2 -1
  76. package/dist/Switch/index.d.cts +2 -2
  77. package/dist/Switch/index.d.ts +2 -2
  78. package/dist/Switch/index.js +2 -2
  79. package/dist/{Switch-hjjy34QB.cjs → Switch-Ch6_VInV.cjs} +7 -1
  80. package/dist/{Switch-hjjy34QB.cjs.map → Switch-Ch6_VInV.cjs.map} +1 -1
  81. package/dist/{Switch-D9DNrqmj.js → Switch-DvKRPFcC.js} +2 -2
  82. package/dist/{Switch-D9DNrqmj.js.map → Switch-DvKRPFcC.js.map} +1 -1
  83. package/dist/SwitchBox/index.d.cts +1 -1
  84. package/dist/SwitchBox/index.d.ts +1 -1
  85. package/dist/SwitchBox-BU1XieaZ.js.map +1 -1
  86. package/dist/SwitchBox-Dl-F5y2m.cjs.map +1 -1
  87. package/dist/TextArea/index.d.cts +1 -1
  88. package/dist/TextArea/index.d.ts +1 -1
  89. package/dist/Time/index.cjs +7 -2
  90. package/dist/Time/index.d.cts +2 -2
  91. package/dist/Time/index.d.ts +2 -2
  92. package/dist/Time/index.js +2 -2
  93. package/dist/{Time-CDptQ3CK.js → Time-B_SXrKWK.js} +5 -2
  94. package/dist/Time-B_SXrKWK.js.map +1 -0
  95. package/dist/{Time-WKgbji5k.cjs → Time-CYoWaQsz.cjs} +16 -1
  96. package/dist/Time-CYoWaQsz.cjs.map +1 -0
  97. package/dist/hooks/useFormContext/index.d.cts +1 -1
  98. package/dist/hooks/useFormContext/index.d.ts +1 -1
  99. package/dist/hooks/useUniformField/index.d.cts +1 -1
  100. package/dist/hooks/useUniformField/index.d.ts +1 -1
  101. package/dist/hooks/useUniformFieldArray/index.d.cts +1 -1
  102. package/dist/hooks/useUniformFieldArray/index.d.ts +1 -1
  103. package/dist/index-19JGtN7H.d.cts +1257 -0
  104. package/dist/index-19JGtN7H.d.cts.map +1 -0
  105. package/dist/index-B4XExHDi.d.cts +539 -0
  106. package/dist/index-B4XExHDi.d.cts.map +1 -0
  107. package/dist/index-BUZEnZDm.d.ts +1760 -0
  108. package/dist/index-BUZEnZDm.d.ts.map +1 -0
  109. package/dist/index-Bbaubtxp.d.cts +677 -0
  110. package/dist/index-Bbaubtxp.d.cts.map +1 -0
  111. package/dist/index-BdgFJ-dj.d.ts +1028 -0
  112. package/dist/index-BdgFJ-dj.d.ts.map +1 -0
  113. package/dist/index-BiZNkLK3.d.cts +1477 -0
  114. package/dist/index-BiZNkLK3.d.cts.map +1 -0
  115. package/dist/index-Bie3CWyW.d.cts +1760 -0
  116. package/dist/index-Bie3CWyW.d.cts.map +1 -0
  117. package/dist/index-BsTqcI1C.d.cts +659 -0
  118. package/dist/index-BsTqcI1C.d.cts.map +1 -0
  119. package/dist/index-C6Y8KybK.d.ts +677 -0
  120. package/dist/index-C6Y8KybK.d.ts.map +1 -0
  121. package/dist/index-CD0Wpla3.d.cts +1413 -0
  122. package/dist/index-CD0Wpla3.d.cts.map +1 -0
  123. package/dist/index-CUByIf_d.d.ts +314 -0
  124. package/dist/index-CUByIf_d.d.ts.map +1 -0
  125. package/dist/index-Cf2B9woY.d.cts +473 -0
  126. package/dist/index-Cf2B9woY.d.cts.map +1 -0
  127. package/dist/index-CqXEYILn.d.cts +1263 -0
  128. package/dist/index-CqXEYILn.d.cts.map +1 -0
  129. package/dist/index-D1cB3mbB.d.ts +3917 -0
  130. package/dist/index-D1cB3mbB.d.ts.map +1 -0
  131. package/dist/index-D7AUghFx.d.ts +1413 -0
  132. package/dist/index-D7AUghFx.d.ts.map +1 -0
  133. package/dist/index-DCwffq1f.d.ts +1263 -0
  134. package/dist/index-DCwffq1f.d.ts.map +1 -0
  135. package/dist/index-DFbuWomg.d.ts +534 -0
  136. package/dist/index-DFbuWomg.d.ts.map +1 -0
  137. package/dist/index-DXOBPBft.d.ts +659 -0
  138. package/dist/index-DXOBPBft.d.ts.map +1 -0
  139. package/dist/index-DY-d4cFe.d.cts +1028 -0
  140. package/dist/index-DY-d4cFe.d.cts.map +1 -0
  141. package/dist/index-DqMpHpu7.d.ts +1257 -0
  142. package/dist/index-DqMpHpu7.d.ts.map +1 -0
  143. package/dist/index-DwnqyNnX.d.cts +534 -0
  144. package/dist/index-DwnqyNnX.d.cts.map +1 -0
  145. package/dist/index-OdNTqjhQ.d.ts +585 -0
  146. package/dist/index-OdNTqjhQ.d.ts.map +1 -0
  147. package/dist/index-QPDvw5Z5.d.cts +585 -0
  148. package/dist/index-QPDvw5Z5.d.cts.map +1 -0
  149. package/dist/index-amMd-sQN.d.ts +473 -0
  150. package/dist/index-amMd-sQN.d.ts.map +1 -0
  151. package/dist/index-clztdahp.d.ts +1477 -0
  152. package/dist/index-clztdahp.d.ts.map +1 -0
  153. package/dist/index-jK092-MJ.d.cts +314 -0
  154. package/dist/index-jK092-MJ.d.cts.map +1 -0
  155. package/dist/index-veBM95Gw.d.cts +3917 -0
  156. package/dist/index-veBM95Gw.d.cts.map +1 -0
  157. package/dist/index-yYjVSHlN.d.ts +539 -0
  158. package/dist/index-yYjVSHlN.d.ts.map +1 -0
  159. package/dist/index.cjs +20 -11
  160. package/dist/index.d.cts +18 -18
  161. package/dist/index.d.ts +18 -18
  162. package/dist/index.js +12 -12
  163. package/dist/{useFormContext-CpLVpNAf.d.ts → useFormContext-Bj1gXLt_.d.ts} +3 -3
  164. package/dist/{useFormContext-CpLVpNAf.d.ts.map → useFormContext-Bj1gXLt_.d.ts.map} +1 -1
  165. package/dist/{useFormContext-Ddc1HWKv.d.cts → useFormContext-M94eQfHm.d.cts} +3 -3
  166. package/dist/{useFormContext-Ddc1HWKv.d.cts.map → useFormContext-M94eQfHm.d.cts.map} +1 -1
  167. package/dist/{useUniformField-CmAYcGER.d.cts → useUniformField-BE-e3C4Y.d.cts} +2 -2
  168. package/dist/{useUniformField-CmAYcGER.d.cts.map → useUniformField-BE-e3C4Y.d.cts.map} +1 -1
  169. package/dist/{useUniformField-DJDpQzRo.d.ts → useUniformField-DUW-svZD.d.ts} +2 -2
  170. package/dist/{useUniformField-DJDpQzRo.d.ts.map → useUniformField-DUW-svZD.d.ts.map} +1 -1
  171. package/dist/{useUniformFieldArray-zGcIhwhF.d.ts → useUniformFieldArray-CdWv1SEk.d.ts} +2 -2
  172. package/dist/{useUniformFieldArray-zGcIhwhF.d.ts.map → useUniformFieldArray-CdWv1SEk.d.ts.map} +1 -1
  173. package/dist/{useUniformFieldArray-D3fdzwzD.d.cts → useUniformFieldArray-kkOHxNFF.d.cts} +2 -2
  174. package/dist/{useUniformFieldArray-D3fdzwzD.d.cts.map → useUniformFieldArray-kkOHxNFF.d.cts.map} +1 -1
  175. package/package.json +6 -6
  176. package/dist/FieldCard-BK6SNqFY.js.map +0 -1
  177. package/dist/FieldCard-C-DZ5ARr.cjs.map +0 -1
  178. package/dist/RadioBoxes-BJz-aJp3.js.map +0 -1
  179. package/dist/RadioBoxes-CR--FBhQ.cjs.map +0 -1
  180. package/dist/RadioTabs-Btt582Nl.cjs.map +0 -1
  181. package/dist/RadioTabs-CYmzrPBG.js.map +0 -1
  182. package/dist/Select-CZwuEAB5.cjs.map +0 -1
  183. package/dist/Select-CgeqhZIC.js.map +0 -1
  184. package/dist/Time-CDptQ3CK.js.map +0 -1
  185. package/dist/Time-WKgbji5k.cjs.map +0 -1
  186. package/dist/index-7UT2Ki5e.d.cts +0 -113
  187. package/dist/index-7UT2Ki5e.d.cts.map +0 -1
  188. package/dist/index-9_3XTDJC.d.cts +0 -174
  189. package/dist/index-9_3XTDJC.d.cts.map +0 -1
  190. package/dist/index-B5SfdA5O.d.cts +0 -99
  191. package/dist/index-B5SfdA5O.d.cts.map +0 -1
  192. package/dist/index-B61zRzeS.d.cts +0 -101
  193. package/dist/index-B61zRzeS.d.cts.map +0 -1
  194. package/dist/index-B7gQppgQ.d.ts +0 -116
  195. package/dist/index-B7gQppgQ.d.ts.map +0 -1
  196. package/dist/index-BDFJDKmz.d.ts +0 -166
  197. package/dist/index-BDFJDKmz.d.ts.map +0 -1
  198. package/dist/index-BPaSE_7b.d.ts +0 -179
  199. package/dist/index-BPaSE_7b.d.ts.map +0 -1
  200. package/dist/index-BSjcTo7A.d.ts +0 -147
  201. package/dist/index-BSjcTo7A.d.ts.map +0 -1
  202. package/dist/index-BmMspnsJ.d.cts +0 -137
  203. package/dist/index-BmMspnsJ.d.cts.map +0 -1
  204. package/dist/index-Bzs7_gnk.d.cts +0 -116
  205. package/dist/index-Bzs7_gnk.d.cts.map +0 -1
  206. package/dist/index-C4GJH8Xv.d.ts +0 -290
  207. package/dist/index-C4GJH8Xv.d.ts.map +0 -1
  208. package/dist/index-CE8fnXuQ.d.ts +0 -167
  209. package/dist/index-CE8fnXuQ.d.ts.map +0 -1
  210. package/dist/index-CIiOXrrY.d.ts +0 -99
  211. package/dist/index-CIiOXrrY.d.ts.map +0 -1
  212. package/dist/index-C_zjtsGM.d.ts +0 -113
  213. package/dist/index-C_zjtsGM.d.ts.map +0 -1
  214. package/dist/index-CbPJiRK2.d.ts +0 -83
  215. package/dist/index-CbPJiRK2.d.ts.map +0 -1
  216. package/dist/index-CvP3tbVV.d.ts +0 -137
  217. package/dist/index-CvP3tbVV.d.ts.map +0 -1
  218. package/dist/index-Cwb7sTO0.d.ts +0 -154
  219. package/dist/index-Cwb7sTO0.d.ts.map +0 -1
  220. package/dist/index-CxY9VWv5.d.cts +0 -154
  221. package/dist/index-CxY9VWv5.d.cts.map +0 -1
  222. package/dist/index-D8udSkgA.d.cts +0 -167
  223. package/dist/index-D8udSkgA.d.cts.map +0 -1
  224. package/dist/index-DBsF7xsq.d.cts +0 -147
  225. package/dist/index-DBsF7xsq.d.cts.map +0 -1
  226. package/dist/index-DNADTCoc.d.cts +0 -290
  227. package/dist/index-DNADTCoc.d.cts.map +0 -1
  228. package/dist/index-DRg0anjB.d.cts +0 -179
  229. package/dist/index-DRg0anjB.d.cts.map +0 -1
  230. package/dist/index-DUmNI6cE.d.cts +0 -83
  231. package/dist/index-DUmNI6cE.d.cts.map +0 -1
  232. package/dist/index-Db0WD4d1.d.cts +0 -166
  233. package/dist/index-Db0WD4d1.d.cts.map +0 -1
  234. package/dist/index-GxTY7aAc.d.ts +0 -174
  235. package/dist/index-GxTY7aAc.d.ts.map +0 -1
  236. package/dist/index-PMCqBX0t.d.ts +0 -101
  237. package/dist/index-PMCqBX0t.d.ts.map +0 -1
  238. package/dist/index-QgVr4iWX.d.cts +0 -122
  239. package/dist/index-QgVr4iWX.d.cts.map +0 -1
  240. package/dist/index-dgho7gpc.d.ts +0 -122
  241. package/dist/index-dgho7gpc.d.ts.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"RadioTabs-Btt582Nl.cjs","names":["useUniformField","createOptionValueConverter","VisuallyHidden","HeroRadioGroup","Tabs"],"sources":["../src/RadioTabs/RadioTabs.tsx","../src/RadioTabs/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { TabsProps } from '@fuf-stack/pixels';\nimport type { TabProps } from '@fuf-stack/pixels/Tabs';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport { useRef } from 'react';\n\nimport { RadioGroup as HeroRadioGroup } from '@heroui/radio';\nimport { VisuallyHidden } from '@react-aria/visually-hidden';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\nimport Tabs from '@fuf-stack/pixels/Tabs';\n\nimport { createOptionValueConverter } from '../helpers';\nimport { useUniformField } from '../hooks/useUniformField';\n\nexport const radioTabsVariants = tv({\n slots: {\n base: 'group gap-0', // Needs group for group-data condition\n cursor: '',\n label:\n 'mb-2 inline-flex text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger',\n tab: '',\n tabBase: '',\n tabContent: '',\n tabList: '',\n tabPanel: 'p-3',\n tabWrapper: '',\n wrapper: '',\n },\n variants: {\n hasContent: {\n true: {\n base: '',\n tabBase: 'p-1',\n tabWrapper: [\n // border style\n 'rounded-medium border border-divider',\n // full width\n 'w-full',\n ],\n },\n },\n fullWidth: {\n true: {\n tabWrapper: 'w-full',\n },\n },\n isInvalid: {\n true: {\n tabWrapper: 'rounded-medium border-2 !border-danger',\n },\n },\n },\n});\n\ntype VariantProps = TVProps<typeof radioTabsVariants>;\ntype ClassName = TVClassName<typeof radioTabsVariants>;\n\nexport interface RadioTabsOption {\n /** Optional content inside of the tab */\n content?: ReactNode;\n /** disables the option */\n disabled?: boolean;\n /** option label */\n label?: ReactNode;\n /** option icon */\n icon?: ReactNode;\n /** HTML data-testid attribute of the option */\n testId?: string;\n /** option value */\n value: string | number | boolean;\n}\n\nexport interface RadioTabsProps extends Omit<VariantProps, 'hasContent'> {\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 /** Determines if the Buttons are disabled or not. */\n disabled?: boolean;\n /** Whether tabs should take up full container width */\n fullWidth?: boolean;\n /** determines orientation of the Buttons. */\n inline?: boolean;\n /** Label displayed next to the RadioButton. */\n label?: ReactNode;\n /** Name the RadioButtons are registered at in HTML forms (react-hook-form). */\n name: string;\n /** Radio button configuration. */\n options: RadioTabsOption[];\n /** Id to grab element in internal tests. */\n testId?: string;\n /** How the RadioTabs should look like. */\n variant?: TabsProps['variant'];\n}\n\n/**\n * RadioTabs component based on [HeroUI RadioGroup](https://www.heroui.com//docs/components/radio-group)\n * and [HeroUI Tabs](https://www.heroui.com//docs/components/tabs)\n */\nconst RadioTabs = ({\n className = undefined,\n fullWidth = false,\n inline = false,\n name,\n options,\n variant = undefined,\n ...uniformFieldProps\n}: RadioTabsProps): ReactElement => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, ref, value },\n invalid,\n label,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Create a ref for the visual radio group to forward focus\n const visualRadioGroupRef = useRef<HTMLDivElement>(null);\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n const tabOptions = options.map<TabProps>((option) => {\n return {\n content: option?.content,\n disabled: option?.disabled,\n // Tabs component uses string keys internally\n key: String(option.value),\n label: option?.label ?? option?.value,\n testId: slugify(`option_${option?.testId ?? option?.value}`, {\n replaceDots: true,\n }),\n };\n });\n\n const disabledAllKeys: string[] | undefined = tabOptions?.map((option) => {\n return option.key as string;\n });\n\n // check if any option has content\n // eslint-disable-next-line @typescript-eslint/no-misused-promises, @typescript-eslint/promise-function-async\n const hasContent = options.some((option) => {\n return option.content;\n });\n\n // classNames from slots\n const variants = radioTabsVariants({\n fullWidth,\n hasContent,\n isInvalid: invalid,\n });\n const classNames = variantsToClassNames(variants, className, 'base');\n\n return (\n <>\n {/* Visually hidden input for React Hook Form focus management */}\n <VisuallyHidden>\n <input\n ref={ref}\n aria-label={ariaLabel}\n name={name}\n onBlur={onBlur}\n value={value ?? ''}\n onChange={(e) => {\n onChange(convertToOriginalType(e.target.value));\n }}\n onFocus={() => {\n // Forward focus to the first tab when RHF focuses this input\n const firstTab = visualRadioGroupRef.current?.querySelector(\n '[role=\"tab\"]',\n ) as HTMLElement;\n firstTab?.focus();\n }}\n />\n </VisuallyHidden>\n\n <HeroRadioGroup\n ref={visualRadioGroupRef}\n aria-label={ariaLabel}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n errorMessage={errorMessage}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label ? <legend>{label}</legend> : null}\n name={`${name}_radiotabs`}\n orientation={inline ? 'horizontal' : 'vertical'}\n classNames={{\n base: classNames.base,\n label: classNames.label,\n wrapper: classNames.wrapper,\n }}\n >\n <Tabs\n disabledKeys={disabled ? disabledAllKeys : undefined}\n // make sure component is controlled (convert to string for Tabs)\n selectedKey={value != null ? String(value) : ''}\n tabs={tabOptions}\n testId={testId}\n variant={variant}\n className={{\n base: classNames.tabBase,\n cursor: classNames.cursor,\n panel: classNames.tabPanel,\n tab: classNames.tab,\n tabContent: classNames.tabContent,\n tabList: classNames.tabList,\n tabWrapper: classNames.tabWrapper,\n }}\n onSelectionChange={(key) => {\n if (key != null) {\n onChange(convertToOriginalType(key));\n }\n }}\n />\n </HeroRadioGroup>\n </>\n );\n};\n\nexport default RadioTabs;\n","import RadioTabs from './RadioTabs';\n\nexport type { RadioTabsProps } from './RadioTabs';\n\nexport { RadioTabs };\n\nexport default RadioTabs;\n"],"mappings":";;;;;;;;;;;AAgBA,MAAa,qBAAA,GAAA,uBAAA,IAAuB;CAClC,OAAO;EACL,MAAM;EACN,QAAQ;EACR,OACE;EACF,KAAK;EACL,SAAS;EACT,YAAY;EACZ,SAAS;EACT,UAAU;EACV,YAAY;EACZ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,WAAW,MAAM;GACf,SAAS,sBAAsB,EAAE,OAAO,KAAK,CAAC;EAChD;EACA,eAAe;GAKb,CAHiB,oBAAoB,SAAS,cAC5C,gBACF,IACU,MAAM;EAClB;CACD,CAAA,EACa,CAAA,GAEhB,iBAAA,GAAA,kBAAA,KAACC,cAAAA,YAAD;EACE,KAAK;EACL,cAAY;EAGZ,gBAAc;EACd,iBAAe;EACf,eAAa;EACC;EACd,YAAY;EACZ,WAAW;EACX,YAAY;EACZ,OAAO,QAAQ,iBAAA,GAAA,kBAAA,KAAC,UAAD,EAAA,UAAS,MAAc,CAAA,IAAI;EAC1C,MAAM,GAAG,KAAK;EACd,aAAa,SAAS,eAAe;EACrC,YAAY;GACV,MAAM,WAAW;GACjB,OAAO,WAAW;GAClB,SAAS,WAAW;EACtB;YAEA,iBAAA,GAAA,kBAAA,KAACC,uBAAAA,SAAD;GACE,cAAc,WAAW,kBAAkB,KAAA;GAE3C,aAAa,SAAS,OAAO,OAAO,KAAK,IAAI;GAC7C,MAAM;GACE;GACC;GACT,WAAW;IACT,MAAM,WAAW;IACjB,QAAQ,WAAW;IACnB,OAAO,WAAW;IAClB,KAAK,WAAW;IAChB,YAAY,WAAW;IACvB,SAAS,WAAW;IACpB,YAAY,WAAW;GACzB;GACA,oBAAoB,QAAQ;IAC1B,IAAI,OAAO,MACT,SAAS,sBAAsB,GAAG,CAAC;GAEvC;EACD,CAAA;CACa,CAAA,CAChB,EAAA,CAAA;AAEN;;;AChOA,IAAA,oBAAe"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"RadioTabs-CYmzrPBG.js","names":["HeroRadioGroup"],"sources":["../src/RadioTabs/RadioTabs.tsx","../src/RadioTabs/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { TabsProps } from '@fuf-stack/pixels';\nimport type { TabProps } from '@fuf-stack/pixels/Tabs';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport { useRef } from 'react';\n\nimport { RadioGroup as HeroRadioGroup } from '@heroui/radio';\nimport { VisuallyHidden } from '@react-aria/visually-hidden';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\nimport Tabs from '@fuf-stack/pixels/Tabs';\n\nimport { createOptionValueConverter } from '../helpers';\nimport { useUniformField } from '../hooks/useUniformField';\n\nexport const radioTabsVariants = tv({\n slots: {\n base: 'group gap-0', // Needs group for group-data condition\n cursor: '',\n label:\n 'mb-2 inline-flex text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger',\n tab: '',\n tabBase: '',\n tabContent: '',\n tabList: '',\n tabPanel: 'p-3',\n tabWrapper: '',\n wrapper: '',\n },\n variants: {\n hasContent: {\n true: {\n base: '',\n tabBase: 'p-1',\n tabWrapper: [\n // border style\n 'rounded-medium border border-divider',\n // full width\n 'w-full',\n ],\n },\n },\n fullWidth: {\n true: {\n tabWrapper: 'w-full',\n },\n },\n isInvalid: {\n true: {\n tabWrapper: 'rounded-medium border-2 !border-danger',\n },\n },\n },\n});\n\ntype VariantProps = TVProps<typeof radioTabsVariants>;\ntype ClassName = TVClassName<typeof radioTabsVariants>;\n\nexport interface RadioTabsOption {\n /** Optional content inside of the tab */\n content?: ReactNode;\n /** disables the option */\n disabled?: boolean;\n /** option label */\n label?: ReactNode;\n /** option icon */\n icon?: ReactNode;\n /** HTML data-testid attribute of the option */\n testId?: string;\n /** option value */\n value: string | number | boolean;\n}\n\nexport interface RadioTabsProps extends Omit<VariantProps, 'hasContent'> {\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 /** Determines if the Buttons are disabled or not. */\n disabled?: boolean;\n /** Whether tabs should take up full container width */\n fullWidth?: boolean;\n /** determines orientation of the Buttons. */\n inline?: boolean;\n /** Label displayed next to the RadioButton. */\n label?: ReactNode;\n /** Name the RadioButtons are registered at in HTML forms (react-hook-form). */\n name: string;\n /** Radio button configuration. */\n options: RadioTabsOption[];\n /** Id to grab element in internal tests. */\n testId?: string;\n /** How the RadioTabs should look like. */\n variant?: TabsProps['variant'];\n}\n\n/**\n * RadioTabs component based on [HeroUI RadioGroup](https://www.heroui.com//docs/components/radio-group)\n * and [HeroUI Tabs](https://www.heroui.com//docs/components/tabs)\n */\nconst RadioTabs = ({\n className = undefined,\n fullWidth = false,\n inline = false,\n name,\n options,\n variant = undefined,\n ...uniformFieldProps\n}: RadioTabsProps): ReactElement => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, ref, value },\n invalid,\n label,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Create a ref for the visual radio group to forward focus\n const visualRadioGroupRef = useRef<HTMLDivElement>(null);\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n const tabOptions = options.map<TabProps>((option) => {\n return {\n content: option?.content,\n disabled: option?.disabled,\n // Tabs component uses string keys internally\n key: String(option.value),\n label: option?.label ?? option?.value,\n testId: slugify(`option_${option?.testId ?? option?.value}`, {\n replaceDots: true,\n }),\n };\n });\n\n const disabledAllKeys: string[] | undefined = tabOptions?.map((option) => {\n return option.key as string;\n });\n\n // check if any option has content\n // eslint-disable-next-line @typescript-eslint/no-misused-promises, @typescript-eslint/promise-function-async\n const hasContent = options.some((option) => {\n return option.content;\n });\n\n // classNames from slots\n const variants = radioTabsVariants({\n fullWidth,\n hasContent,\n isInvalid: invalid,\n });\n const classNames = variantsToClassNames(variants, className, 'base');\n\n return (\n <>\n {/* Visually hidden input for React Hook Form focus management */}\n <VisuallyHidden>\n <input\n ref={ref}\n aria-label={ariaLabel}\n name={name}\n onBlur={onBlur}\n value={value ?? ''}\n onChange={(e) => {\n onChange(convertToOriginalType(e.target.value));\n }}\n onFocus={() => {\n // Forward focus to the first tab when RHF focuses this input\n const firstTab = visualRadioGroupRef.current?.querySelector(\n '[role=\"tab\"]',\n ) as HTMLElement;\n firstTab?.focus();\n }}\n />\n </VisuallyHidden>\n\n <HeroRadioGroup\n ref={visualRadioGroupRef}\n aria-label={ariaLabel}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n errorMessage={errorMessage}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label ? <legend>{label}</legend> : null}\n name={`${name}_radiotabs`}\n orientation={inline ? 'horizontal' : 'vertical'}\n classNames={{\n base: classNames.base,\n label: classNames.label,\n wrapper: classNames.wrapper,\n }}\n >\n <Tabs\n disabledKeys={disabled ? disabledAllKeys : undefined}\n // make sure component is controlled (convert to string for Tabs)\n selectedKey={value != null ? String(value) : ''}\n tabs={tabOptions}\n testId={testId}\n variant={variant}\n className={{\n base: classNames.tabBase,\n cursor: classNames.cursor,\n panel: classNames.tabPanel,\n tab: classNames.tab,\n tabContent: classNames.tabContent,\n tabList: classNames.tabList,\n tabWrapper: classNames.tabWrapper,\n }}\n onSelectionChange={(key) => {\n if (key != null) {\n onChange(convertToOriginalType(key));\n }\n }}\n />\n </HeroRadioGroup>\n </>\n );\n};\n\nexport default RadioTabs;\n","import RadioTabs from './RadioTabs';\n\nexport type { RadioTabsProps } from './RadioTabs';\n\nexport { RadioTabs };\n\nexport default RadioTabs;\n"],"mappings":";;;;;;;;;AAgBA,MAAa,oBAAoB,GAAG;CAClC,OAAO;EACL,MAAM;EACN,QAAQ;EACR,OACE;EACF,KAAK;EACL,SAAS;EACT,YAAY;EACZ,SAAS;EACT,UAAU;EACV,YAAY;EACZ,SAAS;CACX;CACA,UAAU;EACR,YAAY,EACV,MAAM;GACJ,MAAM;GACN,SAAS;GACT,YAAY,CAEV,wCAEA,QACF;EACF,EACF;EACA,WAAW,EACT,MAAM,EACJ,YAAY,SACd,EACF;EACA,WAAW,EACT,MAAM,EACJ,YAAY,yCACd,EACF;CACF;AACF,CAAC;;;;;AA+CD,MAAM,aAAa,EACjB,YAAY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S,eAAe;EACrC,YAAY;GACV,MAAM,WAAW;GACjB,OAAO,WAAW;GAClB,SAAS,WAAW;EACtB;YAEA,oBAAC,MAAD;GACE,cAAc,WAAW,kBAAkB,KAAA;GAE3C,aAAa,SAAS,OAAO,OAAO,KAAK,IAAI;GAC7C,MAAM;GACE;GACC;GACT,WAAW;IACT,MAAM,WAAW;IACjB,QAAQ,WAAW;IACnB,OAAO,WAAW;IAClB,KAAK,WAAW;IAChB,YAAY,WAAW;IACvB,SAAS,WAAW;IACpB,YAAY,WAAW;GACzB;GACA,oBAAoB,QAAQ;IAC1B,IAAI,OAAO,MACT,SAAS,sBAAsB,GAAG,CAAC;GAEvC;EACD,CAAA;CACa,CAAA,CAChB,EAAA,CAAA;AAEN;;;AChOA,IAAA,oBAAe"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Select-CZwuEAB5.cjs","names":["components","useUniformField","useFormContext","createOptionValueConverter","isValueEmpty","ReactSelect"],"sources":["../src/Select/Select.tsx","../src/Select/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\nimport type { MultiValue, Props, SingleValue } from 'react-select';\n\nimport { useState } from 'react';\nimport ReactSelect, { components } from 'react-select';\n\nimport { useSelect } from '@heroui/select';\n\nimport { cn, slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { createOptionValueConverter, isValueEmpty } from '../helpers';\nimport { useFormContext } from '../hooks/useFormContext';\nimport { useUniformField } from '../hooks/useUniformField';\n\nexport const selectVariants = tv({\n slots: {\n base: 'group leading-normal',\n clearIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-foreground-800',\n control:\n 'duration-150! rounded-lg border-2 border-default-200 bg-content1 transition-background hover:border-default-400 group-data-[invalid=true]:border-danger group-data-[invalid=true]:hover:border-danger motion-reduce:transition-none',\n control_focused: 'border-focus',\n crossIcon: '',\n downChevron: '',\n dropdownIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-black',\n group: '',\n groupHeading: 'mb-1 ml-3 mt-2 text-sm text-foreground-500',\n indicatorsContainer: 'gap-1 p-1',\n indicatorSeparator: 'bg-default-300',\n input: 'py-0.5 pl-1',\n // see HeroUI styles for group-data condition,\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'pointer-events-auto relative bottom-1.5 ml-1 text-foreground subpixel-antialiased text-small group-data-[invalid=true]:!text-danger',\n loadingIndicator: '',\n loadingMessage: 'rounded-sm p-2 text-foreground-500',\n menu: 'mt-2 rounded-xl border border-default-200 bg-content1 p-1 shadow-lg',\n menuList: '',\n // ensure menu has same z-index as modal so it is visible when rendered in modal\n // see: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/modal.ts (see z-50)\n menuPortal: 'z-50!',\n multiValue: 'items-center gap-1.5 rounded bg-default-100 py-0.5 pl-2 pr-1',\n multiValueContainer: '',\n multiValueLabel: 'py-0.5 leading-6',\n multiValueRemove:\n 'rounded text-default-500 hover:cursor-pointer hover:border-default-300 hover:text-default-800',\n noOptionsMessage: 'rounded-sm p-2 text-foreground-500',\n option: 'rounded px-3 py-2 hover:cursor-pointer',\n option_disabled:\n 'cursor-not-allowed! hover:cursor-not-allowed! opacity-disabled',\n option_focused: 'bg-default-100 active:bg-default-200',\n option_selected: 'bg-default-300',\n placeholder: 'ml-1 py-0.5 pl-1 text-sm text-foreground-500',\n selectContainer: '',\n singleValue: 'ml-1! leading-7!',\n valueContainer: 'gap-1 p-1',\n },\n});\n\ninterface SelectOption {\n /** set option to disabled state */\n disabled?: boolean;\n /**\n * True when option was auto-generated because the value wasn't found in options.\n * Use in renderOptionLabel to render a component that fetches the real label.\n */\n isFallback?: boolean;\n /** option label */\n label?: ReactNode;\n /** option value */\n value: string | number;\n}\n\ntype VariantProps = TVProps<typeof selectVariants>;\ntype ClassName = TVClassName<typeof selectVariants>;\n\nexport interface SelectProps 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; // string;\n /** Determine if the */\n clearable?: boolean;\n /** Set the select to disabled state. */\n disabled?: boolean;\n /** Force menu open for debugging or visual testing. */\n debugMenuOpen?: boolean;\n /** Filter Select Options */\n filterOption?:\n | undefined\n | ((option?: SelectOption, inputValue?: string) => boolean);\n /** The value of the search input */\n inputValue?: string;\n /** Label that should be associated with the select. */\n label?: ReactNode;\n /** Set the select to a loading state. */\n loading?: boolean;\n /** switch between single and multi select mode. */\n multiSelect?: boolean;\n /** The name for the Select component, used by react-hook-form */\n name: string;\n /** Placeholder that is displayed when nothing is selected */\n placeholder?: string;\n /** Handle change events on the input */\n onInputChange?: Props['onInputChange'];\n /** The options for the Select component */\n options: SelectOption[];\n /** Render custom content when no options match the current search input. */\n renderEmptyOptions?: Props['noOptionsMessage'];\n /** Format the label of the option */\n renderOptionLabel?: undefined | Props['formatOptionLabel'];\n /**\n * Fallback option(s) for async selects when value isn't in current options.\n * Use when the selected value may not be in the options list (e.g., after\n * search results change). Used only if value not found in options.\n * For single select: pass the option object or undefined\n * For multi-select: pass an array of option objects\n */\n selectedOptionFallback?: SelectOption | SelectOption[];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\nconst InputComponent: typeof components.Input = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}`;\n return <components.Input data-testid={testId} {...props} />;\n};\n\nconst ControlComponent: typeof components.Control = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_select`;\n return (\n <div data-testid={testId}>\n <components.Control {...props} />\n </div>\n );\n};\n\nconst OptionComponent: typeof components.Option = (props) => {\n const { isDisabled } = props;\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_select_option_${slugify(String(props?.data?.testId ?? props?.data?.value), { replaceDots: true })}`;\n return (\n <div aria-disabled={isDisabled ? true : undefined} data-testid={testId}>\n <components.Option {...props} />\n </div>\n );\n};\n\nconst DropdownIndicatorComponent: typeof components.DropdownIndicator = (\n props,\n) => {\n // @ts-expect-error data-testid is not a default prop\n const testId = props?.selectProps['data-testid'] as string;\n return (\n <div data-testid={`${testId}_select_dropdown`}>\n <components.DropdownIndicator {...props} />\n </div>\n );\n};\n\n/** Select component based on [HeroUI Select](https://www.heroui.com//docs/components/select) and [React-Select](https://react-select.com/home) */\nconst Select = ({\n className = undefined,\n clearable = true,\n debugMenuOpen = false,\n filterOption = undefined,\n inputValue = undefined,\n loading = false,\n multiSelect = false,\n name,\n onInputChange = undefined,\n options,\n placeholder = undefined,\n renderEmptyOptions = undefined,\n renderOptionLabel = undefined,\n selectedOptionFallback = undefined,\n ...uniformFieldProps\n}: SelectProps) => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, ref, value },\n getErrorMessageProps,\n getHelperWrapperProps,\n getLabelProps,\n invalid,\n label,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Get getFieldState to check isTouched in onChange callback\n const { getFieldState } = useFormContext();\n\n // Track if the select is focused\n const [isFocused, setIsFocused] = useState(false);\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n // classNames from slots\n const variants = selectVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n\n // React-select classNames configuration\n const reactSelectClassNames = {\n clearIndicator: () => {\n return classNames.clearIndicator;\n },\n control: () => {\n return cn(classNames.control, {\n [classNames.control_focused]: isFocused && !invalid,\n });\n },\n dropdownIndicator: () => {\n return classNames.dropdownIndicator;\n },\n groupHeading: () => {\n return classNames.groupHeading;\n },\n indicatorSeparator: () => {\n return classNames.indicatorSeparator;\n },\n indicatorsContainer: () => {\n return classNames.indicatorsContainer;\n },\n input: () => {\n return classNames.input;\n },\n loadingIndicator: () => {\n return classNames.loadingIndicator;\n },\n loadingMessage: () => {\n return classNames.loadingMessage;\n },\n menu: () => {\n return classNames.menu;\n },\n menuList: () => {\n return classNames.menuList;\n },\n menuPortal: () => {\n return classNames.menuPortal;\n },\n multiValue: () => {\n return classNames.multiValue;\n },\n multiValueLabel: () => {\n return cn(classNames.multiValueLabel, `${getValueProps().className}`);\n },\n multiValueRemove: () => {\n return classNames.multiValueRemove;\n },\n noOptionsMessage: () => {\n return classNames.noOptionsMessage;\n },\n option: ({\n isDisabled: optionIsDisabled,\n isFocused: optionIsFocused,\n isSelected: optionIsSelected,\n }: {\n isDisabled: boolean;\n isFocused: boolean;\n isSelected: boolean;\n }) => {\n return cn(classNames.option, {\n [classNames.option_disabled]: optionIsDisabled,\n [classNames.option_focused]: optionIsFocused,\n [classNames.option_selected]: optionIsSelected,\n });\n },\n placeholder: () => {\n return classNames.placeholder;\n },\n singleValue: () => {\n return cn(classNames.singleValue, `${getValueProps().className}`);\n },\n valueContainer: () => {\n return classNames.valueContainer;\n },\n };\n\n const { getBaseProps, getTriggerProps, getValueProps } = useSelect({\n children: [],\n classNames,\n errorMessage,\n isDisabled: disabled,\n isInvalid: invalid,\n isLoading: loading,\n isRequired: required,\n label,\n labelPlacement: 'outside',\n });\n\n // react-select expects `isDisabled`, while our option contract uses `disabled`.\n const reactSelectOptions = options.map((option) => {\n return {\n ...option,\n isDisabled: option.disabled,\n };\n });\n\n // Compute selected option(s) for react-select\n //\n // Priority for finding options:\n // 1. Look in current options list\n // 2. Use selectedOptionFallback prop (for async selects with pre-fetched data)\n // 3. Create fallback with value as label\n //\n // Handles edge cases:\n // - Compares as strings to support both string and number values\n // - Returns null for empty single-select (required by react-select to clear)\n // - Creates fallback options when value exists but isn't in options list\n // (common with async selects where options change after selection)\n const reactSelectValue = (() => {\n // Helper to find option by value\n const findOption = (v: string | number): SelectOption => {\n // First, look in options list\n const inOptions = options.find((option) => {\n return String(option.value) === String(v);\n });\n if (inOptions) {\n return inOptions;\n }\n\n // Second, look in selectedOptionFallback prop (for async selects)\n if (selectedOptionFallback) {\n if (Array.isArray(selectedOptionFallback)) {\n const inSelected = selectedOptionFallback.find((option) => {\n return String(option.value) === String(v);\n });\n if (inSelected) {\n return inSelected;\n }\n } else if (String(selectedOptionFallback.value) === String(v)) {\n return selectedOptionFallback;\n }\n }\n\n // Fallback: create option with value as label, marked as fallback\n return { isFallback: true, label: String(v), value: v };\n };\n\n if (multiSelect) {\n if (!Array.isArray(value) || isValueEmpty(value)) {\n return [];\n }\n return value.map((v) => {\n return findOption(v);\n });\n }\n\n // Single select - use isValueEmpty to handle marker strings (__NULL__, etc.)\n if (isValueEmpty(value)) {\n return null;\n }\n return findOption(value);\n })();\n\n // Handle selection change\n const handleChange = (\n option: MultiValue<SelectOption> | SingleValue<SelectOption>,\n ) => {\n if (multiSelect) {\n onChange(\n (option as SelectOption[])?.map((_option) => {\n return convertToOriginalType(_option.value);\n }),\n );\n } else {\n const newValue = (option as SelectOption)?.value;\n // Pass null explicitly when clearing (not undefined)\n onChange(newValue != null ? convertToOriginalType(newValue) : null);\n }\n\n // Mark field as touched immediately when a selection is made if not already touched\n // This ensures validation errors show right away (isTouched becomes true)\n // For Select components, selecting an option is a complete user action\n // (unlike text inputs where typing is ongoing), so we mark as touched immediately\n const { isTouched: currentIsTouched } = getFieldState(name, testId);\n if (!currentIsTouched) {\n // Defer blur/touched notification until after the onChange value commit.\n // This prevents \"one render cycle behind\" validation states where blur\n // validation runs against the previous value.\n queueMicrotask(() => {\n onBlur();\n });\n }\n };\n\n // Handle blur event\n const handleBlur = () => {\n setIsFocused(false);\n onBlur();\n };\n\n // Handle focus event\n const handleFocus = () => {\n setIsFocused(true);\n };\n\n return (\n <div\n {...getBaseProps()}\n className={cn(classNames.base)}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-required={required}\n data-testid={`${testId}_wrapper`}\n >\n {label ? (\n <label\n className={classNames.label}\n data-slot=\"label\"\n htmlFor={`react-select-${name}-input`}\n id={getLabelProps().id}\n >\n {label}\n {required ? (\n <span aria-hidden className=\"ml-0.5 text-danger\">\n *\n </span>\n ) : null}\n </label>\n ) : null}\n <ReactSelect\n ref={ref}\n aria-errormessage=\"\"\n aria-invalid={invalid}\n aria-label={ariaLabel}\n // set aria-labelledby to the label id so that the select is accessible\n aria-labelledby={\n label\n ? getTriggerProps()['aria-labelledby']?.split(' ')[1]\n : undefined\n }\n classNames={reactSelectClassNames}\n components={{\n Control: ControlComponent,\n DropdownIndicator: DropdownIndicatorComponent,\n Input: InputComponent,\n Option: OptionComponent,\n }}\n // Does not affect the testId of the select, but is needed to pass it to sub-components\n data-testid={testId}\n filterOption={filterOption}\n formatOptionLabel={renderOptionLabel}\n inputValue={inputValue}\n instanceId={name}\n isClearable={clearable}\n isDisabled={disabled}\n isLoading={loading}\n isMulti={multiSelect}\n menuIsOpen={debugMenuOpen ? true : undefined}\n // set menuPosition to fixed so that menu can be rendered\n // inside Card / Modal components, menuShouldBlockScroll\n // prevents container scroll when menu is open\n menuPosition=\"fixed\"\n menuShouldBlockScroll\n name={name}\n noOptionsMessage={renderEmptyOptions}\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={handleFocus}\n onInputChange={onInputChange}\n options={reactSelectOptions}\n placeholder={placeholder}\n unstyled\n value={reactSelectValue}\n />\n {invalid ? (\n <div {...getHelperWrapperProps()}>\n <div {...getErrorMessageProps()}>{errorMessage}</div>\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default Select;\n","import Select from './Select';\n\nexport type { SelectProps } from './Select';\n\nexport { Select };\n\nexport default Select;\n"],"mappings":";;;;;;;;;;;AAeA,MAAa,kBAAA,GAAA,uBAAA,IAAoB,EAC/B,OAAO;CACL,MAAM;CACN,gBACE;CACF,SACE;CACF,iBAAiB;CACjB,WAAW;CACX,aAAa;CACb,mBACE;CACF,O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,KAAA;IAEN,YAAY;IACZ,YAAY;KACV,SAAS;KACT,mBAAmB;KACnB,OAAO;KACP,QAAQ;IACV;IAEA,eAAa;IACC;IACd,mBAAmB;IACP;IACZ,YAAY;IACZ,aAAa;IACb,YAAY;IACZ,WAAW;IACX,SAAS;IACT,YAAY,gBAAgB,OAAO,KAAA;IAInC,cAAa;IACb,uBAAA;IACM;IACN,kBAAkB;IAClB,QAAQ;IACR,UAAU;IACV,SAAS;IACM;IACf,SAAS;IACI;IACb,UAAA;IACA,OAAO;GACR,CAAA;GACA,UACC,iBAAA,GAAA,kBAAA,KAAC,OAAD;IAAK,GAAI,sBAAsB;cAC7B,iBAAA,GAAA,kBAAA,KAAC,OAAD;KAAK,GAAI,qBAAqB;eAAI;IAAkB,CAAA;GACjD,CAAA,IACH;EACD;;AAET;;;ACleA,IAAA,iBAAe"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Select-CgeqhZIC.js","names":[],"sources":["../src/Select/Select.tsx","../src/Select/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\nimport type { MultiValue, Props, SingleValue } from 'react-select';\n\nimport { useState } from 'react';\nimport ReactSelect, { components } from 'react-select';\n\nimport { useSelect } from '@heroui/select';\n\nimport { cn, slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { createOptionValueConverter, isValueEmpty } from '../helpers';\nimport { useFormContext } from '../hooks/useFormContext';\nimport { useUniformField } from '../hooks/useUniformField';\n\nexport const selectVariants = tv({\n slots: {\n base: 'group leading-normal',\n clearIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-foreground-800',\n control:\n 'duration-150! rounded-lg border-2 border-default-200 bg-content1 transition-background hover:border-default-400 group-data-[invalid=true]:border-danger group-data-[invalid=true]:hover:border-danger motion-reduce:transition-none',\n control_focused: 'border-focus',\n crossIcon: '',\n downChevron: '',\n dropdownIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-black',\n group: '',\n groupHeading: 'mb-1 ml-3 mt-2 text-sm text-foreground-500',\n indicatorsContainer: 'gap-1 p-1',\n indicatorSeparator: 'bg-default-300',\n input: 'py-0.5 pl-1',\n // see HeroUI styles for group-data condition,\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'pointer-events-auto relative bottom-1.5 ml-1 text-foreground subpixel-antialiased text-small group-data-[invalid=true]:!text-danger',\n loadingIndicator: '',\n loadingMessage: 'rounded-sm p-2 text-foreground-500',\n menu: 'mt-2 rounded-xl border border-default-200 bg-content1 p-1 shadow-lg',\n menuList: '',\n // ensure menu has same z-index as modal so it is visible when rendered in modal\n // see: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/modal.ts (see z-50)\n menuPortal: 'z-50!',\n multiValue: 'items-center gap-1.5 rounded bg-default-100 py-0.5 pl-2 pr-1',\n multiValueContainer: '',\n multiValueLabel: 'py-0.5 leading-6',\n multiValueRemove:\n 'rounded text-default-500 hover:cursor-pointer hover:border-default-300 hover:text-default-800',\n noOptionsMessage: 'rounded-sm p-2 text-foreground-500',\n option: 'rounded px-3 py-2 hover:cursor-pointer',\n option_disabled:\n 'cursor-not-allowed! hover:cursor-not-allowed! opacity-disabled',\n option_focused: 'bg-default-100 active:bg-default-200',\n option_selected: 'bg-default-300',\n placeholder: 'ml-1 py-0.5 pl-1 text-sm text-foreground-500',\n selectContainer: '',\n singleValue: 'ml-1! leading-7!',\n valueContainer: 'gap-1 p-1',\n },\n});\n\ninterface SelectOption {\n /** set option to disabled state */\n disabled?: boolean;\n /**\n * True when option was auto-generated because the value wasn't found in options.\n * Use in renderOptionLabel to render a component that fetches the real label.\n */\n isFallback?: boolean;\n /** option label */\n label?: ReactNode;\n /** option value */\n value: string | number;\n}\n\ntype VariantProps = TVProps<typeof selectVariants>;\ntype ClassName = TVClassName<typeof selectVariants>;\n\nexport interface SelectProps 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; // string;\n /** Determine if the */\n clearable?: boolean;\n /** Set the select to disabled state. */\n disabled?: boolean;\n /** Force menu open for debugging or visual testing. */\n debugMenuOpen?: boolean;\n /** Filter Select Options */\n filterOption?:\n | undefined\n | ((option?: SelectOption, inputValue?: string) => boolean);\n /** The value of the search input */\n inputValue?: string;\n /** Label that should be associated with the select. */\n label?: ReactNode;\n /** Set the select to a loading state. */\n loading?: boolean;\n /** switch between single and multi select mode. */\n multiSelect?: boolean;\n /** The name for the Select component, used by react-hook-form */\n name: string;\n /** Placeholder that is displayed when nothing is selected */\n placeholder?: string;\n /** Handle change events on the input */\n onInputChange?: Props['onInputChange'];\n /** The options for the Select component */\n options: SelectOption[];\n /** Render custom content when no options match the current search input. */\n renderEmptyOptions?: Props['noOptionsMessage'];\n /** Format the label of the option */\n renderOptionLabel?: undefined | Props['formatOptionLabel'];\n /**\n * Fallback option(s) for async selects when value isn't in current options.\n * Use when the selected value may not be in the options list (e.g., after\n * search results change). Used only if value not found in options.\n * For single select: pass the option object or undefined\n * For multi-select: pass an array of option objects\n */\n selectedOptionFallback?: SelectOption | SelectOption[];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\nconst InputComponent: typeof components.Input = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}`;\n return <components.Input data-testid={testId} {...props} />;\n};\n\nconst ControlComponent: typeof components.Control = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_select`;\n return (\n <div data-testid={testId}>\n <components.Control {...props} />\n </div>\n );\n};\n\nconst OptionComponent: typeof components.Option = (props) => {\n const { isDisabled } = props;\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_select_option_${slugify(String(props?.data?.testId ?? props?.data?.value), { replaceDots: true })}`;\n return (\n <div aria-disabled={isDisabled ? true : undefined} data-testid={testId}>\n <components.Option {...props} />\n </div>\n );\n};\n\nconst DropdownIndicatorComponent: typeof components.DropdownIndicator = (\n props,\n) => {\n // @ts-expect-error data-testid is not a default prop\n const testId = props?.selectProps['data-testid'] as string;\n return (\n <div data-testid={`${testId}_select_dropdown`}>\n <components.DropdownIndicator {...props} />\n </div>\n );\n};\n\n/** Select component based on [HeroUI Select](https://www.heroui.com//docs/components/select) and [React-Select](https://react-select.com/home) */\nconst Select = ({\n className = undefined,\n clearable = true,\n debugMenuOpen = false,\n filterOption = undefined,\n inputValue = undefined,\n loading = false,\n multiSelect = false,\n name,\n onInputChange = undefined,\n options,\n placeholder = undefined,\n renderEmptyOptions = undefined,\n renderOptionLabel = undefined,\n selectedOptionFallback = undefined,\n ...uniformFieldProps\n}: SelectProps) => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, ref, value },\n getErrorMessageProps,\n getHelperWrapperProps,\n getLabelProps,\n invalid,\n label,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Get getFieldState to check isTouched in onChange callback\n const { getFieldState } = useFormContext();\n\n // Track if the select is focused\n const [isFocused, setIsFocused] = useState(false);\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n // classNames from slots\n const variants = selectVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n\n // React-select classNames configuration\n const reactSelectClassNames = {\n clearIndicator: () => {\n return classNames.clearIndicator;\n },\n control: () => {\n return cn(classNames.control, {\n [classNames.control_focused]: isFocused && !invalid,\n });\n },\n dropdownIndicator: () => {\n return classNames.dropdownIndicator;\n },\n groupHeading: () => {\n return classNames.groupHeading;\n },\n indicatorSeparator: () => {\n return classNames.indicatorSeparator;\n },\n indicatorsContainer: () => {\n return classNames.indicatorsContainer;\n },\n input: () => {\n return classNames.input;\n },\n loadingIndicator: () => {\n return classNames.loadingIndicator;\n },\n loadingMessage: () => {\n return classNames.loadingMessage;\n },\n menu: () => {\n return classNames.menu;\n },\n menuList: () => {\n return classNames.menuList;\n },\n menuPortal: () => {\n return classNames.menuPortal;\n },\n multiValue: () => {\n return classNames.multiValue;\n },\n multiValueLabel: () => {\n return cn(classNames.multiValueLabel, `${getValueProps().className}`);\n },\n multiValueRemove: () => {\n return classNames.multiValueRemove;\n },\n noOptionsMessage: () => {\n return classNames.noOptionsMessage;\n },\n option: ({\n isDisabled: optionIsDisabled,\n isFocused: optionIsFocused,\n isSelected: optionIsSelected,\n }: {\n isDisabled: boolean;\n isFocused: boolean;\n isSelected: boolean;\n }) => {\n return cn(classNames.option, {\n [classNames.option_disabled]: optionIsDisabled,\n [classNames.option_focused]: optionIsFocused,\n [classNames.option_selected]: optionIsSelected,\n });\n },\n placeholder: () => {\n return classNames.placeholder;\n },\n singleValue: () => {\n return cn(classNames.singleValue, `${getValueProps().className}`);\n },\n valueContainer: () => {\n return classNames.valueContainer;\n },\n };\n\n const { getBaseProps, getTriggerProps, getValueProps } = useSelect({\n children: [],\n classNames,\n errorMessage,\n isDisabled: disabled,\n isInvalid: invalid,\n isLoading: loading,\n isRequired: required,\n label,\n labelPlacement: 'outside',\n });\n\n // react-select expects `isDisabled`, while our option contract uses `disabled`.\n const reactSelectOptions = options.map((option) => {\n return {\n ...option,\n isDisabled: option.disabled,\n };\n });\n\n // Compute selected option(s) for react-select\n //\n // Priority for finding options:\n // 1. Look in current options list\n // 2. Use selectedOptionFallback prop (for async selects with pre-fetched data)\n // 3. Create fallback with value as label\n //\n // Handles edge cases:\n // - Compares as strings to support both string and number values\n // - Returns null for empty single-select (required by react-select to clear)\n // - Creates fallback options when value exists but isn't in options list\n // (common with async selects where options change after selection)\n const reactSelectValue = (() => {\n // Helper to find option by value\n const findOption = (v: string | number): SelectOption => {\n // First, look in options list\n const inOptions = options.find((option) => {\n return String(option.value) === String(v);\n });\n if (inOptions) {\n return inOptions;\n }\n\n // Second, look in selectedOptionFallback prop (for async selects)\n if (selectedOptionFallback) {\n if (Array.isArray(selectedOptionFallback)) {\n const inSelected = selectedOptionFallback.find((option) => {\n return String(option.value) === String(v);\n });\n if (inSelected) {\n return inSelected;\n }\n } else if (String(selectedOptionFallback.value) === String(v)) {\n return selectedOptionFallback;\n }\n }\n\n // Fallback: create option with value as label, marked as fallback\n return { isFallback: true, label: String(v), value: v };\n };\n\n if (multiSelect) {\n if (!Array.isArray(value) || isValueEmpty(value)) {\n return [];\n }\n return value.map((v) => {\n return findOption(v);\n });\n }\n\n // Single select - use isValueEmpty to handle marker strings (__NULL__, etc.)\n if (isValueEmpty(value)) {\n return null;\n }\n return findOption(value);\n })();\n\n // Handle selection change\n const handleChange = (\n option: MultiValue<SelectOption> | SingleValue<SelectOption>,\n ) => {\n if (multiSelect) {\n onChange(\n (option as SelectOption[])?.map((_option) => {\n return convertToOriginalType(_option.value);\n }),\n );\n } else {\n const newValue = (option as SelectOption)?.value;\n // Pass null explicitly when clearing (not undefined)\n onChange(newValue != null ? convertToOriginalType(newValue) : null);\n }\n\n // Mark field as touched immediately when a selection is made if not already touched\n // This ensures validation errors show right away (isTouched becomes true)\n // For Select components, selecting an option is a complete user action\n // (unlike text inputs where typing is ongoing), so we mark as touched immediately\n const { isTouched: currentIsTouched } = getFieldState(name, testId);\n if (!currentIsTouched) {\n // Defer blur/touched notification until after the onChange value commit.\n // This prevents \"one render cycle behind\" validation states where blur\n // validation runs against the previous value.\n queueMicrotask(() => {\n onBlur();\n });\n }\n };\n\n // Handle blur event\n const handleBlur = () => {\n setIsFocused(false);\n onBlur();\n };\n\n // Handle focus event\n const handleFocus = () => {\n setIsFocused(true);\n };\n\n return (\n <div\n {...getBaseProps()}\n className={cn(classNames.base)}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-required={required}\n data-testid={`${testId}_wrapper`}\n >\n {label ? (\n <label\n className={classNames.label}\n data-slot=\"label\"\n htmlFor={`react-select-${name}-input`}\n id={getLabelProps().id}\n >\n {label}\n {required ? (\n <span aria-hidden className=\"ml-0.5 text-danger\">\n *\n </span>\n ) : null}\n </label>\n ) : null}\n <ReactSelect\n ref={ref}\n aria-errormessage=\"\"\n aria-invalid={invalid}\n aria-label={ariaLabel}\n // set aria-labelledby to the label id so that the select is accessible\n aria-labelledby={\n label\n ? getTriggerProps()['aria-labelledby']?.split(' ')[1]\n : undefined\n }\n classNames={reactSelectClassNames}\n components={{\n Control: ControlComponent,\n DropdownIndicator: DropdownIndicatorComponent,\n Input: InputComponent,\n Option: OptionComponent,\n }}\n // Does not affect the testId of the select, but is needed to pass it to sub-components\n data-testid={testId}\n filterOption={filterOption}\n formatOptionLabel={renderOptionLabel}\n inputValue={inputValue}\n instanceId={name}\n isClearable={clearable}\n isDisabled={disabled}\n isLoading={loading}\n isMulti={multiSelect}\n menuIsOpen={debugMenuOpen ? true : undefined}\n // set menuPosition to fixed so that menu can be rendered\n // inside Card / Modal components, menuShouldBlockScroll\n // prevents container scroll when menu is open\n menuPosition=\"fixed\"\n menuShouldBlockScroll\n name={name}\n noOptionsMessage={renderEmptyOptions}\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={handleFocus}\n onInputChange={onInputChange}\n options={reactSelectOptions}\n placeholder={placeholder}\n unstyled\n value={reactSelectValue}\n />\n {invalid ? (\n <div {...getHelperWrapperProps()}>\n <div {...getErrorMessageProps()}>{errorMessage}</div>\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default Select;\n","import Select from './Select';\n\nexport type { SelectProps } from './Select';\n\nexport { Select };\n\nexport default Select;\n"],"mappings":";;;;;;;;;AAeA,MAAa,iBAAiB,GAAG,EAC/B,OAAO;CACL,MAAM;CACN,gBACE;CACF,SACE;CACF,iBAAiB;CACjB,WAAW;CACX,aAAa;CACb,mBACE;CACF,OAAO;CACP,cAAc;CACd,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kB,CAAA;GACjD,CAAA,IACH;EACD;;AAET;;;ACleA,IAAA,iBAAe"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Time-CDptQ3CK.js","names":["HeroTimeInput"],"sources":["../src/Time/timeHelpers.ts","../src/Time/Time.tsx"],"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 // eslint-disable-next-line @typescript-eslint/no-unsafe-return\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: '',\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, 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 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"],"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,S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AU;EACV,kBAAkB,oBAAoB,KAAA;EACtC,QAAO;EACP,OAAO,eAAe,KAAA;EACtB,SAAQ;CACT,CAAA;AAEL"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Time-WKgbji5k.cjs","names":["useUniformField","HeroTimeInput"],"sources":["../src/Time/timeHelpers.ts","../src/Time/Time.tsx"],"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 // eslint-disable-next-line @typescript-eslint/no-unsafe-return\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: '',\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, 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 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"],"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;;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,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"}
@@ -1,113 +0,0 @@
1
- import { TVClassName, TVProps } from "@fuf-stack/pixel-utils";
2
- import { ReactNode } from "react";
3
-
4
- //#region src/Time/Time.d.ts
5
- declare const timeVariants: import("tailwind-variants").TVReturnType<{
6
- [key: string]: {
7
- [key: string]: import("tailwind-merge").ClassNameValue | {
8
- base?: import("tailwind-merge").ClassNameValue;
9
- label?: import("tailwind-merge").ClassNameValue;
10
- input?: import("tailwind-merge").ClassNameValue;
11
- helperWrapper?: import("tailwind-merge").ClassNameValue;
12
- inputWrapper?: import("tailwind-merge").ClassNameValue;
13
- innerWrapper?: import("tailwind-merge").ClassNameValue;
14
- segment?: import("tailwind-merge").ClassNameValue;
15
- };
16
- };
17
- } | {
18
- [x: string]: {
19
- [x: string]: import("tailwind-merge").ClassNameValue | {
20
- base?: import("tailwind-merge").ClassNameValue;
21
- label?: import("tailwind-merge").ClassNameValue;
22
- input?: import("tailwind-merge").ClassNameValue;
23
- helperWrapper?: import("tailwind-merge").ClassNameValue;
24
- inputWrapper?: import("tailwind-merge").ClassNameValue;
25
- innerWrapper?: import("tailwind-merge").ClassNameValue;
26
- segment?: import("tailwind-merge").ClassNameValue;
27
- };
28
- };
29
- } | {}, {
30
- /** wrapper around the whole time input */base: string; /** helper wrapper for error/description */
31
- helperWrapper: string[]; /** the segmented input element */
32
- input: string; /** inner wrapper around segments and optional content */
33
- innerWrapper: string; /** outer input wrapper */
34
- inputWrapper: string; /** field label */
35
- label: string; /** individual segment */
36
- segment: string;
37
- }, undefined, {
38
- [key: string]: {
39
- [key: string]: import("tailwind-merge").ClassNameValue | {
40
- base?: import("tailwind-merge").ClassNameValue;
41
- label?: import("tailwind-merge").ClassNameValue;
42
- input?: import("tailwind-merge").ClassNameValue;
43
- helperWrapper?: import("tailwind-merge").ClassNameValue;
44
- inputWrapper?: import("tailwind-merge").ClassNameValue;
45
- innerWrapper?: import("tailwind-merge").ClassNameValue;
46
- segment?: import("tailwind-merge").ClassNameValue;
47
- };
48
- };
49
- } | {}, {
50
- /** wrapper around the whole time input */base: string; /** helper wrapper for error/description */
51
- helperWrapper: string[]; /** the segmented input element */
52
- input: string; /** inner wrapper around segments and optional content */
53
- innerWrapper: string; /** outer input wrapper */
54
- inputWrapper: string; /** field label */
55
- label: string; /** individual segment */
56
- segment: string;
57
- }, import("tailwind-variants").TVReturnType<unknown, {
58
- /** wrapper around the whole time input */base: string; /** helper wrapper for error/description */
59
- helperWrapper: string[]; /** the segmented input element */
60
- input: string; /** inner wrapper around segments and optional content */
61
- innerWrapper: string; /** outer input wrapper */
62
- inputWrapper: string; /** field label */
63
- label: string; /** individual segment */
64
- segment: string;
65
- }, undefined, unknown, unknown, undefined>>;
66
- type VariantProps = TVProps<typeof timeVariants>;
67
- type ClassName = TVClassName<typeof timeVariants>;
68
- interface TimeProps extends VariantProps {
69
- /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */
70
- ariaLabel?: string;
71
- /** CSS class name */
72
- className?: ClassName;
73
- /** input is disabled */
74
- disabled?: boolean;
75
- /** smallest visible unit in the segmented time input */
76
- granularity?: 'hour' | 'minute';
77
- /** hide timezone abbreviation for zoned values */
78
- hideTimeZone?: boolean;
79
- /** force hour granularity and store UTC hour as number (0-23) */
80
- hourAsNumber?: boolean;
81
- /** hour cycle formatting */
82
- hourCycle?: 12 | 24;
83
- /** form field label */
84
- label?: ReactNode;
85
- /** form field name */
86
- name: string;
87
- /** HTML data-testid attribute used in e2e tests */
88
- testId?: string;
89
- /**
90
- * Optional timezone used for parsing date-time strings and serializing values.
91
- * When omitted, local timezone is used.
92
- */
93
- timeZone?: string;
94
- /** value format stored in form state (`string` stores UTC minute values, e.g. `10:15Z`) */
95
- valueType?: 'string' | 'timeValue';
96
- }
97
- /**
98
- * Time component based on [HeroUI TimeInput](https://v2.heroui.com/docs/components/time-input)
99
- */
100
- declare const Time: ({
101
- className: _className,
102
- granularity,
103
- hideTimeZone,
104
- hourAsNumber,
105
- hourCycle,
106
- name,
107
- timeZone,
108
- valueType,
109
- ...uniformFieldProps
110
- }: TimeProps) => import("react/jsx-runtime").JSX.Element;
111
- //#endregion
112
- export { TimeProps as n, Time as t };
113
- //# sourceMappingURL=index-7UT2Ki5e.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-7UT2Ki5e.d.cts","names":[],"sources":["../src/Time/Time.tsx"],"mappings":";;;;cAgBa,YAAA,8BAAY,YAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsBpB,YAAA,GAAe,OAAO,QAAQ,YAAA;AAAA,KAC9B,SAAA,GAAY,WAAW,QAAQ,YAAA;AAAA,UAEnB,SAAA,SAAkB,YAAA;EAHf;EAKlB,SAAA;EAJG;EAMH,SAAA,GAAY,SAAA;;EAEZ,QAAA;EAR8C;EAU9C,WAAA;EARyB;EAUzB,YAAA;EANY;EAQZ,YAAA;EAZiC;EAcjC,SAAA;EAd6C;EAgB7C,KAAA,GAAQ,SAAA;EAdR;EAgBA,IAAA;EAdY;EAgBZ,MAAA;EAZA;;;;EAiBA,QAAA;EATQ;EAWR,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,iCAAS,GAAA,CAAA,OAAA"}
@@ -1,174 +0,0 @@
1
- import { TVClassName, TVProps } from "@fuf-stack/pixel-utils";
2
- import { ReactNode } from "react";
3
- //#region src/RadioBoxes/RadioBoxes.d.ts
4
- declare const radioBoxesVariants: import("tailwind-variants").TVReturnType<{
5
- [key: string]: {
6
- [key: string]: import("tailwind-merge").ClassNameValue | {
7
- base?: import("tailwind-merge").ClassNameValue;
8
- label?: import("tailwind-merge").ClassNameValue;
9
- wrapper?: import("tailwind-merge").ClassNameValue;
10
- boxBase?: import("tailwind-merge").ClassNameValue;
11
- boxControl?: import("tailwind-merge").ClassNameValue;
12
- boxDescription?: import("tailwind-merge").ClassNameValue;
13
- boxLabel?: import("tailwind-merge").ClassNameValue;
14
- boxLabelWrapper?: import("tailwind-merge").ClassNameValue;
15
- };
16
- };
17
- } | {
18
- [x: string]: {
19
- [x: string]: import("tailwind-merge").ClassNameValue | {
20
- base?: import("tailwind-merge").ClassNameValue;
21
- label?: import("tailwind-merge").ClassNameValue;
22
- wrapper?: import("tailwind-merge").ClassNameValue;
23
- boxBase?: import("tailwind-merge").ClassNameValue;
24
- boxControl?: import("tailwind-merge").ClassNameValue;
25
- boxDescription?: import("tailwind-merge").ClassNameValue;
26
- boxLabel?: import("tailwind-merge").ClassNameValue;
27
- boxLabelWrapper?: import("tailwind-merge").ClassNameValue;
28
- };
29
- };
30
- } | {}, {
31
- base: string;
32
- boxBase: string;
33
- boxControl: string;
34
- boxDescription: string;
35
- boxLabel: string;
36
- boxLabelWrapper: string;
37
- label: string;
38
- wrapper: string;
39
- }, undefined, {
40
- [key: string]: {
41
- [key: string]: import("tailwind-merge").ClassNameValue | {
42
- base?: import("tailwind-merge").ClassNameValue;
43
- label?: import("tailwind-merge").ClassNameValue;
44
- wrapper?: import("tailwind-merge").ClassNameValue;
45
- boxBase?: import("tailwind-merge").ClassNameValue;
46
- boxControl?: import("tailwind-merge").ClassNameValue;
47
- boxDescription?: import("tailwind-merge").ClassNameValue;
48
- boxLabel?: import("tailwind-merge").ClassNameValue;
49
- boxLabelWrapper?: import("tailwind-merge").ClassNameValue;
50
- };
51
- };
52
- } | {}, {
53
- base: string;
54
- boxBase: string;
55
- boxControl: string;
56
- boxDescription: string;
57
- boxLabel: string;
58
- boxLabelWrapper: string;
59
- label: string;
60
- wrapper: string;
61
- }, import("tailwind-variants").TVReturnType<unknown, {
62
- base: string;
63
- boxBase: string;
64
- boxControl: string;
65
- boxDescription: string;
66
- boxLabel: string;
67
- boxLabelWrapper: string;
68
- label: string;
69
- wrapper: string;
70
- }, undefined, unknown, unknown, undefined>>;
71
- type VariantProps = TVProps<typeof radioBoxesVariants>;
72
- type ClassName = TVClassName<typeof radioBoxesVariants>;
73
- interface RadioBoxesOption {
74
- /** Description of the value. Works with variant radioBox. */
75
- description?: ReactNode;
76
- /** disables the option */
77
- disabled?: boolean;
78
- /** option label */
79
- label?: ReactNode;
80
- /** option icon */
81
- icon?: ReactNode;
82
- /** HTML data-testid attribute of the option */
83
- testId?: string;
84
- /** option value */
85
- value: string | number;
86
- }
87
- interface RadioBoxesProps extends VariantProps {
88
- /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */
89
- ariaLabel?: string;
90
- /** CSS class name */
91
- className?: ClassName;
92
- /** Determines if the Buttons are disabled or not. */
93
- disabled?: boolean;
94
- /** determines orientation of the Buttons. */
95
- inline?: boolean;
96
- /** Label displayed next to the RadioButton. */
97
- label?: ReactNode;
98
- /** Name the RadioButtons are registered at in HTML forms (react-hook-form). */
99
- name: string;
100
- /** Radio button configuration. */
101
- options: RadioBoxesOption[];
102
- /** Id to grab element in internal tests. */
103
- testId?: string;
104
- }
105
- /**
106
- * RadioBoxes component based on [HeroUI RadioGroup](https://www.heroui.com//docs/components/radio-group)
107
- */
108
- declare const RadioBoxes: ({
109
- className,
110
- inline,
111
- name,
112
- options,
113
- ...uniformFieldProps
114
- }: RadioBoxesProps) => import("react/jsx-runtime").JSX.Element;
115
- //#endregion
116
- //#region src/RadioBoxes/RadioBox.d.ts
117
- declare const radioBoxVariants: import("tailwind-variants").TVReturnType<{
118
- isDisabled: {
119
- true: {
120
- base: string;
121
- };
122
- };
123
- isInvalid: {
124
- true: {
125
- base: string;
126
- };
127
- };
128
- }, {
129
- base: string;
130
- control: string;
131
- description: string;
132
- icon: string;
133
- label: string;
134
- labelWrapper: string;
135
- }, undefined, {
136
- isDisabled: {
137
- true: {
138
- base: string;
139
- };
140
- };
141
- isInvalid: {
142
- true: {
143
- base: string;
144
- };
145
- };
146
- }, {
147
- base: string;
148
- control: string;
149
- description: string;
150
- icon: string;
151
- label: string;
152
- labelWrapper: string;
153
- }, import("tailwind-variants").TVReturnType<{
154
- isDisabled: {
155
- true: {
156
- base: string;
157
- };
158
- };
159
- isInvalid: {
160
- true: {
161
- base: string;
162
- };
163
- };
164
- }, {
165
- base: string;
166
- control: string;
167
- description: string;
168
- icon: string;
169
- label: string;
170
- labelWrapper: string;
171
- }, undefined, unknown, unknown, undefined>>;
172
- //#endregion
173
- export { RadioBoxes as n, RadioBoxesProps as r, radioBoxVariants as t };
174
- //# sourceMappingURL=index-9_3XTDJC.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-9_3XTDJC.d.cts","names":[],"sources":["../src/RadioBoxes/RadioBoxes.tsx","../src/RadioBoxes/RadioBox.tsx"],"mappings":";;;cAaa,kBAAA,8BAAkB,YAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgB1B,YAAA,GAAe,OAAO,QAAQ,kBAAA;AAAA,KAC9B,SAAA,GAAY,WAAW,QAAQ,kBAAA;AAAA,UAEnB,gBAAA;;EAEf,WAAA,GAAc,SAAA;;EAEd,QAAA;;EAEA,KAAA,GAAQ,SAAA;;EAER,IAAA,GAAO,SAAA;;EAEP,MAAA;;EAEA,KAAA;AAAA;AAAA,UAGe,eAAA,SAAwB,YAAA;;EAEvC,SAAA;;EAEA,SAAA,GAAY,SAAA;;EAEZ,QAAA;;EAEA,MAAA;EA1BG;EA4BH,KAAA,GAAQ,SAAA;;EAER,IAAA;EA9BmD;EAgCnD,OAAA,EAAS,gBAAA;EA/BG;EAiCZ,MAAA;AAAA;AAjCoD;AAEtD;;AAFsD,cAuChD,UAAA;EAAc,SAAA;EAAA,MAAA;EAAA,IAAA;EAAA,OAAA;EAAA,GAAA;AAAA,GAMjB,eAAA,iCAAe,GAAA,CAAA,OAAA;;;cClEL,gBAAA,8BAAgB,YAAA"}