@customafk/lunas-ui 0.0.63 → 0.0.64
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-dialog-BOMy-TmT.js +2 -0
- package/dist/alert-dialog-BOMy-TmT.js.map +1 -0
- package/dist/alert-dialog-lwTxSl-r.cjs +2 -0
- package/dist/alert-dialog-lwTxSl-r.cjs.map +1 -0
- package/dist/avatar-BaNIRUku.cjs +2 -0
- package/dist/avatar-BaNIRUku.cjs.map +1 -0
- package/dist/avatar-DZU7feMQ.js +2 -0
- package/dist/avatar-DZU7feMQ.js.map +1 -0
- package/dist/badge-6RQPy3Eo.js +2 -0
- package/dist/badge-6RQPy3Eo.js.map +1 -0
- package/dist/badge-BMXpbMfX.cjs +2 -0
- package/dist/badge-BMXpbMfX.cjs.map +1 -0
- package/dist/{button-BtvqPQbl.d.cts → button-CS4aajjP.d.ts} +5 -5
- package/dist/{button-B_r8XsfH.d.ts → button-De2032Bs.d.cts} +5 -5
- package/dist/calendar-BZRNZdsJ.js +2 -0
- package/dist/calendar-BZRNZdsJ.js.map +1 -0
- package/dist/{calendar-Cd2aQCHB.cjs → calendar-CUDdTiC-.cjs} +2 -2
- package/dist/calendar-CUDdTiC-.cjs.map +1 -0
- package/dist/cards/simple-card.d.ts +2 -2
- package/dist/{command-DewLG5N0.d.ts → command-D7AHVkgQ.d.ts} +12 -12
- package/dist/{command-tq_xgJ8Q.d.cts → command-Db5JViIx.d.cts} +12 -12
- package/dist/data-display/country.cjs +1 -1
- package/dist/data-display/country.js +1 -1
- package/dist/data-display/data-list.cjs +1 -1
- package/dist/data-display/data-list.js +1 -1
- package/dist/data-display/date-tooltip.cjs +1 -1
- package/dist/data-display/date-tooltip.js +1 -1
- package/dist/data-display/empty.cjs +1 -1
- package/dist/data-display/empty.d.ts +2 -2
- package/dist/data-display/empty.js +1 -1
- package/dist/data-display/name.cjs +1 -1
- package/dist/data-display/name.js +1 -1
- package/dist/data-display/phone-number.cjs +1 -1
- package/dist/data-display/phone-number.js +1 -1
- package/dist/data-display/role-badge.cjs +1 -1
- package/dist/data-display/role-badge.js +1 -1
- package/dist/data-display/statistic.cjs +1 -1
- package/dist/data-display/statistic.d.cts +2 -2
- package/dist/data-display/statistic.js +1 -1
- package/dist/{dialog-DI0dG1nN.d.cts → dialog-CiqPVetj.d.cts} +12 -12
- package/dist/{dialog-Ddyl2CZg.d.ts → dialog-yE-2SRfz.d.ts} +12 -12
- package/dist/dialogs/confirm-dialog.cjs +1 -1
- package/dist/dialogs/confirm-dialog.js +1 -1
- package/dist/dialogs/detail-dialog/component/sidebar.cjs +1 -1
- package/dist/dialogs/detail-dialog/component/sidebar.d.cts +30 -30
- package/dist/dialogs/detail-dialog/component/sidebar.d.ts +30 -30
- package/dist/dialogs/detail-dialog/component/sidebar.js +1 -1
- package/dist/dialogs/detail-dialog/index.cjs +1 -1
- package/dist/dialogs/detail-dialog/index.js +1 -1
- package/dist/dialogs/error-dialog.cjs +1 -1
- package/dist/dialogs/error-dialog.js +1 -1
- package/dist/dialogs/form-dialog.cjs +1 -1
- package/dist/dialogs/form-dialog.d.cts +2 -2
- package/dist/dialogs/form-dialog.d.ts +2 -2
- package/dist/dialogs/form-dialog.js +1 -1
- package/dist/drawer-B7OJzlXZ.js +2 -0
- package/dist/drawer-B7OJzlXZ.js.map +1 -0
- package/dist/drawer-Dh9uXVnU.cjs +2 -0
- package/dist/drawer-Dh9uXVnU.cjs.map +1 -0
- package/dist/{error-dialog-COyyui94.cjs → error-dialog-BkCaUR7F.cjs} +2 -2
- package/dist/{error-dialog-COyyui94.cjs.map → error-dialog-BkCaUR7F.cjs.map} +1 -1
- package/dist/{error-dialog-YlSsQqiT.js → error-dialog-D3tnycqF.js} +2 -2
- package/dist/{error-dialog-YlSsQqiT.js.map → error-dialog-D3tnycqF.js.map} +1 -1
- package/dist/flex-BZHWRUkz.js +2 -0
- package/dist/flex-BZHWRUkz.js.map +1 -0
- package/dist/flex-DMgD86BT.cjs +2 -0
- package/dist/flex-DMgD86BT.cjs.map +1 -0
- package/dist/form-CaxhlWxK.cjs +2 -0
- package/dist/form-CaxhlWxK.cjs.map +1 -0
- package/dist/form-D-gDMD-J.js +2 -0
- package/dist/form-D-gDMD-J.js.map +1 -0
- package/dist/{form-wrapper-D0-p7R15.cjs → form-wrapper-BUkoh-c7.cjs} +2 -2
- package/dist/{form-wrapper-D0-p7R15.cjs.map → form-wrapper-BUkoh-c7.cjs.map} +1 -1
- package/dist/{form-wrapper-C4OO_eLu.js → form-wrapper-BbScjpBv.js} +2 -2
- package/dist/{form-wrapper-C4OO_eLu.js.map → form-wrapper-BbScjpBv.js.map} +1 -1
- package/dist/forms/combobox-field.cjs +1 -1
- package/dist/forms/combobox-field.js +1 -1
- package/dist/forms/date-field.cjs +1 -1
- package/dist/forms/date-field.d.cts +2 -2
- package/dist/forms/date-field.d.ts +2 -2
- package/dist/forms/date-field.js +1 -1
- package/dist/forms/form-wrapper.cjs +1 -1
- package/dist/forms/form-wrapper.d.cts +2 -2
- package/dist/forms/form-wrapper.d.ts +2 -2
- package/dist/forms/form-wrapper.js +1 -1
- package/dist/forms/multi-select-field.cjs +1 -1
- package/dist/forms/multi-select-field.d.cts +2 -2
- package/dist/forms/multi-select-field.d.ts +2 -2
- package/dist/forms/multi-select-field.js +1 -1
- package/dist/forms/number-field.cjs +1 -1
- package/dist/forms/number-field.cjs.map +1 -1
- package/dist/forms/number-field.d.cts +2 -2
- package/dist/forms/number-field.d.ts +2 -2
- package/dist/forms/number-field.js +1 -1
- package/dist/forms/number-field.js.map +1 -1
- package/dist/forms/password-field.cjs +1 -1
- package/dist/forms/password-field.cjs.map +1 -1
- package/dist/forms/password-field.d.cts +2 -2
- package/dist/forms/password-field.d.ts +2 -2
- package/dist/forms/password-field.js +1 -1
- package/dist/forms/password-field.js.map +1 -1
- package/dist/forms/select-field.cjs +1 -1
- package/dist/forms/select-field.d.cts +2 -2
- package/dist/forms/select-field.d.ts +2 -2
- package/dist/forms/select-field.js +1 -1
- package/dist/forms/switch-field.cjs +1 -1
- package/dist/forms/switch-field.d.cts +2 -2
- package/dist/forms/switch-field.d.ts +2 -2
- package/dist/forms/switch-field.js +1 -1
- package/dist/forms/text-field.cjs +1 -1
- package/dist/forms/text-field.d.cts +2 -2
- package/dist/forms/text-field.d.ts +2 -2
- package/dist/forms/text-field.js +1 -1
- package/dist/forms/textarea-field.cjs +1 -1
- package/dist/forms/textarea-field.d.cts +2 -2
- package/dist/forms/textarea-field.d.ts +2 -2
- package/dist/forms/textarea-field.js +1 -1
- package/dist/input-BFZuwsER.js +2 -0
- package/dist/input-BFZuwsER.js.map +1 -0
- package/dist/{input-B3A9FFIr.d.ts → input-BayoSfCE.d.cts} +3 -4
- package/dist/{input-CBmfFkSA.d.cts → input-BjiwI6EW.d.ts} +3 -4
- package/dist/input-ERPHY3v4.cjs +2 -0
- package/dist/input-ERPHY3v4.cjs.map +1 -0
- package/dist/label-BBPPT0-L.cjs +2 -0
- package/dist/label-BBPPT0-L.cjs.map +1 -0
- package/dist/label-DdpIoRiG.js +2 -0
- package/dist/label-DdpIoRiG.js.map +1 -0
- package/dist/layouts/app-layout/index.cjs +1 -1
- package/dist/layouts/app-layout/index.cjs.map +1 -1
- package/dist/layouts/app-layout/index.d.cts +26 -27
- package/dist/layouts/app-layout/index.d.ts +37 -38
- package/dist/layouts/app-layout/index.js +1 -1
- package/dist/layouts/app-layout/index.js.map +1 -1
- package/dist/layouts/flex.cjs +1 -1
- package/dist/layouts/flex.d.cts +4 -5
- package/dist/layouts/flex.d.ts +2 -3
- package/dist/layouts/flex.js +1 -1
- package/dist/layouts/service-layout/index.cjs +1 -1
- package/dist/layouts/service-layout/index.cjs.map +1 -1
- package/dist/layouts/service-layout/index.d.cts +28 -13
- package/dist/layouts/service-layout/index.d.ts +41 -25
- package/dist/layouts/service-layout/index.js +1 -1
- package/dist/layouts/service-layout/index.js.map +1 -1
- package/dist/multi-select-BAXHYtlU.cjs +2 -0
- package/dist/multi-select-BAXHYtlU.cjs.map +1 -0
- package/dist/multi-select-oXuLHx0A.js +2 -0
- package/dist/multi-select-oXuLHx0A.js.map +1 -0
- package/dist/progress-Cet_LGmM.cjs +2 -0
- package/dist/progress-Cet_LGmM.cjs.map +1 -0
- package/dist/progress-DdINdNdF.js +2 -0
- package/dist/progress-DdINdNdF.js.map +1 -0
- package/dist/{search-input-BxNMZVG4.js → search-input-B_L6kaz-.js} +2 -2
- package/dist/{search-input-BxNMZVG4.js.map → search-input-B_L6kaz-.js.map} +1 -1
- package/dist/{search-input-BXAnx2q9.cjs → search-input-DWLfcXEU.cjs} +2 -2
- package/dist/{search-input-BXAnx2q9.cjs.map → search-input-DWLfcXEU.cjs.map} +1 -1
- package/dist/{separator-DT79vOG-.d.cts → separator-BSmwGEtT.d.cts} +3 -3
- package/dist/{separator-Cr_2vFm6.d.ts → separator-zD-G3xIG.d.ts} +3 -3
- package/dist/{sidebar-BWhRjoI9.cjs → sidebar-BxGyCuTJ.cjs} +2 -2
- package/dist/{sidebar-BWhRjoI9.cjs.map → sidebar-BxGyCuTJ.cjs.map} +1 -1
- package/dist/{sidebar-DwA61Am0.js → sidebar-CMWETVDr.js} +2 -2
- package/dist/{sidebar-DwA61Am0.js.map → sidebar-CMWETVDr.js.map} +1 -1
- package/dist/switch-BPSKvrTw.cjs +2 -0
- package/dist/switch-BPSKvrTw.cjs.map +1 -0
- package/dist/switch-Crju8DJO.js +2 -0
- package/dist/switch-Crju8DJO.js.map +1 -0
- package/dist/table/index.cjs +1 -1
- package/dist/table/index.cjs.map +1 -1
- package/dist/table/index.d.cts +2 -3
- package/dist/table/index.d.ts +2 -3
- package/dist/table/index.js +1 -1
- package/dist/table/index.js.map +1 -1
- package/dist/table-CSvLRXlk.cjs +2 -0
- package/dist/table-CSvLRXlk.cjs.map +1 -0
- package/dist/table-DCmuhHSH.js +2 -0
- package/dist/table-DCmuhHSH.js.map +1 -0
- package/dist/textarea-BCZiUxv7.js +2 -0
- package/dist/textarea-BCZiUxv7.js.map +1 -0
- package/dist/textarea-BtACo9UF.cjs +2 -0
- package/dist/textarea-BtACo9UF.cjs.map +1 -0
- package/dist/{toggle-BAcB5uqb.d.ts → toggle-BtGh6fdx.d.ts} +5 -6
- package/dist/{toggle-BXosB_DV.d.cts → toggle-CP8phE7Y.d.cts} +3 -4
- package/dist/toggle-D8VezYdr.js +2 -0
- package/dist/toggle-D8VezYdr.js.map +1 -0
- package/dist/toggle-D_5Xh3Rl.cjs +2 -0
- package/dist/toggle-D_5Xh3Rl.cjs.map +1 -0
- package/dist/tooltip-CQ8hkJ42.cjs +2 -0
- package/dist/tooltip-CQ8hkJ42.cjs.map +1 -0
- package/dist/tooltip-CTUSyCdh.js +2 -0
- package/dist/tooltip-CTUSyCdh.js.map +1 -0
- package/dist/{tooltip-CyEOAlsP.d.ts → tooltip-CamHYf1v.d.ts} +6 -7
- package/dist/{tooltip-CJK3asOo.d.cts → tooltip-DLNDOfBF.d.cts} +6 -7
- package/dist/typography/paragraph.d.cts +2 -2
- package/dist/typography/paragraph.d.ts +2 -2
- package/dist/typography/title.d.cts +2 -2
- package/dist/typography/title.d.ts +2 -2
- package/dist/ui/alert-dialog.cjs +1 -1
- package/dist/ui/alert-dialog.d.cts +12 -13
- package/dist/ui/alert-dialog.d.ts +12 -13
- package/dist/ui/alert-dialog.js +1 -1
- package/dist/ui/alert.cjs +1 -1
- package/dist/ui/alert.cjs.map +1 -1
- package/dist/ui/alert.d.cts +4 -5
- package/dist/ui/alert.d.ts +6 -7
- package/dist/ui/alert.js +1 -1
- package/dist/ui/alert.js.map +1 -1
- package/dist/ui/aspect-ratio.cjs +1 -1
- package/dist/ui/aspect-ratio.cjs.map +1 -1
- package/dist/ui/aspect-ratio.d.cts +2 -3
- package/dist/ui/aspect-ratio.d.ts +2 -3
- package/dist/ui/aspect-ratio.js +1 -1
- package/dist/ui/aspect-ratio.js.map +1 -1
- package/dist/ui/avatar.cjs +1 -1
- package/dist/ui/avatar.d.cts +4 -5
- package/dist/ui/avatar.d.ts +4 -5
- package/dist/ui/avatar.js +1 -1
- package/dist/ui/badge.cjs +1 -1
- package/dist/ui/badge.d.cts +4 -5
- package/dist/ui/badge.d.ts +4 -5
- package/dist/ui/badge.js +1 -1
- package/dist/ui/breadcrumb.cjs +1 -1
- package/dist/ui/breadcrumb.cjs.map +1 -1
- package/dist/ui/breadcrumb.d.cts +8 -9
- package/dist/ui/breadcrumb.d.ts +8 -9
- package/dist/ui/breadcrumb.js +1 -1
- package/dist/ui/breadcrumb.js.map +1 -1
- package/dist/ui/button.d.cts +1 -1
- package/dist/ui/button.d.ts +1 -1
- 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.cts +1 -1
- package/dist/ui/buttons/upload-image.d.ts +1 -1
- package/dist/ui/buttons/upload-image.js +1 -1
- package/dist/ui/buttons/upload-image.js.map +1 -1
- package/dist/ui/calendar.cjs +1 -1
- package/dist/ui/calendar.d.cts +4 -5
- package/dist/ui/calendar.d.ts +4 -5
- package/dist/ui/calendar.js +1 -1
- package/dist/ui/card.d.cts +8 -8
- package/dist/ui/card.d.ts +8 -8
- package/dist/ui/carousel.cjs +1 -1
- package/dist/ui/carousel.cjs.map +1 -1
- package/dist/ui/carousel.d.cts +7 -8
- package/dist/ui/carousel.d.ts +7 -8
- package/dist/ui/carousel.js +1 -1
- package/dist/ui/carousel.js.map +1 -1
- package/dist/ui/collapsible.cjs +1 -1
- package/dist/ui/collapsible.cjs.map +1 -1
- package/dist/ui/collapsible.d.cts +4 -5
- package/dist/ui/collapsible.d.ts +4 -5
- package/dist/ui/collapsible.js +1 -1
- package/dist/ui/collapsible.js.map +1 -1
- package/dist/ui/command.d.cts +2 -2
- package/dist/ui/command.d.ts +2 -2
- package/dist/ui/context-menu.cjs +1 -1
- package/dist/ui/context-menu.cjs.map +1 -1
- package/dist/ui/context-menu.d.cts +16 -17
- package/dist/ui/context-menu.d.ts +16 -17
- package/dist/ui/context-menu.js +1 -1
- package/dist/ui/context-menu.js.map +1 -1
- package/dist/ui/dialog.d.cts +1 -1
- package/dist/ui/dialog.d.ts +1 -1
- package/dist/ui/dropdown-menu.d.cts +16 -16
- package/dist/ui/dropdown-menu.d.ts +16 -16
- package/dist/ui/file-uploader.cjs +1 -1
- package/dist/ui/file-uploader.cjs.map +1 -1
- package/dist/ui/file-uploader.d.cts +2 -3
- package/dist/ui/file-uploader.d.ts +2 -3
- package/dist/ui/file-uploader.js +2 -2
- package/dist/ui/file-uploader.js.map +1 -1
- package/dist/ui/form.cjs +1 -1
- package/dist/ui/form.d.cts +7 -8
- package/dist/ui/form.d.ts +7 -8
- package/dist/ui/form.js +1 -1
- package/dist/ui/hover-card.cjs +1 -1
- package/dist/ui/hover-card.cjs.map +1 -1
- package/dist/ui/hover-card.d.cts +4 -5
- package/dist/ui/hover-card.d.ts +4 -5
- package/dist/ui/hover-card.js +1 -1
- package/dist/ui/hover-card.js.map +1 -1
- package/dist/ui/input-otp.cjs +1 -1
- package/dist/ui/input-otp.cjs.map +1 -1
- package/dist/ui/input-otp.d.cts +5 -6
- package/dist/ui/input-otp.d.ts +5 -6
- package/dist/ui/input-otp.js +1 -1
- package/dist/ui/input-otp.js.map +1 -1
- package/dist/ui/input.cjs +1 -1
- package/dist/ui/input.d.cts +1 -1
- package/dist/ui/input.d.ts +1 -1
- package/dist/ui/input.js +1 -1
- package/dist/ui/inputs/search-input.cjs +1 -1
- package/dist/ui/inputs/search-input.d.cts +3 -3
- package/dist/ui/inputs/search-input.d.ts +3 -3
- package/dist/ui/inputs/search-input.js +1 -1
- package/dist/ui/label.cjs +1 -1
- package/dist/ui/label.d.cts +2 -3
- package/dist/ui/label.d.ts +2 -3
- package/dist/ui/label.js +1 -1
- package/dist/ui/menubar.cjs +1 -1
- package/dist/ui/menubar.cjs.map +1 -1
- package/dist/ui/menubar.d.cts +17 -18
- package/dist/ui/menubar.d.ts +17 -18
- package/dist/ui/menubar.js +1 -1
- package/dist/ui/menubar.js.map +1 -1
- package/dist/ui/multi-select.cjs +1 -1
- package/dist/ui/multi-select.d.cts +4 -4
- package/dist/ui/multi-select.d.ts +4 -4
- package/dist/ui/multi-select.js +1 -1
- package/dist/ui/navigation-menu.d.cts +11 -11
- package/dist/ui/navigation-menu.d.ts +11 -11
- package/dist/ui/pagination.cjs +1 -1
- package/dist/ui/pagination.cjs.map +1 -1
- package/dist/ui/pagination.d.cts +9 -10
- package/dist/ui/pagination.d.ts +9 -10
- package/dist/ui/pagination.js +1 -1
- package/dist/ui/pagination.js.map +1 -1
- package/dist/ui/popover.d.cts +5 -5
- package/dist/ui/popover.d.ts +5 -5
- package/dist/ui/progress.cjs +1 -1
- package/dist/ui/progress.d.cts +2 -3
- package/dist/ui/progress.d.ts +2 -3
- package/dist/ui/progress.js +1 -1
- package/dist/ui/radio-group.cjs +1 -1
- package/dist/ui/radio-group.cjs.map +1 -1
- package/dist/ui/radio-group.d.cts +3 -4
- package/dist/ui/radio-group.d.ts +3 -4
- package/dist/ui/radio-group.js +1 -1
- package/dist/ui/radio-group.js.map +1 -1
- package/dist/ui/resizable.cjs +1 -1
- package/dist/ui/resizable.cjs.map +1 -1
- package/dist/ui/resizable.d.cts +4 -5
- package/dist/ui/resizable.d.ts +4 -5
- package/dist/ui/resizable.js +1 -1
- package/dist/ui/resizable.js.map +1 -1
- package/dist/ui/scroll-area.d.cts +3 -3
- package/dist/ui/scroll-area.d.ts +3 -3
- package/dist/ui/select.d.cts +11 -11
- package/dist/ui/select.d.ts +11 -11
- package/dist/ui/separator.d.cts +1 -1
- package/dist/ui/separator.d.ts +1 -1
- package/dist/ui/sheet.d.cts +9 -9
- package/dist/ui/sheet.d.ts +9 -9
- package/dist/ui/sidebar.cjs +1 -1
- package/dist/ui/sidebar.cjs.map +1 -1
- package/dist/ui/sidebar.d.cts +30 -31
- package/dist/ui/sidebar.d.ts +30 -31
- package/dist/ui/sidebar.js +1 -1
- package/dist/ui/sidebar.js.map +1 -1
- package/dist/ui/skeleton.d.cts +2 -2
- package/dist/ui/skeleton.d.ts +2 -2
- package/dist/ui/slider.cjs +1 -1
- package/dist/ui/slider.cjs.map +1 -1
- package/dist/ui/slider.d.cts +2 -3
- package/dist/ui/slider.d.ts +2 -3
- package/dist/ui/slider.js +1 -1
- package/dist/ui/slider.js.map +1 -1
- package/dist/ui/sonner.d.cts +2 -2
- package/dist/ui/sonner.d.ts +2 -2
- package/dist/ui/switch.cjs +1 -1
- package/dist/ui/switch.d.cts +2 -3
- package/dist/ui/switch.d.ts +2 -3
- package/dist/ui/switch.js +1 -1
- package/dist/ui/table.cjs +1 -1
- package/dist/ui/table.d.cts +9 -10
- package/dist/ui/table.d.ts +9 -10
- package/dist/ui/table.js +1 -1
- package/dist/ui/tabs.d.cts +5 -5
- package/dist/ui/tabs.d.ts +5 -5
- package/dist/ui/textarea.cjs +1 -1
- package/dist/ui/textarea.d.cts +2 -3
- package/dist/ui/textarea.d.ts +2 -3
- package/dist/ui/textarea.js +1 -1
- 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 -5
- package/dist/ui/toggle-group.d.ts +4 -5
- package/dist/ui/toggle-group.js +1 -1
- package/dist/ui/toggle-group.js.map +1 -1
- package/dist/ui/toggle.cjs +1 -1
- package/dist/ui/toggle.d.cts +1 -1
- package/dist/ui/toggle.d.ts +1 -1
- package/dist/ui/toggle.js +1 -1
- package/dist/ui/tooltip.cjs +1 -1
- package/dist/ui/tooltip.d.cts +1 -1
- package/dist/ui/tooltip.d.ts +1 -1
- package/dist/ui/tooltip.js +1 -1
- package/package.json +2 -2
- package/dist/alert-dialog-7AEaiJxA.cjs +0 -2
- package/dist/alert-dialog-7AEaiJxA.cjs.map +0 -1
- package/dist/alert-dialog-B8Whrlfq.js +0 -2
- package/dist/alert-dialog-B8Whrlfq.js.map +0 -1
- package/dist/avatar-Bp69hha6.js +0 -2
- package/dist/avatar-Bp69hha6.js.map +0 -1
- package/dist/avatar-CRQdBYW5.cjs +0 -2
- package/dist/avatar-CRQdBYW5.cjs.map +0 -1
- package/dist/badge-8wMMxROk.js +0 -2
- package/dist/badge-8wMMxROk.js.map +0 -1
- package/dist/badge-BnFraaZ1.cjs +0 -2
- package/dist/badge-BnFraaZ1.cjs.map +0 -1
- package/dist/calendar-BW3whtDD.js +0 -2
- package/dist/calendar-BW3whtDD.js.map +0 -1
- package/dist/calendar-Cd2aQCHB.cjs.map +0 -1
- package/dist/drawer-BbQKog4D.js +0 -2
- package/dist/drawer-BbQKog4D.js.map +0 -1
- package/dist/drawer-vqMdOZtq.cjs +0 -2
- package/dist/drawer-vqMdOZtq.cjs.map +0 -1
- package/dist/flex-BxBmZCWh.js +0 -2
- package/dist/flex-BxBmZCWh.js.map +0 -1
- package/dist/flex-C-4TxUDe.cjs +0 -2
- package/dist/flex-C-4TxUDe.cjs.map +0 -1
- package/dist/form-B0fOiANW.js +0 -2
- package/dist/form-B0fOiANW.js.map +0 -1
- package/dist/form-DAwCSzSe.cjs +0 -2
- package/dist/form-DAwCSzSe.cjs.map +0 -1
- package/dist/input-B0Q1kBoj.js +0 -2
- package/dist/input-B0Q1kBoj.js.map +0 -1
- package/dist/input-BxXRqpc1.cjs +0 -2
- package/dist/input-BxXRqpc1.cjs.map +0 -1
- package/dist/label-BbuMrcie.cjs +0 -2
- package/dist/label-BbuMrcie.cjs.map +0 -1
- package/dist/label-CyaoUND0.js +0 -2
- package/dist/label-CyaoUND0.js.map +0 -1
- package/dist/multi-select-Bp7nkNEB.js +0 -2
- package/dist/multi-select-Bp7nkNEB.js.map +0 -1
- package/dist/multi-select-CGe8Mg3n.cjs +0 -2
- package/dist/multi-select-CGe8Mg3n.cjs.map +0 -1
- package/dist/progress-CBZMOdvp.js +0 -2
- package/dist/progress-CBZMOdvp.js.map +0 -1
- package/dist/progress-CO0tL2yC.cjs +0 -2
- package/dist/progress-CO0tL2yC.cjs.map +0 -1
- package/dist/switch-32ewlnXt.js +0 -2
- package/dist/switch-32ewlnXt.js.map +0 -1
- package/dist/switch-BCOPCdXH.cjs +0 -2
- package/dist/switch-BCOPCdXH.cjs.map +0 -1
- package/dist/table-6BtDTiv_.cjs +0 -2
- package/dist/table-6BtDTiv_.cjs.map +0 -1
- package/dist/table-CachGeLA.js +0 -2
- package/dist/table-CachGeLA.js.map +0 -1
- package/dist/textarea-BEPen5oo.cjs +0 -2
- package/dist/textarea-BEPen5oo.cjs.map +0 -1
- package/dist/textarea-BI5mw0Vy.js +0 -2
- package/dist/textarea-BI5mw0Vy.js.map +0 -1
- package/dist/toggle-Cicuy0bA.cjs +0 -2
- package/dist/toggle-Cicuy0bA.cjs.map +0 -1
- package/dist/toggle-DZbuAtVZ.js +0 -2
- package/dist/toggle-DZbuAtVZ.js.map +0 -1
- package/dist/tooltip-CN8vvmWA.js +0 -2
- package/dist/tooltip-CN8vvmWA.js.map +0 -1
- package/dist/tooltip-meYt4lxB.cjs +0 -2
- package/dist/tooltip-meYt4lxB.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime5 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/number-field.d.ts
|
|
@@ -22,7 +22,7 @@ declare const NumberField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
22
22
|
unitText,
|
|
23
23
|
description,
|
|
24
24
|
onValueChange
|
|
25
|
-
}: Props<TFieldValues>) =>
|
|
25
|
+
}: Props<TFieldValues>) => react_jsx_runtime5.JSX.Element;
|
|
26
26
|
//#endregion
|
|
27
27
|
export { NumberField };
|
|
28
28
|
//# sourceMappingURL=number-field.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../label-
|
|
1
|
+
import"../label-DdpIoRiG.js";import{FormControl as e,FormDescription as t,FormField as n,FormItem as r,FormLabel as i,FormMessage as a}from"../form-D-gDMD-J.js";import{Input as o}from"../input-BFZuwsER.js";import{cn as s}from"@customafk/react-toolkit/utils";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{useCallback as u,useEffect as d,useMemo as f,useRef as p,useState as m}from"react";import{useWatch as h}from"react-hook-form";const g=e=>e?/^-?\d*\.?\d*$/:/^\d*\.?\d*$/,_=e=>Number(e).toLocaleString(),v=({disabled:e=!1,readonly:t=!1,allowNegative:n=!1,numberAfterDecimalPoint:r=2,roundingRule:i=`none`,value:a=``,unitText:h,decimal:v,placeholder:y,precision:b,onChange:x,onValueChange:S,onBlur:C,...w})=>{let T=p(null),E=p(null),[D,O]=m(a.toString()),k=v?.[1]??r,A=v&&v[0]-v[1],j=f(()=>g(n),[n]),M=u(e=>{if(!k&&e.includes(`.`))return!1;let t=e.split(`.`)[1];return!t||t.length<=k},[k]),N=u(e=>{if(!v||e===`-`)return!0;let[t,n=``]=e.split(`.`);return n.length<=v[1]&&(t.startsWith(`-`)?t.length-1:t.length)<=A},[v,A]),P=u((e,t)=>{if(i===`none`)return e;let n=Math.pow(10,t),r=e*n;switch(i){case`up`:return Math.ceil(r)/n;case`down`:return Math.floor(r)/n;case`nearest`:return r%1<.1?Math.floor(r)/n:r%1>=.59?Math.ceil(r)/n:(Math.floor(r)+.5)/n;default:return e}},[i]),F=u(e=>!r&&e.includes(`.`)||e.split(`.`)[1]?.length>r,[r]),I=u(e=>{if(e===`0`)return`0`;if(!Number(e))return``;let t=parseFloat(e),n=Math.min(k-1,b||0),r=P(t,n).toString(),[i,a=``]=r.split(`.`),o=_(i);return a?`${o}.${a}`:o},[P,k,b]),L=u(e=>{if(!v||e===`-`)return!0;let[t,n=``]=e.split(`.`),r=t.startsWith(`-`)?t.length-1:t.length,i=v[0]-v[1];return n.length<=v[1]&&r<=i},[v]),R=u(e=>{x?.(e);let{value:t}=e.target;if(!t){S?.(void 0),O(``);return}let r=t===`0`,i=t===`-`&&n;if(r||i){S?.(0),O(t);return}let a=j.test(t)&&N(t)&&(v||M(t));if(!a)return;let o=parseFloat(t)||0;S?.(o),O(t)},[n,v,M,N,x,S,j]),z=u(()=>{t||O(e=>e.replace(/,/g,``))},[t]),B=u(()=>{t||(C?.(),O(e=>I(e)))},[t,C,I]);return d(()=>{let e=document.activeElement===E.current;if(!a||!j.test(a.toString())||!L(a.toString())||!v&&F(a.toString())){O(``);return}O(t=>t===`-`?`-`:t?e?a.toString():I(a.toString()):``)},[v,I,a,F,L,j]),d(()=>{if(!T.current||!E.current||!h)return;let e=T.current.offsetWidth;E.current.style.setProperty(`padding-right`,`${(e+10)/16}rem`)},[e,h]),l(`div`,{className:`relative`,children:[c(o,{...w,ref:E,value:D||(t?`0`:``),placeholder:y,disabled:e,readOnly:t,className:s(`font-number text-end`,t&&`bg-muted text-muted-foreground`),onChange:R,onFocus:z,onBlur:B}),h&&c(`span`,{ref:T,className:`text-muted-foreground pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 text-sm`,children:h})]})},y=({name:o,label:s=`Number Field`,placeholder:u=`0`,isShowErrorMsg:d=!1,isShowCount:f=!1,unitText:p=``,description:m=``,onValueChange:g})=>{let _=h({name:o});return c(n,{name:o,render:({field:{onChange:n,...o}})=>l(r,{className:`w-full gap-0`,children:[c(i,{children:s}),c(e,{children:c(v,{...o,placeholder:u,className:`w-full`,unitText:p,onValueChange:e=>{n(e),g?.(e)}})}),f&&l(`div`,{className:`text-muted-foreground text-end text-xs`,children:[_?.length??0,` characters`]}),!!m&&c(t,{children:m}),d&&c(a,{})]})})};export{y as NumberField};
|
|
2
2
|
//# sourceMappingURL=number-field.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-field.js","names":["NumberInput: React.FC<IProps>","value","precision","maxIntegerLength"],"sources":["../../packages/components/ui/inputs/number-input.tsx","../../packages/components/forms/number-field.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nimport { Input } from '../input'\n\nconst createValidationRegex = (allowNegative: boolean): RegExp => {\n return allowNegative ? /^-?\\d*\\.?\\d*$/ : /^\\d*\\.?\\d*$/\n}\n\nconst formatNumberWithCommas = (num: number | string): string => {\n return Number(num).toLocaleString()\n}\n\ninterface IProps extends React.HTMLAttributes<HTMLInputElement> {\n /**\n * Description: Value for the text field\n *\n * Default: ''\n *\n * Usage: Value for the text field\n */\n value?: string | number\n /**\n * Description: Disabled state of the text field\n *\n * Default: `false`\n *\n * Usage: Disabled state of the text field\n *\n * Note: If true, the text field will be disabled\n */\n disabled?: boolean\n /**\n * Description: Readonly state of the text field\n *\n * Default: `false`\n *\n * Usage: Readonly state of the text field\n */\n readonly?: boolean\n /**\n * Description: Allow negative value for the text field\n *\n * Default: `false`\n *\n * Usage: Allow negative value for the text field\n */\n allowNegative?: boolean\n /**\n * Description: Decimal point for the text field\n *\n * Default: `undefined`\n *\n * Usage: Ex: [12,3] => console.log(2323.23) // True\n *\n * Note: IF use this prop, `numberAfterDecimalPoint` will be ignored\n */\n decimal?: [number, number]\n /**\n * Description: Rounding rule for the text field\n *\n * Default: `nearest`\n *\n * Usage: Rounding rule for the text field\n */\n roundingRule?: 'up' | 'down' | 'nearest' | 'none'\n /**\n * Description: Number of digits after the decimal point\n *\n * Default: `2`\n *\n * Usage: Number of digits after the decimal point\n */\n numberAfterDecimalPoint?: number\n /**\n * Description: Placeholder for the text field\n *\n * Default: ''\n *\n * Usage: Placeholder for the text field\n */\n placeholder?: string\n /**\n * Description: Unit text for the text field\n *\n * Default: ''\n *\n * E.g. 'kg', 'm', 'USD'...\n */\n unitText?: string\n /**\n * Description: Invalid state of the text field\n *\n * Default: `false`\n *\n * Usage: Invalid state of the text field\n */\n invalid?: boolean\n /**\n * Description: Precision for the text field\n *\n * Default: `undefined`\n * E.g.\n * - 2.13 => 2.1 when precision is 1\n * - 2.134 => 2.13 when precision is 2\n */\n precision?: number\n /**\n * Description: Callback function for the value change\n * Usage: Callback function for the value change\n */\n onValueChange?: (value?: number) => void\n onBlur?: () => void\n}\n/**\n * ## Unit Text Field Component\n *\n * **Description**: This component is to display common text field with unit\n *\n * **Usage**: Text field with unit example: 1000 (kg), 100 (m), 1000 (USD)...\n */\nexport const NumberInput: React.FC<IProps> = ({\n disabled = false,\n readonly = false,\n allowNegative = false,\n numberAfterDecimalPoint = 2,\n roundingRule = 'none',\n value: initialValue = '',\n unitText,\n decimal,\n placeholder,\n precision,\n onChange,\n onValueChange,\n onBlur,\n ...props\n}) => {\n const _unitRef = React.useRef<HTMLSpanElement>(null)\n const _inputRef = React.useRef<HTMLInputElement>(null)\n\n const [value, setValue] = React.useState<string>(initialValue.toString())\n\n // Memoized values for validation and formatting\n const maxDecimalPlaces = decimal?.[1] ?? numberAfterDecimalPoint\n const maxIntegerLength = decimal && decimal[0] - decimal[1]\n const validationRegex = React.useMemo(() => createValidationRegex(allowNegative), [allowNegative])\n\n // Validation functions\n const isValidDecimalLength = React.useCallback(\n (value: string): boolean => {\n if (!maxDecimalPlaces && value.includes('.')) return false\n const decimalPart = value.split('.')[1]\n return !decimalPart || decimalPart.length <= maxDecimalPlaces\n },\n [maxDecimalPlaces],\n )\n const isValidFormat = React.useCallback(\n (value: string): boolean => {\n if (!decimal || value === '-') return true\n const [integerPart, decimalPart = ''] = value.split('.')\n\n return decimalPart.length <= decimal[1] && (integerPart.startsWith('-') ? integerPart.length - 1 : integerPart.length) <= maxIntegerLength!\n },\n [decimal, maxIntegerLength],\n )\n const customRoundedValue = React.useCallback(\n (value: number, precision: number) => {\n if (roundingRule === 'none') return value\n\n const factor = Math.pow(10, precision)\n const scaledValue = value * factor\n\n switch (roundingRule) {\n case 'up':\n return Math.ceil(scaledValue) / factor\n case 'down':\n return Math.floor(scaledValue) / factor\n case 'nearest': {\n if (scaledValue % 1 < 0.1) return Math.floor(scaledValue) / factor\n if (scaledValue % 1 >= 0.59) return Math.ceil(scaledValue) / factor\n return (Math.floor(scaledValue) + 0.5) / factor\n }\n default:\n return value\n }\n },\n [roundingRule],\n )\n const isDecimalPointGreaterThanLimit = React.useCallback(\n (value: string) => (!numberAfterDecimalPoint && value.includes('.')) || value.split('.')[1]?.length > numberAfterDecimalPoint,\n [numberAfterDecimalPoint],\n )\n const formattedValue = React.useCallback(\n (val: string) => {\n if (val === '0') return '0'\n if (!Number(val)) return ''\n\n const numValue = parseFloat(val)\n const effectivePrecision = Math.min(maxDecimalPlaces - 1, precision || 0)\n const roundedValue = customRoundedValue(numValue, effectivePrecision).toString()\n const [integerPart, decimalPart = ''] = roundedValue.split('.')\n const formattedInteger = formatNumberWithCommas(integerPart)\n return decimalPart ? `${formattedInteger}.${decimalPart}` : formattedInteger\n },\n [customRoundedValue, maxDecimalPlaces, precision],\n )\n // Validate decimal point is less than or equal to the limit\n const validateDecimalPoint = React.useCallback(\n (value: string) => {\n if (!decimal || value === '-') return true\n\n const [integerPart, decimalPart = ''] = value.split('.')\n const integerLength = integerPart.startsWith('-') ? integerPart.length - 1 : integerPart.length\n const maxIntegerLength = decimal[0] - decimal[1]\n\n return decimalPart.length <= decimal[1] && integerLength <= maxIntegerLength\n },\n [decimal],\n )\n const handleChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n // Don't prevent default behavior of input change\n onChange?.(e)\n\n // Custom event handler for value change\n const { value: inputValue } = e.target\n\n // Handle empty input\n if (!inputValue) {\n onValueChange?.(undefined)\n setValue('')\n return\n }\n\n // Handle zero and negative zero\n const isZero = inputValue === '0'\n const isNegativeZero = inputValue === '-' && allowNegative\n if (isZero || isNegativeZero) {\n onValueChange?.(0)\n setValue(inputValue)\n return\n }\n\n // Validate input format\n const isValid = validationRegex.test(inputValue) && isValidFormat(inputValue) && (decimal || isValidDecimalLength(inputValue))\n if (!isValid) return\n\n const numericValue = parseFloat(inputValue) || 0\n onValueChange?.(numericValue)\n setValue(inputValue)\n },\n [allowNegative, decimal, isValidDecimalLength, isValidFormat, onChange, onValueChange, validationRegex],\n )\n\n const handleFocus = React.useCallback(() => {\n if (readonly) return\n setValue((prev) => prev.replace(/,/g, '')) // Remove commas for easier editing\n }, [readonly])\n\n const handleBlur = React.useCallback(() => {\n if (readonly) return\n onBlur?.()\n setValue((prev) => formattedValue(prev))\n }, [readonly, onBlur, formattedValue])\n\n // Set initial value\n React.useEffect(() => {\n const isFocused = document.activeElement === _inputRef.current\n\n if (\n !initialValue ||\n !validationRegex.test(initialValue.toString()) ||\n !validateDecimalPoint(initialValue.toString()) ||\n (!decimal && isDecimalPointGreaterThanLimit(initialValue.toString()))\n ) {\n setValue('')\n return\n }\n\n setValue((prev) => {\n if (prev === '-') return '-'\n if (!prev) return ''\n return isFocused ? initialValue.toString() : formattedValue(initialValue.toString())\n })\n }, [decimal, formattedValue, initialValue, isDecimalPointGreaterThanLimit, validateDecimalPoint, validationRegex])\n\n // Set padding right for the input field\n React.useEffect(() => {\n if (!_unitRef.current || !_inputRef.current || !unitText) return\n const unitWidth = _unitRef.current.offsetWidth\n _inputRef.current.style.setProperty('padding-right', `${(unitWidth + 10) / 16}rem`)\n }, [disabled, unitText])\n\n return (\n <div className=\"relative\">\n <Input\n {...props}\n ref={_inputRef}\n value={value || (readonly ? '0' : '')}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readonly}\n className={cn('font-number text-end', readonly && 'bg-muted text-muted-foreground')}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n />\n {unitText && (\n <span ref={_unitRef} className=\"text-muted-foreground pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 text-sm\">\n {unitText}\n </span>\n )}\n </div>\n )\n}\n","import { type FieldPath, type FieldValues, useWatch } from 'react-hook-form'\n\nimport { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '../ui/form'\nimport { NumberInput } from '../ui/inputs/number-input'\n\ntype Props<TFieldValues extends FieldValues = FieldValues> = {\n name: FieldPath<TFieldValues>\n label?: string\n description?: string\n placeholder?: string\n unitText?: string\n isShowClearButton?: boolean\n isShowErrorMsg?: boolean\n isShowCount?: boolean\n onValueChange?: (value?: number) => void\n}\nexport const NumberField = <TFieldValues extends FieldValues = FieldValues>({\n name,\n label = 'Number Field',\n placeholder = '0',\n isShowErrorMsg = false,\n isShowCount = false,\n unitText = '',\n description = '',\n onValueChange,\n}: Props<TFieldValues>) => {\n const valueWatch = useWatch({ name })\n\n return (\n <FormField\n name={name}\n render={({ field: { onChange, ...field } }) => (\n <FormItem className=\"w-full gap-0\">\n <FormLabel>{label}</FormLabel>\n <FormControl>\n <NumberInput\n {...field}\n placeholder={placeholder}\n className=\"w-full\"\n unitText={unitText}\n onValueChange={(value) => {\n onChange(value)\n onValueChange?.(value)\n }}\n />\n </FormControl>\n {isShowCount && <div className=\"text-muted-foreground text-end text-xs\">{valueWatch?.length ?? 0} characters</div>}\n {!!description && <FormDescription>{description}</FormDescription>}\n {isShowErrorMsg && <FormMessage />}\n </FormItem>\n )}\n />\n )\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"number-field.js","names":["NumberInput: React.FC<IProps>","value","precision","maxIntegerLength"],"sources":["../../packages/components/ui/inputs/number-input.tsx","../../packages/components/forms/number-field.tsx"],"sourcesContent":["'use client'\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nimport { Input } from '../input'\n\nconst createValidationRegex = (allowNegative: boolean): RegExp => {\n return allowNegative ? /^-?\\d*\\.?\\d*$/ : /^\\d*\\.?\\d*$/\n}\n\nconst formatNumberWithCommas = (num: number | string): string => {\n return Number(num).toLocaleString()\n}\n\ninterface IProps extends React.HTMLAttributes<HTMLInputElement> {\n /**\n * Description: Value for the text field\n *\n * Default: ''\n *\n * Usage: Value for the text field\n */\n value?: string | number\n /**\n * Description: Disabled state of the text field\n *\n * Default: `false`\n *\n * Usage: Disabled state of the text field\n *\n * Note: If true, the text field will be disabled\n */\n disabled?: boolean\n /**\n * Description: Readonly state of the text field\n *\n * Default: `false`\n *\n * Usage: Readonly state of the text field\n */\n readonly?: boolean\n /**\n * Description: Allow negative value for the text field\n *\n * Default: `false`\n *\n * Usage: Allow negative value for the text field\n */\n allowNegative?: boolean\n /**\n * Description: Decimal point for the text field\n *\n * Default: `undefined`\n *\n * Usage: Ex: [12,3] => console.log(2323.23) // True\n *\n * Note: IF use this prop, `numberAfterDecimalPoint` will be ignored\n */\n decimal?: [number, number]\n /**\n * Description: Rounding rule for the text field\n *\n * Default: `nearest`\n *\n * Usage: Rounding rule for the text field\n */\n roundingRule?: 'up' | 'down' | 'nearest' | 'none'\n /**\n * Description: Number of digits after the decimal point\n *\n * Default: `2`\n *\n * Usage: Number of digits after the decimal point\n */\n numberAfterDecimalPoint?: number\n /**\n * Description: Placeholder for the text field\n *\n * Default: ''\n *\n * Usage: Placeholder for the text field\n */\n placeholder?: string\n /**\n * Description: Unit text for the text field\n *\n * Default: ''\n *\n * E.g. 'kg', 'm', 'USD'...\n */\n unitText?: string\n /**\n * Description: Invalid state of the text field\n *\n * Default: `false`\n *\n * Usage: Invalid state of the text field\n */\n invalid?: boolean\n /**\n * Description: Precision for the text field\n *\n * Default: `undefined`\n * E.g.\n * - 2.13 => 2.1 when precision is 1\n * - 2.134 => 2.13 when precision is 2\n */\n precision?: number\n /**\n * Description: Callback function for the value change\n * Usage: Callback function for the value change\n */\n onValueChange?: (value?: number) => void\n onBlur?: () => void\n}\n/**\n * ## Unit Text Field Component\n *\n * **Description**: This component is to display common text field with unit\n *\n * **Usage**: Text field with unit example: 1000 (kg), 100 (m), 1000 (USD)...\n */\nexport const NumberInput: React.FC<IProps> = ({\n disabled = false,\n readonly = false,\n allowNegative = false,\n numberAfterDecimalPoint = 2,\n roundingRule = 'none',\n value: initialValue = '',\n unitText,\n decimal,\n placeholder,\n precision,\n onChange,\n onValueChange,\n onBlur,\n ...props\n}) => {\n const _unitRef = useRef<HTMLSpanElement>(null)\n const _inputRef = useRef<HTMLInputElement>(null)\n\n const [value, setValue] = useState<string>(initialValue.toString())\n\n // Memoized values for validation and formatting\n const maxDecimalPlaces = decimal?.[1] ?? numberAfterDecimalPoint\n const maxIntegerLength = decimal && decimal[0] - decimal[1]\n const validationRegex = useMemo(() => createValidationRegex(allowNegative), [allowNegative])\n\n // Validation functions\n const isValidDecimalLength = useCallback(\n (value: string): boolean => {\n if (!maxDecimalPlaces && value.includes('.')) return false\n const decimalPart = value.split('.')[1]\n return !decimalPart || decimalPart.length <= maxDecimalPlaces\n },\n [maxDecimalPlaces],\n )\n const isValidFormat = useCallback(\n (value: string): boolean => {\n if (!decimal || value === '-') return true\n const [integerPart, decimalPart = ''] = value.split('.')\n\n return decimalPart.length <= decimal[1] && (integerPart.startsWith('-') ? integerPart.length - 1 : integerPart.length) <= maxIntegerLength!\n },\n [decimal, maxIntegerLength],\n )\n const customRoundedValue = useCallback(\n (value: number, precision: number) => {\n if (roundingRule === 'none') return value\n\n const factor = Math.pow(10, precision)\n const scaledValue = value * factor\n\n switch (roundingRule) {\n case 'up':\n return Math.ceil(scaledValue) / factor\n case 'down':\n return Math.floor(scaledValue) / factor\n case 'nearest': {\n if (scaledValue % 1 < 0.1) return Math.floor(scaledValue) / factor\n if (scaledValue % 1 >= 0.59) return Math.ceil(scaledValue) / factor\n return (Math.floor(scaledValue) + 0.5) / factor\n }\n default:\n return value\n }\n },\n [roundingRule],\n )\n const isDecimalPointGreaterThanLimit = useCallback(\n (value: string) => (!numberAfterDecimalPoint && value.includes('.')) || value.split('.')[1]?.length > numberAfterDecimalPoint,\n [numberAfterDecimalPoint],\n )\n const formattedValue = useCallback(\n (val: string) => {\n if (val === '0') return '0'\n if (!Number(val)) return ''\n\n const numValue = parseFloat(val)\n const effectivePrecision = Math.min(maxDecimalPlaces - 1, precision || 0)\n const roundedValue = customRoundedValue(numValue, effectivePrecision).toString()\n const [integerPart, decimalPart = ''] = roundedValue.split('.')\n const formattedInteger = formatNumberWithCommas(integerPart)\n return decimalPart ? `${formattedInteger}.${decimalPart}` : formattedInteger\n },\n [customRoundedValue, maxDecimalPlaces, precision],\n )\n // Validate decimal point is less than or equal to the limit\n const validateDecimalPoint = useCallback(\n (value: string) => {\n if (!decimal || value === '-') return true\n\n const [integerPart, decimalPart = ''] = value.split('.')\n const integerLength = integerPart.startsWith('-') ? integerPart.length - 1 : integerPart.length\n const maxIntegerLength = decimal[0] - decimal[1]\n\n return decimalPart.length <= decimal[1] && integerLength <= maxIntegerLength\n },\n [decimal],\n )\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n // Don't prevent default behavior of input change\n onChange?.(e)\n\n // Custom event handler for value change\n const { value: inputValue } = e.target\n\n // Handle empty input\n if (!inputValue) {\n onValueChange?.(undefined)\n setValue('')\n return\n }\n\n // Handle zero and negative zero\n const isZero = inputValue === '0'\n const isNegativeZero = inputValue === '-' && allowNegative\n if (isZero || isNegativeZero) {\n onValueChange?.(0)\n setValue(inputValue)\n return\n }\n\n // Validate input format\n const isValid = validationRegex.test(inputValue) && isValidFormat(inputValue) && (decimal || isValidDecimalLength(inputValue))\n if (!isValid) return\n\n const numericValue = parseFloat(inputValue) || 0\n onValueChange?.(numericValue)\n setValue(inputValue)\n },\n [allowNegative, decimal, isValidDecimalLength, isValidFormat, onChange, onValueChange, validationRegex],\n )\n\n const handleFocus = useCallback(() => {\n if (readonly) return\n setValue((prev) => prev.replace(/,/g, '')) // Remove commas for easier editing\n }, [readonly])\n\n const handleBlur = useCallback(() => {\n if (readonly) return\n onBlur?.()\n setValue((prev) => formattedValue(prev))\n }, [readonly, onBlur, formattedValue])\n\n // Set initial value\n useEffect(() => {\n const isFocused = document.activeElement === _inputRef.current\n\n if (\n !initialValue ||\n !validationRegex.test(initialValue.toString()) ||\n !validateDecimalPoint(initialValue.toString()) ||\n (!decimal && isDecimalPointGreaterThanLimit(initialValue.toString()))\n ) {\n setValue('')\n return\n }\n\n setValue((prev) => {\n if (prev === '-') return '-'\n if (!prev) return ''\n return isFocused ? initialValue.toString() : formattedValue(initialValue.toString())\n })\n }, [decimal, formattedValue, initialValue, isDecimalPointGreaterThanLimit, validateDecimalPoint, validationRegex])\n\n // Set padding right for the input field\n useEffect(() => {\n if (!_unitRef.current || !_inputRef.current || !unitText) return\n const unitWidth = _unitRef.current.offsetWidth\n _inputRef.current.style.setProperty('padding-right', `${(unitWidth + 10) / 16}rem`)\n }, [disabled, unitText])\n\n return (\n <div className=\"relative\">\n <Input\n {...props}\n ref={_inputRef}\n value={value || (readonly ? '0' : '')}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={readonly}\n className={cn('font-number text-end', readonly && 'bg-muted text-muted-foreground')}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n />\n {unitText && (\n <span ref={_unitRef} className=\"text-muted-foreground pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 text-sm\">\n {unitText}\n </span>\n )}\n </div>\n )\n}\n","import { type FieldPath, type FieldValues, useWatch } from 'react-hook-form'\n\nimport { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '../ui/form'\nimport { NumberInput } from '../ui/inputs/number-input'\n\ntype Props<TFieldValues extends FieldValues = FieldValues> = {\n name: FieldPath<TFieldValues>\n label?: string\n description?: string\n placeholder?: string\n unitText?: string\n isShowClearButton?: boolean\n isShowErrorMsg?: boolean\n isShowCount?: boolean\n onValueChange?: (value?: number) => void\n}\nexport const NumberField = <TFieldValues extends FieldValues = FieldValues>({\n name,\n label = 'Number Field',\n placeholder = '0',\n isShowErrorMsg = false,\n isShowCount = false,\n unitText = '',\n description = '',\n onValueChange,\n}: Props<TFieldValues>) => {\n const valueWatch = useWatch({ name })\n\n return (\n <FormField\n name={name}\n render={({ field: { onChange, ...field } }) => (\n <FormItem className=\"w-full gap-0\">\n <FormLabel>{label}</FormLabel>\n <FormControl>\n <NumberInput\n {...field}\n placeholder={placeholder}\n className=\"w-full\"\n unitText={unitText}\n onValueChange={(value) => {\n onChange(value)\n onValueChange?.(value)\n }}\n />\n </FormControl>\n {isShowCount && <div className=\"text-muted-foreground text-end text-xs\">{valueWatch?.length ?? 0} characters</div>}\n {!!description && <FormDescription>{description}</FormDescription>}\n {isShowErrorMsg && <FormMessage />}\n </FormItem>\n )}\n />\n )\n}\n"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require(`../chunk-CUT6urMc.cjs`);require(`../label-
|
|
1
|
+
"use client";const e=require(`../chunk-CUT6urMc.cjs`);require(`../label-BBPPT0-L.cjs`);const t=require(`../form-CaxhlWxK.cjs`),n=require(`../input-ERPHY3v4.cjs`),r=e.__toESM(require(`lucide-react`)),i=e.__toESM(require(`@customafk/react-toolkit/utils`)),a=e.__toESM(require(`react/jsx-runtime`)),o=({className:e,...t})=>{let o=React.useId(),[s,c]=React.useState(!1),l=React.useCallback(()=>c(e=>!e),[]);return(0,a.jsxs)(`div`,{className:`relative`,children:[(0,a.jsx)(n.Input,{...t,id:o,placeholder:`Password`,type:s?`text`:`password`,className:(0,i.cn)(`pe-9`,e)}),(0,a.jsx)(`button`,{className:`text-muted-foreground/80 hover:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 absolute inset-y-0 end-0 flex h-full w-9 items-center justify-center rounded-e-md transition-[color,box-shadow] outline-none focus:z-10 focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,type:`button`,onClick:l,"aria-label":s?`Hide password`:`Show password`,"aria-pressed":s,"aria-controls":`password`,children:s?(0,a.jsx)(r.EyeOffIcon,{size:16,"aria-hidden":`true`}):(0,a.jsx)(r.EyeIcon,{size:16,"aria-hidden":`true`})})]})},s=({name:e,label:n=`Text Field`,placeholder:r=`Enter text here`,isShowErrorMsg:i=!1,description:s,onValueChange:c})=>(0,a.jsx)(t.FormField,{name:e,render:({field:e})=>(0,a.jsxs)(t.FormItem,{className:`w-full`,children:[(0,a.jsx)(t.FormLabel,{children:n}),(0,a.jsx)(t.FormControl,{children:(0,a.jsx)(o,{placeholder:r,...e,onValueChange:c})}),!!s&&(0,a.jsx)(t.FormDescription,{children:s}),i&&(0,a.jsx)(t.FormMessage,{})]})});exports.PasswordField=s;
|
|
2
2
|
//# sourceMappingURL=password-field.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password-field.cjs","names":["PasswordInput: React.FC<Props>","
|
|
1
|
+
{"version":3,"file":"password-field.cjs","names":["PasswordInput: React.FC<Props>","Input","EyeOffIcon","EyeIcon","FormField","FormItem","FormLabel","FormControl","FormDescription","FormMessage"],"sources":["../../packages/components/ui/inputs/password-input.tsx","../../packages/components/forms/password-field.tsx"],"sourcesContent":["'use client'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nimport { EyeIcon, EyeOffIcon } from 'lucide-react'\n\nimport { Input } from '../input'\n\ntype Props = React.ComponentPropsWithoutRef<typeof Input>\nexport const PasswordInput: React.FC<Props> = ({ className, ...rest }) => {\n const id = React.useId()\n const [isVisible, setIsVisible] = React.useState<boolean>(false)\n const toggleVisibility = React.useCallback(() => setIsVisible((prevState) => !prevState), [])\n return (\n <div className=\"relative\">\n <Input {...rest} id={id} placeholder=\"Password\" type={isVisible ? 'text' : 'password'} className={cn('pe-9', className)} />\n <button\n className=\"text-muted-foreground/80 hover:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 absolute inset-y-0 end-0 flex h-full w-9 items-center justify-center rounded-e-md transition-[color,box-shadow] outline-none focus:z-10 focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50\"\n type=\"button\"\n onClick={toggleVisibility}\n aria-label={isVisible ? 'Hide password' : 'Show password'}\n aria-pressed={isVisible}\n aria-controls=\"password\"\n >\n {isVisible ? <EyeOffIcon size={16} aria-hidden=\"true\" /> : <EyeIcon size={16} aria-hidden=\"true\" />}\n </button>\n </div>\n )\n}\n","'use client'\nimport type { FieldPath, FieldValues } from 'react-hook-form'\n\nimport { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '../ui/form'\nimport { PasswordInput } from '../ui/inputs/password-input'\n\ntype Props<TFieldValues extends FieldValues = FieldValues> = {\n name: FieldPath<TFieldValues>\n label?: string\n description?: string\n placeholder?: string\n isShowErrorMsg?: boolean\n onValueChange?: (value: string) => void\n}\nexport const PasswordField = <TFieldValues extends FieldValues = FieldValues>({\n name,\n label = 'Text Field',\n placeholder = 'Enter text here',\n isShowErrorMsg = false,\n description,\n onValueChange,\n}: Props<TFieldValues>) => {\n return (\n <FormField\n name={name}\n render={({ field }) => (\n <FormItem className=\"w-full\">\n <FormLabel>{label}</FormLabel>\n <FormControl>\n <PasswordInput placeholder={placeholder} {...field} onValueChange={onValueChange} />\n </FormControl>\n {!!description && <FormDescription>{description}</FormDescription>}\n {isShowErrorMsg && <FormMessage />}\n </FormItem>\n )}\n />\n )\n}\n"],"mappings":"wSAQaA,GAAkC,CAAE,YAAW,GAAG,KAAW,CACxE,IAAM,EAAK,MAAM,QACX,CAAC,EAAW,GAAgB,MAAM,SAAkB,IACpD,EAAmB,MAAM,gBAAkB,EAAc,GAAc,CAAC,GAAY,IAC1F,OACE,EAAA,EAAA,MAAC,MAAA,CAAI,UAAU,sBACb,EAAA,EAAA,KAACC,EAAAA,MAAAA,CAAM,GAAI,EAAU,KAAI,YAAY,WAAW,KAAM,EAAY,OAAS,WAAY,WAAA,EAAA,EAAA,IAAc,OAAQ,MAC7G,EAAA,EAAA,KAAC,SAAA,CACC,UAAU,oVACV,KAAK,SACL,QAAS,EACT,aAAY,EAAY,gBAAkB,gBAC1C,eAAc,EACd,gBAAc,oBAEb,GAAY,EAAA,EAAA,KAACC,EAAAA,WAAAA,CAAW,KAAM,GAAI,cAAY,UAAY,EAAA,EAAA,KAACC,EAAAA,QAAAA,CAAQ,KAAM,GAAI,cAAY,eCTrF,GAAiE,CAC5E,OACA,QAAQ,aACR,cAAc,kBACd,iBAAiB,GACjB,cACA,oBAGE,EAAA,EAAA,KAACC,EAAAA,UAAAA,CACO,OACN,QAAS,CAAE,YACT,EAAA,EAAA,MAACC,EAAAA,SAAAA,CAAS,UAAU,oBAClB,EAAA,EAAA,KAACC,EAAAA,UAAAA,CAAAA,SAAW,KACZ,EAAA,EAAA,KAACC,EAAAA,YAAAA,CAAAA,UACC,EAAA,EAAA,KAAC,EAAA,CAA2B,cAAa,GAAI,EAAsB,oBAEpE,CAAC,CAAC,IAAe,EAAA,EAAA,KAACC,EAAAA,gBAAAA,CAAAA,SAAiB,IACnC,IAAkB,EAAA,EAAA,KAACC,EAAAA,YAAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime12 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/password-field.d.ts
|
|
@@ -17,7 +17,7 @@ declare const PasswordField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
17
17
|
isShowErrorMsg,
|
|
18
18
|
description,
|
|
19
19
|
onValueChange
|
|
20
|
-
}: Props<TFieldValues>) =>
|
|
20
|
+
}: Props<TFieldValues>) => react_jsx_runtime12.JSX.Element;
|
|
21
21
|
//#endregion
|
|
22
22
|
export { PasswordField };
|
|
23
23
|
//# sourceMappingURL=password-field.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime9 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/password-field.d.ts
|
|
@@ -17,7 +17,7 @@ declare const PasswordField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
17
17
|
isShowErrorMsg,
|
|
18
18
|
description,
|
|
19
19
|
onValueChange
|
|
20
|
-
}: Props<TFieldValues>) =>
|
|
20
|
+
}: Props<TFieldValues>) => react_jsx_runtime9.JSX.Element;
|
|
21
21
|
//#endregion
|
|
22
22
|
export { PasswordField };
|
|
23
23
|
//# sourceMappingURL=password-field.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import"../label-
|
|
1
|
+
"use client";import"../label-DdpIoRiG.js";import{FormControl as e,FormDescription as t,FormField as n,FormItem as r,FormLabel as i,FormMessage as a}from"../form-D-gDMD-J.js";import{Input as o}from"../input-BFZuwsER.js";import{EyeIcon as s,EyeOffIcon as c}from"lucide-react";import{cn as l}from"@customafk/react-toolkit/utils";import{jsx as u,jsxs as d}from"react/jsx-runtime";const f=({className:e,...t})=>{let n=React.useId(),[r,i]=React.useState(!1),a=React.useCallback(()=>i(e=>!e),[]);return d(`div`,{className:`relative`,children:[u(o,{...t,id:n,placeholder:`Password`,type:r?`text`:`password`,className:l(`pe-9`,e)}),u(`button`,{className:`text-muted-foreground/80 hover:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 absolute inset-y-0 end-0 flex h-full w-9 items-center justify-center rounded-e-md transition-[color,box-shadow] outline-none focus:z-10 focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,type:`button`,onClick:a,"aria-label":r?`Hide password`:`Show password`,"aria-pressed":r,"aria-controls":`password`,children:u(r?c:s,{size:16,"aria-hidden":`true`})})]})},p=({name:o,label:s=`Text Field`,placeholder:c=`Enter text here`,isShowErrorMsg:l=!1,description:p,onValueChange:m})=>u(n,{name:o,render:({field:n})=>d(r,{className:`w-full`,children:[u(i,{children:s}),u(e,{children:u(f,{placeholder:c,...n,onValueChange:m})}),!!p&&u(t,{children:p}),l&&u(a,{})]})});export{p as PasswordField};
|
|
2
2
|
//# sourceMappingURL=password-field.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password-field.js","names":["PasswordInput: React.FC<Props>"],"sources":["../../packages/components/ui/inputs/password-input.tsx","../../packages/components/forms/password-field.tsx"],"sourcesContent":["'use client'\nimport
|
|
1
|
+
{"version":3,"file":"password-field.js","names":["PasswordInput: React.FC<Props>"],"sources":["../../packages/components/ui/inputs/password-input.tsx","../../packages/components/forms/password-field.tsx"],"sourcesContent":["'use client'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nimport { EyeIcon, EyeOffIcon } from 'lucide-react'\n\nimport { Input } from '../input'\n\ntype Props = React.ComponentPropsWithoutRef<typeof Input>\nexport const PasswordInput: React.FC<Props> = ({ className, ...rest }) => {\n const id = React.useId()\n const [isVisible, setIsVisible] = React.useState<boolean>(false)\n const toggleVisibility = React.useCallback(() => setIsVisible((prevState) => !prevState), [])\n return (\n <div className=\"relative\">\n <Input {...rest} id={id} placeholder=\"Password\" type={isVisible ? 'text' : 'password'} className={cn('pe-9', className)} />\n <button\n className=\"text-muted-foreground/80 hover:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 absolute inset-y-0 end-0 flex h-full w-9 items-center justify-center rounded-e-md transition-[color,box-shadow] outline-none focus:z-10 focus-visible:ring-[3px] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50\"\n type=\"button\"\n onClick={toggleVisibility}\n aria-label={isVisible ? 'Hide password' : 'Show password'}\n aria-pressed={isVisible}\n aria-controls=\"password\"\n >\n {isVisible ? <EyeOffIcon size={16} aria-hidden=\"true\" /> : <EyeIcon size={16} aria-hidden=\"true\" />}\n </button>\n </div>\n )\n}\n","'use client'\nimport type { FieldPath, FieldValues } from 'react-hook-form'\n\nimport { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '../ui/form'\nimport { PasswordInput } from '../ui/inputs/password-input'\n\ntype Props<TFieldValues extends FieldValues = FieldValues> = {\n name: FieldPath<TFieldValues>\n label?: string\n description?: string\n placeholder?: string\n isShowErrorMsg?: boolean\n onValueChange?: (value: string) => void\n}\nexport const PasswordField = <TFieldValues extends FieldValues = FieldValues>({\n name,\n label = 'Text Field',\n placeholder = 'Enter text here',\n isShowErrorMsg = false,\n description,\n onValueChange,\n}: Props<TFieldValues>) => {\n return (\n <FormField\n name={name}\n render={({ field }) => (\n <FormItem className=\"w-full\">\n <FormLabel>{label}</FormLabel>\n <FormControl>\n <PasswordInput placeholder={placeholder} {...field} onValueChange={onValueChange} />\n </FormControl>\n {!!description && <FormDescription>{description}</FormDescription>}\n {isShowErrorMsg && <FormMessage />}\n </FormItem>\n )}\n />\n )\n}\n"],"mappings":"wXAQA,MAAaA,GAAkC,CAAE,YAAW,GAAG,KAAW,CACxE,IAAM,EAAK,MAAM,QACX,CAAC,EAAW,GAAgB,MAAM,SAAkB,IACpD,EAAmB,MAAM,gBAAkB,EAAc,GAAc,CAAC,GAAY,IAC1F,OACE,EAAC,MAAA,CAAI,UAAU,qBACb,EAAC,EAAA,CAAM,GAAI,EAAU,KAAI,YAAY,WAAW,KAAM,EAAY,OAAS,WAAY,UAAW,EAAG,OAAQ,KAC7G,EAAC,SAAA,CACC,UAAU,oVACV,KAAK,SACL,QAAS,EACT,aAAY,EAAY,gBAAkB,gBAC1C,eAAc,EACd,gBAAc,oBAED,EAAZ,EAAa,EAA8C,EAA9C,CAAW,KAAM,GAAI,cAAY,eCT1C,GAAiE,CAC5E,OACA,QAAQ,aACR,cAAc,kBACd,iBAAiB,GACjB,cACA,mBAGE,EAAC,EAAA,CACO,OACN,QAAS,CAAE,WACT,EAAC,EAAA,CAAS,UAAU,mBAClB,EAAC,EAAA,CAAA,SAAW,IACZ,EAAC,EAAA,CAAA,SACC,EAAC,EAAA,CAA2B,cAAa,GAAI,EAAsB,oBAEpE,CAAC,CAAC,GAAe,EAAC,EAAA,CAAA,SAAiB,IACnC,GAAkB,EAAC,EAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require(`../chunk-CUT6urMc.cjs`);require(`../label-
|
|
1
|
+
"use client";const e=require(`../chunk-CUT6urMc.cjs`);require(`../label-BBPPT0-L.cjs`);const t=require(`../form-CaxhlWxK.cjs`),n=require(`../select-oxr4KoHx.cjs`),r=e.__toESM(require(`@customafk/react-toolkit/utils`)),i=e.__toESM(require(`react/jsx-runtime`)),a=({name:e,label:a=`Select Field`,placeholder:o=`Select an option`,disabledValues:s=[],options:c=[],isShowLabel:l=!0,isShowErrorMsg:u=!1,description:d=``,className:f=``})=>(0,i.jsx)(t.FormField,{name:e,render:({field:e})=>(0,i.jsxs)(t.FormItem,{className:(0,r.cn)(`w-full`,f),children:[l&&(0,i.jsx)(t.FormLabel,{children:a}),(0,i.jsxs)(n.Select,{defaultValue:e.value,onValueChange:e.onChange,children:[(0,i.jsx)(t.FormControl,{children:(0,i.jsx)(n.SelectTrigger,{className:`w-full`,children:(0,i.jsx)(n.SelectValue,{placeholder:o})})}),(0,i.jsx)(n.SelectContent,{children:c.map(e=>(0,i.jsx)(n.SelectItem,{disabled:s.includes(e.value),value:e.value,children:e.label},e.value))})]}),!!d&&(0,i.jsx)(t.FormDescription,{children:d}),u&&(0,i.jsx)(t.FormMessage,{})]})});exports.SelectField=a;
|
|
2
2
|
//# sourceMappingURL=select-field.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime16 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/select-field.d.ts
|
|
@@ -27,7 +27,7 @@ declare const SelectField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
27
27
|
isShowErrorMsg,
|
|
28
28
|
description,
|
|
29
29
|
className
|
|
30
|
-
}: Props<TFieldValues>) =>
|
|
30
|
+
}: Props<TFieldValues>) => react_jsx_runtime16.JSX.Element;
|
|
31
31
|
//#endregion
|
|
32
32
|
export { SelectField };
|
|
33
33
|
//# sourceMappingURL=select-field.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/select-field.d.ts
|
|
@@ -27,7 +27,7 @@ declare const SelectField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
27
27
|
isShowErrorMsg,
|
|
28
28
|
description,
|
|
29
29
|
className
|
|
30
|
-
}: Props<TFieldValues>) =>
|
|
30
|
+
}: Props<TFieldValues>) => react_jsx_runtime1.JSX.Element;
|
|
31
31
|
//#endregion
|
|
32
32
|
export { SelectField };
|
|
33
33
|
//# sourceMappingURL=select-field.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import"../label-
|
|
1
|
+
"use client";import"../label-DdpIoRiG.js";import{FormControl as e,FormDescription as t,FormField as n,FormItem as r,FormLabel as i,FormMessage as a}from"../form-D-gDMD-J.js";import{Select as o,SelectContent as s,SelectItem as c,SelectTrigger as l,SelectValue as u}from"../select-CijI0HX0.js";import{cn as d}from"@customafk/react-toolkit/utils";import{jsx as f,jsxs as p}from"react/jsx-runtime";const m=({name:m,label:h=`Select Field`,placeholder:g=`Select an option`,disabledValues:_=[],options:v=[],isShowLabel:y=!0,isShowErrorMsg:b=!1,description:x=``,className:S=``})=>f(n,{name:m,render:({field:n})=>p(r,{className:d(`w-full`,S),children:[y&&f(i,{children:h}),p(o,{defaultValue:n.value,onValueChange:n.onChange,children:[f(e,{children:f(l,{className:`w-full`,children:f(u,{placeholder:g})})}),f(s,{children:v.map(e=>f(c,{disabled:_.includes(e.value),value:e.value,children:e.label},e.value))})]}),!!x&&f(t,{children:x}),b&&f(a,{})]})});export{m as SelectField};
|
|
2
2
|
//# sourceMappingURL=select-field.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require(`../chunk-CUT6urMc.cjs`);require(`../label-
|
|
1
|
+
"use client";const e=require(`../chunk-CUT6urMc.cjs`);require(`../label-BBPPT0-L.cjs`);const t=require(`../form-CaxhlWxK.cjs`),n=require(`../switch-BPSKvrTw.cjs`),r=e.__toESM(require(`@customafk/react-toolkit/utils`)),i=e.__toESM(require(`react/jsx-runtime`)),a=({name:e,label:a=`Switch Field`,description:o,isShowErrorMsg:s=!1})=>(0,i.jsx)(t.FormField,{name:e,render:({field:e})=>(0,i.jsxs)(`div`,{className:`spage-y-1`,children:[(0,i.jsxs)(t.FormItem,{className:(0,r.cn)(`border-border-weak flex flex-row items-center justify-between rounded-lg border p-3 shadow-xs`),children:[(0,i.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,i.jsx)(t.FormLabel,{className:`cursor-pointer text-sm`,children:a}),o&&(0,i.jsx)(t.FormDescription,{className:`text-xs`,children:o})]}),(0,i.jsx)(t.FormControl,{children:(0,i.jsx)(n.Switch,{checked:e.value,onCheckedChange:e.onChange})})]}),s&&(0,i.jsx)(t.FormMessage,{})]})});exports.SwitchField=a;
|
|
2
2
|
//# sourceMappingURL=switch-field.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime10 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/switch-field.d.ts
|
|
@@ -13,7 +13,7 @@ declare const SwitchField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
13
13
|
label,
|
|
14
14
|
description,
|
|
15
15
|
isShowErrorMsg
|
|
16
|
-
}: Props<TFieldValues>) =>
|
|
16
|
+
}: Props<TFieldValues>) => react_jsx_runtime10.JSX.Element;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { SwitchField };
|
|
19
19
|
//# sourceMappingURL=switch-field.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime13 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/switch-field.d.ts
|
|
@@ -13,7 +13,7 @@ declare const SwitchField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
13
13
|
label,
|
|
14
14
|
description,
|
|
15
15
|
isShowErrorMsg
|
|
16
|
-
}: Props<TFieldValues>) =>
|
|
16
|
+
}: Props<TFieldValues>) => react_jsx_runtime13.JSX.Element;
|
|
17
17
|
//#endregion
|
|
18
18
|
export { SwitchField };
|
|
19
19
|
//# sourceMappingURL=switch-field.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import"../label-
|
|
1
|
+
"use client";import"../label-DdpIoRiG.js";import{FormControl as e,FormDescription as t,FormField as n,FormItem as r,FormLabel as i,FormMessage as a}from"../form-D-gDMD-J.js";import{Switch as o}from"../switch-Crju8DJO.js";import{cn as s}from"@customafk/react-toolkit/utils";import{jsx as c,jsxs as l}from"react/jsx-runtime";const u=({name:u,label:d=`Switch Field`,description:f,isShowErrorMsg:p=!1})=>c(n,{name:u,render:({field:n})=>l(`div`,{className:`spage-y-1`,children:[l(r,{className:s(`border-border-weak flex flex-row items-center justify-between rounded-lg border p-3 shadow-xs`),children:[l(`div`,{className:`space-y-0.5`,children:[c(i,{className:`cursor-pointer text-sm`,children:d}),f&&c(t,{className:`text-xs`,children:f})]}),c(e,{children:c(o,{checked:n.value,onCheckedChange:n.onChange})})]}),p&&c(a,{})]})});export{u as SwitchField};
|
|
2
2
|
//# sourceMappingURL=switch-field.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require(`../chunk-CUT6urMc.cjs`),t=require(`../flex-
|
|
1
|
+
"use client";const e=require(`../chunk-CUT6urMc.cjs`),t=require(`../flex-DMgD86BT.cjs`);require(`../label-BBPPT0-L.cjs`);const n=require(`../form-CaxhlWxK.cjs`),r=require(`../input-ERPHY3v4.cjs`),i=e.__toESM(require(`lucide-react`)),a=e.__toESM(require(`@customafk/react-toolkit/utils`)),o=e.__toESM(require(`react/jsx-runtime`)),s=e.__toESM(require(`react`)),c=e.__toESM(require(`react-hook-form`)),l=({name:e,label:l=`Text Field`,placeholder:u=`Enter text here`,isShowLabel:d=!0,isShowClearButton:f=!1,isShowErrorMsg:p=!1,isShowCount:m=!1,description:h,className:g=``,onValueChange:_})=>{let{resetField:v}=n.useFormField(),y=(0,c.useWatch)({name:e}),b=(0,s.useCallback)(()=>{v(e)},[v,e]);return(0,o.jsx)(n.FormField,{name:e,render:({field:e})=>(0,o.jsxs)(n.FormItem,{className:(0,a.cn)(`w-full gap-0`,m||!!h&&`space-y-1`,g),children:[d&&(0,o.jsx)(n.FormLabel,{children:l}),(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsx)(n.FormControl,{children:(0,o.jsx)(r.Input,{...e,placeholder:u,className:(0,a.cn)(`w-full`,f&&`pr-9`),onValueChange:_})}),f&&y&&(0,o.jsx)(`button`,{type:`button`,className:`text-text-positive-weak hover:text-text-positive focus-visible:ring-border absolute inset-y-0 end-0 flex h-full w-8 cursor-pointer items-center justify-center rounded-e-md transition-[color,box-shadow] outline-none focus:z-10 focus-visible:ring-2`,"aria-label":`Clear input`,onClick:b,children:(0,o.jsx)(i.XIcon,{size:14,"aria-hidden":`true`})})]}),(0,o.jsxs)(t.Flex,{width:`full`,padding:`none`,justify:`end`,children:[p&&(0,o.jsx)(n.FormMessage,{className:`grow`}),m&&(0,o.jsxs)(`div`,{className:`text-text-positive-weak text-end text-xs`,children:[y?.length??0,` characters`]})]}),!!h&&(0,o.jsx)(n.FormDescription,{children:h})]})})};exports.TextField=l;
|
|
2
2
|
//# sourceMappingURL=text-field.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime9 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/text-field.d.ts
|
|
@@ -25,7 +25,7 @@ declare const TextField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
25
25
|
description,
|
|
26
26
|
className,
|
|
27
27
|
onValueChange
|
|
28
|
-
}: Props<TFieldValues>) =>
|
|
28
|
+
}: Props<TFieldValues>) => react_jsx_runtime9.JSX.Element;
|
|
29
29
|
//#endregion
|
|
30
30
|
export { TextField };
|
|
31
31
|
//# sourceMappingURL=text-field.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime10 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/text-field.d.ts
|
|
@@ -25,7 +25,7 @@ declare const TextField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
25
25
|
description,
|
|
26
26
|
className,
|
|
27
27
|
onValueChange
|
|
28
|
-
}: Props<TFieldValues>) =>
|
|
28
|
+
}: Props<TFieldValues>) => react_jsx_runtime10.JSX.Element;
|
|
29
29
|
//#endregion
|
|
30
30
|
export { TextField };
|
|
31
31
|
//# sourceMappingURL=text-field.d.ts.map
|
package/dist/forms/text-field.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{Flex as e}from"../flex-
|
|
1
|
+
"use client";import{Flex as e}from"../flex-BZHWRUkz.js";import"../label-DdpIoRiG.js";import{FormControl as t,FormDescription as n,FormField as r,FormItem as i,FormLabel as a,FormMessage as o,useFormField as s}from"../form-D-gDMD-J.js";import{Input as c}from"../input-BFZuwsER.js";import{XIcon as l}from"lucide-react";import{cn as u}from"@customafk/react-toolkit/utils";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{useCallback as p}from"react";import{useWatch as m}from"react-hook-form";const h=({name:h,label:g=`Text Field`,placeholder:_=`Enter text here`,isShowLabel:v=!0,isShowClearButton:y=!1,isShowErrorMsg:b=!1,isShowCount:x=!1,description:S,className:C=``,onValueChange:w})=>{let{resetField:T}=s(),E=m({name:h}),D=p(()=>{T(h)},[T,h]);return d(r,{name:h,render:({field:r})=>f(i,{className:u(`w-full gap-0`,x||!!S&&`space-y-1`,C),children:[v&&d(a,{children:g}),f(`div`,{className:`relative`,children:[d(t,{children:d(c,{...r,placeholder:_,className:u(`w-full`,y&&`pr-9`),onValueChange:w})}),y&&E&&d(`button`,{type:`button`,className:`text-text-positive-weak hover:text-text-positive focus-visible:ring-border absolute inset-y-0 end-0 flex h-full w-8 cursor-pointer items-center justify-center rounded-e-md transition-[color,box-shadow] outline-none focus:z-10 focus-visible:ring-2`,"aria-label":`Clear input`,onClick:D,children:d(l,{size:14,"aria-hidden":`true`})})]}),f(e,{width:`full`,padding:`none`,justify:`end`,children:[b&&d(o,{className:`grow`}),x&&f(`div`,{className:`text-text-positive-weak text-end text-xs`,children:[E?.length??0,` characters`]})]}),!!S&&d(n,{children:S})]})})};export{h as TextField};
|
|
2
2
|
//# sourceMappingURL=text-field.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";const e=require(`../chunk-CUT6urMc.cjs`);require(`../label-
|
|
1
|
+
"use client";const e=require(`../chunk-CUT6urMc.cjs`);require(`../label-BBPPT0-L.cjs`);const t=require(`../form-CaxhlWxK.cjs`),n=require(`../textarea-BtACo9UF.cjs`),r=e.__toESM(require(`react/jsx-runtime`)),i=e.__toESM(require(`react-hook-form`)),a=({name:e,label:a=`Textarea Field`,placeholder:o=`Enter text here`,isShowErrorMsg:s=!1,isShowCount:c=!1,description:l,rows:u=3,onValueChange:d})=>{let f=(0,i.useWatch)({name:e});return(0,r.jsx)(t.FormField,{name:e,render:({field:e})=>(0,r.jsxs)(t.FormItem,{className:`w-full`,children:[(0,r.jsx)(t.FormLabel,{children:a}),(0,r.jsx)(t.FormControl,{children:(0,r.jsx)(n.Textarea,{...e,placeholder:o,className:`w-full`,rows:u,onValueChange:d})}),c&&(0,r.jsxs)(`div`,{className:`text-muted-foreground text-end text-xs`,children:[f?.length??0,` characters`]}),!!l&&(0,r.jsx)(t.FormDescription,{children:l}),s&&(0,r.jsx)(t.FormMessage,{})]})})};exports.TextareaField=a;
|
|
2
2
|
//# sourceMappingURL=textarea-field.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime13 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/textarea-field.d.ts
|
|
@@ -21,7 +21,7 @@ declare const TextareaField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
21
21
|
description,
|
|
22
22
|
rows,
|
|
23
23
|
onValueChange
|
|
24
|
-
}: Props<TFieldValues>) =>
|
|
24
|
+
}: Props<TFieldValues>) => react_jsx_runtime13.JSX.Element;
|
|
25
25
|
//#endregion
|
|
26
26
|
export { TextareaField };
|
|
27
27
|
//# sourceMappingURL=textarea-field.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime11 from "react/jsx-runtime";
|
|
2
2
|
import { FieldPath, FieldValues } from "react-hook-form";
|
|
3
3
|
|
|
4
4
|
//#region packages/components/forms/textarea-field.d.ts
|
|
@@ -21,7 +21,7 @@ declare const TextareaField: <TFieldValues extends FieldValues = FieldValues>({
|
|
|
21
21
|
description,
|
|
22
22
|
rows,
|
|
23
23
|
onValueChange
|
|
24
|
-
}: Props<TFieldValues>) =>
|
|
24
|
+
}: Props<TFieldValues>) => react_jsx_runtime11.JSX.Element;
|
|
25
25
|
//#endregion
|
|
26
26
|
export { TextareaField };
|
|
27
27
|
//# sourceMappingURL=textarea-field.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import"../label-
|
|
1
|
+
"use client";import"../label-DdpIoRiG.js";import{FormControl as e,FormDescription as t,FormField as n,FormItem as r,FormLabel as i,FormMessage as a}from"../form-D-gDMD-J.js";import{Textarea as o}from"../textarea-BCZiUxv7.js";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{useWatch as l}from"react-hook-form";const u=({name:u,label:d=`Textarea Field`,placeholder:f=`Enter text here`,isShowErrorMsg:p=!1,isShowCount:m=!1,description:h,rows:g=3,onValueChange:_})=>{let v=l({name:u});return s(n,{name:u,render:({field:n})=>c(r,{className:`w-full`,children:[s(i,{children:d}),s(e,{children:s(o,{...n,placeholder:f,className:`w-full`,rows:g,onValueChange:_})}),m&&c(`div`,{className:`text-muted-foreground text-end text-xs`,children:[v?.length??0,` characters`]}),!!h&&s(t,{children:h}),p&&s(a,{})]})})};export{u as TextareaField};
|
|
2
2
|
//# sourceMappingURL=textarea-field.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{cn as e}from"@customafk/react-toolkit/utils";import{jsx as t}from"react/jsx-runtime";import{useCallback as n}from"react";function r({className:r,onChange:i,onValueChange:a,...o}){let s=n(e=>{i?.(e),a?.(e.target.value)},[i,a]);return t(`input`,{"data-slot":`input`,className:e(`flex h-9 w-full px-3 py-1`,`border-border-weak shadow-input rounded-md border`,`caret-primary bg-transparent text-sm`,`transition-[color,border,box-shadow] outline-none`,`placeholder:text-text-positive-muted`,`hover:border-border`,`disabled:pointer-events-none`,`disabled:cursor-not-allowed`,`disabled:opacity-50`,`focus-visible:ring-4`,`focus-visible:ring-primary-weak`,`focus-visible:border-primary-strong`,`aria-invalid:ring-danger-muted`,`aria-invalid:border-danger`,r),...o,onChange:s})}export{r as Input};
|
|
2
|
+
//# sourceMappingURL=input-BFZuwsER.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-BFZuwsER.js","names":[],"sources":["../packages/components/ui/input.tsx"],"sourcesContent":["'use client'\nimport { useCallback } from 'react'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nfunction Input({\n className,\n onChange,\n onValueChange,\n ...props\n}: React.ComponentProps<'input'> & {\n onValueChange?: (value: string) => void\n}) {\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(e)\n onValueChange?.(e.target.value)\n },\n [onChange, onValueChange],\n )\n return (\n <input\n data-slot=\"input\"\n className={cn(\n 'flex h-9 w-full px-3 py-1',\n 'border-border-weak shadow-input rounded-md border',\n 'caret-primary bg-transparent text-sm',\n 'transition-[color,border,box-shadow] outline-none',\n 'placeholder:text-text-positive-muted',\n 'hover:border-border',\n 'disabled:pointer-events-none',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n 'focus-visible:ring-4',\n 'focus-visible:ring-primary-weak',\n 'focus-visible:border-primary-strong',\n 'aria-invalid:ring-danger-muted',\n 'aria-invalid:border-danger',\n className,\n )}\n {...props}\n onChange={handleChange}\n />\n )\n}\n\nexport { Input }\n"],"mappings":"gIAIA,SAAS,EAAM,CACb,YACA,WACA,gBACA,GAAG,GAGF,CACD,IAAM,EAAe,EAClB,GAA2C,CAC1C,IAAW,GACX,IAAgB,EAAE,OAAO,QAE3B,CAAC,EAAU,IAEb,OACE,EAAC,QAAA,CACC,YAAU,QACV,UAAW,EACT,4BACA,oDACA,uCACA,oDACA,uCACA,sBACA,+BACA,8BACA,sBACA,uBACA,kCACA,sCACA,iCACA,6BACA,GAEF,GAAI,EACJ,SAAU"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import React from "react";
|
|
1
|
+
import * as react_jsx_runtime80 from "react/jsx-runtime";
|
|
3
2
|
|
|
4
3
|
//#region packages/components/ui/input.d.ts
|
|
5
4
|
declare function Input({
|
|
@@ -9,7 +8,7 @@ declare function Input({
|
|
|
9
8
|
...props
|
|
10
9
|
}: React.ComponentProps<'input'> & {
|
|
11
10
|
onValueChange?: (value: string) => void;
|
|
12
|
-
}):
|
|
11
|
+
}): react_jsx_runtime80.JSX.Element;
|
|
13
12
|
//#endregion
|
|
14
13
|
export { Input };
|
|
15
|
-
//# sourceMappingURL=input-
|
|
14
|
+
//# sourceMappingURL=input-BayoSfCE.d.cts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import React from "react";
|
|
1
|
+
import * as react_jsx_runtime92 from "react/jsx-runtime";
|
|
3
2
|
|
|
4
3
|
//#region packages/components/ui/input.d.ts
|
|
5
4
|
declare function Input({
|
|
@@ -9,7 +8,7 @@ declare function Input({
|
|
|
9
8
|
...props
|
|
10
9
|
}: React.ComponentProps<'input'> & {
|
|
11
10
|
onValueChange?: (value: string) => void;
|
|
12
|
-
}):
|
|
11
|
+
}): react_jsx_runtime92.JSX.Element;
|
|
13
12
|
//#endregion
|
|
14
13
|
export { Input };
|
|
15
|
-
//# sourceMappingURL=input-
|
|
14
|
+
//# sourceMappingURL=input-BjiwI6EW.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require(`./chunk-CUT6urMc.cjs`),t=e.__toESM(require(`@customafk/react-toolkit/utils`)),n=e.__toESM(require(`react/jsx-runtime`)),r=e.__toESM(require(`react`));function i({className:e,onChange:i,onValueChange:a,...o}){let s=(0,r.useCallback)(e=>{i?.(e),a?.(e.target.value)},[i,a]);return(0,n.jsx)(`input`,{"data-slot":`input`,className:(0,t.cn)(`flex h-9 w-full px-3 py-1`,`border-border-weak shadow-input rounded-md border`,`caret-primary bg-transparent text-sm`,`transition-[color,border,box-shadow] outline-none`,`placeholder:text-text-positive-muted`,`hover:border-border`,`disabled:pointer-events-none`,`disabled:cursor-not-allowed`,`disabled:opacity-50`,`focus-visible:ring-4`,`focus-visible:ring-primary-weak`,`focus-visible:border-primary-strong`,`aria-invalid:ring-danger-muted`,`aria-invalid:border-danger`,e),...o,onChange:s})}Object.defineProperty(exports,`Input`,{enumerable:!0,get:function(){return i}});
|
|
2
|
+
//# sourceMappingURL=input-ERPHY3v4.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-ERPHY3v4.cjs","names":[],"sources":["../packages/components/ui/input.tsx"],"sourcesContent":["'use client'\nimport { useCallback } from 'react'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nfunction Input({\n className,\n onChange,\n onValueChange,\n ...props\n}: React.ComponentProps<'input'> & {\n onValueChange?: (value: string) => void\n}) {\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(e)\n onValueChange?.(e.target.value)\n },\n [onChange, onValueChange],\n )\n return (\n <input\n data-slot=\"input\"\n className={cn(\n 'flex h-9 w-full px-3 py-1',\n 'border-border-weak shadow-input rounded-md border',\n 'caret-primary bg-transparent text-sm',\n 'transition-[color,border,box-shadow] outline-none',\n 'placeholder:text-text-positive-muted',\n 'hover:border-border',\n 'disabled:pointer-events-none',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n 'focus-visible:ring-4',\n 'focus-visible:ring-primary-weak',\n 'focus-visible:border-primary-strong',\n 'aria-invalid:ring-danger-muted',\n 'aria-invalid:border-danger',\n className,\n )}\n {...props}\n onChange={handleChange}\n />\n )\n}\n\nexport { Input }\n"],"mappings":"uKAIA,SAAS,EAAM,CACb,YACA,WACA,gBACA,GAAG,GAGF,CACD,IAAM,GAAA,EAAA,EAAA,aACH,GAA2C,CAC1C,IAAW,GACX,IAAgB,EAAE,OAAO,QAE3B,CAAC,EAAU,IAEb,OACE,EAAA,EAAA,KAAC,QAAA,CACC,YAAU,QACV,WAAA,EAAA,EAAA,IACE,4BACA,oDACA,uCACA,oDACA,uCACA,sBACA,+BACA,8BACA,sBACA,uBACA,kCACA,sCACA,iCACA,6BACA,GAEF,GAAI,EACJ,SAAU"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require(`./chunk-CUT6urMc.cjs`),t=e.__toESM(require(`@customafk/react-toolkit/utils`)),n=e.__toESM(require(`radix-ui`)),r=e.__toESM(require(`react/jsx-runtime`));function i({className:e,...i}){return(0,r.jsx)(n.Label.Root,{"data-slot":`label`,className:(0,t.cn)(`text-text-positive`,`flex items-center gap-2`,`text-sm leading-none font-medium select-none`,`group-data-[disabled=true]:pointer-events-none`,`group-data-[disabled=true]:opacity-50`,`peer-disabled:cursor-not-allowed`,`peer-disabled:opacity-50`,e),...i})}Object.defineProperty(exports,`Label`,{enumerable:!0,get:function(){return i}});
|
|
2
|
+
//# sourceMappingURL=label-BBPPT0-L.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label-BBPPT0-L.cjs","names":["LabelPrimitive"],"sources":["../packages/components/ui/label.tsx"],"sourcesContent":["'use client'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nimport { Label as LabelPrimitive } from 'radix-ui'\n\nfunction Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {\n return (\n <LabelPrimitive.Root\n data-slot=\"label\"\n className={cn(\n 'text-text-positive',\n 'flex items-center gap-2',\n 'text-sm leading-none font-medium select-none',\n 'group-data-[disabled=true]:pointer-events-none',\n 'group-data-[disabled=true]:opacity-50',\n 'peer-disabled:cursor-not-allowed',\n 'peer-disabled:opacity-50',\n className,\n )}\n {...props}\n />\n )\n}\n\nexport { Label }\n"],"mappings":"0KAKA,SAAS,EAAM,CAAE,YAAW,GAAG,GAA2D,CACxF,OACE,EAAA,EAAA,KAACA,EAAAA,MAAe,KAAA,CACd,YAAU,QACV,WAAA,EAAA,EAAA,IACE,qBACA,0BACA,+CACA,iDACA,wCACA,mCACA,2BACA,GAEF,GAAI"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{cn as e}from"@customafk/react-toolkit/utils";import{Label as t}from"radix-ui";import{jsx as n}from"react/jsx-runtime";function r({className:r,...i}){return n(t.Root,{"data-slot":`label`,className:e(`text-text-positive`,`flex items-center gap-2`,`text-sm leading-none font-medium select-none`,`group-data-[disabled=true]:pointer-events-none`,`group-data-[disabled=true]:opacity-50`,`peer-disabled:cursor-not-allowed`,`peer-disabled:opacity-50`,r),...i})}export{r as Label};
|
|
2
|
+
//# sourceMappingURL=label-DdpIoRiG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label-DdpIoRiG.js","names":["Label","LabelPrimitive"],"sources":["../packages/components/ui/label.tsx"],"sourcesContent":["'use client'\nimport { cn } from '@customafk/react-toolkit/utils'\n\nimport { Label as LabelPrimitive } from 'radix-ui'\n\nfunction Label({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) {\n return (\n <LabelPrimitive.Root\n data-slot=\"label\"\n className={cn(\n 'text-text-positive',\n 'flex items-center gap-2',\n 'text-sm leading-none font-medium select-none',\n 'group-data-[disabled=true]:pointer-events-none',\n 'group-data-[disabled=true]:opacity-50',\n 'peer-disabled:cursor-not-allowed',\n 'peer-disabled:opacity-50',\n className,\n )}\n {...props}\n />\n )\n}\n\nexport { Label }\n"],"mappings":"6HAKA,SAASA,EAAM,CAAE,YAAW,GAAG,GAA2D,CACxF,OACE,EAACC,EAAe,KAAA,CACd,YAAU,QACV,UAAW,EACT,qBACA,0BACA,+CACA,iDACA,wCACA,mCACA,2BACA,GAEF,GAAI"}
|