@customafk/lunas-ui 0.2.83 → 0.2.84
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-BHY2dndL.mjs +2 -0
- package/dist/{action-submit-BQdkz4mS.mjs.map → action-submit-BHY2dndL.mjs.map} +1 -1
- package/dist/action-submit-tpgKvZ47.cjs +2 -0
- package/dist/{action-submit-B9vHpLoN.cjs.map → action-submit-tpgKvZ47.cjs.map} +1 -1
- package/dist/actions-form-PByL8_M5.mjs +2 -0
- package/dist/{actions-form-D4n1W3-X.mjs.map → actions-form-PByL8_M5.mjs.map} +1 -1
- package/dist/actions-form-X46W7FVa.cjs +2 -0
- package/dist/{actions-form-DF2eYxGQ.cjs.map → actions-form-X46W7FVa.cjs.map} +1 -1
- package/dist/{button-BnoPktln.d.cts → button-BGW-LZ3i.d.cts} +2 -2
- package/dist/{button-BnoPktln.d.mts → button-BGW-LZ3i.d.mts} +2 -2
- package/dist/{calendar-BkV5hTX2.d.mts → calendar-BNTvKnwd.d.cts} +2 -2
- package/dist/{calendar-iDMPT1kI.d.cts → calendar-DbaIaWr0.d.mts} +2 -2
- package/dist/{carousel-D7VXWJ3S.d.mts → carousel-Bw-VhPR3.d.mts} +2 -2
- package/dist/{carousel-bBvM31sh.d.cts → carousel-DRqMTyKS.d.cts} +2 -2
- package/dist/checkbox-field-BG35eKvM.cjs +2 -0
- package/dist/{checkbox-field-ldZRSCca.cjs.map → checkbox-field-BG35eKvM.cjs.map} +1 -1
- package/dist/checkbox-field-C-NyMjEm.mjs +2 -0
- package/dist/{checkbox-field-BRGTLOjq.mjs.map → checkbox-field-C-NyMjEm.mjs.map} +1 -1
- package/dist/{cms-layout-BGsf1E4E.cjs → cms-layout-DYEmSqzx.cjs} +2 -2
- package/dist/{cms-layout-BGsf1E4E.cjs.map → cms-layout-DYEmSqzx.cjs.map} +1 -1
- package/dist/combobox-field-Cx0A-CD4.mjs +2 -0
- package/dist/{combobox-field-CvkdZkQE.mjs.map → combobox-field-Cx0A-CD4.mjs.map} +1 -1
- package/dist/combobox-field-ROYquFD8.cjs +2 -0
- package/dist/{combobox-field-ZYr7636s.cjs.map → combobox-field-ROYquFD8.cjs.map} +1 -1
- package/dist/data-display/country.cjs +1 -1
- package/dist/date-field-46UtGmEV.cjs +2 -0
- package/dist/{date-field-1Hmcv8Zp.cjs.map → date-field-46UtGmEV.cjs.map} +1 -1
- package/dist/date-field-zoPch5tC.mjs +2 -0
- package/dist/{date-field-DGMTG_hu.mjs.map → date-field-zoPch5tC.mjs.map} +1 -1
- package/dist/dialog-form-BRV1niqF.mjs +2 -0
- package/dist/{dialog-form-BRSZpRTC.mjs.map → dialog-form-BRV1niqF.mjs.map} +1 -1
- package/dist/dialog-form-X9MxC8pq.cjs +2 -0
- package/dist/{dialog-form-C1qpltYx.cjs.map → dialog-form-X9MxC8pq.cjs.map} +1 -1
- package/dist/dialogs/detail-dialog/components/sidebar.d.cts +1 -1
- package/dist/dialogs/detail-dialog/components/sidebar.d.mts +1 -1
- package/dist/{dist-DzA--RwW.cjs → dist-CIdWHwhj.cjs} +2 -2
- package/dist/{dist-DzA--RwW.cjs.map → dist-CIdWHwhj.cjs.map} +1 -1
- package/dist/email-field-0UjeYtnM.cjs +2 -0
- package/dist/{email-field-D3nSkHj2.cjs.map → email-field-0UjeYtnM.cjs.map} +1 -1
- package/dist/email-field-CPEVNvn8.mjs +2 -0
- package/dist/{email-field-C2Lvl_rQ.mjs.map → email-field-CPEVNvn8.mjs.map} +1 -1
- package/dist/features/tables/index.d.cts +1 -1
- package/dist/features/tables/index.d.mts +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/features/text-editor/index.cjs +1 -1
- package/dist/features/text-editor/index.d.cts +1 -1
- package/dist/features/text-editor/index.d.mts +1 -1
- package/dist/features/text-editor/index.mjs +1 -1
- package/dist/{flex-C63_IqSY.d.cts → flex-D7IE_cdR.d.cts} +4 -4
- package/dist/{flex-C63_IqSY.d.mts → flex-D7IE_cdR.d.mts} +4 -4
- package/dist/group-field-Cs0uWHg0.mjs +2 -0
- package/dist/{group-field-gejvx_Td.mjs.map → group-field-Cs0uWHg0.mjs.map} +1 -1
- package/dist/group-field-DJXL9sRy.cjs +2 -0
- package/dist/{group-field-sVykO2JZ.cjs.map → group-field-DJXL9sRy.cjs.map} +1 -1
- package/dist/{index-DvC1inRy.d.cts → index-0HuXxgjQ.d.cts} +13 -10
- package/dist/{index-DvC1inRy.d.mts → index-CZ_2KVir.d.mts} +13 -10
- package/dist/{index-DRAyYm8g.d.cts → index-CvFEJoon.d.cts} +12 -3
- package/dist/{index-DRAyYm8g.d.mts → index-CvFEJoon.d.mts} +12 -3
- package/dist/{index-CrkOhm--.d.mts → index-DJY2uC2H.d.mts} +12 -12
- package/dist/{index--wNkNzCB.d.cts → index-UZik7mgS.d.cts} +12 -12
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +12 -12
- package/dist/index.d.mts +12 -12
- package/dist/index.mjs +1 -1
- package/dist/{input-DxNK7Wo6.d.cts → input-D73TrUof.d.cts} +2 -2
- package/dist/{input-DxNK7Wo6.d.mts → input-D73TrUof.d.mts} +2 -2
- package/dist/layouts/cms-layout/index.cjs +1 -1
- package/dist/layouts/flex.d.cts +1 -1
- package/dist/layouts/flex.d.mts +1 -1
- package/dist/layouts/payment-layout/index.cjs +1 -1
- package/dist/number-field-CMskIrWP.cjs +2 -0
- package/dist/{number-field-CWDYA3La.cjs.map → number-field-CMskIrWP.cjs.map} +1 -1
- package/dist/number-field-DSGwWg7y.mjs +2 -0
- package/dist/{number-field-CR5PLX6H.mjs.map → number-field-DSGwWg7y.mjs.map} +1 -1
- package/dist/{pagination-BRw-yZBY.d.cts → pagination-DDcO-TPf.d.cts} +2 -2
- package/dist/{pagination-BlLiOvY9.d.mts → pagination-DWg3Xv34.d.mts} +2 -2
- package/dist/{paragraph-CRo5eC7H.d.mts → paragraph--8GcgnQL.d.cts} +3 -3
- package/dist/{paragraph-CkCNIsvz.d.cts → paragraph-BOa0VlGX.d.mts} +3 -3
- package/dist/password-field-BxJqTPhN.cjs +2 -0
- package/dist/{password-field-BHRhVyZ0.cjs.map → password-field-BxJqTPhN.cjs.map} +1 -1
- package/dist/password-field-DsmwNZep.mjs +2 -0
- package/dist/{password-field-B2_kzss6.mjs.map → password-field-DsmwNZep.mjs.map} +1 -1
- package/dist/{payment-layout-BZtIcu-3.cjs → payment-layout-C38xIc2X.cjs} +2 -2
- package/dist/{payment-layout-BZtIcu-3.cjs.map → payment-layout-C38xIc2X.cjs.map} +1 -1
- package/dist/popover-form-BUc5ivCF.mjs +2 -0
- package/dist/{popover-form-CeRVpy1B.mjs.map → popover-form-BUc5ivCF.mjs.map} +1 -1
- package/dist/popover-form-CdXVFl0t.cjs +2 -0
- package/dist/{popover-form-Ch_iMMSm.cjs.map → popover-form-CdXVFl0t.cjs.map} +1 -1
- package/dist/radio-group-field-CmCo87tm.mjs +2 -0
- package/dist/{radio-group-field-Iwo2Q2Ig.mjs.map → radio-group-field-CmCo87tm.mjs.map} +1 -1
- package/dist/radio-group-field-gHNAwrdr.cjs +2 -0
- package/dist/{radio-group-field-BFhBfzoT.cjs.map → radio-group-field-gHNAwrdr.cjs.map} +1 -1
- package/dist/{resizable-CNqPu4Ck.d.cts → resizable-C6JLqxF3.d.cts} +2 -2
- package/dist/{resizable-CNqPu4Ck.d.mts → resizable-C6JLqxF3.d.mts} +2 -2
- package/dist/rolldown-runtime-DWNI8pZO.cjs +1 -0
- package/dist/{search-input-C8feOKe2.d.cts → search-input-DEvYI6Rm.d.mts} +2 -2
- package/dist/{search-input-CoqwakbI.d.mts → search-input-h_3MoMqK.d.cts} +2 -2
- package/dist/select-field-8PfksL_U.mjs +2 -0
- package/dist/{select-field-NJgDDCO2.mjs.map → select-field-8PfksL_U.mjs.map} +1 -1
- package/dist/select-field-Ce53hZ3J.cjs +2 -0
- package/dist/{select-field-CvDBZQTl.cjs.map → select-field-Ce53hZ3J.cjs.map} +1 -1
- package/dist/simple-array-field-BAR4MjDR.cjs +2 -0
- package/dist/{simple-array-field-aGXkDZXD.cjs.map → simple-array-field-BAR4MjDR.cjs.map} +1 -1
- package/dist/simple-array-field-C0kpO1cq.mjs +2 -0
- package/dist/{simple-array-field-BwNCeUnn.mjs.map → simple-array-field-C0kpO1cq.mjs.map} +1 -1
- package/dist/simple-boolean-field-36jmOxCR.cjs +2 -0
- package/dist/{simple-boolean-field-BeVkn3c4.cjs.map → simple-boolean-field-36jmOxCR.cjs.map} +1 -1
- package/dist/simple-boolean-field-Bdc4wuUU.mjs +2 -0
- package/dist/{simple-boolean-field-t_XDXqYs.mjs.map → simple-boolean-field-Bdc4wuUU.mjs.map} +1 -1
- package/dist/simple-combobox-field-BPDtPj1W.cjs +2 -0
- package/dist/{simple-combobox-field-U0ZAl7VQ.cjs.map → simple-combobox-field-BPDtPj1W.cjs.map} +1 -1
- package/dist/simple-combobox-field-CR5Q6Nsd.mjs +2 -0
- package/dist/{simple-combobox-field-HCB4A33-.mjs.map → simple-combobox-field-CR5Q6Nsd.mjs.map} +1 -1
- package/dist/simple-date-field-DUPnGa5d.cjs +2 -0
- package/dist/{simple-date-field-DtxEpEZj.cjs.map → simple-date-field-DUPnGa5d.cjs.map} +1 -1
- package/dist/simple-date-field-DkhG2o7I.mjs +2 -0
- package/dist/{simple-date-field-Dj4bJoji.mjs.map → simple-date-field-DkhG2o7I.mjs.map} +1 -1
- package/dist/simple-email-field-BTYqiFp8.cjs +2 -0
- package/dist/{simple-email-field-DK9I_Tc_.cjs.map → simple-email-field-BTYqiFp8.cjs.map} +1 -1
- package/dist/simple-email-field-CpxklyKr.mjs +2 -0
- package/dist/{simple-email-field-BDyhkmHV.mjs.map → simple-email-field-CpxklyKr.mjs.map} +1 -1
- package/dist/simple-number-field-CTFyTMgw.cjs +2 -0
- package/dist/{simple-number-field-BspqWU-3.cjs.map → simple-number-field-CTFyTMgw.cjs.map} +1 -1
- package/dist/simple-number-field-DuCvwUG9.mjs +2 -0
- package/dist/{simple-number-field-hneXMhfJ.mjs.map → simple-number-field-DuCvwUG9.mjs.map} +1 -1
- package/dist/simple-password-field-BaeUvVB1.cjs +2 -0
- package/dist/{simple-password-field-BEEcleom.cjs.map → simple-password-field-BaeUvVB1.cjs.map} +1 -1
- package/dist/simple-password-field-Cu_JvDEE.mjs +2 -0
- package/dist/{simple-password-field-vsLRHDk4.mjs.map → simple-password-field-Cu_JvDEE.mjs.map} +1 -1
- package/dist/simple-radio-group-field-DiU4eQ_c.cjs +2 -0
- package/dist/{simple-radio-group-field-Wm8xB0fN.cjs.map → simple-radio-group-field-DiU4eQ_c.cjs.map} +1 -1
- package/dist/simple-radio-group-field-RJ_cEsxK.mjs +2 -0
- package/dist/{simple-radio-group-field-BURm_BSA.mjs.map → simple-radio-group-field-RJ_cEsxK.mjs.map} +1 -1
- package/dist/simple-select-field-B3uEUqvQ.mjs +2 -0
- package/dist/{simple-select-field-8cY51U4d.mjs.map → simple-select-field-B3uEUqvQ.mjs.map} +1 -1
- package/dist/simple-select-field-C8vmeHbL.cjs +2 -0
- package/dist/{simple-select-field-QQ65caBf.cjs.map → simple-select-field-C8vmeHbL.cjs.map} +1 -1
- package/dist/simple-text-field-BEoQmd1b.mjs +2 -0
- package/dist/{simple-text-field-DK72_OA_.mjs.map → simple-text-field-BEoQmd1b.mjs.map} +1 -1
- package/dist/simple-text-field-zFJt_99J.cjs +2 -0
- package/dist/{simple-text-field-BHkCPiE5.cjs.map → simple-text-field-zFJt_99J.cjs.map} +1 -1
- package/dist/simple-textarea-field-CzpApMiv.mjs +2 -0
- package/dist/{simple-textarea-field-B72nNQHv.mjs.map → simple-textarea-field-CzpApMiv.mjs.map} +1 -1
- package/dist/simple-textarea-field-DyQZEDTe.cjs +2 -0
- package/dist/{simple-textarea-field-Bu5h7sfH.cjs.map → simple-textarea-field-DyQZEDTe.cjs.map} +1 -1
- package/dist/switch-field-CsI6eXJu.cjs +2 -0
- package/dist/{switch-field-eLVlQZSI.cjs.map → switch-field-CsI6eXJu.cjs.map} +1 -1
- package/dist/switch-field-D2SWDM1l.mjs +2 -0
- package/dist/{switch-field-DoPUWb9d.mjs.map → switch-field-D2SWDM1l.mjs.map} +1 -1
- package/dist/tanstack-form-BiOihtxs.cjs +2 -0
- package/dist/tanstack-form-BiOihtxs.cjs.map +1 -0
- package/dist/tanstack-form-Do6xL2kv.mjs +2 -0
- package/dist/tanstack-form-Do6xL2kv.mjs.map +1 -0
- package/dist/text-editor-DWZf3yrW.cjs +2 -0
- package/dist/text-editor-DWZf3yrW.cjs.map +1 -0
- package/dist/text-editor-XBOAwJk-.mjs +2 -0
- package/dist/text-editor-XBOAwJk-.mjs.map +1 -0
- package/dist/text-field-D9CYYDKM.cjs +2 -0
- package/dist/{text-field-DT50dOVI.cjs.map → text-field-D9CYYDKM.cjs.map} +1 -1
- package/dist/text-field-wes_PQEd.mjs +2 -0
- package/dist/{text-field-Bm-k6Jr7.mjs.map → text-field-wes_PQEd.mjs.map} +1 -1
- package/dist/textarea-field-BiNmDHgL.mjs +2 -0
- package/dist/{textarea-field-DNLyrRH7.mjs.map → textarea-field-BiNmDHgL.mjs.map} +1 -1
- package/dist/textarea-field-CRf0M2Eb.cjs +2 -0
- package/dist/{textarea-field-BhqX29CS.cjs.map → textarea-field-CRf0M2Eb.cjs.map} +1 -1
- package/dist/title-field-B9LLoqIi.cjs +2 -0
- package/dist/{title-field-B2hM3S_S.cjs.map → title-field-B9LLoqIi.cjs.map} +1 -1
- package/dist/title-field-C4BmSDR2.mjs +2 -0
- package/dist/{title-field-oAqHRw59.mjs.map → title-field-C4BmSDR2.mjs.map} +1 -1
- package/dist/typography/paragraph.d.cts +1 -1
- package/dist/typography/paragraph.d.mts +1 -1
- package/dist/ui/breadcrumb.cjs +1 -1
- package/dist/ui/button-group.cjs +1 -1
- package/dist/ui/button.cjs +1 -1
- package/dist/ui/button.d.cts +1 -1
- package/dist/ui/button.d.mts +1 -1
- package/dist/ui/calendar.d.cts +1 -1
- package/dist/ui/calendar.d.mts +1 -1
- package/dist/ui/carousel.cjs +1 -1
- package/dist/ui/carousel.d.cts +1 -1
- package/dist/ui/carousel.d.mts +1 -1
- package/dist/ui/dropdown-menu.cjs +1 -1
- package/dist/ui/dropdown-menu.cjs.map +1 -1
- package/dist/ui/dropdown-menu.mjs +1 -1
- package/dist/ui/dropdown-menu.mjs.map +1 -1
- package/dist/ui/file-uploader.cjs +1 -1
- package/dist/ui/input.d.cts +1 -1
- package/dist/ui/input.d.mts +1 -1
- package/dist/ui/inputs/search-input.d.cts +1 -1
- package/dist/ui/inputs/search-input.d.mts +1 -1
- package/dist/ui/item.cjs +1 -1
- package/dist/ui/pagination.d.cts +1 -1
- package/dist/ui/pagination.d.mts +1 -1
- package/dist/ui/resizable.cjs +1 -1
- package/dist/ui/resizable.d.cts +1 -1
- package/dist/ui/resizable.d.mts +1 -1
- package/package.json +7 -2
- package/styles/text-editor.css +205 -38
- package/dist/action-submit-B9vHpLoN.cjs +0 -2
- package/dist/action-submit-BQdkz4mS.mjs +0 -2
- package/dist/actions-form-D4n1W3-X.mjs +0 -2
- package/dist/actions-form-DF2eYxGQ.cjs +0 -2
- package/dist/checkbox-field-BRGTLOjq.mjs +0 -2
- package/dist/checkbox-field-ldZRSCca.cjs +0 -2
- package/dist/combobox-field-CvkdZkQE.mjs +0 -2
- package/dist/combobox-field-ZYr7636s.cjs +0 -2
- package/dist/date-field-1Hmcv8Zp.cjs +0 -2
- package/dist/date-field-DGMTG_hu.mjs +0 -2
- package/dist/dialog-form-BRSZpRTC.mjs +0 -2
- package/dist/dialog-form-C1qpltYx.cjs +0 -2
- package/dist/email-field-C2Lvl_rQ.mjs +0 -2
- package/dist/email-field-D3nSkHj2.cjs +0 -2
- package/dist/field-BSLi-P0Q.cjs +0 -2
- package/dist/field-BSLi-P0Q.cjs.map +0 -1
- package/dist/field-V2DoD8qL.mjs +0 -2
- package/dist/field-V2DoD8qL.mjs.map +0 -1
- package/dist/group-field-gejvx_Td.mjs +0 -2
- package/dist/group-field-sVykO2JZ.cjs +0 -2
- package/dist/number-field-CR5PLX6H.mjs +0 -2
- package/dist/number-field-CWDYA3La.cjs +0 -2
- package/dist/password-field-B2_kzss6.mjs +0 -2
- package/dist/password-field-BHRhVyZ0.cjs +0 -2
- package/dist/popover-form-CeRVpy1B.mjs +0 -2
- package/dist/popover-form-Ch_iMMSm.cjs +0 -2
- package/dist/radio-group-field-BFhBfzoT.cjs +0 -2
- package/dist/radio-group-field-Iwo2Q2Ig.mjs +0 -2
- package/dist/rolldown-runtime-CMqjfN_6.cjs +0 -1
- package/dist/select-field-CvDBZQTl.cjs +0 -2
- package/dist/select-field-NJgDDCO2.mjs +0 -2
- package/dist/simple-array-field-BwNCeUnn.mjs +0 -2
- package/dist/simple-array-field-aGXkDZXD.cjs +0 -2
- package/dist/simple-boolean-field-BeVkn3c4.cjs +0 -2
- package/dist/simple-boolean-field-t_XDXqYs.mjs +0 -2
- package/dist/simple-combobox-field-HCB4A33-.mjs +0 -2
- package/dist/simple-combobox-field-U0ZAl7VQ.cjs +0 -2
- package/dist/simple-date-field-Dj4bJoji.mjs +0 -2
- package/dist/simple-date-field-DtxEpEZj.cjs +0 -2
- package/dist/simple-email-field-BDyhkmHV.mjs +0 -2
- package/dist/simple-email-field-DK9I_Tc_.cjs +0 -2
- package/dist/simple-number-field-BspqWU-3.cjs +0 -2
- package/dist/simple-number-field-hneXMhfJ.mjs +0 -2
- package/dist/simple-password-field-BEEcleom.cjs +0 -2
- package/dist/simple-password-field-vsLRHDk4.mjs +0 -2
- package/dist/simple-radio-group-field-BURm_BSA.mjs +0 -2
- package/dist/simple-radio-group-field-Wm8xB0fN.cjs +0 -2
- package/dist/simple-select-field-8cY51U4d.mjs +0 -2
- package/dist/simple-select-field-QQ65caBf.cjs +0 -2
- package/dist/simple-text-field-BHkCPiE5.cjs +0 -2
- package/dist/simple-text-field-DK72_OA_.mjs +0 -2
- package/dist/simple-textarea-field-B72nNQHv.mjs +0 -2
- package/dist/simple-textarea-field-Bu5h7sfH.cjs +0 -2
- package/dist/switch-field-DoPUWb9d.mjs +0 -2
- package/dist/switch-field-eLVlQZSI.cjs +0 -2
- package/dist/tanstack-form-C0ab8EEl.cjs +0 -2
- package/dist/tanstack-form-C0ab8EEl.cjs.map +0 -1
- package/dist/tanstack-form-fkaBh9RO.mjs +0 -2
- package/dist/tanstack-form-fkaBh9RO.mjs.map +0 -1
- package/dist/text-editor-BtfyZSgR.cjs +0 -2
- package/dist/text-editor-BtfyZSgR.cjs.map +0 -1
- package/dist/text-editor-CtR27_PR.mjs +0 -2
- package/dist/text-editor-CtR27_PR.mjs.map +0 -1
- package/dist/text-editor-field-B6HEsAHt.mjs +0 -2
- package/dist/text-editor-field-B6HEsAHt.mjs.map +0 -1
- package/dist/text-editor-field-DcEUC0iH.cjs +0 -2
- package/dist/text-editor-field-DcEUC0iH.cjs.map +0 -1
- package/dist/text-field-Bm-k6Jr7.mjs +0 -2
- package/dist/text-field-DT50dOVI.cjs +0 -2
- package/dist/textarea-field-BhqX29CS.cjs +0 -2
- package/dist/textarea-field-DNLyrRH7.mjs +0 -2
- package/dist/title-field-B2hM3S_S.cjs +0 -2
- package/dist/title-field-oAqHRw59.mjs +0 -2
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./ui/button.cjs"),t=require("./tanstack-form-C0ab8EEl.cjs"),n=require("./ui/popover.cjs"),r=require("./ui/calendar.cjs"),i=require("./field-BSLi-P0Q.cjs");let a=require("lucide-react"),o=require("react"),s=require("@customafk/react-toolkit/utils"),c=require("react/jsx-runtime"),l=require("@customafk/react-toolkit/date-fns"),u=require("@tanstack/react-form");const d=(0,o.memo)(({label:d,description:f,placeholder:p,orientation:m=`responsive`,tooltip:h,helperText:g,showErrorMessage:_=!0,required:v=!1,disabled:y=!1,minDate:b,maxDate:x})=>{let S=(0,o.useId)(),C=t.G(),[w,T]=(0,o.useState)(!1),E=(0,u.useStore)(C.form.store,({isSubmitting:e})=>e),D=y||E,O=C.state.meta.isDirty||C.state.meta.isTouched,k=O&&!C.state.meta.isValid,A=v&&C.state.value===null,j=O&&C.state.meta.errors.length>0,M=e=>{C.handleChange(e),T(!1)};return(0,c.jsxs)(i.FieldGroup,{className:`px-4`,children:[(0,c.jsxs)(i.Field,{orientation:m,"data-invalid":k,children:[(0,c.jsxs)(i.FieldContent,{children:[(0,c.jsxs)(i.FieldLabel,{htmlFor:C.name,"aria-required":A,children:[d,h&&(0,c.jsx)(i.FieldTooltip,{tooltip:h})]}),(0,c.jsx)(i.FieldDescription,{children:f})]}),(0,c.jsx)(i.FieldContentMain,{className:`flex flex-col space-y-1`,children:(0,c.jsxs)(`div`,{className:`flex w-full flex-col`,children:[(0,c.jsxs)(n.Popover,{open:w,onOpenChange:e=>{T(e),e||C.handleBlur()},children:[(0,c.jsx)(n.PopoverTrigger,{asChild:!0,children:(0,c.jsxs)(e.Button,{variant:`outline`,color:`muted`,size:`lg`,disabled:D,"aria-invalid":k?!0:void 0,"aria-describedby":S,className:(0,s.cn)(`flex items-center justify-between rounded font-normal outline-border`,`hover:bg-transparent`,`focus:outline-1 focus:outline-primary-strong focus:ring-4 focus:ring-primary-weak`,`data-[state=open]:outline-1 data-[state=open]:outline-primary-strong data-[state=open]:ring-4 data-[state=open]:ring-primary-weak`,C.state.value===null&&`text-text-positive-muted`,k&&`outline-danger bg-danger-bg-subtle ring-4 ring-danger-weak`),children:[(0,c.jsx)(`p`,{children:C.state.value===null?p??`Select date`:(0,l.format)(C.state.value,`PPPP`)}),(0,c.jsx)(a.CalendarDaysIcon,{strokeWidth:1})]})}),(0,c.jsxs)(n.PopoverContent,{align:`start`,side:`bottom`,className:`flex w-fit min-w-0 overflow-y-auto rounded p-0`,children:[(0,c.jsxs)(`div`,{className:`flex h-full flex-col space-y-2 border-r border-r-border p-2 [&>button]:justify-start [&>button]:text-sm`,children:[(0,c.jsx)(e.Button,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>M((0,l.endOfToday)()),children:`Hôm nay`}),(0,c.jsx)(e.Button,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>M((0,l.endOfTomorrow)()),children:`Ngày mai`}),(0,c.jsx)(e.Button,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>M((0,l.endOfYesterday)()),children:`Hôm qua`}),(0,c.jsx)(e.Button,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>M((0,l.subDays)((0,l.endOfToday)(),3)),children:`3 ngày qua`}),(0,c.jsx)(e.Button,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>M((0,l.subDays)((0,l.endOfToday)(),7)),children:`7 ngày qua`}),(0,c.jsx)(e.Button,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>M((0,l.subDays)((0,l.endOfToday)(),30)),children:`30 ngày qua`}),(0,c.jsx)(e.Button,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>M((0,l.startOfMonth)((0,l.endOfToday)())),children:`Tháng này`}),(0,c.jsx)(e.Button,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>M((0,l.lastDayOfMonth)((0,l.endOfToday)())),children:`Tháng trước`})]}),(0,c.jsx)(`div`,{className:`flex flex-1 flex-col`,children:(0,c.jsx)(`div`,{className:`min-w-73 border-b border-b-border p-2`,children:(0,c.jsx)(r.Calendar,{mode:`single`,selected:C.state.value??void 0,hidden:{before:b??new Date(1900,0,1),after:x??new Date(2100,11,31)},onSelect:e=>{e&&M(e)}})})})]})]}),O&&_&&j&&(0,c.jsx)(i.FieldError,{id:S,className:`mt-1`,errors:C.state.meta.errors}),(0,c.jsx)(i.FieldNote,{isShow:!!g,children:g})]})})]}),(0,c.jsx)(i.FieldSeparator,{})]})});d.displayName=`DateField`,exports.DateField=d;
|
|
2
|
-
//# sourceMappingURL=date-field-1Hmcv8Zp.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Button as e}from"./ui/button.mjs";import{G as t}from"./tanstack-form-fkaBh9RO.mjs";import{Popover as n,PopoverContent as r,PopoverTrigger as i}from"./ui/popover.mjs";import{Calendar as a}from"./ui/calendar.mjs";import{Field as o,FieldContent as s,FieldContentMain as c,FieldDescription as l,FieldError as u,FieldGroup as d,FieldLabel as f,FieldNote as p,FieldSeparator as m,FieldTooltip as h}from"./field-V2DoD8qL.mjs";import{CalendarDaysIcon as g}from"lucide-react";import{memo as _,useId as v,useState as y}from"react";import{cn as b}from"@customafk/react-toolkit/utils";import{jsx as x,jsxs as S}from"react/jsx-runtime";import{endOfToday as C,endOfTomorrow as w,endOfYesterday as T,format as E,lastDayOfMonth as D,startOfMonth as O,subDays as k}from"@customafk/react-toolkit/date-fns";import{useStore as A}from"@tanstack/react-form";const j=_(({label:_,description:j,placeholder:M,orientation:N=`responsive`,tooltip:P,helperText:F,showErrorMessage:I=!0,required:L=!1,disabled:R=!1,minDate:z,maxDate:B})=>{let V=v(),H=t(),[U,W]=y(!1),G=A(H.form.store,({isSubmitting:e})=>e),K=R||G,q=H.state.meta.isDirty||H.state.meta.isTouched,J=q&&!H.state.meta.isValid,Y=L&&H.state.value===null,X=q&&H.state.meta.errors.length>0,Z=e=>{H.handleChange(e),W(!1)};return S(d,{className:`px-4`,children:[S(o,{orientation:N,"data-invalid":J,children:[S(s,{children:[S(f,{htmlFor:H.name,"aria-required":Y,children:[_,P&&x(h,{tooltip:P})]}),x(l,{children:j})]}),x(c,{className:`flex flex-col space-y-1`,children:S(`div`,{className:`flex w-full flex-col`,children:[S(n,{open:U,onOpenChange:e=>{W(e),e||H.handleBlur()},children:[x(i,{asChild:!0,children:S(e,{variant:`outline`,color:`muted`,size:`lg`,disabled:K,"aria-invalid":J?!0:void 0,"aria-describedby":V,className:b(`flex items-center justify-between rounded font-normal outline-border`,`hover:bg-transparent`,`focus:outline-1 focus:outline-primary-strong focus:ring-4 focus:ring-primary-weak`,`data-[state=open]:outline-1 data-[state=open]:outline-primary-strong data-[state=open]:ring-4 data-[state=open]:ring-primary-weak`,H.state.value===null&&`text-text-positive-muted`,J&&`outline-danger bg-danger-bg-subtle ring-4 ring-danger-weak`),children:[x(`p`,{children:H.state.value===null?M??`Select date`:E(H.state.value,`PPPP`)}),x(g,{strokeWidth:1})]})}),S(r,{align:`start`,side:`bottom`,className:`flex w-fit min-w-0 overflow-y-auto rounded p-0`,children:[S(`div`,{className:`flex h-full flex-col space-y-2 border-r border-r-border p-2 [&>button]:justify-start [&>button]:text-sm`,children:[x(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>Z(C()),children:`Hôm nay`}),x(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>Z(w()),children:`Ngày mai`}),x(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>Z(T()),children:`Hôm qua`}),x(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>Z(k(C(),3)),children:`3 ngày qua`}),x(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>Z(k(C(),7)),children:`7 ngày qua`}),x(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>Z(k(C(),30)),children:`30 ngày qua`}),x(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>Z(O(C())),children:`Tháng này`}),x(e,{variant:`ghost`,color:`muted`,className:`w-32`,onClick:()=>Z(D(C())),children:`Tháng trước`})]}),x(`div`,{className:`flex flex-1 flex-col`,children:x(`div`,{className:`min-w-73 border-b border-b-border p-2`,children:x(a,{mode:`single`,selected:H.state.value??void 0,hidden:{before:z??new Date(1900,0,1),after:B??new Date(2100,11,31)},onSelect:e=>{e&&Z(e)}})})})]})]}),q&&I&&X&&x(u,{id:V,className:`mt-1`,errors:H.state.meta.errors}),x(p,{isShow:!!F,children:F})]})})]}),x(m,{})]})});j.displayName=`DateField`;export{j as DateField};
|
|
2
|
-
//# sourceMappingURL=date-field-DGMTG_hu.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Dialog as e,DialogContent as t,DialogOverlay as n,DialogPortal as r,DialogTitle as i}from"./ui/dialog.mjs";import{K as a}from"./tanstack-form-fkaBh9RO.mjs";import{Separator as o}from"./ui/separator.mjs";import{n as s,t as c}from"./submit-button-CGBaPzE9.mjs";import{useCallback as l}from"react";import{cn as u}from"@customafk/react-toolkit/utils";import{jsx as d,jsxs as f}from"react/jsx-runtime";const p=({title:p,submitText:m,width:h,maxWidth:g,className:_,open:v,onOpenChange:y,children:b})=>{let x=a(),S=l(e=>{e||x.reset(),y?.(e)},[x.reset,y]);return d(e,{open:v,onOpenChange:S,children:f(r,{"data-slot":`dialog-portal`,children:[d(n,{}),f(t,{style:{"--width":h,"--max-width":g},className:u(`flex size-full max-h-dvh max-w-dvw flex-col gap-0 overflow-y-auto rounded-none p-0 shadow-dialog sm:h-auto sm:max-h-[85dvh] sm:max-w-5xl sm:rounded-md`,h&&`sm:w-(--width)`,g&&`sm:max-w-(--max-width)`,_),onOpenAutoFocus:e=>{e.preventDefault()},onInteractOutside:e=>{e.preventDefault()},children:[d(`div`,{"data-slot":`dialog-header`,className:`flex items-center justify-center gap-2 px-6 py-5 text-center sm:text-left`,children:d(i,{"data-slot":`dialog-title`,className:`font-semibold text-lg tracking-tight`,children:p})}),d(o,{}),d(`div`,{"data-slot":`dialog-content`,className:`relative flex flex-col overflow-y-auto p-0 pt-4 max-sm:flex-1 sm:p-4`,children:b}),d(o,{}),f(`div`,{"data-slot":`dialog-footer`,className:`flex flex-col-reverse items-center justify-end gap-2 px-6 py-4 sm:flex-row max-sm:[&>button]:w-full`,children:[d(x.Subscribe,{selector:e=>({disabled:e.isSubmitting}),children:({disabled:e})=>d(s,{disabled:e,onClick:()=>{x.reset(),S(!1)}})}),d(x.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:t})=>d(c,{isSubmitting:e,disabled:t,submitText:m,onClick:()=>x.handleSubmit()})})]})]})]})})};export{p as TanStackDialogForm};
|
|
2
|
-
//# sourceMappingURL=dialog-form-BRSZpRTC.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./ui/dialog.cjs"),t=require("./tanstack-form-C0ab8EEl.cjs"),n=require("./ui/separator.cjs"),r=require("./submit-button-CvINfld5.cjs");let i=require("react"),a=require("@customafk/react-toolkit/utils"),o=require("react/jsx-runtime");const s=({title:s,submitText:c,width:l,maxWidth:u,className:d,open:f,onOpenChange:p,children:m})=>{let h=t.K(),g=(0,i.useCallback)(e=>{e||h.reset(),p?.(e)},[h.reset,p]);return(0,o.jsx)(e.Dialog,{open:f,onOpenChange:g,children:(0,o.jsxs)(e.DialogPortal,{"data-slot":`dialog-portal`,children:[(0,o.jsx)(e.DialogOverlay,{}),(0,o.jsxs)(e.DialogContent,{style:{"--width":l,"--max-width":u},className:(0,a.cn)(`flex size-full max-h-dvh max-w-dvw flex-col gap-0 overflow-y-auto rounded-none p-0 shadow-dialog sm:h-auto sm:max-h-[85dvh] sm:max-w-5xl sm:rounded-md`,l&&`sm:w-(--width)`,u&&`sm:max-w-(--max-width)`,d),onOpenAutoFocus:e=>{e.preventDefault()},onInteractOutside:e=>{e.preventDefault()},children:[(0,o.jsx)(`div`,{"data-slot":`dialog-header`,className:`flex items-center justify-center gap-2 px-6 py-5 text-center sm:text-left`,children:(0,o.jsx)(e.DialogTitle,{"data-slot":`dialog-title`,className:`font-semibold text-lg tracking-tight`,children:s})}),(0,o.jsx)(n.Separator,{}),(0,o.jsx)(`div`,{"data-slot":`dialog-content`,className:`relative flex flex-col overflow-y-auto p-0 pt-4 max-sm:flex-1 sm:p-4`,children:m}),(0,o.jsx)(n.Separator,{}),(0,o.jsxs)(`div`,{"data-slot":`dialog-footer`,className:`flex flex-col-reverse items-center justify-end gap-2 px-6 py-4 sm:flex-row max-sm:[&>button]:w-full`,children:[(0,o.jsx)(h.Subscribe,{selector:e=>({disabled:e.isSubmitting}),children:({disabled:e})=>(0,o.jsx)(r.n,{disabled:e,onClick:()=>{h.reset(),g(!1)}})}),(0,o.jsx)(h.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:t})=>(0,o.jsx)(r.t,{isSubmitting:e,disabled:t,submitText:c,onClick:()=>h.handleSubmit()})})]})]})]})})};exports.TanStackDialogForm=s;
|
|
2
|
-
//# sourceMappingURL=dialog-form-C1qpltYx.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Input as e}from"./ui/input.mjs";import{G as t}from"./tanstack-form-fkaBh9RO.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}=t(),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(e,{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-C2Lvl_rQ.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./ui/input.cjs"),t=require("./tanstack-form-C0ab8EEl.cjs"),n=require("./field-BSLi-P0Q.cjs");let r=require("lucide-react"),i=require("react"),a=require("@customafk/react-toolkit/utils"),o=require("react/jsx-runtime"),s=require("@tanstack/react-form");const c=({label:c,description:l,placeholder:u,tooltip:d,helperText:f,orientation:p=`responsive`,showErrorMessage:m=!0,required:h=!1,maxLength:g})=>{let{form:_,name:v,state:y,handleBlur:b,handleChange:x}=t.G(),S=(0,s.useStore)(_.store,({isSubmitting:e})=>e),C=y.meta.isDirty&&y.meta.isTouched&&!y.meta.isValid,w=h&&y.value===null,T=!S&&!!y.value,E=(0,i.useCallback)(({target:{value:e}})=>{S||g&&e.length>g||x(e||null)},[S,g,x]),D=(0,i.useCallback)(()=>{S||x(null)},[S,x]);return(0,o.jsxs)(n.FieldGroup,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(n.Field,{"data-invalid":C,orientation:p,children:[(0,o.jsxs)(n.FieldContent,{children:[(0,o.jsxs)(n.FieldLabel,{htmlFor:v,"aria-required":w,children:[c,d&&(0,o.jsx)(n.FieldTooltip,{tooltip:d})]}),(0,o.jsx)(n.FieldDescription,{children:l})]}),(0,o.jsxs)(n.FieldContentMain,{children:[(0,o.jsx)(e.Input,{id:v,name:v,value:y.value===null?``:y.value,"aria-invalid":C,autoComplete:`email`,placeholder:u,className:(0,a.cn)(`pl-9`,T&&`pr-9`,S&&`pointer-events-none bg-muted-muted opacity-60`),onBlur:b,onChange:E}),(0,o.jsx)(`div`,{className:`absolute top-0 left-0 flex size-9 items-center justify-center text-muted`,children:(0,o.jsx)(r.AtSignIcon,{size:14})}),T&&(0,o.jsx)(`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:D,children:(0,o.jsx)(r.XIcon,{size:14,"aria-hidden":`true`})}),(0,o.jsx)(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:m&&y.meta.isDirty&&(0,o.jsx)(n.FieldError,{errors:y.meta.errors})}),(0,o.jsx)(n.FieldNote,{isShow:!!f,children:f})]})]}),(0,o.jsx)(n.FieldSeparator,{})]})};exports.EmailField=c;
|
|
2
|
-
//# sourceMappingURL=email-field-D3nSkHj2.cjs.map
|
package/dist/field-BSLi-P0Q.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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 FieldTitle,\n FieldTooltip,\n};\n"],"mappings":"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"}
|
package/dist/field-V2DoD8qL.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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":"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"}
|
|
@@ -1,2 +0,0 @@
|
|
|
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,2 +0,0 @@
|
|
|
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,2 +0,0 @@
|
|
|
1
|
-
import{G as e}from"./tanstack-form-fkaBh9RO.mjs";import{Field as t,FieldContent as n,FieldContentMain as r,FieldDescription as i,FieldError as a,FieldGroup as o,FieldLabel as s,FieldNote as c,FieldSeparator as l,FieldTooltip as u}from"./field-V2DoD8qL.mjs";import{t as d}from"./number-input-CJcEV9Cg.mjs";import{BanIcon as f,Loader2Icon as p}from"lucide-react";import{memo as m,useCallback as h,useId as g}from"react";import{cn as _}from"@customafk/react-toolkit/utils";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{useStore as b}from"@tanstack/react-form";const x=m(({label:m,description:x,placeholder:S,tooltip:C,helperText:w,orientation:T=`responsive`,showErrorMessage:E=!0,rounding:D,decimalPlaces:O,precision:k,unit:A,required:j=!1,disabled:M=!1,allowNegative:N})=>{let P=g(),F=g(),I=e(),L=b(I.form.store,({isSubmitting:e})=>e),R=M||L,z=I.state.meta.isDirty||I.state.meta.isTouched,B=z&&!I.state.meta.isValid,V=j&&I.state.value===null,H=!!I.state.meta.errors.length,U=h(e=>{R||I.handleChange(e)},[R,I.handleChange]);return y(o,{className:`gap-y-4 px-4`,children:[y(t,{orientation:T,"data-invalid":B,children:[y(n,{children:[y(s,{htmlFor:P,"aria-required":V,children:[m,C&&v(u,{tooltip:C})]}),v(i,{children:x})]}),y(r,{children:[y(`div`,{className:`relative w-full`,children:[v(d,{id:P,value:I.state.value,"aria-invalid":B,"aria-describedby":F,placeholder:S,disabled:R,roundingRule:D,numberAfterDecimalPoint:O,precision:k,unitText:A,allowNegative:N,className:_(R&&`pointer-events-none opacity-60`),onBlur:I.handleBlur,onValueChange:U}),L&&v(`div`,{className:`pointer-events-none absolute inset-s-2 inset-y-0 top-2.5 [&>svg]:size-3.5`,children:v(p,{className:`animate-spin text-primary-strong`})}),!L&&z&&E&&H&&v(`div`,{className:`pointer-events-none absolute inset-s-2 inset-y-0 top-2.75 text-danger-strong [&>svg]:size-3.5`,children:v(f,{})}),v(`div`,{className:`mt-1 flex w-full items-start justify-between gap-x-2`,children:z&&E?v(a,{id:F,className:`flex-1`,errors:I.state.meta.errors}):v(`div`,{})})]}),v(c,{isShow:!!w,children:w})]})]}),v(l,{})]})});x.displayName=`NumberField`;export{x as NumberField};
|
|
2
|
-
//# sourceMappingURL=number-field-CR5PLX6H.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./tanstack-form-C0ab8EEl.cjs"),t=require("./field-BSLi-P0Q.cjs"),n=require("./number-input-CAr3JaA-.cjs");let r=require("lucide-react"),i=require("react"),a=require("@customafk/react-toolkit/utils"),o=require("react/jsx-runtime"),s=require("@tanstack/react-form");const c=(0,i.memo)(({label:c,description:l,placeholder:u,tooltip:d,helperText:f,orientation:p=`responsive`,showErrorMessage:m=!0,rounding:h,decimalPlaces:g,precision:_,unit:v,required:y=!1,disabled:b=!1,allowNegative:x})=>{let S=(0,i.useId)(),C=(0,i.useId)(),w=e.G(),T=(0,s.useStore)(w.form.store,({isSubmitting:e})=>e),E=b||T,D=w.state.meta.isDirty||w.state.meta.isTouched,O=D&&!w.state.meta.isValid,k=y&&w.state.value===null,A=!!w.state.meta.errors.length,j=(0,i.useCallback)(e=>{E||w.handleChange(e)},[E,w.handleChange]);return(0,o.jsxs)(t.FieldGroup,{className:`gap-y-4 px-4`,children:[(0,o.jsxs)(t.Field,{orientation:p,"data-invalid":O,children:[(0,o.jsxs)(t.FieldContent,{children:[(0,o.jsxs)(t.FieldLabel,{htmlFor:S,"aria-required":k,children:[c,d&&(0,o.jsx)(t.FieldTooltip,{tooltip:d})]}),(0,o.jsx)(t.FieldDescription,{children:l})]}),(0,o.jsxs)(t.FieldContentMain,{children:[(0,o.jsxs)(`div`,{className:`relative w-full`,children:[(0,o.jsx)(n.t,{id:S,value:w.state.value,"aria-invalid":O,"aria-describedby":C,placeholder:u,disabled:E,roundingRule:h,numberAfterDecimalPoint:g,precision:_,unitText:v,allowNegative:x,className:(0,a.cn)(E&&`pointer-events-none opacity-60`),onBlur:w.handleBlur,onValueChange:j}),T&&(0,o.jsx)(`div`,{className:`pointer-events-none absolute inset-s-2 inset-y-0 top-2.5 [&>svg]:size-3.5`,children:(0,o.jsx)(r.Loader2Icon,{className:`animate-spin text-primary-strong`})}),!T&&D&&m&&A&&(0,o.jsx)(`div`,{className:`pointer-events-none absolute inset-s-2 inset-y-0 top-2.75 text-danger-strong [&>svg]:size-3.5`,children:(0,o.jsx)(r.BanIcon,{})}),(0,o.jsx)(`div`,{className:`mt-1 flex w-full items-start justify-between gap-x-2`,children:D&&m?(0,o.jsx)(t.FieldError,{id:C,className:`flex-1`,errors:w.state.meta.errors}):(0,o.jsx)(`div`,{})})]}),(0,o.jsx)(t.FieldNote,{isShow:!!f,children:f})]})]}),(0,o.jsx)(t.FieldSeparator,{})]})});c.displayName=`NumberField`,exports.NumberField=c;
|
|
2
|
-
//# sourceMappingURL=number-field-CWDYA3La.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Input as e}from"./ui/input.mjs";import{G as t}from"./tanstack-form-fkaBh9RO.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{EyeIcon as f,EyeOffIcon as p}from"lucide-react";import{useCallback as m,useId as h,useState as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{useStore as y}from"@tanstack/react-form";const b=({label:b,description:x,placeholder:S,orientation:C=`responsive`,tooltip:w,helperText:T,showErrorMessage:E=!0})=>{let D=h(),{form:O,name:k,state:A,handleBlur:j,handleChange:M}=t(),N=y(O.store,({isSubmitting:e})=>e),[P,F]=g(!1),I=A.meta.isDirty&&A.meta.isTouched&&!A.meta.isValid,L=m(()=>F(e=>!e),[]),R=m(({target:{value:e}})=>{N||M(e||null)},[N,M]);return v(s,{className:`gap-y-4 px-4`,children:[v(n,{"data-invalid":I,orientation:C,children:[v(r,{children:[v(c,{htmlFor:D,children:[b,w&&_(d,{tooltip:w})]}),_(a,{children:x})]}),v(i,{children:[_(e,{id:D,name:k,type:P?`text`:`password`,placeholder:S,value:A.value??``,"aria-invalid":I,autoComplete:`new-password`,onBlur:j,onChange:R}),_(`button`,{className:`absolute inset-e-0 inset-y-0 flex size-9 items-center justify-center rounded-e-md text-muted outline-none transition-[color,box-shadow] focus:z-10 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,type:`button`,onClick:L,"aria-label":P?`Ẩn mật khẩu`:`Hiện mật khẩu`,"aria-pressed":P,"aria-controls":D,children:_(P?p:f,{size:16,"aria-hidden":`true`})}),_(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:E&&A.meta.isDirty&&_(o,{errors:A.meta.errors})}),_(l,{isShow:!!T,children:T})]})]}),_(u,{})]})};export{b as PasswordField};
|
|
2
|
-
//# sourceMappingURL=password-field-B2_kzss6.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./ui/input.cjs"),t=require("./tanstack-form-C0ab8EEl.cjs"),n=require("./field-BSLi-P0Q.cjs");let r=require("lucide-react"),i=require("react"),a=require("react/jsx-runtime"),o=require("@tanstack/react-form");const s=({label:s,description:c,placeholder:l,orientation:u=`responsive`,tooltip:d,helperText:f,showErrorMessage:p=!0})=>{let m=(0,i.useId)(),{form:h,name:g,state:_,handleBlur:v,handleChange:y}=t.G(),b=(0,o.useStore)(h.store,({isSubmitting:e})=>e),[x,S]=(0,i.useState)(!1),C=_.meta.isDirty&&_.meta.isTouched&&!_.meta.isValid,w=(0,i.useCallback)(()=>S(e=>!e),[]),T=(0,i.useCallback)(({target:{value:e}})=>{b||y(e||null)},[b,y]);return(0,a.jsxs)(n.FieldGroup,{className:`gap-y-4 px-4`,children:[(0,a.jsxs)(n.Field,{"data-invalid":C,orientation:u,children:[(0,a.jsxs)(n.FieldContent,{children:[(0,a.jsxs)(n.FieldLabel,{htmlFor:m,children:[s,d&&(0,a.jsx)(n.FieldTooltip,{tooltip:d})]}),(0,a.jsx)(n.FieldDescription,{children:c})]}),(0,a.jsxs)(n.FieldContentMain,{children:[(0,a.jsx)(e.Input,{id:m,name:g,type:x?`text`:`password`,placeholder:l,value:_.value??``,"aria-invalid":C,autoComplete:`new-password`,onBlur:v,onChange:T}),(0,a.jsx)(`button`,{className:`absolute inset-e-0 inset-y-0 flex size-9 items-center justify-center rounded-e-md text-muted outline-none transition-[color,box-shadow] focus:z-10 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,type:`button`,onClick:w,"aria-label":x?`Ẩn mật khẩu`:`Hiện mật khẩu`,"aria-pressed":x,"aria-controls":m,children:x?(0,a.jsx)(r.EyeOffIcon,{size:16,"aria-hidden":`true`}):(0,a.jsx)(r.EyeIcon,{size:16,"aria-hidden":`true`})}),(0,a.jsx)(`div`,{className:`mt-1 flex w-full items-start justify-start`,children:p&&_.meta.isDirty&&(0,a.jsx)(n.FieldError,{errors:_.meta.errors})}),(0,a.jsx)(n.FieldNote,{isShow:!!f,children:f})]})]}),(0,a.jsx)(n.FieldSeparator,{})]})};exports.PasswordField=s;
|
|
2
|
-
//# sourceMappingURL=password-field-BHRhVyZ0.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./close-DYJZ8fkh.mjs";import{K as t}from"./tanstack-form-fkaBh9RO.mjs";import{n,t as r}from"./submit-button-CGBaPzE9.mjs";import{cn as i}from"@customafk/react-toolkit/utils";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{Dialog as s}from"radix-ui";const c=({title:c,open:l,contentClassName:u,onOpenChange:d,children:f})=>{let p=t();return a(s.Root,{"data-slot":`dialog`,open:l,onOpenChange:d,children:o(s.Portal,{"data-slot":`dialog-portal`,children:[a(s.Overlay,{"data-slot":`dialog-overlay`,className:i(`fixed inset-0 z-40 bg-black/40 backdrop-blur-sm`,`data-[state=open]:animate-in data-[state=open]:fade-in`,`data-[state=closed]:animate-out data-[state=closed]:fade-out`)}),a(s.Content,{"data-slot":`dialog-content`,className:i(`fixed top-4 right-4 z-50 h-[calc(100dvh-2rem)] min-w-sm max-w-xl rounded-md bg-background shadow-lg ring-1 ring-border`,`duration-300`,`data-[state=open]:animate-in data-[state=open]:slide-in-from-right data-[state=open]:fade-in`,`data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right data-[state=closed]:fade-out`),children:o(`section`,{className:`relative flex size-full flex-col`,children:[a(`header`,{className:`flex h-14 shrink-0 items-center border-b border-border px-5`,children:a(`h2`,{className:`font-semibold text-base tracking-tight text-text-positive`,children:c})}),a(`div`,{className:i(`flex flex-1 flex-col overflow-y-auto py-4`,u),children:f}),o(`div`,{className:`flex shrink-0 flex-col gap-2 border-t border-border px-4 py-3`,children:[a(p.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:t})=>a(r,{isSubmitting:e,disabled:t,className:`w-full`,onClick:()=>p.handleSubmit()})}),a(p.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:e})=>a(n,{disabled:e,className:`w-full`,onClick:()=>{p.reset(),d?.(!1)}})})]}),a(s.Close,{asChild:!0,children:a(e,{className:`absolute top-2.5 right-3`})})]})})]})})};export{c as TanStackPopoverForm};
|
|
2
|
-
//# sourceMappingURL=popover-form-CeRVpy1B.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./close-BYHgEZvZ.cjs"),t=require("./tanstack-form-C0ab8EEl.cjs"),n=require("./submit-button-CvINfld5.cjs");let r=require("@customafk/react-toolkit/utils"),i=require("react/jsx-runtime"),a=require("radix-ui");const o=({title:o,open:s,contentClassName:c,onOpenChange:l,children:u})=>{let d=t.K();return(0,i.jsx)(a.Dialog.Root,{"data-slot":`dialog`,open:s,onOpenChange:l,children:(0,i.jsxs)(a.Dialog.Portal,{"data-slot":`dialog-portal`,children:[(0,i.jsx)(a.Dialog.Overlay,{"data-slot":`dialog-overlay`,className:(0,r.cn)(`fixed inset-0 z-40 bg-black/40 backdrop-blur-sm`,`data-[state=open]:animate-in data-[state=open]:fade-in`,`data-[state=closed]:animate-out data-[state=closed]:fade-out`)}),(0,i.jsx)(a.Dialog.Content,{"data-slot":`dialog-content`,className:(0,r.cn)(`fixed top-4 right-4 z-50 h-[calc(100dvh-2rem)] min-w-sm max-w-xl rounded-md bg-background shadow-lg ring-1 ring-border`,`duration-300`,`data-[state=open]:animate-in data-[state=open]:slide-in-from-right data-[state=open]:fade-in`,`data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right data-[state=closed]:fade-out`),children:(0,i.jsxs)(`section`,{className:`relative flex size-full flex-col`,children:[(0,i.jsx)(`header`,{className:`flex h-14 shrink-0 items-center border-b border-border px-5`,children:(0,i.jsx)(`h2`,{className:`font-semibold text-base tracking-tight text-text-positive`,children:o})}),(0,i.jsx)(`div`,{className:(0,r.cn)(`flex flex-1 flex-col overflow-y-auto py-4`,c),children:u}),(0,i.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-t border-border px-4 py-3`,children:[(0,i.jsx)(d.Subscribe,{selector:e=>({isSubmitting:e.isSubmitting,disabled:e.isPristine||!e.isValid||e.isValidating||e.isSubmitting||!e.canSubmit}),children:({isSubmitting:e,disabled:t})=>(0,i.jsx)(n.t,{isSubmitting:e,disabled:t,className:`w-full`,onClick:()=>d.handleSubmit()})}),(0,i.jsx)(d.Subscribe,{selector:e=>({disabled:e.isPristine||e.isSubmitting}),children:({disabled:e})=>(0,i.jsx)(n.n,{disabled:e,className:`w-full`,onClick:()=>{d.reset(),l?.(!1)}})})]}),(0,i.jsx)(a.Dialog.Close,{asChild:!0,children:(0,i.jsx)(e.t,{className:`absolute top-2.5 right-3`})})]})})]})})};exports.TanStackPopoverForm=o;
|
|
2
|
-
//# sourceMappingURL=popover-form-Ch_iMMSm.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./tanstack-form-C0ab8EEl.cjs"),t=require("./ui/radio-group.cjs"),n=require("./field-BSLi-P0Q.cjs");let r=require("@customafk/react-toolkit/utils"),i=require("react/jsx-runtime"),a=require("@tanstack/react-form");const o=({label:o,description:s,orientation:c,options:l,tooltip:u,helperText:d})=>{let f=e.G(),p=(0,a.useStore)(f.form.store,({isSubmitting:e})=>e);return(0,i.jsxs)(n.FieldGroup,{className:`px-4`,children:[(0,i.jsxs)(n.Field,{orientation:c,className:`flex-col gap-2`,children:[(0,i.jsxs)(n.FieldContent,{children:[(0,i.jsxs)(n.FieldLabel,{children:[o,u&&(0,i.jsx)(n.FieldTooltip,{tooltip:u})]}),(0,i.jsx)(n.FieldDescription,{children:s}),(0,i.jsx)(n.FieldNote,{isShow:!!d,children:d})]}),(0,i.jsx)(n.FieldContentMain,{children:(0,i.jsx)(t.RadioGroup,{value:f.state.value??``,className:`w-full`,onValueChange:f.handleChange,children:l.map(e=>(0,i.jsx)(n.FieldLabel,{className:(0,r.cn)(`h-fit`,f.state.value===e.value&&`border-primary-weak! bg-primary-bg-subtle`,p&&`pointer-events-none bg-muted-muted opacity-60`,f.state.value===e.value&&p&&`border-border-strong!`),children:(0,i.jsxs)(n.Field,{orientation:`horizontal`,className:`items-start gap-3 rounded p-2!`,children:[(0,i.jsx)(t.RadioGroupItem,{value:e.value,className:`mt-0.5 shrink-0`}),(0,i.jsxs)(n.FieldContent,{className:`gap-0.5!`,children:[(0,i.jsx)(n.FieldTitle,{children:e.label}),(0,i.jsx)(n.FieldDescription,{className:`text-xs`,children:e.description})]})]})},e.value))})})]}),(0,i.jsx)(n.FieldSeparator,{})]})};exports.RadioGroupField=o;
|
|
2
|
-
//# sourceMappingURL=radio-group-field-BFhBfzoT.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{G as e}from"./tanstack-form-fkaBh9RO.mjs";import{RadioGroup as t,RadioGroupItem as n}from"./ui/radio-group.mjs";import{Field as r,FieldContent as i,FieldContentMain as a,FieldDescription as o,FieldGroup as s,FieldLabel as c,FieldNote as l,FieldSeparator as u,FieldTitle as d,FieldTooltip as f}from"./field-V2DoD8qL.mjs";import{cn as p}from"@customafk/react-toolkit/utils";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{useStore as g}from"@tanstack/react-form";const _=({label:_,description:v,orientation:y,options:b,tooltip:x,helperText:S})=>{let C=e(),w=g(C.form.store,({isSubmitting:e})=>e);return h(s,{className:`px-4`,children:[h(r,{orientation:y,className:`flex-col gap-2`,children:[h(i,{children:[h(c,{children:[_,x&&m(f,{tooltip:x})]}),m(o,{children:v}),m(l,{isShow:!!S,children:S})]}),m(a,{children:m(t,{value:C.state.value??``,className:`w-full`,onValueChange:C.handleChange,children:b.map(e=>m(c,{className:p(`h-fit`,C.state.value===e.value&&`border-primary-weak! bg-primary-bg-subtle`,w&&`pointer-events-none bg-muted-muted opacity-60`,C.state.value===e.value&&w&&`border-border-strong!`),children:h(r,{orientation:`horizontal`,className:`items-start gap-3 rounded p-2!`,children:[m(n,{value:e.value,className:`mt-0.5 shrink-0`}),h(i,{className:`gap-0.5!`,children:[m(d,{children:e.label}),m(o,{className:`text-xs`,children:e.description})]})]})},e.value))})})]}),m(u,{})]})};export{_ as RadioGroupField};
|
|
2
|
-
//# sourceMappingURL=radio-group-field-Iwo2Q2Ig.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./ui/dialog.cjs"),t=require("./tanstack-form-C0ab8EEl.cjs"),n=require("./ui/select.cjs"),r=require("./field-BSLi-P0Q.cjs");let i=require("lucide-react"),a=require("react"),o=require("@customafk/react-toolkit/utils"),s=require("react/jsx-runtime"),c=require("radix-ui"),l=require("@tanstack/react-form"),u=require("@customafk/react-toolkit/hooks/useMobile");const d=(0,a.memo)(({label:d,description:f,placeholder:p,orientation:m=`responsive`,tooltip:h,options:g,helperText:_,clearable:v=!1,required:y=!1,disabled:b=!1,showErrorMessage:x=!0})=>{let S=(0,a.useId)(),C=t.G(),w=(0,u.useIsMobile)(),[T,E]=(0,a.useState)(!1),D=(0,l.useStore)(C.form.store,({isSubmitting:e})=>e),O=b||D,k=C.state.meta.isDirty||C.state.meta.isTouched,A=k&&!C.state.meta.isValid,j=y&&C.state.value===null,M=v&&!!C.state.value&&!O,N=g.find(e=>e.value===C.state.value)?.label,P=()=>{C.handleChange(null),C.handleBlur()};return(0,s.jsxs)(r.FieldGroup,{className:`gap-y-4 px-4`,children:[(0,s.jsxs)(r.Field,{orientation:m,"data-invalid":A,children:[(0,s.jsxs)(r.FieldContent,{children:[(0,s.jsxs)(r.FieldLabel,{htmlFor:C.name,"aria-required":j,children:[d,h&&(0,s.jsx)(r.FieldTooltip,{tooltip:h})]}),(0,s.jsx)(r.FieldDescription,{children:f})]}),(0,s.jsxs)(r.FieldContentMain,{className:`flex flex-col`,children:[w?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(`button`,{id:C.name,type:`button`,disabled:O,"aria-invalid":A?`true`:void 0,"aria-describedby":S,onBlur:C.handleBlur,onClick:()=>E(!0),className:(0,o.cn)(`flex w-full items-center justify-between`,`outline-1 outline-border -outline-offset-1`,`gap-2 rounded bg-transparent px-3 py-2`,`shadow-input transition-all cursor-pointer whitespace-nowrap text-sm`,`focus-visible:outline-primary-strong focus-visible:ring-4 focus-visible:ring-primary-weak`,`disabled:cursor-not-allowed disabled:opacity-50`,A&&`outline-danger bg-danger-bg-subtle ring-danger-weak`,!C.state.value&&`text-text-positive-muted`),children:[(0,s.jsx)(`span`,{className:`line-clamp-1`,children:N??p}),(0,s.jsx)(i.ChevronDownIcon,{size:16,className:`shrink-0 opacity-50`})]}),(0,s.jsx)(e.Dialog,{open:T,onOpenChange:e=>{E(e),e||C.handleBlur()},children:(0,s.jsxs)(e.DialogPortal,{children:[(0,s.jsx)(e.DialogOverlay,{}),(0,s.jsxs)(c.Dialog.Content,{onOpenAutoFocus:e=>e.preventDefault(),className:(0,o.cn)(`fixed inset-x-0 bottom-0 z-50`,`flex flex-col bg-background rounded-t-2xl outline-none`,`max-h-[80dvh] shadow-[0_-4px_24px_rgba(0,0,0,0.08)]`,`data-[state=open]:animate-in data-[state=open]:slide-in-from-bottom data-[state=open]:fade-in-0`,`data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom data-[state=closed]:fade-out-0`,`duration-300`),children:[(0,s.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-border shrink-0`,children:[(0,s.jsx)(`span`,{className:`font-semibold text-sm text-text-positive`,children:d??p??`Chọn một tùy chọn`}),(0,s.jsx)(e.DialogClose,{asChild:!0,children:(0,s.jsx)(`button`,{type:`button`,"aria-label":`Đóng`,className:`flex size-7 items-center justify-center rounded-md text-text-positive-weak transition-colors hover:bg-muted-muted hover:text-text-positive`,children:(0,s.jsx)(i.XIcon,{size:16})})})]}),(0,s.jsxs)(`div`,{className:`flex flex-col overflow-y-auto`,children:[M&&(0,s.jsx)(e.DialogClose,{asChild:!0,children:(0,s.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-x-2 px-4 py-3 text-left text-sm text-danger-strong transition-colors hover:bg-danger-bg-subtle`,onClick:P,children:[(0,s.jsx)(i.XIcon,{size:14}),`Xóa lựa chọn`]})}),g.length>0?g.map(t=>(0,s.jsx)(e.DialogClose,{asChild:!0,children:(0,s.jsx)(`button`,{type:`button`,className:(0,o.cn)(`flex w-full items-center px-4 py-3 text-left text-sm transition-colors`,`hover:bg-muted-muted active:bg-muted-muted`,C.state.value===t.value&&`bg-primary-bg-subtle font-medium text-primary`),onClick:()=>{C.handleChange(t.value),C.handleBlur()},children:t.label})},t.value)):(0,s.jsxs)(`div`,{className:`flex items-center justify-center gap-x-2 px-4 py-8 text-center text-sm text-text-positive-weak`,children:[(0,s.jsx)(i.PackagePlusIcon,{strokeWidth:1}),`Không có tùy chọn`]})]}),(0,s.jsx)(`div`,{className:`shrink-0 h-safe-bottom`})]})]})})]}):(0,s.jsxs)(`div`,{className:`relative`,children:[(0,s.jsxs)(n.Select,{value:C.state.value??``,disabled:O,onValueChange:C.handleChange,children:[(0,s.jsx)(n.SelectTrigger,{"aria-invalid":A?`true`:void 0,"aria-describedby":S,onBlur:C.handleBlur,children:(0,s.jsx)(n.SelectValue,{placeholder:p})}),(0,s.jsx)(n.SelectContent,{children:g.length>0?g.map(e=>(0,s.jsx)(n.SelectItem,{value:e.value,children:e.label},e.value)):(0,s.jsxs)(`div`,{className:`flex items-center justify-center gap-x-2 rounded border border-border bg-muted-muted px-4 py-6.5 text-center text-sm text-text-positive-weak`,children:[(0,s.jsx)(i.PackagePlusIcon,{strokeWidth:1}),`No options available`]})})]}),M&&(0,s.jsx)(`button`,{type:`button`,"aria-label":`Xóa lựa chọn`,className:`absolute right-7 top-1/2 -translate-y-1/2 flex size-4 cursor-pointer items-center justify-center rounded-md text-text-positive-weak outline-none transition-[color,transform] hover:text-text-positive focus-visible:text-primary-strong focus-visible:[&>svg]:scale-125 [&>svg]:size-3.5 [&>svg]:transition-transform`,onClick:P,children:(0,s.jsx)(i.XIcon,{"aria-hidden":`true`})})]}),k&&x&&(0,s.jsx)(r.FieldError,{id:S,className:`mt-1`,errors:C.state.meta.errors}),(0,s.jsx)(r.FieldNote,{isShow:!!_,children:_})]})]}),(0,s.jsx)(r.FieldSeparator,{})]})});d.displayName=`SelectField`,exports.SelectField=d;
|
|
2
|
-
//# sourceMappingURL=select-field-CvDBZQTl.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Dialog as e,DialogClose as t,DialogOverlay as n,DialogPortal as r}from"./ui/dialog.mjs";import{G as i}from"./tanstack-form-fkaBh9RO.mjs";import{Select as a,SelectContent as o,SelectItem as ee,SelectTrigger as s,SelectValue as c}from"./ui/select.mjs";import{Field as l,FieldContent as u,FieldContentMain as d,FieldDescription as f,FieldError as te,FieldGroup as p,FieldLabel as m,FieldNote as h,FieldSeparator as g,FieldTooltip as _}from"./field-V2DoD8qL.mjs";import{ChevronDownIcon as v,PackagePlusIcon as y,XIcon as b}from"lucide-react";import{memo as x,useId as S,useState as C}from"react";import{cn as w}from"@customafk/react-toolkit/utils";import{Fragment as T,jsx as E,jsxs as D}from"react/jsx-runtime";import{Dialog as O}from"radix-ui";import{useStore as k}from"@tanstack/react-form";import{useIsMobile as A}from"@customafk/react-toolkit/hooks/useMobile";const j=x(({label:x,description:j,placeholder:M,orientation:N=`responsive`,tooltip:P,options:F,helperText:I,clearable:L=!1,required:R=!1,disabled:z=!1,showErrorMessage:B=!0})=>{let V=S(),H=i(),U=A(),[W,G]=C(!1),K=k(H.form.store,({isSubmitting:e})=>e),q=z||K,J=H.state.meta.isDirty||H.state.meta.isTouched,Y=J&&!H.state.meta.isValid,X=R&&H.state.value===null,Z=L&&!!H.state.value&&!q,Q=F.find(e=>e.value===H.state.value)?.label,$=()=>{H.handleChange(null),H.handleBlur()};return D(p,{className:`gap-y-4 px-4`,children:[D(l,{orientation:N,"data-invalid":Y,children:[D(u,{children:[D(m,{htmlFor:H.name,"aria-required":X,children:[x,P&&E(_,{tooltip:P})]}),E(f,{children:j})]}),D(d,{className:`flex flex-col`,children:[U?D(T,{children:[D(`button`,{id:H.name,type:`button`,disabled:q,"aria-invalid":Y?`true`:void 0,"aria-describedby":V,onBlur:H.handleBlur,onClick:()=>G(!0),className:w(`flex w-full items-center justify-between`,`outline-1 outline-border -outline-offset-1`,`gap-2 rounded bg-transparent px-3 py-2`,`shadow-input transition-all cursor-pointer whitespace-nowrap text-sm`,`focus-visible:outline-primary-strong focus-visible:ring-4 focus-visible:ring-primary-weak`,`disabled:cursor-not-allowed disabled:opacity-50`,Y&&`outline-danger bg-danger-bg-subtle ring-danger-weak`,!H.state.value&&`text-text-positive-muted`),children:[E(`span`,{className:`line-clamp-1`,children:Q??M}),E(v,{size:16,className:`shrink-0 opacity-50`})]}),E(e,{open:W,onOpenChange:e=>{G(e),e||H.handleBlur()},children:D(r,{children:[E(n,{}),D(O.Content,{onOpenAutoFocus:e=>e.preventDefault(),className:w(`fixed inset-x-0 bottom-0 z-50`,`flex flex-col bg-background rounded-t-2xl outline-none`,`max-h-[80dvh] shadow-[0_-4px_24px_rgba(0,0,0,0.08)]`,`data-[state=open]:animate-in data-[state=open]:slide-in-from-bottom data-[state=open]:fade-in-0`,`data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom data-[state=closed]:fade-out-0`,`duration-300`),children:[D(`div`,{className:`flex items-center justify-between px-4 py-3 border-b border-border shrink-0`,children:[E(`span`,{className:`font-semibold text-sm text-text-positive`,children:x??M??`Chọn một tùy chọn`}),E(t,{asChild:!0,children:E(`button`,{type:`button`,"aria-label":`Đóng`,className:`flex size-7 items-center justify-center rounded-md text-text-positive-weak transition-colors hover:bg-muted-muted hover:text-text-positive`,children:E(b,{size:16})})})]}),D(`div`,{className:`flex flex-col overflow-y-auto`,children:[Z&&E(t,{asChild:!0,children:D(`button`,{type:`button`,className:`flex w-full items-center gap-x-2 px-4 py-3 text-left text-sm text-danger-strong transition-colors hover:bg-danger-bg-subtle`,onClick:$,children:[E(b,{size:14}),`Xóa lựa chọn`]})}),F.length>0?F.map(e=>E(t,{asChild:!0,children:E(`button`,{type:`button`,className:w(`flex w-full items-center px-4 py-3 text-left text-sm transition-colors`,`hover:bg-muted-muted active:bg-muted-muted`,H.state.value===e.value&&`bg-primary-bg-subtle font-medium text-primary`),onClick:()=>{H.handleChange(e.value),H.handleBlur()},children:e.label})},e.value)):D(`div`,{className:`flex items-center justify-center gap-x-2 px-4 py-8 text-center text-sm text-text-positive-weak`,children:[E(y,{strokeWidth:1}),`Không có tùy chọn`]})]}),E(`div`,{className:`shrink-0 h-safe-bottom`})]})]})})]}):D(`div`,{className:`relative`,children:[D(a,{value:H.state.value??``,disabled:q,onValueChange:H.handleChange,children:[E(s,{"aria-invalid":Y?`true`:void 0,"aria-describedby":V,onBlur:H.handleBlur,children:E(c,{placeholder:M})}),E(o,{children:F.length>0?F.map(e=>E(ee,{value:e.value,children:e.label},e.value)):D(`div`,{className:`flex items-center justify-center gap-x-2 rounded border border-border bg-muted-muted px-4 py-6.5 text-center text-sm text-text-positive-weak`,children:[E(y,{strokeWidth:1}),`No options available`]})})]}),Z&&E(`button`,{type:`button`,"aria-label":`Xóa lựa chọn`,className:`absolute right-7 top-1/2 -translate-y-1/2 flex size-4 cursor-pointer items-center justify-center rounded-md text-text-positive-weak outline-none transition-[color,transform] hover:text-text-positive focus-visible:text-primary-strong focus-visible:[&>svg]:scale-125 [&>svg]:size-3.5 [&>svg]:transition-transform`,onClick:$,children:E(b,{"aria-hidden":`true`})})]}),J&&B&&E(te,{id:V,className:`mt-1`,errors:H.state.meta.errors}),E(h,{isShow:!!I,children:I})]})]}),E(g,{})]})});j.displayName=`SelectField`;export{j as SelectField};
|
|
2
|
-
//# sourceMappingURL=select-field-NJgDDCO2.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Button as e}from"./ui/button.mjs";import{G as t}from"./tanstack-form-fkaBh9RO.mjs";import{PlusIcon as n,Trash2Icon as r}from"lucide-react";import{useCallback as i}from"react";import{cn as a}from"@customafk/react-toolkit/utils";import{jsx as o,jsxs as s}from"react/jsx-runtime";function c({width:e,className:t,children:n}){return o(`div`,{"data-slot":`array-col`,style:e?{width:typeof e==`number`?`${e}px`:e,flexShrink:0}:{flex:1,minWidth:0},className:t,children:n})}function l({className:e,children:t}){return s(`div`,{"data-slot":`array-header-row`,className:a(`mb-1 flex items-center gap-2 px-1 text-xs font-medium text-text-positive-weak`,e),children:[t,o(`div`,{className:`min-w-8 w-8 shrink-0`})]})}function u({defaultRow:c,children:l,addLabel:u=`Thêm hàng`,className:d}){let f=t(),p=f.state.value??[],m=i(()=>{f.pushValue({...c})},[f,c]),h=i(e=>{f.removeValue(e)},[f]);return s(`div`,{"data-slot":`simple-array-field`,className:a(`flex flex-col gap-2`,d),children:[p.map((t,n)=>s(`div`,{className:`flex items-start gap-2`,children:[l(n),o(e,{type:`button`,size:`icon`,variant:`ghost`,color:`danger`,className:`min-w-8`,onClick:()=>h(n),children:o(r,{size:14})})]},n)),o(`div`,{children:s(e,{type:`button`,variant:`outline`,color:`muted`,size:`xs`,onClick:m,children:[o(n,{size:13}),u]})})]})}export{c as ArrayCol,l as ArrayHeaderRow,u as SimpleArrayField};
|
|
2
|
-
//# sourceMappingURL=simple-array-field-BwNCeUnn.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./ui/button.cjs"),t=require("./tanstack-form-C0ab8EEl.cjs");let n=require("lucide-react"),r=require("react"),i=require("@customafk/react-toolkit/utils"),a=require("react/jsx-runtime");function o({width:e,className:t,children:n}){return(0,a.jsx)(`div`,{"data-slot":`array-col`,style:e?{width:typeof e==`number`?`${e}px`:e,flexShrink:0}:{flex:1,minWidth:0},className:t,children:n})}function s({className:e,children:t}){return(0,a.jsxs)(`div`,{"data-slot":`array-header-row`,className:(0,i.cn)(`mb-1 flex items-center gap-2 px-1 text-xs font-medium text-text-positive-weak`,e),children:[t,(0,a.jsx)(`div`,{className:`min-w-8 w-8 shrink-0`})]})}function c({defaultRow:o,children:s,addLabel:c=`Thêm hàng`,className:l}){let u=t.G(),d=u.state.value??[],f=(0,r.useCallback)(()=>{u.pushValue({...o})},[u,o]),p=(0,r.useCallback)(e=>{u.removeValue(e)},[u]);return(0,a.jsxs)(`div`,{"data-slot":`simple-array-field`,className:(0,i.cn)(`flex flex-col gap-2`,l),children:[d.map((t,r)=>(0,a.jsxs)(`div`,{className:`flex items-start gap-2`,children:[s(r),(0,a.jsx)(e.Button,{type:`button`,size:`icon`,variant:`ghost`,color:`danger`,className:`min-w-8`,onClick:()=>p(r),children:(0,a.jsx)(n.Trash2Icon,{size:14})})]},r)),(0,a.jsx)(`div`,{children:(0,a.jsxs)(e.Button,{type:`button`,variant:`outline`,color:`muted`,size:`xs`,onClick:f,children:[(0,a.jsx)(n.PlusIcon,{size:13}),c]})})]})}exports.ArrayCol=o,exports.ArrayHeaderRow=s,exports.SimpleArrayField=c;
|
|
2
|
-
//# sourceMappingURL=simple-array-field-aGXkDZXD.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./ui/checkbox.cjs"),t=require("./tanstack-form-C0ab8EEl.cjs"),n=require("./ui/label.cjs"),r=require("./ui/switch.cjs"),i=require("./field-BSLi-P0Q.cjs");let a=require("react"),o=require("react/jsx-runtime"),s=require("@tanstack/react-form");const c=({label:c,required:l,disabled:u,variant:d=`checkbox`})=>{let f=(0,a.useId)(),{form:p,name:m,state:h,handleBlur:g,handleChange:_}=t.G(),v=(0,s.useStore)(p.store,({isSubmitting:e})=>e),y=h.meta.isTouched&&!h.meta.isValid,b=h.value??!1,x=u||v,S=(0,a.useCallback)(e=>{v||_(e)},[v,_]);return(0,o.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2 h-9`,children:[d===`switch`?(0,o.jsx)(r.Switch,{id:f,name:m,checked:b,disabled:x,"aria-invalid":y,onBlur:g,onCheckedChange:S}):(0,o.jsx)(e.Checkbox,{id:f,name:m,checked:b,disabled:x,"aria-invalid":y,onBlur:g,onCheckedChange:S}),c&&(0,o.jsxs)(n.Label,{htmlFor:f,className:`cursor-pointer`,children:[c,l&&(0,o.jsx)(`span`,{className:`text-danger-strong`,children:`*`})]})]}),y&&(0,o.jsx)(i.FieldError,{errors:h.meta.errors})]})};exports.SimpleBooleanField=c;
|
|
2
|
-
//# sourceMappingURL=simple-boolean-field-BeVkn3c4.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Checkbox as e}from"./ui/checkbox.mjs";import{G as t}from"./tanstack-form-fkaBh9RO.mjs";import{Label as n}from"./ui/label.mjs";import{Switch as r}from"./ui/switch.mjs";import{FieldError as i}from"./field-V2DoD8qL.mjs";import{useCallback as a,useId as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{useStore as l}from"@tanstack/react-form";const u=({label:u,required:d,disabled:f,variant:p=`checkbox`})=>{let m=o(),{form:h,name:g,state:_,handleBlur:v,handleChange:y}=t(),b=l(h.store,({isSubmitting:e})=>e),x=_.meta.isTouched&&!_.meta.isValid,S=_.value??!1,C=f||b,w=a(e=>{b||y(e)},[b,y]);return c(`div`,{className:`flex flex-col gap-1.5`,children:[c(`div`,{className:`flex items-center gap-2 h-9`,children:[s(p===`switch`?r:e,{id:m,name:g,checked:S,disabled:C,"aria-invalid":x,onBlur:v,onCheckedChange:w}),u&&c(n,{htmlFor:m,className:`cursor-pointer`,children:[u,d&&s(`span`,{className:`text-danger-strong`,children:`*`})]})]}),x&&s(i,{errors:_.meta.errors})]})};export{u as SimpleBooleanField};
|
|
2
|
-
//# sourceMappingURL=simple-boolean-field-t_XDXqYs.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Button as e}from"./ui/button.mjs";import{Command as t,CommandEmpty as n,CommandGroup as r,CommandInput as i,CommandItem as a,CommandList as o}from"./ui/command.mjs";import{G as s}from"./tanstack-form-fkaBh9RO.mjs";import{Popover as c,PopoverContent as l,PopoverTrigger as u}from"./ui/popover.mjs";import{Label as d}from"./ui/label.mjs";import{Drawer as f,DrawerContent as p,DrawerHeader as m,DrawerTitle as h}from"./ui/drawer.mjs";import{FieldError as g}from"./field-V2DoD8qL.mjs";import{useId as _,useState as v}from"react";import{cn as y}from"@customafk/react-toolkit/utils";import{jsx as b,jsxs as x}from"react/jsx-runtime";import{useStore as S}from"@tanstack/react-form";import{useIsMobile as C}from"@customafk/react-toolkit/hooks/useMobile";const w=({label:w,placeholder:T,required:E,disabled:D,options:O})=>{let k=_(),{form:A,state:j,handleBlur:M,handleChange:N}=s(),P=S(A.store,({isSubmitting:e})=>e),F=C(),[I,L]=v(!1),R=j.meta.isTouched&&!j.meta.isValid,z=D||P,B=O.find(({value:e})=>e===j.value)?.label,V=x(t,{children:[b(i,{placeholder:T??`Tìm kiếm…`}),x(o,{children:[b(n,{children:`Không tìm thấy kết quả.`}),b(r,{children:O.map(e=>b(a,{value:e.label,onSelect:()=>{N(e.value===j.value?null:e.value),L(!1)},children:e.label},e.value))})]})]});return F?x(`div`,{className:`flex flex-col gap-1.5`,children:[w&&x(d,{htmlFor:k,children:[w,E&&b(`span`,{className:`text-danger-strong`,children:`*`})]}),b(e,{id:k,type:`button`,variant:`outline`,color:`muted`,disabled:z,"aria-invalid":R,className:y(`w-full justify-start font-normal outline-1 outline-border -outline-offset-1`,!j.value&&`text-text-positive-muted`,R&&`outline-danger bg-danger-bg-subtle`),onBlur:M,onClick:()=>L(!0),children:B??b(`span`,{className:`text-text-positive-muted`,children:T})}),b(f,{open:I,onOpenChange:L,direction:`bottom`,children:x(p,{children:[b(m,{children:b(h,{children:w??T??`Tìm kiếm…`})}),b(`div`,{className:`overflow-y-auto pb-safe-bottom`,children:V})]})}),R&&b(g,{errors:j.meta.errors})]}):x(`div`,{className:`flex flex-col gap-1.5`,children:[w&&x(d,{htmlFor:k,children:[w,E&&b(`span`,{className:`text-danger-strong`,children:`*`})]}),x(c,{children:[b(u,{asChild:!0,children:b(e,{id:k,variant:`outline`,color:`muted`,size:`lg`,disabled:z,"aria-invalid":R,className:y(`flex w-full items-center justify-start rounded outline-border font-normal`,`hover:bg-transparent`,`focus:outline-1 focus:outline-primary-strong focus:ring-4 focus:ring-primary-weak`,`data-[state=open]:outline-1 data-[state=open]:outline-primary-strong data-[state=open]:ring-4 data-[state=open]:ring-primary-weak`,!j.value&&`text-text-positive-muted`),children:B??b(`span`,{className:`text-text-positive-muted`,children:T})})}),b(l,{align:`start`,side:`bottom`,className:`w-[--radix-popover-trigger-width] p-0 rounded`,onBlur:M,children:V})]}),R&&b(g,{errors:j.meta.errors})]})};export{w as SimpleComboboxField};
|
|
2
|
-
//# sourceMappingURL=simple-combobox-field-HCB4A33-.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./ui/button.cjs"),t=require("./ui/command.cjs"),n=require("./tanstack-form-C0ab8EEl.cjs"),r=require("./ui/popover.cjs"),i=require("./ui/label.cjs"),a=require("./ui/drawer.cjs"),o=require("./field-BSLi-P0Q.cjs");let s=require("react"),c=require("@customafk/react-toolkit/utils"),l=require("react/jsx-runtime"),u=require("@tanstack/react-form"),d=require("@customafk/react-toolkit/hooks/useMobile");const f=({label:f,placeholder:p,required:m,disabled:h,options:g})=>{let _=(0,s.useId)(),{form:v,state:y,handleBlur:b,handleChange:x}=n.G(),S=(0,u.useStore)(v.store,({isSubmitting:e})=>e),C=(0,d.useIsMobile)(),[w,T]=(0,s.useState)(!1),E=y.meta.isTouched&&!y.meta.isValid,D=h||S,O=g.find(({value:e})=>e===y.value)?.label,k=(0,l.jsxs)(t.Command,{children:[(0,l.jsx)(t.CommandInput,{placeholder:p??`Tìm kiếm…`}),(0,l.jsxs)(t.CommandList,{children:[(0,l.jsx)(t.CommandEmpty,{children:`Không tìm thấy kết quả.`}),(0,l.jsx)(t.CommandGroup,{children:g.map(e=>(0,l.jsx)(t.CommandItem,{value:e.label,onSelect:()=>{x(e.value===y.value?null:e.value),T(!1)},children:e.label},e.value))})]})]});return C?(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[f&&(0,l.jsxs)(i.Label,{htmlFor:_,children:[f,m&&(0,l.jsx)(`span`,{className:`text-danger-strong`,children:`*`})]}),(0,l.jsx)(e.Button,{id:_,type:`button`,variant:`outline`,color:`muted`,disabled:D,"aria-invalid":E,className:(0,c.cn)(`w-full justify-start font-normal outline-1 outline-border -outline-offset-1`,!y.value&&`text-text-positive-muted`,E&&`outline-danger bg-danger-bg-subtle`),onBlur:b,onClick:()=>T(!0),children:O??(0,l.jsx)(`span`,{className:`text-text-positive-muted`,children:p})}),(0,l.jsx)(a.Drawer,{open:w,onOpenChange:T,direction:`bottom`,children:(0,l.jsxs)(a.DrawerContent,{children:[(0,l.jsx)(a.DrawerHeader,{children:(0,l.jsx)(a.DrawerTitle,{children:f??p??`Tìm kiếm…`})}),(0,l.jsx)(`div`,{className:`overflow-y-auto pb-safe-bottom`,children:k})]})}),E&&(0,l.jsx)(o.FieldError,{errors:y.meta.errors})]}):(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[f&&(0,l.jsxs)(i.Label,{htmlFor:_,children:[f,m&&(0,l.jsx)(`span`,{className:`text-danger-strong`,children:`*`})]}),(0,l.jsxs)(r.Popover,{children:[(0,l.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,l.jsx)(e.Button,{id:_,variant:`outline`,color:`muted`,size:`lg`,disabled:D,"aria-invalid":E,className:(0,c.cn)(`flex w-full items-center justify-start rounded outline-border font-normal`,`hover:bg-transparent`,`focus:outline-1 focus:outline-primary-strong focus:ring-4 focus:ring-primary-weak`,`data-[state=open]:outline-1 data-[state=open]:outline-primary-strong data-[state=open]:ring-4 data-[state=open]:ring-primary-weak`,!y.value&&`text-text-positive-muted`),children:O??(0,l.jsx)(`span`,{className:`text-text-positive-muted`,children:p})})}),(0,l.jsx)(r.PopoverContent,{align:`start`,side:`bottom`,className:`w-[--radix-popover-trigger-width] p-0 rounded`,onBlur:b,children:k})]}),E&&(0,l.jsx)(o.FieldError,{errors:y.meta.errors})]})};exports.SimpleComboboxField=f;
|
|
2
|
-
//# sourceMappingURL=simple-combobox-field-U0ZAl7VQ.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Button as e}from"./ui/button.mjs";import{G as t}from"./tanstack-form-fkaBh9RO.mjs";import{Popover as n,PopoverContent as r,PopoverTrigger as i}from"./ui/popover.mjs";import{Label as a}from"./ui/label.mjs";import{Calendar as o}from"./ui/calendar.mjs";import{FieldError as s}from"./field-V2DoD8qL.mjs";import{CalendarDaysIcon as c}from"lucide-react";import{useId as l}from"react";import{cn as u}from"@customafk/react-toolkit/utils";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{format as p}from"@customafk/react-toolkit/date-fns";import{useStore as m}from"@tanstack/react-form";const h=({label:h,placeholder:g,required:_,disabled:v,minDate:y,maxDate:b})=>{let x=l(),{form:S,state:C,handleBlur:w,handleChange:T}=t(),E=m(S.store,({isSubmitting:e})=>e),D=C.meta.isTouched&&!C.meta.isValid;return f(`div`,{className:`flex flex-col gap-1.5`,children:[h&&f(a,{htmlFor:x,children:[h,_&&d(`span`,{className:`text-danger-strong`,children:`*`})]}),f(n,{children:[d(i,{asChild:!0,children:f(e,{id:x,variant:`outline`,color:`muted`,size:`lg`,disabled:v||E,"aria-invalid":D,className:u(`flex w-full items-center justify-between rounded outline-border font-normal`,`hover:bg-transparent`,`focus:outline-1 focus:outline-primary-strong focus:ring-4 focus:ring-primary-weak`,`data-[state=open]:outline-1 data-[state=open]:outline-primary-strong data-[state=open]:ring-4 data-[state=open]:ring-primary-weak`,C.value===null&&`text-text-positive-muted`),children:[d(`span`,{children:C.value?p(C.value,`PPP`):g??`Select date`}),d(c,{strokeWidth:1})]})}),d(r,{align:`start`,side:`bottom`,className:`w-fit p-0 rounded`,onBlur:w,children:d(o,{mode:`single`,selected:C.value??void 0,hidden:{before:y??new Date(1900,0,1),after:b??new Date(2100,11,31)},onSelect:e=>{e&&T(e)}})})]}),D&&d(s,{errors:C.meta.errors})]})};export{h as SimpleDateField};
|
|
2
|
-
//# sourceMappingURL=simple-date-field-Dj4bJoji.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./ui/button.cjs"),t=require("./tanstack-form-C0ab8EEl.cjs"),n=require("./ui/popover.cjs"),r=require("./ui/label.cjs"),i=require("./ui/calendar.cjs"),a=require("./field-BSLi-P0Q.cjs");let o=require("lucide-react"),s=require("react"),c=require("@customafk/react-toolkit/utils"),l=require("react/jsx-runtime"),u=require("@customafk/react-toolkit/date-fns"),d=require("@tanstack/react-form");const f=({label:f,placeholder:p,required:m,disabled:h,minDate:g,maxDate:_})=>{let v=(0,s.useId)(),{form:y,state:b,handleBlur:x,handleChange:S}=t.G(),C=(0,d.useStore)(y.store,({isSubmitting:e})=>e),w=b.meta.isTouched&&!b.meta.isValid;return(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[f&&(0,l.jsxs)(r.Label,{htmlFor:v,children:[f,m&&(0,l.jsx)(`span`,{className:`text-danger-strong`,children:`*`})]}),(0,l.jsxs)(n.Popover,{children:[(0,l.jsx)(n.PopoverTrigger,{asChild:!0,children:(0,l.jsxs)(e.Button,{id:v,variant:`outline`,color:`muted`,size:`lg`,disabled:h||C,"aria-invalid":w,className:(0,c.cn)(`flex w-full items-center justify-between rounded outline-border font-normal`,`hover:bg-transparent`,`focus:outline-1 focus:outline-primary-strong focus:ring-4 focus:ring-primary-weak`,`data-[state=open]:outline-1 data-[state=open]:outline-primary-strong data-[state=open]:ring-4 data-[state=open]:ring-primary-weak`,b.value===null&&`text-text-positive-muted`),children:[(0,l.jsx)(`span`,{children:b.value?(0,u.format)(b.value,`PPP`):p??`Select date`}),(0,l.jsx)(o.CalendarDaysIcon,{strokeWidth:1})]})}),(0,l.jsx)(n.PopoverContent,{align:`start`,side:`bottom`,className:`w-fit p-0 rounded`,onBlur:x,children:(0,l.jsx)(i.Calendar,{mode:`single`,selected:b.value??void 0,hidden:{before:g??new Date(1900,0,1),after:_??new Date(2100,11,31)},onSelect:e=>{e&&S(e)}})})]}),w&&(0,l.jsx)(a.FieldError,{errors:b.meta.errors})]})};exports.SimpleDateField=f;
|
|
2
|
-
//# sourceMappingURL=simple-date-field-DtxEpEZj.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Input as e}from"./ui/input.mjs";import{G as t}from"./tanstack-form-fkaBh9RO.mjs";import{Label as n}from"./ui/label.mjs";import{FieldError as r}from"./field-V2DoD8qL.mjs";import{AtSignIcon as i}from"lucide-react";import{useCallback as a,useId as o}from"react";import{cn as s}from"@customafk/react-toolkit/utils";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{useStore as u}from"@tanstack/react-form";const d=({label:d,placeholder:f,required:p,maxLength:m,disabled:h})=>{let g=o(),{form:_,name:v,state:y,handleBlur:b,handleChange:x}=t(),S=u(_.store,({isSubmitting:e})=>e),C=y.meta.isTouched&&!y.meta.isValid,w=a(({target:{value:e}})=>{S||m&&e.length>m||x(e||null)},[S,m,x]);return l(`div`,{className:`flex flex-col gap-1.5`,children:[d&&l(n,{htmlFor:g,children:[d,p&&c(`span`,{className:`text-danger-strong`,children:`*`})]}),l(`div`,{className:`relative`,children:[c(e,{id:g,name:v,type:`email`,value:y.value??``,"aria-invalid":C,autoComplete:`email`,placeholder:f,disabled:h||S,className:s(`pl-9`),onBlur:b,onChange:w}),c(`div`,{className:`pointer-events-none absolute inset-y-0 left-0 flex size-9 items-center justify-center text-muted`,children:c(i,{size:14})})]}),C&&c(r,{errors:y.meta.errors})]})};export{d as SimpleEmailField};
|
|
2
|
-
//# sourceMappingURL=simple-email-field-BDyhkmHV.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./ui/input.cjs"),t=require("./tanstack-form-C0ab8EEl.cjs"),n=require("./ui/label.cjs"),r=require("./field-BSLi-P0Q.cjs");let i=require("lucide-react"),a=require("react"),o=require("@customafk/react-toolkit/utils"),s=require("react/jsx-runtime"),c=require("@tanstack/react-form");const l=({label:l,placeholder:u,required:d,maxLength:f,disabled:p})=>{let m=(0,a.useId)(),{form:h,name:g,state:_,handleBlur:v,handleChange:y}=t.G(),b=(0,c.useStore)(h.store,({isSubmitting:e})=>e),x=_.meta.isTouched&&!_.meta.isValid,S=(0,a.useCallback)(({target:{value:e}})=>{b||f&&e.length>f||y(e||null)},[b,f,y]);return(0,s.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[l&&(0,s.jsxs)(n.Label,{htmlFor:m,children:[l,d&&(0,s.jsx)(`span`,{className:`text-danger-strong`,children:`*`})]}),(0,s.jsxs)(`div`,{className:`relative`,children:[(0,s.jsx)(e.Input,{id:m,name:g,type:`email`,value:_.value??``,"aria-invalid":x,autoComplete:`email`,placeholder:u,disabled:p||b,className:(0,o.cn)(`pl-9`),onBlur:v,onChange:S}),(0,s.jsx)(`div`,{className:`pointer-events-none absolute inset-y-0 left-0 flex size-9 items-center justify-center text-muted`,children:(0,s.jsx)(i.AtSignIcon,{size:14})})]}),x&&(0,s.jsx)(r.FieldError,{errors:_.meta.errors})]})};exports.SimpleEmailField=l;
|
|
2
|
-
//# sourceMappingURL=simple-email-field-DK9I_Tc_.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./tanstack-form-C0ab8EEl.cjs"),t=require("./ui/label.cjs"),n=require("./field-BSLi-P0Q.cjs"),r=require("./number-input-CAr3JaA-.cjs");let i=require("react"),a=require("react/jsx-runtime"),o=require("@tanstack/react-form");const s=({label:s,placeholder:c,required:l,unit:u,allowNegative:d,disabled:f})=>{let p=(0,i.useId)(),{form:m,state:h,handleBlur:g,handleChange:_}=e.G(),v=(0,o.useStore)(m.store,({isSubmitting:e})=>e),y=h.meta.isTouched&&!h.meta.isValid,b=(0,i.useCallback)(e=>{v||_(e)},[v,_]);return(0,a.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s&&(0,a.jsxs)(t.Label,{htmlFor:p,children:[s,l&&(0,a.jsx)(`span`,{className:`text-danger-strong`,children:`*`})]}),(0,a.jsx)(r.t,{id:p,value:h.value,placeholder:c,unitText:u,allowNegative:d,disabled:f||v,onBlur:g,onValueChange:b}),y&&(0,a.jsx)(n.FieldError,{errors:h.meta.errors})]})};exports.SimpleNumberField=s;
|
|
2
|
-
//# sourceMappingURL=simple-number-field-BspqWU-3.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{G as e}from"./tanstack-form-fkaBh9RO.mjs";import{Label as t}from"./ui/label.mjs";import{FieldError as n}from"./field-V2DoD8qL.mjs";import{t as r}from"./number-input-CJcEV9Cg.mjs";import{useCallback as i,useId as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{useStore as c}from"@tanstack/react-form";const l=({label:l,placeholder:u,required:d,unit:f,allowNegative:p,disabled:m})=>{let h=a(),{form:g,state:_,handleBlur:v,handleChange:y}=e(),b=c(g.store,({isSubmitting:e})=>e),x=_.meta.isTouched&&!_.meta.isValid,S=i(e=>{b||y(e)},[b,y]);return s(`div`,{className:`flex flex-col gap-1.5`,children:[l&&s(t,{htmlFor:h,children:[l,d&&o(`span`,{className:`text-danger-strong`,children:`*`})]}),o(r,{id:h,value:_.value,placeholder:u,unitText:f,allowNegative:p,disabled:m||b,onBlur:v,onValueChange:S}),x&&o(n,{errors:_.meta.errors})]})};export{l as SimpleNumberField};
|
|
2
|
-
//# sourceMappingURL=simple-number-field-hneXMhfJ.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./ui/input.cjs"),t=require("./tanstack-form-C0ab8EEl.cjs"),n=require("./ui/label.cjs"),r=require("./field-BSLi-P0Q.cjs");let i=require("lucide-react"),a=require("react"),o=require("react/jsx-runtime"),s=require("@tanstack/react-form");const c=({label:c,placeholder:l,required:u,disabled:d})=>{let f=(0,a.useId)(),{form:p,name:m,state:h,handleBlur:g,handleChange:_}=t.G(),v=(0,s.useStore)(p.store,({isSubmitting:e})=>e),[y,b]=(0,a.useState)(!1),x=h.meta.isTouched&&!h.meta.isValid,S=(0,a.useCallback)(()=>b(e=>!e),[]),C=(0,a.useCallback)(({target:{value:e}})=>{v||_(e||null)},[v,_]);return(0,o.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[c&&(0,o.jsxs)(n.Label,{htmlFor:f,children:[c,u&&(0,o.jsx)(`span`,{className:`text-danger-strong`,children:`*`})]}),(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsx)(e.Input,{id:f,name:m,type:y?`text`:`password`,value:h.value??``,"aria-invalid":x,autoComplete:`current-password`,placeholder:l,disabled:d||v,className:`pr-9`,onBlur:g,onChange:C}),(0,o.jsx)(`button`,{type:`button`,tabIndex:-1,"aria-label":y?`Ẩn mật khẩu`:`Hiện mật khẩu`,"aria-pressed":y,"aria-controls":f,className:`absolute inset-y-0 right-0 flex size-9 items-center justify-center text-muted outline-none transition-colors hover:text-text-positive focus-visible:text-text-positive disabled:pointer-events-none disabled:opacity-50`,disabled:d||v,onClick:S,children:y?(0,o.jsx)(i.EyeOffIcon,{size:16,"aria-hidden":`true`}):(0,o.jsx)(i.EyeIcon,{size:16,"aria-hidden":`true`})})]}),x&&(0,o.jsx)(r.FieldError,{errors:h.meta.errors})]})};exports.SimplePasswordField=c;
|
|
2
|
-
//# sourceMappingURL=simple-password-field-BEEcleom.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Input as e}from"./ui/input.mjs";import{G as t}from"./tanstack-form-fkaBh9RO.mjs";import{Label as n}from"./ui/label.mjs";import{FieldError as r}from"./field-V2DoD8qL.mjs";import{EyeIcon as i,EyeOffIcon as a}from"lucide-react";import{useCallback as o,useId as s,useState as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{useStore as d}from"@tanstack/react-form";const f=({label:f,placeholder:p,required:m,disabled:h})=>{let g=s(),{form:_,name:v,state:y,handleBlur:b,handleChange:x}=t(),S=d(_.store,({isSubmitting:e})=>e),[C,w]=c(!1),T=y.meta.isTouched&&!y.meta.isValid,E=o(()=>w(e=>!e),[]),D=o(({target:{value:e}})=>{S||x(e||null)},[S,x]);return u(`div`,{className:`flex flex-col gap-1.5`,children:[f&&u(n,{htmlFor:g,children:[f,m&&l(`span`,{className:`text-danger-strong`,children:`*`})]}),u(`div`,{className:`relative`,children:[l(e,{id:g,name:v,type:C?`text`:`password`,value:y.value??``,"aria-invalid":T,autoComplete:`current-password`,placeholder:p,disabled:h||S,className:`pr-9`,onBlur:b,onChange:D}),l(`button`,{type:`button`,tabIndex:-1,"aria-label":C?`Ẩn mật khẩu`:`Hiện mật khẩu`,"aria-pressed":C,"aria-controls":g,className:`absolute inset-y-0 right-0 flex size-9 items-center justify-center text-muted outline-none transition-colors hover:text-text-positive focus-visible:text-text-positive disabled:pointer-events-none disabled:opacity-50`,disabled:h||S,onClick:E,children:l(C?a:i,{size:16,"aria-hidden":`true`})})]}),T&&l(r,{errors:y.meta.errors})]})};export{f as SimplePasswordField};
|
|
2
|
-
//# sourceMappingURL=simple-password-field-vsLRHDk4.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{G as e}from"./tanstack-form-fkaBh9RO.mjs";import{Label as t}from"./ui/label.mjs";import{RadioGroup as n,RadioGroupItem as r}from"./ui/radio-group.mjs";import{FieldError as i}from"./field-V2DoD8qL.mjs";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{useStore as s}from"@tanstack/react-form";const c=({label:c,required:l,disabled:u,options:d,orientation:f=`vertical`})=>{let{form:p,name:m,state:h,handleBlur:g,handleChange:_}=e(),v=s(p.store,({isSubmitting:e})=>e),y=h.meta.isTouched&&!h.meta.isValid,b=u||v;return o(`div`,{className:`flex flex-col gap-1.5`,children:[c&&o(t,{children:[c,l&&a(`span`,{className:`text-danger-strong`,children:`*`})]}),a(n,{name:m,value:h.value??``,disabled:b,"aria-invalid":y,className:f===`horizontal`?`flex flex-row flex-wrap gap-x-4 gap-y-2`:`flex flex-col gap-2`,onValueChange:_,onBlur:g,children:d.map(e=>o(`div`,{className:`flex items-center gap-2`,children:[a(r,{id:`${m}-${e.value}`,value:e.value}),a(t,{htmlFor:`${m}-${e.value}`,className:`cursor-pointer font-normal`,children:e.label})]},e.value))}),y&&a(i,{errors:h.meta.errors})]})};export{c as SimpleRadioGroupField};
|
|
2
|
-
//# sourceMappingURL=simple-radio-group-field-BURm_BSA.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./tanstack-form-C0ab8EEl.cjs"),t=require("./ui/label.cjs"),n=require("./ui/radio-group.cjs"),r=require("./field-BSLi-P0Q.cjs");let i=require("react/jsx-runtime"),a=require("@tanstack/react-form");const o=({label:o,required:s,disabled:c,options:l,orientation:u=`vertical`})=>{let{form:d,name:f,state:p,handleBlur:m,handleChange:h}=e.G(),g=(0,a.useStore)(d.store,({isSubmitting:e})=>e),_=p.meta.isTouched&&!p.meta.isValid,v=c||g;return(0,i.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[o&&(0,i.jsxs)(t.Label,{children:[o,s&&(0,i.jsx)(`span`,{className:`text-danger-strong`,children:`*`})]}),(0,i.jsx)(n.RadioGroup,{name:f,value:p.value??``,disabled:v,"aria-invalid":_,className:u===`horizontal`?`flex flex-row flex-wrap gap-x-4 gap-y-2`:`flex flex-col gap-2`,onValueChange:h,onBlur:m,children:l.map(e=>(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(n.RadioGroupItem,{id:`${f}-${e.value}`,value:e.value}),(0,i.jsx)(t.Label,{htmlFor:`${f}-${e.value}`,className:`cursor-pointer font-normal`,children:e.label})]},e.value))}),_&&(0,i.jsx)(r.FieldError,{errors:p.meta.errors})]})};exports.SimpleRadioGroupField=o;
|
|
2
|
-
//# sourceMappingURL=simple-radio-group-field-Wm8xB0fN.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Button as e}from"./ui/button.mjs";import{G as t}from"./tanstack-form-fkaBh9RO.mjs";import{Label as n}from"./ui/label.mjs";import{Drawer as r,DrawerClose as i,DrawerContent as a,DrawerHeader as o,DrawerTitle as s}from"./ui/drawer.mjs";import{Select as c,SelectContent as l,SelectItem as u,SelectTrigger as d,SelectValue as f}from"./ui/select.mjs";import{FieldError as p}from"./field-V2DoD8qL.mjs";import{PackagePlusIcon as m}from"lucide-react";import{useId as h,useState as g}from"react";import{cn as _}from"@customafk/react-toolkit/utils";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{useIsMobile as b}from"@customafk/react-toolkit/hooks/useMobile";const x=({label:x,placeholder:S,required:C,options:w})=>{let T=h(),{state:E,handleBlur:D,handleChange:O}=t(),k=b(),[A,j]=g(!1),M=E.meta.isTouched&&!E.meta.isValid,N=w.find(e=>e.value===E.value)?.label;return k?y(`div`,{className:`flex flex-col gap-1.5`,children:[x&&y(n,{htmlFor:T,children:[x,C&&v(`span`,{className:`text-danger-strong`,children:`*`})]}),v(e,{id:T,type:`button`,variant:`outline`,color:`muted`,className:_(`w-full justify-start font-normal outline-1 outline-border -outline-offset-1`,!E.value&&`text-text-positive-muted`,M&&`outline-danger bg-danger-bg-subtle`),"aria-invalid":M,onBlur:D,onClick:()=>j(!0),children:N??v(`span`,{className:`text-text-positive-muted`,children:S})}),v(r,{open:A,onOpenChange:j,direction:`bottom`,children:y(a,{children:[v(o,{children:v(s,{children:x??S??`Select an option`})}),v(`div`,{className:`flex flex-col overflow-y-auto pb-safe-bottom`,children:w.length>0?w.map(e=>v(i,{asChild:!0,children:v(`button`,{type:`button`,className:_(`flex w-full items-center px-4 py-3 text-left text-sm transition-colors`,`hover:bg-muted-muted active:bg-muted-muted`,E.value===e.value&&`bg-primary-bg-subtle font-medium text-primary`),onClick:()=>{O(e.value),j(!1)},children:e.label})},e.value)):y(`div`,{className:`flex items-center justify-center gap-x-2 px-4 py-8 text-center text-sm text-text-positive-weak`,children:[v(m,{strokeWidth:1}),`No options available`]})})]})}),M&&v(p,{errors:E.meta.errors})]}):y(`div`,{className:`flex flex-col gap-1.5`,children:[x&&y(n,{htmlFor:T,children:[x,C&&v(`span`,{className:`text-danger-strong`,children:`*`})]}),y(c,{value:E.value??``,onValueChange:O,children:[v(d,{id:T,"aria-invalid":M?`true`:void 0,onBlur:D,children:v(f,{placeholder:S})}),v(l,{children:w.length>0?w.map(e=>v(u,{value:e.value,children:e.label},e.value)):y(`div`,{className:`flex items-center justify-center gap-x-2 rounded border border-border bg-muted-muted px-4 py-6.5 text-center text-sm text-text-positive-weak`,children:[v(m,{strokeWidth:1}),`No options available`]})})]}),M&&v(p,{errors:E.meta.errors})]})};export{x as SimpleSelectField};
|
|
2
|
-
//# sourceMappingURL=simple-select-field-8cY51U4d.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./ui/button.cjs"),t=require("./tanstack-form-C0ab8EEl.cjs"),n=require("./ui/label.cjs"),r=require("./ui/drawer.cjs"),i=require("./ui/select.cjs"),a=require("./field-BSLi-P0Q.cjs");let o=require("lucide-react"),s=require("react"),c=require("@customafk/react-toolkit/utils"),l=require("react/jsx-runtime"),u=require("@customafk/react-toolkit/hooks/useMobile");const d=({label:d,placeholder:f,required:p,options:m})=>{let h=(0,s.useId)(),{state:g,handleBlur:_,handleChange:v}=t.G(),y=(0,u.useIsMobile)(),[b,x]=(0,s.useState)(!1),S=g.meta.isTouched&&!g.meta.isValid,C=m.find(e=>e.value===g.value)?.label;return y?(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[d&&(0,l.jsxs)(n.Label,{htmlFor:h,children:[d,p&&(0,l.jsx)(`span`,{className:`text-danger-strong`,children:`*`})]}),(0,l.jsx)(e.Button,{id:h,type:`button`,variant:`outline`,color:`muted`,className:(0,c.cn)(`w-full justify-start font-normal outline-1 outline-border -outline-offset-1`,!g.value&&`text-text-positive-muted`,S&&`outline-danger bg-danger-bg-subtle`),"aria-invalid":S,onBlur:_,onClick:()=>x(!0),children:C??(0,l.jsx)(`span`,{className:`text-text-positive-muted`,children:f})}),(0,l.jsx)(r.Drawer,{open:b,onOpenChange:x,direction:`bottom`,children:(0,l.jsxs)(r.DrawerContent,{children:[(0,l.jsx)(r.DrawerHeader,{children:(0,l.jsx)(r.DrawerTitle,{children:d??f??`Select an option`})}),(0,l.jsx)(`div`,{className:`flex flex-col overflow-y-auto pb-safe-bottom`,children:m.length>0?m.map(e=>(0,l.jsx)(r.DrawerClose,{asChild:!0,children:(0,l.jsx)(`button`,{type:`button`,className:(0,c.cn)(`flex w-full items-center px-4 py-3 text-left text-sm transition-colors`,`hover:bg-muted-muted active:bg-muted-muted`,g.value===e.value&&`bg-primary-bg-subtle font-medium text-primary`),onClick:()=>{v(e.value),x(!1)},children:e.label})},e.value)):(0,l.jsxs)(`div`,{className:`flex items-center justify-center gap-x-2 px-4 py-8 text-center text-sm text-text-positive-weak`,children:[(0,l.jsx)(o.PackagePlusIcon,{strokeWidth:1}),`No options available`]})})]})}),S&&(0,l.jsx)(a.FieldError,{errors:g.meta.errors})]}):(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[d&&(0,l.jsxs)(n.Label,{htmlFor:h,children:[d,p&&(0,l.jsx)(`span`,{className:`text-danger-strong`,children:`*`})]}),(0,l.jsxs)(i.Select,{value:g.value??``,onValueChange:v,children:[(0,l.jsx)(i.SelectTrigger,{id:h,"aria-invalid":S?`true`:void 0,onBlur:_,children:(0,l.jsx)(i.SelectValue,{placeholder:f})}),(0,l.jsx)(i.SelectContent,{children:m.length>0?m.map(e=>(0,l.jsx)(i.SelectItem,{value:e.value,children:e.label},e.value)):(0,l.jsxs)(`div`,{className:`flex items-center justify-center gap-x-2 rounded border border-border bg-muted-muted px-4 py-6.5 text-center text-sm text-text-positive-weak`,children:[(0,l.jsx)(o.PackagePlusIcon,{strokeWidth:1}),`No options available`]})})]}),S&&(0,l.jsx)(a.FieldError,{errors:g.meta.errors})]})};exports.SimpleSelectField=d;
|
|
2
|
-
//# sourceMappingURL=simple-select-field-QQ65caBf.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./ui/input.cjs"),t=require("./tanstack-form-C0ab8EEl.cjs"),n=require("./ui/label.cjs"),r=require("./field-BSLi-P0Q.cjs");let i=require("react"),a=require("react/jsx-runtime"),o=require("@tanstack/react-form");const s=({label:s,placeholder:c,required:l,maxLength:u,disabled:d})=>{let f=(0,i.useId)(),{form:p,name:m,state:h,handleBlur:g,handleChange:_}=t.G(),v=(0,o.useStore)(p.store,({isSubmitting:e})=>e),y=h.meta.isTouched&&!h.meta.isValid,b=(0,i.useCallback)(({target:{value:e}})=>{v||u&&e.length>u||_(e||null)},[v,u,_]);return(0,a.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s&&(0,a.jsxs)(n.Label,{htmlFor:f,children:[s,l&&(0,a.jsx)(`span`,{className:`text-danger-strong`,children:`*`})]}),(0,a.jsx)(e.Input,{id:f,name:m,value:h.value??``,"aria-invalid":y,placeholder:c,autoComplete:`off`,disabled:d||v,onBlur:g,onChange:b}),y&&(0,a.jsx)(r.FieldError,{errors:h.meta.errors})]})};exports.SimpleTextField=s;
|
|
2
|
-
//# sourceMappingURL=simple-text-field-BHkCPiE5.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Input as e}from"./ui/input.mjs";import{G as t}from"./tanstack-form-fkaBh9RO.mjs";import{Label as n}from"./ui/label.mjs";import{FieldError as r}from"./field-V2DoD8qL.mjs";import{useCallback as i,useId as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{useStore as c}from"@tanstack/react-form";const l=({label:l,placeholder:u,required:d,maxLength:f,disabled:p})=>{let m=a(),{form:h,name:g,state:_,handleBlur:v,handleChange:y}=t(),b=c(h.store,({isSubmitting:e})=>e),x=_.meta.isTouched&&!_.meta.isValid,S=i(({target:{value:e}})=>{b||f&&e.length>f||y(e||null)},[b,f,y]);return s(`div`,{className:`flex flex-col gap-1.5`,children:[l&&s(n,{htmlFor:m,children:[l,d&&o(`span`,{className:`text-danger-strong`,children:`*`})]}),o(e,{id:m,name:g,value:_.value??``,"aria-invalid":x,placeholder:u,autoComplete:`off`,disabled:p||b,onBlur:v,onChange:S}),x&&o(r,{errors:_.meta.errors})]})};export{l as SimpleTextField};
|
|
2
|
-
//# sourceMappingURL=simple-text-field-DK72_OA_.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{G as e}from"./tanstack-form-fkaBh9RO.mjs";import{Label as t}from"./ui/label.mjs";import{Textarea as n}from"./ui/textarea.mjs";import{FieldError as r}from"./field-V2DoD8qL.mjs";import{useCallback as i,useId as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{useStore as c}from"@tanstack/react-form";const l=({label:l,placeholder:u,required:d,maxLength:f,rows:p,disabled:m})=>{let h=a(),{form:g,name:_,state:v,handleBlur:y,handleChange:b}=e(),x=c(g.store,({isSubmitting:e})=>e),S=v.meta.isTouched&&!v.meta.isValid,C=i(({target:{value:e}})=>{x||f&&e.length>f||b(e||null)},[x,f,b]);return s(`div`,{className:`flex flex-col gap-1.5`,children:[l&&s(t,{htmlFor:h,children:[l,d&&o(`span`,{className:`text-danger-strong`,children:`*`})]}),o(n,{id:h,name:_,value:v.value??``,"aria-invalid":S,placeholder:u,rows:p,disabled:m||x,onBlur:y,onChange:C}),S&&o(r,{errors:v.meta.errors})]})};export{l as SimpleTextareaField};
|
|
2
|
-
//# sourceMappingURL=simple-textarea-field-B72nNQHv.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./tanstack-form-C0ab8EEl.cjs"),t=require("./ui/label.cjs"),n=require("./ui/textarea.cjs"),r=require("./field-BSLi-P0Q.cjs");let i=require("react"),a=require("react/jsx-runtime"),o=require("@tanstack/react-form");const s=({label:s,placeholder:c,required:l,maxLength:u,rows:d,disabled:f})=>{let p=(0,i.useId)(),{form:m,name:h,state:g,handleBlur:_,handleChange:v}=e.G(),y=(0,o.useStore)(m.store,({isSubmitting:e})=>e),b=g.meta.isTouched&&!g.meta.isValid,x=(0,i.useCallback)(({target:{value:e}})=>{y||u&&e.length>u||v(e||null)},[y,u,v]);return(0,a.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s&&(0,a.jsxs)(t.Label,{htmlFor:p,children:[s,l&&(0,a.jsx)(`span`,{className:`text-danger-strong`,children:`*`})]}),(0,a.jsx)(n.Textarea,{id:p,name:h,value:g.value??``,"aria-invalid":b,placeholder:c,rows:d,disabled:f||y,onBlur:_,onChange:x}),b&&(0,a.jsx)(r.FieldError,{errors:g.meta.errors})]})};exports.SimpleTextareaField=s;
|
|
2
|
-
//# sourceMappingURL=simple-textarea-field-Bu5h7sfH.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{G as e}from"./tanstack-form-fkaBh9RO.mjs";import{Field as t,FieldContent as n,FieldDescription as r,FieldGroup as i,FieldNote as a,FieldSeparator as o,FieldTitle as s}from"./field-V2DoD8qL.mjs";import{cn as c}from"@customafk/react-toolkit/utils";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{Switch as d}from"radix-ui";function f({className:e,...t}){return l(d.Root,{"data-slot":`switch`,className:c(`peer`,`w-8 shrink-0 cursor-pointer items-center rounded-full shadow-xs transition-all`,`inline-flex h-5`,`focus-visible:border-primary-strong`,`focus-visible:ring-primary-weak`,`focus-visible:ring-4`,`disabled:cursor-not-allowed`,`disabled:opacity-50`,`-outline-offset-1 inset-shadow-2xs outline-1`,`data-[state=checked]:bg-primary`,`data-[state=checked]:outline-primary-strong`,`data-[state=unchecked]:bg-muted-weak`,`data-[state=unchecked]:outline-border`,`data-[state=unchecked]:[&_span]:size-4`,`data-[state=unchecked]:[&_span]:translate-x-0.5`,`data-[state=unchecked]:[&_span]:rtl:-translate-x-0.5`,e),...t,children:l(d.Thumb,{"data-slot":`switch-thumb`,className:c(`block size-4 bg-card shadow-xs`,`pointer-events-none rounded-full ring-0 transition-transform`,`data-[state=checked]:translate-x-[calc(100%-3px)]`,`data-[state=unchecked]:translate-x-0`)})})}const p=({label:c,description:d,helperText:p})=>{let m=e();return u(i,{className:`gap-y-4 px-4`,children:[u(t,{orientation:`vertical`,className:`relative justify-between gap-y-1`,children:[u(n,{children:[l(s,{className:`cursor-pointer`,children:l(`label`,{htmlFor:m.name,children:c})}),l(r,{children:d}),l(f,{id:m.name,checked:m.state.value??!1,className:`absolute top-1 right-1`,onBlur:m.handleBlur,onCheckedChange:m.handleChange})]}),l(a,{isShow:!!p,children:p})]}),l(o,{})]})};export{p as SwitchField};
|
|
2
|
-
//# sourceMappingURL=switch-field-DoPUWb9d.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./tanstack-form-C0ab8EEl.cjs"),t=require("./field-BSLi-P0Q.cjs");let n=require("@customafk/react-toolkit/utils"),r=require("react/jsx-runtime"),i=require("radix-ui");function a({className:e,...t}){return(0,r.jsx)(i.Switch.Root,{"data-slot":`switch`,className:(0,n.cn)(`peer`,`w-8 shrink-0 cursor-pointer items-center rounded-full shadow-xs transition-all`,`inline-flex h-5`,`focus-visible:border-primary-strong`,`focus-visible:ring-primary-weak`,`focus-visible:ring-4`,`disabled:cursor-not-allowed`,`disabled:opacity-50`,`-outline-offset-1 inset-shadow-2xs outline-1`,`data-[state=checked]:bg-primary`,`data-[state=checked]:outline-primary-strong`,`data-[state=unchecked]:bg-muted-weak`,`data-[state=unchecked]:outline-border`,`data-[state=unchecked]:[&_span]:size-4`,`data-[state=unchecked]:[&_span]:translate-x-0.5`,`data-[state=unchecked]:[&_span]:rtl:-translate-x-0.5`,e),...t,children:(0,r.jsx)(i.Switch.Thumb,{"data-slot":`switch-thumb`,className:(0,n.cn)(`block size-4 bg-card shadow-xs`,`pointer-events-none rounded-full ring-0 transition-transform`,`data-[state=checked]:translate-x-[calc(100%-3px)]`,`data-[state=unchecked]:translate-x-0`)})})}const o=({label:n,description:i,helperText:o})=>{let s=e.G();return(0,r.jsxs)(t.FieldGroup,{className:`gap-y-4 px-4`,children:[(0,r.jsxs)(t.Field,{orientation:`vertical`,className:`relative justify-between gap-y-1`,children:[(0,r.jsxs)(t.FieldContent,{children:[(0,r.jsx)(t.FieldTitle,{className:`cursor-pointer`,children:(0,r.jsx)(`label`,{htmlFor:s.name,children:n})}),(0,r.jsx)(t.FieldDescription,{children:i}),(0,r.jsx)(a,{id:s.name,checked:s.state.value??!1,className:`absolute top-1 right-1`,onBlur:s.handleBlur,onCheckedChange:s.handleChange})]}),(0,r.jsx)(t.FieldNote,{isShow:!!o,children:o})]}),(0,r.jsx)(t.FieldSeparator,{})]})};exports.SwitchField=o;
|
|
2
|
-
//# sourceMappingURL=switch-field-eLVlQZSI.cjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./ui/skeleton.cjs");let t=require("react"),n=require("react/jsx-runtime"),r=require("@tanstack/react-form");const{fieldContext:i,formContext:a,useFieldContext:o,useFormContext:s}=(0,r.createFormHookContexts)();function c(){return(0,n.jsx)(e.Skeleton,{"data-slot":`tanstack-field-skeleton`,className:`h-9 w-full rounded`})}function l(e){let r=(0,t.lazy)(e);return e=>(0,n.jsx)(t.Suspense,{fallback:(0,n.jsx)(c,{}),children:(0,n.jsx)(r,{...e})})}const u=l(()=>Promise.resolve().then(()=>require("./text-field-DT50dOVI.cjs")).then(e=>({default:e.TextField}))),d=l(()=>Promise.resolve().then(()=>require("./textarea-field-BhqX29CS.cjs")).then(e=>({default:e.TextareaField}))),f=l(()=>Promise.resolve().then(()=>require("./text-editor-field-DcEUC0iH.cjs")).then(e=>({default:e.TextEditorField}))),p=l(()=>Promise.resolve().then(()=>require("./number-field-CWDYA3La.cjs")).then(e=>({default:e.NumberField}))),m=l(()=>Promise.resolve().then(()=>require("./email-field-D3nSkHj2.cjs")).then(e=>({default:e.EmailField}))),h=l(()=>Promise.resolve().then(()=>require("./password-field-BHRhVyZ0.cjs")).then(e=>({default:e.PasswordField}))),g=l(()=>Promise.resolve().then(()=>require("./select-field-CvDBZQTl.cjs")).then(e=>({default:e.SelectField}))),_=l(()=>Promise.resolve().then(()=>require("./combobox-field-ZYr7636s.cjs")).then(e=>({default:e.ComboboxField}))),v=l(()=>Promise.resolve().then(()=>require("./date-field-1Hmcv8Zp.cjs")).then(e=>({default:e.DateField}))),y=l(()=>Promise.resolve().then(()=>require("./switch-field-eLVlQZSI.cjs")).then(e=>({default:e.SwitchField}))),b=l(()=>Promise.resolve().then(()=>require("./radio-group-field-BFhBfzoT.cjs")).then(e=>({default:e.RadioGroupField}))),x=l(()=>Promise.resolve().then(()=>require("./checkbox-field-ldZRSCca.cjs")).then(e=>({default:e.CheckboxField}))),S=l(()=>Promise.resolve().then(()=>require("./simple-text-field-BHkCPiE5.cjs")).then(e=>({default:e.SimpleTextField}))),C=l(()=>Promise.resolve().then(()=>require("./simple-email-field-DK9I_Tc_.cjs")).then(e=>({default:e.SimpleEmailField}))),w=l(()=>Promise.resolve().then(()=>require("./simple-password-field-BEEcleom.cjs")).then(e=>({default:e.SimplePasswordField}))),T=l(()=>Promise.resolve().then(()=>require("./simple-textarea-field-Bu5h7sfH.cjs")).then(e=>({default:e.SimpleTextareaField}))),E=l(()=>Promise.resolve().then(()=>require("./simple-number-field-BspqWU-3.cjs")).then(e=>({default:e.SimpleNumberField}))),D=l(()=>Promise.resolve().then(()=>require("./simple-select-field-QQ65caBf.cjs")).then(e=>({default:e.SimpleSelectField}))),O=(0,t.lazy)(()=>Promise.resolve().then(()=>require("./simple-array-field-aGXkDZXD.cjs")).then(e=>({default:e.SimpleArrayField})));function k(e){return(0,n.jsx)(t.Suspense,{fallback:(0,n.jsx)(c,{}),children:(0,n.jsx)(O,{...e})})}const A=l(()=>Promise.resolve().then(()=>require("./simple-boolean-field-BeVkn3c4.cjs")).then(e=>({default:e.SimpleBooleanField}))),j=l(()=>Promise.resolve().then(()=>require("./simple-combobox-field-U0ZAl7VQ.cjs")).then(e=>({default:e.SimpleComboboxField}))),M=l(()=>Promise.resolve().then(()=>require("./simple-date-field-DtxEpEZj.cjs")).then(e=>({default:e.SimpleDateField}))),N=l(()=>Promise.resolve().then(()=>require("./simple-radio-group-field-Wm8xB0fN.cjs")).then(e=>({default:e.SimpleRadioGroupField}))),P=l(()=>Promise.resolve().then(()=>require("./simple-array-field-aGXkDZXD.cjs")).then(e=>({default:e.ArrayCol}))),F=l(()=>Promise.resolve().then(()=>require("./simple-array-field-aGXkDZXD.cjs")).then(e=>({default:e.ArrayHeaderRow}))),I=l(()=>Promise.resolve().then(()=>require("./dialog-form-C1qpltYx.cjs")).then(e=>({default:e.TanStackDialogForm}))),L=l(()=>Promise.resolve().then(()=>require("./popover-form-Ch_iMMSm.cjs")).then(e=>({default:e.TanStackPopoverForm}))),R=l(()=>Promise.resolve().then(()=>require("./container-form-D8QNEn8M.cjs")).then(e=>({default:e.TanStackContainerForm}))),z=l(()=>Promise.resolve().then(()=>require("./section-form-C_pHiBEW.cjs")).then(e=>({default:e.TanStackSectionForm}))),B=l(()=>Promise.resolve().then(()=>require("./card-form-BR5kDTzB.cjs")).then(e=>({default:e.TanStackCardForm}))),V=l(()=>Promise.resolve().then(()=>require("./group-field-sVykO2JZ.cjs")).then(e=>({default:e.TanStackFieldGroup}))),H=l(()=>Promise.resolve().then(()=>require("./title-field-B2hM3S_S.cjs")).then(e=>({default:e.TanStackTitleField}))),U=l(()=>Promise.resolve().then(()=>require("./actions-form-DF2eYxGQ.cjs")).then(e=>({default:e.TanStackActionsForm}))),W=l(()=>Promise.resolve().then(()=>require("./action-submit-B9vHpLoN.cjs")).then(e=>({default:e.TanStackActionSubmit}))),G=l(()=>Promise.resolve().then(()=>require("./field-BSLi-P0Q.cjs")).then(e=>({default:e.FieldGroup}))),K=l(()=>Promise.resolve().then(()=>require("./field-BSLi-P0Q.cjs")).then(e=>({default:e.Field}))),q=l(()=>Promise.resolve().then(()=>require("./field-BSLi-P0Q.cjs")).then(e=>({default:e.FieldContent}))),J=l(()=>Promise.resolve().then(()=>require("./field-BSLi-P0Q.cjs")).then(e=>({default:e.FieldLabel}))),Y=l(()=>Promise.resolve().then(()=>require("./field-BSLi-P0Q.cjs")).then(e=>({default:e.FieldContentMain}))),X=l(()=>Promise.resolve().then(()=>require("./field-BSLi-P0Q.cjs")).then(e=>({default:e.FieldSeparator}))),Z=l(()=>Promise.resolve().then(()=>require("./field-BSLi-P0Q.cjs")).then(e=>({default:e.FieldError}))),{useAppForm:Q,withForm:$,withFieldGroup:ee}=(0,r.createFormHook)({fieldContext:i,formContext:a,fieldComponents:{TextField:u,TextareaField:d,TextEditorField:f,NumberField:p,EmailField:m,PasswordField:h,SelectField:g,ComboboxField:_,DateField:v,SwitchField:y,RadioGroupField:b,CheckboxField:x,SimpleTextField:S,SimpleEmailField:C,SimplePasswordField:w,SimpleTextareaField:T,SimpleNumberField:E,SimpleSelectField:D,SimpleArrayField:k,SimpleBooleanField:A,SimpleComboboxField:j,SimpleDateField:M,SimpleRadioGroupField:N,FieldGroup:G,Field:K,FieldContent:q,FieldLabel:J,FieldContentMain:Y,FieldSeparator:X,FieldError:Z},formComponents:{TanStackDialogForm:I,TanStackPopoverForm:L,TanStackContainerForm:R,TanStackSectionForm:z,TanStackCardForm:B,TanStackFieldGroup:V,TanStackTitleField:H,TanStackActionsForm:U,TanStackActionSubmit:W,ArrayCol:P,ArrayHeaderRow:F}});Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return f}});
|
|
2
|
-
//# sourceMappingURL=tanstack-form-C0ab8EEl.cjs.map
|