@customafk/lunas-ui 0.2.69 → 0.2.71
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.
- package/dist/{action-submit-Dzo0A7Ew.cjs → action-submit-C19tPHgf.cjs} +2 -2
- package/dist/{action-submit-Dzo0A7Ew.cjs.map → action-submit-C19tPHgf.cjs.map} +1 -1
- package/dist/{action-submit-Bew9PJtF.mjs → action-submit-cOfq0OSY.mjs} +2 -2
- package/dist/{action-submit-Bew9PJtF.mjs.map → action-submit-cOfq0OSY.mjs.map} +1 -1
- package/dist/{actions-form-BnDcdbd-.cjs → actions-form-3ItwYOFj.cjs} +2 -2
- package/dist/{actions-form-BnDcdbd-.cjs.map → actions-form-3ItwYOFj.cjs.map} +1 -1
- package/dist/{actions-form-Z8BX9Hmy.mjs → actions-form-DxbT1lip.mjs} +2 -2
- package/dist/{actions-form-Z8BX9Hmy.mjs.map → actions-form-DxbT1lip.mjs.map} +1 -1
- package/dist/{checkbox-field-BaqE-eVv.mjs → checkbox-field-BAQN-Yno.mjs} +2 -2
- package/dist/{checkbox-field-BaqE-eVv.mjs.map → checkbox-field-BAQN-Yno.mjs.map} +1 -1
- package/dist/{checkbox-field-BsGsZz_N.cjs → checkbox-field-BRqU_dYY.cjs} +2 -2
- package/dist/{checkbox-field-BsGsZz_N.cjs.map → checkbox-field-BRqU_dYY.cjs.map} +1 -1
- package/dist/combobox-field-DnCpN--a.cjs +2 -0
- package/dist/combobox-field-DnCpN--a.cjs.map +1 -0
- package/dist/combobox-field-yvQPJSFC.mjs +2 -0
- package/dist/combobox-field-yvQPJSFC.mjs.map +1 -0
- package/dist/container-form-BjiGIzwm.mjs +2 -0
- package/dist/container-form-BjiGIzwm.mjs.map +1 -0
- package/dist/container-form-D8QNEn8M.cjs +2 -0
- package/dist/container-form-D8QNEn8M.cjs.map +1 -0
- package/dist/date-field-DLsJBYw8.cjs +2 -0
- package/dist/date-field-DLsJBYw8.cjs.map +1 -0
- package/dist/date-field-O67C78Kw.mjs +2 -0
- package/dist/date-field-O67C78Kw.mjs.map +1 -0
- package/dist/{dialog-form-BbumLQqe.mjs → dialog-form-BxlLrEeZ.mjs} +2 -2
- package/dist/{dialog-form-BbumLQqe.mjs.map → dialog-form-BxlLrEeZ.mjs.map} +1 -1
- package/dist/{dialog-form-CEiuEMXD.cjs → dialog-form-ClTCyJDD.cjs} +2 -2
- package/dist/{dialog-form-CEiuEMXD.cjs.map → dialog-form-ClTCyJDD.cjs.map} +1 -1
- package/dist/{email-field-DRb71gQI.cjs → email-field-DZzkfVj5.cjs} +2 -2
- package/dist/{email-field-DRb71gQI.cjs.map → email-field-DZzkfVj5.cjs.map} +1 -1
- package/dist/{email-field-HFmUE81o.mjs → email-field-DqEDxkp7.mjs} +2 -2
- package/dist/{email-field-HFmUE81o.mjs.map → email-field-DqEDxkp7.mjs.map} +1 -1
- package/dist/features/tanstack-form/index.cjs +1 -1
- package/dist/features/tanstack-form/index.d.cts +1 -1
- package/dist/features/tanstack-form/index.d.mts +1 -1
- package/dist/features/tanstack-form/index.mjs +1 -1
- package/dist/{field-BV5twmKA.cjs → field-BSLi-P0Q.cjs} +2 -2
- package/dist/{field-BV5twmKA.cjs.map → field-BSLi-P0Q.cjs.map} +1 -1
- package/dist/{field-BKyUqvzh.mjs → field-V2DoD8qL.mjs} +2 -2
- package/dist/{field-BKyUqvzh.mjs.map → field-V2DoD8qL.mjs.map} +1 -1
- package/dist/{group-field-bviEXmo4.mjs → group-field-gejvx_Td.mjs} +2 -2
- package/dist/{group-field-bviEXmo4.mjs.map → group-field-gejvx_Td.mjs.map} +1 -1
- package/dist/{group-field-0kStiX8n.cjs → group-field-sVykO2JZ.cjs} +2 -2
- package/dist/{group-field-0kStiX8n.cjs.map → group-field-sVykO2JZ.cjs.map} +1 -1
- package/dist/{index-CgP5OCy0.d.cts → index-BGnN6Vax.d.cts} +22 -1
- package/dist/{index-CgP5OCy0.d.mts → index-BGnN6Vax.d.mts} +22 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{number-field-y0H7X4Ka.cjs → number-field-BTLobx1F.cjs} +2 -2
- package/dist/{number-field-y0H7X4Ka.cjs.map → number-field-BTLobx1F.cjs.map} +1 -1
- package/dist/{number-field-CZ06Uzb3.mjs → number-field-Cx-1U_Np.mjs} +2 -2
- package/dist/{number-field-CZ06Uzb3.mjs.map → number-field-Cx-1U_Np.mjs.map} +1 -1
- package/dist/{password-field-DSeObMIU.mjs → password-field-CGPjZ5hZ.mjs} +2 -2
- package/dist/{password-field-DSeObMIU.mjs.map → password-field-CGPjZ5hZ.mjs.map} +1 -1
- package/dist/{password-field-D0drFRG2.cjs → password-field-CuBcb4mi.cjs} +2 -2
- package/dist/{password-field-D0drFRG2.cjs.map → password-field-CuBcb4mi.cjs.map} +1 -1
- package/dist/{popover-form-rwhAulOD.mjs → popover-form-DVJUQ3_T.mjs} +2 -2
- package/dist/{popover-form-rwhAulOD.mjs.map → popover-form-DVJUQ3_T.mjs.map} +1 -1
- package/dist/{popover-form-nkdwopLv.cjs → popover-form-DzvgWQ2Q.cjs} +2 -2
- package/dist/{popover-form-nkdwopLv.cjs.map → popover-form-DzvgWQ2Q.cjs.map} +1 -1
- package/dist/{radio-group-field-0BXRGTJx.mjs → radio-group-field-C45y9BQt.mjs} +2 -2
- package/dist/{radio-group-field-0BXRGTJx.mjs.map → radio-group-field-C45y9BQt.mjs.map} +1 -1
- package/dist/{radio-group-field-wX3cWjyq.cjs → radio-group-field-GiEbZRkS.cjs} +2 -2
- package/dist/{radio-group-field-wX3cWjyq.cjs.map → radio-group-field-GiEbZRkS.cjs.map} +1 -1
- package/dist/section-form-BJWWflUR.mjs +2 -0
- package/dist/section-form-BJWWflUR.mjs.map +1 -0
- package/dist/section-form-C_pHiBEW.cjs +2 -0
- package/dist/section-form-C_pHiBEW.cjs.map +1 -0
- package/dist/{select-field-DR36Hpe0.cjs → select-field-Cd63KvgR.cjs} +2 -2
- package/dist/{select-field-DR36Hpe0.cjs.map → select-field-Cd63KvgR.cjs.map} +1 -1
- package/dist/{select-field-B-bbY7td.mjs → select-field-y3Zttb4j.mjs} +2 -2
- package/dist/{select-field-B-bbY7td.mjs.map → select-field-y3Zttb4j.mjs.map} +1 -1
- package/dist/{simple-array-field-CZb-E4GS.cjs → simple-array-field-BODzA766.cjs} +2 -2
- package/dist/{simple-array-field-CZb-E4GS.cjs.map → simple-array-field-BODzA766.cjs.map} +1 -1
- package/dist/{simple-array-field-CBG9o26e.mjs → simple-array-field-DI_56dVs.mjs} +2 -2
- package/dist/{simple-array-field-CBG9o26e.mjs.map → simple-array-field-DI_56dVs.mjs.map} +1 -1
- package/dist/{simple-boolean-field-BZ9paBNQ.cjs → simple-boolean-field-BjnIh9Mq.cjs} +2 -2
- package/dist/{simple-boolean-field-BZ9paBNQ.cjs.map → simple-boolean-field-BjnIh9Mq.cjs.map} +1 -1
- package/dist/{simple-boolean-field-BEsGOyof.mjs → simple-boolean-field-oP5yJDQL.mjs} +2 -2
- package/dist/{simple-boolean-field-BEsGOyof.mjs.map → simple-boolean-field-oP5yJDQL.mjs.map} +1 -1
- package/dist/{simple-combobox-field-BbhxP-te.mjs → simple-combobox-field-Bd-xk5kC.mjs} +2 -2
- package/dist/{simple-combobox-field-BbhxP-te.mjs.map → simple-combobox-field-Bd-xk5kC.mjs.map} +1 -1
- package/dist/{simple-combobox-field-C4Jmm1AJ.cjs → simple-combobox-field-Dgicw0VN.cjs} +2 -2
- package/dist/{simple-combobox-field-C4Jmm1AJ.cjs.map → simple-combobox-field-Dgicw0VN.cjs.map} +1 -1
- package/dist/{simple-date-field-D7-UWd6G.mjs → simple-date-field-DE5Z-Zkc.mjs} +2 -2
- package/dist/{simple-date-field-D7-UWd6G.mjs.map → simple-date-field-DE5Z-Zkc.mjs.map} +1 -1
- package/dist/{simple-date-field-JVkBTfCc.cjs → simple-date-field-hORsbXHE.cjs} +2 -2
- package/dist/{simple-date-field-JVkBTfCc.cjs.map → simple-date-field-hORsbXHE.cjs.map} +1 -1
- package/dist/{simple-email-field-DHnUuabs.mjs → simple-email-field-CFbpYis_.mjs} +2 -2
- package/dist/{simple-email-field-DHnUuabs.mjs.map → simple-email-field-CFbpYis_.mjs.map} +1 -1
- package/dist/{simple-email-field-BBrdKmN8.cjs → simple-email-field-DpuMlzxg.cjs} +2 -2
- package/dist/{simple-email-field-BBrdKmN8.cjs.map → simple-email-field-DpuMlzxg.cjs.map} +1 -1
- package/dist/{simple-number-field-DGaUnBOr.mjs → simple-number-field-BY0b4BJp.mjs} +2 -2
- package/dist/{simple-number-field-DGaUnBOr.mjs.map → simple-number-field-BY0b4BJp.mjs.map} +1 -1
- package/dist/{simple-number-field-CZ-ycDza.cjs → simple-number-field-C4y4rQcw.cjs} +2 -2
- package/dist/{simple-number-field-CZ-ycDza.cjs.map → simple-number-field-C4y4rQcw.cjs.map} +1 -1
- package/dist/{simple-password-field-BUSJzB-t.cjs → simple-password-field-BUzKJ0fu.cjs} +2 -2
- package/dist/{simple-password-field-BUSJzB-t.cjs.map → simple-password-field-BUzKJ0fu.cjs.map} +1 -1
- package/dist/{simple-password-field-BxYeEv-p.mjs → simple-password-field-CA0FuETK.mjs} +2 -2
- package/dist/{simple-password-field-BxYeEv-p.mjs.map → simple-password-field-CA0FuETK.mjs.map} +1 -1
- package/dist/{simple-radio-group-field-yJdq-reX.mjs → simple-radio-group-field-BM7HBTSs.mjs} +2 -2
- package/dist/{simple-radio-group-field-yJdq-reX.mjs.map → simple-radio-group-field-BM7HBTSs.mjs.map} +1 -1
- package/dist/{simple-radio-group-field-CQTkbvt9.cjs → simple-radio-group-field-CCxUaYom.cjs} +2 -2
- package/dist/{simple-radio-group-field-CQTkbvt9.cjs.map → simple-radio-group-field-CCxUaYom.cjs.map} +1 -1
- package/dist/{simple-select-field-Cp64m8Aa.mjs → simple-select-field-CeTVQwmP.mjs} +2 -2
- package/dist/{simple-select-field-Cp64m8Aa.mjs.map → simple-select-field-CeTVQwmP.mjs.map} +1 -1
- package/dist/{simple-select-field-CUFuptbH.cjs → simple-select-field-CzN4Xb7n.cjs} +2 -2
- package/dist/{simple-select-field-CUFuptbH.cjs.map → simple-select-field-CzN4Xb7n.cjs.map} +1 -1
- package/dist/{simple-text-field-Dl2IOsO3.mjs → simple-text-field-CDsgWUFD.mjs} +2 -2
- package/dist/{simple-text-field-Dl2IOsO3.mjs.map → simple-text-field-CDsgWUFD.mjs.map} +1 -1
- package/dist/{simple-text-field-B2Z1E4sG.cjs → simple-text-field-DGZL0gML.cjs} +2 -2
- package/dist/{simple-text-field-B2Z1E4sG.cjs.map → simple-text-field-DGZL0gML.cjs.map} +1 -1
- package/dist/{simple-textarea-field-CM9aHy-q.mjs → simple-textarea-field-BiuHXtqj.mjs} +2 -2
- package/dist/{simple-textarea-field-CM9aHy-q.mjs.map → simple-textarea-field-BiuHXtqj.mjs.map} +1 -1
- package/dist/{simple-textarea-field-Cjjk9WOW.cjs → simple-textarea-field-vGYOegPj.cjs} +2 -2
- package/dist/{simple-textarea-field-Cjjk9WOW.cjs.map → simple-textarea-field-vGYOegPj.cjs.map} +1 -1
- package/dist/{switch-field-IXQ1Blrd.mjs → switch-field-BVgtm94W.mjs} +2 -2
- package/dist/{switch-field-IXQ1Blrd.mjs.map → switch-field-BVgtm94W.mjs.map} +1 -1
- package/dist/{switch-field-CO5M4qiM.cjs → switch-field-DPB3JDT3.cjs} +2 -2
- package/dist/{switch-field-CO5M4qiM.cjs.map → switch-field-DPB3JDT3.cjs.map} +1 -1
- package/dist/tanstack-form-CKAWexet.mjs +2 -0
- package/dist/{tanstack-form-DJMaMeUh.mjs.map → tanstack-form-CKAWexet.mjs.map} +1 -1
- package/dist/{tanstack-form-BC61U3F-.cjs → tanstack-form-CX3lC3mC.cjs} +2 -2
- package/dist/{tanstack-form-BC61U3F-.cjs.map → tanstack-form-CX3lC3mC.cjs.map} +1 -1
- package/dist/{text-editor-field-D_l4zp_y.cjs → text-editor-field-Ddvgdo_p.cjs} +2 -2
- package/dist/{text-editor-field-D_l4zp_y.cjs.map → text-editor-field-Ddvgdo_p.cjs.map} +1 -1
- package/dist/{text-editor-field-DxLBaxTL.mjs → text-editor-field-qa3t2GBg.mjs} +2 -2
- package/dist/{text-editor-field-DxLBaxTL.mjs.map → text-editor-field-qa3t2GBg.mjs.map} +1 -1
- package/dist/text-field-CBUTZKGH.mjs +2 -0
- package/dist/text-field-CBUTZKGH.mjs.map +1 -0
- package/dist/text-field-Cwu0xuXt.cjs +2 -0
- package/dist/text-field-Cwu0xuXt.cjs.map +1 -0
- package/dist/{textarea-field-BoQtVUI-.mjs → textarea-field-Ctj5o5my.mjs} +2 -2
- package/dist/{textarea-field-BoQtVUI-.mjs.map → textarea-field-Ctj5o5my.mjs.map} +1 -1
- package/dist/{textarea-field-IZUGVQjJ.cjs → textarea-field-jOqHJcAL.cjs} +2 -2
- package/dist/{textarea-field-IZUGVQjJ.cjs.map → textarea-field-jOqHJcAL.cjs.map} +1 -1
- package/dist/{title-field-CKxwzMOM.cjs → title-field-B2hM3S_S.cjs} +2 -2
- package/dist/{title-field-CKxwzMOM.cjs.map → title-field-B2hM3S_S.cjs.map} +1 -1
- package/dist/{title-field-84EnHPvl.mjs → title-field-oAqHRw59.mjs} +2 -2
- package/dist/{title-field-84EnHPvl.mjs.map → title-field-oAqHRw59.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/combobox-field-CAN8g_xv.mjs +0 -2
- package/dist/combobox-field-CAN8g_xv.mjs.map +0 -1
- package/dist/combobox-field-DERJQd5o.cjs +0 -2
- package/dist/combobox-field-DERJQd5o.cjs.map +0 -1
- package/dist/container-form-BdsEX0NH.mjs +0 -2
- package/dist/container-form-BdsEX0NH.mjs.map +0 -1
- package/dist/container-form-CxxUYctk.cjs +0 -2
- package/dist/container-form-CxxUYctk.cjs.map +0 -1
- package/dist/date-field--jOKZ2x1.cjs +0 -2
- package/dist/date-field--jOKZ2x1.cjs.map +0 -1
- package/dist/date-field-CXzcsnjn.mjs +0 -2
- package/dist/date-field-CXzcsnjn.mjs.map +0 -1
- package/dist/section-form-Dv9fKWmB.mjs +0 -2
- package/dist/section-form-Dv9fKWmB.mjs.map +0 -1
- package/dist/section-form-cH13fOhg.cjs +0 -2
- package/dist/section-form-cH13fOhg.cjs.map +0 -1
- package/dist/tanstack-form-DJMaMeUh.mjs +0 -2
- package/dist/text-field-B8xQe0U9.cjs +0 -2
- package/dist/text-field-B8xQe0U9.cjs.map +0 -1
- package/dist/text-field-BrxKYCui.mjs +0 -2
- package/dist/text-field-BrxKYCui.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-field-
|
|
1
|
+
{"version":3,"file":"email-field-DZzkfVj5.cjs","names":["useTanStackFieldContext","FieldGroup","Field","FieldContent","FieldLabel","FieldTooltip","FieldDescription","FieldContentMain","Input","AtSignIcon","XIcon","FieldError","FieldNote","FieldSeparator"],"sources":["../packages/components/features/tanstack-form/components/fields/email-field.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback } from 'react';\n\nimport { useStore } from '@tanstack/react-form';\n\nimport { AtSignIcon, 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 '../ui/field';\nimport { useTanStackFieldContext } from '../form-context';\n\nimport type { EmailFieldProps as Props } from '../../types';\n\n/**\n * A TanStack Form-connected email input field with an at-sign prefix icon,\n * optional clear button, and inline validation error display.\n *\n * @example\n * import { EmailField } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <form.Field name=\"email\">\n * {() => (\n * <EmailField\n * label=\"Email address\"\n * placeholder=\"you@example.com\"\n * required\n * />\n * )}\n * </form.Field>\n */\nexport const EmailField: React.FC<Props> = ({\n label,\n description,\n placeholder,\n tooltip,\n helperText,\n orientation = 'responsive',\n showErrorMessage = true,\n required = false,\n maxLength,\n}) => {\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.isDirty && state.meta.isTouched && !state.meta.isValid;\n const _isEmpty = required && state.value === null;\n const _showClear = !isSubmitting && !!state.value;\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 const onClear = useCallback(() => {\n if (isSubmitting) return;\n handleChange(null);\n }, [isSubmitting, handleChange]);\n\n return (\n <FieldGroup className=\"gap-y-4 px-4\">\n <Field data-invalid={_invalid} orientation={orientation}>\n <FieldContent>\n <FieldLabel htmlFor={name} aria-required={_isEmpty}>\n {label}\n {tooltip && <FieldTooltip tooltip={tooltip} />}\n </FieldLabel>\n <FieldDescription>{description}</FieldDescription>\n </FieldContent>\n <FieldContentMain>\n <Input\n id={name}\n name={name}\n value={state.value === null ? '' : state.value}\n aria-invalid={_invalid}\n autoComplete=\"email\"\n placeholder={placeholder}\n className={cn('pl-9', _showClear && 'pr-9', isSubmitting && 'pointer-events-none bg-muted-muted opacity-60')}\n onBlur={handleBlur}\n onChange={onChange}\n />\n <div className=\"absolute top-0 left-0 flex size-9 items-center justify-center text-muted\">\n <AtSignIcon size={14} />\n </div>\n\n {_showClear && (\n <button\n type=\"button\"\n aria-label=\"Xóa\"\n className=\"absolute inset-e-0 inset-y-0 top-3 flex h-fit w-8 cursor-pointer items-center justify-center rounded-e-md text-text-positive-weak outline-none transition-[color,box-shadow] hover:text-text-positive focus:text-text-positive-strong\"\n onClick={onClear}\n >\n <XIcon size={14} aria-hidden=\"true\" />\n </button>\n )}\n\n <div className=\"mt-1 flex w-full items-start justify-start\">\n {showErrorMessage && state.meta.isDirty && <FieldError errors={state.meta.errors} />}\n </div>\n <FieldNote isShow={!!helperText}>{helperText}</FieldNote>\n </FieldContentMain>\n </Field>\n <FieldSeparator />\n </FieldGroup>\n );\n};\n"],"mappings":"4QA4CA,MAAa,GAA+B,CAC1C,QACA,cACA,cACA,UACA,aACA,cAAc,aACd,mBAAmB,GACnB,WAAW,GACX,eACI,CACJ,GAAM,CAAE,OAAM,OAAM,QAAO,aAAY,gBAAiBA,EAAAA,EAAuC,EAEzF,GAAA,EAAA,EAAA,SAAA,CAAwB,EAAK,OAAQ,CAAE,kBAAmB,CAAY,EAEtE,EAAW,EAAM,KAAK,SAAW,EAAM,KAAK,WAAa,CAAC,EAAM,KAAK,QACrE,EAAW,GAAY,EAAM,QAAU,KACvC,EAAa,CAAC,GAAgB,CAAC,CAAC,EAAM,MAEtC,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,EAEM,GAAA,EAAA,EAAA,YAAA,KAA4B,CAC5B,GACJ,EAAa,IAAI,CACnB,EAAG,CAAC,EAAc,CAAY,CAAC,EAE/B,OACE,EAAA,EAAA,KAAA,CAACC,EAAAA,WAAD,CAAY,UAAU,wBAAtB,EACE,EAAA,EAAA,KAAA,CAACC,EAAAA,MAAD,CAAO,eAAc,EAAuB,uBAA5C,EACE,EAAA,EAAA,KAAA,CAACC,EAAAA,aAAD,CAAA,SAAA,EACE,EAAA,EAAA,KAAA,CAACC,EAAAA,WAAD,CAAY,QAAS,EAAM,gBAAe,WAA1C,CACG,EACA,IAAW,EAAA,EAAA,IAAA,CAACC,EAAAA,aAAD,CAAuB,SAAU,CAAA,CACnC,KACZ,EAAA,EAAA,IAAA,CAACC,EAAAA,iBAAD,CAAA,SAAmB,CAA8B,CAAA,CACrC,CAAA,CAAA,GACd,EAAA,EAAA,KAAA,CAACC,EAAAA,iBAAD,CAAA,SAAA,EACE,EAAA,EAAA,IAAA,CAACC,EAAAA,MAAD,CACE,GAAI,EACE,OACN,MAAO,EAAM,QAAU,KAAO,GAAK,EAAM,MACzC,eAAc,EACd,aAAa,QACA,cACb,WAAA,EAAA,EAAA,GAAA,CAAc,OAAQ,GAAc,OAAQ,GAAgB,+CAA+C,EAC3G,OAAQ,EACE,UACX,CAAA,GACD,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,qFACb,EAAA,EAAA,IAAA,CAACC,EAAAA,WAAD,CAAY,KAAM,EAAK,CAAA,CACpB,CAAA,EAEJ,IACC,EAAA,EAAA,IAAA,CAAC,SAAD,CACE,KAAK,SACL,aAAW,MACX,UAAU,wOACV,QAAS,YAET,EAAA,EAAA,IAAA,CAACC,EAAAA,MAAD,CAAO,KAAM,GAAI,cAAY,MAAQ,CAAA,CAC/B,CAAA,GAGV,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,sDACZ,GAAoB,EAAM,KAAK,UAAW,EAAA,EAAA,IAAA,CAACC,EAAAA,WAAD,CAAY,OAAQ,EAAM,KAAK,MAAS,CAAA,CAChF,CAAA,GACL,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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{G as e}from"./tanstack-form-
|
|
2
|
-
//# sourceMappingURL=email-field-
|
|
1
|
+
import{G as e}from"./tanstack-form-CKAWexet.mjs";import{Input as t}from"./ui/input.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-V2DoD8qL.mjs";import{AtSignIcon as f,XIcon as p}from"lucide-react";import{useCallback as m}from"react";import{cn as h}from"@customafk/react-toolkit/utils";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{useStore as v}from"@tanstack/react-form";const y=({label:y,description:b,placeholder:x,tooltip:S,helperText:C,orientation:w=`responsive`,showErrorMessage:T=!0,required:E=!1,maxLength:D})=>{let{form:O,name:k,state:A,handleBlur:j,handleChange:M}=e(),N=v(O.store,({isSubmitting:e})=>e),P=A.meta.isDirty&&A.meta.isTouched&&!A.meta.isValid,F=E&&A.value===null,I=!N&&!!A.value,L=m(({target:{value:e}})=>{N||D&&e.length>D||M(e||null)},[N,D,M]),R=m(()=>{N||M(null)},[N,M]);return _(s,{className:`gap-y-4 px-4`,children:[_(n,{"data-invalid":P,orientation:w,children:[_(r,{children:[_(c,{htmlFor:k,"aria-required":F,children:[y,S&&g(d,{tooltip:S})]}),g(a,{children:b})]}),_(i,{children:[g(t,{id:k,name:k,value:A.value===null?``:A.value,"aria-invalid":P,autoComplete:`email`,placeholder:x,className:h(`pl-9`,I&&`pr-9`,N&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:j,onChange:L}),g(`div`,{className:`absolute top-0 left-0 flex size-9 items-center justify-center text-muted`,children:g(f,{size:14})}),I&&g(`button`,{type:`button`,"aria-label":`Xóa`,className:`absolute inset-e-0 inset-y-0 top-3 flex h-fit w-8 cursor-pointer items-center justify-center rounded-e-md text-text-positive-weak outline-none transition-[color,box-shadow] hover:text-text-positive focus:text-text-positive-strong`,onClick:R,children:g(p,{size:14,"aria-hidden":`true`})}),g(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:T&&A.meta.isDirty&&g(o,{errors:A.meta.errors})}),g(l,{isShow:!!C,children:C})]})]}),g(u,{})]})};export{y as EmailField};
|
|
2
|
+
//# sourceMappingURL=email-field-DqEDxkp7.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-field-
|
|
1
|
+
{"version":3,"file":"email-field-DqEDxkp7.mjs","names":[],"sources":["../packages/components/features/tanstack-form/components/fields/email-field.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback } from 'react';\n\nimport { useStore } from '@tanstack/react-form';\n\nimport { AtSignIcon, 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 '../ui/field';\nimport { useTanStackFieldContext } from '../form-context';\n\nimport type { EmailFieldProps as Props } from '../../types';\n\n/**\n * A TanStack Form-connected email input field with an at-sign prefix icon,\n * optional clear button, and inline validation error display.\n *\n * @example\n * import { EmailField } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <form.Field name=\"email\">\n * {() => (\n * <EmailField\n * label=\"Email address\"\n * placeholder=\"you@example.com\"\n * required\n * />\n * )}\n * </form.Field>\n */\nexport const EmailField: React.FC<Props> = ({\n label,\n description,\n placeholder,\n tooltip,\n helperText,\n orientation = 'responsive',\n showErrorMessage = true,\n required = false,\n maxLength,\n}) => {\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.isDirty && state.meta.isTouched && !state.meta.isValid;\n const _isEmpty = required && state.value === null;\n const _showClear = !isSubmitting && !!state.value;\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 const onClear = useCallback(() => {\n if (isSubmitting) return;\n handleChange(null);\n }, [isSubmitting, handleChange]);\n\n return (\n <FieldGroup className=\"gap-y-4 px-4\">\n <Field data-invalid={_invalid} orientation={orientation}>\n <FieldContent>\n <FieldLabel htmlFor={name} aria-required={_isEmpty}>\n {label}\n {tooltip && <FieldTooltip tooltip={tooltip} />}\n </FieldLabel>\n <FieldDescription>{description}</FieldDescription>\n </FieldContent>\n <FieldContentMain>\n <Input\n id={name}\n name={name}\n value={state.value === null ? '' : state.value}\n aria-invalid={_invalid}\n autoComplete=\"email\"\n placeholder={placeholder}\n className={cn('pl-9', _showClear && 'pr-9', isSubmitting && 'pointer-events-none bg-muted-muted opacity-60')}\n onBlur={handleBlur}\n onChange={onChange}\n />\n <div className=\"absolute top-0 left-0 flex size-9 items-center justify-center text-muted\">\n <AtSignIcon size={14} />\n </div>\n\n {_showClear && (\n <button\n type=\"button\"\n aria-label=\"Xóa\"\n className=\"absolute inset-e-0 inset-y-0 top-3 flex h-fit w-8 cursor-pointer items-center justify-center rounded-e-md text-text-positive-weak outline-none transition-[color,box-shadow] hover:text-text-positive focus:text-text-positive-strong\"\n onClick={onClear}\n >\n <XIcon size={14} aria-hidden=\"true\" />\n </button>\n )}\n\n <div className=\"mt-1 flex w-full items-start justify-start\">\n {showErrorMessage && state.meta.isDirty && <FieldError errors={state.meta.errors} />}\n </div>\n <FieldNote isShow={!!helperText}>{helperText}</FieldNote>\n </FieldContentMain>\n </Field>\n <FieldSeparator />\n </FieldGroup>\n );\n};\n"],"mappings":"uhBA4CA,MAAa,GAA+B,CAC1C,QACA,cACA,cACA,UACA,aACA,cAAc,aACd,mBAAmB,GACnB,WAAW,GACX,eACI,CACJ,GAAM,CAAE,OAAM,OAAM,QAAO,aAAY,gBAAiB,EAAuC,EAEzF,EAAe,EAAS,EAAK,OAAQ,CAAE,kBAAmB,CAAY,EAEtE,EAAW,EAAM,KAAK,SAAW,EAAM,KAAK,WAAa,CAAC,EAAM,KAAK,QACrE,EAAW,GAAY,EAAM,QAAU,KACvC,EAAa,CAAC,GAAgB,CAAC,CAAC,EAAM,MAEtC,EAAW,GACd,CAAE,OAAQ,CAAE,YAAc,CACrB,GACA,GAAa,EAAM,OAAS,GAChC,EAAa,GAAS,IAAI,CAC5B,EACA,CAAC,EAAc,EAAW,CAAY,CACxC,EAEM,EAAU,MAAkB,CAC5B,GACJ,EAAa,IAAI,CACnB,EAAG,CAAC,EAAc,CAAY,CAAC,EAE/B,OACE,EAAC,EAAD,CAAY,UAAU,wBAAtB,CACE,EAAC,EAAD,CAAO,eAAc,EAAuB,uBAA5C,CACE,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAY,QAAS,EAAM,gBAAe,WAA1C,CACG,EACA,GAAW,EAAC,EAAD,CAAuB,SAAU,CAAA,CACnC,IACZ,EAAC,EAAD,CAAA,SAAmB,CAA8B,CAAA,CACrC,CAAA,CAAA,EACd,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CACE,GAAI,EACE,OACN,MAAO,EAAM,QAAU,KAAO,GAAK,EAAM,MACzC,eAAc,EACd,aAAa,QACA,cACb,UAAW,EAAG,OAAQ,GAAc,OAAQ,GAAgB,+CAA+C,EAC3G,OAAQ,EACE,UACX,CAAA,EACD,EAAC,MAAD,CAAK,UAAU,oFACb,EAAC,EAAD,CAAY,KAAM,EAAK,CAAA,CACpB,CAAA,EAEJ,GACC,EAAC,SAAD,CACE,KAAK,SACL,aAAW,MACX,UAAU,wOACV,QAAS,WAET,EAAC,EAAD,CAAO,KAAM,GAAI,cAAY,MAAQ,CAAA,CAC/B,CAAA,EAGV,EAAC,MAAD,CAAK,UAAU,sDACZ,GAAoB,EAAM,KAAK,SAAW,EAAC,EAAD,CAAY,OAAQ,EAAM,KAAK,MAAS,CAAA,CAChF,CAAA,EACL,EAAC,EAAD,CAAW,OAAQ,CAAC,CAAC,WAAa,CAAsB,CAAA,CACxC,CAAA,CAAA,CACb,IACP,EAAC,EAAD,CAAiB,CAAA,CACP,GAEhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../tanstack-form-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../tanstack-form-CX3lC3mC.cjs");exports.ArrayCol=e.t,exports.ArrayHeaderRow=e.n,exports.CheckboxField=e.r,exports.ComboboxField=e.i,exports.DateField=e.a,exports.EmailField=e.o,exports.Field=e.s,exports.FieldContent=e.c,exports.FieldContentMain=e.l,exports.FieldError=e.u,exports.FieldGroup=e.d,exports.FieldLabel=e.f,exports.FieldSeparator=e.p,exports.NumberField=e.m,exports.PasswordField=e.h,exports.RadioGroupField=e.g,exports.SelectField=e._,exports.SimpleArrayField=e.v,exports.SimpleBooleanField=e.y,exports.SimpleComboboxField=e.b,exports.SimpleDateField=e.x,exports.SimpleEmailField=e.S,exports.SimpleNumberField=e.C,exports.SimplePasswordField=e.w,exports.SimpleRadioGroupField=e.T,exports.SimpleSelectField=e.E,exports.SimpleTextField=e.D,exports.SimpleTextareaField=e.O,exports.SwitchField=e.k,exports.TanStackActionSubmit=e.A,exports.TanStackActionsForm=e.j,exports.TanStackCardForm=e.M,exports.TanStackContainerForm=e.N,exports.TanStackDialogForm=e.P,exports.TanStackFieldGroup=e.F,exports.TanStackPopoverForm=e.I,exports.TanStackSectionForm=e.L,exports.TanStackTitleField=e.R,exports.TextEditorField=e.z,exports.TextField=e.B,exports.TextareaField=e.V,exports.useTanStackFieldContext=e.G,exports.useTanStackForm=e.H,exports.useTanStackFormContext=e.K,exports.withTanStackFieldGroup=e.U,exports.withTanStackForm=e.W;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as EmailFieldProps, A as TanStackActionSubmit, B as TextField, C as SimpleNumberField, D as SimpleTextField, E as SimpleSelectField, F as TanStackFieldGroup, G as useTanStackFieldContext, H as useTanStackForm, I as TanStackPopoverForm, J as BooleanFieldValue, K as useTanStackFormContext, L as TanStackSectionForm, M as TanStackCardForm, N as TanStackContainerForm, O as SimpleTextareaField, P as TanStackDialogForm, Q as DateFieldValue, R as TanStackTitleField, S as SimpleEmailField, T as SimpleRadioGroupField, U as withTanStackFieldGroup, V as TextareaField, W as withTanStackForm, X as ComboboxFieldProps, Y as CheckboxFieldProps, Z as DateFieldProps, _ as SelectField, a as DateField, at as NumberFieldValue, b as SimpleComboboxField, c as FieldContent, ct as RadioOption, d as FieldGroup, dt as SimpleTextFieldProps, et as FieldOrientation, f as FieldLabel, ft as SwitchFieldProps, g as RadioGroupField, gt as TextareaFieldProps, h as PasswordField, ht as TextFieldValue, i as ComboboxField, it as NumberFieldProps, j as TanStackActionsForm, k as SwitchField, l as FieldContentMain, lt as SelectFieldProps, m as NumberField, mt as TextFieldProps, n as ArrayHeaderRow, nt as FieldType, o as EmailField, ot as PasswordFieldProps, p as FieldSeparator, pt as TextEditorFieldProps, q as AnyFieldProps, r as CheckboxField, rt as MultiSelectFieldValue, s as Field, st as RadioGroupFieldProps, t as ArrayCol, tt as FieldRounding, u as FieldError, ut as SelectOption, v as SimpleArrayField, w as SimplePasswordField, x as SimpleDateField, y as SimpleBooleanField, z as TextEditorField } from "../../index-
|
|
1
|
+
import { $ as EmailFieldProps, A as TanStackActionSubmit, B as TextField, C as SimpleNumberField, D as SimpleTextField, E as SimpleSelectField, F as TanStackFieldGroup, G as useTanStackFieldContext, H as useTanStackForm, I as TanStackPopoverForm, J as BooleanFieldValue, K as useTanStackFormContext, L as TanStackSectionForm, M as TanStackCardForm, N as TanStackContainerForm, O as SimpleTextareaField, P as TanStackDialogForm, Q as DateFieldValue, R as TanStackTitleField, S as SimpleEmailField, T as SimpleRadioGroupField, U as withTanStackFieldGroup, V as TextareaField, W as withTanStackForm, X as ComboboxFieldProps, Y as CheckboxFieldProps, Z as DateFieldProps, _ as SelectField, a as DateField, at as NumberFieldValue, b as SimpleComboboxField, c as FieldContent, ct as RadioOption, d as FieldGroup, dt as SimpleTextFieldProps, et as FieldOrientation, f as FieldLabel, ft as SwitchFieldProps, g as RadioGroupField, gt as TextareaFieldProps, h as PasswordField, ht as TextFieldValue, i as ComboboxField, it as NumberFieldProps, j as TanStackActionsForm, k as SwitchField, l as FieldContentMain, lt as SelectFieldProps, m as NumberField, mt as TextFieldProps, n as ArrayHeaderRow, nt as FieldType, o as EmailField, ot as PasswordFieldProps, p as FieldSeparator, pt as TextEditorFieldProps, q as AnyFieldProps, r as CheckboxField, rt as MultiSelectFieldValue, s as Field, st as RadioGroupFieldProps, t as ArrayCol, tt as FieldRounding, u as FieldError, ut as SelectOption, v as SimpleArrayField, w as SimplePasswordField, x as SimpleDateField, y as SimpleBooleanField, z as TextEditorField } from "../../index-BGnN6Vax.cjs";
|
|
2
2
|
export { AnyFieldProps, ArrayCol, ArrayHeaderRow, BooleanFieldValue, CheckboxField, CheckboxFieldProps, ComboboxField, ComboboxFieldProps, DateField, DateFieldProps, DateFieldValue, EmailField, EmailFieldProps, Field, FieldContent, FieldContentMain, FieldError, FieldGroup, FieldLabel, FieldOrientation, FieldRounding, FieldSeparator, FieldType, MultiSelectFieldValue, NumberField, NumberFieldProps, NumberFieldValue, PasswordField, PasswordFieldProps, RadioGroupField, RadioGroupFieldProps, RadioOption, SelectField, SelectFieldProps, SelectOption, SimpleArrayField, SimpleBooleanField, SimpleComboboxField, SimpleDateField, SimpleEmailField, SimpleNumberField, SimplePasswordField, SimpleRadioGroupField, SimpleSelectField, SimpleTextField, SimpleTextFieldProps, SimpleTextareaField, SwitchField, SwitchFieldProps, TanStackActionSubmit, TanStackActionsForm, TanStackCardForm, TanStackContainerForm, TanStackDialogForm, TanStackFieldGroup, TanStackPopoverForm, TanStackSectionForm, TanStackTitleField, TextEditorField, TextEditorFieldProps, TextField, TextFieldProps, TextFieldValue, TextareaField, TextareaFieldProps, useTanStackFieldContext, useTanStackForm, useTanStackFormContext, withTanStackFieldGroup, withTanStackForm };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as EmailFieldProps, A as TanStackActionSubmit, B as TextField, C as SimpleNumberField, D as SimpleTextField, E as SimpleSelectField, F as TanStackFieldGroup, G as useTanStackFieldContext, H as useTanStackForm, I as TanStackPopoverForm, J as BooleanFieldValue, K as useTanStackFormContext, L as TanStackSectionForm, M as TanStackCardForm, N as TanStackContainerForm, O as SimpleTextareaField, P as TanStackDialogForm, Q as DateFieldValue, R as TanStackTitleField, S as SimpleEmailField, T as SimpleRadioGroupField, U as withTanStackFieldGroup, V as TextareaField, W as withTanStackForm, X as ComboboxFieldProps, Y as CheckboxFieldProps, Z as DateFieldProps, _ as SelectField, a as DateField, at as NumberFieldValue, b as SimpleComboboxField, c as FieldContent, ct as RadioOption, d as FieldGroup, dt as SimpleTextFieldProps, et as FieldOrientation, f as FieldLabel, ft as SwitchFieldProps, g as RadioGroupField, gt as TextareaFieldProps, h as PasswordField, ht as TextFieldValue, i as ComboboxField, it as NumberFieldProps, j as TanStackActionsForm, k as SwitchField, l as FieldContentMain, lt as SelectFieldProps, m as NumberField, mt as TextFieldProps, n as ArrayHeaderRow, nt as FieldType, o as EmailField, ot as PasswordFieldProps, p as FieldSeparator, pt as TextEditorFieldProps, q as AnyFieldProps, r as CheckboxField, rt as MultiSelectFieldValue, s as Field, st as RadioGroupFieldProps, t as ArrayCol, tt as FieldRounding, u as FieldError, ut as SelectOption, v as SimpleArrayField, w as SimplePasswordField, x as SimpleDateField, y as SimpleBooleanField, z as TextEditorField } from "../../index-
|
|
1
|
+
import { $ as EmailFieldProps, A as TanStackActionSubmit, B as TextField, C as SimpleNumberField, D as SimpleTextField, E as SimpleSelectField, F as TanStackFieldGroup, G as useTanStackFieldContext, H as useTanStackForm, I as TanStackPopoverForm, J as BooleanFieldValue, K as useTanStackFormContext, L as TanStackSectionForm, M as TanStackCardForm, N as TanStackContainerForm, O as SimpleTextareaField, P as TanStackDialogForm, Q as DateFieldValue, R as TanStackTitleField, S as SimpleEmailField, T as SimpleRadioGroupField, U as withTanStackFieldGroup, V as TextareaField, W as withTanStackForm, X as ComboboxFieldProps, Y as CheckboxFieldProps, Z as DateFieldProps, _ as SelectField, a as DateField, at as NumberFieldValue, b as SimpleComboboxField, c as FieldContent, ct as RadioOption, d as FieldGroup, dt as SimpleTextFieldProps, et as FieldOrientation, f as FieldLabel, ft as SwitchFieldProps, g as RadioGroupField, gt as TextareaFieldProps, h as PasswordField, ht as TextFieldValue, i as ComboboxField, it as NumberFieldProps, j as TanStackActionsForm, k as SwitchField, l as FieldContentMain, lt as SelectFieldProps, m as NumberField, mt as TextFieldProps, n as ArrayHeaderRow, nt as FieldType, o as EmailField, ot as PasswordFieldProps, p as FieldSeparator, pt as TextEditorFieldProps, q as AnyFieldProps, r as CheckboxField, rt as MultiSelectFieldValue, s as Field, st as RadioGroupFieldProps, t as ArrayCol, tt as FieldRounding, u as FieldError, ut as SelectOption, v as SimpleArrayField, w as SimplePasswordField, x as SimpleDateField, y as SimpleBooleanField, z as TextEditorField } from "../../index-BGnN6Vax.mjs";
|
|
2
2
|
export { AnyFieldProps, ArrayCol, ArrayHeaderRow, BooleanFieldValue, CheckboxField, CheckboxFieldProps, ComboboxField, ComboboxFieldProps, DateField, DateFieldProps, DateFieldValue, EmailField, EmailFieldProps, Field, FieldContent, FieldContentMain, FieldError, FieldGroup, FieldLabel, FieldOrientation, FieldRounding, FieldSeparator, FieldType, MultiSelectFieldValue, NumberField, NumberFieldProps, NumberFieldValue, PasswordField, PasswordFieldProps, RadioGroupField, RadioGroupFieldProps, RadioOption, SelectField, SelectFieldProps, SelectOption, SimpleArrayField, SimpleBooleanField, SimpleComboboxField, SimpleDateField, SimpleEmailField, SimpleNumberField, SimplePasswordField, SimpleRadioGroupField, SimpleSelectField, SimpleTextField, SimpleTextFieldProps, SimpleTextareaField, SwitchField, SwitchFieldProps, TanStackActionSubmit, TanStackActionsForm, TanStackCardForm, TanStackContainerForm, TanStackDialogForm, TanStackFieldGroup, TanStackPopoverForm, TanStackSectionForm, TanStackTitleField, TextEditorField, TextEditorFieldProps, TextField, TextFieldProps, TextFieldValue, TextareaField, TextareaFieldProps, useTanStackFieldContext, useTanStackForm, useTanStackFormContext, withTanStackFieldGroup, withTanStackForm };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e,B as t,C as n,D as r,E as i,F as a,G as o,H as s,I as c,K as l,L as u,M as d,N as f,O as p,P as m,R as h,S as g,T as _,U as v,V as y,W as b,_ as x,a as S,b as C,c as w,d as T,f as E,g as D,h as O,i as k,j as A,k as j,l as M,m as N,n as P,o as F,p as I,r as L,s as R,t as z,u as B,v as V,w as H,x as U,y as W,z as G}from"../../tanstack-form-
|
|
1
|
+
import{A as e,B as t,C as n,D as r,E as i,F as a,G as o,H as s,I as c,K as l,L as u,M as d,N as f,O as p,P as m,R as h,S as g,T as _,U as v,V as y,W as b,_ as x,a as S,b as C,c as w,d as T,f as E,g as D,h as O,i as k,j as A,k as j,l as M,m as N,n as P,o as F,p as I,r as L,s as R,t as z,u as B,v as V,w as H,x as U,y as W,z as G}from"../../tanstack-form-CKAWexet.mjs";export{z as ArrayCol,P as ArrayHeaderRow,L as CheckboxField,k as ComboboxField,S as DateField,F as EmailField,R as Field,w as FieldContent,M as FieldContentMain,B as FieldError,T as FieldGroup,E as FieldLabel,I as FieldSeparator,N as NumberField,O as PasswordField,D as RadioGroupField,x as SelectField,V as SimpleArrayField,W as SimpleBooleanField,C as SimpleComboboxField,U as SimpleDateField,g as SimpleEmailField,n as SimpleNumberField,H as SimplePasswordField,_ as SimpleRadioGroupField,i as SimpleSelectField,r as SimpleTextField,p as SimpleTextareaField,j as SwitchField,e as TanStackActionSubmit,A as TanStackActionsForm,d as TanStackCardForm,f as TanStackContainerForm,m as TanStackDialogForm,a as TanStackFieldGroup,c as TanStackPopoverForm,u as TanStackSectionForm,h as TanStackTitleField,G as TextEditorField,t as TextField,y as TextareaField,o as useTanStackFieldContext,s as useTanStackForm,l as useTanStackFormContext,v as withTanStackFieldGroup,b as withTanStackForm};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./ui/tooltip.cjs"),t=require("./ui/separator.cjs");let n=require("lucide-react"),r=require("react"),i=require("@customafk/react-toolkit/utils"),a=require("class-variance-authority"),o=require("react/jsx-runtime"),s=require("radix-ui");function c({className:e,children:t,...n}){return(0,o.jsxs)(s.Label.Root,{"data-slot":`label`,className:(0,i.cn)(`text-text-positive`,`flex w-full items-center justify-between`,`select-none font-medium text-sm/6 leading-none`,`group-data-[disabled=true]:pointer-events-none`,`group-data-[disabled=true]:opacity-50`,`peer-disabled:cursor-not-allowed`,`peer-disabled:opacity-50`,`aria-required:*:data-[slot=required-indicator]:inline-block`,e),...n,children:[(0,o.jsx)(`span`,{className:`flex items-center gap-1`,children:t}),(0,o.jsx)(`span`,{"data-slot":`required-indicator`,className:`hidden shrink-0 rounded-lg bg-danger-strong px-1.5 py-1 font-semibold text-[11px] leading-none text-white`,children:`Bắt buộc`})]})}const l=(0,a.cva)(`group/field flex w-full gap-2 data-[invalid=true]:text-danger *:data-[slot=field-content]:gap-0`,{variants:{orientation:{vertical:[`flex-col *:w-full [&>.sr-only]:w-auto`],horizontal:[`flex-row items-center gap-4`,`*:data-[slot=field-content]:basis-1/2`,`*:data-[slot=field-content-main]:flex-1`,`*:data-[slot=field-label]:flex-auto`,`has-[>[data-slot=field-content]]:items-start`,`has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`],responsive:[`flex-col *:w-full [&>.sr-only]:w-auto`,`@md/field-group:flex-row`,`@md/field-group:items-center`,`@md/field-group:gap-4`,`@md/field-group:*:w-auto`,`@md/field-group:*:data-[slot=field-content]:basis-1/2`,`@md/field-group:*:data-[slot=field-content-main]:basis-1/2`,`@md/field-group:*:data-[slot=field-label]:flex-auto`,`@md/field-group:has-[>[data-slot=field-content]]:items-start`,`@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`]}},defaultVariants:{orientation:`vertical`}}),u=(0,r.memo)(({className:e,...t})=>(0,o.jsx)(`fieldset`,{"data-slot":`field-set`,className:(0,i.cn)(`flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t}));u.displayName=`FieldSet`;const d=(0,r.memo)(({className:e,variant:t=`legend`,...n})=>(0,o.jsx)(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:(0,i.cn)(`mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,e),...n}));d.displayName=`FieldLegend`;const f=(0,r.memo)(({className:e,...t})=>(0,o.jsx)(`div`,{"data-slot":`field-group`,className:(0,i.cn)(`group/field-group @container/field-group`,`flex flex-col gap-7 pt-4`,`data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t}));f.displayName=`FieldGroup`;const p=(0,r.memo)(({className:e,orientation:t=`vertical`,...n})=>(0,o.jsx)(`div`,{"data-slot":`field`,"data-orientation":t,className:(0,i.cn)(l({orientation:t}),e),...n}));p.displayName=`Field`;const m=(0,r.memo)(({className:e,...t})=>(0,o.jsx)(`div`,{"data-slot":`field-content`,className:(0,i.cn)(`group/field-content flex flex-col gap-1.5 leading-snug`,e),...t}));m.displayName=`FieldContent`;const h=(0,r.memo)(({className:e,...t})=>(0,o.jsx)(`div`,{"data-slot":`field-content-main`,className:(0,i.cn)(`relative`,e),...t}));h.displayName=`FieldContentMain`;const g=(0,r.memo)(({className:e,...t})=>(0,o.jsx)(c,{"data-slot":`field-label`,className:(0,i.cn)(`group/field-label peer/field-label min-h-6 gap-1 font-medium leading-snug`,`has-[>[data-slot=field]]:w-full`,`has-[>[data-slot=field]]:flex-col`,`has-[>[data-slot=field]]:rounded-md`,`has-[>[data-slot=field]]:border`,`has-[>[data-slot=field]]:border-border`,`has-data-[state=checked]:border-primary`,`*:data-[slot=field]:p-4 group-data-[disabled=true]/field:opacity-50`,e),...t}));g.displayName=`FieldLabel`;const _=(0,r.memo)(({className:e,...t})=>(0,o.jsx)(`div`,{"data-slot":`field-label`,className:(0,i.cn)(`flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50`,e),...t}));_.displayName=`FieldTitle`;const v=(0,r.memo)(({className:e,...t})=>(0,o.jsx)(`p`,{"data-slot":`field-description`,className:(0,i.cn)(`nth-last-2:-mt-1 font-normal text-text-positive-weak text-xs leading-normal last:mt-0 [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4 [[data-variant=legend]+&]:-mt-1.5`,e),...t}));v.displayName=`FieldDescription`;const y=(0,r.memo)(({isShow:e=!0,className:t,children:r,...a})=>e===!1?null:(0,o.jsxs)(`div`,{"data-slot":`field-note`,className:(0,i.cn)(`flex items-start gap-1.5 rounded border border-primary-muted/60 bg-primary-bg-subtle/80 px-2.5 py-2 text-text-positive-weak text-xs`,t),...a,children:[(0,o.jsx)(n.InfoIcon,{size:12,className:`mt-0.5 shrink-0 text-primary/70`}),(0,o.jsx)(`span`,{children:r})]}));y.displayName=`FieldNote`;const b=(0,r.memo)(({tooltip:t})=>(0,o.jsxs)(e.Tooltip,{children:[(0,o.jsx)(e.TooltipTrigger,{asChild:!0,children:(0,o.jsxs)(`button`,{type:`button`,tabIndex:-1,className:`inline-flex cursor-default items-center text-text-positive-weak/70 hover:text-text-positive focus:outline-none`,children:[(0,o.jsx)(n.HelpCircleIcon,{size:13,"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:`sr-only`,children:`Thêm thông tin`})]})}),(0,o.jsx)(e.TooltipContent,{side:`top`,className:`max-w-xs text-balance`,children:t})]}));b.displayName=`FieldTooltip`;const x=(0,r.memo)(({children:e,className:n,...r})=>(0,o.jsxs)(`div`,{"data-slot":`field-separator`,"data-content":!!e,className:(0,i.cn)(`relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2`,n),...r,children:[(0,o.jsx)(t.Separator,{className:`absolute inset-0 top-1/2`}),e&&(0,o.jsx)(`span`,{className:`relative mx-auto block w-fit bg-background px-2 text-text-positive-weak`,"data-slot":`field-separator-content`,children:e})]}));x.displayName=`FieldSeparator`;const S=(0,r.memo)(({className:e,children:t,errors:n,requiredMessage:a=`Trường này là bắt buộc`,...s})=>{let c=(0,r.useMemo)(()=>{let e=e=>e.code===`invalid_type`?a:e.message;return t||(n?n?.length===1&&n[0]?.message?(0,o.jsx)(`div`,{className:`flex flex-row items-center justify-start gap-x-0.5`,children:(0,o.jsx)(`p`,{children:e(n[0])})}):(0,o.jsx)(`ul`,{className:`flex list-none flex-col`,children:n.map(t=>typeof t==`string`?(0,o.jsx)(`li`,{children:t},t):t?.message?(0,o.jsx)(`li`,{children:e(t)},t.code??t.message):null)}):null)},[t,n,a]);return c?(0,o.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:(0,i.cn)(`w-full font-medium text-danger-strong text-xs`,e),...s,children:c}):null});S.displayName=`FieldError`,exports.Field=p,exports.FieldContent=m,exports.FieldContentMain=h,exports.FieldDescription=v,exports.FieldError=S,exports.FieldGroup=f,exports.FieldLabel=g,exports.FieldLegend=d,exports.FieldNote=y,exports.FieldSeparator=x,exports.FieldTitle=_,exports.FieldTooltip=b;
|
|
2
|
-
//# sourceMappingURL=field-
|
|
1
|
+
const e=require("./ui/tooltip.cjs"),t=require("./ui/separator.cjs");let n=require("lucide-react"),r=require("react"),i=require("@customafk/react-toolkit/utils"),a=require("class-variance-authority"),o=require("react/jsx-runtime"),s=require("radix-ui");function c({className:e,children:t,...n}){return(0,o.jsxs)(s.Label.Root,{"data-slot":`label`,className:(0,i.cn)(`text-text-positive`,`flex w-full items-center justify-between`,`select-none font-medium text-sm/6 leading-none`,`group-data-[disabled=true]:pointer-events-none`,`group-data-[disabled=true]:opacity-50`,`peer-disabled:cursor-not-allowed`,`peer-disabled:opacity-50`,`aria-required:*:data-[slot=required-indicator]:inline-block`,e),...n,children:[(0,o.jsx)(`span`,{className:`flex items-center gap-1`,children:t}),(0,o.jsx)(`span`,{"data-slot":`required-indicator`,className:`hidden shrink-0 rounded-lg bg-danger-strong px-1.5 py-1 font-semibold text-[11px] leading-none text-white`,children:`Bắt buộc`})]})}const l=(0,a.cva)(`group/field flex w-full gap-2 data-[invalid=true]:text-danger *:data-[slot=field-content]:gap-0`,{variants:{orientation:{vertical:[`flex-col *:w-full [&>.sr-only]:w-auto`],horizontal:[`flex-row items-center gap-4`,`*:data-[slot=field-content]:basis-1/2`,`*:data-[slot=field-content-main]:flex-1`,`*:data-[slot=field-label]:flex-auto`,`has-[>[data-slot=field-content]]:items-start`,`has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`],responsive:[`flex-col *:w-full [&>.sr-only]:w-auto`,`@md/field-group:flex-row`,`@md/field-group:items-center`,`@md/field-group:gap-4`,`@md/field-group:*:w-auto`,`@md/field-group:*:data-[slot=field-content]:basis-1/2`,`@md/field-group:*:data-[slot=field-content-main]:basis-1/2`,`@md/field-group:*:data-[slot=field-label]:flex-auto`,`@md/field-group:has-[>[data-slot=field-content]]:items-start`,`@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`]}},defaultVariants:{orientation:`vertical`}}),u=(0,r.memo)(({className:e,...t})=>(0,o.jsx)(`fieldset`,{"data-slot":`field-set`,className:(0,i.cn)(`flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t}));u.displayName=`FieldSet`;const d=(0,r.memo)(({className:e,variant:t=`legend`,...n})=>(0,o.jsx)(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:(0,i.cn)(`mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,e),...n}));d.displayName=`FieldLegend`;const f=(0,r.memo)(({className:e,...t})=>(0,o.jsx)(`div`,{"data-slot":`field-group`,className:(0,i.cn)(`group/field-group @container/field-group`,`flex flex-col gap-7 pt-4`,`data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t}));f.displayName=`FieldGroup`;const p=(0,r.memo)(({className:e,orientation:t=`vertical`,...n})=>(0,o.jsx)(`div`,{"data-slot":`field`,"data-orientation":t,className:(0,i.cn)(l({orientation:t}),e),...n}));p.displayName=`Field`;const m=(0,r.memo)(({className:e,...t})=>(0,o.jsx)(`div`,{"data-slot":`field-content`,className:(0,i.cn)(`group/field-content flex flex-col gap-1.5 leading-snug`,e),...t}));m.displayName=`FieldContent`;const h=(0,r.memo)(({className:e,...t})=>(0,o.jsx)(`div`,{"data-slot":`field-content-main`,className:(0,i.cn)(`relative`,e),...t}));h.displayName=`FieldContentMain`;const g=(0,r.memo)(({className:e,...t})=>(0,o.jsx)(c,{"data-slot":`field-label`,className:(0,i.cn)(`group/field-label peer/field-label min-h-6 gap-1 font-medium leading-snug`,`has-[>[data-slot=field]]:w-full`,`has-[>[data-slot=field]]:flex-col`,`has-[>[data-slot=field]]:rounded-md`,`has-[>[data-slot=field]]:border`,`has-[>[data-slot=field]]:border-border`,`has-data-[state=checked]:border-primary`,`*:data-[slot=field]:p-4 group-data-[disabled=true]/field:opacity-50`,e),...t}));g.displayName=`FieldLabel`;const _=(0,r.memo)(({className:e,...t})=>(0,o.jsx)(`div`,{"data-slot":`field-label`,className:(0,i.cn)(`flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50`,e),...t}));_.displayName=`FieldTitle`;const v=(0,r.memo)(({className:e,...t})=>(0,o.jsx)(`p`,{"data-slot":`field-description`,className:(0,i.cn)(`nth-last-2:-mt-1 font-normal text-text-positive-weak text-xs leading-normal last:mt-0 [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4 [[data-variant=legend]+&]:-mt-1.5`,e),...t}));v.displayName=`FieldDescription`;const y=(0,r.memo)(({isShow:e=!0,className:t,children:r,...a})=>e===!1?null:(0,o.jsxs)(`div`,{"data-slot":`field-note`,className:(0,i.cn)(`flex items-start gap-1.5 rounded border border-primary-muted/60 bg-primary-bg-subtle/80 px-2.5 py-2 text-text-positive-weak text-xs mt-1`,t),...a,children:[(0,o.jsx)(n.InfoIcon,{size:12,className:`mt-0.5 shrink-0 text-primary/70`}),(0,o.jsx)(`span`,{children:r})]}));y.displayName=`FieldNote`;const b=(0,r.memo)(({tooltip:t})=>(0,o.jsxs)(e.Tooltip,{children:[(0,o.jsx)(e.TooltipTrigger,{asChild:!0,children:(0,o.jsxs)(`button`,{type:`button`,tabIndex:-1,className:`inline-flex cursor-default items-center text-text-positive-weak/70 hover:text-text-positive focus:outline-none`,children:[(0,o.jsx)(n.HelpCircleIcon,{size:13,"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:`sr-only`,children:`Thêm thông tin`})]})}),(0,o.jsx)(e.TooltipContent,{side:`top`,className:`max-w-xs text-balance`,children:t})]}));b.displayName=`FieldTooltip`;const x=(0,r.memo)(({children:e,className:n,...r})=>(0,o.jsxs)(`div`,{"data-slot":`field-separator`,"data-content":!!e,className:(0,i.cn)(`relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2`,n),...r,children:[(0,o.jsx)(t.Separator,{className:`absolute inset-0 top-1/2`}),e&&(0,o.jsx)(`span`,{className:`relative mx-auto block w-fit bg-background px-2 text-text-positive-weak`,"data-slot":`field-separator-content`,children:e})]}));x.displayName=`FieldSeparator`;const S=(0,r.memo)(({className:e,children:t,errors:n,requiredMessage:a=`Trường này là bắt buộc`,...s})=>{let c=(0,r.useMemo)(()=>{let e=e=>e.code===`invalid_type`?a:e.message;return t||(n?n?.length===1&&n[0]?.message?(0,o.jsx)(`div`,{className:`flex flex-row items-center justify-start gap-x-0.5`,children:(0,o.jsx)(`p`,{children:e(n[0])})}):(0,o.jsx)(`ul`,{className:`flex list-none flex-col`,children:n.map(t=>typeof t==`string`?(0,o.jsx)(`li`,{children:t},t):t?.message?(0,o.jsx)(`li`,{children:e(t)},t.code??t.message):null)}):null)},[t,n,a]);return c?(0,o.jsx)(`div`,{role:`alert`,"data-slot":`field-error`,className:(0,i.cn)(`w-full font-medium text-danger-strong text-xs`,e),...s,children:c}):null});S.displayName=`FieldError`,exports.Field=p,exports.FieldContent=m,exports.FieldContentMain=h,exports.FieldDescription=v,exports.FieldError=S,exports.FieldGroup=f,exports.FieldLabel=g,exports.FieldLegend=d,exports.FieldNote=y,exports.FieldSeparator=x,exports.FieldTitle=_,exports.FieldTooltip=b;
|
|
2
|
+
//# sourceMappingURL=field-BSLi-P0Q.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-BV5twmKA.cjs","names":["LabelPrimitive","InfoIcon","Tooltip","TooltipTrigger","HelpCircleIcon","TooltipContent","Separator"],"sources":["../packages/components/features/tanstack-form/components/ui/label.tsx","../packages/components/features/tanstack-form/components/ui/field.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Label as LabelPrimitive } from 'radix-ui';\n\n/**\n * Form field label that automatically renders a \"Required\" badge when the field is marked aria-required.\n *\n * @example\n * import { Label } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <Label htmlFor=\"email\">Email address</Label>\n */\nfunction Label({ className, children, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {\n return (\n <LabelPrimitive.Root\n data-slot=\"label\"\n className={cn(\n 'text-text-positive',\n 'flex w-full items-center justify-between',\n 'select-none font-medium text-sm/6 leading-none',\n 'group-data-[disabled=true]:pointer-events-none',\n 'group-data-[disabled=true]:opacity-50',\n 'peer-disabled:cursor-not-allowed',\n 'peer-disabled:opacity-50',\n 'aria-required:*:data-[slot=required-indicator]:inline-block',\n className\n )}\n {...props}\n >\n <span className=\"flex items-center gap-1\">{children}</span>\n <span\n data-slot=\"required-indicator\"\n className=\"hidden shrink-0 rounded-lg bg-danger-strong px-1.5 py-1 font-semibold text-[11px] leading-none text-white\"\n >\n Bắt buộc\n </span>\n </LabelPrimitive.Root>\n );\n}\n\nexport { Label };\n","'use client';\n\nimport { memo, useMemo } from 'react';\n\nimport { HelpCircleIcon, InfoIcon } from 'lucide-react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Separator } from '@/components/ui/separator';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { Label } from './label';\n\nconst fieldVariants = cva('group/field flex w-full gap-2 data-[invalid=true]:text-danger *:data-[slot=field-content]:gap-0', {\n variants: {\n orientation: {\n vertical: ['flex-col *:w-full [&>.sr-only]:w-auto'],\n horizontal: [\n 'flex-row items-center gap-4',\n '*:data-[slot=field-content]:basis-1/2',\n '*:data-[slot=field-content-main]:flex-1',\n '*:data-[slot=field-label]:flex-auto',\n 'has-[>[data-slot=field-content]]:items-start',\n 'has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n ],\n responsive: [\n 'flex-col *:w-full [&>.sr-only]:w-auto',\n '@md/field-group:flex-row',\n '@md/field-group:items-center',\n '@md/field-group:gap-4',\n '@md/field-group:*:w-auto',\n '@md/field-group:*:data-[slot=field-content]:basis-1/2',\n '@md/field-group:*:data-[slot=field-content-main]:basis-1/2',\n '@md/field-group:*:data-[slot=field-label]:flex-auto',\n '@md/field-group:has-[>[data-slot=field-content]]:items-start',\n '@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n ],\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n});\n\n/**\n * Outermost `<fieldset>` wrapper that stacks multiple `Field` rows with consistent vertical spacing.\n *\n * @example\n * import { FieldSet } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldSet>\n * <Field><FieldLabel>Name</FieldLabel><FieldContent><input /></FieldContent></Field>\n * </FieldSet>\n */\nconst FieldSet = memo(({ className, ...props }: React.ComponentProps<'fieldset'>) => {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn('flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3', className)}\n {...props}\n />\n );\n});\nFieldSet.displayName = 'FieldSet';\n\n/**\n * Props for {@link FieldLegend}.\n */\ntype FieldLegendProps = React.ComponentProps<'legend'> & {\n /**\n * Visual weight of the legend text.\n * - `'legend'` — larger base-size text (section heading).\n * - `'label'` — smaller label-size text (matches field label weight).\n * @default 'legend'\n */\n variant?: 'legend' | 'label';\n};\n\n/**\n * `<legend>` element for a `<fieldset>`, styled as either a section heading or a compact label.\n *\n * @example\n * import { FieldSet, FieldLegend } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldSet>\n * <FieldLegend variant=\"legend\">Personal details</FieldLegend>\n * </FieldSet>\n */\nconst FieldLegend = memo(({ className, variant = 'legend', ...props }: FieldLegendProps) => {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn('mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base', className)}\n {...props}\n />\n );\n});\nFieldLegend.displayName = 'FieldLegend';\n\n/**\n * Container `<div>` that groups a set of `Field` rows with container-query support for responsive layouts.\n *\n * @example\n * import { FieldGroup } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldGroup>\n * <Field>…</Field>\n * <Field>…</Field>\n * </FieldGroup>\n */\nconst FieldGroup = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group @container/field-group',\n 'flex flex-col gap-7 pt-4',\n 'data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4',\n className\n )}\n {...props}\n />\n );\n});\nFieldGroup.displayName = 'FieldGroup';\n\n/**\n * Single form field row that arranges label, input, and meta elements with configurable orientation.\n *\n * @example\n * import { Field } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <Field orientation=\"horizontal\">\n * <FieldLabel htmlFor=\"username\">Username</FieldLabel>\n * <FieldContent><input id=\"username\" /></FieldContent>\n * </Field>\n */\nconst Field = memo(({ className, orientation = 'vertical', ...props }: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>) => {\n return <div data-slot=\"field\" data-orientation={orientation} className={cn(fieldVariants({ orientation }), className)} {...props} />;\n});\nField.displayName = 'Field';\n\n/**\n * Flex column wrapper that houses the primary input control together with description and error slots.\n *\n * @example\n * import { FieldContent } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldContent>\n * <input type=\"text\" />\n * <FieldDescription>Enter your full name.</FieldDescription>\n * </FieldContent>\n */\nconst FieldContent = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return <div data-slot=\"field-content\" className={cn('group/field-content flex flex-col gap-1.5 leading-snug', className)} {...props} />;\n});\nFieldContent.displayName = 'FieldContent';\n\n/**\n * Positioned wrapper for the main input element that enables absolutely-placed adornments (icons, spinners).\n *\n * @example\n * import { FieldContentMain } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldContentMain>\n * <input type=\"text\" className=\"pr-8\" />\n * <SearchIcon className=\"absolute right-2 top-2\" />\n * </FieldContentMain>\n */\nconst FieldContentMain = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return <div data-slot=\"field-content-main\" className={cn('relative', className)} {...props} />;\n});\nFieldContentMain.displayName = 'FieldContentMain';\n\n/**\n * Styled `<label>` element for a `Field`, extending the base `Label` with field-group-aware spacing and border states.\n *\n * @example\n * import { FieldLabel } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldLabel htmlFor=\"email\" aria-required>Email</FieldLabel>\n */\nconst FieldLabel = memo(({ className, ...props }: React.ComponentProps<typeof Label>) => {\n return (\n <Label\n data-slot=\"field-label\"\n className={cn(\n 'group/field-label peer/field-label min-h-6 gap-1 font-medium leading-snug',\n 'has-[>[data-slot=field]]:w-full',\n 'has-[>[data-slot=field]]:flex-col',\n 'has-[>[data-slot=field]]:rounded-md',\n 'has-[>[data-slot=field]]:border',\n 'has-[>[data-slot=field]]:border-border',\n 'has-data-[state=checked]:border-primary',\n '*:data-[slot=field]:p-4 group-data-[disabled=true]/field:opacity-50',\n className\n )}\n {...props}\n />\n );\n});\nFieldLabel.displayName = 'FieldLabel';\n\n/**\n * Inline title element (non-`<label>`) for fields whose label cannot be a native `<label>`, such as custom checkbox groups.\n *\n * @example\n * import { FieldTitle } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldTitle>Notification preferences</FieldTitle>\n */\nconst FieldTitle = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return (\n <div\n data-slot=\"field-label\"\n className={cn('flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50', className)}\n {...props}\n />\n );\n});\nFieldTitle.displayName = 'FieldTitle';\n\n/**\n * Supplementary hint text rendered below the input to guide the user, with support for inline anchor links.\n *\n * @example\n * import { FieldDescription } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldDescription>Must be at least 8 characters.</FieldDescription>\n */\nconst FieldDescription = memo(({ className, ...props }: React.ComponentProps<'p'>) => {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n // biome-ignore lint/security/noSecrets: true\n 'nth-last-2:-mt-1 font-normal text-text-positive-weak text-xs leading-normal last:mt-0 [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4 [[data-variant=legend]+&]:-mt-1.5',\n className\n )}\n {...props}\n />\n );\n});\nFieldDescription.displayName = 'FieldDescription';\n\n/**\n * Props for {@link FieldNote}.\n */\ntype FieldNoteProps = React.ComponentProps<'div'> & {\n /**\n * When `false` the note is not rendered at all; useful for conditional display without wrapper conditionals.\n * @default true\n */\n isShow?: boolean;\n};\n\n/**\n * Highlighted informational callout box with an info icon, shown below a field to surface contextual guidance.\n *\n * @example\n * import { FieldNote } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldNote isShow={isDraftMode}>Changes are saved automatically in draft mode.</FieldNote>\n */\nconst FieldNote = memo(({ isShow = true, className, children, ...props }: FieldNoteProps) => {\n if (isShow === false) return null;\n return (\n <div\n data-slot=\"field-note\"\n className={cn(\n 'flex items-start gap-1.5 rounded border border-primary-muted/60 bg-primary-bg-subtle/80 px-2.5 py-2 text-text-positive-weak text-xs',\n className\n )}\n {...props}\n >\n <InfoIcon size={12} className=\"mt-0.5 shrink-0 text-primary/70\" />\n <span>{children}</span>\n </div>\n );\n});\nFieldNote.displayName = 'FieldNote';\n\n/**\n * Props for {@link FieldTooltip}.\n */\ntype FieldTooltipProps = {\n /** Text content displayed inside the tooltip when the help icon is hovered or focused. */\n tooltip: string;\n};\n\n/**\n * Small help-circle icon button that reveals a tooltip with additional field context on hover or focus.\n *\n * @example\n * import { FieldTooltip } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldLabel>\n * Password <FieldTooltip tooltip=\"Use at least one uppercase letter and one number.\" />\n * </FieldLabel>\n */\nconst FieldTooltip = memo(({ tooltip }: FieldTooltipProps) => {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n tabIndex={-1}\n className=\"inline-flex cursor-default items-center text-text-positive-weak/70 hover:text-text-positive focus:outline-none\"\n >\n <HelpCircleIcon size={13} aria-hidden=\"true\" />\n <span className=\"sr-only\">Thêm thông tin</span>\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"top\" className=\"max-w-xs text-balance\">\n {tooltip}\n </TooltipContent>\n </Tooltip>\n );\n});\nFieldTooltip.displayName = 'FieldTooltip';\n\n/**\n * Visual divider row that optionally displays a centered text label, used to separate logical sections within a `FieldGroup`.\n *\n * @example\n * import { FieldSeparator } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldSeparator>or</FieldSeparator>\n */\nconst FieldSeparator = memo(({ children, className, ...props }: React.PropsWithChildren<React.ComponentProps<'div'>>) => {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn('relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span className=\"relative mx-auto block w-fit bg-background px-2 text-text-positive-weak\" data-slot=\"field-separator-content\">\n {children}\n </span>\n )}\n </div>\n );\n});\nFieldSeparator.displayName = 'FieldSeparator';\n\n/**\n * Props for {@link FieldError}.\n */\ntype FieldErrorProps = React.ComponentProps<'div'> & {\n errors?: Array<{ code?: string; message?: string } | undefined>;\n requiredMessage?: string;\n};\n\nconst FieldError = memo(({ className, children, errors, requiredMessage = 'Trường này là bắt buộc', ...props }: FieldErrorProps) => {\n const content = useMemo(() => {\n const resolve = (error: { code?: string; message?: string }) => (error.code === 'invalid_type' ? requiredMessage : error.message);\n\n if (children) {\n return children;\n }\n\n if (!errors) {\n return null;\n }\n\n if (errors?.length === 1 && errors[0]?.message) {\n return (\n <div className=\"flex flex-row items-center justify-start gap-x-0.5\">\n <p>{resolve(errors[0])}</p>\n </div>\n );\n }\n\n return (\n <ul className=\"flex list-none flex-col\">\n {errors.map(error => {\n if (typeof error === 'string') return <li key={error}>{error}</li>;\n if (!error?.message) return null;\n return <li key={error.code ?? error.message}>{resolve(error)}</li>;\n })}\n </ul>\n );\n }, [children, errors, requiredMessage]);\n\n if (!content) {\n return null;\n }\n\n return (\n <div role=\"alert\" data-slot=\"field-error\" className={cn('w-full font-medium text-danger-strong text-xs', className)} {...props}>\n {content}\n </div>\n );\n});\nFieldError.displayName = 'FieldError';\n\nexport {\n Field,\n FieldLabel,\n FieldDescription,\n FieldNote,\n FieldError,\n FieldGroup,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldContent,\n FieldContentMain,\n FieldTitle,\n FieldTooltip,\n};\n"],"mappings":"4PAcA,SAAS,EAAM,CAAE,YAAW,WAAU,GAAG,GAA2D,CAClG,OACE,EAAA,EAAA,KAAA,CAACA,EAAAA,MAAe,KAAhB,CACE,YAAU,QACV,WAAA,EAAA,EAAA,GAAA,CACE,qBACA,2CACA,iDACA,iDACA,wCACA,mCACA,2BACA,8DACA,CACF,EACA,GAAI,WAbN,EAeE,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,0BAA2B,UAAe,CAAA,GAC1D,EAAA,EAAA,IAAA,CAAC,OAAD,CACE,YAAU,qBACV,UAAU,qHACX,UAEK,CAAA,CACa,GAEzB,CC1BA,MAAM,GAAA,EAAA,EAAA,IAAA,CAAoB,kGAAmG,CAC3H,SAAU,CACR,YAAa,CACX,SAAU,CAAC,uCAAuC,EAClD,WAAY,CACV,8BACA,wCACA,0CACA,sCACA,+CACA,yEACF,EACA,WAAY,CACV,wCACA,2BACA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b,EAAA,EAAA,IAAA,CAAC,IAAD,CAAA,SAAI,EAAQ,EAAO,EAAE,CAAK,CAAA,CACvB,CAAA,GAKP,EAAA,EAAA,IAAA,CAAC,KAAD,CAAI,UAAU,mCACX,EAAO,IAAI,GACN,OAAO,GAAU,UAAiB,EAAA,EAAA,IAAA,CAAC,KAAD,CAAA,SAAiB,CAAU,EAAlB,CAAkB,EAC5D,GAAO,SACL,EAAA,EAAA,IAAA,CAAC,KAAD,CAAA,SAAuC,EAAQ,CAAK,CAAM,EAAjD,EAAM,MAAQ,EAAM,OAA6B,EADrC,IAE7B,CACC,CAAA,EAlBG,KAoBX,EAAG,CAAC,EAAU,EAAQ,CAAe,CAAC,EAMtC,OAJK,GAKH,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,KAAK,QAAQ,YAAU,cAAc,WAAA,EAAA,EAAA,GAAA,CAAc,gDAAiD,CAAS,EAAG,GAAI,WACtH,CACE,CAAA,EANE,IAQX,CAAC,EACD,EAAW,YAAc"}
|
|
1
|
+
{"version":3,"file":"field-BSLi-P0Q.cjs","names":["LabelPrimitive","InfoIcon","Tooltip","TooltipTrigger","HelpCircleIcon","TooltipContent","Separator"],"sources":["../packages/components/features/tanstack-form/components/ui/label.tsx","../packages/components/features/tanstack-form/components/ui/field.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Label as LabelPrimitive } from 'radix-ui';\n\n/**\n * Form field label that automatically renders a \"Required\" badge when the field is marked aria-required.\n *\n * @example\n * import { Label } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <Label htmlFor=\"email\">Email address</Label>\n */\nfunction Label({ className, children, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {\n return (\n <LabelPrimitive.Root\n data-slot=\"label\"\n className={cn(\n 'text-text-positive',\n 'flex w-full items-center justify-between',\n 'select-none font-medium text-sm/6 leading-none',\n 'group-data-[disabled=true]:pointer-events-none',\n 'group-data-[disabled=true]:opacity-50',\n 'peer-disabled:cursor-not-allowed',\n 'peer-disabled:opacity-50',\n 'aria-required:*:data-[slot=required-indicator]:inline-block',\n className\n )}\n {...props}\n >\n <span className=\"flex items-center gap-1\">{children}</span>\n <span\n data-slot=\"required-indicator\"\n className=\"hidden shrink-0 rounded-lg bg-danger-strong px-1.5 py-1 font-semibold text-[11px] leading-none text-white\"\n >\n Bắt buộc\n </span>\n </LabelPrimitive.Root>\n );\n}\n\nexport { Label };\n","'use client';\n\nimport { memo, useMemo } from 'react';\n\nimport { HelpCircleIcon, InfoIcon } from 'lucide-react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Separator } from '@/components/ui/separator';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { Label } from './label';\n\nconst fieldVariants = cva('group/field flex w-full gap-2 data-[invalid=true]:text-danger *:data-[slot=field-content]:gap-0', {\n variants: {\n orientation: {\n vertical: ['flex-col *:w-full [&>.sr-only]:w-auto'],\n horizontal: [\n 'flex-row items-center gap-4',\n '*:data-[slot=field-content]:basis-1/2',\n '*:data-[slot=field-content-main]:flex-1',\n '*:data-[slot=field-label]:flex-auto',\n 'has-[>[data-slot=field-content]]:items-start',\n 'has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n ],\n responsive: [\n 'flex-col *:w-full [&>.sr-only]:w-auto',\n '@md/field-group:flex-row',\n '@md/field-group:items-center',\n '@md/field-group:gap-4',\n '@md/field-group:*:w-auto',\n '@md/field-group:*:data-[slot=field-content]:basis-1/2',\n '@md/field-group:*:data-[slot=field-content-main]:basis-1/2',\n '@md/field-group:*:data-[slot=field-label]:flex-auto',\n '@md/field-group:has-[>[data-slot=field-content]]:items-start',\n '@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n ],\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n});\n\n/**\n * Outermost `<fieldset>` wrapper that stacks multiple `Field` rows with consistent vertical spacing.\n *\n * @example\n * import { FieldSet } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldSet>\n * <Field><FieldLabel>Name</FieldLabel><FieldContent><input /></FieldContent></Field>\n * </FieldSet>\n */\nconst FieldSet = memo(({ className, ...props }: React.ComponentProps<'fieldset'>) => {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn('flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3', className)}\n {...props}\n />\n );\n});\nFieldSet.displayName = 'FieldSet';\n\n/**\n * Props for {@link FieldLegend}.\n */\ntype FieldLegendProps = React.ComponentProps<'legend'> & {\n /**\n * Visual weight of the legend text.\n * - `'legend'` — larger base-size text (section heading).\n * - `'label'` — smaller label-size text (matches field label weight).\n * @default 'legend'\n */\n variant?: 'legend' | 'label';\n};\n\n/**\n * `<legend>` element for a `<fieldset>`, styled as either a section heading or a compact label.\n *\n * @example\n * import { FieldSet, FieldLegend } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldSet>\n * <FieldLegend variant=\"legend\">Personal details</FieldLegend>\n * </FieldSet>\n */\nconst FieldLegend = memo(({ className, variant = 'legend', ...props }: FieldLegendProps) => {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn('mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base', className)}\n {...props}\n />\n );\n});\nFieldLegend.displayName = 'FieldLegend';\n\n/**\n * Container `<div>` that groups a set of `Field` rows with container-query support for responsive layouts.\n *\n * @example\n * import { FieldGroup } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldGroup>\n * <Field>…</Field>\n * <Field>…</Field>\n * </FieldGroup>\n */\nconst FieldGroup = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group @container/field-group',\n 'flex flex-col gap-7 pt-4',\n 'data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4',\n className\n )}\n {...props}\n />\n );\n});\nFieldGroup.displayName = 'FieldGroup';\n\n/**\n * Single form field row that arranges label, input, and meta elements with configurable orientation.\n *\n * @example\n * import { Field } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <Field orientation=\"horizontal\">\n * <FieldLabel htmlFor=\"username\">Username</FieldLabel>\n * <FieldContent><input id=\"username\" /></FieldContent>\n * </Field>\n */\nconst Field = memo(({ className, orientation = 'vertical', ...props }: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>) => {\n return <div data-slot=\"field\" data-orientation={orientation} className={cn(fieldVariants({ orientation }), className)} {...props} />;\n});\nField.displayName = 'Field';\n\n/**\n * Flex column wrapper that houses the primary input control together with description and error slots.\n *\n * @example\n * import { FieldContent } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldContent>\n * <input type=\"text\" />\n * <FieldDescription>Enter your full name.</FieldDescription>\n * </FieldContent>\n */\nconst FieldContent = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return <div data-slot=\"field-content\" className={cn('group/field-content flex flex-col gap-1.5 leading-snug', className)} {...props} />;\n});\nFieldContent.displayName = 'FieldContent';\n\n/**\n * Positioned wrapper for the main input element that enables absolutely-placed adornments (icons, spinners).\n *\n * @example\n * import { FieldContentMain } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldContentMain>\n * <input type=\"text\" className=\"pr-8\" />\n * <SearchIcon className=\"absolute right-2 top-2\" />\n * </FieldContentMain>\n */\nconst FieldContentMain = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return <div data-slot=\"field-content-main\" className={cn('relative', className)} {...props} />;\n});\nFieldContentMain.displayName = 'FieldContentMain';\n\n/**\n * Styled `<label>` element for a `Field`, extending the base `Label` with field-group-aware spacing and border states.\n *\n * @example\n * import { FieldLabel } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldLabel htmlFor=\"email\" aria-required>Email</FieldLabel>\n */\nconst FieldLabel = memo(({ className, ...props }: React.ComponentProps<typeof Label>) => {\n return (\n <Label\n data-slot=\"field-label\"\n className={cn(\n 'group/field-label peer/field-label min-h-6 gap-1 font-medium leading-snug',\n 'has-[>[data-slot=field]]:w-full',\n 'has-[>[data-slot=field]]:flex-col',\n 'has-[>[data-slot=field]]:rounded-md',\n 'has-[>[data-slot=field]]:border',\n 'has-[>[data-slot=field]]:border-border',\n 'has-data-[state=checked]:border-primary',\n '*:data-[slot=field]:p-4 group-data-[disabled=true]/field:opacity-50',\n className\n )}\n {...props}\n />\n );\n});\nFieldLabel.displayName = 'FieldLabel';\n\n/**\n * Inline title element (non-`<label>`) for fields whose label cannot be a native `<label>`, such as custom checkbox groups.\n *\n * @example\n * import { FieldTitle } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldTitle>Notification preferences</FieldTitle>\n */\nconst FieldTitle = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return (\n <div\n data-slot=\"field-label\"\n className={cn('flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50', className)}\n {...props}\n />\n );\n});\nFieldTitle.displayName = 'FieldTitle';\n\n/**\n * Supplementary hint text rendered below the input to guide the user, with support for inline anchor links.\n *\n * @example\n * import { FieldDescription } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldDescription>Must be at least 8 characters.</FieldDescription>\n */\nconst FieldDescription = memo(({ className, ...props }: React.ComponentProps<'p'>) => {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n // biome-ignore lint/security/noSecrets: true\n 'nth-last-2:-mt-1 font-normal text-text-positive-weak text-xs leading-normal last:mt-0 [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4 [[data-variant=legend]+&]:-mt-1.5',\n className\n )}\n {...props}\n />\n );\n});\nFieldDescription.displayName = 'FieldDescription';\n\n/**\n * Props for {@link FieldNote}.\n */\ntype FieldNoteProps = React.ComponentProps<'div'> & {\n /**\n * When `false` the note is not rendered at all; useful for conditional display without wrapper conditionals.\n * @default true\n */\n isShow?: boolean;\n};\n\n/**\n * Highlighted informational callout box with an info icon, shown below a field to surface contextual guidance.\n *\n * @example\n * import { FieldNote } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldNote isShow={isDraftMode}>Changes are saved automatically in draft mode.</FieldNote>\n */\nconst FieldNote = memo(({ isShow = true, className, children, ...props }: FieldNoteProps) => {\n if (isShow === false) return null;\n return (\n <div\n data-slot=\"field-note\"\n className={cn(\n 'flex items-start gap-1.5 rounded border border-primary-muted/60 bg-primary-bg-subtle/80 px-2.5 py-2 text-text-positive-weak text-xs mt-1',\n className\n )}\n {...props}\n >\n <InfoIcon size={12} className=\"mt-0.5 shrink-0 text-primary/70\" />\n <span>{children}</span>\n </div>\n );\n});\nFieldNote.displayName = 'FieldNote';\n\n/**\n * Props for {@link FieldTooltip}.\n */\ntype FieldTooltipProps = {\n /** Text content displayed inside the tooltip when the help icon is hovered or focused. */\n tooltip: string;\n};\n\n/**\n * Small help-circle icon button that reveals a tooltip with additional field context on hover or focus.\n *\n * @example\n * import { FieldTooltip } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldLabel>\n * Password <FieldTooltip tooltip=\"Use at least one uppercase letter and one number.\" />\n * </FieldLabel>\n */\nconst FieldTooltip = memo(({ tooltip }: FieldTooltipProps) => {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n tabIndex={-1}\n className=\"inline-flex cursor-default items-center text-text-positive-weak/70 hover:text-text-positive focus:outline-none\"\n >\n <HelpCircleIcon size={13} aria-hidden=\"true\" />\n <span className=\"sr-only\">Thêm thông tin</span>\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"top\" className=\"max-w-xs text-balance\">\n {tooltip}\n </TooltipContent>\n </Tooltip>\n );\n});\nFieldTooltip.displayName = 'FieldTooltip';\n\n/**\n * Visual divider row that optionally displays a centered text label, used to separate logical sections within a `FieldGroup`.\n *\n * @example\n * import { FieldSeparator } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldSeparator>or</FieldSeparator>\n */\nconst FieldSeparator = memo(({ children, className, ...props }: React.PropsWithChildren<React.ComponentProps<'div'>>) => {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn('relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span className=\"relative mx-auto block w-fit bg-background px-2 text-text-positive-weak\" data-slot=\"field-separator-content\">\n {children}\n </span>\n )}\n </div>\n );\n});\nFieldSeparator.displayName = 'FieldSeparator';\n\n/**\n * Props for {@link FieldError}.\n */\ntype FieldErrorProps = React.ComponentProps<'div'> & {\n errors?: Array<{ code?: string; message?: string } | undefined>;\n requiredMessage?: string;\n};\n\nconst FieldError = memo(({ className, children, errors, requiredMessage = 'Trường này là bắt buộc', ...props }: FieldErrorProps) => {\n const content = useMemo(() => {\n const resolve = (error: { code?: string; message?: string }) => (error.code === 'invalid_type' ? requiredMessage : error.message);\n\n if (children) {\n return children;\n }\n\n if (!errors) {\n return null;\n }\n\n if (errors?.length === 1 && errors[0]?.message) {\n return (\n <div className=\"flex flex-row items-center justify-start gap-x-0.5\">\n <p>{resolve(errors[0])}</p>\n </div>\n );\n }\n\n return (\n <ul className=\"flex list-none flex-col\">\n {errors.map(error => {\n if (typeof error === 'string') return <li key={error}>{error}</li>;\n if (!error?.message) return null;\n return <li key={error.code ?? error.message}>{resolve(error)}</li>;\n })}\n </ul>\n );\n }, [children, errors, requiredMessage]);\n\n if (!content) {\n return null;\n }\n\n return (\n <div role=\"alert\" data-slot=\"field-error\" className={cn('w-full font-medium text-danger-strong text-xs', className)} {...props}>\n {content}\n </div>\n );\n});\nFieldError.displayName = 'FieldError';\n\nexport {\n Field,\n FieldLabel,\n FieldDescription,\n FieldNote,\n FieldError,\n FieldGroup,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldContent,\n FieldContentMain,\n FieldTit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 @@
|
|
|
1
|
-
import{Tooltip as e,TooltipContent as t,TooltipTrigger as n}from"./ui/tooltip.mjs";import{Separator as r}from"./ui/separator.mjs";import{HelpCircleIcon as i,InfoIcon as a}from"lucide-react";import{memo as o,useMemo as s}from"react";import{cn as c}from"@customafk/react-toolkit/utils";import{cva as l}from"class-variance-authority";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{Label as f}from"radix-ui";function p({className:e,children:t,...n}){return d(f.Root,{"data-slot":`label`,className:c(`text-text-positive`,`flex w-full items-center justify-between`,`select-none font-medium text-sm/6 leading-none`,`group-data-[disabled=true]:pointer-events-none`,`group-data-[disabled=true]:opacity-50`,`peer-disabled:cursor-not-allowed`,`peer-disabled:opacity-50`,`aria-required:*:data-[slot=required-indicator]:inline-block`,e),...n,children:[u(`span`,{className:`flex items-center gap-1`,children:t}),u(`span`,{"data-slot":`required-indicator`,className:`hidden shrink-0 rounded-lg bg-danger-strong px-1.5 py-1 font-semibold text-[11px] leading-none text-white`,children:`Bắt buộc`})]})}const m=l(`group/field flex w-full gap-2 data-[invalid=true]:text-danger *:data-[slot=field-content]:gap-0`,{variants:{orientation:{vertical:[`flex-col *:w-full [&>.sr-only]:w-auto`],horizontal:[`flex-row items-center gap-4`,`*:data-[slot=field-content]:basis-1/2`,`*:data-[slot=field-content-main]:flex-1`,`*:data-[slot=field-label]:flex-auto`,`has-[>[data-slot=field-content]]:items-start`,`has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`],responsive:[`flex-col *:w-full [&>.sr-only]:w-auto`,`@md/field-group:flex-row`,`@md/field-group:items-center`,`@md/field-group:gap-4`,`@md/field-group:*:w-auto`,`@md/field-group:*:data-[slot=field-content]:basis-1/2`,`@md/field-group:*:data-[slot=field-content-main]:basis-1/2`,`@md/field-group:*:data-[slot=field-label]:flex-auto`,`@md/field-group:has-[>[data-slot=field-content]]:items-start`,`@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`]}},defaultVariants:{orientation:`vertical`}}),h=o(({className:e,...t})=>u(`fieldset`,{"data-slot":`field-set`,className:c(`flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t}));h.displayName=`FieldSet`;const g=o(({className:e,variant:t=`legend`,...n})=>u(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:c(`mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,e),...n}));g.displayName=`FieldLegend`;const _=o(({className:e,...t})=>u(`div`,{"data-slot":`field-group`,className:c(`group/field-group @container/field-group`,`flex flex-col gap-7 pt-4`,`data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t}));_.displayName=`FieldGroup`;const v=o(({className:e,orientation:t=`vertical`,...n})=>u(`div`,{"data-slot":`field`,"data-orientation":t,className:c(m({orientation:t}),e),...n}));v.displayName=`Field`;const y=o(({className:e,...t})=>u(`div`,{"data-slot":`field-content`,className:c(`group/field-content flex flex-col gap-1.5 leading-snug`,e),...t}));y.displayName=`FieldContent`;const b=o(({className:e,...t})=>u(`div`,{"data-slot":`field-content-main`,className:c(`relative`,e),...t}));b.displayName=`FieldContentMain`;const x=o(({className:e,...t})=>u(p,{"data-slot":`field-label`,className:c(`group/field-label peer/field-label min-h-6 gap-1 font-medium leading-snug`,`has-[>[data-slot=field]]:w-full`,`has-[>[data-slot=field]]:flex-col`,`has-[>[data-slot=field]]:rounded-md`,`has-[>[data-slot=field]]:border`,`has-[>[data-slot=field]]:border-border`,`has-data-[state=checked]:border-primary`,`*:data-[slot=field]:p-4 group-data-[disabled=true]/field:opacity-50`,e),...t}));x.displayName=`FieldLabel`;const S=o(({className:e,...t})=>u(`div`,{"data-slot":`field-label`,className:c(`flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50`,e),...t}));S.displayName=`FieldTitle`;const C=o(({className:e,...t})=>u(`p`,{"data-slot":`field-description`,className:c(`nth-last-2:-mt-1 font-normal text-text-positive-weak text-xs leading-normal last:mt-0 [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4 [[data-variant=legend]+&]:-mt-1.5`,e),...t}));C.displayName=`FieldDescription`;const w=o(({isShow:e=!0,className:t,children:n,...r})=>e===!1?null:d(`div`,{"data-slot":`field-note`,className:c(`flex items-start gap-1.5 rounded border border-primary-muted/60 bg-primary-bg-subtle/80 px-2.5 py-2 text-text-positive-weak text-xs`,t),...r,children:[u(a,{size:12,className:`mt-0.5 shrink-0 text-primary/70`}),u(`span`,{children:n})]}));w.displayName=`FieldNote`;const T=o(({tooltip:r})=>d(e,{children:[u(n,{asChild:!0,children:d(`button`,{type:`button`,tabIndex:-1,className:`inline-flex cursor-default items-center text-text-positive-weak/70 hover:text-text-positive focus:outline-none`,children:[u(i,{size:13,"aria-hidden":`true`}),u(`span`,{className:`sr-only`,children:`Thêm thông tin`})]})}),u(t,{side:`top`,className:`max-w-xs text-balance`,children:r})]}));T.displayName=`FieldTooltip`;const E=o(({children:e,className:t,...n})=>d(`div`,{"data-slot":`field-separator`,"data-content":!!e,className:c(`relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2`,t),...n,children:[u(r,{className:`absolute inset-0 top-1/2`}),e&&u(`span`,{className:`relative mx-auto block w-fit bg-background px-2 text-text-positive-weak`,"data-slot":`field-separator-content`,children:e})]}));E.displayName=`FieldSeparator`;const D=o(({className:e,children:t,errors:n,requiredMessage:r=`Trường này là bắt buộc`,...i})=>{let a=s(()=>{let e=e=>e.code===`invalid_type`?r:e.message;return t||(n?n?.length===1&&n[0]?.message?u(`div`,{className:`flex flex-row items-center justify-start gap-x-0.5`,children:u(`p`,{children:e(n[0])})}):u(`ul`,{className:`flex list-none flex-col`,children:n.map(t=>typeof t==`string`?u(`li`,{children:t},t):t?.message?u(`li`,{children:e(t)},t.code??t.message):null)}):null)},[t,n,r]);return a?u(`div`,{role:`alert`,"data-slot":`field-error`,className:c(`w-full font-medium text-danger-strong text-xs`,e),...i,children:a}):null});D.displayName=`FieldError`;export{v as Field,y as FieldContent,b as FieldContentMain,C as FieldDescription,D as FieldError,_ as FieldGroup,x as FieldLabel,g as FieldLegend,w as FieldNote,E as FieldSeparator,S as FieldTitle,T as FieldTooltip};
|
|
2
|
-
//# sourceMappingURL=field-
|
|
1
|
+
import{Tooltip as e,TooltipContent as t,TooltipTrigger as n}from"./ui/tooltip.mjs";import{Separator as r}from"./ui/separator.mjs";import{HelpCircleIcon as i,InfoIcon as a}from"lucide-react";import{memo as o,useMemo as s}from"react";import{cn as c}from"@customafk/react-toolkit/utils";import{cva as l}from"class-variance-authority";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{Label as f}from"radix-ui";function p({className:e,children:t,...n}){return d(f.Root,{"data-slot":`label`,className:c(`text-text-positive`,`flex w-full items-center justify-between`,`select-none font-medium text-sm/6 leading-none`,`group-data-[disabled=true]:pointer-events-none`,`group-data-[disabled=true]:opacity-50`,`peer-disabled:cursor-not-allowed`,`peer-disabled:opacity-50`,`aria-required:*:data-[slot=required-indicator]:inline-block`,e),...n,children:[u(`span`,{className:`flex items-center gap-1`,children:t}),u(`span`,{"data-slot":`required-indicator`,className:`hidden shrink-0 rounded-lg bg-danger-strong px-1.5 py-1 font-semibold text-[11px] leading-none text-white`,children:`Bắt buộc`})]})}const m=l(`group/field flex w-full gap-2 data-[invalid=true]:text-danger *:data-[slot=field-content]:gap-0`,{variants:{orientation:{vertical:[`flex-col *:w-full [&>.sr-only]:w-auto`],horizontal:[`flex-row items-center gap-4`,`*:data-[slot=field-content]:basis-1/2`,`*:data-[slot=field-content-main]:flex-1`,`*:data-[slot=field-label]:flex-auto`,`has-[>[data-slot=field-content]]:items-start`,`has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`],responsive:[`flex-col *:w-full [&>.sr-only]:w-auto`,`@md/field-group:flex-row`,`@md/field-group:items-center`,`@md/field-group:gap-4`,`@md/field-group:*:w-auto`,`@md/field-group:*:data-[slot=field-content]:basis-1/2`,`@md/field-group:*:data-[slot=field-content-main]:basis-1/2`,`@md/field-group:*:data-[slot=field-label]:flex-auto`,`@md/field-group:has-[>[data-slot=field-content]]:items-start`,`@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`]}},defaultVariants:{orientation:`vertical`}}),h=o(({className:e,...t})=>u(`fieldset`,{"data-slot":`field-set`,className:c(`flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3`,e),...t}));h.displayName=`FieldSet`;const g=o(({className:e,variant:t=`legend`,...n})=>u(`legend`,{"data-slot":`field-legend`,"data-variant":t,className:c(`mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base`,e),...n}));g.displayName=`FieldLegend`;const _=o(({className:e,...t})=>u(`div`,{"data-slot":`field-group`,className:c(`group/field-group @container/field-group`,`flex flex-col gap-7 pt-4`,`data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t}));_.displayName=`FieldGroup`;const v=o(({className:e,orientation:t=`vertical`,...n})=>u(`div`,{"data-slot":`field`,"data-orientation":t,className:c(m({orientation:t}),e),...n}));v.displayName=`Field`;const y=o(({className:e,...t})=>u(`div`,{"data-slot":`field-content`,className:c(`group/field-content flex flex-col gap-1.5 leading-snug`,e),...t}));y.displayName=`FieldContent`;const b=o(({className:e,...t})=>u(`div`,{"data-slot":`field-content-main`,className:c(`relative`,e),...t}));b.displayName=`FieldContentMain`;const x=o(({className:e,...t})=>u(p,{"data-slot":`field-label`,className:c(`group/field-label peer/field-label min-h-6 gap-1 font-medium leading-snug`,`has-[>[data-slot=field]]:w-full`,`has-[>[data-slot=field]]:flex-col`,`has-[>[data-slot=field]]:rounded-md`,`has-[>[data-slot=field]]:border`,`has-[>[data-slot=field]]:border-border`,`has-data-[state=checked]:border-primary`,`*:data-[slot=field]:p-4 group-data-[disabled=true]/field:opacity-50`,e),...t}));x.displayName=`FieldLabel`;const S=o(({className:e,...t})=>u(`div`,{"data-slot":`field-label`,className:c(`flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50`,e),...t}));S.displayName=`FieldTitle`;const C=o(({className:e,...t})=>u(`p`,{"data-slot":`field-description`,className:c(`nth-last-2:-mt-1 font-normal text-text-positive-weak text-xs leading-normal last:mt-0 [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4 [[data-variant=legend]+&]:-mt-1.5`,e),...t}));C.displayName=`FieldDescription`;const w=o(({isShow:e=!0,className:t,children:n,...r})=>e===!1?null:d(`div`,{"data-slot":`field-note`,className:c(`flex items-start gap-1.5 rounded border border-primary-muted/60 bg-primary-bg-subtle/80 px-2.5 py-2 text-text-positive-weak text-xs mt-1`,t),...r,children:[u(a,{size:12,className:`mt-0.5 shrink-0 text-primary/70`}),u(`span`,{children:n})]}));w.displayName=`FieldNote`;const T=o(({tooltip:r})=>d(e,{children:[u(n,{asChild:!0,children:d(`button`,{type:`button`,tabIndex:-1,className:`inline-flex cursor-default items-center text-text-positive-weak/70 hover:text-text-positive focus:outline-none`,children:[u(i,{size:13,"aria-hidden":`true`}),u(`span`,{className:`sr-only`,children:`Thêm thông tin`})]})}),u(t,{side:`top`,className:`max-w-xs text-balance`,children:r})]}));T.displayName=`FieldTooltip`;const E=o(({children:e,className:t,...n})=>d(`div`,{"data-slot":`field-separator`,"data-content":!!e,className:c(`relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2`,t),...n,children:[u(r,{className:`absolute inset-0 top-1/2`}),e&&u(`span`,{className:`relative mx-auto block w-fit bg-background px-2 text-text-positive-weak`,"data-slot":`field-separator-content`,children:e})]}));E.displayName=`FieldSeparator`;const D=o(({className:e,children:t,errors:n,requiredMessage:r=`Trường này là bắt buộc`,...i})=>{let a=s(()=>{let e=e=>e.code===`invalid_type`?r:e.message;return t||(n?n?.length===1&&n[0]?.message?u(`div`,{className:`flex flex-row items-center justify-start gap-x-0.5`,children:u(`p`,{children:e(n[0])})}):u(`ul`,{className:`flex list-none flex-col`,children:n.map(t=>typeof t==`string`?u(`li`,{children:t},t):t?.message?u(`li`,{children:e(t)},t.code??t.message):null)}):null)},[t,n,r]);return a?u(`div`,{role:`alert`,"data-slot":`field-error`,className:c(`w-full font-medium text-danger-strong text-xs`,e),...i,children:a}):null});D.displayName=`FieldError`;export{v as Field,y as FieldContent,b as FieldContentMain,C as FieldDescription,D as FieldError,_ as FieldGroup,x as FieldLabel,g as FieldLegend,w as FieldNote,E as FieldSeparator,S as FieldTitle,T as FieldTooltip};
|
|
2
|
+
//# sourceMappingURL=field-V2DoD8qL.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-BKyUqvzh.mjs","names":["Label","LabelPrimitive","Label","Tooltip","Separator"],"sources":["../packages/components/features/tanstack-form/components/ui/label.tsx","../packages/components/features/tanstack-form/components/ui/field.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Label as LabelPrimitive } from 'radix-ui';\n\n/**\n * Form field label that automatically renders a \"Required\" badge when the field is marked aria-required.\n *\n * @example\n * import { Label } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <Label htmlFor=\"email\">Email address</Label>\n */\nfunction Label({ className, children, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {\n return (\n <LabelPrimitive.Root\n data-slot=\"label\"\n className={cn(\n 'text-text-positive',\n 'flex w-full items-center justify-between',\n 'select-none font-medium text-sm/6 leading-none',\n 'group-data-[disabled=true]:pointer-events-none',\n 'group-data-[disabled=true]:opacity-50',\n 'peer-disabled:cursor-not-allowed',\n 'peer-disabled:opacity-50',\n 'aria-required:*:data-[slot=required-indicator]:inline-block',\n className\n )}\n {...props}\n >\n <span className=\"flex items-center gap-1\">{children}</span>\n <span\n data-slot=\"required-indicator\"\n className=\"hidden shrink-0 rounded-lg bg-danger-strong px-1.5 py-1 font-semibold text-[11px] leading-none text-white\"\n >\n Bắt buộc\n </span>\n </LabelPrimitive.Root>\n );\n}\n\nexport { Label };\n","'use client';\n\nimport { memo, useMemo } from 'react';\n\nimport { HelpCircleIcon, InfoIcon } from 'lucide-react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Separator } from '@/components/ui/separator';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { Label } from './label';\n\nconst fieldVariants = cva('group/field flex w-full gap-2 data-[invalid=true]:text-danger *:data-[slot=field-content]:gap-0', {\n variants: {\n orientation: {\n vertical: ['flex-col *:w-full [&>.sr-only]:w-auto'],\n horizontal: [\n 'flex-row items-center gap-4',\n '*:data-[slot=field-content]:basis-1/2',\n '*:data-[slot=field-content-main]:flex-1',\n '*:data-[slot=field-label]:flex-auto',\n 'has-[>[data-slot=field-content]]:items-start',\n 'has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n ],\n responsive: [\n 'flex-col *:w-full [&>.sr-only]:w-auto',\n '@md/field-group:flex-row',\n '@md/field-group:items-center',\n '@md/field-group:gap-4',\n '@md/field-group:*:w-auto',\n '@md/field-group:*:data-[slot=field-content]:basis-1/2',\n '@md/field-group:*:data-[slot=field-content-main]:basis-1/2',\n '@md/field-group:*:data-[slot=field-label]:flex-auto',\n '@md/field-group:has-[>[data-slot=field-content]]:items-start',\n '@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n ],\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n});\n\n/**\n * Outermost `<fieldset>` wrapper that stacks multiple `Field` rows with consistent vertical spacing.\n *\n * @example\n * import { FieldSet } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldSet>\n * <Field><FieldLabel>Name</FieldLabel><FieldContent><input /></FieldContent></Field>\n * </FieldSet>\n */\nconst FieldSet = memo(({ className, ...props }: React.ComponentProps<'fieldset'>) => {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn('flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3', className)}\n {...props}\n />\n );\n});\nFieldSet.displayName = 'FieldSet';\n\n/**\n * Props for {@link FieldLegend}.\n */\ntype FieldLegendProps = React.ComponentProps<'legend'> & {\n /**\n * Visual weight of the legend text.\n * - `'legend'` — larger base-size text (section heading).\n * - `'label'` — smaller label-size text (matches field label weight).\n * @default 'legend'\n */\n variant?: 'legend' | 'label';\n};\n\n/**\n * `<legend>` element for a `<fieldset>`, styled as either a section heading or a compact label.\n *\n * @example\n * import { FieldSet, FieldLegend } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldSet>\n * <FieldLegend variant=\"legend\">Personal details</FieldLegend>\n * </FieldSet>\n */\nconst FieldLegend = memo(({ className, variant = 'legend', ...props }: FieldLegendProps) => {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn('mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base', className)}\n {...props}\n />\n );\n});\nFieldLegend.displayName = 'FieldLegend';\n\n/**\n * Container `<div>` that groups a set of `Field` rows with container-query support for responsive layouts.\n *\n * @example\n * import { FieldGroup } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldGroup>\n * <Field>…</Field>\n * <Field>…</Field>\n * </FieldGroup>\n */\nconst FieldGroup = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group @container/field-group',\n 'flex flex-col gap-7 pt-4',\n 'data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4',\n className\n )}\n {...props}\n />\n );\n});\nFieldGroup.displayName = 'FieldGroup';\n\n/**\n * Single form field row that arranges label, input, and meta elements with configurable orientation.\n *\n * @example\n * import { Field } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <Field orientation=\"horizontal\">\n * <FieldLabel htmlFor=\"username\">Username</FieldLabel>\n * <FieldContent><input id=\"username\" /></FieldContent>\n * </Field>\n */\nconst Field = memo(({ className, orientation = 'vertical', ...props }: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>) => {\n return <div data-slot=\"field\" data-orientation={orientation} className={cn(fieldVariants({ orientation }), className)} {...props} />;\n});\nField.displayName = 'Field';\n\n/**\n * Flex column wrapper that houses the primary input control together with description and error slots.\n *\n * @example\n * import { FieldContent } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldContent>\n * <input type=\"text\" />\n * <FieldDescription>Enter your full name.</FieldDescription>\n * </FieldContent>\n */\nconst FieldContent = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return <div data-slot=\"field-content\" className={cn('group/field-content flex flex-col gap-1.5 leading-snug', className)} {...props} />;\n});\nFieldContent.displayName = 'FieldContent';\n\n/**\n * Positioned wrapper for the main input element that enables absolutely-placed adornments (icons, spinners).\n *\n * @example\n * import { FieldContentMain } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldContentMain>\n * <input type=\"text\" className=\"pr-8\" />\n * <SearchIcon className=\"absolute right-2 top-2\" />\n * </FieldContentMain>\n */\nconst FieldContentMain = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return <div data-slot=\"field-content-main\" className={cn('relative', className)} {...props} />;\n});\nFieldContentMain.displayName = 'FieldContentMain';\n\n/**\n * Styled `<label>` element for a `Field`, extending the base `Label` with field-group-aware spacing and border states.\n *\n * @example\n * import { FieldLabel } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldLabel htmlFor=\"email\" aria-required>Email</FieldLabel>\n */\nconst FieldLabel = memo(({ className, ...props }: React.ComponentProps<typeof Label>) => {\n return (\n <Label\n data-slot=\"field-label\"\n className={cn(\n 'group/field-label peer/field-label min-h-6 gap-1 font-medium leading-snug',\n 'has-[>[data-slot=field]]:w-full',\n 'has-[>[data-slot=field]]:flex-col',\n 'has-[>[data-slot=field]]:rounded-md',\n 'has-[>[data-slot=field]]:border',\n 'has-[>[data-slot=field]]:border-border',\n 'has-data-[state=checked]:border-primary',\n '*:data-[slot=field]:p-4 group-data-[disabled=true]/field:opacity-50',\n className\n )}\n {...props}\n />\n );\n});\nFieldLabel.displayName = 'FieldLabel';\n\n/**\n * Inline title element (non-`<label>`) for fields whose label cannot be a native `<label>`, such as custom checkbox groups.\n *\n * @example\n * import { FieldTitle } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldTitle>Notification preferences</FieldTitle>\n */\nconst FieldTitle = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return (\n <div\n data-slot=\"field-label\"\n className={cn('flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50', className)}\n {...props}\n />\n );\n});\nFieldTitle.displayName = 'FieldTitle';\n\n/**\n * Supplementary hint text rendered below the input to guide the user, with support for inline anchor links.\n *\n * @example\n * import { FieldDescription } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldDescription>Must be at least 8 characters.</FieldDescription>\n */\nconst FieldDescription = memo(({ className, ...props }: React.ComponentProps<'p'>) => {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n // biome-ignore lint/security/noSecrets: true\n 'nth-last-2:-mt-1 font-normal text-text-positive-weak text-xs leading-normal last:mt-0 [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4 [[data-variant=legend]+&]:-mt-1.5',\n className\n )}\n {...props}\n />\n );\n});\nFieldDescription.displayName = 'FieldDescription';\n\n/**\n * Props for {@link FieldNote}.\n */\ntype FieldNoteProps = React.ComponentProps<'div'> & {\n /**\n * When `false` the note is not rendered at all; useful for conditional display without wrapper conditionals.\n * @default true\n */\n isShow?: boolean;\n};\n\n/**\n * Highlighted informational callout box with an info icon, shown below a field to surface contextual guidance.\n *\n * @example\n * import { FieldNote } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldNote isShow={isDraftMode}>Changes are saved automatically in draft mode.</FieldNote>\n */\nconst FieldNote = memo(({ isShow = true, className, children, ...props }: FieldNoteProps) => {\n if (isShow === false) return null;\n return (\n <div\n data-slot=\"field-note\"\n className={cn(\n 'flex items-start gap-1.5 rounded border border-primary-muted/60 bg-primary-bg-subtle/80 px-2.5 py-2 text-text-positive-weak text-xs',\n className\n )}\n {...props}\n >\n <InfoIcon size={12} className=\"mt-0.5 shrink-0 text-primary/70\" />\n <span>{children}</span>\n </div>\n );\n});\nFieldNote.displayName = 'FieldNote';\n\n/**\n * Props for {@link FieldTooltip}.\n */\ntype FieldTooltipProps = {\n /** Text content displayed inside the tooltip when the help icon is hovered or focused. */\n tooltip: string;\n};\n\n/**\n * Small help-circle icon button that reveals a tooltip with additional field context on hover or focus.\n *\n * @example\n * import { FieldTooltip } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldLabel>\n * Password <FieldTooltip tooltip=\"Use at least one uppercase letter and one number.\" />\n * </FieldLabel>\n */\nconst FieldTooltip = memo(({ tooltip }: FieldTooltipProps) => {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n tabIndex={-1}\n className=\"inline-flex cursor-default items-center text-text-positive-weak/70 hover:text-text-positive focus:outline-none\"\n >\n <HelpCircleIcon size={13} aria-hidden=\"true\" />\n <span className=\"sr-only\">Thêm thông tin</span>\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"top\" className=\"max-w-xs text-balance\">\n {tooltip}\n </TooltipContent>\n </Tooltip>\n );\n});\nFieldTooltip.displayName = 'FieldTooltip';\n\n/**\n * Visual divider row that optionally displays a centered text label, used to separate logical sections within a `FieldGroup`.\n *\n * @example\n * import { FieldSeparator } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldSeparator>or</FieldSeparator>\n */\nconst FieldSeparator = memo(({ children, className, ...props }: React.PropsWithChildren<React.ComponentProps<'div'>>) => {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn('relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span className=\"relative mx-auto block w-fit bg-background px-2 text-text-positive-weak\" data-slot=\"field-separator-content\">\n {children}\n </span>\n )}\n </div>\n );\n});\nFieldSeparator.displayName = 'FieldSeparator';\n\n/**\n * Props for {@link FieldError}.\n */\ntype FieldErrorProps = React.ComponentProps<'div'> & {\n errors?: Array<{ code?: string; message?: string } | undefined>;\n requiredMessage?: string;\n};\n\nconst FieldError = memo(({ className, children, errors, requiredMessage = 'Trường này là bắt buộc', ...props }: FieldErrorProps) => {\n const content = useMemo(() => {\n const resolve = (error: { code?: string; message?: string }) => (error.code === 'invalid_type' ? requiredMessage : error.message);\n\n if (children) {\n return children;\n }\n\n if (!errors) {\n return null;\n }\n\n if (errors?.length === 1 && errors[0]?.message) {\n return (\n <div className=\"flex flex-row items-center justify-start gap-x-0.5\">\n <p>{resolve(errors[0])}</p>\n </div>\n );\n }\n\n return (\n <ul className=\"flex list-none flex-col\">\n {errors.map(error => {\n if (typeof error === 'string') return <li key={error}>{error}</li>;\n if (!error?.message) return null;\n return <li key={error.code ?? error.message}>{resolve(error)}</li>;\n })}\n </ul>\n );\n }, [children, errors, requiredMessage]);\n\n if (!content) {\n return null;\n }\n\n return (\n <div role=\"alert\" data-slot=\"field-error\" className={cn('w-full font-medium text-danger-strong text-xs', className)} {...props}>\n {content}\n </div>\n );\n});\nFieldError.displayName = 'FieldError';\n\nexport {\n Field,\n FieldLabel,\n FieldDescription,\n FieldNote,\n FieldError,\n FieldGroup,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldContent,\n FieldContentMain,\n FieldTitle,\n FieldTooltip,\n};\n"],"mappings":"8ZAcA,SAASA,EAAM,CAAE,YAAW,WAAU,GAAG,GAA2D,CAClG,OACE,EAACC,EAAe,KAAhB,CACE,YAAU,QACV,UAAW,EACT,qBACA,2CACA,iDACA,iDACA,wCACA,mCACA,2BACA,8DACA,CACF,EACA,GAAI,WAbN,CAeE,EAAC,OAAD,CAAM,UAAU,0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A,CAEZ,EACD,EAAa,YAAc,eAU3B,MAAM,EAAiB,GAAM,CAAE,WAAU,YAAW,GAAG,KAEnD,EAAC,MAAD,CACE,YAAU,kBACV,eAAc,CAAC,CAAC,EAChB,UAAW,EAAG,4EAA6E,CAAS,EACpG,GAAI,WAJN,CAME,EAACC,EAAD,CAAW,UAAU,0BAA4B,CAAA,EAChD,GACC,EAAC,OAAD,CAAM,UAAU,0EAA0E,YAAU,0BACjG,UACG,CAAA,CAEL,GAER,EACD,EAAe,YAAc,iBAU7B,MAAM,EAAa,GAAM,CAAE,YAAW,WAAU,SAAQ,kBAAkB,yBAA0B,GAAG,KAA6B,CAClI,IAAM,EAAU,MAAc,CAC5B,IAAM,EAAW,GAAgD,EAAM,OAAS,eAAiB,EAAkB,EAAM,QAkBzH,OAhBI,IAIC,EAID,GAAQ,SAAW,GAAK,EAAO,EAAE,EAAE,QAEnC,EAAC,MAAD,CAAK,UAAU,8DACb,EAAC,IAAD,CAAA,SAAI,EAAQ,EAAO,EAAE,CAAK,CAAA,CACvB,CAAA,EAKP,EAAC,KAAD,CAAI,UAAU,mCACX,EAAO,IAAI,GACN,OAAO,GAAU,SAAiB,EAAC,KAAD,CAAA,SAAiB,CAAU,EAAlB,CAAkB,EAC5D,GAAO,QACL,EAAC,KAAD,CAAA,SAAuC,EAAQ,CAAK,CAAM,EAAjD,EAAM,MAAQ,EAAM,OAA6B,EADrC,IAE7B,CACC,CAAA,EAlBG,KAoBX,EAAG,CAAC,EAAU,EAAQ,CAAe,CAAC,EAMtC,OAJK,EAKH,EAAC,MAAD,CAAK,KAAK,QAAQ,YAAU,cAAc,UAAW,EAAG,gDAAiD,CAAS,EAAG,GAAI,WACtH,CACE,CAAA,EANE,IAQX,CAAC,EACD,EAAW,YAAc"}
|
|
1
|
+
{"version":3,"file":"field-V2DoD8qL.mjs","names":["Label","LabelPrimitive","Label","Tooltip","Separator"],"sources":["../packages/components/features/tanstack-form/components/ui/label.tsx","../packages/components/features/tanstack-form/components/ui/field.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Label as LabelPrimitive } from 'radix-ui';\n\n/**\n * Form field label that automatically renders a \"Required\" badge when the field is marked aria-required.\n *\n * @example\n * import { Label } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <Label htmlFor=\"email\">Email address</Label>\n */\nfunction Label({ className, children, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {\n return (\n <LabelPrimitive.Root\n data-slot=\"label\"\n className={cn(\n 'text-text-positive',\n 'flex w-full items-center justify-between',\n 'select-none font-medium text-sm/6 leading-none',\n 'group-data-[disabled=true]:pointer-events-none',\n 'group-data-[disabled=true]:opacity-50',\n 'peer-disabled:cursor-not-allowed',\n 'peer-disabled:opacity-50',\n 'aria-required:*:data-[slot=required-indicator]:inline-block',\n className\n )}\n {...props}\n >\n <span className=\"flex items-center gap-1\">{children}</span>\n <span\n data-slot=\"required-indicator\"\n className=\"hidden shrink-0 rounded-lg bg-danger-strong px-1.5 py-1 font-semibold text-[11px] leading-none text-white\"\n >\n Bắt buộc\n </span>\n </LabelPrimitive.Root>\n );\n}\n\nexport { Label };\n","'use client';\n\nimport { memo, useMemo } from 'react';\n\nimport { HelpCircleIcon, InfoIcon } from 'lucide-react';\n\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { Separator } from '@/components/ui/separator';\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { Label } from './label';\n\nconst fieldVariants = cva('group/field flex w-full gap-2 data-[invalid=true]:text-danger *:data-[slot=field-content]:gap-0', {\n variants: {\n orientation: {\n vertical: ['flex-col *:w-full [&>.sr-only]:w-auto'],\n horizontal: [\n 'flex-row items-center gap-4',\n '*:data-[slot=field-content]:basis-1/2',\n '*:data-[slot=field-content-main]:flex-1',\n '*:data-[slot=field-label]:flex-auto',\n 'has-[>[data-slot=field-content]]:items-start',\n 'has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n ],\n responsive: [\n 'flex-col *:w-full [&>.sr-only]:w-auto',\n '@md/field-group:flex-row',\n '@md/field-group:items-center',\n '@md/field-group:gap-4',\n '@md/field-group:*:w-auto',\n '@md/field-group:*:data-[slot=field-content]:basis-1/2',\n '@md/field-group:*:data-[slot=field-content-main]:basis-1/2',\n '@md/field-group:*:data-[slot=field-label]:flex-auto',\n '@md/field-group:has-[>[data-slot=field-content]]:items-start',\n '@md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n ],\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n});\n\n/**\n * Outermost `<fieldset>` wrapper that stacks multiple `Field` rows with consistent vertical spacing.\n *\n * @example\n * import { FieldSet } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldSet>\n * <Field><FieldLabel>Name</FieldLabel><FieldContent><input /></FieldContent></Field>\n * </FieldSet>\n */\nconst FieldSet = memo(({ className, ...props }: React.ComponentProps<'fieldset'>) => {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn('flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3', className)}\n {...props}\n />\n );\n});\nFieldSet.displayName = 'FieldSet';\n\n/**\n * Props for {@link FieldLegend}.\n */\ntype FieldLegendProps = React.ComponentProps<'legend'> & {\n /**\n * Visual weight of the legend text.\n * - `'legend'` — larger base-size text (section heading).\n * - `'label'` — smaller label-size text (matches field label weight).\n * @default 'legend'\n */\n variant?: 'legend' | 'label';\n};\n\n/**\n * `<legend>` element for a `<fieldset>`, styled as either a section heading or a compact label.\n *\n * @example\n * import { FieldSet, FieldLegend } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldSet>\n * <FieldLegend variant=\"legend\">Personal details</FieldLegend>\n * </FieldSet>\n */\nconst FieldLegend = memo(({ className, variant = 'legend', ...props }: FieldLegendProps) => {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn('mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base', className)}\n {...props}\n />\n );\n});\nFieldLegend.displayName = 'FieldLegend';\n\n/**\n * Container `<div>` that groups a set of `Field` rows with container-query support for responsive layouts.\n *\n * @example\n * import { FieldGroup } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldGroup>\n * <Field>…</Field>\n * <Field>…</Field>\n * </FieldGroup>\n */\nconst FieldGroup = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group @container/field-group',\n 'flex flex-col gap-7 pt-4',\n 'data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4',\n className\n )}\n {...props}\n />\n );\n});\nFieldGroup.displayName = 'FieldGroup';\n\n/**\n * Single form field row that arranges label, input, and meta elements with configurable orientation.\n *\n * @example\n * import { Field } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <Field orientation=\"horizontal\">\n * <FieldLabel htmlFor=\"username\">Username</FieldLabel>\n * <FieldContent><input id=\"username\" /></FieldContent>\n * </Field>\n */\nconst Field = memo(({ className, orientation = 'vertical', ...props }: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>) => {\n return <div data-slot=\"field\" data-orientation={orientation} className={cn(fieldVariants({ orientation }), className)} {...props} />;\n});\nField.displayName = 'Field';\n\n/**\n * Flex column wrapper that houses the primary input control together with description and error slots.\n *\n * @example\n * import { FieldContent } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldContent>\n * <input type=\"text\" />\n * <FieldDescription>Enter your full name.</FieldDescription>\n * </FieldContent>\n */\nconst FieldContent = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return <div data-slot=\"field-content\" className={cn('group/field-content flex flex-col gap-1.5 leading-snug', className)} {...props} />;\n});\nFieldContent.displayName = 'FieldContent';\n\n/**\n * Positioned wrapper for the main input element that enables absolutely-placed adornments (icons, spinners).\n *\n * @example\n * import { FieldContentMain } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldContentMain>\n * <input type=\"text\" className=\"pr-8\" />\n * <SearchIcon className=\"absolute right-2 top-2\" />\n * </FieldContentMain>\n */\nconst FieldContentMain = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return <div data-slot=\"field-content-main\" className={cn('relative', className)} {...props} />;\n});\nFieldContentMain.displayName = 'FieldContentMain';\n\n/**\n * Styled `<label>` element for a `Field`, extending the base `Label` with field-group-aware spacing and border states.\n *\n * @example\n * import { FieldLabel } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldLabel htmlFor=\"email\" aria-required>Email</FieldLabel>\n */\nconst FieldLabel = memo(({ className, ...props }: React.ComponentProps<typeof Label>) => {\n return (\n <Label\n data-slot=\"field-label\"\n className={cn(\n 'group/field-label peer/field-label min-h-6 gap-1 font-medium leading-snug',\n 'has-[>[data-slot=field]]:w-full',\n 'has-[>[data-slot=field]]:flex-col',\n 'has-[>[data-slot=field]]:rounded-md',\n 'has-[>[data-slot=field]]:border',\n 'has-[>[data-slot=field]]:border-border',\n 'has-data-[state=checked]:border-primary',\n '*:data-[slot=field]:p-4 group-data-[disabled=true]/field:opacity-50',\n className\n )}\n {...props}\n />\n );\n});\nFieldLabel.displayName = 'FieldLabel';\n\n/**\n * Inline title element (non-`<label>`) for fields whose label cannot be a native `<label>`, such as custom checkbox groups.\n *\n * @example\n * import { FieldTitle } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldTitle>Notification preferences</FieldTitle>\n */\nconst FieldTitle = memo(({ className, ...props }: React.ComponentProps<'div'>) => {\n return (\n <div\n data-slot=\"field-label\"\n className={cn('flex w-fit items-center gap-2 font-medium text-sm leading-snug group-data-[disabled=true]/field:opacity-50', className)}\n {...props}\n />\n );\n});\nFieldTitle.displayName = 'FieldTitle';\n\n/**\n * Supplementary hint text rendered below the input to guide the user, with support for inline anchor links.\n *\n * @example\n * import { FieldDescription } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldDescription>Must be at least 8 characters.</FieldDescription>\n */\nconst FieldDescription = memo(({ className, ...props }: React.ComponentProps<'p'>) => {\n return (\n <p\n data-slot=\"field-description\"\n className={cn(\n // biome-ignore lint/security/noSecrets: true\n 'nth-last-2:-mt-1 font-normal text-text-positive-weak text-xs leading-normal last:mt-0 [&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4 [[data-variant=legend]+&]:-mt-1.5',\n className\n )}\n {...props}\n />\n );\n});\nFieldDescription.displayName = 'FieldDescription';\n\n/**\n * Props for {@link FieldNote}.\n */\ntype FieldNoteProps = React.ComponentProps<'div'> & {\n /**\n * When `false` the note is not rendered at all; useful for conditional display without wrapper conditionals.\n * @default true\n */\n isShow?: boolean;\n};\n\n/**\n * Highlighted informational callout box with an info icon, shown below a field to surface contextual guidance.\n *\n * @example\n * import { FieldNote } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldNote isShow={isDraftMode}>Changes are saved automatically in draft mode.</FieldNote>\n */\nconst FieldNote = memo(({ isShow = true, className, children, ...props }: FieldNoteProps) => {\n if (isShow === false) return null;\n return (\n <div\n data-slot=\"field-note\"\n className={cn(\n 'flex items-start gap-1.5 rounded border border-primary-muted/60 bg-primary-bg-subtle/80 px-2.5 py-2 text-text-positive-weak text-xs mt-1',\n className\n )}\n {...props}\n >\n <InfoIcon size={12} className=\"mt-0.5 shrink-0 text-primary/70\" />\n <span>{children}</span>\n </div>\n );\n});\nFieldNote.displayName = 'FieldNote';\n\n/**\n * Props for {@link FieldTooltip}.\n */\ntype FieldTooltipProps = {\n /** Text content displayed inside the tooltip when the help icon is hovered or focused. */\n tooltip: string;\n};\n\n/**\n * Small help-circle icon button that reveals a tooltip with additional field context on hover or focus.\n *\n * @example\n * import { FieldTooltip } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldLabel>\n * Password <FieldTooltip tooltip=\"Use at least one uppercase letter and one number.\" />\n * </FieldLabel>\n */\nconst FieldTooltip = memo(({ tooltip }: FieldTooltipProps) => {\n return (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n tabIndex={-1}\n className=\"inline-flex cursor-default items-center text-text-positive-weak/70 hover:text-text-positive focus:outline-none\"\n >\n <HelpCircleIcon size={13} aria-hidden=\"true\" />\n <span className=\"sr-only\">Thêm thông tin</span>\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"top\" className=\"max-w-xs text-balance\">\n {tooltip}\n </TooltipContent>\n </Tooltip>\n );\n});\nFieldTooltip.displayName = 'FieldTooltip';\n\n/**\n * Visual divider row that optionally displays a centered text label, used to separate logical sections within a `FieldGroup`.\n *\n * @example\n * import { FieldSeparator } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <FieldSeparator>or</FieldSeparator>\n */\nconst FieldSeparator = memo(({ children, className, ...props }: React.PropsWithChildren<React.ComponentProps<'div'>>) => {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn('relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span className=\"relative mx-auto block w-fit bg-background px-2 text-text-positive-weak\" data-slot=\"field-separator-content\">\n {children}\n </span>\n )}\n </div>\n );\n});\nFieldSeparator.displayName = 'FieldSeparator';\n\n/**\n * Props for {@link FieldError}.\n */\ntype FieldErrorProps = React.ComponentProps<'div'> & {\n errors?: Array<{ code?: string; message?: string } | undefined>;\n requiredMessage?: string;\n};\n\nconst FieldError = memo(({ className, children, errors, requiredMessage = 'Trường này là bắt buộc', ...props }: FieldErrorProps) => {\n const content = useMemo(() => {\n const resolve = (error: { code?: string; message?: string }) => (error.code === 'invalid_type' ? requiredMessage : error.message);\n\n if (children) {\n return children;\n }\n\n if (!errors) {\n return null;\n }\n\n if (errors?.length === 1 && errors[0]?.message) {\n return (\n <div className=\"flex flex-row items-center justify-start gap-x-0.5\">\n <p>{resolve(errors[0])}</p>\n </div>\n );\n }\n\n return (\n <ul className=\"flex list-none flex-col\">\n {errors.map(error => {\n if (typeof error === 'string') return <li key={error}>{error}</li>;\n if (!error?.message) return null;\n return <li key={error.code ?? error.message}>{resolve(error)}</li>;\n })}\n </ul>\n );\n }, [children, errors, requiredMessage]);\n\n if (!content) {\n return null;\n }\n\n return (\n <div role=\"alert\" data-slot=\"field-error\" className={cn('w-full font-medium text-danger-strong text-xs', className)} {...props}>\n {content}\n </div>\n );\n});\nFieldError.displayName = 'FieldError';\n\nexport {\n Field,\n FieldLabel,\n FieldDescription,\n FieldNote,\n FieldError,\n FieldGroup,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldContent,\n FieldContentMain,\n FieldTitle,\n FieldTooltip,\n};\n"],"mappings":"8ZAcA,SAASA,EAAM,CAAE,YAAW,WAAU,GAAG,GAA2D,CAClG,OACE,EAACC,EAAe,KAAhB,CACE,YAAU,QACV,UAAW,EACT,qBACA,2CACA,iDACA,iDACA,wCACA,mCACA,2BACA,8DACA,CACF,EACA,GAAI,WAbN,CAeE,EAAC,OAAD,CAAM,UAAU,0BAA2B,UAAe,CAAA,EAC1D,EAAC,OAAD,CACE,YAAU,qBACV,UAAU,qHACX,UAEK,CAAA,CACa,GAEzB,CC1BA,MAAM,EAAgB,EAAI,kGAAmG,CAC3H,SAAU,CACR,YAAa,CACX,SAAU,CAAC,uCAAuC,EAClD,WAAY,CACV,8BACA,wCACA,0CACA,sCACA,+CACA,yEACF,EACA,WAAY,CACV,wCACA,2BACA,+BACA,wBACA,2BACA,wDACA,6DACA,sDACA,+DACA,yFACF,CACF,CACF,EACA,gBAAiB,CACf,YAAa,UACf,CACF,CAAC,EAYK,EAAW,GAAM,CAAE,YAAW,GAAG,KAEnC,EAAC,WAAD,CACE,YAAU,YACV,UAAW,EAAG,mGAAoG,CAAS,EAC3H,GAAI,CACL,CAAA,CAEJ,EACD,EAAS,YAAc,WAyBvB,MAAM,EAAc,GAAM,CAAE,YAAW,UAAU,SAAU,G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EnC,EAAC,MAAD,CAAK,UAAU,8DACb,EAAC,IAAD,CAAA,SAAI,EAAQ,EAAO,EAAE,CAAK,CAAA,CACvB,CAAA,EAKP,EAAC,KAAD,CAAI,UAAU,mCACX,EAAO,IAAI,GACN,OAAO,GAAU,SAAiB,EAAC,KAAD,CAAA,SAAiB,CAAU,EAAlB,CAAkB,EAC5D,GAAO,QACL,EAAC,KAAD,CAAA,SAAuC,EAAQ,CAAK,CAAM,EAAjD,EAAM,MAAQ,EAAM,OAA6B,EADrC,IAE7B,CACC,CAAA,EAlBG,KAoBX,EAAG,CAAC,EAAU,EAAQ,CAAe,CAAC,EAMtC,OAJK,EAKH,EAAC,MAAD,CAAK,KAAK,QAAQ,YAAU,cAAc,UAAW,EAAG,gDAAiD,CAAS,EAAG,GAAI,WACtH,CACE,CAAA,EANE,IAQX,CAAC,EACD,EAAW,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Field as e,FieldContent as t,FieldContentMain as n,FieldDescription as r,FieldGroup as i,FieldLabel as a,FieldNote as o,FieldSeparator as s}from"./field-
|
|
2
|
-
//# sourceMappingURL=group-field-
|
|
1
|
+
import{Field as e,FieldContent as t,FieldContentMain as n,FieldDescription as r,FieldGroup as i,FieldLabel as a,FieldNote as o,FieldSeparator as s}from"./field-V2DoD8qL.mjs";import{jsx as c,jsxs as l}from"react/jsx-runtime";const u=({label:u,description:d,helperText:f,orientation:p=`responsive`,children:m})=>l(i,{className:`gap-y-4 px-4`,children:[l(e,{orientation:p,children:[l(t,{children:[c(a,{children:u}),c(r,{children:d})]}),l(n,{children:[m,c(o,{isShow:!!f,children:f})]})]}),c(s,{})]});export{u as TanStackFieldGroup};
|
|
2
|
+
//# sourceMappingURL=group-field-gejvx_Td.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group-field-
|
|
1
|
+
{"version":3,"file":"group-field-gejvx_Td.mjs","names":[],"sources":["../packages/components/features/tanstack-form/components/forms/group-field.tsx"],"sourcesContent":["import {\n Field,\n FieldContent,\n FieldContentMain,\n FieldDescription,\n FieldGroup,\n FieldLabel,\n FieldNote,\n FieldSeparator,\n} from '@/components/features/tanstack-form/components/ui/field';\n\n/**\n * Renders a labeled field group with an optional description, helper text, and a bottom separator.\n *\n * @example\n * import { TanStackFieldGroup } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <TanStackFieldGroup\n * label=\"Contact Details\"\n * description=\"Enter your contact information.\"\n * helperText=\"All fields are required.\"\n * orientation=\"horizontal\"\n * >\n * <EmailField />\n * </TanStackFieldGroup>\n */\nexport const TanStackFieldGroup: React.FC<\n React.PropsWithChildren<{\n /** Primary label displayed above the field content. */\n label: string;\n /** Secondary descriptive text shown beneath the label. */\n description?: string;\n /** Supplementary helper note rendered below the field content. */\n helperText?: string;\n /** Layout orientation of the label-to-content axis. Defaults to `'responsive'`. */\n orientation?: 'horizontal' | 'vertical' | 'responsive';\n }>\n> = ({\n label,\n description,\n helperText,\n\n orientation = 'responsive',\n children,\n}) => {\n return (\n <FieldGroup className=\"gap-y-4 px-4\">\n <Field orientation={orientation}>\n <FieldContent>\n <FieldLabel>{label}</FieldLabel>\n <FieldDescription>{description}</FieldDescription>\n </FieldContent>\n <FieldContentMain>\n {children}\n <FieldNote isShow={!!helperText}>{helperText}</FieldNote>\n </FieldContentMain>\n </Field>\n <FieldSeparator />\n </FieldGroup>\n );\n};\n"],"mappings":"gOA0BA,MAAa,GAWR,CACH,QACA,cACA,aAEA,cAAc,aACd,cAGE,EAAC,EAAD,CAAY,UAAU,wBAAtB,CACE,EAAC,EAAD,CAAoB,uBAApB,CACE,EAAC,EAAD,CAAA,SAAA,CACE,EAAC,EAAD,CAAA,SAAa,CAAkB,CAAA,EAC/B,EAAC,EAAD,CAAA,SAAmB,CAA8B,CAAA,CACrC,CAAA,CAAA,EACd,EAAC,EAAD,CAAA,SAAA,CACG,EACD,EAAC,EAAD,CAAW,OAAQ,CAAC,CAAC,WAAa,CAAsB,CAAA,CACxC,CAAA,CAAA,CACb,IACP,EAAC,EAAD,CAAiB,CAAA,CACP"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./field-
|
|
2
|
-
//# sourceMappingURL=group-field-
|
|
1
|
+
const e=require("./field-BSLi-P0Q.cjs");let t=require("react/jsx-runtime");const n=({label:n,description:r,helperText:i,orientation:a=`responsive`,children:o})=>(0,t.jsxs)(e.FieldGroup,{className:`gap-y-4 px-4`,children:[(0,t.jsxs)(e.Field,{orientation:a,children:[(0,t.jsxs)(e.FieldContent,{children:[(0,t.jsx)(e.FieldLabel,{children:n}),(0,t.jsx)(e.FieldDescription,{children:r})]}),(0,t.jsxs)(e.FieldContentMain,{children:[o,(0,t.jsx)(e.FieldNote,{isShow:!!i,children:i})]})]}),(0,t.jsx)(e.FieldSeparator,{})]});exports.TanStackFieldGroup=n;
|
|
2
|
+
//# sourceMappingURL=group-field-sVykO2JZ.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group-field-
|
|
1
|
+
{"version":3,"file":"group-field-sVykO2JZ.cjs","names":["FieldGroup","Field","FieldContent","FieldLabel","FieldDescription","FieldContentMain","FieldNote","FieldSeparator"],"sources":["../packages/components/features/tanstack-form/components/forms/group-field.tsx"],"sourcesContent":["import {\n Field,\n FieldContent,\n FieldContentMain,\n FieldDescription,\n FieldGroup,\n FieldLabel,\n FieldNote,\n FieldSeparator,\n} from '@/components/features/tanstack-form/components/ui/field';\n\n/**\n * Renders a labeled field group with an optional description, helper text, and a bottom separator.\n *\n * @example\n * import { TanStackFieldGroup } from '@customafk/lunas-ui/features/tanstack-form';\n *\n * <TanStackFieldGroup\n * label=\"Contact Details\"\n * description=\"Enter your contact information.\"\n * helperText=\"All fields are required.\"\n * orientation=\"horizontal\"\n * >\n * <EmailField />\n * </TanStackFieldGroup>\n */\nexport const TanStackFieldGroup: React.FC<\n React.PropsWithChildren<{\n /** Primary label displayed above the field content. */\n label: string;\n /** Secondary descriptive text shown beneath the label. */\n description?: string;\n /** Supplementary helper note rendered below the field content. */\n helperText?: string;\n /** Layout orientation of the label-to-content axis. Defaults to `'responsive'`. */\n orientation?: 'horizontal' | 'vertical' | 'responsive';\n }>\n> = ({\n label,\n description,\n helperText,\n\n orientation = 'responsive',\n children,\n}) => {\n return (\n <FieldGroup className=\"gap-y-4 px-4\">\n <Field orientation={orientation}>\n <FieldContent>\n <FieldLabel>{label}</FieldLabel>\n <FieldDescription>{description}</FieldDescription>\n </FieldContent>\n <FieldContentMain>\n {children}\n <FieldNote isShow={!!helperText}>{helperText}</FieldNote>\n </FieldContentMain>\n </Field>\n <FieldSeparator />\n </FieldGroup>\n );\n};\n"],"mappings":"2EA0BA,MAAa,GAWR,CACH,QACA,cACA,aAEA,cAAc,aACd,eAGE,EAAA,EAAA,KAAA,CAACA,EAAAA,WAAD,CAAY,UAAU,wBAAtB,EACE,EAAA,EAAA,KAAA,CAACC,EAAAA,MAAD,CAAoB,uBAApB,EACE,EAAA,EAAA,KAAA,CAACC,EAAAA,aAAD,CAAA,SAAA,EACE,EAAA,EAAA,IAAA,CAACC,EAAAA,WAAD,CAAA,SAAa,CAAkB,CAAA,GAC/B,EAAA,EAAA,IAAA,CAACC,EAAAA,iBAAD,CAAA,SAAmB,CAA8B,CAAA,CACrC,CAAA,CAAA,GACd,EAAA,EAAA,KAAA,CAACC,EAAAA,iBAAD,CAAA,SAAA,CACG,GACD,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"}
|
|
@@ -2167,11 +2167,14 @@ declare const TanStackPopoverForm: ComponentType<{
|
|
|
2167
2167
|
children?: import("react").ReactNode | undefined;
|
|
2168
2168
|
}>;
|
|
2169
2169
|
declare const TanStackContainerForm: ComponentType<{
|
|
2170
|
+
className?: string;
|
|
2171
|
+
} & {
|
|
2170
2172
|
children?: import("react").ReactNode | undefined;
|
|
2171
2173
|
}>;
|
|
2172
2174
|
declare const TanStackSectionForm: ComponentType<{
|
|
2173
2175
|
title: string;
|
|
2174
2176
|
icon?: React.ReactNode;
|
|
2177
|
+
className?: string;
|
|
2175
2178
|
} & {
|
|
2176
2179
|
children?: import("react").ReactNode | undefined;
|
|
2177
2180
|
}>;
|
|
@@ -2401,11 +2404,14 @@ declare const useTanStackForm: <TFormData, TOnMount extends FormValidateOrFn<TFo
|
|
|
2401
2404
|
children?: import("react").ReactNode | undefined;
|
|
2402
2405
|
}>;
|
|
2403
2406
|
readonly TanStackContainerForm: ComponentType<{
|
|
2407
|
+
className?: string;
|
|
2408
|
+
} & {
|
|
2404
2409
|
children?: import("react").ReactNode | undefined;
|
|
2405
2410
|
}>;
|
|
2406
2411
|
readonly TanStackSectionForm: ComponentType<{
|
|
2407
2412
|
title: string;
|
|
2408
2413
|
icon?: React.ReactNode;
|
|
2414
|
+
className?: string;
|
|
2409
2415
|
} & {
|
|
2410
2416
|
children?: import("react").ReactNode | undefined;
|
|
2411
2417
|
}>;
|
|
@@ -2575,11 +2581,14 @@ declare const useTanStackForm: <TFormData, TOnMount extends FormValidateOrFn<TFo
|
|
|
2575
2581
|
children?: import("react").ReactNode | undefined;
|
|
2576
2582
|
}>;
|
|
2577
2583
|
readonly TanStackContainerForm: ComponentType<{
|
|
2584
|
+
className?: string;
|
|
2585
|
+
} & {
|
|
2578
2586
|
children?: import("react").ReactNode | undefined;
|
|
2579
2587
|
}>;
|
|
2580
2588
|
readonly TanStackSectionForm: ComponentType<{
|
|
2581
2589
|
title: string;
|
|
2582
2590
|
icon?: React.ReactNode;
|
|
2591
|
+
className?: string;
|
|
2583
2592
|
} & {
|
|
2584
2593
|
children?: import("react").ReactNode | undefined;
|
|
2585
2594
|
}>;
|
|
@@ -2747,11 +2756,14 @@ declare const useTanStackForm: <TFormData, TOnMount extends FormValidateOrFn<TFo
|
|
|
2747
2756
|
children?: import("react").ReactNode | undefined;
|
|
2748
2757
|
}>;
|
|
2749
2758
|
readonly TanStackContainerForm: ComponentType<{
|
|
2759
|
+
className?: string;
|
|
2760
|
+
} & {
|
|
2750
2761
|
children?: import("react").ReactNode | undefined;
|
|
2751
2762
|
}>;
|
|
2752
2763
|
readonly TanStackSectionForm: ComponentType<{
|
|
2753
2764
|
title: string;
|
|
2754
2765
|
icon?: React.ReactNode;
|
|
2766
|
+
className?: string;
|
|
2755
2767
|
} & {
|
|
2756
2768
|
children?: import("react").ReactNode | undefined;
|
|
2757
2769
|
}>;
|
|
@@ -2923,11 +2935,14 @@ declare const useTanStackForm: <TFormData, TOnMount extends FormValidateOrFn<TFo
|
|
|
2923
2935
|
children?: import("react").ReactNode | undefined;
|
|
2924
2936
|
}>;
|
|
2925
2937
|
readonly TanStackContainerForm: ComponentType<{
|
|
2938
|
+
className?: string;
|
|
2939
|
+
} & {
|
|
2926
2940
|
children?: import("react").ReactNode | undefined;
|
|
2927
2941
|
}>;
|
|
2928
2942
|
readonly TanStackSectionForm: ComponentType<{
|
|
2929
2943
|
title: string;
|
|
2930
2944
|
icon?: React.ReactNode;
|
|
2945
|
+
className?: string;
|
|
2931
2946
|
} & {
|
|
2932
2947
|
children?: import("react").ReactNode | undefined;
|
|
2933
2948
|
}>;
|
|
@@ -3095,11 +3110,14 @@ declare const useTanStackForm: <TFormData, TOnMount extends FormValidateOrFn<TFo
|
|
|
3095
3110
|
children?: import("react").ReactNode | undefined;
|
|
3096
3111
|
}>;
|
|
3097
3112
|
readonly TanStackContainerForm: ComponentType<{
|
|
3113
|
+
className?: string;
|
|
3114
|
+
} & {
|
|
3098
3115
|
children?: import("react").ReactNode | undefined;
|
|
3099
3116
|
}>;
|
|
3100
3117
|
readonly TanStackSectionForm: ComponentType<{
|
|
3101
3118
|
title: string;
|
|
3102
3119
|
icon?: React.ReactNode;
|
|
3120
|
+
className?: string;
|
|
3103
3121
|
} & {
|
|
3104
3122
|
children?: import("react").ReactNode | undefined;
|
|
3105
3123
|
}>;
|
|
@@ -3266,11 +3284,14 @@ declare const useTanStackForm: <TFormData, TOnMount extends FormValidateOrFn<TFo
|
|
|
3266
3284
|
children?: import("react").ReactNode | undefined;
|
|
3267
3285
|
}>;
|
|
3268
3286
|
readonly TanStackContainerForm: ComponentType<{
|
|
3287
|
+
className?: string;
|
|
3288
|
+
} & {
|
|
3269
3289
|
children?: import("react").ReactNode | undefined;
|
|
3270
3290
|
}>;
|
|
3271
3291
|
readonly TanStackSectionForm: ComponentType<{
|
|
3272
3292
|
title: string;
|
|
3273
3293
|
icon?: React.ReactNode;
|
|
3294
|
+
className?: string;
|
|
3274
3295
|
} & {
|
|
3275
3296
|
children?: import("react").ReactNode | undefined;
|
|
3276
3297
|
}>;
|
|
@@ -3317,4 +3338,4 @@ declare const useTanStackForm: <TFormData, TOnMount extends FormValidateOrFn<TFo
|
|
|
3317
3338
|
}>) => ReturnType<import("react").FunctionComponent>;
|
|
3318
3339
|
//#endregion
|
|
3319
3340
|
export { EmailFieldProps as $, TanStackActionSubmit as A, TextField as B, SimpleNumberField as C, SimpleTextField as D, SimpleSelectField as E, TanStackFieldGroup as F, useTanStackFieldContext as G, useTanStackForm as H, TanStackPopoverForm as I, BooleanFieldValue as J, useTanStackFormContext as K, TanStackSectionForm as L, TanStackCardForm as M, TanStackContainerForm as N, SimpleTextareaField as O, TanStackDialogForm as P, DateFieldValue as Q, TanStackTitleField as R, SimpleEmailField as S, SimpleRadioGroupField as T, withTanStackFieldGroup as U, TextareaField as V, withTanStackForm as W, ComboboxFieldProps as X, CheckboxFieldProps as Y, DateFieldProps as Z, SelectField as _, DateField as a, NumberFieldValue as at, SimpleComboboxField as b, FieldContent as c, RadioOption as ct, FieldGroup as d, SimpleTextFieldProps as dt, FieldOrientation as et, FieldLabel as f, SwitchFieldProps as ft, RadioGroupField as g, TextareaFieldProps as gt, PasswordField as h, TextFieldValue as ht, ComboboxField as i, NumberFieldProps as it, TanStackActionsForm as j, SwitchField as k, FieldContentMain as l, SelectFieldProps as lt, NumberField as m, TextFieldProps as mt, ArrayHeaderRow as n, FieldType as nt, EmailField as o, PasswordFieldProps as ot, FieldSeparator as p, TextEditorFieldProps as pt, AnyFieldProps as q, CheckboxField as r, MultiSelectFieldValue as rt, Field as s, RadioGroupFieldProps as st, ArrayCol as t, FieldRounding as tt, FieldError as u, SelectOption as ut, SimpleArrayField as v, SimplePasswordField as w, SimpleDateField as x, SimpleBooleanField as y, TextEditorField as z };
|
|
3320
|
-
//# sourceMappingURL=index-
|
|
3341
|
+
//# sourceMappingURL=index-BGnN6Vax.d.cts.map
|