@customafk/lunas-ui 0.0.7 → 0.0.8
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/{add-new-BaABbnol.js → add-new-C--Ee4bj.js} +1 -2
- package/dist/{add-new-DUoS_-n2.cjs → add-new-pfLdk0Hp.cjs} +1 -2
- package/dist/{alert-dialog-0KwdjY-6.js → alert-dialog-CQa0TLlF.js} +1 -2
- package/dist/{alert-dialog-D5ZqgIiC.cjs → alert-dialog-D1DFrl-0.cjs} +1 -2
- package/dist/badge-D_qEoSL8.js +1 -2
- package/dist/{badge-CRXT2dH_.cjs → badge-DfSj5nwV.cjs} +1 -2
- package/dist/button-Bku3bKv9.js +1 -2
- package/dist/button-CS0x-mYR.d.cts +22 -0
- package/dist/button-CxHABSnr.d.ts +22 -0
- package/dist/{button-Dzv_nos1.cjs → button-CycE0WzB.cjs} +1 -2
- package/dist/calendar-DaYVxwJx.js +1 -0
- package/dist/calendar-DzAxQqFI.cjs +1 -0
- package/dist/{card-Dta5eW8u.cjs → card-D7C05tvk.cjs} +1 -2
- package/dist/card-D8cxRC5y.js +1 -2
- package/dist/cards/simple-card.cjs +1 -2
- package/dist/cards/simple-card.d.cts +3 -3
- package/dist/cards/simple-card.d.ts +3 -3
- package/dist/cards/simple-card.js +1 -2
- package/dist/chunk-hhQzssFb.cjs +1 -0
- package/dist/command-BfYiUikG.d.cts +52 -0
- package/dist/{command-CsntVmEz.cjs → command-CkGJbvFq.cjs} +1 -2
- package/dist/command-CycGGWOh.d.ts +52 -0
- package/dist/{command-_L9bD9a-.js → command-Ir_Vqgds.js} +1 -2
- package/dist/data-display/country.cjs +1 -2
- package/dist/data-display/country.d.cts +1 -2
- package/dist/data-display/country.d.ts +2 -3
- package/dist/data-display/country.js +1 -2
- package/dist/data-display/data-list.cjs +1 -2
- package/dist/data-display/data-list.d.cts +1 -2
- package/dist/data-display/data-list.d.ts +1 -2
- package/dist/data-display/data-list.js +1 -2
- package/dist/data-display/date.cjs +1 -1
- package/dist/data-display/date.d.cts +1 -2
- package/dist/data-display/date.d.ts +1 -2
- package/dist/data-display/empty.cjs +1 -2
- package/dist/data-display/empty.d.cts +4 -3
- package/dist/data-display/empty.d.ts +4 -3
- package/dist/data-display/empty.js +1 -2
- package/dist/data-display/name.cjs +1 -2
- package/dist/data-display/name.d.cts +1 -2
- package/dist/data-display/name.d.ts +1 -2
- package/dist/data-display/name.js +1 -2
- package/dist/data-display/phone-number.cjs +1 -2
- package/dist/data-display/phone-number.d.cts +1 -2
- package/dist/data-display/phone-number.d.ts +1 -2
- package/dist/data-display/phone-number.js +1 -2
- package/dist/data-display/role-badge.cjs +1 -2
- package/dist/data-display/role-badge.d.cts +1 -2
- package/dist/data-display/role-badge.d.ts +2 -3
- package/dist/data-display/role-badge.js +1 -2
- package/dist/data-display/statistic.cjs +1 -2
- package/dist/data-display/statistic.d.cts +26 -3
- package/dist/data-display/statistic.d.ts +26 -3
- package/dist/data-display/statistic.js +1 -2
- package/dist/date-BMq_DNsv.js +1 -2
- package/dist/{date-nd8WkPlx.cjs → date-ByLOGsKl.cjs} +1 -2
- package/dist/{dialog-D3VF5qxy.d.cts → dialog-B13T--98.d.ts} +12 -12
- package/dist/{dialog-W-DmDMEE.cjs → dialog-B3cQOpjg.cjs} +1 -2
- package/dist/{dialog-C4hf-Puw.js → dialog-BLDh3Gqw.js} +1 -2
- package/dist/{dialog-MLCAvDJH.d.ts → dialog-Dspjpsjh.d.cts} +12 -12
- package/dist/dialogs/confirm-dialog.cjs +1 -2
- package/dist/dialogs/confirm-dialog.d.cts +1 -2
- package/dist/dialogs/confirm-dialog.d.ts +1 -2
- package/dist/dialogs/confirm-dialog.js +1 -2
- package/dist/dialogs/detail-dialog/index.cjs +1 -2
- package/dist/dialogs/detail-dialog/index.d.cts +1 -2
- package/dist/dialogs/detail-dialog/index.d.ts +1 -2
- package/dist/dialogs/detail-dialog/index.js +1 -2
- package/dist/dialogs/error-dialog.cjs +1 -1
- package/dist/dialogs/error-dialog.d.cts +1 -2
- package/dist/dialogs/error-dialog.d.ts +1 -2
- package/dist/dialogs/error-dialog.js +1 -1
- package/dist/dialogs/form-dialog.cjs +1 -2
- package/dist/dialogs/form-dialog.d.cts +3 -3
- package/dist/dialogs/form-dialog.d.ts +3 -3
- package/dist/dialogs/form-dialog.js +1 -2
- package/dist/dialogs/loading-dialog.cjs +1 -2
- package/dist/dialogs/loading-dialog.d.cts +1 -2
- package/dist/dialogs/loading-dialog.d.ts +1 -2
- package/dist/dialogs/loading-dialog.js +1 -2
- package/dist/{dropdown-menu-Bv18S56o.cjs → dropdown-menu-CPvB_jOC.cjs} +1 -2
- package/dist/{dropdown-menu-jCQwh2rG.js → dropdown-menu-Cx-Wime0.js} +1 -2
- package/dist/{error-dialog-DpQgL5Hy.cjs → error-dialog-BTjeT7x-.cjs} +1 -2
- package/dist/{error-dialog-D_4WL-Hj.js → error-dialog-DlhosP10.js} +1 -2
- package/dist/flex-ILvQrYMJ.js +1 -2
- package/dist/{flex-CNA_SId-.cjs → flex-yTyoLpgH.cjs} +1 -2
- package/dist/form-CA4hhSV5.js +1 -2
- package/dist/{form-CYZkgobJ.cjs → form-C_PCHrpx.cjs} +1 -2
- package/dist/{form-wrapper-BYbwt1zC.cjs → form-wrapper-CCqogufb.cjs} +1 -2
- package/dist/{form-wrapper-D-2Uz518.js → form-wrapper-YPIbD8rh.js} +1 -2
- package/dist/forms/combobox-field.cjs +41 -0
- package/dist/forms/combobox-field.d.cts +27 -0
- package/dist/forms/combobox-field.d.ts +27 -0
- package/dist/forms/combobox-field.js +41 -0
- package/dist/forms/date-field.cjs +1 -0
- package/dist/forms/date-field.d.cts +21 -0
- package/dist/forms/date-field.d.ts +21 -0
- package/dist/forms/date-field.js +1 -0
- package/dist/forms/form-wrapper.cjs +1 -1
- package/dist/forms/form-wrapper.d.cts +3 -3
- package/dist/forms/form-wrapper.d.ts +3 -3
- package/dist/forms/form-wrapper.js +1 -1
- package/dist/forms/multi-select-field.cjs +1 -0
- package/dist/forms/multi-select-field.d.cts +29 -0
- package/dist/forms/multi-select-field.d.ts +29 -0
- package/dist/forms/multi-select-field.js +1 -0
- package/dist/forms/number-field.cjs +1 -0
- package/dist/forms/number-field.d.cts +27 -0
- package/dist/forms/number-field.d.ts +27 -0
- package/dist/forms/number-field.js +1 -0
- package/dist/forms/password-field.cjs +1 -0
- package/dist/forms/password-field.d.cts +22 -0
- package/dist/forms/password-field.d.ts +22 -0
- package/dist/forms/password-field.js +1 -0
- package/dist/forms/select-field.cjs +1 -0
- package/dist/forms/select-field.d.cts +32 -0
- package/dist/forms/select-field.d.ts +32 -0
- package/dist/forms/select-field.js +1 -0
- package/dist/forms/switch-field.cjs +1 -0
- package/dist/forms/switch-field.d.cts +18 -0
- package/dist/forms/switch-field.d.ts +18 -0
- package/dist/forms/switch-field.js +1 -0
- package/dist/forms/text-field.cjs +1 -0
- package/dist/forms/text-field.d.cts +30 -0
- package/dist/forms/text-field.d.ts +30 -0
- package/dist/forms/text-field.js +1 -0
- package/dist/forms/textarea-field.cjs +1 -0
- package/dist/forms/textarea-field.d.cts +26 -0
- package/dist/forms/textarea-field.d.ts +26 -0
- package/dist/forms/textarea-field.js +1 -0
- package/dist/{input-D0Phuz25.d.cts → input-BcIy0lq8.d.cts} +3 -3
- package/dist/{input-DXEBB91E.cjs → input-C8Sebaue.cjs} +1 -2
- package/dist/{input-tHIKXxVS.d.ts → input-Cux9upuQ.d.ts} +3 -3
- package/dist/{input-FzKbxUq2.js → input-Dmaq3fzf.js} +1 -2
- package/dist/label-Cxbctr6x.js +1 -2
- package/dist/{label-CunjD1rx.cjs → label-i858Jr98.cjs} +1 -2
- package/dist/layouts/flex.cjs +1 -1
- package/dist/layouts/flex.d.cts +14 -4
- package/dist/layouts/flex.d.ts +14 -4
- package/dist/layouts/main/index.cjs +1 -2
- package/dist/layouts/main/index.d.cts +14 -5
- package/dist/layouts/main/index.d.ts +14 -5
- package/dist/layouts/main/index.js +1 -2
- package/dist/multi-select-DZBXSr7F.cjs +1 -0
- package/dist/multi-select-LYl29d4h.js +1 -0
- package/dist/paragraph-Bey03JkA.js +1 -2
- package/dist/{paragraph-ZxI8zxuf.cjs → paragraph-DWQ0PZt_.cjs} +1 -2
- package/dist/popover-Ce0OTSQL.cjs +1 -0
- package/dist/popover-tDri6Ded.js +1 -0
- package/dist/{progress-BnnOfAZN.cjs → progress-CHh9eRZi.cjs} +1 -2
- package/dist/{progress-CBccqUUJ.js → progress-CeXKNvJc.js} +1 -2
- package/dist/{refresh-BHt_h3N_.js → refresh-BPlmkCzH.js} +1 -2
- package/dist/{refresh-DrolZxuC.cjs → refresh-Dtz354hW.cjs} +1 -2
- package/dist/{scroll-area-DWWpaz5j.cjs → scroll-area-Ba9RvkDf.cjs} +1 -2
- package/dist/{scroll-area-Bdb_LSFF.js → scroll-area-D-IhBWqm.js} +1 -2
- package/dist/{search-input-L2sq0eB0.js → search-input-BG4-fO9W.js} +1 -2
- package/dist/{search-input-Bf4-FeWu.cjs → search-input-DVMQEBvb.cjs} +1 -2
- package/dist/{select-CWUsisI0.js → select-4IO3vAjO.js} +1 -2
- package/dist/{select-ZSyt5zCe.cjs → select-UsiicIRo.cjs} +1 -2
- package/dist/{separator-DTB3sDNG.cjs → separator-D4iTmsID.cjs} +1 -2
- package/dist/{separator-BpsL0PlX.js → separator-DMdqEz29.js} +1 -2
- package/dist/{separator-COXs-I-Q.d.cts → separator-DtZ0fiIK.d.cts} +3 -3
- package/dist/{separator-2cwfp8qT.d.ts → separator-J8f9PdbI.d.ts} +3 -3
- package/dist/{sheet-C8r2QGpq.js → sheet-2JqHfdYi.js} +1 -2
- package/dist/{sheet-CCwbAaA6.cjs → sheet-Dr-a3-o2.cjs} +1 -2
- package/dist/{sidebar-C166f_9B.js → sidebar-COBzB7S8.js} +1 -2
- package/dist/{sidebar-BLPMNltJ.cjs → sidebar-gXuaHBie.cjs} +1 -2
- package/dist/skeleton-BTQm_mtV.cjs +1 -0
- package/dist/{skeleton-DYmX0k94.js → skeleton-D1_Brnl9.js} +1 -2
- package/dist/switch-BlK-TC1h.js +1 -0
- package/dist/switch-CoP3UwNk.cjs +1 -0
- package/dist/table/index.cjs +1 -2
- package/dist/table/index.d.cts +3 -3
- package/dist/table/index.d.ts +3 -3
- package/dist/table/index.js +1 -2
- package/dist/{table-BSeev7T0.cjs → table-C46bXpzd.cjs} +1 -2
- package/dist/{table-BvA64mE8.js → table-nHFRC3DG.js} +1 -2
- package/dist/textarea-Dz6npuI4.cjs +1 -0
- package/dist/textarea-dM1DYNfF.js +1 -0
- package/dist/{title-xsPZpQpb.cjs → title-BlLBscIg.cjs} +1 -2
- package/dist/title-DTkABsIG.js +1 -2
- package/dist/toggle-3yC7NgOb.d.ts +19 -0
- package/dist/toggle-8wPArWPq.d.cts +19 -0
- package/dist/{toggle-D_MDMruK.js → toggle-CHJ2edke.js} +1 -2
- package/dist/{toggle-CfL3GVe2.cjs → toggle-CzMYdDvC.cjs} +1 -2
- package/dist/{tooltip-Cjuu_Ld4.d.ts → tooltip-Bo9id3nz.d.ts} +6 -6
- package/dist/tooltip-Dzyf5smh.js +1 -2
- package/dist/{tooltip-Dk4HsZVR.d.cts → tooltip-JbjxxBNd.d.cts} +6 -6
- package/dist/{tooltip-Beb-_EPp.cjs → tooltip-MgToVOzy.cjs} +1 -2
- package/dist/types-B0V1F4Ml.d.cts +1 -2
- package/dist/{types-DLrIc2fL.d.ts → types-CmcNT14g.d.ts} +1 -2
- package/dist/types-CrbWxjnp.cjs +1 -2
- package/dist/types-DaIHddx7.js +1 -2
- package/dist/typography/paragraph.cjs +1 -1
- package/dist/typography/paragraph.d.cts +3 -3
- package/dist/typography/paragraph.d.ts +3 -3
- package/dist/typography/title.cjs +1 -1
- package/dist/typography/title.d.cts +4 -3
- package/dist/typography/title.d.ts +4 -3
- package/dist/ui/alert-dialog.cjs +1 -1
- package/dist/ui/alert-dialog.d.cts +13 -13
- package/dist/ui/alert-dialog.d.ts +13 -13
- package/dist/ui/alert-dialog.js +1 -1
- package/dist/ui/alert.cjs +1 -2
- package/dist/ui/alert.d.cts +9 -6
- package/dist/ui/alert.d.ts +9 -6
- package/dist/ui/alert.js +1 -2
- package/dist/ui/aspect-ratio.cjs +1 -2
- package/dist/ui/aspect-ratio.d.cts +3 -3
- package/dist/ui/aspect-ratio.d.ts +3 -3
- package/dist/ui/aspect-ratio.js +1 -2
- package/dist/ui/avatar.cjs +1 -2
- package/dist/ui/avatar.d.cts +5 -5
- package/dist/ui/avatar.d.ts +5 -5
- package/dist/ui/avatar.js +1 -2
- package/dist/ui/badge.cjs +1 -1
- package/dist/ui/badge.d.cts +9 -4
- package/dist/ui/badge.d.ts +9 -4
- package/dist/ui/breadcrumb.cjs +1 -2
- package/dist/ui/breadcrumb.d.cts +9 -9
- package/dist/ui/breadcrumb.d.ts +9 -9
- package/dist/ui/breadcrumb.js +1 -2
- package/dist/ui/button.cjs +1 -1
- package/dist/ui/button.d.cts +1 -1
- package/dist/ui/button.d.ts +1 -1
- package/dist/ui/buttons/add-new.cjs +1 -1
- package/dist/ui/buttons/add-new.d.cts +1 -2
- package/dist/ui/buttons/add-new.d.ts +1 -2
- package/dist/ui/buttons/add-new.js +1 -1
- package/dist/ui/buttons/refresh.cjs +1 -1
- package/dist/ui/buttons/refresh.d.cts +1 -2
- package/dist/ui/buttons/refresh.d.ts +1 -2
- package/dist/ui/buttons/refresh.js +1 -1
- package/dist/ui/calendar.cjs +1 -2
- package/dist/ui/calendar.d.cts +5 -5
- package/dist/ui/calendar.d.ts +5 -5
- package/dist/ui/calendar.js +1 -2
- package/dist/ui/card.cjs +1 -1
- package/dist/ui/card.d.cts +9 -9
- package/dist/ui/card.d.ts +9 -9
- package/dist/ui/carousel.cjs +1 -2
- package/dist/ui/carousel.d.cts +8 -8
- package/dist/ui/carousel.d.ts +8 -8
- package/dist/ui/carousel.js +1 -2
- package/dist/ui/collapsible.cjs +1 -2
- package/dist/ui/collapsible.d.cts +5 -5
- package/dist/ui/collapsible.d.ts +5 -5
- package/dist/ui/collapsible.js +1 -2
- package/dist/ui/command.cjs +1 -1
- package/dist/ui/command.d.cts +3 -52
- package/dist/ui/command.d.ts +3 -52
- package/dist/ui/command.js +1 -1
- package/dist/ui/context-menu.cjs +1 -2
- package/dist/ui/context-menu.d.cts +17 -17
- package/dist/ui/context-menu.d.ts +17 -17
- package/dist/ui/context-menu.js +1 -2
- package/dist/ui/dialog.cjs +1 -1
- package/dist/ui/dialog.d.cts +1 -1
- package/dist/ui/dialog.d.ts +1 -1
- package/dist/ui/dialog.js +1 -1
- package/dist/ui/dropdown-menu.cjs +1 -1
- package/dist/ui/dropdown-menu.d.cts +17 -17
- package/dist/ui/dropdown-menu.d.ts +17 -17
- package/dist/ui/dropdown-menu.js +1 -1
- package/dist/ui/file-uploader.cjs +2 -3
- package/dist/ui/file-uploader.d.cts +3 -3
- package/dist/ui/file-uploader.d.ts +3 -3
- package/dist/ui/file-uploader.js +2 -3
- package/dist/ui/form.cjs +1 -1
- package/dist/ui/form.d.cts +24 -10
- package/dist/ui/form.d.ts +24 -10
- package/dist/ui/hover-card.cjs +1 -2
- package/dist/ui/hover-card.d.cts +5 -5
- package/dist/ui/hover-card.d.ts +5 -5
- package/dist/ui/hover-card.js +1 -2
- package/dist/ui/input-otp.cjs +1 -2
- package/dist/ui/input-otp.d.cts +6 -6
- package/dist/ui/input-otp.d.ts +6 -6
- package/dist/ui/input-otp.js +1 -2
- 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 +4 -4
- package/dist/ui/inputs/search-input.d.ts +4 -4
- package/dist/ui/inputs/search-input.js +1 -1
- package/dist/ui/label.cjs +1 -1
- package/dist/ui/label.d.cts +3 -3
- package/dist/ui/label.d.ts +3 -3
- package/dist/ui/menubar.cjs +1 -2
- package/dist/ui/menubar.d.cts +18 -18
- package/dist/ui/menubar.d.ts +18 -18
- package/dist/ui/menubar.js +1 -2
- package/dist/ui/multi-select.cjs +1 -2
- package/dist/ui/multi-select.d.cts +62 -3
- package/dist/ui/multi-select.d.ts +62 -3
- package/dist/ui/multi-select.js +1 -2
- package/dist/ui/navigation-menu.cjs +1 -2
- package/dist/ui/navigation-menu.d.cts +12 -11
- package/dist/ui/navigation-menu.d.ts +12 -11
- package/dist/ui/navigation-menu.js +1 -2
- package/dist/ui/pagination.cjs +1 -2
- package/dist/ui/pagination.d.cts +10 -10
- package/dist/ui/pagination.d.ts +10 -10
- package/dist/ui/pagination.js +1 -2
- package/dist/ui/popover.cjs +1 -2
- package/dist/ui/popover.d.cts +6 -6
- package/dist/ui/popover.d.ts +6 -6
- package/dist/ui/popover.js +1 -2
- package/dist/ui/progress.cjs +1 -1
- package/dist/ui/progress.d.cts +3 -3
- package/dist/ui/progress.d.ts +3 -3
- package/dist/ui/progress.js +1 -1
- package/dist/ui/radio-group.cjs +1 -2
- package/dist/ui/radio-group.d.cts +4 -4
- package/dist/ui/radio-group.d.ts +4 -4
- package/dist/ui/radio-group.js +1 -2
- package/dist/ui/resizable.cjs +1 -2
- package/dist/ui/resizable.d.cts +5 -5
- package/dist/ui/resizable.d.ts +5 -5
- package/dist/ui/resizable.js +1 -2
- package/dist/ui/scroll-area.cjs +1 -1
- package/dist/ui/scroll-area.d.cts +4 -4
- package/dist/ui/scroll-area.d.ts +4 -4
- package/dist/ui/scroll-area.js +1 -1
- package/dist/ui/select.cjs +1 -1
- package/dist/ui/select.d.cts +12 -12
- package/dist/ui/select.d.ts +12 -12
- package/dist/ui/select.js +1 -1
- package/dist/ui/separator.cjs +1 -1
- package/dist/ui/separator.d.cts +1 -1
- package/dist/ui/separator.d.ts +1 -1
- package/dist/ui/separator.js +1 -1
- package/dist/ui/sheet.cjs +1 -1
- package/dist/ui/sheet.d.cts +10 -10
- package/dist/ui/sheet.d.ts +10 -10
- package/dist/ui/sheet.js +1 -1
- package/dist/ui/sidebar.cjs +1 -1
- package/dist/ui/sidebar.d.cts +44 -31
- package/dist/ui/sidebar.d.ts +44 -31
- package/dist/ui/sidebar.js +1 -1
- package/dist/ui/skeleton.cjs +1 -1
- package/dist/ui/skeleton.d.cts +3 -3
- package/dist/ui/skeleton.d.ts +3 -3
- package/dist/ui/skeleton.js +1 -1
- package/dist/ui/slider.cjs +1 -2
- package/dist/ui/slider.d.cts +3 -3
- package/dist/ui/slider.d.ts +3 -3
- package/dist/ui/slider.js +1 -2
- package/dist/ui/sonner.cjs +1 -2
- package/dist/ui/sonner.d.cts +4 -3
- package/dist/ui/sonner.d.ts +4 -3
- package/dist/ui/sonner.js +1 -2
- package/dist/ui/switch.cjs +1 -2
- package/dist/ui/switch.d.cts +3 -3
- package/dist/ui/switch.d.ts +3 -3
- package/dist/ui/switch.js +1 -2
- package/dist/ui/table.cjs +1 -1
- package/dist/ui/table.d.cts +10 -10
- package/dist/ui/table.d.ts +10 -10
- package/dist/ui/table.js +1 -1
- package/dist/ui/tabs.cjs +1 -2
- package/dist/ui/tabs.d.cts +6 -6
- package/dist/ui/tabs.d.ts +6 -6
- package/dist/ui/tabs.js +1 -2
- package/dist/ui/textarea.cjs +1 -2
- package/dist/ui/textarea.d.cts +3 -3
- package/dist/ui/textarea.d.ts +3 -3
- package/dist/ui/textarea.js +1 -2
- package/dist/ui/toggle-group.cjs +1 -2
- package/dist/ui/toggle-group.d.cts +5 -5
- package/dist/ui/toggle-group.d.ts +5 -5
- package/dist/ui/toggle-group.js +1 -2
- 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/utils-D9AH0PUV.js +1 -2
- package/dist/utils-DaJ1XZgX.cjs +1 -0
- package/package.json +51 -4
- package/packages/components/cards/simple-card.tsx +37 -0
- package/packages/components/data-display/country.tsx +59 -0
- package/packages/components/data-display/data-list.tsx +38 -0
- package/packages/components/data-display/date.tsx +215 -0
- package/packages/components/data-display/empty.tsx +25 -0
- package/packages/components/data-display/name.tsx +25 -0
- package/packages/components/data-display/phone-number.tsx +22 -0
- package/packages/components/data-display/role-badge.tsx +33 -0
- package/packages/components/data-display/statistic.tsx +141 -0
- package/packages/components/dialogs/confirm-dialog.tsx +51 -0
- package/packages/components/dialogs/detail-dialog/component/header.tsx +14 -0
- package/packages/components/dialogs/detail-dialog/component/main.tsx +39 -0
- package/packages/components/dialogs/detail-dialog/component/sidebar.tsx +747 -0
- package/packages/components/dialogs/detail-dialog/component/wrapper.tsx +17 -0
- package/packages/components/dialogs/detail-dialog/index.tsx +100 -0
- package/packages/components/dialogs/error-dialog.tsx +48 -0
- package/packages/components/dialogs/form-dialog.tsx +106 -0
- package/packages/components/dialogs/loading-dialog.tsx +23 -0
- package/packages/components/forms/combobox-field.tsx +113 -0
- package/packages/components/forms/date-field.tsx +65 -0
- package/packages/components/forms/form-wrapper.tsx +146 -0
- package/packages/components/forms/multi-select-field.tsx +56 -0
- package/packages/components/forms/number-field.tsx +56 -0
- package/packages/components/forms/password-field.tsx +38 -0
- package/packages/components/forms/select-field.tsx +58 -0
- package/packages/components/forms/switch-field.tsx +42 -0
- package/packages/components/forms/text-field.tsx +80 -0
- package/packages/components/forms/textarea-field.tsx +53 -0
- package/packages/components/index.tsx +0 -0
- package/packages/components/layouts/flex.tsx +110 -0
- package/packages/components/layouts/main/content.tsx +11 -0
- package/packages/components/layouts/main/header.tsx +53 -0
- package/packages/components/layouts/main/index.tsx +3 -0
- package/packages/components/layouts/main/wrapper.tsx +5 -0
- package/packages/components/table/data-table-pagination.tsx +99 -0
- package/packages/components/table/data-table.tsx +328 -0
- package/packages/components/table/index.tsx +126 -0
- package/packages/components/typography/paragraph.tsx +32 -0
- package/packages/components/typography/title.tsx +36 -0
- package/packages/components/ui/alert-dialog.tsx +173 -0
- package/packages/components/ui/alert.tsx +71 -0
- package/packages/components/ui/aspect-ratio.tsx +20 -0
- package/packages/components/ui/avatar.tsx +52 -0
- package/packages/components/ui/badge.tsx +63 -0
- package/packages/components/ui/breadcrumb.tsx +110 -0
- package/packages/components/ui/button.tsx +88 -0
- package/packages/components/ui/buttons/add-new.tsx +26 -0
- package/packages/components/ui/buttons/refresh.tsx +30 -0
- package/packages/components/ui/calendar.tsx +209 -0
- package/packages/components/ui/card.tsx +95 -0
- package/packages/components/ui/carousel.tsx +241 -0
- package/packages/components/ui/checkbox.tsx +44 -0
- package/packages/components/ui/collapsible.tsx +33 -0
- package/packages/components/ui/command.tsx +217 -0
- package/packages/components/ui/context-menu.tsx +258 -0
- package/packages/components/ui/dialog.tsx +174 -0
- package/packages/components/ui/dropdown-menu.tsx +318 -0
- package/packages/components/ui/file-uploader.tsx +372 -0
- package/packages/components/ui/form.tsx +168 -0
- package/packages/components/ui/hover-card.tsx +43 -0
- package/packages/components/ui/input-otp.tsx +76 -0
- package/packages/components/ui/input.tsx +59 -0
- package/packages/components/ui/inputs/number-input.tsx +325 -0
- package/packages/components/ui/inputs/password-input.tsx +35 -0
- package/packages/components/ui/inputs/search-input.tsx +24 -0
- package/packages/components/ui/label.tsx +29 -0
- package/packages/components/ui/menubar.tsx +275 -0
- package/packages/components/ui/multi-select.tsx +693 -0
- package/packages/components/ui/navigation-menu.tsx +170 -0
- package/packages/components/ui/pagination.tsx +128 -0
- package/packages/components/ui/popover.tsx +64 -0
- package/packages/components/ui/progress.tsx +30 -0
- package/packages/components/ui/radio-group.tsx +53 -0
- package/packages/components/ui/resizable.tsx +55 -0
- package/packages/components/ui/scroll-area.tsx +51 -0
- package/packages/components/ui/select.tsx +246 -0
- package/packages/components/ui/separator.tsx +27 -0
- package/packages/components/ui/sheet.tsx +155 -0
- package/packages/components/ui/sidebar.tsx +751 -0
- package/packages/components/ui/skeleton.tsx +15 -0
- package/packages/components/ui/slider.tsx +62 -0
- package/packages/components/ui/sonner.tsx +43 -0
- package/packages/components/ui/switch.tsx +52 -0
- package/packages/components/ui/table.tsx +118 -0
- package/packages/components/ui/tabs.tsx +85 -0
- package/packages/components/ui/textarea.tsx +47 -0
- package/packages/components/ui/toggle-group.tsx +72 -0
- package/packages/components/ui/toggle.tsx +47 -0
- package/packages/components/ui/tooltip.tsx +71 -0
- package/packages/constants.tsx +79 -0
- package/packages/hooks/use-callback-ref.ts +27 -0
- package/packages/hooks/use-controllable-state.ts +67 -0
- package/packages/hooks/use-mobile.ts +21 -0
- package/packages/index.css +392 -0
- package/packages/lib/utils.ts +28 -0
- package/packages/types.ts +50 -0
- package/dist/add-new-BaABbnol.js.map +0 -1
- package/dist/add-new-DUoS_-n2.cjs.map +0 -1
- package/dist/alert-dialog-0KwdjY-6.js.map +0 -1
- package/dist/alert-dialog-D5ZqgIiC.cjs.map +0 -1
- package/dist/badge-CRXT2dH_.cjs.map +0 -1
- package/dist/badge-D_qEoSL8.js.map +0 -1
- package/dist/button-Bku3bKv9.js.map +0 -1
- package/dist/button-D_E_bNRb.d.ts +0 -18
- package/dist/button-Dzv_nos1.cjs.map +0 -1
- package/dist/button-YHI7I64h.d.cts +0 -18
- package/dist/card-D8cxRC5y.js.map +0 -1
- package/dist/card-Dta5eW8u.cjs.map +0 -1
- package/dist/cards/simple-card.cjs.map +0 -1
- package/dist/cards/simple-card.js.map +0 -1
- package/dist/chunk-CUT6urMc.cjs +0 -1
- package/dist/command-CsntVmEz.cjs.map +0 -1
- package/dist/command-_L9bD9a-.js.map +0 -1
- package/dist/data-display/country.cjs.map +0 -1
- package/dist/data-display/country.js.map +0 -1
- package/dist/data-display/data-list.cjs.map +0 -1
- package/dist/data-display/data-list.js.map +0 -1
- package/dist/data-display/empty.cjs.map +0 -1
- package/dist/data-display/empty.js.map +0 -1
- package/dist/data-display/name.cjs.map +0 -1
- package/dist/data-display/name.js.map +0 -1
- package/dist/data-display/phone-number.cjs.map +0 -1
- package/dist/data-display/phone-number.js.map +0 -1
- package/dist/data-display/role-badge.cjs.map +0 -1
- package/dist/data-display/role-badge.js.map +0 -1
- package/dist/data-display/statistic.cjs.map +0 -1
- package/dist/data-display/statistic.js.map +0 -1
- package/dist/date-BMq_DNsv.js.map +0 -1
- package/dist/date-nd8WkPlx.cjs.map +0 -1
- package/dist/dialog-C4hf-Puw.js.map +0 -1
- package/dist/dialog-W-DmDMEE.cjs.map +0 -1
- package/dist/dialogs/confirm-dialog.cjs.map +0 -1
- package/dist/dialogs/confirm-dialog.js.map +0 -1
- package/dist/dialogs/detail-dialog/index.cjs.map +0 -1
- package/dist/dialogs/detail-dialog/index.js.map +0 -1
- package/dist/dialogs/form-dialog.cjs.map +0 -1
- package/dist/dialogs/form-dialog.js.map +0 -1
- package/dist/dialogs/loading-dialog.cjs.map +0 -1
- package/dist/dialogs/loading-dialog.js.map +0 -1
- package/dist/dropdown-menu-Bv18S56o.cjs.map +0 -1
- package/dist/dropdown-menu-jCQwh2rG.js.map +0 -1
- package/dist/error-dialog-D_4WL-Hj.js.map +0 -1
- package/dist/error-dialog-DpQgL5Hy.cjs.map +0 -1
- package/dist/flex-CNA_SId-.cjs.map +0 -1
- package/dist/flex-ILvQrYMJ.js.map +0 -1
- package/dist/form-CA4hhSV5.js.map +0 -1
- package/dist/form-CYZkgobJ.cjs.map +0 -1
- package/dist/form-wrapper-BYbwt1zC.cjs.map +0 -1
- package/dist/form-wrapper-D-2Uz518.js.map +0 -1
- package/dist/input-DXEBB91E.cjs.map +0 -1
- package/dist/input-FzKbxUq2.js.map +0 -1
- package/dist/label-CunjD1rx.cjs.map +0 -1
- package/dist/label-Cxbctr6x.js.map +0 -1
- package/dist/layouts/main/index.cjs.map +0 -1
- package/dist/layouts/main/index.js.map +0 -1
- package/dist/paragraph-Bey03JkA.js.map +0 -1
- package/dist/paragraph-ZxI8zxuf.cjs.map +0 -1
- package/dist/progress-BnnOfAZN.cjs.map +0 -1
- package/dist/progress-CBccqUUJ.js.map +0 -1
- package/dist/refresh-BHt_h3N_.js.map +0 -1
- package/dist/refresh-DrolZxuC.cjs.map +0 -1
- package/dist/scroll-area-Bdb_LSFF.js.map +0 -1
- package/dist/scroll-area-DWWpaz5j.cjs.map +0 -1
- package/dist/search-input-Bf4-FeWu.cjs.map +0 -1
- package/dist/search-input-L2sq0eB0.js.map +0 -1
- package/dist/select-CWUsisI0.js.map +0 -1
- package/dist/select-ZSyt5zCe.cjs.map +0 -1
- package/dist/separator-BpsL0PlX.js.map +0 -1
- package/dist/separator-DTB3sDNG.cjs.map +0 -1
- package/dist/sheet-C8r2QGpq.js.map +0 -1
- package/dist/sheet-CCwbAaA6.cjs.map +0 -1
- package/dist/sidebar-BLPMNltJ.cjs.map +0 -1
- package/dist/sidebar-C166f_9B.js.map +0 -1
- package/dist/skeleton-DYmX0k94.js.map +0 -1
- package/dist/skeleton-m3giaF4T.cjs +0 -2
- package/dist/skeleton-m3giaF4T.cjs.map +0 -1
- package/dist/table/index.cjs.map +0 -1
- package/dist/table/index.js.map +0 -1
- package/dist/table-BSeev7T0.cjs.map +0 -1
- package/dist/table-BvA64mE8.js.map +0 -1
- package/dist/title-DTkABsIG.js.map +0 -1
- package/dist/title-xsPZpQpb.cjs.map +0 -1
- package/dist/toggle-BVkMTVAz.d.ts +0 -15
- package/dist/toggle-CW-ZnYMy.d.cts +0 -15
- package/dist/toggle-CfL3GVe2.cjs.map +0 -1
- package/dist/toggle-D_MDMruK.js.map +0 -1
- package/dist/tooltip-Beb-_EPp.cjs.map +0 -1
- package/dist/tooltip-Dzyf5smh.js.map +0 -1
- package/dist/types-CrbWxjnp.cjs.map +0 -1
- package/dist/types-DaIHddx7.js.map +0 -1
- package/dist/ui/alert.cjs.map +0 -1
- package/dist/ui/alert.js.map +0 -1
- package/dist/ui/aspect-ratio.cjs.map +0 -1
- package/dist/ui/aspect-ratio.js.map +0 -1
- package/dist/ui/avatar.cjs.map +0 -1
- package/dist/ui/avatar.js.map +0 -1
- package/dist/ui/breadcrumb.cjs.map +0 -1
- package/dist/ui/breadcrumb.js.map +0 -1
- package/dist/ui/calendar.cjs.map +0 -1
- package/dist/ui/calendar.js.map +0 -1
- package/dist/ui/carousel.cjs.map +0 -1
- package/dist/ui/carousel.js.map +0 -1
- package/dist/ui/collapsible.cjs.map +0 -1
- package/dist/ui/collapsible.js.map +0 -1
- package/dist/ui/context-menu.cjs.map +0 -1
- package/dist/ui/context-menu.js.map +0 -1
- package/dist/ui/file-uploader.cjs.map +0 -1
- package/dist/ui/file-uploader.js.map +0 -1
- package/dist/ui/hover-card.cjs.map +0 -1
- package/dist/ui/hover-card.js.map +0 -1
- package/dist/ui/input-otp.cjs.map +0 -1
- package/dist/ui/input-otp.js.map +0 -1
- package/dist/ui/menubar.cjs.map +0 -1
- package/dist/ui/menubar.js.map +0 -1
- package/dist/ui/multi-select.cjs.map +0 -1
- package/dist/ui/multi-select.js.map +0 -1
- package/dist/ui/navigation-menu.cjs.map +0 -1
- package/dist/ui/navigation-menu.js.map +0 -1
- package/dist/ui/pagination.cjs.map +0 -1
- package/dist/ui/pagination.js.map +0 -1
- package/dist/ui/popover.cjs.map +0 -1
- package/dist/ui/popover.js.map +0 -1
- package/dist/ui/radio-group.cjs.map +0 -1
- package/dist/ui/radio-group.js.map +0 -1
- package/dist/ui/resizable.cjs.map +0 -1
- package/dist/ui/resizable.js.map +0 -1
- package/dist/ui/slider.cjs.map +0 -1
- package/dist/ui/slider.js.map +0 -1
- package/dist/ui/sonner.cjs.map +0 -1
- package/dist/ui/sonner.js.map +0 -1
- package/dist/ui/switch.cjs.map +0 -1
- package/dist/ui/switch.js.map +0 -1
- package/dist/ui/tabs.cjs.map +0 -1
- package/dist/ui/tabs.js.map +0 -1
- package/dist/ui/textarea.cjs.map +0 -1
- package/dist/ui/textarea.js.map +0 -1
- package/dist/ui/toggle-group.cjs.map +0 -1
- package/dist/ui/toggle-group.js.map +0 -1
- package/dist/utils-BsjVK5EW.cjs +0 -2
- package/dist/utils-BsjVK5EW.cjs.map +0 -1
- package/dist/utils-D9AH0PUV.js.map +0 -1
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import {
|
|
4
|
+
Controller,
|
|
5
|
+
type ControllerProps,
|
|
6
|
+
type FieldPath,
|
|
7
|
+
type FieldValues,
|
|
8
|
+
FormProvider,
|
|
9
|
+
useFormContext,
|
|
10
|
+
useFormState,
|
|
11
|
+
} from "react-hook-form";
|
|
12
|
+
import { Label as LabelPrimitive, Slot as SlotPrimitive } from "radix-ui";
|
|
13
|
+
|
|
14
|
+
import { Label } from "@/components/ui/label";
|
|
15
|
+
import { cn } from "@/lib/utils";
|
|
16
|
+
|
|
17
|
+
const Form = FormProvider;
|
|
18
|
+
|
|
19
|
+
type FormFieldContextValue<
|
|
20
|
+
TFieldValues extends FieldValues = FieldValues,
|
|
21
|
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
22
|
+
> = {
|
|
23
|
+
name: TName;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const FormFieldContext = React.createContext<FormFieldContextValue>(
|
|
27
|
+
{} as FormFieldContextValue,
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const FormField = <
|
|
31
|
+
TFieldValues extends FieldValues = FieldValues,
|
|
32
|
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
33
|
+
>({
|
|
34
|
+
...props
|
|
35
|
+
}: ControllerProps<TFieldValues, TName>) => {
|
|
36
|
+
return (
|
|
37
|
+
<FormFieldContext.Provider value={{ name: props.name }}>
|
|
38
|
+
<Controller {...props} />
|
|
39
|
+
</FormFieldContext.Provider>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const useFormField = () => {
|
|
44
|
+
const fieldContext = React.useContext(FormFieldContext);
|
|
45
|
+
const itemContext = React.useContext(FormItemContext);
|
|
46
|
+
const { getFieldState, control, resetField } = useFormContext();
|
|
47
|
+
const formState = useFormState({ name: fieldContext.name });
|
|
48
|
+
const fieldState = getFieldState(fieldContext.name, formState);
|
|
49
|
+
|
|
50
|
+
if (!fieldContext) {
|
|
51
|
+
throw new Error("useFormField should be used within <FormField>");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const { id } = itemContext;
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
id,
|
|
58
|
+
control,
|
|
59
|
+
resetField,
|
|
60
|
+
name: fieldContext.name,
|
|
61
|
+
formItemId: `${id}-form-item`,
|
|
62
|
+
formDescriptionId: `${id}-form-item-description`,
|
|
63
|
+
formMessageId: `${id}-form-item-message`,
|
|
64
|
+
...fieldState,
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
type FormItemContextValue = {
|
|
69
|
+
id: string;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const FormItemContext = React.createContext<FormItemContextValue>(
|
|
73
|
+
{} as FormItemContextValue,
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
function FormItem({ className, ...props }: React.ComponentProps<"div">) {
|
|
77
|
+
const id = React.useId();
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<FormItemContext.Provider value={{ id }}>
|
|
81
|
+
<div
|
|
82
|
+
data-slot="form-item"
|
|
83
|
+
className={cn("grid gap-1", className)}
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
</FormItemContext.Provider>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function FormLabel({
|
|
91
|
+
className,
|
|
92
|
+
...props
|
|
93
|
+
}: React.ComponentProps<typeof LabelPrimitive.Root>) {
|
|
94
|
+
const { formItemId } = useFormField();
|
|
95
|
+
return (
|
|
96
|
+
<Label
|
|
97
|
+
data-slot="form-label"
|
|
98
|
+
className={cn("text-xs", className)}
|
|
99
|
+
htmlFor={formItemId}
|
|
100
|
+
{...props}
|
|
101
|
+
/>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function FormControl({
|
|
106
|
+
...props
|
|
107
|
+
}: React.ComponentProps<typeof SlotPrimitive.Slot>) {
|
|
108
|
+
const { error, formItemId, formDescriptionId, formMessageId } =
|
|
109
|
+
useFormField();
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<SlotPrimitive.Slot
|
|
113
|
+
data-slot="form-control"
|
|
114
|
+
id={formItemId}
|
|
115
|
+
aria-describedby={
|
|
116
|
+
!error
|
|
117
|
+
? `${formDescriptionId}`
|
|
118
|
+
: `${formDescriptionId} ${formMessageId}`
|
|
119
|
+
}
|
|
120
|
+
aria-invalid={!!error}
|
|
121
|
+
{...props}
|
|
122
|
+
/>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function FormDescription({ className, ...props }: React.ComponentProps<"p">) {
|
|
127
|
+
const { formDescriptionId } = useFormField();
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<p
|
|
131
|
+
data-slot="form-description"
|
|
132
|
+
id={formDescriptionId}
|
|
133
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
134
|
+
{...props}
|
|
135
|
+
/>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function FormMessage({
|
|
140
|
+
className,
|
|
141
|
+
children,
|
|
142
|
+
...props
|
|
143
|
+
}: React.ComponentProps<"p">) {
|
|
144
|
+
const { error, formMessageId } = useFormField();
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<span
|
|
148
|
+
data-slot="form-message"
|
|
149
|
+
id={formMessageId}
|
|
150
|
+
className={cn("text-destructive text-xs", className)}
|
|
151
|
+
{...props}
|
|
152
|
+
>
|
|
153
|
+
{error ? String(error?.message ?? "") : children}
|
|
154
|
+
</span>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// eslint-disable-next-line react-refresh/only-export-components
|
|
159
|
+
export {
|
|
160
|
+
Form,
|
|
161
|
+
FormControl,
|
|
162
|
+
FormDescription,
|
|
163
|
+
FormField,
|
|
164
|
+
FormItem,
|
|
165
|
+
FormLabel,
|
|
166
|
+
FormMessage,
|
|
167
|
+
useFormField,
|
|
168
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { HoverCard as HoverCardPrimitive } from "radix-ui";
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils";
|
|
6
|
+
|
|
7
|
+
function HoverCard({
|
|
8
|
+
...props
|
|
9
|
+
}: React.ComponentProps<typeof HoverCardPrimitive.Root>) {
|
|
10
|
+
return <HoverCardPrimitive.Root data-slot="hover-card" {...props} />;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function HoverCardTrigger({
|
|
14
|
+
...props
|
|
15
|
+
}: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {
|
|
16
|
+
return (
|
|
17
|
+
<HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function HoverCardContent({
|
|
22
|
+
className,
|
|
23
|
+
align = "center",
|
|
24
|
+
sideOffset = 4,
|
|
25
|
+
...props
|
|
26
|
+
}: React.ComponentProps<typeof HoverCardPrimitive.Content>) {
|
|
27
|
+
return (
|
|
28
|
+
<HoverCardPrimitive.Portal data-slot="hover-card-portal">
|
|
29
|
+
<HoverCardPrimitive.Content
|
|
30
|
+
data-slot="hover-card-content"
|
|
31
|
+
align={align}
|
|
32
|
+
sideOffset={sideOffset}
|
|
33
|
+
className={cn(
|
|
34
|
+
"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",
|
|
35
|
+
className,
|
|
36
|
+
)}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
</HoverCardPrimitive.Portal>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { HoverCard, HoverCardContent, HoverCardTrigger };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { OTPInput, OTPInputContext } from "input-otp";
|
|
4
|
+
import { MinusIcon } from "lucide-react";
|
|
5
|
+
|
|
6
|
+
import { cn } from "@/lib/utils";
|
|
7
|
+
|
|
8
|
+
function InputOTP({
|
|
9
|
+
className,
|
|
10
|
+
containerClassName,
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentProps<typeof OTPInput> & {
|
|
13
|
+
containerClassName?: string;
|
|
14
|
+
}) {
|
|
15
|
+
return (
|
|
16
|
+
<OTPInput
|
|
17
|
+
data-slot="input-otp"
|
|
18
|
+
containerClassName={cn(
|
|
19
|
+
"flex items-center gap-2 has-disabled:opacity-50",
|
|
20
|
+
containerClassName,
|
|
21
|
+
)}
|
|
22
|
+
className={cn("disabled:cursor-not-allowed", className)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function InputOTPGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
29
|
+
return (
|
|
30
|
+
<div
|
|
31
|
+
data-slot="input-otp-group"
|
|
32
|
+
className={cn("flex items-center", className)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function InputOTPSlot({
|
|
39
|
+
index,
|
|
40
|
+
className,
|
|
41
|
+
...props
|
|
42
|
+
}: React.ComponentProps<"div"> & {
|
|
43
|
+
index: number;
|
|
44
|
+
}) {
|
|
45
|
+
const inputOTPContext = React.useContext(OTPInputContext);
|
|
46
|
+
const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<div
|
|
50
|
+
data-slot="input-otp-slot"
|
|
51
|
+
data-active={isActive}
|
|
52
|
+
className={cn(
|
|
53
|
+
"data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",
|
|
54
|
+
className,
|
|
55
|
+
)}
|
|
56
|
+
{...props}
|
|
57
|
+
>
|
|
58
|
+
{char}
|
|
59
|
+
{hasFakeCaret && (
|
|
60
|
+
<div className="pointer-events-none absolute inset-0 flex items-center justify-center">
|
|
61
|
+
<div className="animate-caret-blink bg-foreground h-4 w-px duration-1000" />
|
|
62
|
+
</div>
|
|
63
|
+
)}
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function InputOTPSeparator({ ...props }: React.ComponentProps<"div">) {
|
|
69
|
+
return (
|
|
70
|
+
<div data-slot="input-otp-separator" role="separator" {...props}>
|
|
71
|
+
<MinusIcon />
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils";
|
|
5
|
+
|
|
6
|
+
function Input({
|
|
7
|
+
className,
|
|
8
|
+
type,
|
|
9
|
+
onChange,
|
|
10
|
+
onValueChange,
|
|
11
|
+
...props
|
|
12
|
+
}: React.ComponentProps<"input"> & {
|
|
13
|
+
onValueChange?: (value: string) => void;
|
|
14
|
+
}) {
|
|
15
|
+
const handleChange = React.useCallback(
|
|
16
|
+
(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
17
|
+
onChange?.(e);
|
|
18
|
+
onValueChange?.(e.target.value);
|
|
19
|
+
},
|
|
20
|
+
[onChange, onValueChange],
|
|
21
|
+
);
|
|
22
|
+
return (
|
|
23
|
+
<input
|
|
24
|
+
type={type}
|
|
25
|
+
data-slot="input"
|
|
26
|
+
className={cn(
|
|
27
|
+
"flex h-9 w-full min-w-0",
|
|
28
|
+
"border-input shadow-input rounded-md border",
|
|
29
|
+
"px-3 py-1",
|
|
30
|
+
"bg-transparent",
|
|
31
|
+
"caret-primary text-sm",
|
|
32
|
+
"transition-[color,box-shadow] outline-none",
|
|
33
|
+
"placeholder:text-muted-foreground",
|
|
34
|
+
"selection:bg-primary",
|
|
35
|
+
"selection:text-primary-foreground",
|
|
36
|
+
"file:inline-flex",
|
|
37
|
+
"file:h-7",
|
|
38
|
+
"file:border-0",
|
|
39
|
+
"file:bg-transparent",
|
|
40
|
+
"file:text-sm",
|
|
41
|
+
"file:text-foreground",
|
|
42
|
+
"file:font-medium",
|
|
43
|
+
"disabled:pointer-events-none",
|
|
44
|
+
"disabled:cursor-not-allowed",
|
|
45
|
+
"disabled:opacity-50",
|
|
46
|
+
"focus-visible:ring-4",
|
|
47
|
+
"focus-visible:ring-ring",
|
|
48
|
+
"focus-visible:border-primary/60",
|
|
49
|
+
"aria-invalid:ring-destructive/40",
|
|
50
|
+
"aria-invalid:border-destructive",
|
|
51
|
+
className,
|
|
52
|
+
)}
|
|
53
|
+
{...props}
|
|
54
|
+
onChange={handleChange}
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { Input };
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { cn } from '@/lib/utils'
|
|
5
|
+
|
|
6
|
+
import { Input } from '../input'
|
|
7
|
+
|
|
8
|
+
const createValidationRegex = (allowNegative: boolean): RegExp => {
|
|
9
|
+
return allowNegative ? /^-?\d*\.?\d*$/ : /^\d*\.?\d*$/
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const formatNumberWithCommas = (num: number | string): string => {
|
|
13
|
+
return Number(num).toLocaleString()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface IProps extends React.HTMLAttributes<HTMLInputElement> {
|
|
17
|
+
/**
|
|
18
|
+
* Description: Value for the text field
|
|
19
|
+
*
|
|
20
|
+
* Default: ''
|
|
21
|
+
*
|
|
22
|
+
* Usage: Value for the text field
|
|
23
|
+
*/
|
|
24
|
+
value?: string | number
|
|
25
|
+
/**
|
|
26
|
+
* Description: Disabled state of the text field
|
|
27
|
+
*
|
|
28
|
+
* Default: `false`
|
|
29
|
+
*
|
|
30
|
+
* Usage: Disabled state of the text field
|
|
31
|
+
*
|
|
32
|
+
* Note: If true, the text field will be disabled
|
|
33
|
+
*/
|
|
34
|
+
disabled?: boolean
|
|
35
|
+
/**
|
|
36
|
+
* Description: Readonly state of the text field
|
|
37
|
+
*
|
|
38
|
+
* Default: `false`
|
|
39
|
+
*
|
|
40
|
+
* Usage: Readonly state of the text field
|
|
41
|
+
*/
|
|
42
|
+
readonly?: boolean
|
|
43
|
+
/**
|
|
44
|
+
* Description: Allow negative value for the text field
|
|
45
|
+
*
|
|
46
|
+
* Default: `false`
|
|
47
|
+
*
|
|
48
|
+
* Usage: Allow negative value for the text field
|
|
49
|
+
*/
|
|
50
|
+
allowNegative?: boolean
|
|
51
|
+
/**
|
|
52
|
+
* Description: Decimal point for the text field
|
|
53
|
+
*
|
|
54
|
+
* Default: `undefined`
|
|
55
|
+
*
|
|
56
|
+
* Usage: Ex: [12,3] => console.log(2323.23) // True
|
|
57
|
+
*
|
|
58
|
+
* Note: IF use this prop, `numberAfterDecimalPoint` will be ignored
|
|
59
|
+
*/
|
|
60
|
+
decimal?: [number, number]
|
|
61
|
+
/**
|
|
62
|
+
* Description: Rounding rule for the text field
|
|
63
|
+
*
|
|
64
|
+
* Default: `nearest`
|
|
65
|
+
*
|
|
66
|
+
* Usage: Rounding rule for the text field
|
|
67
|
+
*/
|
|
68
|
+
roundingRule?: 'up' | 'down' | 'nearest' | 'none'
|
|
69
|
+
/**
|
|
70
|
+
* Description: Number of digits after the decimal point
|
|
71
|
+
*
|
|
72
|
+
* Default: `2`
|
|
73
|
+
*
|
|
74
|
+
* Usage: Number of digits after the decimal point
|
|
75
|
+
*/
|
|
76
|
+
numberAfterDecimalPoint?: number
|
|
77
|
+
/**
|
|
78
|
+
* Description: Placeholder for the text field
|
|
79
|
+
*
|
|
80
|
+
* Default: ''
|
|
81
|
+
*
|
|
82
|
+
* Usage: Placeholder for the text field
|
|
83
|
+
*/
|
|
84
|
+
placeholder?: string
|
|
85
|
+
/**
|
|
86
|
+
* Description: Unit text for the text field
|
|
87
|
+
*
|
|
88
|
+
* Default: ''
|
|
89
|
+
*
|
|
90
|
+
* E.g. 'kg', 'm', 'USD'...
|
|
91
|
+
*/
|
|
92
|
+
unitText?: string
|
|
93
|
+
/**
|
|
94
|
+
* Description: Invalid state of the text field
|
|
95
|
+
*
|
|
96
|
+
* Default: `false`
|
|
97
|
+
*
|
|
98
|
+
* Usage: Invalid state of the text field
|
|
99
|
+
*/
|
|
100
|
+
invalid?: boolean
|
|
101
|
+
/**
|
|
102
|
+
* Description: Precision for the text field
|
|
103
|
+
*
|
|
104
|
+
* Default: `undefined`
|
|
105
|
+
* E.g.
|
|
106
|
+
* - 2.13 => 2.1 when precision is 1
|
|
107
|
+
* - 2.134 => 2.13 when precision is 2
|
|
108
|
+
*/
|
|
109
|
+
precision?: number
|
|
110
|
+
/**
|
|
111
|
+
* Description: Callback function for the value change
|
|
112
|
+
* Usage: Callback function for the value change
|
|
113
|
+
*/
|
|
114
|
+
onValueChange?: (value?: number) => void
|
|
115
|
+
onBlur?: () => void
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* ## Unit Text Field Component
|
|
119
|
+
*
|
|
120
|
+
* **Description**: This component is to display common text field with unit
|
|
121
|
+
*
|
|
122
|
+
* **Usage**: Text field with unit example: 1000 (kg), 100 (m), 1000 (USD)...
|
|
123
|
+
*/
|
|
124
|
+
export const NumberInput: React.FC<IProps> = ({
|
|
125
|
+
disabled = false,
|
|
126
|
+
readonly = false,
|
|
127
|
+
allowNegative = false,
|
|
128
|
+
numberAfterDecimalPoint = 2,
|
|
129
|
+
roundingRule = 'none',
|
|
130
|
+
value: initialValue = '',
|
|
131
|
+
unitText,
|
|
132
|
+
decimal,
|
|
133
|
+
placeholder,
|
|
134
|
+
precision,
|
|
135
|
+
onChange,
|
|
136
|
+
onValueChange,
|
|
137
|
+
onBlur,
|
|
138
|
+
...props
|
|
139
|
+
}) => {
|
|
140
|
+
const _unitRef = React.useRef<HTMLSpanElement>(null)
|
|
141
|
+
const _inputRef = React.useRef<HTMLInputElement>(null)
|
|
142
|
+
|
|
143
|
+
const [value, setValue] = React.useState<string>(initialValue.toString())
|
|
144
|
+
|
|
145
|
+
// Memoized values for validation and formatting
|
|
146
|
+
const maxDecimalPlaces = decimal?.[1] ?? numberAfterDecimalPoint
|
|
147
|
+
const maxIntegerLength = decimal && decimal[0] - decimal[1]
|
|
148
|
+
const validationRegex = React.useMemo(() => createValidationRegex(allowNegative), [allowNegative])
|
|
149
|
+
|
|
150
|
+
// Validation functions
|
|
151
|
+
const isValidDecimalLength = React.useCallback(
|
|
152
|
+
(value: string): boolean => {
|
|
153
|
+
if (!maxDecimalPlaces && value.includes('.')) return false
|
|
154
|
+
const decimalPart = value.split('.')[1]
|
|
155
|
+
return !decimalPart || decimalPart.length <= maxDecimalPlaces
|
|
156
|
+
},
|
|
157
|
+
[maxDecimalPlaces],
|
|
158
|
+
)
|
|
159
|
+
const isValidFormat = React.useCallback(
|
|
160
|
+
(value: string): boolean => {
|
|
161
|
+
if (!decimal || value === '-') return true
|
|
162
|
+
const [integerPart, decimalPart = ''] = value.split('.')
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
decimalPart.length <= decimal[1] &&
|
|
166
|
+
(integerPart.startsWith('-') ? integerPart.length - 1 : integerPart.length) <= maxIntegerLength!
|
|
167
|
+
)
|
|
168
|
+
},
|
|
169
|
+
[decimal, maxIntegerLength],
|
|
170
|
+
)
|
|
171
|
+
const customRoundedValue = React.useCallback(
|
|
172
|
+
(value: number, precision: number) => {
|
|
173
|
+
if (roundingRule === 'none') return value
|
|
174
|
+
|
|
175
|
+
const factor = Math.pow(10, precision)
|
|
176
|
+
const scaledValue = value * factor
|
|
177
|
+
|
|
178
|
+
switch (roundingRule) {
|
|
179
|
+
case 'up':
|
|
180
|
+
return Math.ceil(scaledValue) / factor
|
|
181
|
+
case 'down':
|
|
182
|
+
return Math.floor(scaledValue) / factor
|
|
183
|
+
case 'nearest': {
|
|
184
|
+
if (scaledValue % 1 < 0.1) return Math.floor(scaledValue) / factor
|
|
185
|
+
if (scaledValue % 1 >= 0.59) return Math.ceil(scaledValue) / factor
|
|
186
|
+
return (Math.floor(scaledValue) + 0.5) / factor
|
|
187
|
+
}
|
|
188
|
+
default:
|
|
189
|
+
return value
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
[roundingRule],
|
|
193
|
+
)
|
|
194
|
+
const isDecimalPointGreaterThanLimit = React.useCallback(
|
|
195
|
+
(value: string) =>
|
|
196
|
+
(!numberAfterDecimalPoint && value.includes('.')) || value.split('.')[1]?.length > numberAfterDecimalPoint,
|
|
197
|
+
[numberAfterDecimalPoint],
|
|
198
|
+
)
|
|
199
|
+
const formattedValue = React.useCallback(
|
|
200
|
+
(val: string) => {
|
|
201
|
+
if (val === '0') return '0'
|
|
202
|
+
if (!Number(val)) return ''
|
|
203
|
+
|
|
204
|
+
const numValue = parseFloat(val)
|
|
205
|
+
const effectivePrecision = Math.min(maxDecimalPlaces - 1, precision || 0)
|
|
206
|
+
const roundedValue = customRoundedValue(numValue, effectivePrecision).toString()
|
|
207
|
+
const [integerPart, decimalPart = ''] = roundedValue.split('.')
|
|
208
|
+
const formattedInteger = formatNumberWithCommas(integerPart)
|
|
209
|
+
return decimalPart ? `${formattedInteger}.${decimalPart}` : formattedInteger
|
|
210
|
+
},
|
|
211
|
+
[customRoundedValue, maxDecimalPlaces, precision],
|
|
212
|
+
)
|
|
213
|
+
// Validate decimal point is less than or equal to the limit
|
|
214
|
+
const validateDecimalPoint = React.useCallback(
|
|
215
|
+
(value: string) => {
|
|
216
|
+
if (!decimal || value === '-') return true
|
|
217
|
+
|
|
218
|
+
const [integerPart, decimalPart = ''] = value.split('.')
|
|
219
|
+
const integerLength = integerPart.startsWith('-') ? integerPart.length - 1 : integerPart.length
|
|
220
|
+
const maxIntegerLength = decimal[0] - decimal[1]
|
|
221
|
+
|
|
222
|
+
return decimalPart.length <= decimal[1] && integerLength <= maxIntegerLength
|
|
223
|
+
},
|
|
224
|
+
[decimal],
|
|
225
|
+
)
|
|
226
|
+
const handleChange = React.useCallback(
|
|
227
|
+
(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
228
|
+
// Don't prevent default behavior of input change
|
|
229
|
+
onChange?.(e)
|
|
230
|
+
|
|
231
|
+
// Custom event handler for value change
|
|
232
|
+
const { value: inputValue } = e.target
|
|
233
|
+
|
|
234
|
+
// Handle empty input
|
|
235
|
+
if (!inputValue) {
|
|
236
|
+
onValueChange?.(undefined)
|
|
237
|
+
setValue('')
|
|
238
|
+
return
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Handle zero and negative zero
|
|
242
|
+
const isZero = inputValue === '0'
|
|
243
|
+
const isNegativeZero = inputValue === '-' && allowNegative
|
|
244
|
+
if (isZero || isNegativeZero) {
|
|
245
|
+
onValueChange?.(0)
|
|
246
|
+
setValue(inputValue)
|
|
247
|
+
return
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Validate input format
|
|
251
|
+
const isValid =
|
|
252
|
+
validationRegex.test(inputValue) && isValidFormat(inputValue) && (decimal || isValidDecimalLength(inputValue))
|
|
253
|
+
if (!isValid) return
|
|
254
|
+
|
|
255
|
+
const numericValue = parseFloat(inputValue) || 0
|
|
256
|
+
onValueChange?.(numericValue)
|
|
257
|
+
setValue(inputValue)
|
|
258
|
+
},
|
|
259
|
+
[allowNegative, decimal, isValidDecimalLength, isValidFormat, onChange, onValueChange, validationRegex],
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
const handleFocus = React.useCallback(() => {
|
|
263
|
+
if (readonly) return
|
|
264
|
+
setValue((prev) => prev.replace(/,/g, '')) // Remove commas for easier editing
|
|
265
|
+
}, [readonly])
|
|
266
|
+
|
|
267
|
+
const handleBlur = React.useCallback(() => {
|
|
268
|
+
if (readonly) return
|
|
269
|
+
onBlur?.()
|
|
270
|
+
setValue((prev) => formattedValue(prev))
|
|
271
|
+
}, [readonly, onBlur, formattedValue])
|
|
272
|
+
|
|
273
|
+
// Set initial value
|
|
274
|
+
React.useEffect(() => {
|
|
275
|
+
const isFocused = document.activeElement === _inputRef.current
|
|
276
|
+
|
|
277
|
+
if (
|
|
278
|
+
!initialValue ||
|
|
279
|
+
!validationRegex.test(initialValue.toString()) ||
|
|
280
|
+
!validateDecimalPoint(initialValue.toString()) ||
|
|
281
|
+
(!decimal && isDecimalPointGreaterThanLimit(initialValue.toString()))
|
|
282
|
+
) {
|
|
283
|
+
setValue('')
|
|
284
|
+
return
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
setValue((prev) => {
|
|
288
|
+
if (prev === '-') return '-'
|
|
289
|
+
if (!prev) return ''
|
|
290
|
+
return isFocused ? initialValue.toString() : formattedValue(initialValue.toString())
|
|
291
|
+
})
|
|
292
|
+
}, [decimal, formattedValue, initialValue, isDecimalPointGreaterThanLimit, validateDecimalPoint, validationRegex])
|
|
293
|
+
|
|
294
|
+
// Set padding right for the input field
|
|
295
|
+
React.useEffect(() => {
|
|
296
|
+
if (!_unitRef.current || !_inputRef.current || !unitText) return
|
|
297
|
+
const unitWidth = _unitRef.current.offsetWidth
|
|
298
|
+
_inputRef.current.style.setProperty('padding-right', `${(unitWidth + 8) / 16}rem`)
|
|
299
|
+
}, [disabled, unitText])
|
|
300
|
+
|
|
301
|
+
return (
|
|
302
|
+
<div className="relative">
|
|
303
|
+
<Input
|
|
304
|
+
{...props}
|
|
305
|
+
ref={_inputRef}
|
|
306
|
+
value={value || (readonly ? '0' : '')}
|
|
307
|
+
placeholder={placeholder}
|
|
308
|
+
disabled={disabled}
|
|
309
|
+
readOnly={readonly}
|
|
310
|
+
className={cn('font-number text-end', readonly && 'bg-muted text-muted-foreground')}
|
|
311
|
+
onChange={handleChange}
|
|
312
|
+
onFocus={handleFocus}
|
|
313
|
+
onBlur={handleBlur}
|
|
314
|
+
/>
|
|
315
|
+
{unitText && (
|
|
316
|
+
<span
|
|
317
|
+
ref={_unitRef}
|
|
318
|
+
className="text-muted-foreground pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 text-sm"
|
|
319
|
+
>
|
|
320
|
+
{unitText}
|
|
321
|
+
</span>
|
|
322
|
+
)}
|
|
323
|
+
</div>
|
|
324
|
+
)
|
|
325
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { EyeIcon, EyeOffIcon } from 'lucide-react'
|
|
4
|
+
|
|
5
|
+
import { cn } from '@/lib/utils'
|
|
6
|
+
|
|
7
|
+
import { Input } from '../input'
|
|
8
|
+
|
|
9
|
+
type Props = React.ComponentPropsWithoutRef<typeof Input>
|
|
10
|
+
export const PasswordInput: React.FC<Props> = ({ className, ...rest }) => {
|
|
11
|
+
const id = React.useId()
|
|
12
|
+
const [isVisible, setIsVisible] = React.useState<boolean>(false)
|
|
13
|
+
const toggleVisibility = React.useCallback(() => setIsVisible((prevState) => !prevState), [])
|
|
14
|
+
return (
|
|
15
|
+
<div className="relative">
|
|
16
|
+
<Input
|
|
17
|
+
{...rest}
|
|
18
|
+
id={id}
|
|
19
|
+
placeholder="Password"
|
|
20
|
+
type={isVisible ? 'text' : 'password'}
|
|
21
|
+
className={cn('pe-9', className)}
|
|
22
|
+
/>
|
|
23
|
+
<button
|
|
24
|
+
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"
|
|
25
|
+
type="button"
|
|
26
|
+
onClick={toggleVisibility}
|
|
27
|
+
aria-label={isVisible ? 'Hide password' : 'Show password'}
|
|
28
|
+
aria-pressed={isVisible}
|
|
29
|
+
aria-controls="password"
|
|
30
|
+
>
|
|
31
|
+
{isVisible ? <EyeOffIcon size={16} aria-hidden="true" /> : <EyeIcon size={16} aria-hidden="true" />}
|
|
32
|
+
</button>
|
|
33
|
+
</div>
|
|
34
|
+
)
|
|
35
|
+
}
|