@customafk/lunas-ui 0.2.64 → 0.2.65

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 (181) hide show
  1. package/dist/action-submit-3kZ7JOop.cjs +2 -0
  2. package/dist/action-submit-3kZ7JOop.cjs.map +1 -0
  3. package/dist/action-submit-Dg5GvYz5.mjs +2 -0
  4. package/dist/action-submit-Dg5GvYz5.mjs.map +1 -0
  5. package/dist/actions-form-BL_B81Vg.mjs +2 -0
  6. package/dist/actions-form-BL_B81Vg.mjs.map +1 -0
  7. package/dist/actions-form-CE_enCgE.cjs +2 -0
  8. package/dist/actions-form-CE_enCgE.cjs.map +1 -0
  9. package/dist/card-form-BR5kDTzB.cjs +2 -0
  10. package/dist/card-form-BR5kDTzB.cjs.map +1 -0
  11. package/dist/card-form-D9fNO-6F.mjs +2 -0
  12. package/dist/card-form-D9fNO-6F.mjs.map +1 -0
  13. package/dist/checkbox-field-CRcfuDu1.mjs +2 -0
  14. package/dist/checkbox-field-CRcfuDu1.mjs.map +1 -0
  15. package/dist/checkbox-field-DdeohRmi.cjs +2 -0
  16. package/dist/checkbox-field-DdeohRmi.cjs.map +1 -0
  17. package/dist/combobox-field-BGChwajc.mjs +2 -0
  18. package/dist/combobox-field-BGChwajc.mjs.map +1 -0
  19. package/dist/combobox-field-D9NdSih1.cjs +2 -0
  20. package/dist/combobox-field-D9NdSih1.cjs.map +1 -0
  21. package/dist/container-form-BdsEX0NH.mjs +2 -0
  22. package/dist/container-form-BdsEX0NH.mjs.map +1 -0
  23. package/dist/container-form-CxxUYctk.cjs +2 -0
  24. package/dist/container-form-CxxUYctk.cjs.map +1 -0
  25. package/dist/date-field-BqAX4M_h.cjs +2 -0
  26. package/dist/date-field-BqAX4M_h.cjs.map +1 -0
  27. package/dist/date-field-Dm4ki1HS.mjs +2 -0
  28. package/dist/date-field-Dm4ki1HS.mjs.map +1 -0
  29. package/dist/dialog-form-ClWBZbUN.mjs +2 -0
  30. package/dist/dialog-form-ClWBZbUN.mjs.map +1 -0
  31. package/dist/dialog-form-DN-NlQFO.cjs +2 -0
  32. package/dist/dialog-form-DN-NlQFO.cjs.map +1 -0
  33. package/dist/dialogs/confirm-dialog.cjs +1 -1
  34. package/dist/dialogs/confirm-dialog.cjs.map +1 -1
  35. package/dist/dialogs/confirm-dialog.mjs +1 -1
  36. package/dist/dialogs/confirm-dialog.mjs.map +1 -1
  37. package/dist/email-field-DZNR_JbT.mjs +2 -0
  38. package/dist/email-field-DZNR_JbT.mjs.map +1 -0
  39. package/dist/email-field-lDd9ouFN.cjs +2 -0
  40. package/dist/email-field-lDd9ouFN.cjs.map +1 -0
  41. package/dist/features/tables/index.d.cts +1 -1
  42. package/dist/features/tables/index.d.mts +1 -1
  43. package/dist/features/tanstack-form/index.cjs +1 -1
  44. package/dist/features/tanstack-form/index.d.cts +1 -1
  45. package/dist/features/tanstack-form/index.d.mts +1 -1
  46. package/dist/features/tanstack-form/index.mjs +1 -1
  47. package/dist/field-BKyUqvzh.mjs +2 -0
  48. package/dist/field-BKyUqvzh.mjs.map +1 -0
  49. package/dist/field-BV5twmKA.cjs +2 -0
  50. package/dist/field-BV5twmKA.cjs.map +1 -0
  51. package/dist/group-field-0kStiX8n.cjs +2 -0
  52. package/dist/group-field-0kStiX8n.cjs.map +1 -0
  53. package/dist/group-field-bviEXmo4.mjs +2 -0
  54. package/dist/group-field-bviEXmo4.mjs.map +1 -0
  55. package/dist/{index-CGpGIM1H.d.cts → index-C4isgHWG.d.cts} +2 -2
  56. package/dist/{index-DueBB0rP.d.mts → index-C8W56XKm.d.mts} +2 -2
  57. package/dist/{index-C2KjuFXQ.d.cts → index-DDROD2y9.d.cts} +596 -1117
  58. package/dist/{index-C2KjuFXQ.d.mts → index-DDROD2y9.d.mts} +596 -1117
  59. package/dist/index.cjs +1 -1
  60. package/dist/index.d.cts +3 -3
  61. package/dist/index.d.mts +3 -3
  62. package/dist/index.mjs +1 -1
  63. package/dist/{input-BJMvABEL.d.cts → input-go3H4EQz.d.cts} +2 -2
  64. package/dist/{input-BJMvABEL.d.mts → input-go3H4EQz.d.mts} +2 -2
  65. package/dist/number-field-Baj9Yhiv.mjs +2 -0
  66. package/dist/number-field-Baj9Yhiv.mjs.map +1 -0
  67. package/dist/number-field-BqeSbMvE.cjs +2 -0
  68. package/dist/number-field-BqeSbMvE.cjs.map +1 -0
  69. package/dist/number-input-CqkegUWs.mjs +2 -0
  70. package/dist/number-input-CqkegUWs.mjs.map +1 -0
  71. package/dist/number-input-kTh9zzr7.cjs +2 -0
  72. package/dist/number-input-kTh9zzr7.cjs.map +1 -0
  73. package/dist/password-field-Cq0S949S.cjs +2 -0
  74. package/dist/password-field-Cq0S949S.cjs.map +1 -0
  75. package/dist/password-field-fzpU42sV.mjs +2 -0
  76. package/dist/password-field-fzpU42sV.mjs.map +1 -0
  77. package/dist/popover-form-DNbBGWVF.mjs +2 -0
  78. package/dist/popover-form-DNbBGWVF.mjs.map +1 -0
  79. package/dist/popover-form-KLmew1Vd.cjs +2 -0
  80. package/dist/popover-form-KLmew1Vd.cjs.map +1 -0
  81. package/dist/radio-group-field-DjzD3i-f.cjs +2 -0
  82. package/dist/radio-group-field-DjzD3i-f.cjs.map +1 -0
  83. package/dist/radio-group-field-Ps8yHpnH.mjs +2 -0
  84. package/dist/radio-group-field-Ps8yHpnH.mjs.map +1 -0
  85. package/dist/section-form-B9iTs2we.cjs +2 -0
  86. package/dist/section-form-B9iTs2we.cjs.map +1 -0
  87. package/dist/section-form-B_AZr7jZ.mjs +2 -0
  88. package/dist/section-form-B_AZr7jZ.mjs.map +1 -0
  89. package/dist/select-field-B4eU65OI.cjs +2 -0
  90. package/dist/select-field-B4eU65OI.cjs.map +1 -0
  91. package/dist/select-field-D6Dw-Jwg.mjs +2 -0
  92. package/dist/select-field-D6Dw-Jwg.mjs.map +1 -0
  93. package/dist/separator-BlNAFSJv.mjs +2 -0
  94. package/dist/separator-BlNAFSJv.mjs.map +1 -0
  95. package/dist/separator-sBz__BXC.cjs +2 -0
  96. package/dist/separator-sBz__BXC.cjs.map +1 -0
  97. package/dist/simple-array-field-9oZ-Smzp.mjs +2 -0
  98. package/dist/simple-array-field-9oZ-Smzp.mjs.map +1 -0
  99. package/dist/simple-array-field-Bcs2pHdp.cjs +2 -0
  100. package/dist/simple-array-field-Bcs2pHdp.cjs.map +1 -0
  101. package/dist/simple-boolean-field-C-qq6Vlt.cjs +2 -0
  102. package/dist/simple-boolean-field-C-qq6Vlt.cjs.map +1 -0
  103. package/dist/simple-boolean-field-CkJUMxNU.mjs +2 -0
  104. package/dist/simple-boolean-field-CkJUMxNU.mjs.map +1 -0
  105. package/dist/simple-combobox-field-5dfMd49B.mjs +2 -0
  106. package/dist/simple-combobox-field-5dfMd49B.mjs.map +1 -0
  107. package/dist/simple-combobox-field-BtmQGEo5.cjs +2 -0
  108. package/dist/simple-combobox-field-BtmQGEo5.cjs.map +1 -0
  109. package/dist/simple-date-field-BXoLb496.mjs +2 -0
  110. package/dist/simple-date-field-BXoLb496.mjs.map +1 -0
  111. package/dist/simple-date-field-LVfNhVJi.cjs +2 -0
  112. package/dist/simple-date-field-LVfNhVJi.cjs.map +1 -0
  113. package/dist/simple-email-field-QVUrm8f7.cjs +2 -0
  114. package/dist/simple-email-field-QVUrm8f7.cjs.map +1 -0
  115. package/dist/simple-email-field-rZZIXu7S.mjs +2 -0
  116. package/dist/simple-email-field-rZZIXu7S.mjs.map +1 -0
  117. package/dist/simple-number-field-P9PTwcs4.cjs +2 -0
  118. package/dist/simple-number-field-P9PTwcs4.cjs.map +1 -0
  119. package/dist/simple-number-field-PJAyAOMO.mjs +2 -0
  120. package/dist/simple-number-field-PJAyAOMO.mjs.map +1 -0
  121. package/dist/simple-password-field-BEuFXAsk.mjs +2 -0
  122. package/dist/simple-password-field-BEuFXAsk.mjs.map +1 -0
  123. package/dist/simple-password-field-BW6YkfSP.cjs +2 -0
  124. package/dist/simple-password-field-BW6YkfSP.cjs.map +1 -0
  125. package/dist/simple-radio-group-field-BtQHJpOz.cjs +2 -0
  126. package/dist/simple-radio-group-field-BtQHJpOz.cjs.map +1 -0
  127. package/dist/simple-radio-group-field-DiYQfgts.mjs +2 -0
  128. package/dist/simple-radio-group-field-DiYQfgts.mjs.map +1 -0
  129. package/dist/simple-select-field--zJMLBUY.cjs +2 -0
  130. package/dist/simple-select-field--zJMLBUY.cjs.map +1 -0
  131. package/dist/simple-select-field-Df4DLsbi.mjs +2 -0
  132. package/dist/simple-select-field-Df4DLsbi.mjs.map +1 -0
  133. package/dist/simple-text-field-DVkuHrhF.cjs +2 -0
  134. package/dist/simple-text-field-DVkuHrhF.cjs.map +1 -0
  135. package/dist/simple-text-field-zAfkmlhc.mjs +2 -0
  136. package/dist/simple-text-field-zAfkmlhc.mjs.map +1 -0
  137. package/dist/simple-textarea-field-BaMK0feA.cjs +2 -0
  138. package/dist/simple-textarea-field-BaMK0feA.cjs.map +1 -0
  139. package/dist/simple-textarea-field-q9DeFByl.mjs +2 -0
  140. package/dist/simple-textarea-field-q9DeFByl.mjs.map +1 -0
  141. package/dist/submit-button-CGBaPzE9.mjs +2 -0
  142. package/dist/submit-button-CGBaPzE9.mjs.map +1 -0
  143. package/dist/submit-button-CvINfld5.cjs +2 -0
  144. package/dist/submit-button-CvINfld5.cjs.map +1 -0
  145. package/dist/switch-field-B8HVvc2f.mjs +2 -0
  146. package/dist/switch-field-B8HVvc2f.mjs.map +1 -0
  147. package/dist/switch-field-C1uNuuku.cjs +2 -0
  148. package/dist/switch-field-C1uNuuku.cjs.map +1 -0
  149. package/dist/tanstack-form-CM_Hb3JT.mjs +2 -0
  150. package/dist/tanstack-form-CM_Hb3JT.mjs.map +1 -0
  151. package/dist/tanstack-form-DS_ZvRl8.cjs +2 -0
  152. package/dist/tanstack-form-DS_ZvRl8.cjs.map +1 -0
  153. package/dist/text-editor-field-BBDgCPuc.cjs +2 -0
  154. package/dist/text-editor-field-BBDgCPuc.cjs.map +1 -0
  155. package/dist/text-editor-field-CcsR48Jw.mjs +2 -0
  156. package/dist/text-editor-field-CcsR48Jw.mjs.map +1 -0
  157. package/dist/text-field-BhC_ik5w.cjs +2 -0
  158. package/dist/text-field-BhC_ik5w.cjs.map +1 -0
  159. package/dist/text-field-qhiYvQKt.mjs +2 -0
  160. package/dist/text-field-qhiYvQKt.mjs.map +1 -0
  161. package/dist/textarea-field-C-7ZoUMz.cjs +2 -0
  162. package/dist/textarea-field-C-7ZoUMz.cjs.map +1 -0
  163. package/dist/textarea-field-DqDciVSB.mjs +2 -0
  164. package/dist/textarea-field-DqDciVSB.mjs.map +1 -0
  165. package/dist/title-field-84EnHPvl.mjs +2 -0
  166. package/dist/title-field-84EnHPvl.mjs.map +1 -0
  167. package/dist/title-field-CKxwzMOM.cjs +2 -0
  168. package/dist/title-field-CKxwzMOM.cjs.map +1 -0
  169. package/dist/ui/badge.cjs +1 -1
  170. package/dist/ui/badge.cjs.map +1 -1
  171. package/dist/ui/badge.mjs +1 -1
  172. package/dist/ui/badge.mjs.map +1 -1
  173. package/dist/ui/input.d.cts +1 -1
  174. package/dist/ui/input.d.mts +1 -1
  175. package/dist/ui/inputs/search-input.d.cts +1 -1
  176. package/dist/ui/inputs/search-input.d.mts +1 -1
  177. package/package.json +1 -5
  178. package/dist/tanstack-form-BMVn8ai_.cjs +0 -2
  179. package/dist/tanstack-form-BMVn8ai_.cjs.map +0 -1
  180. package/dist/tanstack-form-DTCgWGCA.mjs +0 -2
  181. package/dist/tanstack-form-DTCgWGCA.mjs.map +0 -1
