@customafk/lunas-ui 0.2.42 → 0.2.44
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/alert-B02cVKWp.d.cts +88 -0
- package/dist/alert-B2PaDJp6.cjs +2 -0
- package/dist/alert-B2PaDJp6.cjs.map +1 -0
- package/dist/alert-BbvPwf2x.mjs +2 -0
- package/dist/alert-BbvPwf2x.mjs.map +1 -0
- package/dist/alert-DHSm8bMn.d.mts +88 -0
- package/dist/avatar-TyOphzGo.cjs +2 -0
- package/dist/avatar-TyOphzGo.cjs.map +1 -0
- package/dist/avatar-fltdRVsJ.mjs +2 -0
- package/dist/avatar-fltdRVsJ.mjs.map +1 -0
- package/dist/badge-BxSbkHQL.d.mts +42 -0
- package/dist/badge-CDGBGq8X.mjs +2 -0
- package/dist/badge-CDGBGq8X.mjs.map +1 -0
- package/dist/badge-KW7xu5Ca.cjs +2 -0
- package/dist/badge-KW7xu5Ca.cjs.map +1 -0
- package/dist/badge-zrAIDd-9.d.cts +42 -0
- package/dist/button-C--DAN1D.cjs +2 -0
- package/dist/button-C--DAN1D.cjs.map +1 -0
- package/dist/button-CCVJTHBI.mjs +2 -0
- package/dist/button-CCVJTHBI.mjs.map +1 -0
- package/dist/button-D3QvCdr6.d.cts +174 -0
- package/dist/button-D3d7M90P.d.mts +174 -0
- package/dist/button.variants-4kw6plrv.cjs +2 -0
- package/dist/button.variants-4kw6plrv.cjs.map +1 -0
- package/dist/button.variants-DkMqWB8G.mjs +2 -0
- package/dist/button.variants-DkMqWB8G.mjs.map +1 -0
- package/dist/calendar-4weBDnXz.cjs +2 -0
- package/dist/calendar-4weBDnXz.cjs.map +1 -0
- package/dist/calendar-R866yyd1.mjs +2 -0
- package/dist/calendar-R866yyd1.mjs.map +1 -0
- package/dist/cards/grid-product-card.cjs +1 -1
- package/dist/cards/grid-product-card.cjs.map +1 -1
- package/dist/cards/grid-product-card.d.mts +37 -0
- package/dist/cards/grid-product-card.mjs +2 -0
- package/dist/cards/grid-product-card.mjs.map +1 -0
- package/dist/cards/product-card.cjs +1 -1
- package/dist/cards/product-card.cjs.map +1 -1
- package/dist/cards/product-card.d.mts +37 -0
- package/dist/cards/product-card.mjs +2 -0
- package/dist/cards/product-card.mjs.map +1 -0
- package/dist/cards/simple-card.cjs +1 -1
- package/dist/cards/simple-card.d.mts +35 -0
- package/dist/cards/simple-card.mjs +2 -0
- package/dist/cards/simple-card.mjs.map +1 -0
- package/dist/checkbox-Cat3i08X.mjs +2 -0
- package/dist/checkbox-Cat3i08X.mjs.map +1 -0
- package/dist/checkbox-Dsq-MSbH.cjs +2 -0
- package/dist/checkbox-Dsq-MSbH.cjs.map +1 -0
- package/dist/chunk-350yNsax.cjs +1 -0
- package/dist/close-Dlo1bI8x.cjs +2 -0
- package/dist/close-Dlo1bI8x.cjs.map +1 -0
- package/dist/close-_UHFeiLS.mjs +2 -0
- package/dist/close-_UHFeiLS.mjs.map +1 -0
- package/dist/cms-layout-BCH4NroR.cjs +2 -0
- package/dist/cms-layout-BCH4NroR.cjs.map +1 -0
- package/dist/cms-layout-DkCR1AfG.mjs +2 -0
- package/dist/cms-layout-DkCR1AfG.mjs.map +1 -0
- package/dist/command-CsP8a1Un.cjs +2 -0
- package/dist/command-CsP8a1Un.cjs.map +1 -0
- package/dist/command-D6_CSbwJ.mjs +2 -0
- package/dist/command-D6_CSbwJ.mjs.map +1 -0
- package/dist/data-display/country.cjs +1 -1
- package/dist/data-display/country.cjs.map +1 -1
- package/dist/data-display/country.d.cts +1 -1
- package/dist/data-display/country.d.mts +22 -0
- package/dist/data-display/country.mjs +2 -0
- package/dist/data-display/country.mjs.map +1 -0
- package/dist/data-display/data-list.cjs +1 -1
- package/dist/data-display/data-list.d.mts +43 -0
- package/dist/data-display/data-list.mjs +2 -0
- package/dist/data-display/data-list.mjs.map +1 -0
- package/dist/data-display/date-tooltip.cjs +1 -1
- package/dist/data-display/date-tooltip.cjs.map +1 -1
- package/dist/data-display/date-tooltip.d.mts +19 -0
- package/dist/data-display/date-tooltip.mjs +2 -0
- package/dist/data-display/date-tooltip.mjs.map +1 -0
- package/dist/data-display/date.cjs +1 -2
- package/dist/data-display/date.d.mts +39 -0
- package/dist/data-display/date.mjs +1 -0
- package/dist/data-display/empty.cjs +1 -1
- package/dist/data-display/empty.d.mts +21 -0
- package/dist/data-display/empty.mjs +2 -0
- package/dist/data-display/empty.mjs.map +1 -0
- package/dist/data-display/name.cjs +1 -1
- package/dist/data-display/name.cjs.map +1 -1
- package/dist/data-display/name.d.mts +19 -0
- package/dist/data-display/name.mjs +2 -0
- package/dist/data-display/name.mjs.map +1 -0
- package/dist/data-display/phone-number.cjs +1 -1
- package/dist/data-display/phone-number.cjs.map +1 -1
- package/dist/data-display/phone-number.d.mts +19 -0
- package/dist/data-display/phone-number.mjs +2 -0
- package/dist/data-display/phone-number.mjs.map +1 -0
- package/dist/data-display/role-badge.cjs +1 -1
- package/dist/data-display/role-badge.cjs.map +1 -1
- package/dist/data-display/role-badge.d.cts +1 -1
- package/dist/data-display/role-badge.d.mts +22 -0
- package/dist/data-display/role-badge.mjs +2 -0
- package/dist/data-display/role-badge.mjs.map +1 -0
- package/dist/data-display/statistic.cjs +1 -2
- package/dist/data-display/statistic.d.cts +4 -4
- package/dist/data-display/statistic.d.mts +57 -0
- package/dist/data-display/statistic.mjs +1 -0
- package/dist/data-display/user.cjs +1 -2
- package/dist/data-display/user.d.mts +23 -0
- package/dist/data-display/user.mjs +1 -0
- package/dist/date-D4NVl6C9.cjs +2 -0
- package/dist/date-D4NVl6C9.cjs.map +1 -0
- package/dist/date-fY3sUcLp.mjs +2 -0
- package/dist/date-fY3sUcLp.mjs.map +1 -0
- package/dist/dialog-Bd5cOZia.d.mts +90 -0
- package/dist/dialog-BigPrWIj.cjs +2 -0
- package/dist/dialog-BigPrWIj.cjs.map +1 -0
- package/dist/dialog-CLDnvNH_.mjs +2 -0
- package/dist/dialog-CLDnvNH_.mjs.map +1 -0
- package/dist/dialog-DEmYNufN.d.cts +90 -0
- package/dist/dialogs/confirm-dialog.cjs +1 -1
- package/dist/dialogs/confirm-dialog.d.mts +142 -0
- package/dist/dialogs/confirm-dialog.mjs +2 -0
- package/dist/dialogs/confirm-dialog.mjs.map +1 -0
- package/dist/dialogs/detail-dialog/components/sidebar.cjs +1 -1
- package/dist/dialogs/detail-dialog/components/sidebar.d.cts +29 -29
- package/dist/dialogs/detail-dialog/components/sidebar.d.mts +209 -0
- package/dist/dialogs/detail-dialog/components/sidebar.mjs +1 -0
- package/dist/dialogs/detail-dialog/index.cjs +1 -1
- package/dist/dialogs/detail-dialog/index.cjs.map +1 -1
- package/dist/dialogs/detail-dialog/index.d.mts +45 -0
- package/dist/dialogs/detail-dialog/index.mjs +2 -0
- package/dist/dialogs/detail-dialog/index.mjs.map +1 -0
- package/dist/dialogs/error-dialog.cjs +1 -1
- package/dist/dialogs/error-dialog.d.mts +25 -0
- package/dist/dialogs/error-dialog.mjs +2 -0
- package/dist/dialogs/error-dialog.mjs.map +1 -0
- package/dist/dialogs/loading-dialog.cjs +1 -1
- package/dist/dialogs/loading-dialog.cjs.map +1 -1
- package/dist/dialogs/loading-dialog.d.mts +21 -0
- package/dist/dialogs/loading-dialog.mjs +2 -0
- package/dist/dialogs/loading-dialog.mjs.map +1 -0
- package/dist/dist-Cx5ufCdr.cjs +2 -0
- package/dist/dist-Cx5ufCdr.cjs.map +1 -0
- package/dist/dist-DVrfqn8H.mjs +2 -0
- package/dist/dist-DVrfqn8H.mjs.map +1 -0
- package/dist/drawer-BB8BZzDG.cjs +2 -0
- package/dist/drawer-BB8BZzDG.cjs.map +1 -0
- package/dist/drawer-CMD7JWH8.mjs +2 -0
- package/dist/drawer-CMD7JWH8.mjs.map +1 -0
- package/dist/dropdown-menu-BWhiVsEf.mjs +2 -0
- package/dist/dropdown-menu-BWhiVsEf.mjs.map +1 -0
- package/dist/dropdown-menu-CVh520yG.cjs +2 -0
- package/dist/dropdown-menu-CVh520yG.cjs.map +1 -0
- package/dist/features/descriptions/index.cjs +1 -1
- package/dist/features/descriptions/index.cjs.map +1 -1
- package/dist/features/descriptions/index.d.cts +4 -4
- package/dist/features/descriptions/index.d.mts +246 -0
- package/dist/features/descriptions/index.mjs +2 -0
- package/dist/features/descriptions/index.mjs.map +1 -0
- package/dist/features/search-modal/index.cjs +1 -1
- package/dist/features/search-modal/index.d.cts +2 -2
- package/dist/features/search-modal/index.d.mts +17 -0
- package/dist/features/search-modal/index.mjs +1 -0
- package/dist/features/tables/index.cjs +1 -1
- package/dist/features/tables/index.d.cts +1 -1
- package/dist/features/tables/index.d.mts +3 -0
- package/dist/features/tables/index.mjs +1 -0
- 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 +2 -0
- package/dist/features/tanstack-form/index.mjs +1 -0
- 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 +2 -0
- package/dist/features/text-editor/index.mjs +1 -0
- package/dist/field-BrlETeXX.cjs +2 -0
- package/dist/field-BrlETeXX.cjs.map +1 -0
- package/dist/field-dYemS0hQ.mjs +2 -0
- package/dist/field-dYemS0hQ.mjs.map +1 -0
- package/dist/flex-B6YSJzGe.mjs +2 -0
- package/dist/flex-B6YSJzGe.mjs.map +1 -0
- package/dist/flex-DmWmOBn5.cjs +2 -0
- package/dist/flex-DmWmOBn5.cjs.map +1 -0
- package/dist/heading-De4Pn3mZ.mjs +2 -0
- package/dist/heading-De4Pn3mZ.mjs.map +1 -0
- package/dist/heading-tGTqk3pA.cjs +2 -0
- package/dist/heading-tGTqk3pA.cjs.map +1 -0
- package/dist/image-D7OZ13Ib.mjs +2 -0
- package/dist/image-D7OZ13Ib.mjs.map +1 -0
- package/dist/image-W_Yb0xTB.cjs +2 -0
- package/dist/image-W_Yb0xTB.cjs.map +1 -0
- package/dist/index-BhiLHeUb.d.cts +1093 -0
- package/dist/index-CiG1i12w.d.cts +85 -0
- package/dist/index-Cl_7tlH_.d.mts +2348 -0
- package/dist/index-Cm62M0Ft.d.mts +90 -0
- package/dist/index-DNozPoRR.d.mts +85 -0
- package/dist/index-DSciiDhn.d.cts +2348 -0
- package/dist/index-DriviV-i.d.mts +1093 -0
- package/dist/index-KO98y6L0.d.cts +90 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +11 -11
- package/dist/index.d.mts +93 -0
- package/dist/index.mjs +1 -0
- package/dist/input-BtuZm0BQ.d.mts +44 -0
- package/dist/input-CD4zf7t1.d.cts +44 -0
- package/dist/input-NJP2wQOm.mjs +2 -0
- package/dist/input-NJP2wQOm.mjs.map +1 -0
- package/dist/input-WJ0DLHTR.cjs +2 -0
- package/dist/input-WJ0DLHTR.cjs.map +1 -0
- package/dist/label-CC6fXVbC.cjs +2 -0
- package/dist/label-CC6fXVbC.cjs.map +1 -0
- package/dist/label-CUCpwS5D.mjs +2 -0
- package/dist/label-CUCpwS5D.mjs.map +1 -0
- package/dist/layouts/cms-layout/index.cjs +1 -1
- package/dist/layouts/cms-layout/index.d.cts +1 -1
- package/dist/layouts/cms-layout/index.d.mts +2 -0
- package/dist/layouts/cms-layout/index.mjs +1 -0
- package/dist/layouts/flex.cjs +1 -1
- package/dist/layouts/flex.d.cts +6 -6
- package/dist/layouts/flex.d.mts +117 -0
- package/dist/layouts/flex.mjs +1 -0
- package/dist/layouts/grid.cjs +1 -1
- package/dist/layouts/grid.d.mts +19 -0
- package/dist/layouts/grid.mjs +2 -0
- package/dist/layouts/grid.mjs.map +1 -0
- package/dist/layouts/payment-layout/index.cjs +1 -1
- package/dist/layouts/payment-layout/index.d.mts +74 -0
- package/dist/layouts/payment-layout/index.mjs +1 -0
- package/dist/pages/FeatureDeveloping.cjs +1 -1
- package/dist/pages/FeatureDeveloping.cjs.map +1 -1
- package/dist/pages/FeatureDeveloping.d.cts +2 -2
- package/dist/pages/FeatureDeveloping.d.mts +43 -0
- package/dist/pages/FeatureDeveloping.mjs +2 -0
- package/dist/pages/FeatureDeveloping.mjs.map +1 -0
- package/dist/pages/FeatureFixing.cjs +1 -1
- package/dist/pages/FeatureFixing.cjs.map +1 -1
- package/dist/pages/FeatureFixing.d.cts +2 -2
- package/dist/pages/FeatureFixing.d.mts +43 -0
- package/dist/pages/FeatureFixing.mjs +2 -0
- package/dist/pages/FeatureFixing.mjs.map +1 -0
- package/dist/pages/LoginPage.cjs +1 -1
- package/dist/pages/LoginPage.cjs.map +1 -1
- package/dist/pages/LoginPage.d.cts +2 -2
- package/dist/pages/LoginPage.d.mts +55 -0
- package/dist/pages/LoginPage.mjs +2 -0
- package/dist/pages/LoginPage.mjs.map +1 -0
- package/dist/pages/NotAuthorized.cjs +1 -1
- package/dist/pages/NotAuthorized.cjs.map +1 -1
- package/dist/pages/NotAuthorized.d.cts +2 -2
- package/dist/pages/NotAuthorized.d.mts +43 -0
- package/dist/pages/NotAuthorized.mjs +2 -0
- package/dist/pages/NotAuthorized.mjs.map +1 -0
- package/dist/pages/NotFound.cjs +1 -1
- package/dist/pages/NotFound.cjs.map +1 -1
- package/dist/pages/NotFound.d.cts +2 -2
- package/dist/pages/NotFound.d.mts +43 -0
- package/dist/pages/NotFound.mjs +2 -0
- package/dist/pages/NotFound.mjs.map +1 -0
- package/dist/pages/RegisterPage.cjs +1 -1
- package/dist/pages/RegisterPage.cjs.map +1 -1
- package/dist/pages/RegisterPage.d.cts +2 -2
- package/dist/pages/RegisterPage.d.mts +52 -0
- package/dist/pages/RegisterPage.mjs +2 -0
- package/dist/pages/RegisterPage.mjs.map +1 -0
- package/dist/pages/VerifyEmailPage.cjs +1 -1
- package/dist/pages/VerifyEmailPage.cjs.map +1 -1
- package/dist/pages/VerifyEmailPage.d.cts +2 -2
- package/dist/pages/VerifyEmailPage.d.mts +64 -0
- package/dist/pages/VerifyEmailPage.mjs +2 -0
- package/dist/pages/VerifyEmailPage.mjs.map +1 -0
- package/dist/paragraph-DYLaQtTV.mjs +2 -0
- package/dist/paragraph-DYLaQtTV.mjs.map +1 -0
- package/dist/paragraph-DvTZvbzw.cjs +2 -0
- package/dist/paragraph-DvTZvbzw.cjs.map +1 -0
- package/dist/payment-layout-DrQ0kZPX.mjs +2 -0
- package/dist/payment-layout-DrQ0kZPX.mjs.map +1 -0
- package/dist/payment-layout-DyILfyVG.cjs +2 -0
- package/dist/payment-layout-DyILfyVG.cjs.map +1 -0
- package/dist/popover-C8rcemA3.mjs +2 -0
- package/dist/popover-C8rcemA3.mjs.map +1 -0
- package/dist/popover-DBsC8Ltp.cjs +2 -0
- package/dist/popover-DBsC8Ltp.cjs.map +1 -0
- package/dist/progress-CLeM0e7Z.mjs +2 -0
- package/dist/progress-CLeM0e7Z.mjs.map +1 -0
- package/dist/progress-gvBqNiHp.cjs +2 -0
- package/dist/progress-gvBqNiHp.cjs.map +1 -0
- package/dist/radio-group-Y9bhdr55.mjs +2 -0
- package/dist/radio-group-Y9bhdr55.mjs.map +1 -0
- package/dist/radio-group-_TdMkv8w.cjs +2 -0
- package/dist/radio-group-_TdMkv8w.cjs.map +1 -0
- package/dist/resizable-CpCaSCFB.mjs +2 -0
- package/dist/resizable-CpCaSCFB.mjs.map +1 -0
- package/dist/resizable-sgpaHAb8.cjs +2 -0
- package/dist/resizable-sgpaHAb8.cjs.map +1 -0
- package/dist/search-modal-B-pzGcfP.cjs +2 -0
- package/dist/search-modal-B-pzGcfP.cjs.map +1 -0
- package/dist/search-modal-Bn-GOOCy.mjs +2 -0
- package/dist/search-modal-Bn-GOOCy.mjs.map +1 -0
- package/dist/select-CWLQHh8x.cjs +2 -0
- package/dist/select-CWLQHh8x.cjs.map +1 -0
- package/dist/select-LlPCZFSF.mjs +2 -0
- package/dist/select-LlPCZFSF.mjs.map +1 -0
- package/dist/separator-D3Gmkxzq.mjs +2 -0
- package/dist/separator-D3Gmkxzq.mjs.map +1 -0
- package/dist/separator-KuymG9g0.cjs +2 -0
- package/dist/separator-KuymG9g0.cjs.map +1 -0
- package/dist/sheet-BFlIfNaA.mjs +2 -0
- package/dist/sheet-BFlIfNaA.mjs.map +1 -0
- package/dist/sheet-CvKSi0UC.cjs +2 -0
- package/dist/sheet-CvKSi0UC.cjs.map +1 -0
- package/dist/sidebar-ChtCyu-n.mjs +2 -0
- package/dist/sidebar-ChtCyu-n.mjs.map +1 -0
- package/dist/sidebar-D5J2gcTw.cjs +2 -0
- package/dist/sidebar-D5J2gcTw.cjs.map +1 -0
- package/dist/skeleton-C51IdOfK.mjs +2 -0
- package/dist/skeleton-C51IdOfK.mjs.map +1 -0
- package/dist/skeleton-CX1USu1w.cjs +2 -0
- package/dist/skeleton-CX1USu1w.cjs.map +1 -0
- package/dist/spinner-CFxorYEt.cjs +2 -0
- package/dist/spinner-CFxorYEt.cjs.map +1 -0
- package/dist/spinner-eClTgHjk.mjs +2 -0
- package/dist/spinner-eClTgHjk.mjs.map +1 -0
- package/dist/statistic-DDXilD7q.cjs +2 -0
- package/dist/statistic-DDXilD7q.cjs.map +1 -0
- package/dist/statistic-cwLwcukn.mjs +2 -0
- package/dist/statistic-cwLwcukn.mjs.map +1 -0
- package/dist/switch-BP7EPatj.mjs +2 -0
- package/dist/switch-BP7EPatj.mjs.map +1 -0
- package/dist/switch-DVfOV7wP.cjs +2 -0
- package/dist/switch-DVfOV7wP.cjs.map +1 -0
- package/dist/systems/google.cjs +1 -1
- package/dist/systems/google.d.mts +53 -0
- package/dist/systems/google.mjs +2 -0
- package/dist/systems/google.mjs.map +1 -0
- package/dist/tables-CFrsk2lM.mjs +4 -0
- package/dist/tables-CFrsk2lM.mjs.map +1 -0
- package/dist/tables-CPKHe3k-.cjs +4 -0
- package/dist/tables-CPKHe3k-.cjs.map +1 -0
- package/dist/tanstack-form-DT1TqIDl.mjs +12 -0
- package/dist/tanstack-form-DT1TqIDl.mjs.map +1 -0
- package/dist/tanstack-form-DatI41wz.cjs +12 -0
- package/dist/tanstack-form-DatI41wz.cjs.map +1 -0
- package/dist/text-editor-5mA7XyaI.mjs +2 -0
- package/dist/text-editor-5mA7XyaI.mjs.map +1 -0
- package/dist/text-editor-CvJN3nSL.cjs +2 -0
- package/dist/text-editor-CvJN3nSL.cjs.map +1 -0
- package/dist/textarea-7HDXcaK9.mjs +2 -0
- package/dist/textarea-7HDXcaK9.mjs.map +1 -0
- package/dist/textarea-Cc9CF8wD.cjs +2 -0
- package/dist/textarea-Cc9CF8wD.cjs.map +1 -0
- package/dist/tooltip-CBdoIzoM.cjs +2 -0
- package/dist/tooltip-CBdoIzoM.cjs.map +1 -0
- package/dist/tooltip-Dxl5Wa8i.mjs +2 -0
- package/dist/tooltip-Dxl5Wa8i.mjs.map +1 -0
- package/dist/types-B5nyTWtO.mjs +2 -0
- package/dist/types-B5nyTWtO.mjs.map +1 -0
- package/dist/types-BD1t0Bj8.cjs +2 -0
- package/dist/types-BD1t0Bj8.cjs.map +1 -0
- package/dist/types-Cc_mLRAn.d.cts +24 -0
- package/dist/types-YLu40dXY.d.mts +24 -0
- package/dist/typography/paragraph.cjs +1 -1
- package/dist/typography/paragraph.d.cts +3 -3
- package/dist/typography/paragraph.d.mts +48 -0
- package/dist/typography/paragraph.mjs +1 -0
- package/dist/typography/title.cjs +1 -1
- package/dist/typography/title.d.mts +43 -0
- package/dist/typography/title.mjs +2 -0
- package/dist/typography/title.mjs.map +1 -0
- package/dist/ui/alert-dialog.cjs +1 -1
- package/dist/ui/alert-dialog.d.cts +12 -12
- package/dist/ui/alert-dialog.d.mts +90 -0
- package/dist/ui/alert-dialog.mjs +2 -0
- package/dist/ui/alert-dialog.mjs.map +1 -0
- package/dist/ui/alert.cjs +1 -1
- package/dist/ui/alert.d.cts +1 -1
- package/dist/ui/alert.d.mts +2 -0
- package/dist/ui/alert.mjs +1 -0
- package/dist/ui/aspect-ratio.cjs +1 -1
- package/dist/ui/aspect-ratio.d.cts +2 -2
- package/dist/ui/aspect-ratio.d.mts +24 -0
- package/dist/ui/aspect-ratio.mjs +2 -0
- package/dist/ui/aspect-ratio.mjs.map +1 -0
- package/dist/ui/avatar.cjs +1 -2
- package/dist/ui/avatar.d.cts +4 -4
- package/dist/ui/avatar.d.mts +35 -0
- package/dist/ui/avatar.mjs +1 -0
- package/dist/ui/badge.cjs +1 -2
- package/dist/ui/badge.d.cts +2 -42
- package/dist/ui/badge.d.mts +2 -0
- package/dist/ui/badge.mjs +1 -0
- package/dist/ui/breadcrumb.cjs +1 -1
- package/dist/ui/breadcrumb.cjs.map +1 -1
- package/dist/ui/breadcrumb.d.cts +8 -8
- package/dist/ui/breadcrumb.d.mts +72 -0
- package/dist/ui/breadcrumb.mjs +2 -0
- package/dist/ui/breadcrumb.mjs.map +1 -0
- package/dist/ui/button-group.cjs +1 -1
- package/dist/ui/button-group.cjs.map +1 -1
- package/dist/ui/button-group.d.cts +7 -7
- package/dist/ui/button-group.d.mts +50 -0
- package/dist/ui/button-group.mjs +2 -0
- package/dist/ui/button-group.mjs.map +1 -0
- package/dist/ui/button.cjs +1 -2
- package/dist/ui/button.d.cts +1 -1
- package/dist/ui/button.d.mts +2 -0
- package/dist/ui/button.mjs +1 -0
- package/dist/ui/buttons/add-new.cjs +1 -1
- package/dist/ui/buttons/add-new.cjs.map +1 -1
- package/dist/ui/buttons/add-new.d.mts +17 -0
- package/dist/ui/buttons/add-new.mjs +2 -0
- package/dist/ui/buttons/add-new.mjs.map +1 -0
- package/dist/ui/buttons/edit.cjs +1 -1
- package/dist/ui/buttons/edit.cjs.map +1 -1
- package/dist/ui/buttons/edit.d.mts +17 -0
- package/dist/ui/buttons/edit.mjs +2 -0
- package/dist/ui/buttons/edit.mjs.map +1 -0
- package/dist/ui/buttons/refresh.cjs +1 -1
- package/dist/ui/buttons/refresh.cjs.map +1 -1
- package/dist/ui/buttons/refresh.d.mts +17 -0
- package/dist/ui/buttons/refresh.mjs +2 -0
- package/dist/ui/buttons/refresh.mjs.map +1 -0
- package/dist/ui/buttons/trash.cjs +1 -1
- package/dist/ui/buttons/trash.cjs.map +1 -1
- package/dist/ui/buttons/trash.d.mts +17 -0
- package/dist/ui/buttons/trash.mjs +2 -0
- package/dist/ui/buttons/trash.mjs.map +1 -0
- package/dist/ui/buttons/upload-image.cjs +1 -1
- package/dist/ui/buttons/upload-image.cjs.map +1 -1
- package/dist/ui/buttons/upload-image.d.mts +24 -0
- package/dist/ui/buttons/upload-image.mjs +2 -0
- package/dist/ui/buttons/upload-image.mjs.map +1 -0
- package/dist/ui/calendar.cjs +1 -2
- package/dist/ui/calendar.d.cts +4 -4
- package/dist/ui/calendar.d.mts +45 -0
- package/dist/ui/calendar.mjs +1 -0
- package/dist/ui/card.cjs +1 -1
- package/dist/ui/card.d.cts +8 -8
- package/dist/ui/card.d.mts +63 -0
- package/dist/ui/card.mjs +2 -0
- package/dist/ui/card.mjs.map +1 -0
- package/dist/ui/carousel.cjs +1 -1
- package/dist/ui/carousel.cjs.map +1 -1
- package/dist/ui/carousel.d.cts +7 -7
- package/dist/ui/carousel.d.mts +71 -0
- package/dist/ui/carousel.mjs +2 -0
- package/dist/ui/carousel.mjs.map +1 -0
- package/dist/ui/checkbox.cjs +1 -2
- package/dist/ui/checkbox.d.cts +2 -2
- package/dist/ui/checkbox.d.mts +26 -0
- package/dist/ui/checkbox.mjs +1 -0
- package/dist/ui/collapsible.cjs +1 -1
- package/dist/ui/collapsible.d.cts +4 -4
- package/dist/ui/collapsible.d.mts +34 -0
- package/dist/ui/collapsible.mjs +2 -0
- package/dist/ui/collapsible.mjs.map +1 -0
- package/dist/ui/command.cjs +1 -2
- package/dist/ui/command.d.cts +11 -11
- package/dist/ui/command.d.mts +89 -0
- package/dist/ui/command.mjs +1 -0
- package/dist/ui/context-menu.cjs +1 -1
- package/dist/ui/context-menu.d.cts +16 -16
- package/dist/ui/context-menu.d.mts +125 -0
- package/dist/ui/context-menu.mjs +2 -0
- package/dist/ui/context-menu.mjs.map +1 -0
- package/dist/ui/dialog.cjs +1 -2
- package/dist/ui/dialog.d.cts +2 -90
- package/dist/ui/dialog.d.mts +2 -0
- package/dist/ui/dialog.mjs +1 -0
- package/dist/ui/drawer.cjs +1 -2
- package/dist/ui/drawer.d.cts +11 -11
- package/dist/ui/drawer.d.mts +72 -0
- package/dist/ui/drawer.mjs +1 -0
- package/dist/ui/dropdown-menu.cjs +1 -2
- package/dist/ui/dropdown-menu.d.cts +16 -16
- package/dist/ui/dropdown-menu.d.mts +127 -0
- package/dist/ui/dropdown-menu.mjs +1 -0
- package/dist/ui/empty.cjs +1 -1
- package/dist/ui/empty.d.cts +7 -7
- package/dist/ui/empty.d.mts +68 -0
- package/dist/ui/empty.mjs +2 -0
- package/dist/ui/empty.mjs.map +1 -0
- package/dist/ui/field.cjs +1 -1
- package/dist/ui/field.d.cts +24 -24
- package/dist/ui/field.d.mts +65 -0
- package/dist/ui/field.mjs +1 -0
- package/dist/ui/file-uploader.cjs +2 -2
- package/dist/ui/file-uploader.cjs.map +1 -1
- package/dist/ui/file-uploader.d.cts +2 -2
- package/dist/ui/file-uploader.d.mts +103 -0
- package/dist/ui/file-uploader.mjs +3 -0
- package/dist/ui/file-uploader.mjs.map +1 -0
- package/dist/ui/form.cjs +1 -1
- package/dist/ui/form.cjs.map +1 -1
- package/dist/ui/form.d.cts +10 -10
- package/dist/ui/form.d.mts +112 -0
- package/dist/ui/form.mjs +2 -0
- package/dist/ui/form.mjs.map +1 -0
- package/dist/ui/hover-card.cjs +1 -1
- package/dist/ui/hover-card.d.cts +4 -4
- package/dist/ui/hover-card.d.mts +37 -0
- package/dist/ui/hover-card.mjs +2 -0
- package/dist/ui/hover-card.mjs.map +1 -0
- package/dist/ui/image.cjs +1 -2
- package/dist/ui/image.d.mts +36 -0
- package/dist/ui/image.mjs +1 -0
- package/dist/ui/input-otp.cjs +1 -1
- package/dist/ui/input-otp.d.cts +5 -5
- package/dist/ui/input-otp.d.mts +59 -0
- package/dist/ui/input-otp.mjs +2 -0
- package/dist/ui/input-otp.mjs.map +1 -0
- package/dist/ui/input.cjs +1 -2
- package/dist/ui/input.d.cts +2 -44
- package/dist/ui/input.d.mts +2 -0
- package/dist/ui/input.mjs +1 -0
- package/dist/ui/inputs/search-input.cjs +1 -1
- package/dist/ui/inputs/search-input.cjs.map +1 -1
- package/dist/ui/inputs/search-input.d.cts +3 -3
- package/dist/ui/inputs/search-input.d.mts +29 -0
- package/dist/ui/inputs/search-input.mjs +2 -0
- package/dist/ui/inputs/search-input.mjs.map +1 -0
- package/dist/ui/item.cjs +1 -1
- package/dist/ui/item.cjs.map +1 -1
- package/dist/ui/item.d.cts +17 -17
- package/dist/ui/item.d.mts +102 -0
- package/dist/ui/item.mjs +2 -0
- package/dist/ui/item.mjs.map +1 -0
- package/dist/ui/label.cjs +1 -2
- package/dist/ui/label.d.cts +2 -2
- package/dist/ui/label.d.mts +24 -0
- package/dist/ui/label.mjs +1 -0
- package/dist/ui/menubar.cjs +1 -1
- package/dist/ui/menubar.d.cts +17 -17
- package/dist/ui/menubar.d.mts +135 -0
- package/dist/ui/menubar.mjs +2 -0
- package/dist/ui/menubar.mjs.map +1 -0
- package/dist/ui/multi-select.cjs +1 -1
- package/dist/ui/multi-select.cjs.map +1 -1
- package/dist/ui/multi-select.d.cts +3 -3
- package/dist/ui/multi-select.d.mts +118 -0
- package/dist/ui/multi-select.mjs +2 -0
- package/dist/ui/multi-select.mjs.map +1 -0
- package/dist/ui/navigation-menu.cjs +1 -1
- package/dist/ui/navigation-menu.d.cts +11 -11
- package/dist/ui/navigation-menu.d.mts +77 -0
- package/dist/ui/navigation-menu.mjs +2 -0
- package/dist/ui/navigation-menu.mjs.map +1 -0
- package/dist/ui/pagination.cjs +1 -1
- package/dist/ui/pagination.d.cts +9 -9
- package/dist/ui/pagination.d.mts +67 -0
- package/dist/ui/pagination.mjs +2 -0
- package/dist/ui/pagination.mjs.map +1 -0
- package/dist/ui/popover.cjs +1 -2
- package/dist/ui/popover.d.cts +6 -6
- package/dist/ui/popover.d.mts +52 -0
- package/dist/ui/popover.mjs +1 -0
- package/dist/ui/progress.cjs +1 -2
- package/dist/ui/progress.d.cts +2 -2
- package/dist/ui/progress.d.mts +23 -0
- package/dist/ui/progress.mjs +1 -0
- package/dist/ui/radio-group.cjs +1 -2
- package/dist/ui/radio-group.d.cts +3 -3
- package/dist/ui/radio-group.d.mts +37 -0
- package/dist/ui/radio-group.mjs +1 -0
- package/dist/ui/resizable.cjs +1 -2
- package/dist/ui/resizable.d.cts +9 -9
- package/dist/ui/resizable.d.mts +63 -0
- package/dist/ui/resizable.mjs +1 -0
- package/dist/ui/scroll-area.cjs +1 -1
- package/dist/ui/scroll-area.d.cts +5 -5
- package/dist/ui/scroll-area.d.mts +37 -0
- package/dist/ui/scroll-area.mjs +2 -0
- package/dist/ui/scroll-area.mjs.map +1 -0
- package/dist/ui/select.cjs +1 -2
- package/dist/ui/select.d.cts +9 -9
- package/dist/ui/select.d.mts +77 -0
- package/dist/ui/select.mjs +1 -0
- package/dist/ui/separator.cjs +1 -2
- package/dist/ui/separator.d.cts +2 -2
- package/dist/ui/separator.d.mts +34 -0
- package/dist/ui/separator.mjs +1 -0
- package/dist/ui/sheet.cjs +1 -2
- package/dist/ui/sheet.d.cts +9 -9
- package/dist/ui/sheet.d.mts +69 -0
- package/dist/ui/sheet.mjs +1 -0
- package/dist/ui/skeleton.cjs +1 -1
- package/dist/ui/skeleton.d.cts +2 -2
- package/dist/ui/skeleton.d.mts +27 -0
- package/dist/ui/skeleton.mjs +1 -0
- package/dist/ui/slider.cjs +1 -1
- package/dist/ui/slider.d.cts +2 -2
- package/dist/ui/slider.d.mts +26 -0
- package/dist/ui/slider.mjs +2 -0
- package/dist/ui/slider.mjs.map +1 -0
- package/dist/ui/sonner.cjs +1 -1
- package/dist/ui/sonner.d.cts +2 -2
- package/dist/ui/sonner.d.mts +24 -0
- package/dist/ui/sonner.mjs +2 -0
- package/dist/ui/sonner.mjs.map +1 -0
- package/dist/ui/spinner.cjs +1 -2
- package/dist/ui/spinner.d.cts +2 -2
- package/dist/ui/spinner.d.mts +25 -0
- package/dist/ui/spinner.mjs +1 -0
- package/dist/ui/switch.cjs +1 -2
- package/dist/ui/switch.d.cts +2 -2
- package/dist/ui/switch.d.mts +26 -0
- package/dist/ui/switch.mjs +1 -0
- package/dist/ui/table.cjs +1 -1
- package/dist/ui/table.d.cts +17 -17
- package/dist/ui/table.d.mts +73 -0
- package/dist/ui/table.mjs +2 -0
- package/dist/ui/table.mjs.map +1 -0
- package/dist/ui/tabs.cjs +1 -1
- package/dist/ui/tabs.d.cts +5 -5
- package/dist/ui/tabs.d.mts +44 -0
- package/dist/ui/tabs.mjs +2 -0
- package/dist/ui/tabs.mjs.map +1 -0
- package/dist/ui/textarea.cjs +1 -2
- package/dist/ui/textarea.d.cts +2 -2
- package/dist/ui/textarea.d.mts +30 -0
- package/dist/ui/textarea.mjs +1 -0
- package/dist/ui/toggle-group.cjs +1 -1
- package/dist/ui/toggle-group.cjs.map +1 -1
- package/dist/ui/toggle-group.d.cts +4 -4
- package/dist/ui/toggle-group.d.mts +39 -0
- package/dist/ui/toggle-group.mjs +2 -0
- package/dist/ui/toggle-group.mjs.map +1 -0
- package/dist/ui/toggle.cjs +1 -1
- package/dist/ui/toggle.d.cts +5 -5
- package/dist/ui/toggle.d.mts +32 -0
- package/dist/ui/toggle.mjs +2 -0
- package/dist/ui/toggle.mjs.map +1 -0
- package/dist/ui/tooltip.cjs +1 -2
- package/dist/ui/tooltip.d.cts +5 -5
- package/dist/ui/tooltip.d.mts +55 -0
- package/dist/ui/tooltip.mjs +1 -0
- package/dist/user-DtZy4P9d.mjs +2 -0
- package/dist/user-DtZy4P9d.mjs.map +1 -0
- package/dist/user-ii4FBhO1.cjs +2 -0
- package/dist/user-ii4FBhO1.cjs.map +1 -0
- package/package.json +100 -100
- package/dist/alert-BVsYpWFX.d.cts +0 -88
- package/dist/alert-D5VmhFT9.js +0 -2
- package/dist/alert-D5VmhFT9.js.map +0 -1
- package/dist/alert-DXmXDeGs.d.ts +0 -88
- package/dist/alert-JwECRZfz.cjs +0 -2
- package/dist/alert-JwECRZfz.cjs.map +0 -1
- package/dist/button-BBfGvggN.d.ts +0 -174
- package/dist/button-BEjRVw6s.d.cts +0 -174
- package/dist/button.variants-BruXd4VM.js +0 -2
- package/dist/button.variants-BruXd4VM.js.map +0 -1
- package/dist/button.variants-DgVFNsVc.cjs +0 -2
- package/dist/button.variants-DgVFNsVc.cjs.map +0 -1
- package/dist/cards/grid-product-card.d.ts +0 -37
- package/dist/cards/grid-product-card.js +0 -2
- package/dist/cards/grid-product-card.js.map +0 -1
- package/dist/cards/product-card.d.ts +0 -37
- package/dist/cards/product-card.js +0 -2
- package/dist/cards/product-card.js.map +0 -1
- package/dist/cards/simple-card.d.ts +0 -35
- package/dist/cards/simple-card.js +0 -2
- package/dist/cards/simple-card.js.map +0 -1
- package/dist/chunk-Bmb41Sf3.cjs +0 -1
- package/dist/close-Dflkky9q.cjs +0 -2
- package/dist/close-Dflkky9q.cjs.map +0 -1
- package/dist/close-DrkwaVXK.js +0 -2
- package/dist/close-DrkwaVXK.js.map +0 -1
- package/dist/cms-layout-B8maJRLp.cjs +0 -2
- package/dist/cms-layout-B8maJRLp.cjs.map +0 -1
- package/dist/cms-layout-CLeGdpMb.js +0 -2
- package/dist/cms-layout-CLeGdpMb.js.map +0 -1
- package/dist/data-display/country.d.ts +0 -22
- package/dist/data-display/country.js +0 -2
- package/dist/data-display/country.js.map +0 -1
- package/dist/data-display/data-list.d.ts +0 -43
- package/dist/data-display/data-list.js +0 -2
- package/dist/data-display/data-list.js.map +0 -1
- package/dist/data-display/date-tooltip.d.ts +0 -19
- package/dist/data-display/date-tooltip.js +0 -2
- package/dist/data-display/date-tooltip.js.map +0 -1
- package/dist/data-display/date.cjs.map +0 -1
- package/dist/data-display/date.d.ts +0 -39
- package/dist/data-display/date.js +0 -2
- package/dist/data-display/date.js.map +0 -1
- package/dist/data-display/empty.d.ts +0 -21
- package/dist/data-display/empty.js +0 -2
- package/dist/data-display/empty.js.map +0 -1
- package/dist/data-display/name.d.ts +0 -19
- package/dist/data-display/name.js +0 -2
- package/dist/data-display/name.js.map +0 -1
- package/dist/data-display/phone-number.d.ts +0 -19
- package/dist/data-display/phone-number.js +0 -2
- package/dist/data-display/phone-number.js.map +0 -1
- package/dist/data-display/role-badge.d.ts +0 -22
- package/dist/data-display/role-badge.js +0 -2
- package/dist/data-display/role-badge.js.map +0 -1
- package/dist/data-display/statistic.cjs.map +0 -1
- package/dist/data-display/statistic.d.ts +0 -57
- package/dist/data-display/statistic.js +0 -2
- package/dist/data-display/statistic.js.map +0 -1
- package/dist/data-display/user.cjs.map +0 -1
- package/dist/data-display/user.d.ts +0 -23
- package/dist/data-display/user.js +0 -2
- package/dist/data-display/user.js.map +0 -1
- package/dist/dialogs/confirm-dialog.d.ts +0 -142
- package/dist/dialogs/confirm-dialog.js +0 -2
- package/dist/dialogs/confirm-dialog.js.map +0 -1
- package/dist/dialogs/detail-dialog/components/sidebar.d.ts +0 -209
- package/dist/dialogs/detail-dialog/components/sidebar.js +0 -1
- package/dist/dialogs/detail-dialog/index.d.ts +0 -45
- package/dist/dialogs/detail-dialog/index.js +0 -2
- package/dist/dialogs/detail-dialog/index.js.map +0 -1
- package/dist/dialogs/error-dialog.d.ts +0 -25
- package/dist/dialogs/error-dialog.js +0 -2
- package/dist/dialogs/error-dialog.js.map +0 -1
- package/dist/dialogs/loading-dialog.d.ts +0 -21
- package/dist/dialogs/loading-dialog.js +0 -2
- package/dist/dialogs/loading-dialog.js.map +0 -1
- package/dist/features/descriptions/index.d.ts +0 -246
- package/dist/features/descriptions/index.js +0 -2
- package/dist/features/descriptions/index.js.map +0 -1
- package/dist/features/search-modal/index.d.ts +0 -17
- package/dist/features/search-modal/index.js +0 -1
- package/dist/features/tables/index.d.ts +0 -2
- package/dist/features/tables/index.js +0 -1
- package/dist/features/tanstack-form/index.d.ts +0 -2
- package/dist/features/tanstack-form/index.js +0 -1
- package/dist/features/text-editor/index.d.ts +0 -2
- package/dist/features/text-editor/index.js +0 -1
- package/dist/field-0gaEKxov.cjs +0 -2
- package/dist/field-0gaEKxov.cjs.map +0 -1
- package/dist/field-DG-kX3HU.js +0 -2
- package/dist/field-DG-kX3HU.js.map +0 -1
- package/dist/flex-BAfCk_in.cjs +0 -2
- package/dist/flex-BAfCk_in.cjs.map +0 -1
- package/dist/flex-D_XtSjf4.js +0 -2
- package/dist/flex-D_XtSjf4.js.map +0 -1
- package/dist/heading-BX7ZVnVg.cjs +0 -2
- package/dist/heading-BX7ZVnVg.cjs.map +0 -1
- package/dist/heading-Bw3eo6IT.js +0 -2
- package/dist/heading-Bw3eo6IT.js.map +0 -1
- package/dist/index--eHW_BCk.d.ts +0 -85
- package/dist/index-C257sc-c.d.ts +0 -90
- package/dist/index-C4ZFmaZm.d.cts +0 -2348
- package/dist/index-DWEpRM8i.d.cts +0 -1093
- package/dist/index-DnQeeNHV.d.ts +0 -1093
- package/dist/index-_MFRCXuJ.d.cts +0 -85
- package/dist/index-rNI5ia8r.d.cts +0 -90
- package/dist/index-rZ2RtGJp.d.ts +0 -2348
- package/dist/index.d.ts +0 -93
- package/dist/index.js +0 -1
- package/dist/layouts/cms-layout/index.d.ts +0 -2
- package/dist/layouts/cms-layout/index.js +0 -1
- package/dist/layouts/flex.d.ts +0 -117
- package/dist/layouts/flex.js +0 -1
- package/dist/layouts/grid.d.ts +0 -19
- package/dist/layouts/grid.js +0 -2
- package/dist/layouts/grid.js.map +0 -1
- package/dist/layouts/payment-layout/index.d.ts +0 -74
- package/dist/layouts/payment-layout/index.js +0 -1
- package/dist/pages/FeatureDeveloping.d.ts +0 -43
- package/dist/pages/FeatureDeveloping.js +0 -2
- package/dist/pages/FeatureDeveloping.js.map +0 -1
- package/dist/pages/FeatureFixing.d.ts +0 -43
- package/dist/pages/FeatureFixing.js +0 -2
- package/dist/pages/FeatureFixing.js.map +0 -1
- package/dist/pages/LoginPage.d.ts +0 -55
- package/dist/pages/LoginPage.js +0 -2
- package/dist/pages/LoginPage.js.map +0 -1
- package/dist/pages/NotAuthorized.d.ts +0 -43
- package/dist/pages/NotAuthorized.js +0 -2
- package/dist/pages/NotAuthorized.js.map +0 -1
- package/dist/pages/NotFound.d.ts +0 -43
- package/dist/pages/NotFound.js +0 -2
- package/dist/pages/NotFound.js.map +0 -1
- package/dist/pages/RegisterPage.d.ts +0 -52
- package/dist/pages/RegisterPage.js +0 -2
- package/dist/pages/RegisterPage.js.map +0 -1
- package/dist/pages/VerifyEmailPage.d.ts +0 -64
- package/dist/pages/VerifyEmailPage.js +0 -2
- package/dist/pages/VerifyEmailPage.js.map +0 -1
- package/dist/paragraph-D0x3Jc6W.cjs +0 -2
- package/dist/paragraph-D0x3Jc6W.cjs.map +0 -1
- package/dist/paragraph-ESjXXqHU.js +0 -2
- package/dist/paragraph-ESjXXqHU.js.map +0 -1
- package/dist/payment-layout-CksJbGsl.js +0 -2
- package/dist/payment-layout-CksJbGsl.js.map +0 -1
- package/dist/payment-layout-O7TNw2Cr.cjs +0 -2
- package/dist/payment-layout-O7TNw2Cr.cjs.map +0 -1
- package/dist/search-modal-Db8Xp2L4.cjs +0 -2
- package/dist/search-modal-Db8Xp2L4.cjs.map +0 -1
- package/dist/search-modal-DdonKbwA.js +0 -2
- package/dist/search-modal-DdonKbwA.js.map +0 -1
- package/dist/sidebar-BCuXtop_.js +0 -2
- package/dist/sidebar-BCuXtop_.js.map +0 -1
- package/dist/sidebar-CQZlWCK4.cjs +0 -2
- package/dist/sidebar-CQZlWCK4.cjs.map +0 -1
- package/dist/skeleton-DAcbjBGp.js +0 -2
- package/dist/skeleton-DAcbjBGp.js.map +0 -1
- package/dist/skeleton-oQFT4xR2.cjs +0 -2
- package/dist/skeleton-oQFT4xR2.cjs.map +0 -1
- package/dist/systems/google.d.ts +0 -53
- package/dist/systems/google.js +0 -2
- package/dist/systems/google.js.map +0 -1
- package/dist/tables-DbwtCMRI.js +0 -4
- package/dist/tables-DbwtCMRI.js.map +0 -1
- package/dist/tables-DgZbLZQP.cjs +0 -4
- package/dist/tables-DgZbLZQP.cjs.map +0 -1
- package/dist/tanstack-form-C3SGhsmN.cjs +0 -2
- package/dist/tanstack-form-C3SGhsmN.cjs.map +0 -1
- package/dist/tanstack-form-Ds_Zjt20.js +0 -2
- package/dist/tanstack-form-Ds_Zjt20.js.map +0 -1
- package/dist/text-editor-DhTxCxvH.cjs +0 -2
- package/dist/text-editor-DhTxCxvH.cjs.map +0 -1
- package/dist/text-editor-DwisU9_U.js +0 -2
- package/dist/text-editor-DwisU9_U.js.map +0 -1
- package/dist/typography/paragraph.d.ts +0 -48
- package/dist/typography/paragraph.js +0 -1
- package/dist/typography/title.d.ts +0 -43
- package/dist/typography/title.js +0 -2
- package/dist/typography/title.js.map +0 -1
- package/dist/ui/alert-dialog.d.ts +0 -90
- package/dist/ui/alert-dialog.js +0 -2
- package/dist/ui/alert-dialog.js.map +0 -1
- package/dist/ui/alert.d.ts +0 -2
- package/dist/ui/alert.js +0 -1
- package/dist/ui/aspect-ratio.d.ts +0 -24
- package/dist/ui/aspect-ratio.js +0 -2
- package/dist/ui/aspect-ratio.js.map +0 -1
- package/dist/ui/avatar.cjs.map +0 -1
- package/dist/ui/avatar.d.ts +0 -35
- package/dist/ui/avatar.js +0 -2
- package/dist/ui/avatar.js.map +0 -1
- package/dist/ui/badge.cjs.map +0 -1
- package/dist/ui/badge.d.ts +0 -42
- package/dist/ui/badge.js +0 -2
- package/dist/ui/badge.js.map +0 -1
- package/dist/ui/breadcrumb.d.ts +0 -72
- package/dist/ui/breadcrumb.js +0 -2
- package/dist/ui/breadcrumb.js.map +0 -1
- package/dist/ui/button-group.d.ts +0 -50
- package/dist/ui/button-group.js +0 -2
- package/dist/ui/button-group.js.map +0 -1
- package/dist/ui/button.cjs.map +0 -1
- package/dist/ui/button.d.ts +0 -2
- package/dist/ui/button.js +0 -2
- package/dist/ui/button.js.map +0 -1
- package/dist/ui/buttons/add-new.d.ts +0 -17
- package/dist/ui/buttons/add-new.js +0 -2
- package/dist/ui/buttons/add-new.js.map +0 -1
- package/dist/ui/buttons/edit.d.ts +0 -17
- package/dist/ui/buttons/edit.js +0 -2
- package/dist/ui/buttons/edit.js.map +0 -1
- package/dist/ui/buttons/refresh.d.ts +0 -17
- package/dist/ui/buttons/refresh.js +0 -2
- package/dist/ui/buttons/refresh.js.map +0 -1
- package/dist/ui/buttons/trash.d.ts +0 -17
- package/dist/ui/buttons/trash.js +0 -2
- package/dist/ui/buttons/trash.js.map +0 -1
- package/dist/ui/buttons/upload-image.d.ts +0 -24
- package/dist/ui/buttons/upload-image.js +0 -2
- package/dist/ui/buttons/upload-image.js.map +0 -1
- package/dist/ui/calendar.cjs.map +0 -1
- package/dist/ui/calendar.d.ts +0 -45
- package/dist/ui/calendar.js +0 -2
- package/dist/ui/calendar.js.map +0 -1
- package/dist/ui/card.d.ts +0 -63
- package/dist/ui/card.js +0 -2
- package/dist/ui/card.js.map +0 -1
- package/dist/ui/carousel.d.ts +0 -71
- package/dist/ui/carousel.js +0 -2
- package/dist/ui/carousel.js.map +0 -1
- package/dist/ui/checkbox.cjs.map +0 -1
- package/dist/ui/checkbox.d.ts +0 -26
- package/dist/ui/checkbox.js +0 -2
- package/dist/ui/checkbox.js.map +0 -1
- package/dist/ui/collapsible.d.ts +0 -34
- package/dist/ui/collapsible.js +0 -2
- package/dist/ui/collapsible.js.map +0 -1
- package/dist/ui/command.cjs.map +0 -1
- package/dist/ui/command.d.ts +0 -89
- package/dist/ui/command.js +0 -2
- package/dist/ui/command.js.map +0 -1
- package/dist/ui/context-menu.d.ts +0 -125
- package/dist/ui/context-menu.js +0 -2
- package/dist/ui/context-menu.js.map +0 -1
- package/dist/ui/dialog.cjs.map +0 -1
- package/dist/ui/dialog.d.ts +0 -90
- package/dist/ui/dialog.js +0 -2
- package/dist/ui/dialog.js.map +0 -1
- package/dist/ui/drawer.cjs.map +0 -1
- package/dist/ui/drawer.d.ts +0 -72
- package/dist/ui/drawer.js +0 -2
- package/dist/ui/drawer.js.map +0 -1
- package/dist/ui/dropdown-menu.cjs.map +0 -1
- package/dist/ui/dropdown-menu.d.ts +0 -127
- package/dist/ui/dropdown-menu.js +0 -2
- package/dist/ui/dropdown-menu.js.map +0 -1
- package/dist/ui/empty.d.ts +0 -68
- package/dist/ui/empty.js +0 -2
- package/dist/ui/empty.js.map +0 -1
- package/dist/ui/field.d.ts +0 -65
- package/dist/ui/field.js +0 -1
- package/dist/ui/file-uploader.d.ts +0 -103
- package/dist/ui/file-uploader.js +0 -3
- package/dist/ui/file-uploader.js.map +0 -1
- package/dist/ui/form.d.ts +0 -112
- package/dist/ui/form.js +0 -2
- package/dist/ui/form.js.map +0 -1
- package/dist/ui/hover-card.d.ts +0 -37
- package/dist/ui/hover-card.js +0 -2
- package/dist/ui/hover-card.js.map +0 -1
- package/dist/ui/image.cjs.map +0 -1
- package/dist/ui/image.d.ts +0 -36
- package/dist/ui/image.js +0 -2
- package/dist/ui/image.js.map +0 -1
- package/dist/ui/input-otp.d.ts +0 -59
- package/dist/ui/input-otp.js +0 -2
- package/dist/ui/input-otp.js.map +0 -1
- package/dist/ui/input.cjs.map +0 -1
- package/dist/ui/input.d.ts +0 -44
- package/dist/ui/input.js +0 -2
- package/dist/ui/input.js.map +0 -1
- package/dist/ui/inputs/search-input.d.ts +0 -29
- package/dist/ui/inputs/search-input.js +0 -2
- package/dist/ui/inputs/search-input.js.map +0 -1
- package/dist/ui/item.d.ts +0 -102
- package/dist/ui/item.js +0 -2
- package/dist/ui/item.js.map +0 -1
- package/dist/ui/label.cjs.map +0 -1
- package/dist/ui/label.d.ts +0 -24
- package/dist/ui/label.js +0 -2
- package/dist/ui/label.js.map +0 -1
- package/dist/ui/menubar.d.ts +0 -135
- package/dist/ui/menubar.js +0 -2
- package/dist/ui/menubar.js.map +0 -1
- package/dist/ui/multi-select.d.ts +0 -117
- package/dist/ui/multi-select.js +0 -2
- package/dist/ui/multi-select.js.map +0 -1
- package/dist/ui/navigation-menu.d.ts +0 -77
- package/dist/ui/navigation-menu.js +0 -2
- package/dist/ui/navigation-menu.js.map +0 -1
- package/dist/ui/pagination.d.ts +0 -67
- package/dist/ui/pagination.js +0 -2
- package/dist/ui/pagination.js.map +0 -1
- package/dist/ui/popover.cjs.map +0 -1
- package/dist/ui/popover.d.ts +0 -52
- package/dist/ui/popover.js +0 -2
- package/dist/ui/popover.js.map +0 -1
- package/dist/ui/progress.cjs.map +0 -1
- package/dist/ui/progress.d.ts +0 -23
- package/dist/ui/progress.js +0 -2
- package/dist/ui/progress.js.map +0 -1
- package/dist/ui/radio-group.cjs.map +0 -1
- package/dist/ui/radio-group.d.ts +0 -37
- package/dist/ui/radio-group.js +0 -2
- package/dist/ui/radio-group.js.map +0 -1
- package/dist/ui/resizable.cjs.map +0 -1
- package/dist/ui/resizable.d.ts +0 -63
- package/dist/ui/resizable.js +0 -2
- package/dist/ui/resizable.js.map +0 -1
- package/dist/ui/scroll-area.d.ts +0 -37
- package/dist/ui/scroll-area.js +0 -2
- package/dist/ui/scroll-area.js.map +0 -1
- package/dist/ui/select.cjs.map +0 -1
- package/dist/ui/select.d.ts +0 -77
- package/dist/ui/select.js +0 -2
- package/dist/ui/select.js.map +0 -1
- package/dist/ui/separator.cjs.map +0 -1
- package/dist/ui/separator.d.ts +0 -34
- package/dist/ui/separator.js +0 -2
- package/dist/ui/separator.js.map +0 -1
- package/dist/ui/sheet.cjs.map +0 -1
- package/dist/ui/sheet.d.ts +0 -69
- package/dist/ui/sheet.js +0 -2
- package/dist/ui/sheet.js.map +0 -1
- package/dist/ui/skeleton.d.ts +0 -27
- package/dist/ui/skeleton.js +0 -1
- package/dist/ui/slider.d.ts +0 -26
- package/dist/ui/slider.js +0 -2
- package/dist/ui/slider.js.map +0 -1
- package/dist/ui/sonner.d.ts +0 -24
- package/dist/ui/sonner.js +0 -2
- package/dist/ui/sonner.js.map +0 -1
- package/dist/ui/spinner.cjs.map +0 -1
- package/dist/ui/spinner.d.ts +0 -25
- package/dist/ui/spinner.js +0 -2
- package/dist/ui/spinner.js.map +0 -1
- package/dist/ui/switch.cjs.map +0 -1
- package/dist/ui/switch.d.ts +0 -26
- package/dist/ui/switch.js +0 -2
- package/dist/ui/switch.js.map +0 -1
- package/dist/ui/table.d.ts +0 -73
- package/dist/ui/table.js +0 -2
- package/dist/ui/table.js.map +0 -1
- package/dist/ui/tabs.d.ts +0 -44
- package/dist/ui/tabs.js +0 -2
- package/dist/ui/tabs.js.map +0 -1
- package/dist/ui/textarea.cjs.map +0 -1
- package/dist/ui/textarea.d.ts +0 -30
- package/dist/ui/textarea.js +0 -2
- package/dist/ui/textarea.js.map +0 -1
- package/dist/ui/toggle-group.d.ts +0 -39
- package/dist/ui/toggle-group.js +0 -2
- package/dist/ui/toggle-group.js.map +0 -1
- package/dist/ui/toggle.d.ts +0 -32
- package/dist/ui/toggle.js +0 -2
- package/dist/ui/toggle.js.map +0 -1
- package/dist/ui/tooltip.cjs.map +0 -1
- package/dist/ui/tooltip.d.ts +0 -55
- package/dist/ui/tooltip.js +0 -2
- package/dist/ui/tooltip.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-uploader.cjs","names":["Dropzone","Upload","Image","Trash2","Progress","Button","FileText"],"sources":["../../packages/components/ui/file-uploader.tsx"],"sourcesContent":["'use client';\nimport { useCallback, useEffect } from 'react';\nimport Dropzone, { type DropzoneProps, type FileRejection } from 'react-dropzone';\nimport { useControllableState } from '@customafk/react-toolkit/hooks/useControllableState';\nimport { cn, formatBytes } from '@customafk/react-toolkit/utils';\n\nimport { FileText, Image, Trash2, Upload } from 'lucide-react';\nimport { toast } from 'sonner';\n\nimport { Button } from '@/components/ui/button';\nimport { Progress } from '@/components/ui/progress';\n\n/**\n * Props for the FileUploader component.\n *\n * @example\n * ```tsx\n * import { FileUploader } from '@customafk/lunas-ui/ui/file-uploader';\n *\n * <FileUploader\n * accept={{ 'image/*': [] }}\n * maxSize={1024 * 1024 * 5}\n * maxFileCount={3}\n * multiple\n * onUpload={async (files) => { await uploadFiles(files); }}\n * />\n * ```\n */\ninterface FileUploaderProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Value of the uploader.\n * @type File[]\n * @default undefined\n * @example value={files}\n */\n value?: File[];\n\n /**\n * Function to be called when the value changes.\n * @type (files: File[]) => void\n * @default undefined\n * @example onValueChange={(files) => setFiles(files)}\n */\n onValueChange?: (files: File[]) => void;\n\n /**\n * Function to be called when files are uploaded.\n * @type (files: File[]) => Promise<void>\n * @default undefined\n * @example onUpload={(files) => uploadFiles(files)}\n */\n onUpload?: (files: File[]) => Promise<void>;\n\n /**\n * Progress of the uploaded files.\n * @type Record<string, number> | undefined\n * @default undefined\n * @example progresses={{ \"file1.png\": 50 }}\n */\n progresses?: Record<string, number>;\n\n /**\n * Accepted file types for the uploader.\n * @type { [key: string]: string[]}\n * @default\n * ```ts\n * { \"image/*\": [] }\n * ```\n * @example accept={[\"image/png\", \"image/jpeg\"]}\n */\n accept?: DropzoneProps['accept'];\n\n /**\n * Maximum file size for the uploader.\n * @type number | undefined\n * @default 1024 * 1024 * 2 // 2MB\n * @example maxSize={1024 * 1024 * 2} // 2MB\n */\n maxSize?: DropzoneProps['maxSize'];\n\n /**\n * Maximum number of files for the uploader.\n * @type number | undefined\n * @default 1\n * @example maxFileCount={4}\n */\n maxFileCount?: DropzoneProps['maxFiles'];\n\n /**\n * Whether the uploader should accept multiple files.\n * @type boolean\n * @default false\n * @example multiple\n */\n multiple?: boolean;\n\n /**\n * Whether the uploader is disabled.\n * @type boolean\n * @default false\n * @example disabled\n */\n disabled?: boolean;\n\n /**\n * Whether to show the instructional drag-and-drop text inside the drop zone.\n * @default true\n */\n showText?: boolean;\n /** Size in pixels for the upload icon. */\n iconSize?: number;\n}\n\n/**\n * A drag-and-drop file upload zone that manages file selection, validation, preview generation, and optional async upload with progress tracking.\n */\nexport function FileUploader(props: FileUploaderProps) {\n const {\n value: valueProp,\n onValueChange,\n onUpload,\n progresses,\n accept = {\n 'image/*': [],\n },\n maxSize = 1024 * 1024 * 2,\n maxFileCount = 1,\n multiple = false,\n disabled = false,\n showText = true,\n iconSize,\n className,\n ...dropzoneProps\n } = props;\n\n const [files, setFiles] = useControllableState({\n prop: valueProp,\n onChange: onValueChange,\n });\n\n const onDrop = useCallback(\n (acceptedFiles: File[], rejectedFiles: FileRejection[]) => {\n if (!multiple && maxFileCount === 1 && acceptedFiles.length > 1) {\n toast.error('Cannot upload more than 1 file at a time');\n\n return;\n }\n\n if ((files?.length ?? 0) + acceptedFiles.length > maxFileCount) {\n toast.error(`Cannot upload more than ${maxFileCount} files`);\n return;\n }\n\n const newFiles = acceptedFiles.map(file =>\n Object.assign(file, {\n preview: URL.createObjectURL(file),\n })\n );\n\n const updatedFiles = files ? [...files, ...newFiles] : newFiles;\n\n setFiles(updatedFiles);\n\n if (rejectedFiles.length > 0) {\n rejectedFiles.forEach(({ file }) => {\n toast.error(`File ${file.name} was rejected`);\n });\n }\n\n if (onUpload && updatedFiles.length > 0 && updatedFiles.length <= maxFileCount) {\n const target = updatedFiles.length > 0 ? `${updatedFiles.length} files` : `file`;\n\n onUpload(updatedFiles).then(() => {\n setFiles([]);\n toast(`${target} uploaded`);\n });\n }\n },\n\n [files, maxFileCount, multiple, onUpload, setFiles]\n );\n\n function onRemove(index: number) {\n if (!files) return;\n\n if (isFileWithPreview(files[index])) {\n URL.revokeObjectURL(files[index].preview);\n }\n\n const newFiles = files.filter((_, i) => i !== index);\n setFiles(newFiles);\n onValueChange?.(newFiles);\n }\n\n // Revoke preview url when component unmounts\n useEffect(() => {\n return () => {\n if (!files) return;\n files.forEach(file => {\n if (isFileWithPreview(file)) {\n URL.revokeObjectURL(file.preview);\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const isDisabled = disabled || (files?.length ?? 0) >= maxFileCount;\n\n return (\n <div className=\"relative flex w-full flex-col gap-6\">\n <Dropzone onDrop={onDrop} accept={accept} maxSize={maxSize} maxFiles={maxFileCount} multiple={maxFileCount > 1 || multiple} disabled={isDisabled}>\n {({ getRootProps, getInputProps, isDragActive }) => (\n <div\n {...getRootProps()}\n className={cn(\n 'group',\n 'border-border-weak',\n 'hover:bg-border-weak/20',\n 'relative grid h-52 w-full cursor-pointer place-items-center rounded-lg border-2 border-dashed px-5 py-2.5 text-center transition',\n 'ring-offset-background',\n 'focus-visible:ring-primary-weak',\n 'focus-visible:ring-2',\n 'focus-visible:ring-offset-2',\n 'focus-visible:outline-hidden',\n isDragActive && 'border-border-primary-strong bg-border-weak/40',\n isDisabled && 'pointer-events-none opacity-60',\n className\n )}\n {...dropzoneProps}\n >\n <input {...getInputProps()} />\n {isDragActive ? (\n <div className=\"flex flex-col items-center justify-center gap-4 sm:px-5\">\n <div className=\"rounded-full border border-dashed p-3\">\n <Upload className=\"text-text-positive-muted size-7\" aria-hidden=\"true\" />\n </div>\n <p className=\"text-text-positive-muted font-medium\">Drop the files here</p>\n </div>\n ) : (\n <div className=\"flex flex-col items-center justify-center gap-4 sm:px-5\">\n <div className=\"rounded-full border border-dashed p-3\">\n <Upload size={iconSize || 24} className=\"text-muted-foreground\" aria-hidden=\"true\" />\n </div>\n {showText && (\n <div className=\"flex flex-col gap-px\">\n <p className=\"text-text-positive-weak text-xs font-medium\">Drag {`'n'`} drop files here, or click to select files</p>\n <p className=\"text-text-positive-muted text-xs\">\n You can upload\n {maxFileCount > 1\n ? ` ${maxFileCount === Infinity ? 'multiple' : maxFileCount}\n files (up to ${formatBytes(maxSize)} each)`\n : ` a file with ${formatBytes(maxSize)}`}\n </p>\n </div>\n )}\n </div>\n )}\n </div>\n )}\n </Dropzone>\n {files?.length ? (\n <div className=\"h-fit w-full overflow-y-auto\">\n <div className=\"flex items-center justify-between px-3 py-2.5\">\n <div className=\"text-text-positive-weak flex items-center gap-1\">\n <Image size={16} aria-hidden=\"true\" />\n <p className=\"text-sm\">Ảnh đã tải lên ({files.length})</p>\n </div>\n <button\n className=\"hover:text-text-positive text-text-positive-muted flex cursor-pointer items-center gap-1 transition-colors duration-200\"\n onClick={() => {\n if (!files) return;\n files.forEach(file => {\n if (!isFileWithPreview(file)) return;\n URL.revokeObjectURL(file.preview);\n });\n setFiles([]);\n onValueChange?.([]);\n }}\n >\n <Trash2 size={16} aria-hidden=\"true\" />\n <p className=\"text-sm\">Xóa tất cả</p>\n </button>\n </div>\n <div className=\"flex flex-col gap-2.5\">\n {files?.map((file, index) => (\n <FileCard key={index} file={file} onRemove={() => onRemove(index)} progress={progresses?.[file.name]} />\n ))}\n </div>\n </div>\n ) : null}\n </div>\n );\n}\n\ninterface FileCardProps {\n file: File;\n onRemove: () => void;\n progress?: number;\n}\n\nfunction FileCard({ file, progress, onRemove }: FileCardProps) {\n return (\n <div className=\"border-border-weak hover:border-border relative flex items-center gap-4 rounded-md border py-2 pr-3 pl-2 shadow-xs transition-colors\">\n <div className=\"flex flex-1 gap-2.5\">\n {isFileWithPreview(file) ? <FilePreview file={file} /> : null}\n <div className=\"flex w-full flex-col gap-2\">\n <div className=\"flex flex-col gap-y-0.5\">\n <p className=\"text-text-positive line-clamp-1 text-sm\">{file.name}</p>\n <p className=\"text-text-positive-muted text-xs\">{formatBytes(file.size)}</p>\n </div>\n {progress ? <Progress value={progress} /> : null}\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <Button type=\"button\" variant=\"ghost\" color=\"secondary\" size=\"icon\" className=\"size-7\" onClick={onRemove}>\n <Trash2 size={16} className=\"text-text-positive-muted\" aria-hidden=\"true\" />\n <span className=\"sr-only\">Remove file</span>\n </Button>\n </div>\n </div>\n );\n}\n\nfunction isFileWithPreview(file: File): file is File & { preview: string } {\n return 'preview' in file && typeof file.preview === 'string';\n}\n\ninterface FilePreviewProps {\n file: File & { preview: string };\n}\n\nfunction FilePreview({ file }: FilePreviewProps) {\n if (file.type.startsWith('image/')) {\n return <img src={file.preview} className=\"border-border aspect-square size-10 shrink-0 rounded border object-cover object-top shadow-sm\" />;\n }\n\n return <FileText className=\"text-text-positive-muted size-10 border\" aria-hidden=\"true\" />;\n}\n"],"mappings":"0XAoHA,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ACb,EAAA,EAAA,MAAC,MAAA,CAAI,UAAU,qCACb,EAAA,EAAA,KAAC,IAAA,CAAE,UAAU,mDAA2C,EAAK,MAAS,EACtE,EAAA,EAAA,KAAC,IAAA,CAAE,UAAU,8DAAgD,EAAK,KAAK,EAAK,CAAA,EACxE,CACL,GAAW,EAAA,EAAA,KAACC,EAAAA,SAAAA,CAAS,MAAO,EAAA,CAAY,CAAG,KAAA,EACxC,CAAA,EACF,EACN,EAAA,EAAA,KAAC,MAAA,CAAI,UAAU,oCACb,EAAA,EAAA,MAACC,EAAAA,OAAAA,CAAO,KAAK,SAAS,QAAQ,QAAQ,MAAM,YAAY,KAAK,OAAO,UAAU,SAAS,QAAS,aAC9F,EAAA,EAAA,KAACF,EAAAA,OAAAA,CAAO,KAAM,GAAI,UAAU,2BAA2B,cAAY,QAAS,EAC5E,EAAA,EAAA,KAAC,OAAA,CAAK,UAAU,mBAAU,eAAkB,CAAA,EACrC,EACL,CAAA,EACF,CAIV,SAAS,EAAkB,EAAgD,CACzE,MAAO,YAAa,GAAQ,OAAO,EAAK,SAAY,SAOtD,SAAS,EAAY,CAAE,QAA0B,CAK/C,OAJI,EAAK,KAAK,WAAW,SAAS,EACzB,EAAA,EAAA,KAAC,MAAA,CAAI,IAAK,EAAK,QAAS,UAAU,iGAAkG,EAGtI,EAAA,EAAA,KAACG,EAAAA,SAAAA,CAAS,UAAU,0CAA0C,cAAY,QAAS"}
|
|
1
|
+
{"version":3,"file":"file-uploader.cjs","names":["Dropzone","Upload","Image","Trash2","Progress","Button","FileText"],"sources":["../../packages/components/ui/file-uploader.tsx"],"sourcesContent":["'use client';\nimport { useCallback, useEffect } from 'react';\nimport Dropzone, { type DropzoneProps, type FileRejection } from 'react-dropzone';\nimport { useControllableState } from '@customafk/react-toolkit/hooks/useControllableState';\nimport { cn, formatBytes } from '@customafk/react-toolkit/utils';\n\nimport { FileText, Image, Trash2, Upload } from 'lucide-react';\nimport { toast } from 'sonner';\n\nimport { Button } from '@/components/ui/button';\nimport { Progress } from '@/components/ui/progress';\n\n/**\n * Props for the FileUploader component.\n *\n * @example\n * ```tsx\n * import { FileUploader } from '@customafk/lunas-ui/ui/file-uploader';\n *\n * <FileUploader\n * accept={{ 'image/*': [] }}\n * maxSize={1024 * 1024 * 5}\n * maxFileCount={3}\n * multiple\n * onUpload={async (files) => { await uploadFiles(files); }}\n * />\n * ```\n */\ninterface FileUploaderProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Value of the uploader.\n * @type File[]\n * @default undefined\n * @example value={files}\n */\n value?: File[];\n\n /**\n * Function to be called when the value changes.\n * @type (files: File[]) => void\n * @default undefined\n * @example onValueChange={(files) => setFiles(files)}\n */\n onValueChange?: (files: File[]) => void;\n\n /**\n * Function to be called when files are uploaded.\n * @type (files: File[]) => Promise<void>\n * @default undefined\n * @example onUpload={(files) => uploadFiles(files)}\n */\n onUpload?: (files: File[]) => Promise<void>;\n\n /**\n * Progress of the uploaded files.\n * @type Record<string, number> | undefined\n * @default undefined\n * @example progresses={{ \"file1.png\": 50 }}\n */\n progresses?: Record<string, number>;\n\n /**\n * Accepted file types for the uploader.\n * @type { [key: string]: string[]}\n * @default\n * ```ts\n * { \"image/*\": [] }\n * ```\n * @example accept={[\"image/png\", \"image/jpeg\"]}\n */\n accept?: DropzoneProps['accept'];\n\n /**\n * Maximum file size for the uploader.\n * @type number | undefined\n * @default 1024 * 1024 * 2 // 2MB\n * @example maxSize={1024 * 1024 * 2} // 2MB\n */\n maxSize?: DropzoneProps['maxSize'];\n\n /**\n * Maximum number of files for the uploader.\n * @type number | undefined\n * @default 1\n * @example maxFileCount={4}\n */\n maxFileCount?: DropzoneProps['maxFiles'];\n\n /**\n * Whether the uploader should accept multiple files.\n * @type boolean\n * @default false\n * @example multiple\n */\n multiple?: boolean;\n\n /**\n * Whether the uploader is disabled.\n * @type boolean\n * @default false\n * @example disabled\n */\n disabled?: boolean;\n\n /**\n * Whether to show the instructional drag-and-drop text inside the drop zone.\n * @default true\n */\n showText?: boolean;\n /** Size in pixels for the upload icon. */\n iconSize?: number;\n}\n\n/**\n * A drag-and-drop file upload zone that manages file selection, validation, preview generation, and optional async upload with progress tracking.\n */\nexport function FileUploader(props: FileUploaderProps) {\n const {\n value: valueProp,\n onValueChange,\n onUpload,\n progresses,\n accept = {\n 'image/*': [],\n },\n maxSize = 1024 * 1024 * 2,\n maxFileCount = 1,\n multiple = false,\n disabled = false,\n showText = true,\n iconSize,\n className,\n ...dropzoneProps\n } = props;\n\n const [files, setFiles] = useControllableState({\n prop: valueProp,\n onChange: onValueChange,\n });\n\n const onDrop = useCallback(\n (acceptedFiles: File[], rejectedFiles: FileRejection[]) => {\n if (!multiple && maxFileCount === 1 && acceptedFiles.length > 1) {\n toast.error('Cannot upload more than 1 file at a time');\n\n return;\n }\n\n if ((files?.length ?? 0) + acceptedFiles.length > maxFileCount) {\n toast.error(`Cannot upload more than ${maxFileCount} files`);\n return;\n }\n\n const newFiles = acceptedFiles.map(file =>\n Object.assign(file, {\n preview: URL.createObjectURL(file),\n })\n );\n\n const updatedFiles = files ? [...files, ...newFiles] : newFiles;\n\n setFiles(updatedFiles);\n\n if (rejectedFiles.length > 0) {\n rejectedFiles.forEach(({ file }) => {\n toast.error(`File ${file.name} was rejected`);\n });\n }\n\n if (onUpload && updatedFiles.length > 0 && updatedFiles.length <= maxFileCount) {\n const target = updatedFiles.length > 0 ? `${updatedFiles.length} files` : `file`;\n\n onUpload(updatedFiles).then(() => {\n setFiles([]);\n toast(`${target} uploaded`);\n });\n }\n },\n\n [files, maxFileCount, multiple, onUpload, setFiles]\n );\n\n function onRemove(index: number) {\n if (!files) return;\n\n if (isFileWithPreview(files[index])) {\n URL.revokeObjectURL(files[index].preview);\n }\n\n const newFiles = files.filter((_, i) => i !== index);\n setFiles(newFiles);\n onValueChange?.(newFiles);\n }\n\n // Revoke preview url when component unmounts\n useEffect(() => {\n return () => {\n if (!files) return;\n files.forEach(file => {\n if (isFileWithPreview(file)) {\n URL.revokeObjectURL(file.preview);\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const isDisabled = disabled || (files?.length ?? 0) >= maxFileCount;\n\n return (\n <div className=\"relative flex w-full flex-col gap-6\">\n <Dropzone onDrop={onDrop} accept={accept} maxSize={maxSize} maxFiles={maxFileCount} multiple={maxFileCount > 1 || multiple} disabled={isDisabled}>\n {({ getRootProps, getInputProps, isDragActive }) => (\n <div\n {...getRootProps()}\n className={cn(\n 'group',\n 'border-border-weak',\n 'hover:bg-border-weak/20',\n 'relative grid h-52 w-full cursor-pointer place-items-center rounded-lg border-2 border-dashed px-5 py-2.5 text-center transition',\n 'ring-offset-background',\n 'focus-visible:ring-primary-weak',\n 'focus-visible:ring-2',\n 'focus-visible:ring-offset-2',\n 'focus-visible:outline-hidden',\n isDragActive && 'border-border-primary-strong bg-border-weak/40',\n isDisabled && 'pointer-events-none opacity-60',\n className\n )}\n {...dropzoneProps}\n >\n <input {...getInputProps()} />\n {isDragActive ? (\n <div className=\"flex flex-col items-center justify-center gap-4 sm:px-5\">\n <div className=\"rounded-full border border-dashed p-3\">\n <Upload className=\"text-text-positive-muted size-7\" aria-hidden=\"true\" />\n </div>\n <p className=\"text-text-positive-muted font-medium\">Drop the files here</p>\n </div>\n ) : (\n <div className=\"flex flex-col items-center justify-center gap-4 sm:px-5\">\n <div className=\"rounded-full border border-dashed p-3\">\n <Upload size={iconSize || 24} className=\"text-muted-foreground\" aria-hidden=\"true\" />\n </div>\n {showText && (\n <div className=\"flex flex-col gap-px\">\n <p className=\"text-text-positive-weak text-xs font-medium\">Drag {`'n'`} drop files here, or click to select files</p>\n <p className=\"text-text-positive-muted text-xs\">\n You can upload\n {maxFileCount > 1\n ? ` ${maxFileCount === Infinity ? 'multiple' : maxFileCount}\n files (up to ${formatBytes(maxSize)} each)`\n : ` a file with ${formatBytes(maxSize)}`}\n </p>\n </div>\n )}\n </div>\n )}\n </div>\n )}\n </Dropzone>\n {files?.length ? (\n <div className=\"h-fit w-full overflow-y-auto\">\n <div className=\"flex items-center justify-between px-3 py-2.5\">\n <div className=\"text-text-positive-weak flex items-center gap-1\">\n <Image size={16} aria-hidden=\"true\" />\n <p className=\"text-sm\">Ảnh đã tải lên ({files.length})</p>\n </div>\n <button\n className=\"hover:text-text-positive text-text-positive-muted flex cursor-pointer items-center gap-1 transition-colors duration-200\"\n onClick={() => {\n if (!files) return;\n files.forEach(file => {\n if (!isFileWithPreview(file)) return;\n URL.revokeObjectURL(file.preview);\n });\n setFiles([]);\n onValueChange?.([]);\n }}\n >\n <Trash2 size={16} aria-hidden=\"true\" />\n <p className=\"text-sm\">Xóa tất cả</p>\n </button>\n </div>\n <div className=\"flex flex-col gap-2.5\">\n {files?.map((file, index) => (\n <FileCard key={index} file={file} onRemove={() => onRemove(index)} progress={progresses?.[file.name]} />\n ))}\n </div>\n </div>\n ) : null}\n </div>\n );\n}\n\ninterface FileCardProps {\n file: File;\n onRemove: () => void;\n progress?: number;\n}\n\nfunction FileCard({ file, progress, onRemove }: FileCardProps) {\n return (\n <div className=\"border-border-weak hover:border-border relative flex items-center gap-4 rounded-md border py-2 pr-3 pl-2 shadow-xs transition-colors\">\n <div className=\"flex flex-1 gap-2.5\">\n {isFileWithPreview(file) ? <FilePreview file={file} /> : null}\n <div className=\"flex w-full flex-col gap-2\">\n <div className=\"flex flex-col gap-y-0.5\">\n <p className=\"text-text-positive line-clamp-1 text-sm\">{file.name}</p>\n <p className=\"text-text-positive-muted text-xs\">{formatBytes(file.size)}</p>\n </div>\n {progress ? <Progress value={progress} /> : null}\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <Button type=\"button\" variant=\"ghost\" color=\"secondary\" size=\"icon\" className=\"size-7\" onClick={onRemove}>\n <Trash2 size={16} className=\"text-text-positive-muted\" aria-hidden=\"true\" />\n <span className=\"sr-only\">Remove file</span>\n </Button>\n </div>\n </div>\n );\n}\n\nfunction isFileWithPreview(file: File): file is File & { preview: string } {\n return 'preview' in file && typeof file.preview === 'string';\n}\n\ninterface FilePreviewProps {\n file: File & { preview: string };\n}\n\nfunction FilePreview({ file }: FilePreviewProps) {\n if (file.type.startsWith('image/')) {\n return <img src={file.preview} className=\"border-border aspect-square size-10 shrink-0 rounded border object-cover object-top shadow-sm\" />;\n }\n\n return <FileText className=\"text-text-positive-muted size-10 border\" aria-hidden=\"true\" />;\n}\n"],"mappings":"2aAoHA,SAAgB,EAAa,EAA0B,CACrD,GAAM,CACJ,MAAO,EACP,gBACA,WACA,aACA,SAAS,CACP,UAAW,EAAE,CACd,CACD,UAAU,KAAO,KAAO,EACxB,eAAe,EACf,WAAW,GACX,WAAW,GACX,WAAW,GACX,WACA,YACA,GAAG,GACD,EAEE,CAAC,EAAO,IAAA,EAAA,EAAA,sBAAiC,CAC7C,KAAM,EACN,SAAU,EACX,CAAC,CAEI,GAAA,EAAA,EAAA,cACH,EAAuB,IAAmC,CACzD,GAAI,CAAC,GAAY,IAAiB,GAAK,EAAc,OAAS,EAAG,CAC/D,EAAA,MAAM,MAAM,2CAA2C,CAEvD,OAGF,IAAK,GAAO,QAAU,GAAK,EAAc,OAAS,EAAc,CAC9D,EAAA,MAAM,MAAM,2BAA2B,EAAa,QAAQ,CAC5D,OAGF,IAAM,EAAW,EAAc,IAAI,GACjC,OAAO,OAAO,EAAM,CAClB,QAAS,IAAI,gBAAgB,EAAK,CACnC,CAAC,CACH,CAEK,EAAe,EAAQ,CAAC,GAAG,EAAO,GAAG,EAAS,CAAG,EAUvD,GARA,EAAS,EAAa,CAElB,EAAc,OAAS,GACzB,EAAc,SAAS,CAAE,UAAW,CAClC,EAAA,MAAM,MAAM,QAAQ,EAAK,KAAK,eAAe,EAC7C,CAGA,GAAY,EAAa,OAAS,GAAK,EAAa,QAAU,EAAc,CAC9E,IAAM,EAAS,EAAa,OAAS,EAAI,GAAG,EAAa,OAAO,QAAU,OAE1E,EAAS,EAAa,CAAC,SAAW,CAChC,EAAS,EAAE,CAAC,EACZ,EAAA,EAAA,OAAM,GA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zone";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/ui/file-uploader.d.ts
|
|
@@ -97,7 +97,7 @@ interface FileUploaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
97
97
|
/**
|
|
98
98
|
* A drag-and-drop file upload zone that manages file selection, validation, preview generation, and optional async upload with progress tracking.
|
|
99
99
|
*/
|
|
100
|
-
declare function FileUploader(props: FileUploaderProps):
|
|
100
|
+
declare function FileUploader(props: FileUploaderProps): react121.JSX.Element;
|
|
101
101
|
//#endregion
|
|
102
102
|
export { FileUploader };
|
|
103
103
|
//# sourceMappingURL=file-uploader.d.cts.map
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as react229 from "react";
|
|
2
|
+
import { DropzoneProps } from "react-dropzone";
|
|
3
|
+
|
|
4
|
+
//#region packages/components/ui/file-uploader.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Props for the FileUploader component.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { FileUploader } from '@customafk/lunas-ui/ui/file-uploader';
|
|
12
|
+
*
|
|
13
|
+
* <FileUploader
|
|
14
|
+
* accept={{ 'image/*': [] }}
|
|
15
|
+
* maxSize={1024 * 1024 * 5}
|
|
16
|
+
* maxFileCount={3}
|
|
17
|
+
* multiple
|
|
18
|
+
* onUpload={async (files) => { await uploadFiles(files); }}
|
|
19
|
+
* />
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
interface FileUploaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
23
|
+
/**
|
|
24
|
+
* Value of the uploader.
|
|
25
|
+
* @type File[]
|
|
26
|
+
* @default undefined
|
|
27
|
+
* @example value={files}
|
|
28
|
+
*/
|
|
29
|
+
value?: File[];
|
|
30
|
+
/**
|
|
31
|
+
* Function to be called when the value changes.
|
|
32
|
+
* @type (files: File[]) => void
|
|
33
|
+
* @default undefined
|
|
34
|
+
* @example onValueChange={(files) => setFiles(files)}
|
|
35
|
+
*/
|
|
36
|
+
onValueChange?: (files: File[]) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Function to be called when files are uploaded.
|
|
39
|
+
* @type (files: File[]) => Promise<void>
|
|
40
|
+
* @default undefined
|
|
41
|
+
* @example onUpload={(files) => uploadFiles(files)}
|
|
42
|
+
*/
|
|
43
|
+
onUpload?: (files: File[]) => Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Progress of the uploaded files.
|
|
46
|
+
* @type Record<string, number> | undefined
|
|
47
|
+
* @default undefined
|
|
48
|
+
* @example progresses={{ "file1.png": 50 }}
|
|
49
|
+
*/
|
|
50
|
+
progresses?: Record<string, number>;
|
|
51
|
+
/**
|
|
52
|
+
* Accepted file types for the uploader.
|
|
53
|
+
* @type { [key: string]: string[]}
|
|
54
|
+
* @default
|
|
55
|
+
* ```ts
|
|
56
|
+
* { "image/*": [] }
|
|
57
|
+
* ```
|
|
58
|
+
* @example accept={["image/png", "image/jpeg"]}
|
|
59
|
+
*/
|
|
60
|
+
accept?: DropzoneProps['accept'];
|
|
61
|
+
/**
|
|
62
|
+
* Maximum file size for the uploader.
|
|
63
|
+
* @type number | undefined
|
|
64
|
+
* @default 1024 * 1024 * 2 // 2MB
|
|
65
|
+
* @example maxSize={1024 * 1024 * 2} // 2MB
|
|
66
|
+
*/
|
|
67
|
+
maxSize?: DropzoneProps['maxSize'];
|
|
68
|
+
/**
|
|
69
|
+
* Maximum number of files for the uploader.
|
|
70
|
+
* @type number | undefined
|
|
71
|
+
* @default 1
|
|
72
|
+
* @example maxFileCount={4}
|
|
73
|
+
*/
|
|
74
|
+
maxFileCount?: DropzoneProps['maxFiles'];
|
|
75
|
+
/**
|
|
76
|
+
* Whether the uploader should accept multiple files.
|
|
77
|
+
* @type boolean
|
|
78
|
+
* @default false
|
|
79
|
+
* @example multiple
|
|
80
|
+
*/
|
|
81
|
+
multiple?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Whether the uploader is disabled.
|
|
84
|
+
* @type boolean
|
|
85
|
+
* @default false
|
|
86
|
+
* @example disabled
|
|
87
|
+
*/
|
|
88
|
+
disabled?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Whether to show the instructional drag-and-drop text inside the drop zone.
|
|
91
|
+
* @default true
|
|
92
|
+
*/
|
|
93
|
+
showText?: boolean;
|
|
94
|
+
/** Size in pixels for the upload icon. */
|
|
95
|
+
iconSize?: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* A drag-and-drop file upload zone that manages file selection, validation, preview generation, and optional async upload with progress tracking.
|
|
99
|
+
*/
|
|
100
|
+
declare function FileUploader(props: FileUploaderProps): react229.JSX.Element;
|
|
101
|
+
//#endregion
|
|
102
|
+
export { FileUploader };
|
|
103
|
+
//# sourceMappingURL=file-uploader.d.mts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";import"../button.variants-DkMqWB8G.mjs";import{t as e}from"../button-CCVJTHBI.mjs";import{t}from"../progress-CLeM0e7Z.mjs";import{FileText as n,Image as r,Trash2 as i,Upload as a}from"lucide-react";import{useCallback as o,useEffect as s}from"react";import{cn as c,formatBytes as l}from"@customafk/react-toolkit/utils";import{jsx as u,jsxs as d}from"react/jsx-runtime";import f from"react-dropzone";import{useControllableState as p}from"@customafk/react-toolkit/hooks/useControllableState";import{toast as m}from"sonner";function h(e){let{value:t,onValueChange:n,onUpload:h,progresses:v,accept:y={"image/*":[]},maxSize:b=1024*1024*2,maxFileCount:x=1,multiple:S=!1,disabled:C=!1,showText:w=!0,iconSize:T,className:E,...D}=e,[O,k]=p({prop:t,onChange:n}),A=o((e,t)=>{if(!S&&x===1&&e.length>1){m.error(`Cannot upload more than 1 file at a time`);return}if((O?.length??0)+e.length>x){m.error(`Cannot upload more than ${x} files`);return}let n=e.map(e=>Object.assign(e,{preview:URL.createObjectURL(e)})),r=O?[...O,...n]:n;if(k(r),t.length>0&&t.forEach(({file:e})=>{m.error(`File ${e.name} was rejected`)}),h&&r.length>0&&r.length<=x){let e=r.length>0?`${r.length} files`:`file`;h(r).then(()=>{k([]),m(`${e} uploaded`)})}},[O,x,S,h,k]);function j(e){if(!O)return;_(O[e])&&URL.revokeObjectURL(O[e].preview);let t=O.filter((t,n)=>n!==e);k(t),n?.(t)}s(()=>()=>{O&&O.forEach(e=>{_(e)&&URL.revokeObjectURL(e.preview)})},[]);let M=C||(O?.length??0)>=x;return d(`div`,{className:`relative flex w-full flex-col gap-6`,children:[u(f,{onDrop:A,accept:y,maxSize:b,maxFiles:x,multiple:x>1||S,disabled:M,children:({getRootProps:e,getInputProps:t,isDragActive:n})=>d(`div`,{...e(),className:c(`group`,`border-border-weak`,`hover:bg-border-weak/20`,`relative grid h-52 w-full cursor-pointer place-items-center rounded-lg border-2 border-dashed px-5 py-2.5 text-center transition`,`ring-offset-background`,`focus-visible:ring-primary-weak`,`focus-visible:ring-2`,`focus-visible:ring-offset-2`,`focus-visible:outline-hidden`,n&&`border-border-primary-strong bg-border-weak/40`,M&&`pointer-events-none opacity-60`,E),...D,children:[u(`input`,{...t()}),n?d(`div`,{className:`flex flex-col items-center justify-center gap-4 sm:px-5`,children:[u(`div`,{className:`rounded-full border border-dashed p-3`,children:u(a,{className:`text-text-positive-muted size-7`,"aria-hidden":`true`})}),u(`p`,{className:`text-text-positive-muted font-medium`,children:`Drop the files here`})]}):d(`div`,{className:`flex flex-col items-center justify-center gap-4 sm:px-5`,children:[u(`div`,{className:`rounded-full border border-dashed p-3`,children:u(a,{size:T||24,className:`text-muted-foreground`,"aria-hidden":`true`})}),w&&d(`div`,{className:`flex flex-col gap-px`,children:[d(`p`,{className:`text-text-positive-weak text-xs font-medium`,children:[`Drag `,`'n'`,` drop files here, or click to select files`]}),d(`p`,{className:`text-text-positive-muted text-xs`,children:[`You can upload`,x>1?` ${x===1/0?`multiple`:x}
|
|
2
|
+
files (up to ${l(b)} each)`:` a file with ${l(b)}`]})]})]})]})}),O?.length?d(`div`,{className:`h-fit w-full overflow-y-auto`,children:[d(`div`,{className:`flex items-center justify-between px-3 py-2.5`,children:[d(`div`,{className:`text-text-positive-weak flex items-center gap-1`,children:[u(r,{size:16,"aria-hidden":`true`}),d(`p`,{className:`text-sm`,children:[`Ảnh đã tải lên (`,O.length,`)`]})]}),d(`button`,{className:`hover:text-text-positive text-text-positive-muted flex cursor-pointer items-center gap-1 transition-colors duration-200`,onClick:()=>{O&&(O.forEach(e=>{_(e)&&URL.revokeObjectURL(e.preview)}),k([]),n?.([]))},children:[u(i,{size:16,"aria-hidden":`true`}),u(`p`,{className:`text-sm`,children:`Xóa tất cả`})]})]}),u(`div`,{className:`flex flex-col gap-2.5`,children:O?.map((e,t)=>u(g,{file:e,onRemove:()=>j(t),progress:v?.[e.name]},t))})]}):null]})}function g({file:n,progress:r,onRemove:a}){return d(`div`,{className:`border-border-weak hover:border-border relative flex items-center gap-4 rounded-md border py-2 pr-3 pl-2 shadow-xs transition-colors`,children:[d(`div`,{className:`flex flex-1 gap-2.5`,children:[_(n)?u(v,{file:n}):null,d(`div`,{className:`flex w-full flex-col gap-2`,children:[d(`div`,{className:`flex flex-col gap-y-0.5`,children:[u(`p`,{className:`text-text-positive line-clamp-1 text-sm`,children:n.name}),u(`p`,{className:`text-text-positive-muted text-xs`,children:l(n.size)})]}),r?u(t,{value:r}):null]})]}),u(`div`,{className:`flex items-center gap-2`,children:d(e,{type:`button`,variant:`ghost`,color:`secondary`,size:`icon`,className:`size-7`,onClick:a,children:[u(i,{size:16,className:`text-text-positive-muted`,"aria-hidden":`true`}),u(`span`,{className:`sr-only`,children:`Remove file`})]})})]})}function _(e){return`preview`in e&&typeof e.preview==`string`}function v({file:e}){return e.type.startsWith(`image/`)?u(`img`,{src:e.preview,className:`border-border aspect-square size-10 shrink-0 rounded border object-cover object-top shadow-sm`}):u(n,{className:`text-text-positive-muted size-10 border`,"aria-hidden":`true`})}export{h as FileUploader};
|
|
3
|
+
//# sourceMappingURL=file-uploader.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-uploader.mjs","names":[],"sources":["../../packages/components/ui/file-uploader.tsx"],"sourcesContent":["'use client';\nimport { useCallback, useEffect } from 'react';\nimport Dropzone, { type DropzoneProps, type FileRejection } from 'react-dropzone';\nimport { useControllableState } from '@customafk/react-toolkit/hooks/useControllableState';\nimport { cn, formatBytes } from '@customafk/react-toolkit/utils';\n\nimport { FileText, Image, Trash2, Upload } from 'lucide-react';\nimport { toast } from 'sonner';\n\nimport { Button } from '@/components/ui/button';\nimport { Progress } from '@/components/ui/progress';\n\n/**\n * Props for the FileUploader component.\n *\n * @example\n * ```tsx\n * import { FileUploader } from '@customafk/lunas-ui/ui/file-uploader';\n *\n * <FileUploader\n * accept={{ 'image/*': [] }}\n * maxSize={1024 * 1024 * 5}\n * maxFileCount={3}\n * multiple\n * onUpload={async (files) => { await uploadFiles(files); }}\n * />\n * ```\n */\ninterface FileUploaderProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * Value of the uploader.\n * @type File[]\n * @default undefined\n * @example value={files}\n */\n value?: File[];\n\n /**\n * Function to be called when the value changes.\n * @type (files: File[]) => void\n * @default undefined\n * @example onValueChange={(files) => setFiles(files)}\n */\n onValueChange?: (files: File[]) => void;\n\n /**\n * Function to be called when files are uploaded.\n * @type (files: File[]) => Promise<void>\n * @default undefined\n * @example onUpload={(files) => uploadFiles(files)}\n */\n onUpload?: (files: File[]) => Promise<void>;\n\n /**\n * Progress of the uploaded files.\n * @type Record<string, number> | undefined\n * @default undefined\n * @example progresses={{ \"file1.png\": 50 }}\n */\n progresses?: Record<string, number>;\n\n /**\n * Accepted file types for the uploader.\n * @type { [key: string]: string[]}\n * @default\n * ```ts\n * { \"image/*\": [] }\n * ```\n * @example accept={[\"image/png\", \"image/jpeg\"]}\n */\n accept?: DropzoneProps['accept'];\n\n /**\n * Maximum file size for the uploader.\n * @type number | undefined\n * @default 1024 * 1024 * 2 // 2MB\n * @example maxSize={1024 * 1024 * 2} // 2MB\n */\n maxSize?: DropzoneProps['maxSize'];\n\n /**\n * Maximum number of files for the uploader.\n * @type number | undefined\n * @default 1\n * @example maxFileCount={4}\n */\n maxFileCount?: DropzoneProps['maxFiles'];\n\n /**\n * Whether the uploader should accept multiple files.\n * @type boolean\n * @default false\n * @example multiple\n */\n multiple?: boolean;\n\n /**\n * Whether the uploader is disabled.\n * @type boolean\n * @default false\n * @example disabled\n */\n disabled?: boolean;\n\n /**\n * Whether to show the instructional drag-and-drop text inside the drop zone.\n * @default true\n */\n showText?: boolean;\n /** Size in pixels for the upload icon. */\n iconSize?: number;\n}\n\n/**\n * A drag-and-drop file upload zone that manages file selection, validation, preview generation, and optional async upload with progress tracking.\n */\nexport function FileUploader(props: FileUploaderProps) {\n const {\n value: valueProp,\n onValueChange,\n onUpload,\n progresses,\n accept = {\n 'image/*': [],\n },\n maxSize = 1024 * 1024 * 2,\n maxFileCount = 1,\n multiple = false,\n disabled = false,\n showText = true,\n iconSize,\n className,\n ...dropzoneProps\n } = props;\n\n const [files, setFiles] = useControllableState({\n prop: valueProp,\n onChange: onValueChange,\n });\n\n const onDrop = useCallback(\n (acceptedFiles: File[], rejectedFiles: FileRejection[]) => {\n if (!multiple && maxFileCount === 1 && acceptedFiles.length > 1) {\n toast.error('Cannot upload more than 1 file at a time');\n\n return;\n }\n\n if ((files?.length ?? 0) + acceptedFiles.length > maxFileCount) {\n toast.error(`Cannot upload more than ${maxFileCount} files`);\n return;\n }\n\n const newFiles = acceptedFiles.map(file =>\n Object.assign(file, {\n preview: URL.createObjectURL(file),\n })\n );\n\n const updatedFiles = files ? [...files, ...newFiles] : newFiles;\n\n setFiles(updatedFiles);\n\n if (rejectedFiles.length > 0) {\n rejectedFiles.forEach(({ file }) => {\n toast.error(`File ${file.name} was rejected`);\n });\n }\n\n if (onUpload && updatedFiles.length > 0 && updatedFiles.length <= maxFileCount) {\n const target = updatedFiles.length > 0 ? `${updatedFiles.length} files` : `file`;\n\n onUpload(updatedFiles).then(() => {\n setFiles([]);\n toast(`${target} uploaded`);\n });\n }\n },\n\n [files, maxFileCount, multiple, onUpload, setFiles]\n );\n\n function onRemove(index: number) {\n if (!files) return;\n\n if (isFileWithPreview(files[index])) {\n URL.revokeObjectURL(files[index].preview);\n }\n\n const newFiles = files.filter((_, i) => i !== index);\n setFiles(newFiles);\n onValueChange?.(newFiles);\n }\n\n // Revoke preview url when component unmounts\n useEffect(() => {\n return () => {\n if (!files) return;\n files.forEach(file => {\n if (isFileWithPreview(file)) {\n URL.revokeObjectURL(file.preview);\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const isDisabled = disabled || (files?.length ?? 0) >= maxFileCount;\n\n return (\n <div className=\"relative flex w-full flex-col gap-6\">\n <Dropzone onDrop={onDrop} accept={accept} maxSize={maxSize} maxFiles={maxFileCount} multiple={maxFileCount > 1 || multiple} disabled={isDisabled}>\n {({ getRootProps, getInputProps, isDragActive }) => (\n <div\n {...getRootProps()}\n className={cn(\n 'group',\n 'border-border-weak',\n 'hover:bg-border-weak/20',\n 'relative grid h-52 w-full cursor-pointer place-items-center rounded-lg border-2 border-dashed px-5 py-2.5 text-center transition',\n 'ring-offset-background',\n 'focus-visible:ring-primary-weak',\n 'focus-visible:ring-2',\n 'focus-visible:ring-offset-2',\n 'focus-visible:outline-hidden',\n isDragActive && 'border-border-primary-strong bg-border-weak/40',\n isDisabled && 'pointer-events-none opacity-60',\n className\n )}\n {...dropzoneProps}\n >\n <input {...getInputProps()} />\n {isDragActive ? (\n <div className=\"flex flex-col items-center justify-center gap-4 sm:px-5\">\n <div className=\"rounded-full border border-dashed p-3\">\n <Upload className=\"text-text-positive-muted size-7\" aria-hidden=\"true\" />\n </div>\n <p className=\"text-text-positive-muted font-medium\">Drop the files here</p>\n </div>\n ) : (\n <div className=\"flex flex-col items-center justify-center gap-4 sm:px-5\">\n <div className=\"rounded-full border border-dashed p-3\">\n <Upload size={iconSize || 24} className=\"text-muted-foreground\" aria-hidden=\"true\" />\n </div>\n {showText && (\n <div className=\"flex flex-col gap-px\">\n <p className=\"text-text-positive-weak text-xs font-medium\">Drag {`'n'`} drop files here, or click to select files</p>\n <p className=\"text-text-positive-muted text-xs\">\n You can upload\n {maxFileCount > 1\n ? ` ${maxFileCount === Infinity ? 'multiple' : maxFileCount}\n files (up to ${formatBytes(maxSize)} each)`\n : ` a file with ${formatBytes(maxSize)}`}\n </p>\n </div>\n )}\n </div>\n )}\n </div>\n )}\n </Dropzone>\n {files?.length ? (\n <div className=\"h-fit w-full overflow-y-auto\">\n <div className=\"flex items-center justify-between px-3 py-2.5\">\n <div className=\"text-text-positive-weak flex items-center gap-1\">\n <Image size={16} aria-hidden=\"true\" />\n <p className=\"text-sm\">Ảnh đã tải lên ({files.length})</p>\n </div>\n <button\n className=\"hover:text-text-positive text-text-positive-muted flex cursor-pointer items-center gap-1 transition-colors duration-200\"\n onClick={() => {\n if (!files) return;\n files.forEach(file => {\n if (!isFileWithPreview(file)) return;\n URL.revokeObjectURL(file.preview);\n });\n setFiles([]);\n onValueChange?.([]);\n }}\n >\n <Trash2 size={16} aria-hidden=\"true\" />\n <p className=\"text-sm\">Xóa tất cả</p>\n </button>\n </div>\n <div className=\"flex flex-col gap-2.5\">\n {files?.map((file, index) => (\n <FileCard key={index} file={file} onRemove={() => onRemove(index)} progress={progresses?.[file.name]} />\n ))}\n </div>\n </div>\n ) : null}\n </div>\n );\n}\n\ninterface FileCardProps {\n file: File;\n onRemove: () => void;\n progress?: number;\n}\n\nfunction FileCard({ file, progress, onRemove }: FileCardProps) {\n return (\n <div className=\"border-border-weak hover:border-border relative flex items-center gap-4 rounded-md border py-2 pr-3 pl-2 shadow-xs transition-colors\">\n <div className=\"flex flex-1 gap-2.5\">\n {isFileWithPreview(file) ? <FilePreview file={file} /> : null}\n <div className=\"flex w-full flex-col gap-2\">\n <div className=\"flex flex-col gap-y-0.5\">\n <p className=\"text-text-positive line-clamp-1 text-sm\">{file.name}</p>\n <p className=\"text-text-positive-muted text-xs\">{formatBytes(file.size)}</p>\n </div>\n {progress ? <Progress value={progress} /> : null}\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n <Button type=\"button\" variant=\"ghost\" color=\"secondary\" size=\"icon\" className=\"size-7\" onClick={onRemove}>\n <Trash2 size={16} className=\"text-text-positive-muted\" aria-hidden=\"true\" />\n <span className=\"sr-only\">Remove file</span>\n </Button>\n </div>\n </div>\n );\n}\n\nfunction isFileWithPreview(file: File): file is File & { preview: string } {\n return 'preview' in file && typeof file.preview === 'string';\n}\n\ninterface FilePreviewProps {\n file: File & { preview: string };\n}\n\nfunction FilePreview({ file }: FilePreviewProps) {\n if (file.type.startsWith('image/')) {\n return <img src={file.preview} className=\"border-border aspect-square size-10 shrink-0 rounded border object-cover object-top shadow-sm\" />;\n }\n\n return <FileText className=\"text-text-positive-muted size-10 border\" aria-hidden=\"true\" />;\n}\n"],"mappings":"qhBAoHA,SAAgB,EAAa,EAA0B,CACrD,GAAM,CACJ,MAAO,EACP,gBACA,WACA,aACA,SAAS,CACP,UAAW,EAAE,CACd,CACD,UAAU,KAAO,KAAO,EACxB,eAAe,EACf,WAAW,GACX,WAAW,GACX,WAAW,GACX,WACA,YACA,GAAG,GACD,EAEE,CAAC,EAAO,GAAY,EAAqB,CAC7C,KAAM,EACN,SAAU,EACX,CAAC,CAEI,EAAS,GACZ,EAAuB,IAAmC,CACzD,GAAI,CAAC,GAAY,IAAiB,GAAK,EAAc,OAAS,EAAG,CAC/D,EAAM,MAAM,2CAA2C,CAEvD,OAGF,IAAK,GAAO,QAAU,GAAK,EAAc,OAAS,EAAc,CAC9D,EAAM,MAAM,2BAA2B,EAAa,QAAQ,CAC5D,OAGF,IAAM,EAAW,EAAc,IAAI,GACjC,OAAO,OAAO,EAAM,CAClB,QAAS,IAAI,gBAAgB,EAAK,CACnC,CAAC,CACH,CAEK,EAAe,EAAQ,CAAC,GAAG,EAAO,GAAG,EAAS,CAAG,EAUvD,GARA,EAAS,EAAa,CAElB,EAAc,O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AAU,gCACZ,EAAkB,EAAK,CAAG,EAAC,EAAA,CAAkB,OAAA,CAAQ,CAAG,KACzD,EAAC,MAAA,CAAI,UAAU,uCACb,EAAC,MAAA,CAAI,UAAU,oCACb,EAAC,IAAA,CAAE,UAAU,mDAA2C,EAAK,MAAS,CACtE,EAAC,IAAA,CAAE,UAAU,4CAAoC,EAAY,EAAK,KAAK,EAAK,CAAA,EACxE,CACL,EAAW,EAAC,EAAA,CAAS,MAAO,EAAA,CAAY,CAAG,KAAA,EACxC,CAAA,EACF,CACN,EAAC,MAAA,CAAI,UAAU,mCACb,EAAC,EAAA,CAAO,KAAK,SAAS,QAAQ,QAAQ,MAAM,YAAY,KAAK,OAAO,UAAU,SAAS,QAAS,YAC9F,EAAC,EAAA,CAAO,KAAM,GAAI,UAAU,2BAA2B,cAAY,QAAS,CAC5E,EAAC,OAAA,CAAK,UAAU,mBAAU,eAAkB,CAAA,EACrC,EACL,CAAA,EACF,CAIV,SAAS,EAAkB,EAAgD,CACzE,MAAO,YAAa,GAAQ,OAAO,EAAK,SAAY,SAOtD,SAAS,EAAY,CAAE,QAA0B,CAK/C,OAJI,EAAK,KAAK,WAAW,SAAS,CACzB,EAAC,MAAA,CAAI,IAAK,EAAK,QAAS,UAAU,iGAAkG,CAGtI,EAAC,EAAA,CAAS,UAAU,0CAA0C,cAAY,QAAS"}
|
package/dist/ui/form.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require(`../chunk-
|
|
1
|
+
"use client";const e=require(`../chunk-350yNsax.cjs`);require(`../separator-KuymG9g0.cjs`),require(`../label-CC6fXVbC.cjs`);const t=require(`../field-BrlETeXX.cjs`);let n=require(`react`),r=require(`@customafk/react-toolkit/utils`),i=require(`react/jsx-runtime`),a=require(`radix-ui`),o=require(`react-hook-form`);const s=o.FormProvider,c=(0,n.createContext)({}),l=({...e})=>(0,i.jsx)(c.Provider,{value:{name:e.name},children:(0,i.jsx)(o.Controller,{...e})}),u=()=>{let e=(0,n.use)(c),t=(0,n.use)(d),{getFieldState:r,control:i,resetField:a}=(0,o.useFormContext)(),s=(0,o.useFormState)({name:e.name}),l=r(e.name,s);if(!e)throw Error(`useFormField should be used within <FormField>`);let{id:u}=t;return{id:u,control:i,resetField:a,name:e.name,formItemId:`${u}-form-item`,formDescriptionId:`${u}-form-item-description`,formMessageId:`${u}-form-item-message`,...l}},d=(0,n.createContext)({}),f=(0,n.memo)(({className:e,orientation:r=`responsive`,...a})=>{let o=(0,n.useId)();return(0,i.jsx)(d.Provider,{value:{id:o},children:(0,i.jsx)(t.t,{orientation:r,...a,className:e})})});f.displayName=`FormItem`;const p=(0,n.memo)(({...e})=>{let{formItemId:n}=u();return(0,i.jsx)(t.o,{htmlFor:n,...e})});p.displayName=`FormLabel`;const m=(0,n.memo)(({...e})=>{let{error:t,formItemId:n,formDescriptionId:r,formMessageId:o}=u();return(0,i.jsx)(a.Slot.Slot,{"data-slot":`form-control`,id:n,"aria-describedby":t?`${r} ${o}`:`${r}`,"aria-invalid":!!t,...e})});m.displayName=`FormControl`;function h({className:e,...n}){let{formDescriptionId:a}=u();return(0,i.jsx)(t.r,{id:a,className:(0,r.cn)(`text-text-positive-weak text-sm/6 leading-normal font-normal`,`group-has-data-[orientation=horizontal]/field:text-balance`,`last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5`,`[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4`,e),...n})}function g({className:e,children:t,...n}){let{error:a,formMessageId:o}=u();return(0,i.jsx)(`span`,{"data-slot":`form-message`,id:o,className:(0,r.cn)(`text-danger text-xs`,e),...n,children:a?String(a?.message??``):t})}exports.Form=s,exports.FormControl=m,exports.FormDescription=h,exports.FormField=l,exports.FormItem=f,exports.FormLabel=p,exports.FormMessage=g,exports.useFormField=u;
|
|
2
2
|
//# sourceMappingURL=form.cjs.map
|
package/dist/ui/form.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.cjs","names":["FormProvider","Controller","Field","FieldLabel","SlotPrimitive","FieldDescription"],"sources":["../../packages/components/ui/form.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@customafk/react-toolkit/utils';\nimport { type Label as LabelPrimitive, Slot as SlotPrimitive } from 'radix-ui';\nimport { createContext, memo, use, useId } from 'react';\nimport type { ControllerProps, FieldPath, FieldValues } from 'react-hook-form';\nimport { Controller, FormProvider, useFormContext, useFormState } from 'react-hook-form';\nimport { Field, FieldDescription, FieldLabel } from './field';\n\n/**\n * Re-export of react-hook-form's `FormProvider`; wrap your form with this to give all nested form components access to the form context.\n *\n * @example\n * ```tsx\n * import { Form, FormField, FormItem, FormLabel, FormControl, FormMessage } from '@customafk/lunas-ui/ui/form';\n * import { useForm } from 'react-hook-form';\n *\n * const form = useForm<{ username: string }>();\n *\n * <Form {...form}>\n * <form onSubmit={form.handleSubmit(onSubmit)}>\n * <FormField\n * control={form.control}\n * name=\"username\"\n * render={({ field }) => (\n * <FormItem>\n * <FormLabel>Username</FormLabel>\n * <FormControl><input {...field} /></FormControl>\n * <FormMessage />\n * </FormItem>\n * )}\n * />\n * </form>\n * </Form>\n * ```\n */\nconst Form = FormProvider;\n\ntype FormFieldContextValue<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {\n name: TName;\n};\n\nconst FormFieldContext = createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\n/**\n * Connects a single react-hook-form field to the form context; renders a `Controller` and passes `name` down to nested FormItem, FormLabel, FormControl, and FormMessage.\n */\nconst FormField = <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\n/**\n * Hook that returns the field state and IDs for the enclosing FormField.\n * Must be called inside a component rendered within a `<FormField>`.\n */\nconst useFormField = () => {\n const fieldContext = use(FormFieldContext);\n const itemContext = use(FormItemContext);\n const { getFieldState, control, resetField } = useFormContext();\n const formState = useFormState({ name: fieldContext.name });\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const { id } = itemContext;\n\n return {\n id,\n control,\n resetField,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = createContext<FormItemContextValue>({} as FormItemContextValue);\n\n/**\n * Container for a single form field — generates a unique ID and provides it via context to FormLabel, FormControl, and FormMessage.\n *\n * @param orientation - Layout direction: `'vertical'`, `'horizontal'`, or `'responsive'` (default).\n */\nconst FormItem = memo(\n ({\n className,\n orientation = 'responsive',\n ...props\n }: React.ComponentProps<'div'> & {\n orientation?: 'vertical' | 'horizontal' | 'responsive';\n }) => {\n const id = useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <Field orientation={orientation} {...props} className={className} />\n </FormItemContext.Provider>\n );\n }\n);\nFormItem.displayName = 'FormItem';\n\n/** Styled label automatically associated with the FormItem's control via `htmlFor`. */\nconst FormLabel = memo(({ ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) => {\n const { formItemId } = useFormField();\n return <FieldLabel htmlFor={formItemId} {...props} />;\n});\nFormLabel.displayName = 'FormLabel';\n\n/** Radix Slot wrapper that wires the correct `id`, `aria-describedby`, and `aria-invalid` attributes onto the underlying control element. */\nconst FormControl = memo(({ ...props }: React.ComponentProps<typeof SlotPrimitive.Slot>) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <SlotPrimitive.Slot\n data-slot=\"form-control\"\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n );\n});\nFormControl.displayName = 'FormControl';\n\n/** Helper text displayed below the control that provides additional context about the field. */\nfunction FormDescription({ className, ...props }: React.ComponentProps<'p'>) {\n const { formDescriptionId } = useFormField();\n\n return (\n <FieldDescription\n id={formDescriptionId}\n className={cn(\n 'text-text-positive-weak text-sm/6 leading-normal font-normal',\n 'group-has-data-[orientation=horizontal]/field:text-balance',\n 'last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5',\n '[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',\n className\n )}\n {...props}\n />\n );\n}\n\n/** Displays the validation error message for the field, or falls back to `children` when there is no error. */\nfunction FormMessage({ className, children, ...props }: React.ComponentProps<'p'>) {\n const { error, formMessageId } = useFormField();\n\n return (\n <span data-slot=\"form-message\" id={formMessageId} className={cn('text-danger text-xs', className)} {...props}>\n {error ? String(error?.message ?? '') : children}\n </span>\n );\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"form.cjs","names":["FormProvider","Controller","Field","FieldLabel","SlotPrimitive","FieldDescription"],"sources":["../../packages/components/ui/form.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@customafk/react-toolkit/utils';\nimport { type Label as LabelPrimitive, Slot as SlotPrimitive } from 'radix-ui';\nimport { createContext, memo, use, useId } from 'react';\nimport type { ControllerProps, FieldPath, FieldValues } from 'react-hook-form';\nimport { Controller, FormProvider, useFormContext, useFormState } from 'react-hook-form';\nimport { Field, FieldDescription, FieldLabel } from './field';\n\n/**\n * Re-export of react-hook-form's `FormProvider`; wrap your form with this to give all nested form components access to the form context.\n *\n * @example\n * ```tsx\n * import { Form, FormField, FormItem, FormLabel, FormControl, FormMessage } from '@customafk/lunas-ui/ui/form';\n * import { useForm } from 'react-hook-form';\n *\n * const form = useForm<{ username: string }>();\n *\n * <Form {...form}>\n * <form onSubmit={form.handleSubmit(onSubmit)}>\n * <FormField\n * control={form.control}\n * name=\"username\"\n * render={({ field }) => (\n * <FormItem>\n * <FormLabel>Username</FormLabel>\n * <FormControl><input {...field} /></FormControl>\n * <FormMessage />\n * </FormItem>\n * )}\n * />\n * </form>\n * </Form>\n * ```\n */\nconst Form = FormProvider;\n\ntype FormFieldContextValue<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {\n name: TName;\n};\n\nconst FormFieldContext = createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\n/**\n * Connects a single react-hook-form field to the form context; renders a `Controller` and passes `name` down to nested FormItem, FormLabel, FormControl, and FormMessage.\n */\nconst FormField = <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\n/**\n * Hook that returns the field state and IDs for the enclosing FormField.\n * Must be called inside a component rendered within a `<FormField>`.\n */\nconst useFormField = () => {\n const fieldContext = use(FormFieldContext);\n const itemContext = use(FormItemContext);\n const { getFieldState, control, resetField } = useFormContext();\n const formState = useFormState({ name: fieldContext.name });\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const { id } = itemContext;\n\n return {\n id,\n control,\n resetField,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = createContext<FormItemContextValue>({} as FormItemContextValue);\n\n/**\n * Container for a single form field — generates a unique ID and provides it via context to FormLabel, FormControl, and FormMessage.\n *\n * @param orientation - Layout direction: `'vertical'`, `'horizontal'`, or `'responsive'` (default).\n */\nconst FormItem = memo(\n ({\n className,\n orientation = 'responsive',\n ...props\n }: React.ComponentProps<'div'> & {\n orientation?: 'vertical' | 'horizontal' | 'responsive';\n }) => {\n const id = useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <Field orientation={orientation} {...props} className={className} />\n </FormItemContext.Provider>\n );\n }\n);\nFormItem.displayName = 'FormItem';\n\n/** Styled label automatically associated with the FormItem's control via `htmlFor`. */\nconst FormLabel = memo(({ ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) => {\n const { formItemId } = useFormField();\n return <FieldLabel htmlFor={formItemId} {...props} />;\n});\nFormLabel.displayName = 'FormLabel';\n\n/** Radix Slot wrapper that wires the correct `id`, `aria-describedby`, and `aria-invalid` attributes onto the underlying control element. */\nconst FormControl = memo(({ ...props }: React.ComponentProps<typeof SlotPrimitive.Slot>) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <SlotPrimitive.Slot\n data-slot=\"form-control\"\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n );\n});\nFormControl.displayName = 'FormControl';\n\n/** Helper text displayed below the control that provides additional context about the field. */\nfunction FormDescription({ className, ...props }: React.ComponentProps<'p'>) {\n const { formDescriptionId } = useFormField();\n\n return (\n <FieldDescription\n id={formDescriptionId}\n className={cn(\n 'text-text-positive-weak text-sm/6 leading-normal font-normal',\n 'group-has-data-[orientation=horizontal]/field:text-balance',\n 'last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5',\n '[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',\n className\n )}\n {...props}\n />\n );\n}\n\n/** Displays the validation error message for the field, or falls back to `children` when there is no error. */\nfunction FormMessage({ className, children, ...props }: React.ComponentProps<'p'>) {\n const { error, formMessageId } = useFormField();\n\n return (\n <span data-slot=\"form-message\" id={formMessageId} className={cn('text-danger text-xs', className)} {...props}>\n {error ? String(error?.message ?? '') : children}\n </span>\n );\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };\n"],"mappings":"0TAoCA,MAAM,EAAOA,EAAAA,aAMP,GAAA,EAAA,EAAA,eAAwD,EAAE,CAA0B,CAKpF,GAA8H,CAClI,GAAG,MAGD,EAAA,EAAA,KAAC,EAAiB,SAAA,CAAS,MAAO,CAAE,KAAM,EAAM,KAAM,WACpD,EAAA,EAAA,KAACC,EAAAA,WAAAA,CAAW,GAAI,EAAA,CAAS,EACC,CAQ1B,MAAqB,CACzB,IAAM,GAAA,EAAA,EAAA,KAAmB,EAAiB,CACpC,GAAA,EAAA,EAAA,KAAkB,EAAgB,CAClC,CAAE,gBAAe,UAAS,eAAA,EAAA,EAAA,iBAA+B,CACzD,GAAA,EAAA,EAAA,cAAyB,CAAE,KAAM,EAAa,KAAM,CAAC,CACrD,EAAa,EAAc,EAAa,KAAM,EAAU,CAE9D,GAAI,CAAC,EACH,MAAU,MAAM,iDAAiD,CAGnE,GAAM,CAAE,MAAO,EAEf,MAAO,CACL,KACA,UACA,aACA,KAAM,EAAa,KACnB,WAAY,GAAG,EAAG,YAClB,kBAAmB,GAAG,EAAG,wBACzB,cAAe,GAAG,EAAG,oBACrB,GAAG,EACJ,EAOG,GAAA,EAAA,EAAA,eAAsD,EAAE,CAAyB,CAOjF,GAAA,EAAA,EAAA,OACH,CACC,YACA,cAAc,aACd,GAAG,KAGC,CACJ,IAAM,GAAA,EAAA,EAAA,QAAY,CAElB,OACE,EAAA,EAAA,KAAC,EAAgB,SAAA,CAAS,MAAO,CAAE,KAAI,WACrC,EAAA,EAAA,KAACC,EAAAA,EAAAA,CAAmB,cAAa,GAAI,EAAkB,aAAa,EAC3C,EAGhC,CACD,EAAS,YAAc,WAGvB,MAAM,GAAA,EAAA,EAAA,OAAkB,CAAE,GAAG,KAA8D,CACzF,GAAM,CAAE,cAAe,GAAc,CACrC,OAAO,EAAA,EAAA,KAACC,EAAAA,EAAAA,CAAW,QAAS,EAAY,GAAI,GAAS,EACrD,CACF,EAAU,YAAc,YAGxB,MAAM,GAAA,EAAA,EAAA,OAAoB,CAAE,GAAG,KAA6D,CAC1F,GAAM,CAAE,QAAO,aAAY,oBAAmB,iBAAkB,GAAc,CAE9E,OACE,EAAA,EAAA,KAACC,EAAAA,KAAc,KAAA,CACb,YAAU,eACV,GAAI,EACJ,mBAAmB,EAAiC,GAAG,EAAkB,GAAG,IAAjD,GAAG,IAC9B,eAAc,CAAC,CAAC,EAChB,GAAI,GACJ,EAEJ,CACF,EAAY,YAAc,cAG1B,SAAS,EAAgB,CAAE,YAAW,GAAG,GAAoC,CAC3E,GAAM,CAAE,qBAAsB,GAAc,CAE5C,OACE,EAAA,EAAA,KAACC,EAAAA,EAAAA,CACC,GAAI,EACJ,WAAA,EAAA,EAAA,IACE,+DACA,6DACA,+DACA,oEACA,EACD,CACD,GAAI,GACJ,CAKN,SAAS,EAAY,CAAE,YAAW,WAAU,GAAG,GAAoC,CACjF,GAAM,CAAE,QAAO,iBAAkB,GAAc,CAE/C,OACE,EAAA,EAAA,KAAC,OAAA,CAAK,YAAU,eAAe,GAAI,EAAe,WAAA,EAAA,EAAA,IAAc,sBAAuB,EAAU,CAAE,GAAI,WACpG,EAAQ,OAAO,GAAO,SAAW,GAAG,CAAG,GACnC"}
|
package/dist/ui/form.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react97 from "react";
|
|
2
2
|
import { Label, Slot } from "radix-ui";
|
|
3
3
|
import * as react_hook_form0 from "react-hook-form";
|
|
4
4
|
import { ControllerProps, FieldPath, FieldValues } from "react-hook-form";
|
|
@@ -57,7 +57,7 @@ declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransfor
|
|
|
57
57
|
*/
|
|
58
58
|
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({
|
|
59
59
|
...props
|
|
60
|
-
}: ControllerProps<TFieldValues, TName>) =>
|
|
60
|
+
}: ControllerProps<TFieldValues, TName>) => react97.JSX.Element;
|
|
61
61
|
/**
|
|
62
62
|
* Hook that returns the field state and IDs for the enclosing FormField.
|
|
63
63
|
* Must be called inside a component rendered within a `<FormField>`.
|
|
@@ -81,32 +81,32 @@ declare const useFormField: () => {
|
|
|
81
81
|
*
|
|
82
82
|
* @param orientation - Layout direction: `'vertical'`, `'horizontal'`, or `'responsive'` (default).
|
|
83
83
|
*/
|
|
84
|
-
declare const FormItem:
|
|
84
|
+
declare const FormItem: react97.MemoExoticComponent<({
|
|
85
85
|
className,
|
|
86
86
|
orientation,
|
|
87
87
|
...props
|
|
88
88
|
}: React.ComponentProps<"div"> & {
|
|
89
89
|
orientation?: "vertical" | "horizontal" | "responsive";
|
|
90
|
-
}) =>
|
|
90
|
+
}) => react97.JSX.Element>;
|
|
91
91
|
/** Styled label automatically associated with the FormItem's control via `htmlFor`. */
|
|
92
|
-
declare const FormLabel:
|
|
92
|
+
declare const FormLabel: react97.MemoExoticComponent<({
|
|
93
93
|
...props
|
|
94
|
-
}: React.ComponentProps<typeof Label.Root>) =>
|
|
94
|
+
}: React.ComponentProps<typeof Label.Root>) => react97.JSX.Element>;
|
|
95
95
|
/** Radix Slot wrapper that wires the correct `id`, `aria-describedby`, and `aria-invalid` attributes onto the underlying control element. */
|
|
96
|
-
declare const FormControl:
|
|
96
|
+
declare const FormControl: react97.MemoExoticComponent<({
|
|
97
97
|
...props
|
|
98
|
-
}: React.ComponentProps<typeof Slot.Slot>) =>
|
|
98
|
+
}: React.ComponentProps<typeof Slot.Slot>) => react97.JSX.Element>;
|
|
99
99
|
/** Helper text displayed below the control that provides additional context about the field. */
|
|
100
100
|
declare function FormDescription({
|
|
101
101
|
className,
|
|
102
102
|
...props
|
|
103
|
-
}: React.ComponentProps<'p'>):
|
|
103
|
+
}: React.ComponentProps<'p'>): react97.JSX.Element;
|
|
104
104
|
/** Displays the validation error message for the field, or falls back to `children` when there is no error. */
|
|
105
105
|
declare function FormMessage({
|
|
106
106
|
className,
|
|
107
107
|
children,
|
|
108
108
|
...props
|
|
109
|
-
}: React.ComponentProps<'p'>):
|
|
109
|
+
}: React.ComponentProps<'p'>): react97.JSX.Element;
|
|
110
110
|
//#endregion
|
|
111
111
|
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
|
|
112
112
|
//# sourceMappingURL=form.d.cts.map
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import * as react162 from "react";
|
|
2
|
+
import { Label, Slot } from "radix-ui";
|
|
3
|
+
import * as react_hook_form0 from "react-hook-form";
|
|
4
|
+
import { ControllerProps, FieldPath, FieldValues } from "react-hook-form";
|
|
5
|
+
|
|
6
|
+
//#region packages/components/ui/form.d.ts
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Re-export of react-hook-form's `FormProvider`; wrap your form with this to give all nested form components access to the form context.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* import { Form, FormField, FormItem, FormLabel, FormControl, FormMessage } from '@customafk/lunas-ui/ui/form';
|
|
14
|
+
* import { useForm } from 'react-hook-form';
|
|
15
|
+
*
|
|
16
|
+
* const form = useForm<{ username: string }>();
|
|
17
|
+
*
|
|
18
|
+
* <Form {...form}>
|
|
19
|
+
* <form onSubmit={form.handleSubmit(onSubmit)}>
|
|
20
|
+
* <FormField
|
|
21
|
+
* control={form.control}
|
|
22
|
+
* name="username"
|
|
23
|
+
* render={({ field }) => (
|
|
24
|
+
* <FormItem>
|
|
25
|
+
* <FormLabel>Username</FormLabel>
|
|
26
|
+
* <FormControl><input {...field} /></FormControl>
|
|
27
|
+
* <FormMessage />
|
|
28
|
+
* </FormItem>
|
|
29
|
+
* )}
|
|
30
|
+
* />
|
|
31
|
+
* </form>
|
|
32
|
+
* </Form>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>({
|
|
36
|
+
children,
|
|
37
|
+
watch,
|
|
38
|
+
getValues,
|
|
39
|
+
getFieldState,
|
|
40
|
+
setError,
|
|
41
|
+
clearErrors,
|
|
42
|
+
setValue,
|
|
43
|
+
setValues,
|
|
44
|
+
trigger,
|
|
45
|
+
formState,
|
|
46
|
+
resetField,
|
|
47
|
+
reset,
|
|
48
|
+
handleSubmit,
|
|
49
|
+
unregister,
|
|
50
|
+
control,
|
|
51
|
+
register,
|
|
52
|
+
setFocus,
|
|
53
|
+
subscribe
|
|
54
|
+
}: react_hook_form0.FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
55
|
+
/**
|
|
56
|
+
* Connects a single react-hook-form field to the form context; renders a `Controller` and passes `name` down to nested FormItem, FormLabel, FormControl, and FormMessage.
|
|
57
|
+
*/
|
|
58
|
+
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({
|
|
59
|
+
...props
|
|
60
|
+
}: ControllerProps<TFieldValues, TName>) => react162.JSX.Element;
|
|
61
|
+
/**
|
|
62
|
+
* Hook that returns the field state and IDs for the enclosing FormField.
|
|
63
|
+
* Must be called inside a component rendered within a `<FormField>`.
|
|
64
|
+
*/
|
|
65
|
+
declare const useFormField: () => {
|
|
66
|
+
invalid: boolean;
|
|
67
|
+
isDirty: boolean;
|
|
68
|
+
isTouched: boolean;
|
|
69
|
+
isValidating: boolean;
|
|
70
|
+
error?: react_hook_form0.FieldError;
|
|
71
|
+
id: string;
|
|
72
|
+
control: react_hook_form0.Control<FieldValues, any, FieldValues>;
|
|
73
|
+
resetField: react_hook_form0.UseFormResetField<FieldValues>;
|
|
74
|
+
name: string;
|
|
75
|
+
formItemId: string;
|
|
76
|
+
formDescriptionId: string;
|
|
77
|
+
formMessageId: string;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Container for a single form field — generates a unique ID and provides it via context to FormLabel, FormControl, and FormMessage.
|
|
81
|
+
*
|
|
82
|
+
* @param orientation - Layout direction: `'vertical'`, `'horizontal'`, or `'responsive'` (default).
|
|
83
|
+
*/
|
|
84
|
+
declare const FormItem: react162.MemoExoticComponent<({
|
|
85
|
+
className,
|
|
86
|
+
orientation,
|
|
87
|
+
...props
|
|
88
|
+
}: React.ComponentProps<"div"> & {
|
|
89
|
+
orientation?: "vertical" | "horizontal" | "responsive";
|
|
90
|
+
}) => react162.JSX.Element>;
|
|
91
|
+
/** Styled label automatically associated with the FormItem's control via `htmlFor`. */
|
|
92
|
+
declare const FormLabel: react162.MemoExoticComponent<({
|
|
93
|
+
...props
|
|
94
|
+
}: React.ComponentProps<typeof Label.Root>) => react162.JSX.Element>;
|
|
95
|
+
/** Radix Slot wrapper that wires the correct `id`, `aria-describedby`, and `aria-invalid` attributes onto the underlying control element. */
|
|
96
|
+
declare const FormControl: react162.MemoExoticComponent<({
|
|
97
|
+
...props
|
|
98
|
+
}: React.ComponentProps<typeof Slot.Slot>) => react162.JSX.Element>;
|
|
99
|
+
/** Helper text displayed below the control that provides additional context about the field. */
|
|
100
|
+
declare function FormDescription({
|
|
101
|
+
className,
|
|
102
|
+
...props
|
|
103
|
+
}: React.ComponentProps<'p'>): react162.JSX.Element;
|
|
104
|
+
/** Displays the validation error message for the field, or falls back to `children` when there is no error. */
|
|
105
|
+
declare function FormMessage({
|
|
106
|
+
className,
|
|
107
|
+
children,
|
|
108
|
+
...props
|
|
109
|
+
}: React.ComponentProps<'p'>): react162.JSX.Element;
|
|
110
|
+
//#endregion
|
|
111
|
+
export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
|
|
112
|
+
//# sourceMappingURL=form.d.mts.map
|
package/dist/ui/form.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import"../separator-D3Gmkxzq.mjs";import"../label-CUCpwS5D.mjs";import{o as e,r as t,t as n}from"../field-dYemS0hQ.mjs";import{createContext as r,memo as i,use as a,useId as o}from"react";import{cn as s}from"@customafk/react-toolkit/utils";import{jsx as c}from"react/jsx-runtime";import{Slot as l}from"radix-ui";import{Controller as u,FormProvider as d,useFormContext as f,useFormState as p}from"react-hook-form";const m=d,h=r({}),g=({...e})=>c(h.Provider,{value:{name:e.name},children:c(u,{...e})}),_=()=>{let e=a(h),t=a(v),{getFieldState:n,control:r,resetField:i}=f(),o=p({name:e.name}),s=n(e.name,o);if(!e)throw Error(`useFormField should be used within <FormField>`);let{id:c}=t;return{id:c,control:r,resetField:i,name:e.name,formItemId:`${c}-form-item`,formDescriptionId:`${c}-form-item-description`,formMessageId:`${c}-form-item-message`,...s}},v=r({}),y=i(({className:e,orientation:t=`responsive`,...r})=>{let i=o();return c(v.Provider,{value:{id:i},children:c(n,{orientation:t,...r,className:e})})});y.displayName=`FormItem`;const b=i(({...t})=>{let{formItemId:n}=_();return c(e,{htmlFor:n,...t})});b.displayName=`FormLabel`;const x=i(({...e})=>{let{error:t,formItemId:n,formDescriptionId:r,formMessageId:i}=_();return c(l.Slot,{"data-slot":`form-control`,id:n,"aria-describedby":t?`${r} ${i}`:`${r}`,"aria-invalid":!!t,...e})});x.displayName=`FormControl`;function S({className:e,...n}){let{formDescriptionId:r}=_();return c(t,{id:r,className:s(`text-text-positive-weak text-sm/6 leading-normal font-normal`,`group-has-data-[orientation=horizontal]/field:text-balance`,`last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5`,`[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4`,e),...n})}function C({className:e,children:t,...n}){let{error:r,formMessageId:i}=_();return c(`span`,{"data-slot":`form-message`,id:i,className:s(`text-danger text-xs`,e),...n,children:r?String(r?.message??``):t})}export{m as Form,x as FormControl,S as FormDescription,g as FormField,y as FormItem,b as FormLabel,C as FormMessage,_ as useFormField};
|
|
2
|
+
//# sourceMappingURL=form.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.mjs","names":["SlotPrimitive"],"sources":["../../packages/components/ui/form.tsx"],"sourcesContent":["'use client';\n\nimport { cn } from '@customafk/react-toolkit/utils';\nimport { type Label as LabelPrimitive, Slot as SlotPrimitive } from 'radix-ui';\nimport { createContext, memo, use, useId } from 'react';\nimport type { ControllerProps, FieldPath, FieldValues } from 'react-hook-form';\nimport { Controller, FormProvider, useFormContext, useFormState } from 'react-hook-form';\nimport { Field, FieldDescription, FieldLabel } from './field';\n\n/**\n * Re-export of react-hook-form's `FormProvider`; wrap your form with this to give all nested form components access to the form context.\n *\n * @example\n * ```tsx\n * import { Form, FormField, FormItem, FormLabel, FormControl, FormMessage } from '@customafk/lunas-ui/ui/form';\n * import { useForm } from 'react-hook-form';\n *\n * const form = useForm<{ username: string }>();\n *\n * <Form {...form}>\n * <form onSubmit={form.handleSubmit(onSubmit)}>\n * <FormField\n * control={form.control}\n * name=\"username\"\n * render={({ field }) => (\n * <FormItem>\n * <FormLabel>Username</FormLabel>\n * <FormControl><input {...field} /></FormControl>\n * <FormMessage />\n * </FormItem>\n * )}\n * />\n * </form>\n * </Form>\n * ```\n */\nconst Form = FormProvider;\n\ntype FormFieldContextValue<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {\n name: TName;\n};\n\nconst FormFieldContext = createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\n/**\n * Connects a single react-hook-form field to the form context; renders a `Controller` and passes `name` down to nested FormItem, FormLabel, FormControl, and FormMessage.\n */\nconst FormField = <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\n/**\n * Hook that returns the field state and IDs for the enclosing FormField.\n * Must be called inside a component rendered within a `<FormField>`.\n */\nconst useFormField = () => {\n const fieldContext = use(FormFieldContext);\n const itemContext = use(FormItemContext);\n const { getFieldState, control, resetField } = useFormContext();\n const formState = useFormState({ name: fieldContext.name });\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error('useFormField should be used within <FormField>');\n }\n\n const { id } = itemContext;\n\n return {\n id,\n control,\n resetField,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = createContext<FormItemContextValue>({} as FormItemContextValue);\n\n/**\n * Container for a single form field — generates a unique ID and provides it via context to FormLabel, FormControl, and FormMessage.\n *\n * @param orientation - Layout direction: `'vertical'`, `'horizontal'`, or `'responsive'` (default).\n */\nconst FormItem = memo(\n ({\n className,\n orientation = 'responsive',\n ...props\n }: React.ComponentProps<'div'> & {\n orientation?: 'vertical' | 'horizontal' | 'responsive';\n }) => {\n const id = useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <Field orientation={orientation} {...props} className={className} />\n </FormItemContext.Provider>\n );\n }\n);\nFormItem.displayName = 'FormItem';\n\n/** Styled label automatically associated with the FormItem's control via `htmlFor`. */\nconst FormLabel = memo(({ ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) => {\n const { formItemId } = useFormField();\n return <FieldLabel htmlFor={formItemId} {...props} />;\n});\nFormLabel.displayName = 'FormLabel';\n\n/** Radix Slot wrapper that wires the correct `id`, `aria-describedby`, and `aria-invalid` attributes onto the underlying control element. */\nconst FormControl = memo(({ ...props }: React.ComponentProps<typeof SlotPrimitive.Slot>) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <SlotPrimitive.Slot\n data-slot=\"form-control\"\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n {...props}\n />\n );\n});\nFormControl.displayName = 'FormControl';\n\n/** Helper text displayed below the control that provides additional context about the field. */\nfunction FormDescription({ className, ...props }: React.ComponentProps<'p'>) {\n const { formDescriptionId } = useFormField();\n\n return (\n <FieldDescription\n id={formDescriptionId}\n className={cn(\n 'text-text-positive-weak text-sm/6 leading-normal font-normal',\n 'group-has-data-[orientation=horizontal]/field:text-balance',\n 'last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5',\n '[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4',\n className\n )}\n {...props}\n />\n );\n}\n\n/** Displays the validation error message for the field, or falls back to `children` when there is no error. */\nfunction FormMessage({ className, children, ...props }: React.ComponentProps<'p'>) {\n const { error, formMessageId } = useFormField();\n\n return (\n <span data-slot=\"form-message\" id={formMessageId} className={cn('text-danger text-xs', className)} {...props}>\n {error ? String(error?.message ?? '') : children}\n </span>\n );\n}\n\n// eslint-disable-next-line react-refresh/only-export-components\nexport { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };\n"],"mappings":"0aAoCA,MAAM,EAAO,EAMP,EAAmB,EAAqC,EAAE,CAA0B,CAKpF,GAA8H,CAClI,GAAG,KAGD,EAAC,EAAiB,SAAA,CAAS,MAAO,CAAE,KAAM,EAAM,KAAM,UACpD,EAAC,EAAA,CAAW,GAAI,EAAA,CAAS,EACC,CAQ1B,MAAqB,CACzB,IAAM,EAAe,EAAI,EAAiB,CACpC,EAAc,EAAI,EAAgB,CAClC,CAAE,gBAAe,UAAS,cAAe,GAAgB,CACzD,EAAY,EAAa,CAAE,KAAM,EAAa,KAAM,CAAC,CACrD,EAAa,EAAc,EAAa,KAAM,EAAU,CAE9D,GAAI,CAAC,EACH,MAAU,MAAM,iDAAiD,CAGnE,GAAM,CAAE,MAAO,EAEf,MAAO,CACL,KACA,UACA,aACA,KAAM,EAAa,KACnB,WAAY,GAAG,EAAG,YAClB,kBAAmB,GAAG,EAAG,wBACzB,cAAe,GAAG,EAAG,oBACrB,GAAG,EACJ,EAOG,EAAkB,EAAoC,EAAE,CAAyB,CAOjF,EAAW,GACd,CACC,YACA,cAAc,aACd,GAAG,KAGC,CACJ,IAAM,EAAK,GAAO,CAElB,OACE,EAAC,EAAgB,SAAA,CAAS,MAAO,CAAE,KAAI,UACrC,EAAC,EAAA,CAAmB,cAAa,GAAI,EAAkB,aAAa,EAC3C,EAGhC,CACD,EAAS,YAAc,WAGvB,MAAM,EAAY,GAAM,CAAE,GAAG,KAA8D,CACzF,GAAM,CAAE,cAAe,GAAc,CACrC,OAAO,EAAC,EAAA,CAAW,QAAS,EAAY,GAAI,GAAS,EACrD,CACF,EAAU,YAAc,YAGxB,MAAM,EAAc,GAAM,CAAE,GAAG,KAA6D,CAC1F,GAAM,CAAE,QAAO,aAAY,oBAAmB,iBAAkB,GAAc,CAE9E,OACE,EAACA,EAAc,KAAA,CACb,YAAU,eACV,GAAI,EACJ,mBAAmB,EAAiC,GAAG,EAAkB,GAAG,IAAjD,GAAG,IAC9B,eAAc,CAAC,CAAC,EAChB,GAAI,GACJ,EAEJ,CACF,EAAY,YAAc,cAG1B,SAAS,EAAgB,CAAE,YAAW,GAAG,GAAoC,CAC3E,GAAM,CAAE,qBAAsB,GAAc,CAE5C,OACE,EAAC,EAAA,CACC,GAAI,EACJ,UAAW,EACT,+DACA,6DACA,+DACA,oEACA,EACD,CACD,GAAI,GACJ,CAKN,SAAS,EAAY,CAAE,YAAW,WAAU,GAAG,GAAoC,CACjF,GAAM,CAAE,QAAO,iBAAkB,GAAc,CAE/C,OACE,EAAC,OAAA,CAAK,YAAU,eAAe,GAAI,EAAe,UAAW,EAAG,sBAAuB,EAAU,CAAE,GAAI,WACpG,EAAQ,OAAO,GAAO,SAAW,GAAG,CAAG,GACnC"}
|
package/dist/ui/hover-card.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require(`../chunk-
|
|
1
|
+
"use client";const e=require(`../chunk-350yNsax.cjs`);let t=require(`@customafk/react-toolkit/utils`),n=require(`react/jsx-runtime`),r=require(`radix-ui`);function i({...e}){return(0,n.jsx)(r.HoverCard.Root,{"data-slot":`hover-card`,...e})}function a({...e}){return(0,n.jsx)(r.HoverCard.Trigger,{"data-slot":`hover-card-trigger`,...e})}function o({className:e,align:i=`center`,sideOffset:a=4,...o}){return(0,n.jsx)(r.HoverCard.Portal,{"data-slot":`hover-card-portal`,children:(0,n.jsx)(r.HoverCard.Content,{"data-slot":`hover-card-content`,align:i,sideOffset:a,className:(0,t.cn)(`bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden`,e),...o})})}exports.HoverCard=i,exports.HoverCardContent=o,exports.HoverCardTrigger=a;
|
|
2
2
|
//# sourceMappingURL=hover-card.cjs.map
|
package/dist/ui/hover-card.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react92 from "react";
|
|
2
2
|
import { HoverCard as HoverCard$1 } from "radix-ui";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/ui/hover-card.d.ts
|
|
@@ -20,18 +20,18 @@ import { HoverCard as HoverCard$1 } from "radix-ui";
|
|
|
20
20
|
*/
|
|
21
21
|
declare function HoverCard({
|
|
22
22
|
...props
|
|
23
|
-
}: React.ComponentProps<typeof HoverCard$1.Root>):
|
|
23
|
+
}: React.ComponentProps<typeof HoverCard$1.Root>): react92.JSX.Element;
|
|
24
24
|
/** The element that triggers the HoverCard on pointer enter. */
|
|
25
25
|
declare function HoverCardTrigger({
|
|
26
26
|
...props
|
|
27
|
-
}: React.ComponentProps<typeof HoverCard$1.Trigger>):
|
|
27
|
+
}: React.ComponentProps<typeof HoverCard$1.Trigger>): react92.JSX.Element;
|
|
28
28
|
/** The floating card panel displayed when the trigger is hovered. */
|
|
29
29
|
declare function HoverCardContent({
|
|
30
30
|
className,
|
|
31
31
|
align,
|
|
32
32
|
sideOffset,
|
|
33
33
|
...props
|
|
34
|
-
}: React.ComponentProps<typeof HoverCard$1.Content>):
|
|
34
|
+
}: React.ComponentProps<typeof HoverCard$1.Content>): react92.JSX.Element;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { HoverCard, HoverCardContent, HoverCardTrigger };
|
|
37
37
|
//# sourceMappingURL=hover-card.d.cts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as react77 from "react";
|
|
2
|
+
import { HoverCard as HoverCard$1 } from "radix-ui";
|
|
3
|
+
|
|
4
|
+
//#region packages/components/ui/hover-card.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Root provider for the HoverCard — shows a floating card when the trigger is hovered.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { HoverCard, HoverCardTrigger, HoverCardContent } from '@customafk/lunas-ui/ui/hover-card';
|
|
12
|
+
*
|
|
13
|
+
* <HoverCard>
|
|
14
|
+
* <HoverCardTrigger>@username</HoverCardTrigger>
|
|
15
|
+
* <HoverCardContent>
|
|
16
|
+
* <p>Profile details here</p>
|
|
17
|
+
* </HoverCardContent>
|
|
18
|
+
* </HoverCard>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare function HoverCard({
|
|
22
|
+
...props
|
|
23
|
+
}: React.ComponentProps<typeof HoverCard$1.Root>): react77.JSX.Element;
|
|
24
|
+
/** The element that triggers the HoverCard on pointer enter. */
|
|
25
|
+
declare function HoverCardTrigger({
|
|
26
|
+
...props
|
|
27
|
+
}: React.ComponentProps<typeof HoverCard$1.Trigger>): react77.JSX.Element;
|
|
28
|
+
/** The floating card panel displayed when the trigger is hovered. */
|
|
29
|
+
declare function HoverCardContent({
|
|
30
|
+
className,
|
|
31
|
+
align,
|
|
32
|
+
sideOffset,
|
|
33
|
+
...props
|
|
34
|
+
}: React.ComponentProps<typeof HoverCard$1.Content>): react77.JSX.Element;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { HoverCard, HoverCardContent, HoverCardTrigger };
|
|
37
|
+
//# sourceMappingURL=hover-card.d.mts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{cn as e}from"@customafk/react-toolkit/utils";import{jsx as t}from"react/jsx-runtime";import{HoverCard as n}from"radix-ui";function r({...e}){return t(n.Root,{"data-slot":`hover-card`,...e})}function i({...e}){return t(n.Trigger,{"data-slot":`hover-card-trigger`,...e})}function a({className:r,align:i=`center`,sideOffset:a=4,...o}){return t(n.Portal,{"data-slot":`hover-card-portal`,children:t(n.Content,{"data-slot":`hover-card-content`,align:i,sideOffset:a,className:e(`bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden`,r),...o})})}export{r as HoverCard,a as HoverCardContent,i as HoverCardTrigger};
|
|
2
|
+
//# sourceMappingURL=hover-card.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hover-card.mjs","names":["HoverCardPrimitive"],"sources":["../../packages/components/ui/hover-card.tsx"],"sourcesContent":["'use client';\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { HoverCard as HoverCardPrimitive } from 'radix-ui';\n\n/**\n * Root provider for the HoverCard — shows a floating card when the trigger is hovered.\n *\n * @example\n * ```tsx\n * import { HoverCard, HoverCardTrigger, HoverCardContent } from '@customafk/lunas-ui/ui/hover-card';\n *\n * <HoverCard>\n * <HoverCardTrigger>@username</HoverCardTrigger>\n * <HoverCardContent>\n * <p>Profile details here</p>\n * </HoverCardContent>\n * </HoverCard>\n * ```\n */\nfunction HoverCard({ ...props }: React.ComponentProps<typeof HoverCardPrimitive.Root>) {\n return <HoverCardPrimitive.Root data-slot=\"hover-card\" {...props} />;\n}\n\n/** The element that triggers the HoverCard on pointer enter. */\nfunction HoverCardTrigger({ ...props }: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {\n return <HoverCardPrimitive.Trigger data-slot=\"hover-card-trigger\" {...props} />;\n}\n\n/** The floating card panel displayed when the trigger is hovered. */\nfunction HoverCardContent({ className, align = 'center', sideOffset = 4, ...props }: React.ComponentProps<typeof HoverCardPrimitive.Content>) {\n return (\n <HoverCardPrimitive.Portal data-slot=\"hover-card-portal\">\n <HoverCardPrimitive.Content\n data-slot=\"hover-card-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden',\n className\n )}\n {...props}\n />\n </HoverCardPrimitive.Portal>\n );\n}\n\nexport { HoverCard, HoverCardContent, HoverCardTrigger };\n"],"mappings":"8IAoBA,SAAS,EAAU,CAAE,GAAG,GAA+D,CACrF,OAAO,EAACA,EAAmB,KAAA,CAAK,YAAU,aAAa,GAAI,GAAS,CAItE,SAAS,EAAiB,CAAE,GAAG,GAAkE,CAC/F,OAAO,EAACA,EAAmB,QAAA,CAAQ,YAAU,qBAAqB,GAAI,GAAS,CAIjF,SAAS,EAAiB,CAAE,YAAW,QAAQ,SAAU,aAAa,EAAG,GAAG,GAAkE,CAC5I,OACE,EAACA,EAAmB,OAAA,CAAO,YAAU,6BACnC,EAACA,EAAmB,QAAA,CAClB,YAAU,qBACH,QACK,aACZ,UAAW,EACT,oeACA,EACD,CACD,GAAI,GACJ,EACwB"}
|
package/dist/ui/image.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=image.cjs.map
|
|
1
|
+
require(`../skeleton-CX1USu1w.cjs`);const e=require(`../image-W_Yb0xTB.cjs`);exports.Image=e.t;
|