@@ -0,0 +1,2 @@
1
+ import{Button as e}from"./ui/button.mjs";import{Label as t}from"./ui/label.mjs";import{Select as n,SelectContent as r,SelectItem as i,SelectTrigger as a,SelectValue as o}from"./ui/select.mjs";import{G as s}from"./tanstack-form-CM_Hb3JT.mjs";import{Drawer as c,DrawerClose as l,DrawerContent as u,DrawerHeader as d,DrawerTitle as f}from"./ui/drawer.mjs";import{FieldError as p}from"./field-BKyUqvzh.mjs";import{PackagePlusIcon as m}from"lucide-react";import{useId as h,useState as g}from"react";import{cn as _}from"@customafk/react-toolkit/utils";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{useIsMobile as b}from"@customafk/react-toolkit/hooks/useMobile";const x=({label:x,placeholder:S,required:C,options:w})=>{let T=h(),{state:E,handleBlur:D,handleChange:O}=s(),k=b(),[A,j]=g(!1),M=E.meta.isTouched&&!E.meta.isValid,N=w.find(e=>e.value===E.value)?.label;return k?y(`div`,{className:`flex flex-col gap-1.5`,children:[x&&y(t,{htmlFor:T,children:[x,C&&v(`span`,{className:`text-danger-strong`,children:`*`})]}),v(e,{id:T,type:`button`,variant:`outline`,color:`muted`,className:_(`w-full justify-start font-normal outline-1 outline-border -outline-offset-1`,!E.value&&`text-text-positive-muted`,M&&`outline-danger bg-danger-bg-subtle`),"aria-invalid":M,onBlur:D,onClick:()=>j(!0),children:N??v(`span`,{className:`text-text-positive-muted`,children:S})}),v(c,{open:A,onOpenChange:j,direction:`bottom`,children:y(u,{children:[v(d,{children:v(f,{children:x??S??`Select an option`})}),v(`div`,{className:`flex flex-col overflow-y-auto pb-safe-bottom`,children:w.length>0?w.map(e=>v(l,{asChild:!0,children:v(`button`,{type:`button`,className:_(`flex w-full items-center px-4 py-3 text-left text-sm transition-colors`,`hover:bg-muted-muted active:bg-muted-muted`,E.value===e.value&&`bg-primary-bg-subtle font-medium text-primary`),onClick:()=>{O(e.value),j(!1)},children:e.label})},e.value)):y(`div`,{className:`flex items-center justify-center gap-x-2 px-4 py-8 text-center text-sm text-text-positive-weak`,children:[v(m,{strokeWidth:1}),`No options available`]})})]})}),M&&v(p,{errors:E.meta.errors})]}):y(`div`,{className:`flex flex-col gap-1.5`,children:[x&&y(t,{htmlFor:T,children:[x,C&&v(`span`,{className:`text-danger-strong`,children:`*`})]}),y(n,{value:E.value??``,onValueChange:O,children:[v(a,{id:T,"aria-invalid":M?`true`:void 0,onBlur:D,children:v(o,{placeholder:S})}),v(r,{children:w.length>0?w.map(e=>v(i,{value:e.value,children:e.label},e.value)):y(`div`,{className:`flex items-center justify-center gap-x-2 rounded border border-border bg-muted-muted px-4 py-6.5 text-center text-sm text-text-positive-weak`,children:[v(m,{strokeWidth:1}),`No options available`]})})]}),M&&v(p,{errors:E.meta.errors})]})};export{x as SimpleSelectField};
2
+ //# sourceMappingURL=simple-select-field-Df4DLsbi.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-select-field-Df4DLsbi.mjs","names":[],"sources":["../packages/components/features/tanstack-form/components/atoms/simple-select-field.tsx"],"sourcesContent":["'use client';\n\nimport { useId, useState } from 'react';\n\nimport { PackagePlusIcon } from 'lucide-react';\n\nimport { useIsMobile } from '@customafk/react-toolkit/hooks/useMobile';\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Button } from '@/components/ui/button';\nimport { Drawer, DrawerClose, DrawerContent, DrawerHeader, DrawerTitle } from '@/components/ui/drawer';\nimport { Label } from '@/components/ui/label';\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';\n\nimport { useTanStackFieldContext } from '../form-context';\nimport { FieldError } from '../ui/field';\n\ntype Props = {\n label?: string;\n placeholder?: string;\n required?: boolean;\n options: Array<{ value: string; label: string }>;\n};\n\nexport const SimpleSelectField: React.FC<Props> = ({ label, placeholder, required, options }) => {\n const id = useId();\n const { state, handleBlur, handleChange } = useTanStackFieldContext<string | null>();\n const isMobile = useIsMobile();\n const [drawerOpen, setDrawerOpen] = useState(false);\n\n const _invalid = state.meta.isTouched && !state.meta.isValid;\n const selectedLabel = options.find(o => o.value === state.value)?.label;\n\n if (isMobile) {\n return (\n <div className=\"flex flex-col gap-1.5\">\n {label && (\n <Label htmlFor={id}>\n {label}\n {required && <span className=\"text-danger-strong\">*</span>}\n </Label>\n )}\n <Button\n id={id}\n type=\"button\"\n variant=\"outline\"\n color=\"muted\"\n className={cn(\n 'w-full justify-start font-normal outline-1 outline-border -outline-offset-1',\n !state.value && 'text-text-positive-muted',\n _invalid && 'outline-danger bg-danger-bg-subtle'\n )}\n aria-invalid={_invalid}\n onBlur={handleBlur}\n onClick={() => setDrawerOpen(true)}\n >\n {selectedLabel ?? <span className=\"text-text-positive-muted\">{placeholder}</span>}\n </Button>\n\n <Drawer open={drawerOpen} onOpenChange={setDrawerOpen} direction=\"bottom\">\n <DrawerContent>\n <DrawerHeader>\n <DrawerTitle>{label ?? placeholder ?? 'Select an option'}</DrawerTitle>\n </DrawerHeader>\n <div className=\"flex flex-col overflow-y-auto pb-safe-bottom\">\n {options.length > 0 ? (\n options.map(option => (\n <DrawerClose key={option.value} asChild>\n <button\n type=\"button\"\n className={cn(\n 'flex w-full items-center px-4 py-3 text-left text-sm transition-colors',\n 'hover:bg-muted-muted active:bg-muted-muted',\n state.value === option.value && 'bg-primary-bg-subtle font-medium text-primary'\n )}\n onClick={() => {\n handleChange(option.value);\n setDrawerOpen(false);\n }}\n >\n {option.label}\n </button>\n </DrawerClose>\n ))\n ) : (\n <div className=\"flex items-center justify-center gap-x-2 px-4 py-8 text-center text-sm text-text-positive-weak\">\n <PackagePlusIcon strokeWidth={1} />\n No options available\n </div>\n )}\n </div>\n </DrawerContent>\n </Drawer>\n\n {_invalid && <FieldError errors={state.meta.errors} />}\n </div>\n );\n }\n\n return (\n <div className=\"flex flex-col gap-1.5\">\n {label && (\n <Label htmlFor={id}>\n {label}\n {required && <span className=\"text-danger-strong\">*</span>}\n </Label>\n )}\n <Select value={state.value ?? ''} onValueChange={handleChange}>\n <SelectTrigger id={id} aria-invalid={_invalid ? 'true' : undefined} onBlur={handleBlur}>\n <SelectValue placeholder={placeholder} />\n </SelectTrigger>\n <SelectContent>\n {options.length > 0 ? (\n options.map(option => (\n <SelectItem key={option.value} value={option.value}>\n {option.label}\n </SelectItem>\n ))\n ) : (\n <div className=\"flex items-center justify-center gap-x-2 rounded border border-border bg-muted-muted px-4 py-6.5 text-center text-sm text-text-positive-weak\">\n <PackagePlusIcon strokeWidth={1} />\n No options available\n </div>\n )}\n </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EAED,EAAC,MAAD,CAAK,UAAU,0GAAf,CACE,EAAC,EAAD,CAAiB,YAAa,CAAI,CAAA,EAAC,sBAEhC,GAEJ,CAAA,CACQ,CAAA,CAAA,CACT,CAAA,EAEP,GAAY,EAAC,EAAD,CAAY,OAAQ,EAAM,KAAK,MAAS,CAAA,CAClD,IAKP,EAAC,MAAD,CAAK,UAAU,iCAAf,CACG,GACC,EAAC,EAAD,CAAO,QAAS,WAAhB,CACG,EACA,GAAY,EAAC,OAAD,CAAM,UAAU,8BAAqB,GAAO,CAAA,CACpD,IAET,EAAC,EAAD,CAAQ,MAAO,EAAM,OAAS,GAAI,cAAe,WAAjD,CACE,EAAC,EAAD,CAAmB,KAAI,eAAc,EAAW,OAAS,IAAA,GAAW,OAAQ,WAC1E,EAAC,EAAD,CAA0B,aAAc,CAAA,CAC3B,CAAA,EACf,EAAC,EAAD,CAAA,SACG,EAAQ,OAAS,EAChB,EAAQ,IAAI,GACV,EAAC,EAAD,CAA+B,MAAO,EAAO,eAC1C,EAAO,KACE,EAFK,EAAO,KAEZ,CACb,EAED,EAAC,MAAD,CAAK,UAAU,wJAAf,CACE,EAAC,EAAD,CAAiB,YAAa,CAAI,CAAA,EAAC,sBAEhC,GAEM,CAAA,CACT,IACP,GAAY,EAAC,EAAD,CAAY,OAAQ,EAAM,KAAK,MAAS,CAAA,CAClD,GAET"}
@@ -0,0 +1,2 @@
1
+ const e=require("./ui/input.cjs"),t=require("./ui/label.cjs"),n=require("./tanstack-form-DS_ZvRl8.cjs"),r=require("./field-BV5twmKA.cjs");let i=require("react"),a=require("react/jsx-runtime"),o=require("@tanstack/react-form");const s=({label:s,placeholder:c,required:l,maxLength:u,disabled:d})=>{let f=(0,i.useId)(),{form:p,name:m,state:h,handleBlur:g,handleChange:_}=n.G(),v=(0,o.useStore)(p.store,({isSubmitting:e})=>e),y=h.meta.isTouched&&!h.meta.isValid,b=(0,i.useCallback)(({target:{value:e}})=>{v||u&&e.length>u||_(e||null)},[v,u,_]);return(0,a.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s&&(0,a.jsxs)(t.Label,{htmlFor:f,children:[s,l&&(0,a.jsx)(`span`,{className:`text-danger-strong`,children:`*`})]}),(0,a.jsx)(e.Input,{id:f,name:m,value:h.value??``,"aria-invalid":y,placeholder:c,autoComplete:`off`,disabled:d||v,onBlur:g,onChange:b}),y&&(0,a.jsx)(r.FieldError,{errors:h.meta.errors})]})};exports.SimpleTextField=s;
2
+ //# sourceMappingURL=simple-text-field-DVkuHrhF.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-text-field-DVkuHrhF.cjs","names":["useTanStackFieldContext","Label","Input","FieldError"],"sources":["../packages/components/features/tanstack-form/components/atoms/simple-text-field.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback, useId } from 'react';\n\nimport { useStore } from '@tanstack/react-form';\n\nimport { Input } from '@/components/ui/input';\nimport { Label } from '@/components/ui/label';\n\nimport { useTanStackFieldContext } from '../form-context';\nimport { FieldError } from '../ui/field';\n\nimport type { SimpleTextFieldProps as Props } from '../../types';\n\nexport const SimpleTextField: React.FC<Props> = ({ label, placeholder, required, maxLength, disabled }) => {\n const id = useId();\n const { form, name, state, handleBlur, handleChange } = useTanStackFieldContext<string | null>();\n\n const isSubmitting = useStore(form.store, ({ isSubmitting }) => isSubmitting);\n\n const _invalid = state.meta.isTouched && !state.meta.isValid;\n\n const onChange = useCallback<React.ChangeEventHandler<HTMLInputElement>>(\n ({ target: { value } }) => {\n if (isSubmitting) return;\n if (maxLength && value.length > maxLength) return;\n handleChange(value || null);\n },\n [isSubmitting, maxLength, handleChange]\n );\n\n return (\n <div className=\"flex flex-col gap-1.5\">\n {label && (\n <Label htmlFor={id}>\n {label}\n {required && <span className=\"text-danger-strong\">*</span>}\n </Label>\n )}\n <Input\n id={id}\n name={name}\n value={state.value ?? ''}\n aria-invalid={_invalid}\n placeholder={placeholder}\n autoComplete=\"off\"\n disabled={disabled || isSubmitting}\n onBlur={handleBlur}\n onChange={onChange}\n />\n {_invalid && <FieldError errors={state.meta.errors} />}\n </div>\n );\n};\n"],"mappings":"kOAcA,MAAa,GAAoC,CAAE,QAAO,cAAa,WAAU,YAAW,cAAe,CACzG,IAAM,GAAA,EAAA,EAAA,MAAA,CAAW,EACX,CAAE,OAAM,OAAM,QAAO,aAAY,gBAAiBA,EAAAA,EAAuC,EAEzF,GAAA,EAAA,EAAA,SAAA,CAAwB,EAAK,OAAQ,CAAE,kBAAmB,CAAY,EAEtE,EAAW,EAAM,KAAK,WAAa,CAAC,EAAM,KAAK,QAE/C,GAAA,EAAA,EAAA,YAAA,EACH,CAAE,OAAQ,CAAE,YAAc,CACrB,GACA,GAAa,EAAM,OAAS,GAChC,EAAa,GAAS,IAAI,CAC5B,EACA,CAAC,EAAc,EAAW,CAAY,CACxC,EAEA,OACE,EAAA,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,iCAAf,CACG,IACC,EAAA,EAAA,KAAA,CAACC,EAAAA,MAAD,CAAO,QAAS,WAAhB,CACG,EACA,IAAY,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,8BAAqB,GAAO,CAAA,CACpD,KAET,EAAA,EAAA,IAAA,CAACC,EAAAA,MAAD,CACM,KACE,OACN,MAAO,EAAM,OAAS,GACtB,eAAc,EACD,cACb,aAAa,MACb,SAAU,GAAY,EACtB,OAAQ,EACE,UACX,CAAA,EACA,IAAY,EAAA,EAAA,IAAA,CAACC,EAAAA,WAAD,CAAY,OAAQ,EAAM,KAAK,MAAS,CAAA,CAClD,GAET"}
@@ -0,0 +1,2 @@
1
+ import{Input as e}from"./ui/input.mjs";import{Label as t}from"./ui/label.mjs";import{G as n}from"./tanstack-form-CM_Hb3JT.mjs";import{FieldError as r}from"./field-BKyUqvzh.mjs";import{useCallback as i,useId as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{useStore as c}from"@tanstack/react-form";const l=({label:l,placeholder:u,required:d,maxLength:f,disabled:p})=>{let m=a(),{form:h,name:g,state:_,handleBlur:v,handleChange:y}=n(),b=c(h.store,({isSubmitting:e})=>e),x=_.meta.isTouched&&!_.meta.isValid,S=i(({target:{value:e}})=>{b||f&&e.length>f||y(e||null)},[b,f,y]);return s(`div`,{className:`flex flex-col gap-1.5`,children:[l&&s(t,{htmlFor:m,children:[l,d&&o(`span`,{className:`text-danger-strong`,children:`*`})]}),o(e,{id:m,name:g,value:_.value??``,"aria-invalid":x,placeholder:u,autoComplete:`off`,disabled:p||b,onBlur:v,onChange:S}),x&&o(r,{errors:_.meta.errors})]})};export{l as SimpleTextField};
2
+ //# sourceMappingURL=simple-text-field-zAfkmlhc.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-text-field-zAfkmlhc.mjs","names":[],"sources":["../packages/components/features/tanstack-form/components/atoms/simple-text-field.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback, useId } from 'react';\n\nimport { useStore } from '@tanstack/react-form';\n\nimport { Input } from '@/components/ui/input';\nimport { Label } from '@/components/ui/label';\n\nimport { useTanStackFieldContext } from '../form-context';\nimport { FieldError } from '../ui/field';\n\nimport type { SimpleTextFieldProps as Props } from '../../types';\n\nexport const SimpleTextField: React.FC<Props> = ({ label, placeholder, required, maxLength, disabled }) => {\n const id = useId();\n const { form, name, state, handleBlur, handleChange } = useTanStackFieldContext<string | null>();\n\n const isSubmitting = useStore(form.store, ({ isSubmitting }) => isSubmitting);\n\n const _invalid = state.meta.isTouched && !state.meta.isValid;\n\n const onChange = useCallback<React.ChangeEventHandler<HTMLInputElement>>(\n ({ target: { value } }) => {\n if (isSubmitting) return;\n if (maxLength && value.length > maxLength) return;\n handleChange(value || null);\n },\n [isSubmitting, maxLength, handleChange]\n );\n\n return (\n <div className=\"flex flex-col gap-1.5\">\n {label && (\n <Label htmlFor={id}>\n {label}\n {required && <span className=\"text-danger-strong\">*</span>}\n </Label>\n )}\n <Input\n id={id}\n name={name}\n value={state.value ?? ''}\n aria-invalid={_invalid}\n placeholder={placeholder}\n autoComplete=\"off\"\n disabled={disabled || isSubmitting}\n onBlur={handleBlur}\n onChange={onChange}\n />\n {_invalid && <FieldError errors={state.meta.errors} />}\n </div>\n );\n};\n"],"mappings":"kUAcA,MAAa,GAAoC,CAAE,QAAO,cAAa,WAAU,YAAW,cAAe,CACzG,IAAM,EAAK,EAAM,EACX,CAAE,OAAM,OAAM,QAAO,aAAY,gBAAiB,EAAuC,EAEzF,EAAe,EAAS,EAAK,OAAQ,CAAE,kBAAmB,CAAY,EAEtE,EAAW,EAAM,KAAK,WAAa,CAAC,EAAM,KAAK,QAE/C,EAAW,GACd,CAAE,OAAQ,CAAE,YAAc,CACrB,GACA,GAAa,EAAM,OAAS,GAChC,EAAa,GAAS,IAAI,CAC5B,EACA,CAAC,EAAc,EAAW,CAAY,CACxC,EAEA,OACE,EAAC,MAAD,CAAK,UAAU,iCAAf,CACG,GACC,EAAC,EAAD,CAAO,QAAS,WAAhB,CACG,EACA,GAAY,EAAC,OAAD,CAAM,UAAU,8BAAqB,GAAO,CAAA,CACpD,IAET,EAAC,EAAD,CACM,KACE,OACN,MAAO,EAAM,OAAS,GACtB,eAAc,EACD,cACb,aAAa,MACb,SAAU,GAAY,EACtB,OAAQ,EACE,UACX,CAAA,EACA,GAAY,EAAC,EAAD,CAAY,OAAQ,EAAM,KAAK,MAAS,CAAA,CAClD,GAET"}
@@ -0,0 +1,2 @@
1
+ const e=require("./ui/label.cjs"),t=require("./tanstack-form-DS_ZvRl8.cjs"),n=require("./ui/textarea.cjs"),r=require("./field-BV5twmKA.cjs");let i=require("react"),a=require("react/jsx-runtime"),o=require("@tanstack/react-form");const s=({label:s,placeholder:c,required:l,maxLength:u,rows:d,disabled:f})=>{let p=(0,i.useId)(),{form:m,name:h,state:g,handleBlur:_,handleChange:v}=t.G(),y=(0,o.useStore)(m.store,({isSubmitting:e})=>e),b=g.meta.isTouched&&!g.meta.isValid,x=(0,i.useCallback)(({target:{value:e}})=>{y||u&&e.length>u||v(e||null)},[y,u,v]);return(0,a.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s&&(0,a.jsxs)(e.Label,{htmlFor:p,children:[s,l&&(0,a.jsx)(`span`,{className:`text-danger-strong`,children:`*`})]}),(0,a.jsx)(n.Textarea,{id:p,name:h,value:g.value??``,"aria-invalid":b,placeholder:c,rows:d,disabled:f||y,onBlur:_,onChange:x}),b&&(0,a.jsx)(r.FieldError,{errors:g.meta.errors})]})};exports.SimpleTextareaField=s;
2
+ //# sourceMappingURL=simple-textarea-field-BaMK0feA.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-textarea-field-BaMK0feA.cjs","names":["useTanStackFieldContext","Label","Textarea","FieldError"],"sources":["../packages/components/features/tanstack-form/components/atoms/simple-textarea-field.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback, useId } from 'react';\n\nimport { useStore } from '@tanstack/react-form';\n\nimport { Textarea } from '@/components/ui/textarea';\nimport { Label } from '@/components/ui/label';\n\nimport { useTanStackFieldContext } from '../form-context';\nimport { FieldError } from '../ui/field';\n\ntype Props = {\n label?: string;\n placeholder?: string;\n required?: boolean;\n maxLength?: number;\n rows?: number;\n disabled?: boolean;\n};\n\nexport const SimpleTextareaField: React.FC<Props> = ({ label, placeholder, required, maxLength, rows, disabled }) => {\n const id = useId();\n const { form, name, state, handleBlur, handleChange } = useTanStackFieldContext<string | null>();\n\n const isSubmitting = useStore(form.store, ({ isSubmitting }) => isSubmitting);\n\n const _invalid = state.meta.isTouched && !state.meta.isValid;\n\n const onChange = useCallback<React.ChangeEventHandler<HTMLTextAreaElement>>(\n ({ target: { value } }) => {\n if (isSubmitting) return;\n if (maxLength && value.length > maxLength) return;\n handleChange(value || null);\n },\n [isSubmitting, maxLength, handleChange]\n );\n\n return (\n <div className=\"flex flex-col gap-1.5\">\n {label && (\n <Label htmlFor={id}>\n {label}\n {required && <span className=\"text-danger-strong\">*</span>}\n </Label>\n )}\n <Textarea\n id={id}\n name={name}\n value={state.value ?? ''}\n aria-invalid={_invalid}\n placeholder={placeholder}\n rows={rows}\n disabled={disabled || isSubmitting}\n onBlur={handleBlur}\n onChange={onChange}\n />\n {_invalid && <FieldError errors={state.meta.errors} />}\n </div>\n );\n};\n"],"mappings":"qOAqBA,MAAa,GAAwC,CAAE,QAAO,cAAa,WAAU,YAAW,OAAM,cAAe,CACnH,IAAM,GAAA,EAAA,EAAA,MAAA,CAAW,EACX,CAAE,OAAM,OAAM,QAAO,aAAY,gBAAiBA,EAAAA,EAAuC,EAEzF,GAAA,EAAA,EAAA,SAAA,CAAwB,EAAK,OAAQ,CAAE,kBAAmB,CAAY,EAEtE,EAAW,EAAM,KAAK,WAAa,CAAC,EAAM,KAAK,QAE/C,GAAA,EAAA,EAAA,YAAA,EACH,CAAE,OAAQ,CAAE,YAAc,CACrB,GACA,GAAa,EAAM,OAAS,GAChC,EAAa,GAAS,IAAI,CAC5B,EACA,CAAC,EAAc,EAAW,CAAY,CACxC,EAEA,OACE,EAAA,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,iCAAf,CACG,IACC,EAAA,EAAA,KAAA,CAACC,EAAAA,MAAD,CAAO,QAAS,WAAhB,CACG,EACA,IAAY,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,8BAAqB,GAAO,CAAA,CACpD,KAET,EAAA,EAAA,IAAA,CAACC,EAAAA,SAAD,CACM,KACE,OACN,MAAO,EAAM,OAAS,GACtB,eAAc,EACD,cACP,OACN,SAAU,GAAY,EACtB,OAAQ,EACE,UACX,CAAA,EACA,IAAY,EAAA,EAAA,IAAA,CAACC,EAAAA,WAAD,CAAY,OAAQ,EAAM,KAAK,MAAS,CAAA,CAClD,GAET"}
@@ -0,0 +1,2 @@
1
+ import{Label as e}from"./ui/label.mjs";import{G as t}from"./tanstack-form-CM_Hb3JT.mjs";import{Textarea as n}from"./ui/textarea.mjs";import{FieldError as r}from"./field-BKyUqvzh.mjs";import{useCallback as i,useId as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{useStore as c}from"@tanstack/react-form";const l=({label:l,placeholder:u,required:d,maxLength:f,rows:p,disabled:m})=>{let h=a(),{form:g,name:_,state:v,handleBlur:y,handleChange:b}=t(),x=c(g.store,({isSubmitting:e})=>e),S=v.meta.isTouched&&!v.meta.isValid,C=i(({target:{value:e}})=>{x||f&&e.length>f||b(e||null)},[x,f,b]);return s(`div`,{className:`flex flex-col gap-1.5`,children:[l&&s(e,{htmlFor:h,children:[l,d&&o(`span`,{className:`text-danger-strong`,children:`*`})]}),o(n,{id:h,name:_,value:v.value??``,"aria-invalid":S,placeholder:u,rows:p,disabled:m||x,onBlur:y,onChange:C}),S&&o(r,{errors:v.meta.errors})]})};export{l as SimpleTextareaField};
2
+ //# sourceMappingURL=simple-textarea-field-q9DeFByl.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-textarea-field-q9DeFByl.mjs","names":[],"sources":["../packages/components/features/tanstack-form/components/atoms/simple-textarea-field.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback, useId } from 'react';\n\nimport { useStore } from '@tanstack/react-form';\n\nimport { Textarea } from '@/components/ui/textarea';\nimport { Label } from '@/components/ui/label';\n\nimport { useTanStackFieldContext } from '../form-context';\nimport { FieldError } from '../ui/field';\n\ntype Props = {\n label?: string;\n placeholder?: string;\n required?: boolean;\n maxLength?: number;\n rows?: number;\n disabled?: boolean;\n};\n\nexport const SimpleTextareaField: React.FC<Props> = ({ label, placeholder, required, maxLength, rows, disabled }) => {\n const id = useId();\n const { form, name, state, handleBlur, handleChange } = useTanStackFieldContext<string | null>();\n\n const isSubmitting = useStore(form.store, ({ isSubmitting }) => isSubmitting);\n\n const _invalid = state.meta.isTouched && !state.meta.isValid;\n\n const onChange = useCallback<React.ChangeEventHandler<HTMLTextAreaElement>>(\n ({ target: { value } }) => {\n if (isSubmitting) return;\n if (maxLength && value.length > maxLength) return;\n handleChange(value || null);\n },\n [isSubmitting, maxLength, handleChange]\n );\n\n return (\n <div className=\"flex flex-col gap-1.5\">\n {label && (\n <Label htmlFor={id}>\n {label}\n {required && <span className=\"text-danger-strong\">*</span>}\n </Label>\n )}\n <Textarea\n id={id}\n name={name}\n value={state.value ?? ''}\n aria-invalid={_invalid}\n placeholder={placeholder}\n rows={rows}\n disabled={disabled || isSubmitting}\n onBlur={handleBlur}\n onChange={onChange}\n />\n {_invalid && <FieldError errors={state.meta.errors} />}\n </div>\n );\n};\n"],"mappings":"wUAqBA,MAAa,GAAwC,CAAE,QAAO,cAAa,WAAU,YAAW,OAAM,cAAe,CACnH,IAAM,EAAK,EAAM,EACX,CAAE,OAAM,OAAM,QAAO,aAAY,gBAAiB,EAAuC,EAEzF,EAAe,EAAS,EAAK,OAAQ,CAAE,kBAAmB,CAAY,EAEtE,EAAW,EAAM,KAAK,WAAa,CAAC,EAAM,KAAK,QAE/C,EAAW,GACd,CAAE,OAAQ,CAAE,YAAc,CACrB,GACA,GAAa,EAAM,OAAS,GAChC,EAAa,GAAS,IAAI,CAC5B,EACA,CAAC,EAAc,EAAW,CAAY,CACxC,EAEA,OACE,EAAC,MAAD,CAAK,UAAU,iCAAf,CACG,GACC,EAAC,EAAD,CAAO,QAAS,WAAhB,CACG,EACA,GAAY,EAAC,OAAD,CAAM,UAAU,8BAAqB,GAAO,CAAA,CACpD,IAET,EAAC,EAAD,CACM,KACE,OACN,MAAO,EAAM,OAAS,GACtB,eAAc,EACD,cACP,OACN,SAAU,GAAY,EACtB,OAAQ,EACE,UACX,CAAA,EACA,GAAY,EAAC,EAAD,CAAY,OAAQ,EAAM,KAAK,MAAS,CAAA,CAClD,GAET"}
@@ -0,0 +1,2 @@
1
+ import{Button as e}from"./ui/button.mjs";import{cn as t}from"@customafk/react-toolkit/utils";import{jsx as n}from"react/jsx-runtime";const r=({disabled:r,className:i,onClick:a,children:o})=>n(e,{type:`button`,variant:`outline`,color:`muted`,disabled:r,className:t(`min-w-40`,i),onClick:a,children:o??`Huỷ`}),i=({isSubmitting:r,submitText:i=`Xác nhận`,disabled:a,className:o,onClick:s})=>n(e,{type:`button`,isLoading:r,disabled:a||r,className:t(`min-w-40`,o),onClick:s,children:i});export{r as n,i as t};
2
+ //# sourceMappingURL=submit-button-CGBaPzE9.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"submit-button-CGBaPzE9.mjs","names":[],"sources":["../packages/components/features/tanstack-form/components/ui/cancel-button.tsx","../packages/components/features/tanstack-form/components/ui/submit-button.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Button } from '@/components/ui/button';\n\n/**\n * Secondary outline button used to dismiss or cancel a form without submitting, defaulting to the label \"Cancel\".\n *\n * @example\n * import { CancelButton } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <CancelButton onClick={() => router.back()} />\n */\nexport const CancelButton: React.FC<React.ComponentProps<'button'>> = ({ disabled, className, onClick, children }) => {\n return (\n <Button\n type=\"button\"\n variant=\"outline\"\n color=\"muted\"\n disabled={disabled}\n className={cn('min-w-40', className)}\n onClick={onClick as React.MouseEventHandler<HTMLButtonElement>}\n >\n {children ?? 'Huỷ'}\n </Button>\n );\n};\n","'use client';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Button } from '@/components/ui/button';\n\n/**\n * Props for the {@link SubmitButton} component.\n */\ntype SubmitButtonProps = React.ComponentProps<'button'> & {\n /**\n * When `true` the button enters a loading state and is automatically disabled to prevent duplicate submissions.\n */\n isSubmitting?: boolean;\n /**\n * Label text rendered inside the button.\n * @default 'Submit'\n */\n submitText?: string;\n};\n\n/**\n * Primary form submission button that shows a loading indicator while the form is being submitted.\n *\n * @example\n * import { SubmitButton } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <SubmitButton isSubmitting={form.state.isSubmitting} submitText=\"Save changes\" />\n */\nexport const SubmitButton: React.FC<SubmitButtonProps> = ({ isSubmitting, submitText = 'Xác nhận', disabled, className, onClick }) => {\n return (\n <Button\n type=\"button\"\n isLoading={isSubmitting}\n disabled={disabled || isSubmitting}\n className={cn('min-w-40', className)}\n onClick={onClick as React.MouseEventHandler<HTMLButtonElement>}\n >\n {submitText}\n </Button>\n );\n};\n"],"mappings":"qIAcA,MAAa,GAA0D,CAAE,WAAU,YAAW,UAAS,cAEnG,EAAC,EAAD,CACE,KAAK,SACL,QAAQ,UACR,MAAM,QACI,WACV,UAAW,EAAG,WAAY,CAAS,EAC1B,mBAER,GAAY,KACP,CAAA,ECIC,GAA6C,CAAE,eAAc,aAAa,WAAY,WAAU,YAAW,aAEpH,EAAC,EAAD,CACE,KAAK,SACL,UAAW,EACX,SAAU,GAAY,EACtB,UAAW,EAAG,WAAY,CAAS,EAC1B,mBAER,CACK,CAAA"}
@@ -0,0 +1,2 @@
1
+ const e=require("./ui/button.cjs");let t=require("@customafk/react-toolkit/utils"),n=require("react/jsx-runtime");const r=({disabled:r,className:i,onClick:a,children:o})=>(0,n.jsx)(e.Button,{type:`button`,variant:`outline`,color:`muted`,disabled:r,className:(0,t.cn)(`min-w-40`,i),onClick:a,children:o??`Huỷ`}),i=({isSubmitting:r,submitText:i=`Xác nhận`,disabled:a,className:o,onClick:s})=>(0,n.jsx)(e.Button,{type:`button`,isLoading:r,disabled:a||r,className:(0,t.cn)(`min-w-40`,o),onClick:s,children:i});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
2
+ //# sourceMappingURL=submit-button-CvINfld5.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"submit-button-CvINfld5.cjs","names":["Button","Button"],"sources":["../packages/components/features/tanstack-form/components/ui/cancel-button.tsx","../packages/components/features/tanstack-form/components/ui/submit-button.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Button } from '@/components/ui/button';\n\n/**\n * Secondary outline button used to dismiss or cancel a form without submitting, defaulting to the label \"Cancel\".\n *\n * @example\n * import { CancelButton } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <CancelButton onClick={() => router.back()} />\n */\nexport const CancelButton: React.FC<React.ComponentProps<'button'>> = ({ disabled, className, onClick, children }) => {\n return (\n <Button\n type=\"button\"\n variant=\"outline\"\n color=\"muted\"\n disabled={disabled}\n className={cn('min-w-40', className)}\n onClick={onClick as React.MouseEventHandler<HTMLButtonElement>}\n >\n {children ?? 'Huỷ'}\n </Button>\n );\n};\n","'use client';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Button } from '@/components/ui/button';\n\n/**\n * Props for the {@link SubmitButton} component.\n */\ntype SubmitButtonProps = React.ComponentProps<'button'> & {\n /**\n * When `true` the button enters a loading state and is automatically disabled to prevent duplicate submissions.\n */\n isSubmitting?: boolean;\n /**\n * Label text rendered inside the button.\n * @default 'Submit'\n */\n submitText?: string;\n};\n\n/**\n * Primary form submission button that shows a loading indicator while the form is being submitted.\n *\n * @example\n * import { SubmitButton } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <SubmitButton isSubmitting={form.state.isSubmitting} submitText=\"Save changes\" />\n */\nexport const SubmitButton: React.FC<SubmitButtonProps> = ({ isSubmitting, submitText = 'Xác nhận', disabled, className, onClick }) => {\n return (\n <Button\n type=\"button\"\n isLoading={isSubmitting}\n disabled={disabled || isSubmitting}\n className={cn('min-w-40', className)}\n onClick={onClick as React.MouseEventHandler<HTMLButtonElement>}\n >\n {submitText}\n </Button>\n );\n};\n"],"mappings":"kHAcA,MAAa,GAA0D,CAAE,WAAU,YAAW,UAAS,eAEnG,EAAA,EAAA,IAAA,CAACA,EAAAA,OAAD,CACE,KAAK,SACL,QAAQ,UACR,MAAM,QACI,WACV,WAAA,EAAA,EAAA,GAAA,CAAc,WAAY,CAAS,EAC1B,mBAER,GAAY,KACP,CAAA,ECIC,GAA6C,CAAE,eAAc,aAAa,WAAY,WAAU,YAAW,cAEpH,EAAA,EAAA,IAAA,CAACC,EAAAA,OAAD,CACE,KAAK,SACL,UAAW,EACX,SAAU,GAAY,EACtB,WAAA,EAAA,EAAA,GAAA,CAAc,WAAY,CAAS,EAC1B,mBAER,CACK,CAAA"}
@@ -0,0 +1,2 @@
1
+ import{G as e}from"./tanstack-form-CM_Hb3JT.mjs";import{Field as t,FieldContent as n,FieldDescription as r,FieldGroup as i,FieldNote as a,FieldSeparator as o,FieldTitle as s}from"./field-BKyUqvzh.mjs";import{cn as c}from"@customafk/react-toolkit/utils";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{Switch as d}from"radix-ui";function f({className:e,...t}){return l(d.Root,{"data-slot":`switch`,className:c(`peer`,`w-8 shrink-0 cursor-pointer items-center rounded-full shadow-xs transition-all`,`inline-flex h-5`,`focus-visible:border-primary-strong`,`focus-visible:ring-primary-weak`,`focus-visible:ring-4`,`disabled:cursor-not-allowed`,`disabled:opacity-50`,`-outline-offset-1 inset-shadow-2xs outline-1`,`data-[state=checked]:bg-primary`,`data-[state=checked]:outline-primary-strong`,`data-[state=unchecked]:bg-muted-weak`,`data-[state=unchecked]:outline-border`,`data-[state=unchecked]:[&_span]:size-4`,`data-[state=unchecked]:[&_span]:translate-x-0.5`,`data-[state=unchecked]:[&_span]:rtl:-translate-x-0.5`,e),...t,children:l(d.Thumb,{"data-slot":`switch-thumb`,className:c(`block size-4 bg-card shadow-xs`,`pointer-events-none rounded-full ring-0 transition-transform`,`data-[state=checked]:translate-x-[calc(100%-3px)]`,`data-[state=unchecked]:translate-x-0`)})})}const p=({label:c,description:d,helperText:p})=>{let m=e();return u(i,{className:`gap-y-4 px-4`,children:[u(t,{orientation:`vertical`,className:`relative justify-between gap-y-1`,children:[u(n,{children:[l(s,{className:`cursor-pointer`,children:l(`label`,{htmlFor:m.name,children:c})}),l(r,{children:d}),l(f,{id:m.name,checked:m.state.value??!1,className:`absolute top-1 right-1`,onBlur:m.handleBlur,onCheckedChange:m.handleChange})]}),l(a,{isShow:!!p,children:p})]}),l(o,{})]})};export{p as SwitchField};
2
+ //# sourceMappingURL=switch-field-B8HVvc2f.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch-field-B8HVvc2f.mjs","names":["Switch","SwitchPrimitive","Switch"],"sources":["../packages/components/features/tanstack-form/components/ui/switch.tsx","../packages/components/features/tanstack-form/components/fields/switch-field.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Switch as SwitchPrimitive } from 'radix-ui';\n\n/**\n * Accessible toggle switch built on Radix UI, styled with primary-color checked state and smooth thumb transition.\n *\n * @example\n * import { Switch } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <Switch defaultChecked onCheckedChange={(checked) => console.log(checked)} />\n */\nfunction Switch({ className, ...props }: React.ComponentProps<typeof SwitchPrimitive.Root>) {\n return (\n <SwitchPrimitive.Root\n data-slot=\"switch\"\n className={cn(\n 'peer',\n 'w-8 shrink-0 cursor-pointer items-center rounded-full shadow-xs transition-all',\n 'inline-flex h-5',\n 'focus-visible:border-primary-strong',\n 'focus-visible:ring-primary-weak',\n 'focus-visible:ring-4',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n\n '-outline-offset-1 inset-shadow-2xs outline-1',\n\n 'data-[state=checked]:bg-primary',\n 'data-[state=checked]:outline-primary-strong',\n\n 'data-[state=unchecked]:bg-muted-weak',\n 'data-[state=unchecked]:outline-border',\n\n 'data-[state=unchecked]:[&_span]:size-4',\n 'data-[state=unchecked]:[&_span]:translate-x-0.5',\n 'data-[state=unchecked]:[&_span]:rtl:-translate-x-0.5',\n className\n )}\n {...props}\n >\n <SwitchPrimitive.Thumb\n data-slot=\"switch-thumb\"\n className={cn(\n 'block size-4 bg-card shadow-xs',\n 'pointer-events-none rounded-full ring-0 transition-transform',\n 'data-[state=checked]:translate-x-[calc(100%-3px)]',\n 'data-[state=unchecked]:translate-x-0'\n )}\n />\n </SwitchPrimitive.Root>\n );\n}\n\nexport { Switch };\n","'use client';\n\nimport { useTanStackFieldContext } from '../form-context';\nimport { Field, FieldContent, FieldDescription, FieldGroup, FieldNote, FieldSeparator, FieldTitle } from '../ui/field';\nimport { Switch } from '../ui/switch';\n\nimport type { SwitchFieldProps as Props } from '../../types';\n\n/**\n * A TanStack Form-connected boolean toggle field rendered as a labelled switch,\n * positioned absolutely in the top-right corner of the field card.\n *\n * @example\n * import { SwitchField } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <form.Field name=\"notifications\">\n * {() => (\n * <SwitchField\n * label=\"Enable notifications\"\n * description=\"Receive email alerts for important events\"\n * helperText=\"You can change this at any time\"\n * />\n * )}\n * </form.Field>\n */\nexport const SwitchField: React.FC<Props> = ({ label, description, helperText }) => {\n const field = useTanStackFieldContext<boolean | null>();\n\n return (\n <FieldGroup className=\"gap-y-4 px-4\">\n <Field orientation=\"vertical\" className=\"relative justify-between gap-y-1\">\n <FieldContent>\n <FieldTitle className=\"cursor-pointer\">\n <label htmlFor={field.name}>{label}</label>\n </FieldTitle>\n <FieldDescription>{description}</FieldDescription>\n <Switch\n id={field.name}\n checked={field.state.value ?? false}\n className=\"absolute top-1 right-1\"\n onBlur={field.handleBlur}\n onCheckedChange={field.handleChange}\n />\n </FieldContent>\n <FieldNote isShow={!!helperText}>{helperText}</FieldNote>\n </Field>\n <FieldSeparator />\n </FieldGroup>\n );\n};\n"],"mappings":"iVAcA,SAASA,EAAO,CAAE,YAAW,GAAG,GAA4D,CAC1F,OACE,EAACC,EAAgB,KAAjB,CACE,YAAU,SACV,UAAW,EACT,OACA,iFACA,kBACA,sCACA,kCACA,uBACA,8BACA,sBAEA,+CAEA,kCACA,8CAEA,uCACA,wCAEA,yCACA,kDACA,uDACA,CACF,EACA,GAAI,WAEJ,EAACA,EAAgB,MAAjB,CACE,YAAU,eACV,UAAW,EACT,iCACA,+DACA,oDACA,sCACF,CACD,CAAA,CACmB,CAAA,CAE1B,CC7BA,MAAa,GAAgC,CAAE,QAAO,cAAa,gBAAiB,CAClF,IAAM,EAAQ,EAAwC,EAEtD,OACE,EAAC,EAAD,CAAY,UAAU,wBAAtB,CACE,EAAC,EAAD,CAAO,YAAY,WAAW,UAAU,4CAAxC,CACE,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAY,UAAU,0BACpB,EAAC,QAAD,CAAO,QAAS,EAAM,cAAO,CAAa,CAAA,CAChC,CAAA,EACZ,EAAC,EAAD,CAAA,SAAmB,CAA8B,CAAA,EACjD,EAACC,EAAD,CACE,GAAI,EAAM,KACV,QAAS,EAAM,MAAM,OAAS,GAC9B,UAAU,yBACV,OAAQ,EAAM,WACd,gBAAiB,EAAM,YACxB,CAAA,CACW,CAAA,CAAA,EACd,EAAC,EAAD,CAAW,OAAQ,CAAC,CAAC,WAAa,CAAsB,CAAA,CACnD,IACP,EAAC,EAAD,CAAiB,CAAA,CACP,GAEhB"}
@@ -0,0 +1,2 @@
1
+ const e=require("./tanstack-form-DS_ZvRl8.cjs"),t=require("./field-BV5twmKA.cjs");let n=require("@customafk/react-toolkit/utils"),r=require("react/jsx-runtime"),i=require("radix-ui");function a({className:e,...t}){return(0,r.jsx)(i.Switch.Root,{"data-slot":`switch`,className:(0,n.cn)(`peer`,`w-8 shrink-0 cursor-pointer items-center rounded-full shadow-xs transition-all`,`inline-flex h-5`,`focus-visible:border-primary-strong`,`focus-visible:ring-primary-weak`,`focus-visible:ring-4`,`disabled:cursor-not-allowed`,`disabled:opacity-50`,`-outline-offset-1 inset-shadow-2xs outline-1`,`data-[state=checked]:bg-primary`,`data-[state=checked]:outline-primary-strong`,`data-[state=unchecked]:bg-muted-weak`,`data-[state=unchecked]:outline-border`,`data-[state=unchecked]:[&_span]:size-4`,`data-[state=unchecked]:[&_span]:translate-x-0.5`,`data-[state=unchecked]:[&_span]:rtl:-translate-x-0.5`,e),...t,children:(0,r.jsx)(i.Switch.Thumb,{"data-slot":`switch-thumb`,className:(0,n.cn)(`block size-4 bg-card shadow-xs`,`pointer-events-none rounded-full ring-0 transition-transform`,`data-[state=checked]:translate-x-[calc(100%-3px)]`,`data-[state=unchecked]:translate-x-0`)})})}const o=({label:n,description:i,helperText:o})=>{let s=e.G();return(0,r.jsxs)(t.FieldGroup,{className:`gap-y-4 px-4`,children:[(0,r.jsxs)(t.Field,{orientation:`vertical`,className:`relative justify-between gap-y-1`,children:[(0,r.jsxs)(t.FieldContent,{children:[(0,r.jsx)(t.FieldTitle,{className:`cursor-pointer`,children:(0,r.jsx)(`label`,{htmlFor:s.name,children:n})}),(0,r.jsx)(t.FieldDescription,{children:i}),(0,r.jsx)(a,{id:s.name,checked:s.state.value??!1,className:`absolute top-1 right-1`,onBlur:s.handleBlur,onCheckedChange:s.handleChange})]}),(0,r.jsx)(t.FieldNote,{isShow:!!o,children:o})]}),(0,r.jsx)(t.FieldSeparator,{})]})};exports.SwitchField=o;
2
+ //# sourceMappingURL=switch-field-C1uNuuku.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch-field-C1uNuuku.cjs","names":["SwitchPrimitive","useTanStackFieldContext","FieldGroup","Field","FieldContent","FieldTitle","FieldDescription","FieldNote","FieldSeparator"],"sources":["../packages/components/features/tanstack-form/components/ui/switch.tsx","../packages/components/features/tanstack-form/components/fields/switch-field.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Switch as SwitchPrimitive } from 'radix-ui';\n\n/**\n * Accessible toggle switch built on Radix UI, styled with primary-color checked state and smooth thumb transition.\n *\n * @example\n * import { Switch } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <Switch defaultChecked onCheckedChange={(checked) => console.log(checked)} />\n */\nfunction Switch({ className, ...props }: React.ComponentProps<typeof SwitchPrimitive.Root>) {\n return (\n <SwitchPrimitive.Root\n data-slot=\"switch\"\n className={cn(\n 'peer',\n 'w-8 shrink-0 cursor-pointer items-center rounded-full shadow-xs transition-all',\n 'inline-flex h-5',\n 'focus-visible:border-primary-strong',\n 'focus-visible:ring-primary-weak',\n 'focus-visible:ring-4',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n\n '-outline-offset-1 inset-shadow-2xs outline-1',\n\n 'data-[state=checked]:bg-primary',\n 'data-[state=checked]:outline-primary-strong',\n\n 'data-[state=unchecked]:bg-muted-weak',\n 'data-[state=unchecked]:outline-border',\n\n 'data-[state=unchecked]:[&_span]:size-4',\n 'data-[state=unchecked]:[&_span]:translate-x-0.5',\n 'data-[state=unchecked]:[&_span]:rtl:-translate-x-0.5',\n className\n )}\n {...props}\n >\n <SwitchPrimitive.Thumb\n data-slot=\"switch-thumb\"\n className={cn(\n 'block size-4 bg-card shadow-xs',\n 'pointer-events-none rounded-full ring-0 transition-transform',\n 'data-[state=checked]:translate-x-[calc(100%-3px)]',\n 'data-[state=unchecked]:translate-x-0'\n )}\n />\n </SwitchPrimitive.Root>\n );\n}\n\nexport { Switch };\n","'use client';\n\nimport { useTanStackFieldContext } from '../form-context';\nimport { Field, FieldContent, FieldDescription, FieldGroup, FieldNote, FieldSeparator, FieldTitle } from '../ui/field';\nimport { Switch } from '../ui/switch';\n\nimport type { SwitchFieldProps as Props } from '../../types';\n\n/**\n * A TanStack Form-connected boolean toggle field rendered as a labelled switch,\n * positioned absolutely in the top-right corner of the field card.\n *\n * @example\n * import { SwitchField } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <form.Field name=\"notifications\">\n * {() => (\n * <SwitchField\n * label=\"Enable notifications\"\n * description=\"Receive email alerts for important events\"\n * helperText=\"You can change this at any time\"\n * />\n * )}\n * </form.Field>\n */\nexport const SwitchField: React.FC<Props> = ({ label, description, helperText }) => {\n const field = useTanStackFieldContext<boolean | null>();\n\n return (\n <FieldGroup className=\"gap-y-4 px-4\">\n <Field orientation=\"vertical\" className=\"relative justify-between gap-y-1\">\n <FieldContent>\n <FieldTitle className=\"cursor-pointer\">\n <label htmlFor={field.name}>{label}</label>\n </FieldTitle>\n <FieldDescription>{description}</FieldDescription>\n <Switch\n id={field.name}\n checked={field.state.value ?? false}\n className=\"absolute top-1 right-1\"\n onBlur={field.handleBlur}\n onCheckedChange={field.handleChange}\n />\n </FieldContent>\n <FieldNote isShow={!!helperText}>{helperText}</FieldNote>\n </Field>\n <FieldSeparator />\n </FieldGroup>\n );\n};\n"],"mappings":"uLAcA,SAAS,EAAO,CAAE,YAAW,GAAG,GAA4D,CAC1F,OACE,EAAA,EAAA,IAAA,CAACA,EAAAA,OAAgB,KAAjB,CACE,YAAU,SACV,WAAA,EAAA,EAAA,GAAA,CACE,OACA,iFACA,kBACA,sCACA,kCACA,uBACA,8BACA,sBAEA,+CAEA,kCACA,8CAEA,uCACA,wCAEA,yCACA,kDACA,uDACA,CACF,EACA,GAAI,YAEJ,EAAA,EAAA,IAAA,CAACA,EAAAA,OAAgB,MAAjB,CACE,YAAU,eACV,WAAA,EAAA,EAAA,GAAA,CACE,iCACA,+DACA,oDACA,sCACF,CACD,CAAA,CACmB,CAAA,CAE1B,CC7BA,MAAa,GAAgC,CAAE,QAAO,cAAa,gBAAiB,CAClF,IAAM,EAAQC,EAAAA,EAAwC,EAEtD,OACE,EAAA,EAAA,KAAA,CAACC,EAAAA,WAAD,CAAY,UAAU,wBAAtB,EACE,EAAA,EAAA,KAAA,CAACC,EAAAA,MAAD,CAAO,YAAY,WAAW,UAAU,4CAAxC,EACE,EAAA,EAAA,KAAA,CAACC,EAAAA,aAAD,CAAA,SAAA,EACE,EAAA,EAAA,IAAA,CAACC,EAAAA,WAAD,CAAY,UAAU,2BACpB,EAAA,EAAA,IAAA,CAAC,QAAD,CAAO,QAAS,EAAM,cAAO,CAAa,CAAA,CAChC,CAAA,GACZ,EAAA,EAAA,IAAA,CAACC,EAAAA,iBAAD,CAAA,SAAmB,CAA8B,CAAA,GACjD,EAAA,EAAA,IAAA,CAAC,EAAD,CACE,GAAI,EAAM,KACV,QAAS,EAAM,MAAM,OAAS,GAC9B,UAAU,yBACV,OAAQ,EAAM,WACd,gBAAiB,EAAM,YACxB,CAAA,CACW,CAAA,CAAA,GACd,EAAA,EAAA,IAAA,CAACC,EAAAA,UAAD,CAAW,OAAQ,CAAC,CAAC,WAAa,CAAsB,CAAA,CACnD,KACP,EAAA,EAAA,IAAA,CAACC,EAAAA,eAAD,CAAiB,CAAA,CACP,GAEhB"}
@@ -0,0 +1,2 @@
1
+ import{Suspense as e,lazy as t}from"react";import{jsx as n}from"react/jsx-runtime";import{createFormHook as r,createFormHookContexts as i}from"@tanstack/react-form";const{fieldContext:a,formContext:o,useFieldContext:s,useFormContext:c}=i();function l(r){let i=t(r);return t=>n(e,{fallback:null,children:n(i,{...t})})}const u=l(()=>import(`./text-field-qhiYvQKt.mjs`).then(e=>({default:e.TextField}))),d=l(()=>import(`./textarea-field-DqDciVSB.mjs`).then(e=>({default:e.TextareaField}))),f=l(()=>import(`./text-editor-field-CcsR48Jw.mjs`).then(e=>({default:e.TextEditorField}))),p=l(()=>import(`./number-field-Baj9Yhiv.mjs`).then(e=>({default:e.NumberField}))),m=l(()=>import(`./email-field-DZNR_JbT.mjs`).then(e=>({default:e.EmailField}))),h=l(()=>import(`./password-field-fzpU42sV.mjs`).then(e=>({default:e.PasswordField}))),g=l(()=>import(`./select-field-D6Dw-Jwg.mjs`).then(e=>({default:e.SelectField}))),_=l(()=>import(`./combobox-field-BGChwajc.mjs`).then(e=>({default:e.ComboboxField}))),v=l(()=>import(`./date-field-Dm4ki1HS.mjs`).then(e=>({default:e.DateField}))),y=l(()=>import(`./switch-field-B8HVvc2f.mjs`).then(e=>({default:e.SwitchField}))),b=l(()=>import(`./radio-group-field-Ps8yHpnH.mjs`).then(e=>({default:e.RadioGroupField}))),x=l(()=>import(`./checkbox-field-CRcfuDu1.mjs`).then(e=>({default:e.CheckboxField}))),S=l(()=>import(`./simple-text-field-zAfkmlhc.mjs`).then(e=>({default:e.SimpleTextField}))),C=l(()=>import(`./simple-email-field-rZZIXu7S.mjs`).then(e=>({default:e.SimpleEmailField}))),w=l(()=>import(`./simple-password-field-BEuFXAsk.mjs`).then(e=>({default:e.SimplePasswordField}))),T=l(()=>import(`./simple-textarea-field-q9DeFByl.mjs`).then(e=>({default:e.SimpleTextareaField}))),E=l(()=>import(`./simple-number-field-PJAyAOMO.mjs`).then(e=>({default:e.SimpleNumberField}))),D=l(()=>import(`./simple-select-field-Df4DLsbi.mjs`).then(e=>({default:e.SimpleSelectField}))),O=t(()=>import(`./simple-array-field-9oZ-Smzp.mjs`).then(e=>({default:e.SimpleArrayField})));function k(t){return n(e,{fallback:null,children:n(O,{...t})})}const A=l(()=>import(`./simple-boolean-field-CkJUMxNU.mjs`).then(e=>({default:e.SimpleBooleanField}))),j=l(()=>import(`./simple-combobox-field-5dfMd49B.mjs`).then(e=>({default:e.SimpleComboboxField}))),M=l(()=>import(`./simple-date-field-BXoLb496.mjs`).then(e=>({default:e.SimpleDateField}))),N=l(()=>import(`./simple-radio-group-field-DiYQfgts.mjs`).then(e=>({default:e.SimpleRadioGroupField}))),P=l(()=>import(`./simple-array-field-9oZ-Smzp.mjs`).then(e=>({default:e.ArrayCol}))),F=l(()=>import(`./simple-array-field-9oZ-Smzp.mjs`).then(e=>({default:e.ArrayHeaderRow}))),I=l(()=>import(`./dialog-form-ClWBZbUN.mjs`).then(e=>({default:e.TanStackDialogForm}))),L=l(()=>import(`./popover-form-DNbBGWVF.mjs`).then(e=>({default:e.TanStackPopoverForm}))),R=l(()=>import(`./container-form-BdsEX0NH.mjs`).then(e=>({default:e.TanStackContainerForm}))),z=l(()=>import(`./section-form-B_AZr7jZ.mjs`).then(e=>({default:e.TanStackSectionForm}))),B=l(()=>import(`./card-form-D9fNO-6F.mjs`).then(e=>({default:e.TanStackCardForm}))),V=l(()=>import(`./group-field-bviEXmo4.mjs`).then(e=>({default:e.TanStackFieldGroup}))),H=l(()=>import(`./title-field-84EnHPvl.mjs`).then(e=>({default:e.TanStackTitleField}))),U=l(()=>import(`./actions-form-BL_B81Vg.mjs`).then(e=>({default:e.TanStackActionsForm}))),W=l(()=>import(`./action-submit-Dg5GvYz5.mjs`).then(e=>({default:e.TanStackActionSubmit}))),G=l(()=>import(`./field-BKyUqvzh.mjs`).then(e=>({default:e.FieldGroup}))),K=l(()=>import(`./field-BKyUqvzh.mjs`).then(e=>({default:e.Field}))),q=l(()=>import(`./field-BKyUqvzh.mjs`).then(e=>({default:e.FieldContent}))),J=l(()=>import(`./field-BKyUqvzh.mjs`).then(e=>({default:e.FieldLabel}))),Y=l(()=>import(`./field-BKyUqvzh.mjs`).then(e=>({default:e.FieldContentMain}))),X=l(()=>import(`./field-BKyUqvzh.mjs`).then(e=>({default:e.FieldSeparator}))),Z=l(()=>import(`./field-BKyUqvzh.mjs`).then(e=>({default:e.FieldError}))),{useAppForm:Q,withForm:$,withFieldGroup:ee}=r({fieldContext:a,formContext:o,fieldComponents:{TextField:u,TextareaField:d,TextEditorField:f,NumberField:p,EmailField:m,PasswordField:h,SelectField:g,ComboboxField:_,DateField:v,SwitchField:y,RadioGroupField:b,CheckboxField:x,SimpleTextField:S,SimpleEmailField:C,SimplePasswordField:w,SimpleTextareaField:T,SimpleNumberField:E,SimpleSelectField:D,SimpleArrayField:k,SimpleBooleanField:A,SimpleComboboxField:j,SimpleDateField:M,SimpleRadioGroupField:N,FieldGroup:G,Field:K,FieldContent:q,FieldLabel:J,FieldContentMain:Y,FieldSeparator:X,FieldError:Z},formComponents:{TanStackDialogForm:I,TanStackPopoverForm:L,TanStackContainerForm:R,TanStackSectionForm:z,TanStackCardForm:B,TanStackFieldGroup:V,TanStackTitleField:H,TanStackActionsForm:U,TanStackActionSubmit:W,ArrayCol:P,ArrayHeaderRow:F}});export{W as A,u as B,E as C,S as D,D as E,V as F,s as G,Q as H,L as I,c as K,z as L,B as M,R as N,T as O,I as P,H as R,C as S,N as T,ee as U,d as V,$ as W,g as _,v as a,j as b,q as c,G as d,J as f,b as g,h,_ as i,U as j,y as k,Y as l,p as m,F as n,m as o,X as p,x as r,K as s,P as t,Z as u,k as v,w,M as x,A as y,f as z};
2
+ //# sourceMappingURL=tanstack-form-CM_Hb3JT.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tanstack-form-CM_Hb3JT.mjs","names":["Impl"],"sources":["../packages/components/features/tanstack-form/components/form-context.ts","../packages/components/features/tanstack-form/tanstack-form.tsx"],"sourcesContent":["'use client';\n\nimport { createFormHookContexts } from '@tanstack/react-form';\n\n/**\n * Shared field/form contexts, split out from `tanstack-form.tsx` so that field and form\n * components can depend on them directly instead of importing back through the file that\n * lazy-loads those same components (which would reintroduce a circular import).\n */\nexport const { fieldContext, formContext, useFieldContext: useTanStackFieldContext, useFormContext: useTanStackFormContext } = createFormHookContexts();\n","'use client';\n\nimport type { ComponentProps, ComponentType } from 'react';\nimport { lazy, Suspense } from 'react';\n\nimport { createFormHook } from '@tanstack/react-form';\n\nimport { fieldContext, formContext, useTanStackFieldContext, useTanStackFormContext } from './components/form-context';\n\nimport type { TanStackActionSubmit as TanStackActionSubmitType } from './components/forms/action-submit';\nimport type { TanStackActionsForm as TanStackActionsFormType } from './components/forms/actions-form';\nimport type { TanStackCardForm as TanStackCardFormType } from './components/forms/card-form';\nimport type { TanStackContainerForm as TanStackContainerFormType } from './components/forms/container-form';\nimport type { TanStackDialogForm as TanStackDialogFormType } from './components/forms/dialog-form';\nimport type { TanStackFieldGroup as TanStackFieldGroupType } from './components/forms/group-field';\nimport type { TanStackPopoverForm as TanStackPopoverFormType } from './components/forms/popover-form';\nimport type { TanStackSectionForm as TanStackSectionFormType } from './components/forms/section-form';\nimport type { TanStackTitleField as TanStackTitleFieldType } from './components/forms/title-field';\nimport type {\n Field as FieldType,\n FieldContent as FieldContentType,\n FieldContentMain as FieldContentMainType,\n FieldError as FieldErrorType,\n FieldGroup as FieldGroupType,\n FieldLabel as FieldLabelType,\n FieldSeparator as FieldSeparatorType,\n} from './components/ui/field';\n\nimport type { ArrayCol as ArrayColType, ArrayHeaderRow as ArrayHeaderRowType, SimpleArrayFieldProps } from './components/atoms/simple-array-field';\nimport type { SimpleBooleanField as SimpleBooleanFieldType } from './components/atoms/simple-boolean-field';\nimport type { SimpleComboboxField as SimpleComboboxFieldType } from './components/atoms/simple-combobox-field';\nimport type { SimpleDateField as SimpleDateFieldType } from './components/atoms/simple-date-field';\nimport type { SimpleEmailField as SimpleEmailFieldType } from './components/atoms/simple-email-field';\nimport type { SimpleNumberField as SimpleNumberFieldType } from './components/atoms/simple-number-field';\nimport type { SimplePasswordField as SimplePasswordFieldType } from './components/atoms/simple-password-field';\nimport type { SimpleRadioGroupField as SimpleRadioGroupFieldType } from './components/atoms/simple-radio-group-field';\nimport type { SimpleSelectField as SimpleSelectFieldType } from './components/atoms/simple-select-field';\nimport type { SimpleTextareaField as SimpleTextareaFieldType } from './components/atoms/simple-textarea-field';\nimport type { SimpleTextField as SimpleTextFieldType } from './components/atoms/simple-text-field';\nimport type { CheckboxField as CheckboxFieldType } from './components/fields/checkbox-field';\nimport type { ComboboxField as ComboboxFieldType } from './components/fields/combobox-field';\nimport type { DateField as DateFieldType } from './components/fields/date-field';\nimport type { EmailField as EmailFieldType } from './components/fields/email-field';\nimport type { NumberField as NumberFieldType } from './components/fields/number-field';\nimport type { PasswordField as PasswordFieldType } from './components/fields/password-field';\nimport type { RadioGroupField as RadioGroupFieldType } from './components/fields/radio-group-field';\nimport type { SelectField as SelectFieldType } from './components/fields/select-field';\nimport type { SwitchField as SwitchFieldType } from './components/fields/switch-field';\nimport type { TextEditorField as TextEditorFieldType } from './components/fields/text-editor-field';\nimport type { TextField as TextFieldType } from './components/fields/text-field';\nimport type { TextareaField as TextareaFieldType } from './components/fields/textarea-field';\n\n/**\n * Wraps a `lazy()`-loaded component in its own `Suspense` boundary so it can be dropped\n * anywhere (inside or outside our own form containers) without callers needing to set up\n * Suspense themselves. Keeps this file itself small — the heavy per-field-type\n * implementations (Radix Select/Combobox/date-picker, the rich text editor, etc.) only load\n * when a form actually renders that field type.\n */\nfunction lazyField<P extends object>(loader: () => Promise<{ default: ComponentType<P> }>): ComponentType<P> {\n const LazyComponent = lazy(loader);\n return (props: P) => (\n <Suspense fallback={null}>\n <LazyComponent {...props} />\n </Suspense>\n );\n}\n\n// ─── Rich field components (lazy) ─────────────────────────────────────────────\n\nconst TextField = lazyField<ComponentProps<typeof TextFieldType>>(() => import('./components/fields/text-field').then(m => ({ default: m.TextField })));\nconst TextareaField = lazyField<ComponentProps<typeof TextareaFieldType>>(() =>\n import('./components/fields/textarea-field').then(m => ({ default: m.TextareaField }))\n);\nconst TextEditorField = lazyField<ComponentProps<typeof TextEditorFieldType>>(() =>\n import('./components/fields/text-editor-field').then(m => ({ default: m.TextEditorField }))\n);\nconst NumberField = lazyField<ComponentProps<typeof NumberFieldType>>(() => import('./components/fields/number-field').then(m => ({ default: m.NumberField })));\nconst EmailField = lazyField<ComponentProps<typeof EmailFieldType>>(() => import('./components/fields/email-field').then(m => ({ default: m.EmailField })));\nconst PasswordField = lazyField<ComponentProps<typeof PasswordFieldType>>(() =>\n import('./components/fields/password-field').then(m => ({ default: m.PasswordField }))\n);\nconst SelectField = lazyField<ComponentProps<typeof SelectFieldType>>(() => import('./components/fields/select-field').then(m => ({ default: m.SelectField })));\nconst ComboboxField = lazyField<ComponentProps<typeof ComboboxFieldType>>(() =>\n import('./components/fields/combobox-field').then(m => ({ default: m.ComboboxField }))\n);\nconst DateField = lazyField<ComponentProps<typeof DateFieldType>>(() => import('./components/fields/date-field').then(m => ({ default: m.DateField })));\nconst SwitchField = lazyField<ComponentProps<typeof SwitchFieldType>>(() => import('./components/fields/switch-field').then(m => ({ default: m.SwitchField })));\nconst RadioGroupField = lazyField<ComponentProps<typeof RadioGroupFieldType>>(() =>\n import('./components/fields/radio-group-field').then(m => ({ default: m.RadioGroupField }))\n);\nconst CheckboxField = lazyField<ComponentProps<typeof CheckboxFieldType>>(() =>\n import('./components/fields/checkbox-field').then(m => ({ default: m.CheckboxField }))\n);\n\n// ─── Simple (minimal) field components (lazy) ─────────────────────────────────\n\nconst SimpleTextField = lazyField<ComponentProps<typeof SimpleTextFieldType>>(() =>\n import('./components/atoms/simple-text-field').then(m => ({ default: m.SimpleTextField }))\n);\nconst SimpleEmailField = lazyField<ComponentProps<typeof SimpleEmailFieldType>>(() =>\n import('./components/atoms/simple-email-field').then(m => ({ default: m.SimpleEmailField }))\n);\nconst SimplePasswordField = lazyField<ComponentProps<typeof SimplePasswordFieldType>>(() =>\n import('./components/atoms/simple-password-field').then(m => ({ default: m.SimplePasswordField }))\n);\nconst SimpleTextareaField = lazyField<ComponentProps<typeof SimpleTextareaFieldType>>(() =>\n import('./components/atoms/simple-textarea-field').then(m => ({ default: m.SimpleTextareaField }))\n);\nconst SimpleNumberField = lazyField<ComponentProps<typeof SimpleNumberFieldType>>(() =>\n import('./components/atoms/simple-number-field').then(m => ({ default: m.SimpleNumberField }))\n);\nconst SimpleSelectField = lazyField<ComponentProps<typeof SimpleSelectFieldType>>(() =>\n import('./components/atoms/simple-select-field').then(m => ({ default: m.SimpleSelectField }))\n);\nconst LazySimpleArrayField = lazy(() =>\n import('./components/atoms/simple-array-field').then(m => ({ default: m.SimpleArrayField as ComponentType<SimpleArrayFieldProps<unknown>> }))\n);\n\n/** Kept as its own generic wrapper (instead of `lazyField`) so callers can still write `<SimpleArrayField<Row> />`. */\nfunction SimpleArrayField<T>(props: SimpleArrayFieldProps<T>) {\n const Impl = LazySimpleArrayField as ComponentType<SimpleArrayFieldProps<T>>;\n return (\n <Suspense fallback={null}>\n <Impl {...props} />\n </Suspense>\n );\n}\n\nconst SimpleBooleanField = lazyField<ComponentProps<typeof SimpleBooleanFieldType>>(() =>\n import('./components/atoms/simple-boolean-field').then(m => ({ default: m.SimpleBooleanField }))\n);\nconst SimpleComboboxField = lazyField<ComponentProps<typeof SimpleComboboxFieldType>>(() =>\n import('./components/atoms/simple-combobox-field').then(m => ({ default: m.SimpleComboboxField }))\n);\nconst SimpleDateField = lazyField<ComponentProps<typeof SimpleDateFieldType>>(() =>\n import('./components/atoms/simple-date-field').then(m => ({ default: m.SimpleDateField }))\n);\nconst SimpleRadioGroupField = lazyField<ComponentProps<typeof SimpleRadioGroupFieldType>>(() =>\n import('./components/atoms/simple-radio-group-field').then(m => ({ default: m.SimpleRadioGroupField }))\n);\n\n// ─── Array field layout helpers (lazy, co-located with SimpleArrayField) ──────\n\nconst ArrayCol = lazyField<ComponentProps<typeof ArrayColType>>(() => import('./components/atoms/simple-array-field').then(m => ({ default: m.ArrayCol })));\nconst ArrayHeaderRow = lazyField<ComponentProps<typeof ArrayHeaderRowType>>(() =>\n import('./components/atoms/simple-array-field').then(m => ({ default: m.ArrayHeaderRow }))\n);\n\n// ─── Form containers (lazy) ───────────────────────────────────────────────────\n\nconst TanStackDialogForm = lazyField<ComponentProps<typeof TanStackDialogFormType>>(() =>\n import('./components/forms/dialog-form').then(m => ({ default: m.TanStackDialogForm }))\n);\nconst TanStackPopoverForm = lazyField<ComponentProps<typeof TanStackPopoverFormType>>(() =>\n import('./components/forms/popover-form').then(m => ({ default: m.TanStackPopoverForm }))\n);\nconst TanStackContainerForm = lazyField<ComponentProps<typeof TanStackContainerFormType>>(() =>\n import('./components/forms/container-form').then(m => ({ default: m.TanStackContainerForm }))\n);\nconst TanStackSectionForm = lazyField<ComponentProps<typeof TanStackSectionFormType>>(() =>\n import('./components/forms/section-form').then(m => ({ default: m.TanStackSectionForm }))\n);\nconst TanStackCardForm = lazyField<ComponentProps<typeof TanStackCardFormType>>(() =>\n import('./components/forms/card-form').then(m => ({ default: m.TanStackCardForm }))\n);\nconst TanStackFieldGroup = lazyField<ComponentProps<typeof TanStackFieldGroupType>>(() =>\n import('./components/forms/group-field').then(m => ({ default: m.TanStackFieldGroup }))\n);\nconst TanStackTitleField = lazyField<ComponentProps<typeof TanStackTitleFieldType>>(() =>\n import('./components/forms/title-field').then(m => ({ default: m.TanStackTitleField }))\n);\nconst TanStackActionsForm = lazyField<ComponentProps<typeof TanStackActionsFormType>>(() =>\n import('./components/forms/actions-form').then(m => ({ default: m.TanStackActionsForm }))\n);\nconst TanStackActionSubmit = lazyField<ComponentProps<typeof TanStackActionSubmitType>>(() =>\n import('./components/forms/action-submit').then(m => ({ default: m.TanStackActionSubmit }))\n);\n\n// ─── Field UI primitives (lazy) ───────────────────────────────────────────────\n\nconst FieldGroup = lazyField<ComponentProps<typeof FieldGroupType>>(() => import('./components/ui/field').then(m => ({ default: m.FieldGroup })));\nconst Field = lazyField<ComponentProps<typeof FieldType>>(() => import('./components/ui/field').then(m => ({ default: m.Field })));\nconst FieldContent = lazyField<ComponentProps<typeof FieldContentType>>(() => import('./components/ui/field').then(m => ({ default: m.FieldContent })));\nconst FieldLabel = lazyField<ComponentProps<typeof FieldLabelType>>(() => import('./components/ui/field').then(m => ({ default: m.FieldLabel })));\nconst FieldContentMain = lazyField<ComponentProps<typeof FieldContentMainType>>(() =>\n import('./components/ui/field').then(m => ({ default: m.FieldContentMain }))\n);\nconst FieldSeparator = lazyField<ComponentProps<typeof FieldSeparatorType>>(() => import('./components/ui/field').then(m => ({ default: m.FieldSeparator })));\nconst FieldError = lazyField<ComponentProps<typeof FieldErrorType>>(() => import('./components/ui/field').then(m => ({ default: m.FieldError })));\n\n/**\n * Factory result from {@link createFormHook} pre-wired with all Lunas UI field and form components.\n *\n * ### `useTanStackForm`\n * Pre-configured TanStack Form hook that returns a type-safe form instance bound to all Lunas UI\n * field and form components.\n *\n * @example\n * import { useTanStackForm } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * const form = useTanStackForm({\n * defaultValues: { name: '', email: '' },\n * onSubmit: async ({ value }) => console.log(value),\n * });\n *\n * return (\n * <form.Provider>\n * <form.AppForm>\n * <form.AppField name=\"name\" children={(field) => <field.TextField label=\"Name\" />} />\n * <form.Subscribe selector={(s) => s.canSubmit}>\n * {(canSubmit) => <form.TanStackActionSubmit disabled={!canSubmit} />}\n * </form.Subscribe>\n * </form.AppForm>\n * </form.Provider>\n * );\n *\n * ### `withTanStackForm`\n * Higher-order component that wraps a sub-form component with access to the parent\n * `useTanStackForm` form context, enabling isolated field groups that still participate in the\n * top-level form state.\n *\n * @example\n * import { withTanStackForm } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * const AddressFields = withTanStackForm(\n * { street: '', city: '' } as const,\n * ({ form }) => (\n * <>\n * <form.AppField name=\"street\" children={(f) => <f.TextField label=\"Street\" />} />\n * <form.AppField name=\"city\" children={(f) => <f.TextField label=\"City\" />} />\n * </>\n * ),\n * );\n *\n * ### `withTanStackFieldGroup`\n * Higher-order component that creates a reusable field-group component sharing the enclosing\n * `useTanStackForm` context without requiring additional form providers.\n *\n * @example\n * import { withTanStackFieldGroup } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * const ContactGroup = withTanStackFieldGroup(({ form }) => (\n * <form.AppField name=\"phone\" children={(f) => <f.TextField label=\"Phone\" />} />\n * ));\n */\nconst {\n useAppForm: useTanStackForm,\n withForm: withTanStackForm,\n withFieldGroup: withTanStackFieldGroup,\n} = createFormHook({\n fieldContext,\n formContext,\n\n fieldComponents: {\n TextField,\n TextareaField,\n TextEditorField,\n NumberField,\n EmailField,\n PasswordField,\n\n SelectField,\n ComboboxField,\n DateField,\n SwitchField,\n RadioGroupField,\n CheckboxField,\n\n SimpleTextField,\n SimpleEmailField,\n SimplePasswordField,\n SimpleTextareaField,\n SimpleNumberField,\n SimpleSelectField,\n SimpleArrayField,\n SimpleBooleanField,\n SimpleComboboxField,\n SimpleDateField,\n SimpleRadioGroupField,\n\n FieldGroup,\n Field,\n FieldContent,\n FieldLabel,\n FieldContentMain,\n FieldSeparator,\n FieldError,\n },\n formComponents: {\n TanStackDialogForm,\n TanStackPopoverForm,\n TanStackContainerForm,\n TanStackSectionForm,\n TanStackCardForm,\n TanStackFieldGroup,\n TanStackTitleField,\n\n TanStackActionsForm,\n TanStackActionSubmit,\n\n ArrayCol,\n ArrayHeaderRow,\n },\n});\n\nexport {\n // Hooks & HOCs\n useTanStackForm,\n withTanStackForm,\n withTanStackFieldGroup,\n useTanStackFieldContext,\n useTanStackFormContext,\n // Form containers\n TanStackDialogForm,\n TanStackPopoverForm,\n TanStackContainerForm,\n TanStackSectionForm,\n TanStackCardForm,\n TanStackFieldGroup,\n TanStackTitleField,\n // Form actions\n TanStackActionsForm,\n TanStackActionSubmit,\n // Array helpers\n ArrayCol,\n ArrayHeaderRow,\n // Rich field components\n TextField,\n TextareaField,\n TextEditorField,\n NumberField,\n EmailField,\n PasswordField,\n SelectField,\n ComboboxField,\n DateField,\n SwitchField,\n RadioGroupField,\n CheckboxField,\n // Simple (minimal) field components\n SimpleTextField,\n SimpleEmailField,\n SimplePasswordField,\n SimpleTextareaField,\n SimpleNumberField,\n SimpleSelectField,\n SimpleArrayField,\n SimpleBooleanField,\n SimpleComboboxField,\n SimpleDateField,\n SimpleRadioGroupField,\n // Field UI primitives\n FieldGroup,\n Field,\n FieldContent,\n FieldContentMain,\n FieldLabel,\n FieldSeparator,\n FieldError,\n};\n"],"mappings":"qKASA,KAAa,CAAE,eAAc,cAAa,gBAAiB,EAAyB,eAAgB,GAA2B,EAAuB,ECkDtJ,SAAS,EAA4B,EAAwE,CAC3G,IAAM,EAAgB,EAAK,CAAM,EACjC,MAAQ,IACN,EAAC,EAAD,CAAU,SAAU,cAClB,EAAC,EAAD,CAAe,GAAI,CAAQ,CAAA,CACnB,CAAA,CAEd,CAIA,MAAM,EAAY,MAAsD,OAAO,4BAAiC,CAAC,KAAK,IAAM,CAAE,QAAS,EAAE,SAAU,EAAE,CAAC,EAChJ,EAAgB,MACpB,OAAO,gCAAqC,CAAC,KAAK,IAAM,CAAE,QAAS,EAAE,aAAc,EAAE,CACvF,EACM,EAAkB,MACtB,OAAO,mCAAwC,CAAC,KAAK,IAAM,CAAE,QAAS,EAAE,eAAgB,EAAE,CAC5F,EACM,EAAc,MAAwD,OAAO,8BAAmC,CAAC,KAAK,IAAM,CAAE,QAAS,EAAE,WAAY,EAAE,CAAC,EACxJ,EAAa,MAAuD,OAAO,6BAAkC,CAAC,KAAK,IAAM,CAAE,QAAS,EAAE,UAAW,EAAE,CAAC,EACpJ,EAAgB,MACpB,OAAO,gCAAqC,CAAC,KAAK,IAAM,CAAE,QAAS,EAAE,aAAc,EAAE,CACvF,EAC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AAsB,MAC1B,OAAO,8BAAkC,CAAC,KAAK,IAAM,CAAE,QAAS,EAAE,mBAAoB,EAAE,CAC1F,EACM,EAAuB,MAC3B,OAAO,+BAAmC,CAAC,KAAK,IAAM,CAAE,QAAS,EAAE,oBAAqB,EAAE,CAC5F,EAIM,EAAa,MAAuD,OAAO,uBAAwB,CAAC,KAAK,IAAM,CAAE,QAAS,EAAE,UAAW,EAAE,CAAC,EAC1I,EAAQ,MAAkD,OAAO,uBAAwB,CAAC,KAAK,IAAM,CAAE,QAAS,EAAE,KAAM,EAAE,CAAC,EAC3H,EAAe,MAAyD,OAAO,uBAAwB,CAAC,KAAK,IAAM,CAAE,QAAS,EAAE,YAAa,EAAE,CAAC,EAChJ,EAAa,MAAuD,OAAO,uBAAwB,CAAC,KAAK,IAAM,CAAE,QAAS,EAAE,UAAW,EAAE,CAAC,EAC1I,EAAmB,MACvB,OAAO,uBAAwB,CAAC,KAAK,IAAM,CAAE,QAAS,EAAE,gBAAiB,EAAE,CAC7E,EACM,EAAiB,MAA2D,OAAO,uBAAwB,CAAC,KAAK,IAAM,CAAE,QAAS,EAAE,cAAe,EAAE,CAAC,EACtJ,EAAa,MAAuD,OAAO,uBAAwB,CAAC,KAAK,IAAM,CAAE,QAAS,EAAE,UAAW,EAAE,CAAC,EAyD1I,CACJ,WAAY,EACZ,SAAU,EACV,eAAgB,IACd,EAAe,CACjB,eACA,cAEA,gBAAiB,CACf,YACA,gBACA,kBACA,cACA,aACA,gBAEA,cACA,gBACA,YACA,cACA,kBACA,gBAEA,kBACA,mBACA,sBACA,sBACA,oBACA,oBACA,mBACA,qBACA,sBACA,kBACA,wBAEA,aACA,QACA,eACA,aACA,mBACA,iBACA,YACF,EACA,eAAgB,CACd,qBACA,sBACA,wBACA,sBACA,mBACA,qBACA,qBAEA,sBACA,uBAEA,WACA,gBACF,CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ let e=require("react"),t=require("react/jsx-runtime"),n=require("@tanstack/react-form");const{fieldContext:r,formContext:i,useFieldContext:a,useFormContext:o}=(0,n.createFormHookContexts)();function s(n){let r=(0,e.lazy)(n);return n=>(0,t.jsx)(e.Suspense,{fallback:null,children:(0,t.jsx)(r,{...n})})}const c=s(()=>Promise.resolve().then(()=>require("./text-field-BhC_ik5w.cjs")).then(e=>({default:e.TextField}))),l=s(()=>Promise.resolve().then(()=>require("./textarea-field-C-7ZoUMz.cjs")).then(e=>({default:e.TextareaField}))),u=s(()=>Promise.resolve().then(()=>require("./text-editor-field-BBDgCPuc.cjs")).then(e=>({default:e.TextEditorField}))),d=s(()=>Promise.resolve().then(()=>require("./number-field-BqeSbMvE.cjs")).then(e=>({default:e.NumberField}))),f=s(()=>Promise.resolve().then(()=>require("./email-field-lDd9ouFN.cjs")).then(e=>({default:e.EmailField}))),p=s(()=>Promise.resolve().then(()=>require("./password-field-Cq0S949S.cjs")).then(e=>({default:e.PasswordField}))),m=s(()=>Promise.resolve().then(()=>require("./select-field-B4eU65OI.cjs")).then(e=>({default:e.SelectField}))),h=s(()=>Promise.resolve().then(()=>require("./combobox-field-D9NdSih1.cjs")).then(e=>({default:e.ComboboxField}))),g=s(()=>Promise.resolve().then(()=>require("./date-field-BqAX4M_h.cjs")).then(e=>({default:e.DateField}))),_=s(()=>Promise.resolve().then(()=>require("./switch-field-C1uNuuku.cjs")).then(e=>({default:e.SwitchField}))),v=s(()=>Promise.resolve().then(()=>require("./radio-group-field-DjzD3i-f.cjs")).then(e=>({default:e.RadioGroupField}))),y=s(()=>Promise.resolve().then(()=>require("./checkbox-field-DdeohRmi.cjs")).then(e=>({default:e.CheckboxField}))),b=s(()=>Promise.resolve().then(()=>require("./simple-text-field-DVkuHrhF.cjs")).then(e=>({default:e.SimpleTextField}))),x=s(()=>Promise.resolve().then(()=>require("./simple-email-field-QVUrm8f7.cjs")).then(e=>({default:e.SimpleEmailField}))),S=s(()=>Promise.resolve().then(()=>require("./simple-password-field-BW6YkfSP.cjs")).then(e=>({default:e.SimplePasswordField}))),C=s(()=>Promise.resolve().then(()=>require("./simple-textarea-field-BaMK0feA.cjs")).then(e=>({default:e.SimpleTextareaField}))),w=s(()=>Promise.resolve().then(()=>require("./simple-number-field-P9PTwcs4.cjs")).then(e=>({default:e.SimpleNumberField}))),T=s(()=>Promise.resolve().then(()=>require("./simple-select-field--zJMLBUY.cjs")).then(e=>({default:e.SimpleSelectField}))),E=(0,e.lazy)(()=>Promise.resolve().then(()=>require("./simple-array-field-Bcs2pHdp.cjs")).then(e=>({default:e.SimpleArrayField})));function D(n){return(0,t.jsx)(e.Suspense,{fallback:null,children:(0,t.jsx)(E,{...n})})}const O=s(()=>Promise.resolve().then(()=>require("./simple-boolean-field-C-qq6Vlt.cjs")).then(e=>({default:e.SimpleBooleanField}))),k=s(()=>Promise.resolve().then(()=>require("./simple-combobox-field-BtmQGEo5.cjs")).then(e=>({default:e.SimpleComboboxField}))),A=s(()=>Promise.resolve().then(()=>require("./simple-date-field-LVfNhVJi.cjs")).then(e=>({default:e.SimpleDateField}))),j=s(()=>Promise.resolve().then(()=>require("./simple-radio-group-field-BtQHJpOz.cjs")).then(e=>({default:e.SimpleRadioGroupField}))),M=s(()=>Promise.resolve().then(()=>require("./simple-array-field-Bcs2pHdp.cjs")).then(e=>({default:e.ArrayCol}))),N=s(()=>Promise.resolve().then(()=>require("./simple-array-field-Bcs2pHdp.cjs")).then(e=>({default:e.ArrayHeaderRow}))),P=s(()=>Promise.resolve().then(()=>require("./dialog-form-DN-NlQFO.cjs")).then(e=>({default:e.TanStackDialogForm}))),F=s(()=>Promise.resolve().then(()=>require("./popover-form-KLmew1Vd.cjs")).then(e=>({default:e.TanStackPopoverForm}))),I=s(()=>Promise.resolve().then(()=>require("./container-form-CxxUYctk.cjs")).then(e=>({default:e.TanStackContainerForm}))),L=s(()=>Promise.resolve().then(()=>require("./section-form-B9iTs2we.cjs")).then(e=>({default:e.TanStackSectionForm}))),R=s(()=>Promise.resolve().then(()=>require("./card-form-BR5kDTzB.cjs")).then(e=>({default:e.TanStackCardForm}))),z=s(()=>Promise.resolve().then(()=>require("./group-field-0kStiX8n.cjs")).then(e=>({default:e.TanStackFieldGroup}))),B=s(()=>Promise.resolve().then(()=>require("./title-field-CKxwzMOM.cjs")).then(e=>({default:e.TanStackTitleField}))),V=s(()=>Promise.resolve().then(()=>require("./actions-form-CE_enCgE.cjs")).then(e=>({default:e.TanStackActionsForm}))),H=s(()=>Promise.resolve().then(()=>require("./action-submit-3kZ7JOop.cjs")).then(e=>({default:e.TanStackActionSubmit}))),U=s(()=>Promise.resolve().then(()=>require("./field-BV5twmKA.cjs")).then(e=>({default:e.FieldGroup}))),W=s(()=>Promise.resolve().then(()=>require("./field-BV5twmKA.cjs")).then(e=>({default:e.Field}))),G=s(()=>Promise.resolve().then(()=>require("./field-BV5twmKA.cjs")).then(e=>({default:e.FieldContent}))),K=s(()=>Promise.resolve().then(()=>require("./field-BV5twmKA.cjs")).then(e=>({default:e.FieldLabel}))),q=s(()=>Promise.resolve().then(()=>require("./field-BV5twmKA.cjs")).then(e=>({default:e.FieldContentMain}))),J=s(()=>Promise.resolve().then(()=>require("./field-BV5twmKA.cjs")).then(e=>({default:e.FieldSeparator}))),Y=s(()=>Promise.resolve().then(()=>require("./field-BV5twmKA.cjs")).then(e=>({default:e.FieldError}))),{useAppForm:X,withForm:Z,withFieldGroup:Q}=(0,n.createFormHook)({fieldContext:r,formContext:i,fieldComponents:{TextField:c,TextareaField:l,TextEditorField:u,NumberField:d,EmailField:f,PasswordField:p,SelectField:m,ComboboxField:h,DateField:g,SwitchField:_,RadioGroupField:v,CheckboxField:y,SimpleTextField:b,SimpleEmailField:x,SimplePasswordField:S,SimpleTextareaField:C,SimpleNumberField:w,SimpleSelectField:T,SimpleArrayField:D,SimpleBooleanField:O,SimpleComboboxField:k,SimpleDateField:A,SimpleRadioGroupField:j,FieldGroup:U,Field:W,FieldContent:G,FieldLabel:K,FieldContentMain:q,FieldSeparator:J,FieldError:Y},formComponents:{TanStackDialogForm:P,TanStackPopoverForm:F,TanStackContainerForm:I,TanStackSectionForm:L,TanStackCardForm:R,TanStackFieldGroup:z,TanStackTitleField:B,TanStackActionsForm:V,TanStackActionSubmit:H,ArrayCol:M,ArrayHeaderRow:N}});Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return u}});
2
+ //# sourceMappingURL=tanstack-form-DS_ZvRl8.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tanstack-form-DS_ZvRl8.cjs","names":["Suspense","Impl"],"sources":["../packages/components/features/tanstack-form/components/form-context.ts","../packages/components/features/tanstack-form/tanstack-form.tsx"],"sourcesContent":["'use client';\n\nimport { createFormHookContexts } from '@tanstack/react-form';\n\n/**\n * Shared field/form contexts, split out from `tanstack-form.tsx` so that field and form\n * components can depend on them directly instead of importing back through the file that\n * lazy-loads those same components (which would reintroduce a circular import).\n */\nexport const { fieldContext, formContext, useFieldContext: useTanStackFieldContext, useFormContext: useTanStackFormContext } = createFormHookContexts();\n","'use client';\n\nimport type { ComponentProps, ComponentType } from 'react';\nimport { lazy, Suspense } from 'react';\n\nimport { createFormHook } from '@tanstack/react-form';\n\nimport { fieldContext, formContext, useTanStackFieldContext, useTanStackFormContext } from './components/form-context';\n\nimport type { TanStackActionSubmit as TanStackActionSubmitType } from './components/forms/action-submit';\nimport type { TanStackActionsForm as TanStackActionsFormType } from './components/forms/actions-form';\nimport type { TanStackCardForm as TanStackCardFormType } from './components/forms/card-form';\nimport type { TanStackContainerForm as TanStackContainerFormType } from './components/forms/container-form';\nimport type { TanStackDialogForm as TanStackDialogFormType } from './components/forms/dialog-form';\nimport type { TanStackFieldGroup as TanStackFieldGroupType } from './components/forms/group-field';\nimport type { TanStackPopoverForm as TanStackPopoverFormType } from './components/forms/popover-form';\nimport type { TanStackSectionForm as TanStackSectionFormType } from './components/forms/section-form';\nimport type { TanStackTitleField as TanStackTitleFieldType } from './components/forms/title-field';\nimport type {\n Field as FieldType,\n FieldContent as FieldContentType,\n FieldContentMain as FieldContentMainType,\n FieldError as FieldErrorType,\n FieldGroup as FieldGroupType,\n FieldLabel as FieldLabelType,\n FieldSeparator as FieldSeparatorType,\n} from './components/ui/field';\n\nimport type { ArrayCol as ArrayColType, ArrayHeaderRow as ArrayHeaderRowType, SimpleArrayFieldProps } from './components/atoms/simple-array-field';\nimport type { SimpleBooleanField as SimpleBooleanFieldType } from './components/atoms/simple-boolean-field';\nimport type { SimpleComboboxField as SimpleComboboxFieldType } from './components/atoms/simple-combobox-field';\nimport type { SimpleDateField as SimpleDateFieldType } from './components/atoms/simple-date-field';\nimport type { SimpleEmailField as SimpleEmailFieldType } from './components/atoms/simple-email-field';\nimport type { SimpleNumberField as SimpleNumberFieldType } from './components/atoms/simple-number-field';\nimport type { SimplePasswordField as SimplePasswordFieldType } from './components/atoms/simple-password-field';\nimport type { SimpleRadioGroupField as SimpleRadioGroupFieldType } from './components/atoms/simple-radio-group-field';\nimport type { SimpleSelectField as SimpleSelectFieldType } from './components/atoms/simple-select-field';\nimport type { SimpleTextareaField as SimpleTextareaFieldType } from './components/atoms/simple-textarea-field';\nimport type { SimpleTextField as SimpleTextFieldType } from './components/atoms/simple-text-field';\nimport type { CheckboxField as CheckboxFieldType } from './components/fields/checkbox-field';\nimport type { ComboboxField as ComboboxFieldType } from './components/fields/combobox-field';\nimport type { DateField as DateFieldType } from './components/fields/date-field';\nimport type { EmailField as EmailFieldType } from './components/fields/email-field';\nimport type { NumberField as NumberFieldType } from './components/fields/number-field';\nimport type { PasswordField as PasswordFieldType } from './components/fields/password-field';\nimport type { RadioGroupField as RadioGroupFieldType } from './components/fields/radio-group-field';\nimport type { SelectField as SelectFieldType } from './components/fields/select-field';\nimport type { SwitchField as SwitchFieldType } from './components/fields/switch-field';\nimport type { TextEditorField as TextEditorFieldType } from './components/fields/text-editor-field';\nimport type { TextField as TextFieldType } from './components/fields/text-field';\nimport type { TextareaField as TextareaFieldType } from './components/fields/textarea-field';\n\n/**\n * Wraps a `lazy()`-loaded component in its own `Suspense` boundary so it can be dropped\n * anywhere (inside or outside our own form containers) without callers needing to set up\n * Suspense themselves. Keeps this file itself small — the heavy per-field-type\n * implementations (Radix Select/Combobox/date-picker, the rich text editor, etc.) only load\n * when a form actually renders that field type.\n */\nfunction lazyField<P extends object>(loader: () => Promise<{ default: ComponentType<P> }>): ComponentType<P> {\n const LazyComponent = lazy(loader);\n return (props: P) => (\n <Suspense fallback={null}>\n <LazyComponent {...props} />\n </Suspense>\n );\n}\n\n// ─── Rich field components (lazy) ─────────────────────────────────────────────\n\nconst TextField = lazyField<ComponentProps<typeof TextFieldType>>(() => import('./components/fields/text-field').then(m => ({ default: m.TextField })));\nconst TextareaField = lazyField<ComponentProps<typeof TextareaFieldType>>(() =>\n import('./components/fields/textarea-field').then(m => ({ default: m.TextareaField }))\n);\nconst TextEditorField = lazyField<ComponentProps<typeof TextEditorFieldType>>(() =>\n import('./components/fields/text-editor-field').then(m => ({ default: m.TextEditorField }))\n);\nconst NumberField = lazyField<ComponentProps<typeof NumberFieldType>>(() => import('./components/fields/number-field').then(m => ({ default: m.NumberField })));\nconst EmailField = lazyField<ComponentProps<typeof EmailFieldType>>(() => import('./components/fields/email-field').then(m => ({ default: m.EmailField })));\nconst PasswordField = lazyField<ComponentProps<typeof PasswordFieldType>>(() =>\n import('./components/fields/password-field').then(m => ({ default: m.PasswordField }))\n);\nconst SelectField = lazyField<ComponentProps<typeof SelectFieldType>>(() => import('./components/fields/select-field').then(m => ({ default: m.SelectField })));\nconst ComboboxField = lazyField<ComponentProps<typeof ComboboxFieldType>>(() =>\n import('./components/fields/combobox-field').then(m => ({ default: m.ComboboxField }))\n);\nconst DateField = lazyField<ComponentProps<typeof DateFieldType>>(() => import('./components/fields/date-field').then(m => ({ default: m.DateField })));\nconst SwitchField = lazyField<ComponentProps<typeof SwitchFieldType>>(() => import('./components/fields/switch-field').then(m => ({ default: m.SwitchField })));\nconst RadioGroupField = lazyField<ComponentProps<typeof RadioGroupFieldType>>(() =>\n import('./components/fields/radio-group-field').then(m => ({ default: m.RadioGroupField }))\n);\nconst CheckboxField = lazyField<ComponentProps<typeof CheckboxFieldType>>(() =>\n import('./components/fields/checkbox-field').then(m => ({ default: m.CheckboxField }))\n);\n\n// ─── Simple (minimal) field components (lazy) ─────────────────────────────────\n\nconst SimpleTextField = lazyField<ComponentProps<typeof SimpleTextFieldType>>(() =>\n import('./components/atoms/simple-text-field').then(m => ({ default: m.SimpleTextField }))\n);\nconst SimpleEmailField = lazyField<ComponentProps<typeof SimpleEmailFieldType>>(() =>\n import('./components/atoms/simple-email-field').then(m => ({ default: m.SimpleEmailField }))\n);\nconst SimplePasswordField = lazyField<ComponentProps<typeof SimplePasswordFieldType>>(() =>\n import('./components/atoms/simple-password-field').then(m => ({ default: m.SimplePasswordField }))\n);\nconst SimpleTextareaField = lazyField<ComponentProps<typeof SimpleTextareaFieldType>>(() =>\n import('./components/atoms/simple-textarea-field').then(m => ({ default: m.SimpleTextareaField }))\n);\nconst SimpleNumberField = lazyField<ComponentProps<typeof SimpleNumberFieldType>>(() =>\n import('./components/atoms/simple-number-field').then(m => ({ default: m.SimpleNumberField }))\n);\nconst SimpleSelectField = lazyField<ComponentProps<typeof SimpleSelectFieldType>>(() =>\n import('./components/atoms/simple-select-field').then(m => ({ default: m.SimpleSelectField }))\n);\nconst LazySimpleArrayField = lazy(() =>\n import('./components/atoms/simple-array-field').then(m => ({ default: m.SimpleArrayField as ComponentType<SimpleArrayFieldProps<unknown>> }))\n);\n\n/** Kept as its own generic wrapper (instead of `lazyField`) so callers can still write `<SimpleArrayField<Row> />`. */\nfunction SimpleArrayField<T>(props: SimpleArrayFieldProps<T>) {\n const Impl = LazySimpleArrayField as ComponentType<SimpleArrayFieldProps<T>>;\n return (\n <Suspense fallback={null}>\n <Impl {...props} />\n </Suspense>\n );\n}\n\nconst SimpleBooleanField = lazyField<ComponentProps<typeof SimpleBooleanFieldType>>(() =>\n import('./components/atoms/simple-boolean-field').then(m => ({ default: m.SimpleBooleanField }))\n);\nconst SimpleComboboxField = lazyField<ComponentProps<typeof SimpleComboboxFieldType>>(() =>\n import('./components/atoms/simple-combobox-field').then(m => ({ default: m.SimpleComboboxField }))\n);\nconst SimpleDateField = lazyField<ComponentProps<typeof SimpleDateFieldType>>(() =>\n import('./components/atoms/simple-date-field').then(m => ({ default: m.SimpleDateField }))\n);\nconst SimpleRadioGroupField = lazyField<ComponentProps<typeof SimpleRadioGroupFieldType>>(() =>\n import('./components/atoms/simple-radio-group-field').then(m => ({ default: m.SimpleRadioGroupField }))\n);\n\n// ─── Array field layout helpers (lazy, co-located with SimpleArrayField) ──────\n\nconst ArrayCol = lazyField<ComponentProps<typeof ArrayColType>>(() => import('./components/atoms/simple-array-field').then(m => ({ default: m.ArrayCol })));\nconst ArrayHeaderRow = lazyField<ComponentProps<typeof ArrayHeaderRowType>>(() =>\n import('./components/atoms/simple-array-field').then(m => ({ default: m.ArrayHeaderRow }))\n);\n\n// ─── Form containers (lazy) ───────────────────────────────────────────────────\n\nconst TanStackDialogForm = lazyField<ComponentProps<typeof TanStackDialogFormType>>(() =>\n import('./components/forms/dialog-form').then(m => ({ default: m.TanStackDialogForm }))\n);\nconst TanStackPopoverForm = lazyField<ComponentProps<typeof TanStackPopoverFormType>>(() =>\n import('./components/forms/popover-form').then(m => ({ default: m.TanStackPopoverForm }))\n);\nconst TanStackContainerForm = lazyField<ComponentProps<typeof TanStackContainerFormType>>(() =>\n import('./components/forms/container-form').then(m => ({ default: m.TanStackContainerForm }))\n);\nconst TanStackSectionForm = lazyField<ComponentProps<typeof TanStackSectionFormType>>(() =>\n import('./components/forms/section-form').then(m => ({ default: m.TanStackSectionForm }))\n);\nconst TanStackCardForm = lazyField<ComponentProps<typeof TanStackCardFormType>>(() =>\n import('./components/forms/card-form').then(m => ({ default: m.TanStackCardForm }))\n);\nconst TanStackFieldGroup = lazyField<ComponentProps<typeof TanStackFieldGroupType>>(() =>\n import('./components/forms/group-field').then(m => ({ default: m.TanStackFieldGroup }))\n);\nconst TanStackTitleField = lazyField<ComponentProps<typeof TanStackTitleFieldType>>(() =>\n import('./components/forms/title-field').then(m => ({ default: m.TanStackTitleField }))\n);\nconst TanStackActionsForm = lazyField<ComponentProps<typeof TanStackActionsFormType>>(() =>\n import('./components/forms/actions-form').then(m => ({ default: m.TanStackActionsForm }))\n);\nconst TanStackActionSubmit = lazyField<ComponentProps<typeof TanStackActionSubmitType>>(() =>\n import('./components/forms/action-submit').then(m => ({ default: m.TanStackActionSubmit }))\n);\n\n// ─── Field UI primitives (lazy) ───────────────────────────────────────────────\n\nconst FieldGroup = lazyField<ComponentProps<typeof FieldGroupType>>(() => import('./components/ui/field').then(m => ({ default: m.FieldGroup })));\nconst Field = lazyField<ComponentProps<typeof FieldType>>(() => import('./components/ui/field').then(m => ({ default: m.Field })));\nconst FieldContent = lazyField<ComponentProps<typeof FieldContentType>>(() => import('./components/ui/field').then(m => ({ default: m.FieldContent })));\nconst FieldLabel = lazyField<ComponentProps<typeof FieldLabelType>>(() => import('./components/ui/field').then(m => ({ default: m.FieldLabel })));\nconst FieldContentMain = lazyField<ComponentProps<typeof FieldContentMainType>>(() =>\n import('./components/ui/field').then(m => ({ default: m.FieldContentMain }))\n);\nconst FieldSeparator = lazyField<ComponentProps<typeof FieldSeparatorType>>(() => import('./components/ui/field').then(m => ({ default: m.FieldSeparator })));\nconst FieldError = lazyField<ComponentProps<typeof FieldErrorType>>(() => import('./components/ui/field').then(m => ({ default: m.FieldError })));\n\n/**\n * Factory result from {@link createFormHook} pre-wired with all Lunas UI field and form components.\n *\n * ### `useTanStackForm`\n * Pre-configured TanStack Form hook that returns a type-safe form instance bound to all Lunas UI\n * field and form components.\n *\n * @example\n * import { useTanStackForm } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * const form = useTanStackForm({\n * defaultValues: { name: '', email: '' },\n * onSubmit: async ({ value }) => console.log(value),\n * });\n *\n * return (\n * <form.Provider>\n * <form.AppForm>\n * <form.AppField name=\"name\" children={(field) => <field.TextField label=\"Name\" />} />\n * <form.Subscribe selector={(s) => s.canSubmit}>\n * {(canSubmit) => <form.TanStackActionSubmit disabled={!canSubmit} />}\n * </form.Subscribe>\n * </form.AppForm>\n * </form.Provider>\n * );\n *\n * ### `withTanStackForm`\n * Higher-order component that wraps a sub-form component with access to the parent\n * `useTanStackForm` form context, enabling isolated field groups that still participate in the\n * top-level form state.\n *\n * @example\n * import { withTanStackForm } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * const AddressFields = withTanStackForm(\n * { street: '', city: '' } as const,\n * ({ form }) => (\n * <>\n * <form.AppField name=\"street\" children={(f) => <f.TextField label=\"Street\" />} />\n * <form.AppField name=\"city\" children={(f) => <f.TextField label=\"City\" />} />\n * </>\n * ),\n * );\n *\n * ### `withTanStackFieldGroup`\n * Higher-order component that creates a reusable field-group component sharing the enclosing\n * `useTanStackForm` context without requiring additional form providers.\n *\n * @example\n * import { withTanStackFieldGroup } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * const ContactGroup = withTanStackFieldGroup(({ form }) => (\n * <form.AppField name=\"phone\" children={(f) => <f.TextField label=\"Phone\" />} />\n * ));\n */\nconst {\n useAppForm: useTanStackForm,\n withForm: withTanStackForm,\n withFieldGroup: withTanStackFieldGroup,\n} = createFormHook({\n fieldContext,\n formContext,\n\n fieldComponents: {\n TextField,\n TextareaField,\n TextEditorField,\n NumberField,\n EmailField,\n PasswordField,\n\n SelectField,\n ComboboxField,\n DateField,\n SwitchField,\n RadioGroupField,\n CheckboxField,\n\n SimpleTextField,\n SimpleEmailField,\n SimplePasswordField,\n SimpleTextareaField,\n SimpleNumberField,\n SimpleSelectField,\n SimpleArrayField,\n SimpleBooleanField,\n SimpleComboboxField,\n SimpleDateField,\n SimpleRadioGroupField,\n\n FieldGroup,\n Field,\n FieldContent,\n FieldLabel,\n FieldContentMain,\n FieldSeparator,\n FieldError,\n },\n formComponents: {\n TanStackDialogForm,\n TanStackPopoverForm,\n TanStackContainerForm,\n TanStackSectionForm,\n TanStackCardForm,\n TanStackFieldGroup,\n TanStackTitleField,\n\n TanStackActionsForm,\n TanStackActionSubmit,\n\n ArrayCol,\n ArrayHeaderRow,\n },\n});\n\nexport {\n // Hooks & HOCs\n useTanStackForm,\n withTanStackForm,\n withTanStackFieldGroup,\n useTanStackFieldContext,\n useTanStackFormContext,\n // Form containers\n TanStackDialogForm,\n TanStackPopoverForm,\n TanStackContainerForm,\n TanStackSectionForm,\n TanStackCardForm,\n TanStackFieldGroup,\n TanStackTitleField,\n // Form actions\n TanStackActionsForm,\n TanStackActionSubmit,\n // Array helpers\n ArrayCol,\n ArrayHeaderRow,\n // Rich field components\n TextField,\n TextareaField,\n TextEditorField,\n NumberField,\n EmailField,\n PasswordField,\n SelectField,\n ComboboxField,\n DateField,\n SwitchField,\n RadioGroupField,\n CheckboxField,\n // Simple (minimal) field components\n SimpleTextField,\n SimpleEmailField,\n SimplePasswordField,\n SimpleTextareaField,\n SimpleNumberField,\n SimpleSelectField,\n SimpleArrayField,\n SimpleBooleanField,\n SimpleComboboxField,\n SimpleDateField,\n SimpleRadioGroupField,\n // Field UI primitives\n FieldGroup,\n Field,\n FieldContent,\n FieldContentMain,\n FieldLabel,\n FieldSeparator,\n FieldError,\n};\n"],"mappings":"wFASA,KAAa,CAAE,eAAc,cAAa,gBAAiB,EAAyB,eAAgB,IAAA,EAAA,EAAA,uBAAA,CAAkD,ECkDtJ,SAAS,EAA4B,EAAwE,CAC3G,IAAM,GAAA,EAAA,EAAA,KAAA,CAAqB,CAAM,EACjC,MAAQ,KACN,EAAA,EAAA,IAAA,CAACA,EAAAA,SAAD,CAAU,SAAU,eAClB,EAAA,EAAA,IAAA,CAAC,EAAD,CAAe,GAAI,CAAQ,CAAA,CACnB,CAAA,CAEd,CAIA,MAAM,EAAY,MAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAsD,2BAAA,CAAA,CAAA,CAAyC,KAAK,IAAM,CAAE,QAAS,EAAE,SAAU,EAAE,CAAC,EAChJ,EAAgB,MAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QACpB,+BAAA,CAAA,CAAA,CAA6C,KAAK,IAAM,CAAE,QAAS,EAAE,aAAc,EAAE,CACvF,EACM,EAAkB,MAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QACtB,kCAAA,CAAA,CAAA,CAAgD,KAAK,IAAM,CAAE,QAAS,EAAE,eAAgB,EAAE,CAC5F,EACM,EAAc,MAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAwD,6BAAA,CAAA,CAAA,CAA2C,KAAK,IAAM,CAAE,QAAS,EAAE,WAAY,EAAE,CAAC,EACxJ,EAAa,MAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QAAuD,4BAAA,CAAA,CAAA,CAA0C,KAAK,IAAM,CAAE,QAAS,EAAE,UAAW,EAAE,CAAC,EACpJ,EAAgB,MAAA,QAAA,QAAA,CAAA,CAAA,SAAA,QACpB,+BAAA,CAAA,CAAA,CAA6C,KAAK,IAAM,CAAE,QAAS,EAAE,aAAc,EAAE,CACv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,aACA,gBAEA,cACA,gBACA,YACA,cACA,kBACA,gBAEA,kBACA,mBACA,sBACA,sBACA,oBACA,oBACA,mBACA,qBACA,sBACA,kBACA,wBAEA,aACA,QACA,eACA,aACA,mBACA,iBACA,YACF,EACA,eAAgB,CACd,qBACA,sBACA,wBACA,sBACA,mBACA,qBACA,qBAEA,sBACA,uBAEA,WACA,gBACF,CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ const e=require("./tanstack-form-DS_ZvRl8.cjs"),t=require("./text-editor-DJYQXXtP.cjs"),n=require("./field-BV5twmKA.cjs");let r=require("react"),i=require("react/jsx-runtime"),a=require("@tanstack/react-form");const o=(0,r.memo)(({label:o,description:s,placeholder:c,tooltip:l,helperText:u,showErrorMessage:d=!0,required:f=!1})=>{let{form:p,state:m,handleChange:h}=e.G(),g=(0,a.useStore)(p.store,({isSubmitting:e})=>e),_=m.meta.isDirty&&m.meta.isTouched&&!m.meta.isValid,v=f&&m.value===null,y=(0,r.useCallback)(e=>{g||h(e||null)},[g,h]);return(0,i.jsxs)(n.FieldGroup,{className:`gap-y-4 px-4`,children:[(0,i.jsxs)(n.Field,{orientation:`vertical`,"data-invalid":_,children:[(0,i.jsxs)(n.FieldContent,{children:[(0,i.jsxs)(n.FieldLabel,{"aria-required":v,children:[o,l&&(0,i.jsx)(n.FieldTooltip,{tooltip:l})]}),(0,i.jsx)(n.FieldDescription,{children:s})]}),(0,i.jsx)(t.t,{value:m.value??``,placeholder:c,readOnly:g,onChange:y}),m.meta.isDirty&&d&&!!m.meta.errors.length&&(0,i.jsx)(n.FieldError,{errors:m.meta.errors}),(0,i.jsx)(n.FieldNote,{isShow:!!u,children:u})]}),(0,i.jsx)(n.FieldSeparator,{})]})});o.displayName=`TextEditorField`,exports.TextEditorField=o;
2
+ //# sourceMappingURL=text-editor-field-BBDgCPuc.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-editor-field-BBDgCPuc.cjs","names":["useTanStackFieldContext","FieldGroup","Field","FieldContent","FieldLabel","FieldTooltip","FieldDescription","TextEditor","FieldError","FieldNote","FieldSeparator"],"sources":["../packages/components/features/tanstack-form/components/fields/text-editor-field.tsx"],"sourcesContent":["'use client';\n\nimport { memo, useCallback } from 'react';\n\nimport { useStore } from '@tanstack/react-form';\n\nimport { TextEditor } from '@/components/features/text-editor';\n\nimport { useTanStackFieldContext } from '../form-context';\nimport { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldNote, FieldSeparator, FieldTooltip } from '../ui/field';\n\nimport type { TextEditorFieldProps as Props } from '../../types';\n\nexport const TextEditorField: React.FC<Props> = memo(({ label, description, placeholder, tooltip, helperText, showErrorMessage = true, required = false }) => {\n const { form, state, handleChange } = useTanStackFieldContext<string | null>();\n\n const isSubmitting = useStore(form.store, ({ isSubmitting }) => isSubmitting);\n\n const _invalid = state.meta.isDirty && state.meta.isTouched && !state.meta.isValid;\n const _isEmpty = required && state.value === null;\n\n const onChange = useCallback(\n (html: string) => {\n if (isSubmitting) return;\n handleChange(html || null);\n },\n [isSubmitting, handleChange]\n );\n\n return (\n <FieldGroup className=\"gap-y-4 px-4\">\n <Field orientation=\"vertical\" data-invalid={_invalid}>\n <FieldContent>\n <FieldLabel aria-required={_isEmpty}>\n {label}\n {tooltip && <FieldTooltip tooltip={tooltip} />}\n </FieldLabel>\n <FieldDescription>{description}</FieldDescription>\n </FieldContent>\n <TextEditor value={state.value ?? ''} placeholder={placeholder} readOnly={isSubmitting} onChange={onChange} />\n {state.meta.isDirty && showErrorMessage && !!state.meta.errors.length && <FieldError errors={state.meta.errors} />}\n <FieldNote isShow={!!helperText}>{helperText}</FieldNote>\n </Field>\n <FieldSeparator />\n </FieldGroup>\n );\n});\nTextEditorField.displayName = 'TextEditorField';\n"],"mappings":"kNAaA,MAAa,GAAA,EAAA,EAAA,KAAA,EAAyC,CAAE,QAAO,cAAa,cAAa,UAAS,aAAY,mBAAmB,GAAM,WAAW,MAAY,CAC5J,GAAM,CAAE,OAAM,QA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{t}from"./text-editor-BQtIXOpM.mjs";import{Field as n,FieldContent as r,FieldDescription as i,FieldError as a,FieldGroup as o,FieldLabel as s,FieldNote as c,FieldSeparator as l,FieldTooltip as u}from"./field-BKyUqvzh.mjs";import{memo as d,useCallback as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{useStore as h}from"@tanstack/react-form";const g=d(({label:d,description:g,placeholder:_,tooltip:v,helperText:y,showErrorMessage:b=!0,required:x=!1})=>{let{form:S,state:C,handleChange:w}=e(),T=h(S.store,({isSubmitting:e})=>e),E=C.meta.isDirty&&C.meta.isTouched&&!C.meta.isValid,D=x&&C.value===null,O=f(e=>{T||w(e||null)},[T,w]);return m(o,{className:`gap-y-4 px-4`,children:[m(n,{orientation:`vertical`,"data-invalid":E,children:[m(r,{children:[m(s,{"aria-required":D,children:[d,v&&p(u,{tooltip:v})]}),p(i,{children:g})]}),p(t,{value:C.value??``,placeholder:_,readOnly:T,onChange:O}),C.meta.isDirty&&b&&!!C.meta.errors.length&&p(a,{errors:C.meta.errors}),p(c,{isShow:!!y,children:y})]}),p(l,{})]})});g.displayName=`TextEditorField`;export{g as TextEditorField};
2
+ //# sourceMappingURL=text-editor-field-CcsR48Jw.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-editor-field-CcsR48Jw.mjs","names":[],"sources":["../packages/components/features/tanstack-form/components/fields/text-editor-field.tsx"],"sourcesContent":["'use client';\n\nimport { memo, useCallback } from 'react';\n\nimport { useStore } from '@tanstack/react-form';\n\nimport { TextEditor } from '@/components/features/text-editor';\n\nimport { useTanStackFieldContext } from '../form-context';\nimport { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldNote, FieldSeparator, FieldTooltip } from '../ui/field';\n\nimport type { TextEditorFieldProps as Props } from '../../types';\n\nexport const TextEditorField: React.FC<Props> = memo(({ label, description, placeholder, tooltip, helperText, showErrorMessage = true, required = false }) => {\n const { form, state, handleChange } = useTanStackFieldContext<string | null>();\n\n const isSubmitting = useStore(form.store, ({ isSubmitting }) => isSubmitting);\n\n const _invalid = state.meta.isDirty && state.meta.isTouched && !state.meta.isValid;\n const _isEmpty = required && state.value === null;\n\n const onChange = useCallback(\n (html: string) => {\n if (isSubmitting) return;\n handleChange(html || null);\n },\n [isSubmitting, handleChange]\n );\n\n return (\n <FieldGroup className=\"gap-y-4 px-4\">\n <Field orientation=\"vertical\" data-invalid={_invalid}>\n <FieldContent>\n <FieldLabel aria-required={_isEmpty}>\n {label}\n {tooltip && <FieldTooltip tooltip={tooltip} />}\n </FieldLabel>\n <FieldDescription>{description}</FieldDescription>\n </FieldContent>\n <TextEditor value={state.value ?? ''} placeholder={placeholder} readOnly={isSubmitting} onChange={onChange} />\n {state.meta.isDirty && showErrorMessage && !!state.meta.errors.length && <FieldError errors={state.meta.errors} />}\n <FieldNote isShow={!!helperText}>{helperText}</FieldNote>\n </Field>\n <FieldSeparator />\n </FieldGroup>\n );\n});\nTextEditorField.displayName = 'TextEditorField';\n"],"mappings":"qaAaA,MAAa,EAAmC,GAAM,CAAE,QAAO,cAAa,cAAa,UAAS,aAAY,mBAAmB,GAAM,WAAW,MAAY,CAC5J,GAAM,CAAE,OAAM,QAAO,gBAAiB,EAAuC,EAEvE,EAAe,EAAS,EAAK,OAAQ,CAAE,kBAAmB,CAAY,EAEtE,EAAW,EAAM,KAAK,SAAW,EAAM,KAAK,WAAa,CAAC,EAAM,KAAK,QACrE,EAAW,GAAY,EAAM,QAAU,KAEvC,EAAW,EACd,GAAiB,CACZ,GACJ,EAAa,GAAQ,IAAI,CAC3B,EACA,CAAC,EAAc,CAAY,CAC7B,EAEA,OACE,EAAC,EAAD,CAAY,UAAU,wBAAtB,CACE,EAAC,EAAD,CAAO,YAAY,WAAW,eAAc,WAA5C,CACE,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAY,gBAAe,WAA3B,CACG,EACA,GAAW,EAAC,EAAD,CAAuB,SAAU,CAAA,CACnC,IACZ,EAAC,EAAD,CAAA,SAAmB,CAA8B,CAAA,CACrC,CAAA,CAAA,EACd,EAAC,EAAD,CAAY,MAAO,EAAM,OAAS,GAAiB,cAAa,SAAU,EAAwB,UAAW,CAAA,EAC5G,EAAM,KAAK,SAAW,GAAoB,CAAC,CAAC,EAAM,KAAK,OAAO,QAAU,EAAC,EAAD,CAAY,OAAQ,EAAM,KAAK,MAAS,CAAA,EACjH,EAAC,EAAD,CAAW,OAAQ,CAAC,CAAC,WAAa,CAAsB,CAAA,CACnD,IACP,EAAC,EAAD,CAAiB,CAAA,CACP,GAEhB,CAAC,EACD,EAAgB,YAAc"}
@@ -0,0 +1,2 @@
1
+ const e=require("./ui/input.cjs"),t=require("./tanstack-form-DS_ZvRl8.cjs"),n=require("./field-BV5twmKA.cjs");let r=require("lucide-react"),i=require("react"),a=require("@customafk/react-toolkit/utils"),o=require("react/jsx-runtime"),s=require("@tanstack/react-form");const c=e=>{e.key===`Enter`&&e.preventDefault()},l=(0,i.memo)(({label:l,description:u,placeholder:d,tooltip:f,helperText:p,counter:m=!1,orientation:h=`responsive`,showClearButton:g=!1,showErrorMessage:_=!0,required:v=!1,disabled:y=!1,maxLength:b})=>{let x=(0,i.useId)(),S=(0,i.useId)(),C=(0,i.useRef)(null),{form:w,name:T,state:E,handleBlur:D,handleChange:O}=t.G(),k=(0,s.useStore)(w.store,({isSubmitting:e})=>e),A=y||k,j=E.meta.isDirty||E.meta.isTouched,M=j&&!E.meta.isValid,N=v&&E.value===null,P=E.meta.errors.length>0,F=g&&!A&&!!E.value,I=m?E.value?.length??0:0,L=m&&!!b&&I>=b*.8,R=m&&!!b&&I>=b,z=m?b?`${I} / ${b} ký tự`:`${I} ký tự`:null,B=m||j&&_,V=(0,i.useCallback)(({target:{value:e}})=>{m&&b&&e.length>b||O(e||null)},[m,b,O]),H=(0,i.useCallback)(()=>{O(null),C.current?.focus()},[O]);return(0,o.jsxs)(n.FieldGroup,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(n.Field,{orientation:h,"data-invalid":M,children:[(0,o.jsxs)(n.FieldContent,{children:[(0,o.jsxs)(n.FieldLabel,{"aria-required":N,htmlFor:x,children:[l,f&&(0,o.jsx)(n.FieldTooltip,{tooltip:f})]}),u&&(0,o.jsx)(n.FieldDescription,{children:u})]}),(0,o.jsxs)(n.FieldContentMain,{children:[(0,o.jsx)(e.Input,{ref:C,id:x,name:T,value:E.value??``,"aria-invalid":M,"aria-describedby":S,autoComplete:`off`,placeholder:d,autoCapitalize:`none`,autoCorrect:`off`,disabled:A,className:(0,a.cn)(`pr-6`,A&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:D,onChange:V,onKeyDown:c}),F&&(0,o.jsx)(`button`,{type:`button`,"aria-label":`Xóa`,className:`absolute inset-e-1 top-2.5 flex size-4 cursor-pointer items-center justify-center rounded-md text-text-positive-weak outline-none transition-[color,transform] hover:text-text-positive focus-visible:text-primary-strong focus-visible:[&>svg]:scale-125 [&>svg]:size-3.5 [&>svg]:transition-transform`,onClick:H,children:(0,o.jsx)(r.XIcon,{"aria-hidden":`true`})}),k&&(0,o.jsx)(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak`,children:(0,o.jsx)(r.Loader2Icon,{size:14,className:`animate-spin text-primary-strong`})}),!F&&j&&_&&P&&(0,o.jsx)(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong`,children:(0,o.jsx)(r.BanIcon,{"aria-hidden":`true`,size:14})}),B&&(0,o.jsxs)(`div`,{className:`my-1 flex w-full items-start justify-between gap-x-2`,children:[j&&_?(0,o.jsx)(n.FieldError,{id:S,className:`flex-1`,errors:E.meta.errors}):(0,o.jsx)(`div`,{}),m&&(0,o.jsx)(`p`,{className:(0,a.cn)(`h-4 flex-0 text-nowrap text-end text-xs tabular-nums transition-colors`,R?`font-medium text-danger-strong`:L?`text-warning-strong`:`text-text-positive-weak`),children:z})]}),(0,o.jsx)(n.FieldNote,{isShow:!!p,children:p})]})]}),(0,o.jsx)(n.FieldSeparator,{})]})});l.displayName=`TextField`,exports.TextField=l;
2
+ //# sourceMappingURL=text-field-BhC_ik5w.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-field-BhC_ik5w.cjs","names":["useTanStackFieldContext","FieldGroup","Field","FieldContent","FieldLabel","FieldTooltip","FieldDescription","FieldContentMain","Input","XIcon","Loader2Icon","BanIcon","FieldError","FieldNote","FieldSeparator"],"sources":["../packages/components/features/tanstack-form/components/fields/text-field.tsx"],"sourcesContent":["'use client';\n\nimport { memo, useCallback, useId, useRef } from 'react';\n\nimport { useStore } from '@tanstack/react-form';\n\nimport { BanIcon, Loader2Icon, XIcon } from 'lucide-react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Input } from '@/components/ui/input';\nimport {\n Field,\n FieldContent,\n FieldContentMain,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldNote,\n FieldSeparator,\n FieldTooltip,\n} from '@/components/features/tanstack-form/components/ui/field';\nimport { useTanStackFieldContext } from '../form-context';\n\nimport type { TextFieldProps as Props } from '../../types';\n\n/** Fraction of maxLength at which the counter turns warning color (80%). */\nconst COUNTER_WARNING_THRESHOLD = 0.8;\n\n/** Pixel size for inline adornment icons (error ban, loading spinner). */\nconst ADORNMENT_ICON_SIZE = 14;\n\n// Static handler — no closure deps, shared across all TextField instances\nconst onKeyDown: React.KeyboardEventHandler<HTMLInputElement> = e => {\n if (e.key === 'Enter') e.preventDefault();\n};\n\n/**\n * A TanStack Form-connected single-line text input with label, validation, and optional features.\n *\n * Must be rendered inside an `AppField` context from `useTanStackForm`.\n * The field value type is `string | null` — `null` represents an empty/unset state.\n *\n * ---\n *\n * **Basic usage**\n * @example\n * const { AppField } = useTanStackForm({ defaultValues: { name: null } });\n *\n * <AppField name=\"name\">\n * {field => <field.TextField label=\"Full name\" placeholder=\"Nguyễn Văn A\" />}\n * </AppField>\n *\n * ---\n *\n * **With validation**\n * @example\n * <AppField\n * name=\"username\"\n * validators={{ onChange: ({ value }) => !value ? 'Bắt buộc' : undefined }}\n * >\n * {field => <field.TextField label=\"Username\" required />}\n * </AppField>\n *\n * ---\n *\n * **With character counter and max length**\n * @example\n * <AppField name=\"bio\">\n * {field => (\n * <field.TextField\n * label=\"Bio\"\n * counter\n * maxLength={160}\n * placeholder=\"Giới thiệu bản thân…\"\n * />\n * )}\n * </AppField>\n *\n * ---\n *\n * **With clear button and helper note**\n * @example\n * <AppField name=\"search\">\n * {field => (\n * <field.TextField\n * label=\"Tìm kiếm\"\n * showClearButton\n * helperText=\"Nhập ít nhất 3 ký tự để tìm kiếm.\"\n * />\n * )}\n * </AppField>\n *\n * ---\n *\n * **Horizontal layout**\n * @example\n * <AppField name=\"code\">\n * {field => (\n * <field.TextField\n * label=\"Mã sản phẩm\"\n * orientation=\"horizontal\"\n * tooltip=\"Mã duy nhất định danh sản phẩm trong hệ thống.\"\n * />\n * )}\n * </AppField>\n */\nexport const TextField = memo<Props>(\n ({\n label,\n description,\n placeholder,\n\n tooltip,\n helperText,\n counter = false,\n orientation = 'responsive',\n showClearButton = false,\n showErrorMessage = true,\n\n required = false,\n disabled = false,\n maxLength,\n }) => {\n const id = useId();\n const errorId = useId();\n const inputRef = useRef<HTMLInputElement>(null);\n const { form, name, state, handleBlur, handleChange } = useTanStackFieldContext<string | null>();\n\n const isSubmitting = useStore(form.store, ({ isSubmitting }) => isSubmitting);\n const isDisabled = disabled || isSubmitting;\n\n const _touched = state.meta.isDirty || state.meta.isTouched;\n const _invalid = _touched && !state.meta.isValid;\n const _isEmpty = required && state.value === null;\n const _hasErrors = state.meta.errors.length > 0;\n const _showClearButton = showClearButton && !isDisabled && !!state.value;\n\n // Counter values are only computed when the feature is active\n const _count = counter ? (state.value?.length ?? 0) : 0;\n const _isNearLimit = counter && !!maxLength && _count >= maxLength * COUNTER_WARNING_THRESHOLD;\n const _isAtLimit = counter && !!maxLength && _count >= maxLength;\n const _countText = counter ? (maxLength ? `${_count} / ${maxLength} ký tự` : `${_count} ký tự`) : null;\n\n // Skip the bottom row entirely when neither error nor counter will render\n const _showBottomRow = counter || (_touched && showErrorMessage);\n\n const onChange = useCallback<React.ChangeEventHandler<HTMLInputElement>>(\n ({ target: { value } }) => {\n if (counter && maxLength && value.length > maxLength) return;\n handleChange(value || null);\n },\n [counter, maxLength, handleChange]\n );\n\n const onClear = useCallback(() => {\n handleChange(null);\n inputRef.current?.focus();\n }, [handleChange]);\n\n return (\n <FieldGroup className=\"gap-y-4 px-4\">\n <Field orientation={orientation} data-invalid={_invalid}>\n <FieldContent>\n <FieldLabel aria-required={_isEmpty} htmlFor={id}>\n {label}\n {tooltip && <FieldTooltip tooltip={tooltip} />}\n </FieldLabel>\n {description && <FieldDescription>{description}</FieldDescription>}\n </FieldContent>\n <FieldContentMain>\n <Input\n ref={inputRef}\n id={id}\n name={name}\n value={state.value ?? ''}\n aria-invalid={_invalid}\n aria-describedby={errorId}\n autoComplete=\"off\"\n placeholder={placeholder}\n autoCapitalize=\"none\"\n autoCorrect=\"off\"\n disabled={isDisabled}\n className={cn('pr-6', isDisabled && 'pointer-events-none bg-muted-muted opacity-60')}\n onBlur={handleBlur}\n onChange={onChange}\n onKeyDown={onKeyDown}\n />\n {_showClearButton && (\n <button\n type=\"button\"\n aria-label=\"Xóa\"\n className=\"absolute inset-e-1 top-2.5 flex size-4 cursor-pointer items-center justify-center rounded-md text-text-positive-weak outline-none transition-[color,transform] hover:text-text-positive focus-visible:text-primary-strong focus-visible:[&>svg]:scale-125 [&>svg]:size-3.5 [&>svg]:transition-transform\"\n onClick={onClear}\n >\n <XIcon aria-hidden=\"true\" />\n </button>\n )}\n {isSubmitting && (\n <div className=\"absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak\">\n <Loader2Icon size={ADORNMENT_ICON_SIZE} className=\"animate-spin text-primary-strong\" />\n </div>\n )}\n {!_showClearButton && _touched && showErrorMessage && _hasErrors && (\n <div className=\"absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong\">\n <BanIcon aria-hidden=\"true\" size={ADORNMENT_ICON_SIZE} />\n </div>\n )}\n {_showBottomRow && (\n <div className=\"my-1 flex w-full items-start justify-between gap-x-2\">\n {_touched && showErrorMessage ? <FieldError id={errorId} className=\"flex-1\" errors={state.meta.errors} /> : <div />}\n {counter && (\n <p\n className={cn(\n 'h-4 flex-0 text-nowrap text-end text-xs tabular-nums transition-colors',\n _isAtLimit ? 'font-medium text-danger-strong' : _isNearLimit ? 'text-warning-strong' : 'text-text-positive-weak'\n )}\n >\n {_countText}\n </p>\n )}\n </div>\n )}\n <FieldNote isShow={!!helperText}>{helperText}</FieldNote>\n </FieldContentMain>\n </Field>\n <FieldSeparator />\n </FieldGroup>\n );\n }\n);\n\nTextField.displayName = 'TextField';\n"],"mappings":"4QA4BA,MAMM,EAA0D,GAAK,CAC/D,EAAE,MAAQ,SAAS,EAAE,eAAe,CAC1C,EAwEa,GAAA,EAAA,EAAA,KAAA,EACV,CACC,QACA,cACA,cAEA,UACA,aACA,UAAU,GACV,cAAc,aACd,kBAAkB,GAClB,mBAAmB,GAEnB,WAAW,GACX,WAAW,GACX,eACI,CACJ,IAAM,GAAA,EAAA,EAAA,MAAA,CAAW,EACX,GAAA,EAAA,EAAA,MAAA,CAAgB,EAChB,GAAA,EAAA,EAAA,OAAA,CAAoC,IAAI,EACxC,CAAE,OAAM,OAAM,QAAO,aAAY,gBAAiBA,EAAAA,EAAuC,EAEzF,GAAA,EAAA,EAAA,SAAA,CAAwB,EAAK,OAAQ,CAAE,kBAAmB,CAAY,EACtE,EAAa,GAAY,EAEzB,EAAW,EAAM,KAAK,SAAW,EAAM,KAAK,UAC5C,EAAW,GAAY,CAAC,EAAM,KAAK,QACnC,EAAW,GAAY,EAAM,QAAU,KACvC,EAAa,EAAM,KAAK,OAAO,OAAS,EACxC,EAAmB,GAAmB,CAAC,GAAc,CAAC,CAAC,EAAM,MAG7D,EAAS,EAAW,EAAM,OAAO,QAAU,EAAK,EAChD,EAAe,GAAW,CAAC,CAA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L,aAAW,MACX,UAAU,0SACV,QAAS,YAET,EAAA,EAAA,IAAA,CAACC,EAAAA,MAAD,CAAO,cAAY,MAAQ,CAAA,CACrB,CAAA,EAET,IACC,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,iEACb,EAAA,EAAA,IAAA,CAACC,EAAAA,YAAD,CAAa,KAAM,GAAqB,UAAU,kCAAoC,CAAA,CACnF,CAAA,EAEN,CAAC,GAAoB,GAAY,GAAoB,IACpD,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,oEACb,EAAA,EAAA,IAAA,CAACC,EAAAA,QAAD,CAAS,cAAY,OAAO,KAAM,EAAsB,CAAA,CACrD,CAAA,EAEN,IACC,EAAA,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,gEAAf,CACG,GAAY,GAAmB,EAAA,EAAA,IAAA,CAACC,EAAAA,WAAD,CAAY,GAAI,EAAS,UAAU,SAAS,OAAQ,EAAM,KAAK,MAAS,CAAA,GAAI,EAAA,EAAA,IAAA,CAAC,MAAD,CAAM,CAAA,EACjH,IACC,EAAA,EAAA,IAAA,CAAC,IAAD,CACE,WAAA,EAAA,EAAA,GAAA,CACE,yEACA,EAAa,iCAAmC,EAAe,sBAAwB,yBACzF,WAEC,CACA,CAAA,CAEF,KAEP,EAAA,EAAA,IAAA,CAACC,EAAAA,UAAD,CAAW,OAAQ,CAAC,CAAC,WAAa,CAAsB,CAAA,CACxC,CAAA,CAAA,CACb,KACP,EAAA,EAAA,IAAA,CAACC,EAAAA,eAAD,CAAiB,CAAA,CACP,GAEhB,CACF,EAEA,EAAU,YAAc"}
@@ -0,0 +1,2 @@
1
+ import{Input as e}from"./ui/input.mjs";import{G as t}from"./tanstack-form-CM_Hb3JT.mjs";import{Field as n,FieldContent as r,FieldContentMain as i,FieldDescription as a,FieldError as o,FieldGroup as s,FieldLabel as c,FieldNote as l,FieldSeparator as u,FieldTooltip as d}from"./field-BKyUqvzh.mjs";import{BanIcon as f,Loader2Icon as p,XIcon as m}from"lucide-react";import{memo as h,useCallback as g,useId as _,useRef as v}from"react";import{cn as y}from"@customafk/react-toolkit/utils";import{jsx as b,jsxs as x}from"react/jsx-runtime";import{useStore as S}from"@tanstack/react-form";const C=e=>{e.key===`Enter`&&e.preventDefault()},w=h(({label:h,description:w,placeholder:T,tooltip:E,helperText:D,counter:O=!1,orientation:k=`responsive`,showClearButton:A=!1,showErrorMessage:j=!0,required:M=!1,disabled:N=!1,maxLength:P})=>{let F=_(),I=_(),L=v(null),{form:R,name:z,state:B,handleBlur:V,handleChange:H}=t(),U=S(R.store,({isSubmitting:e})=>e),W=N||U,G=B.meta.isDirty||B.meta.isTouched,K=G&&!B.meta.isValid,q=M&&B.value===null,J=B.meta.errors.length>0,Y=A&&!W&&!!B.value,X=O?B.value?.length??0:0,Z=O&&!!P&&X>=P*.8,Q=O&&!!P&&X>=P,$=O?P?`${X} / ${P} ký tự`:`${X} ký tự`:null,ee=O||G&&j,te=g(({target:{value:e}})=>{O&&P&&e.length>P||H(e||null)},[O,P,H]),ne=g(()=>{H(null),L.current?.focus()},[H]);return x(s,{className:`gap-y-4 px-4`,children:[x(n,{orientation:k,"data-invalid":K,children:[x(r,{children:[x(c,{"aria-required":q,htmlFor:F,children:[h,E&&b(d,{tooltip:E})]}),w&&b(a,{children:w})]}),x(i,{children:[b(e,{ref:L,id:F,name:z,value:B.value??``,"aria-invalid":K,"aria-describedby":I,autoComplete:`off`,placeholder:T,autoCapitalize:`none`,autoCorrect:`off`,disabled:W,className:y(`pr-6`,W&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:V,onChange:te,onKeyDown:C}),Y&&b(`button`,{type:`button`,"aria-label":`Xóa`,className:`absolute inset-e-1 top-2.5 flex size-4 cursor-pointer items-center justify-center rounded-md text-text-positive-weak outline-none transition-[color,transform] hover:text-text-positive focus-visible:text-primary-strong focus-visible:[&>svg]:scale-125 [&>svg]:size-3.5 [&>svg]:transition-transform`,onClick:ne,children:b(m,{"aria-hidden":`true`})}),U&&b(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak`,children:b(p,{size:14,className:`animate-spin text-primary-strong`})}),!Y&&G&&j&&J&&b(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong`,children:b(f,{"aria-hidden":`true`,size:14})}),ee&&x(`div`,{className:`my-1 flex w-full items-start justify-between gap-x-2`,children:[G&&j?b(o,{id:I,className:`flex-1`,errors:B.meta.errors}):b(`div`,{}),O&&b(`p`,{className:y(`h-4 flex-0 text-nowrap text-end text-xs tabular-nums transition-colors`,Q?`font-medium text-danger-strong`:Z?`text-warning-strong`:`text-text-positive-weak`),children:$})]}),b(l,{isShow:!!D,children:D})]})]}),b(u,{})]})});w.displayName=`TextField`;export{w as TextField};
2
+ //# sourceMappingURL=text-field-qhiYvQKt.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-field-qhiYvQKt.mjs","names":[],"sources":["../packages/components/features/tanstack-form/components/fields/text-field.tsx"],"sourcesContent":["'use client';\n\nimport { memo, useCallback, useId, useRef } from 'react';\n\nimport { useStore } from '@tanstack/react-form';\n\nimport { BanIcon, Loader2Icon, XIcon } from 'lucide-react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Input } from '@/components/ui/input';\nimport {\n Field,\n FieldContent,\n FieldContentMain,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldNote,\n FieldSeparator,\n FieldTooltip,\n} from '@/components/features/tanstack-form/components/ui/field';\nimport { useTanStackFieldContext } from '../form-context';\n\nimport type { TextFieldProps as Props } from '../../types';\n\n/** Fraction of maxLength at which the counter turns warning color (80%). */\nconst COUNTER_WARNING_THRESHOLD = 0.8;\n\n/** Pixel size for inline adornment icons (error ban, loading spinner). */\nconst ADORNMENT_ICON_SIZE = 14;\n\n// Static handler — no closure deps, shared across all TextField instances\nconst onKeyDown: React.KeyboardEventHandler<HTMLInputElement> = e => {\n if (e.key === 'Enter') e.preventDefault();\n};\n\n/**\n * A TanStack Form-connected single-line text input with label, validation, and optional features.\n *\n * Must be rendered inside an `AppField` context from `useTanStackForm`.\n * The field value type is `string | null` — `null` represents an empty/unset state.\n *\n * ---\n *\n * **Basic usage**\n * @example\n * const { AppField } = useTanStackForm({ defaultValues: { name: null } });\n *\n * <AppField name=\"name\">\n * {field => <field.TextField label=\"Full name\" placeholder=\"Nguyễn Văn A\" />}\n * </AppField>\n *\n * ---\n *\n * **With validation**\n * @example\n * <AppField\n * name=\"username\"\n * validators={{ onChange: ({ value }) => !value ? 'Bắt buộc' : undefined }}\n * >\n * {field => <field.TextField label=\"Username\" required />}\n * </AppField>\n *\n * ---\n *\n * **With character counter and max length**\n * @example\n * <AppField name=\"bio\">\n * {field => (\n * <field.TextField\n * label=\"Bio\"\n * counter\n * maxLength={160}\n * placeholder=\"Giới thiệu bản thân…\"\n * />\n * )}\n * </AppField>\n *\n * ---\n *\n * **With clear button and helper note**\n * @example\n * <AppField name=\"search\">\n * {field => (\n * <field.TextField\n * label=\"Tìm kiếm\"\n * showClearButton\n * helperText=\"Nhập ít nhất 3 ký tự để tìm kiếm.\"\n * />\n * )}\n * </AppField>\n *\n * ---\n *\n * **Horizontal layout**\n * @example\n * <AppField name=\"code\">\n * {field => (\n * <field.TextField\n * label=\"Mã sản phẩm\"\n * orientation=\"horizontal\"\n * tooltip=\"Mã duy nhất định danh sản phẩm trong hệ thống.\"\n * />\n * )}\n * </AppField>\n */\nexport const TextField = memo<Props>(\n ({\n label,\n description,\n placeholder,\n\n tooltip,\n helperText,\n counter = false,\n orientation = 'responsive',\n showClearButton = false,\n showErrorMessage = true,\n\n required = false,\n disabled = false,\n maxLength,\n }) => {\n const id = useId();\n const errorId = useId();\n const inputRef = useRef<HTMLInputElement>(null);\n const { form, name, state, handleBlur, handleChange } = useTanStackFieldContext<string | null>();\n\n const isSubmitting = useStore(form.store, ({ isSubmitting }) => isSubmitting);\n const isDisabled = disabled || isSubmitting;\n\n const _touched = state.meta.isDirty || state.meta.isTouched;\n const _invalid = _touched && !state.meta.isValid;\n const _isEmpty = required && state.value === null;\n const _hasErrors = state.meta.errors.length > 0;\n const _showClearButton = showClearButton && !isDisabled && !!state.value;\n\n // Counter values are only computed when the feature is active\n const _count = counter ? (state.value?.length ?? 0) : 0;\n const _isNearLimit = counter && !!maxLength && _count >= maxLength * COUNTER_WARNING_THRESHOLD;\n const _isAtLimit = counter && !!maxLength && _count >= maxLength;\n const _countText = counter ? (maxLength ? `${_count} / ${maxLength} ký tự` : `${_count} ký tự`) : null;\n\n // Skip the bottom row entirely when neither error nor counter will render\n const _showBottomRow = counter || (_touched && showErrorMessage);\n\n const onChange = useCallback<React.ChangeEventHandler<HTMLInputElement>>(\n ({ target: { value } }) => {\n if (counter && maxLength && value.length > maxLength) return;\n handleChange(value || null);\n },\n [counter, maxLength, handleChange]\n );\n\n const onClear = useCallback(() => {\n handleChange(null);\n inputRef.current?.focus();\n }, [handleChange]);\n\n return (\n <FieldGroup className=\"gap-y-4 px-4\">\n <Field orientation={orientation} data-invalid={_invalid}>\n <FieldContent>\n <FieldLabel aria-required={_isEmpty} htmlFor={id}>\n {label}\n {tooltip && <FieldTooltip tooltip={tooltip} />}\n </FieldLabel>\n {description && <FieldDescription>{description}</FieldDescription>}\n </FieldContent>\n <FieldContentMain>\n <Input\n ref={inputRef}\n id={id}\n name={name}\n value={state.value ?? ''}\n aria-invalid={_invalid}\n aria-describedby={errorId}\n autoComplete=\"off\"\n placeholder={placeholder}\n autoCapitalize=\"none\"\n autoCorrect=\"off\"\n disabled={isDisabled}\n className={cn('pr-6', isDisabled && 'pointer-events-none bg-muted-muted opacity-60')}\n onBlur={handleBlur}\n onChange={onChange}\n onKeyDown={onKeyDown}\n />\n {_showClearButton && (\n <button\n type=\"button\"\n aria-label=\"Xóa\"\n className=\"absolute inset-e-1 top-2.5 flex size-4 cursor-pointer items-center justify-center rounded-md text-text-positive-weak outline-none transition-[color,transform] hover:text-text-positive focus-visible:text-primary-strong focus-visible:[&>svg]:scale-125 [&>svg]:size-3.5 [&>svg]:transition-transform\"\n onClick={onClear}\n >\n <XIcon aria-hidden=\"true\" />\n </button>\n )}\n {isSubmitting && (\n <div className=\"absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak\">\n <Loader2Icon size={ADORNMENT_ICON_SIZE} className=\"animate-spin text-primary-strong\" />\n </div>\n )}\n {!_showClearButton && _touched && showErrorMessage && _hasErrors && (\n <div className=\"absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong\">\n <BanIcon aria-hidden=\"true\" size={ADORNMENT_ICON_SIZE} />\n </div>\n )}\n {_showBottomRow && (\n <div className=\"my-1 flex w-full items-start justify-between gap-x-2\">\n {_touched && showErrorMessage ? <FieldError id={errorId} className=\"flex-1\" errors={state.meta.errors} /> : <div />}\n {counter && (\n <p\n className={cn(\n 'h-4 flex-0 text-nowrap text-end text-xs tabular-nums transition-colors',\n _isAtLimit ? 'font-medium text-danger-strong' : _isNearLimit ? 'text-warning-strong' : 'text-text-positive-weak'\n )}\n >\n {_countText}\n </p>\n )}\n </div>\n )}\n <FieldNote isShow={!!helperText}>{helperText}</FieldNote>\n </FieldContentMain>\n </Field>\n <FieldSeparator />\n </FieldGroup>\n );\n }\n);\n\nTextField.displayName = 'TextField';\n"],"mappings":"skBA4BA,MAMM,EAA0D,GAAK,CAC/D,EAAE,MAAQ,SAAS,EAAE,eAAe,CAC1C,EAwEa,EAAY,GACtB,CACC,QACA,cACA,cAEA,UACA,aACA,UAAU,GACV,cAAc,aACd,kBAAkB,GAClB,mBAAmB,GAEnB,WAAW,GACX,WAAW,GACX,eACI,CACJ,IAAM,EAAK,EAAM,EACX,EAAU,EAAM,EAChB,EAAW,EAAyB,IAAI,EACxC,CAAE,OAAM,OAAM,QAAO,aAAY,gBAAiB,EAAuC,EAEzF,EAAe,EAAS,EAAK,OAAQ,CAAE,kBAAmB,CAAY,EACtE,EAAa,GAAY,EAEzB,EAAW,EAAM,KAAK,SAAW,EAAM,KAAK,UAC5C,EA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AAQ,CAAA,CACrB,CAAA,EAET,GACC,EAAC,MAAD,CAAK,UAAU,gEACb,EAAC,EAAD,CAAa,KAAM,GAAqB,UAAU,kCAAoC,CAAA,CACnF,CAAA,EAEN,CAAC,GAAoB,GAAY,GAAoB,GACpD,EAAC,MAAD,CAAK,UAAU,mEACb,EAAC,EAAD,CAAS,cAAY,OAAO,KAAM,EAAsB,CAAA,CACrD,CAAA,EAEN,IACC,EAAC,MAAD,CAAK,UAAU,gEAAf,CACG,GAAY,EAAmB,EAAC,EAAD,CAAY,GAAI,EAAS,UAAU,SAAS,OAAQ,EAAM,KAAK,MAAS,CAAA,EAAI,EAAC,MAAD,CAAM,CAAA,EACjH,GACC,EAAC,IAAD,CACE,UAAW,EACT,yEACA,EAAa,iCAAmC,EAAe,sBAAwB,yBACzF,WAEC,CACA,CAAA,CAEF,IAEP,EAAC,EAAD,CAAW,OAAQ,CAAC,CAAC,WAAa,CAAsB,CAAA,CACxC,CAAA,CAAA,CACb,IACP,EAAC,EAAD,CAAiB,CAAA,CACP,GAEhB,CACF,EAEA,EAAU,YAAc"}
@@ -0,0 +1,2 @@
1
+ const e=require("./tanstack-form-DS_ZvRl8.cjs"),t=require("./ui/textarea.cjs"),n=require("./field-BV5twmKA.cjs");let r=require("lucide-react"),i=require("react"),a=require("@customafk/react-toolkit/utils"),o=require("react/jsx-runtime"),s=require("@tanstack/react-form");const c=(0,i.memo)(({label:c,description:l,placeholder:u,tooltip:d,helperText:f,counter:p=!1,orientation:m=`responsive`,showErrorMessage:h=!0,required:g=!1,disabled:_=!1,maxLength:v})=>{let y=(0,i.useId)(),b=(0,i.useId)(),[x,S]=(0,i.useState)(!1),C=(0,i.useRef)(null),{form:w,state:T,name:E,handleBlur:D,handleChange:O}=e.G(),k=(0,s.useStore)(w.store,({isSubmitting:e})=>e),A=_||k,j=T.value?.length??0,M=(0,i.useMemo)(()=>p?v?`${j} / ${v} ký tự`:`${j} ký tự`:``,[j,p,v]),N=!!v&&j>=v*.8,P=!!v&&j>=v,F=T.meta.isDirty||T.meta.isTouched,I=F&&!T.meta.isValid,L=g&&T.value===null,R=!!T.meta.errors.length,z=!!T.value&&!A,B=(0,i.useMemo)(()=>(0,a.cn)(`h-4 flex-0 text-nowrap text-end text-xs tabular-nums transition-colors`,P?`font-medium text-danger-strong`:N?`text-warning-strong`:`text-text-positive-weak`),[P,N]),V=(0,i.useCallback)(({target:{value:e}})=>{A||p&&v&&e.length>v||O(e||null)},[A,p,v,O]),H=(0,i.useCallback)(async()=>{T.value&&(await navigator.clipboard.writeText(T.value),C.current!==null&&window.clearTimeout(C.current),S(!0),C.current=window.setTimeout(()=>S(!1),1500))},[T.value]);return(0,i.useEffect)(()=>()=>{C.current!==null&&window.clearTimeout(C.current)},[]),(0,o.jsxs)(n.FieldGroup,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(n.Field,{orientation:m,"data-invalid":I,children:[(0,o.jsxs)(n.FieldContent,{children:[(0,o.jsxs)(n.FieldLabel,{"aria-required":L,htmlFor:y,children:[c,d&&(0,o.jsx)(n.FieldTooltip,{tooltip:d})]}),(0,o.jsx)(n.FieldDescription,{children:l})]}),(0,o.jsxs)(n.FieldContentMain,{children:[(0,o.jsx)(t.Textarea,{id:y,name:E,value:T.value??``,"aria-invalid":I,"aria-describedby":b,autoCapitalize:`none`,autoComplete:`off`,autoCorrect:`off`,placeholder:u,disabled:A,className:(0,a.cn)(A&&`pointer-events-none bg-muted-muted opacity-60`),onChange:V,onBlur:D}),z&&(0,o.jsx)(`button`,{type:`button`,"aria-label":`Sao chép`,className:`absolute inset-e-1 top-2 flex size-4 cursor-pointer items-center justify-center rounded-md outline-none transition-[color,transform] focus-visible:[&>svg]:scale-125 [&>svg]:size-3.5 [&>svg]:transition-transform`,onClick:H,children:x?(0,o.jsx)(r.CheckIcon,{"aria-hidden":`true`,className:`text-success-strong`}):(0,o.jsx)(r.CopyIcon,{"aria-hidden":`true`,className:`text-text-positive-weak transition-colors hover:text-text-positive focus-visible:text-primary-strong`})}),k&&(0,o.jsx)(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak`,children:(0,o.jsx)(r.Loader2Icon,{size:14,className:`animate-spin text-primary-strong`})}),!z&&F&&h&&R&&(0,o.jsx)(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong`,children:(0,o.jsx)(r.BanIcon,{size:14})}),(0,o.jsxs)(`div`,{className:`my-1 flex w-full items-start justify-between gap-x-2`,children:[F&&h?(0,o.jsx)(n.FieldError,{id:b,className:`flex-1`,errors:T.meta.errors}):(0,o.jsx)(`div`,{}),!!p&&(0,o.jsx)(`p`,{className:B,children:M})]}),(0,o.jsx)(n.FieldNote,{isShow:!!f,children:f})]})]}),(0,o.jsx)(n.FieldSeparator,{})]})});c.displayName=`TextareaField`,exports.TextareaField=c;
2
+ //# sourceMappingURL=textarea-field-C-7ZoUMz.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textarea-field-C-7ZoUMz.cjs","names":["useTanStackFieldContext","FieldGroup","Field","FieldContent","FieldLabel","FieldTooltip","FieldDescription","FieldContentMain","Textarea","CheckIcon","CopyIcon","Loader2Icon","BanIcon","FieldError","FieldNote","FieldSeparator"],"sources":["../packages/components/features/tanstack-form/components/fields/textarea-field.tsx"],"sourcesContent":["'use client';\n\nimport { memo, useCallback, useEffect, useId, useMemo, useRef, useState } from 'react';\n\nimport { useStore } from '@tanstack/react-form';\n\nimport { BanIcon, CheckIcon, CopyIcon, Loader2Icon } from 'lucide-react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Textarea } from '@/components/ui/textarea';\n\nimport { useTanStackFieldContext } from '../form-context';\nimport {\n Field,\n FieldContent,\n FieldContentMain,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldNote,\n FieldSeparator,\n FieldTooltip,\n} from '../ui/field';\n\nimport type { TextareaFieldProps as Props } from '../../types';\n\nexport const TextareaField = memo<Props>(\n ({\n label,\n description,\n placeholder,\n\n tooltip,\n helperText,\n counter = false,\n orientation = 'responsive',\n showErrorMessage = true,\n\n required = false,\n disabled = false,\n maxLength,\n }) => {\n const id = useId();\n const errorId = useId();\n const [copied, setCopied] = useState(false);\n const copyTimeoutRef = useRef<number | null>(null);\n\n const { form, state, name, handleBlur, handleChange } = useTanStackFieldContext<string | null>();\n\n const isSubmitting = useStore(form.store, ({ isSubmitting }) => isSubmitting);\n const isDisabled = disabled || isSubmitting;\n\n const _count = state.value?.length ?? 0;\n\n const _countText = useMemo(() => {\n if (!counter) return '';\n return maxLength ? `${_count} / ${maxLength} ký tự` : `${_count} ký tự`;\n }, [_count, counter, maxLength]);\n\n const _isNearLimit = !!maxLength && _count >= maxLength * 0.8;\n const _isAtLimit = !!maxLength && _count >= maxLength;\n\n const _touched = state.meta.isDirty || state.meta.isTouched;\n const _invalid = _touched && !state.meta.isValid;\n const _isEmpty = required && state.value === null;\n const _hasErrors = !!state.meta.errors.length;\n const _showCopy = !!state.value && !isDisabled;\n\n const _counterClass = useMemo(\n () =>\n cn(\n 'h-4 flex-0 text-nowrap text-end text-xs tabular-nums transition-colors',\n _isAtLimit ? 'font-medium text-danger-strong' : _isNearLimit ? 'text-warning-strong' : 'text-text-positive-weak'\n ),\n [_isAtLimit, _isNearLimit]\n );\n\n const onChange = useCallback<React.ChangeEventHandler<HTMLTextAreaElement>>(\n ({ target: { value } }) => {\n if (isDisabled) return;\n if (counter && maxLength && value.length > maxLength) return;\n handleChange(value || null);\n },\n [isDisabled, counter, maxLength, handleChange]\n );\n\n const onCopy = useCallback(async () => {\n if (!state.value) return;\n await navigator.clipboard.writeText(state.value);\n if (copyTimeoutRef.current !== null) window.clearTimeout(copyTimeoutRef.current);\n setCopied(true);\n copyTimeoutRef.current = window.setTimeout(() => setCopied(false), 1500);\n }, [state.value]);\n\n useEffect(() => {\n return () => {\n if (copyTimeoutRef.current !== null) window.clearTimeout(copyTimeoutRef.current);\n };\n }, []);\n\n return (\n <FieldGroup className=\"gap-y-4 px-4\">\n <Field orientation={orientation} data-invalid={_invalid}>\n <FieldContent>\n <FieldLabel aria-required={_isEmpty} htmlFor={id}>\n {label}\n {tooltip && <FieldTooltip tooltip={tooltip} />}\n </FieldLabel>\n <FieldDescription>{description}</FieldDescription>\n </FieldContent>\n <FieldContentMain>\n <Textarea\n id={id}\n name={name}\n value={state.value ?? ''}\n aria-invalid={_invalid}\n aria-describedby={errorId}\n autoCapitalize=\"none\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n placeholder={placeholder}\n disabled={isDisabled}\n className={cn(isDisabled && 'pointer-events-none bg-muted-muted opacity-60')}\n onChange={onChange}\n onBlur={handleBlur}\n />\n {_showCopy && (\n <button\n type=\"button\"\n aria-label=\"Sao chép\"\n className=\"absolute inset-e-1 top-2 flex size-4 cursor-pointer items-center justify-center rounded-md outline-none transition-[color,transform] focus-visible:[&>svg]:scale-125 [&>svg]:size-3.5 [&>svg]:transition-transform\"\n onClick={onCopy}\n >\n {copied ? (\n <CheckIcon aria-hidden=\"true\" className=\"text-success-strong\" />\n ) : (\n <CopyIcon\n aria-hidden=\"true\"\n className=\"text-text-positive-weak transition-colors hover:text-text-positive focus-visible:text-primary-strong\"\n />\n )}\n </button>\n )}\n {isSubmitting && (\n <div className=\"absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak\">\n <Loader2Icon size={14} className=\"animate-spin text-primary-strong\" />\n </div>\n )}\n {!_showCopy && _touched && showErrorMessage && _hasErrors && (\n <div className=\"absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong\">\n <BanIcon size={14} />\n </div>\n )}\n <div className=\"my-1 flex w-full items-start justify-between gap-x-2\">\n {_touched && showErrorMessage ? <FieldError id={errorId} className=\"flex-1\" errors={state.meta.errors} /> : <div />}\n {!!counter && <p className={_counterClass}>{_countText}</p>}\n </div>\n <FieldNote isShow={!!helperText}>{helperText}</FieldNote>\n </FieldContentMain>\n </Field>\n <FieldSeparator />\n </FieldGroup>\n );\n }\n);\n\nTextareaField.displ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AAuB,CAAA,GAE/D,EAAA,EAAA,IAAA,CAACC,EAAAA,SAAD,CACE,cAAY,OACZ,UAAU,sGACX,CAAA,CAEG,CAAA,EAET,IACC,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,iEACb,EAAA,EAAA,IAAA,CAACC,EAAAA,YAAD,CAAa,KAAM,GAAI,UAAU,kCAAoC,CAAA,CAClE,CAAA,EAEN,CAAC,GAAa,GAAY,GAAoB,IAC7C,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,oEACb,EAAA,EAAA,IAAA,CAACC,EAAAA,QAAD,CAAS,KAAM,EAAK,CAAA,CACjB,CAAA,GAEP,EAAA,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,gEAAf,CACG,GAAY,GAAmB,EAAA,EAAA,IAAA,CAACC,EAAAA,WAAD,CAAY,GAAI,EAAS,UAAU,SAAS,OAAQ,EAAM,KAAK,MAAS,CAAA,GAAI,EAAA,EAAA,IAAA,CAAC,MAAD,CAAM,CAAA,EACjH,CAAC,CAAC,IAAW,EAAA,EAAA,IAAA,CAAC,IAAD,CAAG,UAAW,WAAgB,CAAc,CAAA,CACvD,KACL,EAAA,EAAA,IAAA,CAACC,EAAAA,UAAD,CAAW,OAAQ,CAAC,CAAC,WAAa,CAAsB,CAAA,CACxC,CAAA,CAAA,CACb,KACP,EAAA,EAAA,IAAA,CAACC,EAAAA,eAAD,CAAiB,CAAA,CACP,GAEhB,CACF,EAEA,EAAc,YAAc"}
@@ -0,0 +1,2 @@
1
+ import{G as e}from"./tanstack-form-CM_Hb3JT.mjs";import{Textarea as t}from"./ui/textarea.mjs";import{Field as n,FieldContent as r,FieldContentMain as i,FieldDescription as a,FieldError as o,FieldGroup as s,FieldLabel as c,FieldNote as l,FieldSeparator as u,FieldTooltip as d}from"./field-BKyUqvzh.mjs";import{BanIcon as f,CheckIcon as p,CopyIcon as ee,Loader2Icon as m}from"lucide-react";import{memo as h,useCallback as g,useEffect as _,useId as v,useMemo as y,useRef as b,useState as x}from"react";import{cn as S}from"@customafk/react-toolkit/utils";import{jsx as C,jsxs as w}from"react/jsx-runtime";import{useStore as T}from"@tanstack/react-form";const E=h(({label:h,description:E,placeholder:te,tooltip:D,helperText:O,counter:k=!1,orientation:A=`responsive`,showErrorMessage:j=!0,required:M=!1,disabled:N=!1,maxLength:P})=>{let F=v(),I=v(),[L,R]=x(!1),z=b(null),{form:B,state:V,name:H,handleBlur:U,handleChange:W}=e(),G=T(B.store,({isSubmitting:e})=>e),K=N||G,q=V.value?.length??0,J=y(()=>k?P?`${q} / ${P} ký tự`:`${q} ký tự`:``,[q,k,P]),Y=!!P&&q>=P*.8,X=!!P&&q>=P,Z=V.meta.isDirty||V.meta.isTouched,Q=Z&&!V.meta.isValid,ne=M&&V.value===null,re=!!V.meta.errors.length,$=!!V.value&&!K,ie=y(()=>S(`h-4 flex-0 text-nowrap text-end text-xs tabular-nums transition-colors`,X?`font-medium text-danger-strong`:Y?`text-warning-strong`:`text-text-positive-weak`),[X,Y]),ae=g(({target:{value:e}})=>{K||k&&P&&e.length>P||W(e||null)},[K,k,P,W]),oe=g(async()=>{V.value&&(await navigator.clipboard.writeText(V.value),z.current!==null&&window.clearTimeout(z.current),R(!0),z.current=window.setTimeout(()=>R(!1),1500))},[V.value]);return _(()=>()=>{z.current!==null&&window.clearTimeout(z.current)},[]),w(s,{className:`gap-y-4 px-4`,children:[w(n,{orientation:A,"data-invalid":Q,children:[w(r,{children:[w(c,{"aria-required":ne,htmlFor:F,children:[h,D&&C(d,{tooltip:D})]}),C(a,{children:E})]}),w(i,{children:[C(t,{id:F,name:H,value:V.value??``,"aria-invalid":Q,"aria-describedby":I,autoCapitalize:`none`,autoComplete:`off`,autoCorrect:`off`,placeholder:te,disabled:K,className:S(K&&`pointer-events-none bg-muted-muted opacity-60`),onChange:ae,onBlur:U}),$&&C(`button`,{type:`button`,"aria-label":`Sao chép`,className:`absolute inset-e-1 top-2 flex size-4 cursor-pointer items-center justify-center rounded-md outline-none transition-[color,transform] focus-visible:[&>svg]:scale-125 [&>svg]:size-3.5 [&>svg]:transition-transform`,onClick:oe,children:L?C(p,{"aria-hidden":`true`,className:`text-success-strong`}):C(ee,{"aria-hidden":`true`,className:`text-text-positive-weak transition-colors hover:text-text-positive focus-visible:text-primary-strong`})}),G&&C(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak`,children:C(m,{size:14,className:`animate-spin text-primary-strong`})}),!$&&Z&&j&&re&&C(`div`,{className:`absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong`,children:C(f,{size:14})}),w(`div`,{className:`my-1 flex w-full items-start justify-between gap-x-2`,children:[Z&&j?C(o,{id:I,className:`flex-1`,errors:V.meta.errors}):C(`div`,{}),!!k&&C(`p`,{className:ie,children:J})]}),C(l,{isShow:!!O,children:O})]})]}),C(u,{})]})});E.displayName=`TextareaField`;export{E as TextareaField};
2
+ //# sourceMappingURL=textarea-field-DqDciVSB.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textarea-field-DqDciVSB.mjs","names":[],"sources":["../packages/components/features/tanstack-form/components/fields/textarea-field.tsx"],"sourcesContent":["'use client';\n\nimport { memo, useCallback, useEffect, useId, useMemo, useRef, useState } from 'react';\n\nimport { useStore } from '@tanstack/react-form';\n\nimport { BanIcon, CheckIcon, CopyIcon, Loader2Icon } from 'lucide-react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Textarea } from '@/components/ui/textarea';\n\nimport { useTanStackFieldContext } from '../form-context';\nimport {\n Field,\n FieldContent,\n FieldContentMain,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLabel,\n FieldNote,\n FieldSeparator,\n FieldTooltip,\n} from '../ui/field';\n\nimport type { TextareaFieldProps as Props } from '../../types';\n\nexport const TextareaField = memo<Props>(\n ({\n label,\n description,\n placeholder,\n\n tooltip,\n helperText,\n counter = false,\n orientation = 'responsive',\n showErrorMessage = true,\n\n required = false,\n disabled = false,\n maxLength,\n }) => {\n const id = useId();\n const errorId = useId();\n const [copied, setCopied] = useState(false);\n const copyTimeoutRef = useRef<number | null>(null);\n\n const { form, state, name, handleBlur, handleChange } = useTanStackFieldContext<string | null>();\n\n const isSubmitting = useStore(form.store, ({ isSubmitting }) => isSubmitting);\n const isDisabled = disabled || isSubmitting;\n\n const _count = state.value?.length ?? 0;\n\n const _countText = useMemo(() => {\n if (!counter) return '';\n return maxLength ? `${_count} / ${maxLength} ký tự` : `${_count} ký tự`;\n }, [_count, counter, maxLength]);\n\n const _isNearLimit = !!maxLength && _count >= maxLength * 0.8;\n const _isAtLimit = !!maxLength && _count >= maxLength;\n\n const _touched = state.meta.isDirty || state.meta.isTouched;\n const _invalid = _touched && !state.meta.isValid;\n const _isEmpty = required && state.value === null;\n const _hasErrors = !!state.meta.errors.length;\n const _showCopy = !!state.value && !isDisabled;\n\n const _counterClass = useMemo(\n () =>\n cn(\n 'h-4 flex-0 text-nowrap text-end text-xs tabular-nums transition-colors',\n _isAtLimit ? 'font-medium text-danger-strong' : _isNearLimit ? 'text-warning-strong' : 'text-text-positive-weak'\n ),\n [_isAtLimit, _isNearLimit]\n );\n\n const onChange = useCallback<React.ChangeEventHandler<HTMLTextAreaElement>>(\n ({ target: { value } }) => {\n if (isDisabled) return;\n if (counter && maxLength && value.length > maxLength) return;\n handleChange(value || null);\n },\n [isDisabled, counter, maxLength, handleChange]\n );\n\n const onCopy = useCallback(async () => {\n if (!state.value) return;\n await navigator.clipboard.writeText(state.value);\n if (copyTimeoutRef.current !== null) window.clearTimeout(copyTimeoutRef.current);\n setCopied(true);\n copyTimeoutRef.current = window.setTimeout(() => setCopied(false), 1500);\n }, [state.value]);\n\n useEffect(() => {\n return () => {\n if (copyTimeoutRef.current !== null) window.clearTimeout(copyTimeoutRef.current);\n };\n }, []);\n\n return (\n <FieldGroup className=\"gap-y-4 px-4\">\n <Field orientation={orientation} data-invalid={_invalid}>\n <FieldContent>\n <FieldLabel aria-required={_isEmpty} htmlFor={id}>\n {label}\n {tooltip && <FieldTooltip tooltip={tooltip} />}\n </FieldLabel>\n <FieldDescription>{description}</FieldDescription>\n </FieldContent>\n <FieldContentMain>\n <Textarea\n id={id}\n name={name}\n value={state.value ?? ''}\n aria-invalid={_invalid}\n aria-describedby={errorId}\n autoCapitalize=\"none\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n placeholder={placeholder}\n disabled={isDisabled}\n className={cn(isDisabled && 'pointer-events-none bg-muted-muted opacity-60')}\n onChange={onChange}\n onBlur={handleBlur}\n />\n {_showCopy && (\n <button\n type=\"button\"\n aria-label=\"Sao chép\"\n className=\"absolute inset-e-1 top-2 flex size-4 cursor-pointer items-center justify-center rounded-md outline-none transition-[color,transform] focus-visible:[&>svg]:scale-125 [&>svg]:size-3.5 [&>svg]:transition-transform\"\n onClick={onCopy}\n >\n {copied ? (\n <CheckIcon aria-hidden=\"true\" className=\"text-success-strong\" />\n ) : (\n <CopyIcon\n aria-hidden=\"true\"\n className=\"text-text-positive-weak transition-colors hover:text-text-positive focus-visible:text-primary-strong\"\n />\n )}\n </button>\n )}\n {isSubmitting && (\n <div className=\"absolute inset-e-2 inset-y-0 top-2.5 text-muted-weak\">\n <Loader2Icon size={14} className=\"animate-spin text-primary-strong\" />\n </div>\n )}\n {!_showCopy && _touched && showErrorMessage && _hasErrors && (\n <div className=\"absolute inset-e-2 inset-y-0 top-2.5 text-danger-strong\">\n <BanIcon size={14} />\n </div>\n )}\n <div className=\"my-1 flex w-full items-start justify-between gap-x-2\">\n {_touched && showErrorMessage ? <FieldError id={errorId} className=\"flex-1\" errors={state.meta.errors} /> : <div />}\n {!!counter && <p className={_counterClass}>{_countText}</p>}\n </div>\n <FieldNote isShow={!!helperText}>{helperText}</FieldNote>\n </FieldContentMain>\n </Field>\n <FieldSeparator />\n </FieldGroup>\n );\n }\n);\n\nTextareaField.displayName = 'TextareaField';\n"],"mappings":"yoBA4BA,MAAa,EAAgB,GAC1B,CACC,QACA,cACA,eAEA,UACA,aACA,UAAU,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AsB,CAAA,CACxC,CAAA,CAAA,CACb,IACP,EAAC,EAAD,CAAiB,CAAA,CACP,GAEhB,CACF,EAEA,EAAc,YAAc"}
@@ -0,0 +1,2 @@
1
+ import{Field as e,FieldContent as t,FieldDescription as n,FieldGroup as r,FieldLegend as i,FieldNote as a,FieldSeparator as o}from"./field-BKyUqvzh.mjs";import{jsx as s,jsxs as c}from"react/jsx-runtime";const l=({title:l,description:u,helperText:d})=>c(r,{className:`gap-y-4 px-4`,children:[c(e,{className:`gap-0`,children:[c(t,{children:[s(i,{className:`mb-1`,children:l}),s(n,{children:u})]}),s(a,{isShow:!!d,children:d})]}),s(o,{})]});export{l as TanStackTitleField};
2
+ //# sourceMappingURL=title-field-84EnHPvl.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"title-field-84EnHPvl.mjs","names":[],"sources":["../packages/components/features/tanstack-form/components/forms/title-field.tsx"],"sourcesContent":["import { Field, FieldContent, FieldDescription, FieldGroup, FieldLegend, FieldNote, FieldSeparator } from '../ui/field';\n\n/**\n * Renders a standalone section title with an optional description and helper note, followed by a separator.\n *\n * @example\n * import { TanStackTitleField } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <TanStackTitleField\n * title=\"Billing Address\"\n * description=\"Provide the address associated with your payment method.\"\n * helperText=\"Must match your bank records.\"\n * />\n */\nexport const TanStackTitleField: React.FC<{\n /** The heading text rendered as a legend element. */\n title: string;\n /** Optional supplementary text displayed beneath the title. */\n description?: string;\n /** Optional helper note shown below the description area. */\n helperText?: string;\n}> = ({ title, description, helperText }) => {\n return (\n <FieldGroup className=\"gap-y-4 px-4\">\n <Field className=\"gap-0\">\n <FieldContent>\n <FieldLegend className=\"mb-1\">{title}</FieldLegend>\n <FieldDescription>{description}</FieldDescription>\n </FieldContent>\n <FieldNote isShow={!!helperText}>{helperText}</FieldNote>\n </Field>\n <FieldSeparator />\n </FieldGroup>\n );\n};\n"],"mappings":"2MAcA,MAAa,GAOP,CAAE,QAAO,cAAa,gBAExB,EAAC,EAAD,CAAY,UAAU,wBAAtB,CACE,EAAC,EAAD,CAAO,UAAU,iBAAjB,CACE,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAa,UAAU,gBAAQ,CAAmB,CAAA,EAClD,EAAC,EAAD,CAAA,SAAmB,CAA8B,CAAA,CACrC,CAAA,CAAA,EACd,EAAC,EAAD,CAAW,OAAQ,CAAC,CAAC,WAAa,CAAsB,CAAA,CACnD,IACP,EAAC,EAAD,CAAiB,CAAA,CACP"}
@@ -0,0 +1,2 @@
1
+ const e=require("./field-BV5twmKA.cjs");let t=require("react/jsx-runtime");const n=({title:n,description:r,helperText:i})=>(0,t.jsxs)(e.FieldGroup,{className:`gap-y-4 px-4`,children:[(0,t.jsxs)(e.Field,{className:`gap-0`,children:[(0,t.jsxs)(e.FieldContent,{children:[(0,t.jsx)(e.FieldLegend,{className:`mb-1`,children:n}),(0,t.jsx)(e.FieldDescription,{children:r})]}),(0,t.jsx)(e.FieldNote,{isShow:!!i,children:i})]}),(0,t.jsx)(e.FieldSeparator,{})]});exports.TanStackTitleField=n;
2
+ //# sourceMappingURL=title-field-CKxwzMOM.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"title-field-CKxwzMOM.cjs","names":["FieldGroup","Field","FieldContent","FieldLegend","FieldDescription","FieldNote","FieldSeparator"],"sources":["../packages/components/features/tanstack-form/components/forms/title-field.tsx"],"sourcesContent":["import { Field, FieldContent, FieldDescription, FieldGroup, FieldLegend, FieldNote, FieldSeparator } from '../ui/field';\n\n/**\n * Renders a standalone section title with an optional description and helper note, followed by a separator.\n *\n * @example\n * import { TanStackTitleField } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <TanStackTitleField\n * title=\"Billing Address\"\n * description=\"Provide the address associated with your payment method.\"\n * helperText=\"Must match your bank records.\"\n * />\n */\nexport const TanStackTitleField: React.FC<{\n /** The heading text rendered as a legend element. */\n title: string;\n /** Optional supplementary text displayed beneath the title. */\n description?: string;\n /** Optional helper note shown below the description area. */\n helperText?: string;\n}> = ({ title, description, helperText }) => {\n return (\n <FieldGroup className=\"gap-y-4 px-4\">\n <Field className=\"gap-0\">\n <FieldContent>\n <FieldLegend className=\"mb-1\">{title}</FieldLegend>\n <FieldDescription>{description}</FieldDescription>\n </FieldContent>\n <FieldNote isShow={!!helperText}>{helperText}</FieldNote>\n </Field>\n <FieldSeparator />\n </FieldGroup>\n );\n};\n"],"mappings":"2EAcA,MAAa,GAOP,CAAE,QAAO,cAAa,iBAExB,EAAA,EAAA,KAAA,CAACA,EAAAA,WAAD,CAAY,UAAU,wBAAtB,EACE,EAAA,EAAA,KAAA,CAACC,EAAAA,MAAD,CAAO,UAAU,iBAAjB,EACE,EAAA,EAAA,KAAA,CAACC,EAAAA,aAAD,CAAA,SAAA,EACE,EAAA,EAAA,IAAA,CAACC,EAAAA,YAAD,CAAa,UAAU,gBAAQ,CAAmB,CAAA,GAClD,EAAA,EAAA,IAAA,CAACC,EAAAA,iBAAD,CAAA,SAAmB,CAA8B,CAAA,CACrC,CAAA,CAAA,GACd,EAAA,EAAA,IAAA,CAACC,EAAAA,UAAD,CAAW,OAAQ,CAAC,CAAC,WAAa,CAAsB,CAAA,CACnD,KACP,EAAA,EAAA,IAAA,CAACC,EAAAA,eAAD,CAAiB,CAAA,CACP"}