@customafk/lunas-ui 0.0.26 → 0.0.28
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-D-oR0YW3.cjs → alert-dialog-26JyobJb.cjs} +1 -1
- package/dist/{alert-dialog-D-oR0YW3.cjs.map → alert-dialog-26JyobJb.cjs.map} +1 -1
- package/dist/{alert-dialog-CNHyP_A9.js → alert-dialog-Dv0cgymS.js} +1 -1
- package/dist/{alert-dialog-CNHyP_A9.js.map → alert-dialog-Dv0cgymS.js.map} +1 -1
- package/dist/{button-BmBtMriU.d.ts → button-CPBLm_02.d.ts} +5 -5
- package/dist/{button-tCnJHt8O.d.cts → button-ghXW1WTr.d.cts} +5 -5
- package/dist/{calendar-CbuOOMpK.js → calendar-B66UT_fu.js} +1 -1
- package/dist/{calendar-CbuOOMpK.js.map → calendar-B66UT_fu.js.map} +1 -1
- package/dist/{calendar-B8IKzrdN.cjs → calendar-DXegnGRJ.cjs} +1 -1
- package/dist/{calendar-B8IKzrdN.cjs.map → calendar-DXegnGRJ.cjs.map} +1 -1
- package/dist/{command-Dr2XmKV6.d.cts → command-CE_Qcgo7.d.ts} +12 -12
- package/dist/{command-Dvq-HZwH.d.ts → command-CiEjoEnP.d.cts} +12 -12
- package/dist/{command-TFZwJmux.js → command-Dbkg10QA.js} +2 -2
- package/dist/{command-TFZwJmux.js.map → command-Dbkg10QA.js.map} +1 -1
- package/dist/{command-CoB5R5FI.cjs → command-IL3ogESu.cjs} +2 -2
- package/dist/{command-CoB5R5FI.cjs.map → command-IL3ogESu.cjs.map} +1 -1
- package/dist/data-display/empty.d.cts +2 -2
- package/dist/data-display/statistic.d.cts +2 -2
- package/dist/data-display/statistic.d.ts +2 -2
- package/dist/{dialog-CSDDiHKO.js → dialog-BEdMA5Lp.js} +1 -1
- package/dist/{dialog-CSDDiHKO.js.map → dialog-BEdMA5Lp.js.map} +1 -1
- package/dist/{dialog-C-DYoapJ.d.ts → dialog-Bw_T5aco.d.cts} +12 -12
- package/dist/{dialog-_Cgij9NP.cjs → dialog-C4oHnJNN.cjs} +1 -1
- package/dist/{dialog-_Cgij9NP.cjs.map → dialog-C4oHnJNN.cjs.map} +1 -1
- package/dist/{dialog-CA0E_tNX.d.cts → dialog-CoH1pTBH.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.d.cts +4 -4
- package/dist/dialogs/detail-dialog/component/sidebar.d.ts +28 -28
- 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/dialogs/loading-dialog.cjs +1 -1
- package/dist/dialogs/loading-dialog.js +1 -1
- package/dist/{error-dialog-D5R5le-W.cjs → error-dialog-C0PDn-pj.cjs} +2 -2
- package/dist/{error-dialog-D5R5le-W.cjs.map → error-dialog-C0PDn-pj.cjs.map} +1 -1
- package/dist/{error-dialog-Q99thrSD.js → error-dialog-CCdQ8zbQ.js} +2 -2
- package/dist/{error-dialog-Q99thrSD.js.map → error-dialog-CCdQ8zbQ.js.map} +1 -1
- package/dist/{form-wrapper-CY-stRaQ.cjs → form-wrapper-Cd8c5MIL.cjs} +2 -2
- package/dist/{form-wrapper-CY-stRaQ.cjs.map → form-wrapper-Cd8c5MIL.cjs.map} +1 -1
- package/dist/{form-wrapper-C2xlvWx0.js → form-wrapper-DntbFqN1.js} +2 -2
- package/dist/{form-wrapper-C2xlvWx0.js.map → form-wrapper-DntbFqN1.js.map} +1 -1
- package/dist/forms/combobox-field.cjs +1 -1
- package/dist/forms/combobox-field.d.cts +2 -2
- package/dist/forms/combobox-field.d.ts +2 -2
- 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.cjs.map +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.d.cts +2 -2
- package/dist/forms/number-field.d.ts +2 -2
- package/dist/forms/password-field.d.cts +2 -2
- package/dist/forms/password-field.d.ts +2 -2
- package/dist/forms/select-field.d.cts +2 -2
- package/dist/forms/select-field.d.ts +2 -2
- package/dist/forms/switch-field.d.cts +2 -2
- package/dist/forms/switch-field.d.ts +2 -2
- package/dist/forms/text-field.d.cts +2 -2
- package/dist/forms/text-field.d.ts +2 -2
- package/dist/forms/textarea-field.d.cts +2 -2
- package/dist/forms/textarea-field.d.ts +2 -2
- package/dist/{input-CjNcnHb_.d.ts → input-CUDclgoU.d.ts} +3 -3
- package/dist/{input-BsXm0_Iq.d.cts → input-y_n-XGys.d.cts} +3 -3
- package/dist/layouts/app-layout/index.d.cts +5 -5
- package/dist/layouts/app-layout/index.d.ts +3 -3
- package/dist/layouts/flex.d.cts +4 -4
- package/dist/layouts/flex.d.ts +4 -4
- package/dist/layouts/main/index.d.cts +4 -4
- package/dist/layouts/main/index.d.ts +4 -4
- package/dist/{multi-select-Cjvm4tK5.cjs → multi-select-3yxD9gbY.cjs} +2 -2
- package/dist/{multi-select-Cjvm4tK5.cjs.map → multi-select-3yxD9gbY.cjs.map} +1 -1
- package/dist/{multi-select-D0bZVOnm.js → multi-select-Cb07NlA7.js} +2 -2
- package/dist/{multi-select-D0bZVOnm.js.map → multi-select-Cb07NlA7.js.map} +1 -1
- package/dist/{popover-CTFp7ZXi.js → popover-CqAD7HNo.js} +1 -1
- package/dist/{popover-CTFp7ZXi.js.map → popover-CqAD7HNo.js.map} +1 -1
- package/dist/{popover-DCcPvdz2.cjs → popover-Dd0acCEk.cjs} +1 -1
- package/dist/{popover-DCcPvdz2.cjs.map → popover-Dd0acCEk.cjs.map} +1 -1
- package/dist/{separator-5FdzRGaJ.d.ts → separator-BLYi41aC.d.ts} +3 -3
- package/dist/{separator-DpxrpK_H.d.cts → separator-ClGBPiYE.d.cts} +3 -3
- package/dist/table/index.d.cts +2 -2
- package/dist/table/index.d.ts +2 -2
- package/dist/{toggle-Cx9H5u3p.d.cts → toggle-BWQWsKMA.d.ts} +4 -4
- package/dist/{toggle-DH9IssyE.d.ts → toggle-DnGvFJh8.d.cts} +4 -4
- package/dist/{tooltip-Djh_dcy5.d.ts → tooltip-Bk8VwHdM.d.ts} +6 -6
- package/dist/{tooltip-BAtWdJyX.d.cts → tooltip-cisSpCHG.d.cts} +6 -6
- 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 -12
- package/dist/ui/alert-dialog.d.ts +12 -12
- package/dist/ui/alert-dialog.js +1 -1
- package/dist/ui/alert.d.cts +6 -6
- package/dist/ui/alert.d.ts +6 -6
- package/dist/ui/aspect-ratio.d.cts +2 -2
- package/dist/ui/aspect-ratio.d.ts +2 -2
- package/dist/ui/avatar.d.cts +4 -4
- package/dist/ui/avatar.d.ts +4 -4
- package/dist/ui/badge.d.cts +2 -2
- package/dist/ui/badge.d.ts +4 -4
- package/dist/ui/breadcrumb.d.cts +8 -8
- package/dist/ui/breadcrumb.d.ts +8 -8
- package/dist/ui/button.d.cts +1 -1
- package/dist/ui/button.d.ts +1 -1
- package/dist/ui/calendar.cjs +1 -1
- package/dist/ui/calendar.d.cts +4 -4
- package/dist/ui/calendar.d.ts +4 -4
- 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.d.cts +7 -7
- package/dist/ui/carousel.d.ts +7 -7
- package/dist/ui/collapsible.d.cts +4 -4
- package/dist/ui/collapsible.d.ts +4 -4
- package/dist/ui/command.cjs +1 -1
- package/dist/ui/command.d.cts +2 -2
- package/dist/ui/command.d.ts +2 -2
- package/dist/ui/command.js +1 -1
- package/dist/ui/context-menu.d.cts +16 -16
- package/dist/ui/context-menu.d.ts +16 -16
- 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.d.cts +16 -16
- package/dist/ui/dropdown-menu.d.ts +16 -16
- package/dist/ui/file-uploader.d.cts +2 -2
- package/dist/ui/file-uploader.d.ts +2 -2
- package/dist/ui/form.d.cts +7 -7
- package/dist/ui/form.d.ts +7 -7
- package/dist/ui/hover-card.d.cts +4 -4
- package/dist/ui/hover-card.d.ts +4 -4
- package/dist/ui/input-otp.d.cts +5 -5
- package/dist/ui/input-otp.d.ts +5 -5
- package/dist/ui/input.d.cts +1 -1
- package/dist/ui/input.d.ts +1 -1
- package/dist/ui/inputs/search-input.d.cts +1 -1
- package/dist/ui/inputs/search-input.d.ts +3 -3
- package/dist/ui/label.d.cts +2 -2
- package/dist/ui/label.d.ts +2 -2
- package/dist/ui/menubar.d.cts +17 -17
- package/dist/ui/menubar.d.ts +17 -17
- package/dist/ui/multi-select.cjs +1 -1
- package/dist/ui/multi-select.d.cts +2 -2
- package/dist/ui/multi-select.d.ts +2 -2
- package/dist/ui/multi-select.js +1 -1
- package/dist/ui/navigation-menu.d.cts +11 -11
- package/dist/ui/navigation-menu.d.ts +9 -9
- package/dist/ui/pagination.d.cts +9 -9
- package/dist/ui/pagination.d.ts +9 -9
- package/dist/ui/popover.cjs +1 -1
- package/dist/ui/popover.d.cts +5 -5
- package/dist/ui/popover.d.ts +5 -5
- package/dist/ui/popover.js +1 -1
- package/dist/ui/progress.d.cts +2 -2
- package/dist/ui/progress.d.ts +2 -2
- package/dist/ui/radio-group.d.cts +3 -3
- package/dist/ui/radio-group.d.ts +3 -3
- package/dist/ui/resizable.d.cts +4 -4
- package/dist/ui/resizable.d.ts +4 -4
- 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.d.cts +30 -30
- package/dist/ui/sidebar.d.ts +30 -30
- package/dist/ui/skeleton.d.cts +2 -2
- package/dist/ui/skeleton.d.ts +2 -2
- package/dist/ui/slider.d.cts +2 -2
- package/dist/ui/slider.d.ts +2 -2
- package/dist/ui/sonner.d.cts +2 -2
- package/dist/ui/sonner.d.ts +2 -2
- package/dist/ui/switch.d.cts +2 -2
- package/dist/ui/switch.d.ts +2 -2
- package/dist/ui/table.d.cts +9 -9
- package/dist/ui/table.d.ts +9 -9
- package/dist/ui/tabs.d.cts +5 -5
- package/dist/ui/tabs.d.ts +5 -5
- package/dist/ui/textarea.d.cts +2 -2
- package/dist/ui/textarea.d.ts +2 -2
- package/dist/ui/toggle-group.d.cts +4 -4
- package/dist/ui/toggle-group.d.ts +4 -4
- package/dist/ui/toggle.d.cts +1 -1
- package/dist/ui/toggle.d.ts +1 -1
- package/dist/ui/tooltip.d.cts +1 -1
- package/dist/ui/tooltip.d.ts +1 -1
- package/package.json +6 -2
- package/styles/base.css +29 -0
- package/styles/loader.css +113 -0
- package/styles/theme.css +104 -0
- package/styles/typography.css +6 -0
- package/packages/components/cards/simple-card.tsx +0 -23
- package/packages/components/data-display/country.tsx +0 -53
- package/packages/components/data-display/data-list.tsx +0 -29
- package/packages/components/data-display/date-tooltip.tsx +0 -23
- package/packages/components/data-display/date.tsx +0 -157
- package/packages/components/data-display/empty.tsx +0 -13
- package/packages/components/data-display/name.tsx +0 -23
- package/packages/components/data-display/phone-number.tsx +0 -14
- package/packages/components/data-display/role-badge.tsx +0 -29
- package/packages/components/data-display/statistic.tsx +0 -139
- package/packages/components/dialogs/confirm-dialog.tsx +0 -44
- package/packages/components/dialogs/detail-dialog/component/header.tsx +0 -10
- package/packages/components/dialogs/detail-dialog/component/main.tsx +0 -35
- package/packages/components/dialogs/detail-dialog/component/sidebar.tsx +0 -618
- package/packages/components/dialogs/detail-dialog/component/wrapper.tsx +0 -15
- package/packages/components/dialogs/detail-dialog/index.tsx +0 -91
- package/packages/components/dialogs/error-dialog.tsx +0 -34
- package/packages/components/dialogs/form-dialog.tsx +0 -74
- package/packages/components/dialogs/loading-dialog.tsx +0 -20
- package/packages/components/forms/combobox-field.tsx +0 -104
- package/packages/components/forms/date-field.tsx +0 -62
- package/packages/components/forms/form-wrapper.tsx +0 -120
- package/packages/components/forms/multi-select-field.tsx +0 -56
- package/packages/components/forms/number-field.tsx +0 -54
- package/packages/components/forms/password-field.tsx +0 -38
- package/packages/components/forms/select-field.tsx +0 -58
- package/packages/components/forms/switch-field.tsx +0 -40
- package/packages/components/forms/text-field.tsx +0 -73
- package/packages/components/forms/textarea-field.tsx +0 -45
- package/packages/components/index.tsx +0 -0
- package/packages/components/layouts/app-layout/index.tsx +0 -74
- package/packages/components/layouts/app-layout/sidebar.tsx +0 -663
- package/packages/components/layouts/flex.tsx +0 -99
- package/packages/components/layouts/main/content.tsx +0 -11
- package/packages/components/layouts/main/header.tsx +0 -41
- package/packages/components/layouts/main/index.tsx +0 -3
- package/packages/components/layouts/main/wrapper.tsx +0 -5
- package/packages/components/table/data-table-pagination.tsx +0 -70
- package/packages/components/table/data-table.tsx +0 -241
- package/packages/components/table/index.tsx +0 -107
- package/packages/components/typography/paragraph.tsx +0 -29
- package/packages/components/typography/title.tsx +0 -31
- package/packages/components/ui/alert-dialog.tsx +0 -99
- package/packages/components/ui/alert.tsx +0 -44
- package/packages/components/ui/aspect-ratio.tsx +0 -11
- package/packages/components/ui/avatar.tsx +0 -25
- package/packages/components/ui/badge.tsx +0 -57
- package/packages/components/ui/breadcrumb.tsx +0 -74
- package/packages/components/ui/button.tsx +0 -205
- package/packages/components/ui/buttons/add-new.tsx +0 -19
- package/packages/components/ui/buttons/edit.tsx +0 -14
- package/packages/components/ui/buttons/refresh.tsx +0 -19
- package/packages/components/ui/buttons/trash.tsx +0 -14
- package/packages/components/ui/buttons/upload-image.tsx +0 -25
- package/packages/components/ui/calendar.tsx +0 -141
- package/packages/components/ui/card.tsx +0 -44
- package/packages/components/ui/carousel.tsx +0 -187
- package/packages/components/ui/checkbox.tsx +0 -34
- package/packages/components/ui/collapsible.tsx +0 -17
- package/packages/components/ui/command.tsx +0 -138
- package/packages/components/ui/context-menu.tsx +0 -196
- package/packages/components/ui/dialog.tsx +0 -119
- package/packages/components/ui/dropdown-menu.tsx +0 -249
- package/packages/components/ui/file-uploader.tsx +0 -314
- package/packages/components/ui/form.tsx +0 -104
- package/packages/components/ui/hover-card.tsx +0 -32
- package/packages/components/ui/input-otp.tsx +0 -67
- package/packages/components/ui/input.tsx +0 -59
- package/packages/components/ui/inputs/number-input.tsx +0 -317
- package/packages/components/ui/inputs/password-input.tsx +0 -29
- package/packages/components/ui/inputs/search-input.tsx +0 -24
- package/packages/components/ui/label.tsx +0 -26
- package/packages/components/ui/menubar.tsx +0 -212
- package/packages/components/ui/multi-select.tsx +0 -626
- package/packages/components/ui/navigation-menu.tsx +0 -124
- package/packages/components/ui/pagination.tsx +0 -70
- package/packages/components/ui/popover.tsx +0 -49
- package/packages/components/ui/progress.tsx +0 -19
- package/packages/components/ui/radio-group.tsx +0 -36
- package/packages/components/ui/resizable.tsx +0 -47
- package/packages/components/ui/scroll-area.tsx +0 -35
- package/packages/components/ui/select.tsx +0 -199
- package/packages/components/ui/separator.tsx +0 -25
- package/packages/components/ui/sheet.tsx +0 -119
- package/packages/components/ui/sidebar.tsx +0 -675
- package/packages/components/ui/skeleton.tsx +0 -8
- package/packages/components/ui/slider.tsx +0 -45
- package/packages/components/ui/sonner.tsx +0 -40
- package/packages/components/ui/switch.tsx +0 -46
- package/packages/components/ui/table.tsx +0 -66
- package/packages/components/ui/tabs.tsx +0 -53
- package/packages/components/ui/textarea.tsx +0 -46
- package/packages/components/ui/toggle-group.tsx +0 -63
- package/packages/components/ui/toggle.tsx +0 -34
- package/packages/components/ui/tooltip.tsx +0 -53
- package/packages/constants.tsx +0 -45
- package/packages/hooks/use-callback-ref.ts +0 -22
- package/packages/hooks/use-controllable-state.ts +0 -58
- package/packages/hooks/use-mobile.ts +0 -19
- package/packages/index.css +0 -133
- package/packages/lib/utils.ts +0 -24
- package/packages/stories/1.Guideline.mdx +0 -3
- package/packages/stories/2.Colors.mdx +0 -145
- package/packages/stories/3.Pypography.mdx +0 -51
- package/packages/stories/cards/simple-card.stories.tsx +0 -24
- package/packages/stories/data-display/data-list.stories.tsx +0 -22
- package/packages/stories/data-display/empty.stories.tsx +0 -13
- package/packages/stories/data-display/form-dialog.stories.tsx +0 -27
- package/packages/stories/data-display/name.stories.tsx +0 -25
- package/packages/stories/data-display/phone-number.stories.tsx +0 -17
- package/packages/stories/data-display/statistic.stories.tsx +0 -41
- package/packages/stories/dialogs/confirm-dialog.stories.tsx +0 -26
- package/packages/stories/dialogs/detail-dialog.stories.tsx +0 -34
- package/packages/stories/dialogs/error-dialog.stories.tsx +0 -27
- package/packages/stories/dialogs/loading-dialog.stories.tsx +0 -16
- package/packages/stories/forms/combobox-field.stories.tsx +0 -38
- package/packages/stories/forms/form-wrapper.stories.tsx +0 -59
- package/packages/stories/forms/multi-select-field.stories.tsx +0 -42
- package/packages/stories/forms/number-field.stories.tsx +0 -35
- package/packages/stories/forms/select-field.stories.tsx +0 -39
- package/packages/stories/forms/switch-field.stories.tsx +0 -36
- package/packages/stories/forms/text-field.stories.tsx +0 -41
- package/packages/stories/forms/textarea-field.stories.tsx +0 -34
- package/packages/stories/layouts/app-layout.stories.tsx +0 -49
- package/packages/stories/typography/paragraph.stories.tsx +0 -45
- package/packages/stories/typography/title.stories.tsx +0 -39
- package/packages/stories/ui/alert-dialog.stories.tsx +0 -49
- package/packages/stories/ui/alert.stories.tsx +0 -63
- package/packages/stories/ui/aspect-ratio.stories.tsx +0 -22
- package/packages/stories/ui/badge.stories.tsx +0 -170
- package/packages/stories/ui/breadcrumb.stories.tsx +0 -172
- package/packages/stories/ui/button.stories.tsx +0 -181
- package/packages/stories/ui/card.stories.tsx +0 -58
- package/packages/stories/ui/checkbox.stories.tsx +0 -48
- package/packages/stories/ui/command.stories.tsx +0 -58
- package/packages/stories/ui/dialog.stories.tsx +0 -55
- package/packages/stories/ui/dropdown-menu.stories.tsx +0 -89
- package/packages/stories/ui/file-uploader.stories.tsx +0 -18
- package/packages/stories/ui/input.stories.tsx +0 -38
- package/packages/stories/ui/label.stories.tsx +0 -17
- package/packages/stories/ui/multi-select.stories.tsx +0 -29
- package/packages/stories/ui/popover.stories.tsx +0 -52
- package/packages/stories/ui/progress.stories.tsx +0 -17
- package/packages/stories/ui/radio-group.stories.tsx +0 -31
- package/packages/stories/ui/select.stories.tsx +0 -31
- package/packages/stories/ui/separator.stories.tsx +0 -31
- package/packages/stories/ui/sheet.stories.tsx +0 -50
- package/packages/stories/ui/skeleton.stories.tsx +0 -27
- package/packages/stories/ui/switch.stories.tsx +0 -21
- package/packages/stories/ui/table.stories.tsx +0 -82
- package/packages/stories/ui/tabs.stories.tsx +0 -70
- package/packages/stories/ui/textarea.stories.tsx +0 -15
- package/packages/stories/ui/toaster.stories.tsx +0 -87
- package/packages/types.ts +0 -50
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import { cva, type VariantProps } from 'class-variance-authority'
|
|
4
|
-
|
|
5
|
-
import { cn } from '@/lib/utils'
|
|
6
|
-
|
|
7
|
-
const flexVariants = cva(['relative flex', 'text-sm'], {
|
|
8
|
-
variants: {
|
|
9
|
-
vertical: {
|
|
10
|
-
true: 'flex-col',
|
|
11
|
-
false: 'flex-row',
|
|
12
|
-
},
|
|
13
|
-
width: {
|
|
14
|
-
full: 'w-full',
|
|
15
|
-
auto: 'w-auto',
|
|
16
|
-
fit: 'w-fit',
|
|
17
|
-
screen: 'w-screen',
|
|
18
|
-
min: 'w-min',
|
|
19
|
-
max: 'w-max',
|
|
20
|
-
},
|
|
21
|
-
wrap: {
|
|
22
|
-
true: 'flex-wrap',
|
|
23
|
-
false: 'flex-nowrap',
|
|
24
|
-
},
|
|
25
|
-
margin: {
|
|
26
|
-
sm: 'm-2',
|
|
27
|
-
md: 'm-4',
|
|
28
|
-
lg: 'm-6',
|
|
29
|
-
xl: 'm-8',
|
|
30
|
-
none: 'm-0',
|
|
31
|
-
},
|
|
32
|
-
padding: {
|
|
33
|
-
sm: 'p-2',
|
|
34
|
-
md: 'p-4',
|
|
35
|
-
lg: 'p-6',
|
|
36
|
-
xl: 'p-8',
|
|
37
|
-
none: 'p-0',
|
|
38
|
-
},
|
|
39
|
-
gap: {
|
|
40
|
-
xs: 'gap-1',
|
|
41
|
-
sm: 'gap-2',
|
|
42
|
-
md: 'gap-4',
|
|
43
|
-
lg: 'gap-6',
|
|
44
|
-
xl: 'gap-8',
|
|
45
|
-
none: 'gap-0',
|
|
46
|
-
},
|
|
47
|
-
justify: {
|
|
48
|
-
start: 'justify-start',
|
|
49
|
-
center: 'justify-center',
|
|
50
|
-
end: 'justify-end',
|
|
51
|
-
between: 'justify-between',
|
|
52
|
-
around: 'justify-around',
|
|
53
|
-
evenly: 'justify-evenly',
|
|
54
|
-
stretch: 'justify-stretch',
|
|
55
|
-
},
|
|
56
|
-
align: {
|
|
57
|
-
start: 'items-start',
|
|
58
|
-
center: 'items-center',
|
|
59
|
-
end: 'items-end',
|
|
60
|
-
baseline: 'items-baseline',
|
|
61
|
-
stretch: 'items-stretch',
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
defaultVariants: {
|
|
65
|
-
vertical: false,
|
|
66
|
-
wrap: true,
|
|
67
|
-
width: 'fit',
|
|
68
|
-
margin: 'none',
|
|
69
|
-
padding: 'sm',
|
|
70
|
-
gap: 'xs',
|
|
71
|
-
justify: 'start',
|
|
72
|
-
align: 'center',
|
|
73
|
-
},
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
type Props = {
|
|
77
|
-
className?: string
|
|
78
|
-
} & VariantProps<typeof flexVariants>
|
|
79
|
-
export const Flex = ({ vertical, wrap, width, margin, padding, gap, justify, align, className, children }: React.PropsWithChildren<Props>) => {
|
|
80
|
-
return (
|
|
81
|
-
<div
|
|
82
|
-
className={cn(
|
|
83
|
-
flexVariants({
|
|
84
|
-
vertical,
|
|
85
|
-
width,
|
|
86
|
-
wrap,
|
|
87
|
-
margin,
|
|
88
|
-
padding,
|
|
89
|
-
gap,
|
|
90
|
-
justify,
|
|
91
|
-
align,
|
|
92
|
-
className,
|
|
93
|
-
}),
|
|
94
|
-
)}
|
|
95
|
-
>
|
|
96
|
-
{children}
|
|
97
|
-
</div>
|
|
98
|
-
)
|
|
99
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { SidebarInset } from '@/components/ui/sidebar'
|
|
2
|
-
|
|
3
|
-
export const MainLayoutContent = ({ children }: React.PropsWithChildren) => {
|
|
4
|
-
return (
|
|
5
|
-
<SidebarInset>
|
|
6
|
-
<section className="relative size-full">
|
|
7
|
-
<div className="absolute inset-0">{children}</div>
|
|
8
|
-
</section>
|
|
9
|
-
</SidebarInset>
|
|
10
|
-
)
|
|
11
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { BellIcon, CircleQuestionMarkIcon, ShoppingCartIcon } from 'lucide-react'
|
|
2
|
-
|
|
3
|
-
import { Button } from '@/components/ui/button'
|
|
4
|
-
import { SidebarTrigger } from '@/components/ui/sidebar'
|
|
5
|
-
import { cn } from '@/lib/utils'
|
|
6
|
-
|
|
7
|
-
export const MainLayoutHeader = () => {
|
|
8
|
-
return (
|
|
9
|
-
<header
|
|
10
|
-
className={cn(
|
|
11
|
-
'bg-card',
|
|
12
|
-
'h-(--header-height)',
|
|
13
|
-
'absolute inset-x-0 top-0 z-20',
|
|
14
|
-
'flex items-center gap-2 border-b shadow-sm',
|
|
15
|
-
'transition-[width,height] ease-linear',
|
|
16
|
-
'group-has-data-[collapsible=icon]/sidebar-wrapper:h-(--header-height)',
|
|
17
|
-
'px-4',
|
|
18
|
-
)}
|
|
19
|
-
>
|
|
20
|
-
<SidebarTrigger />
|
|
21
|
-
|
|
22
|
-
<div className="ml-2.5 flex gap-x-2">
|
|
23
|
-
<div className="bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg">
|
|
24
|
-
<ShoppingCartIcon size={20} />
|
|
25
|
-
</div>
|
|
26
|
-
<div className="grid flex-1 text-left text-sm leading-tight">
|
|
27
|
-
<span className="truncate font-medium">Lunas Store</span>
|
|
28
|
-
<span className="truncate text-xs">Established 2023</span>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
<div className="flex flex-1 items-center justify-end">
|
|
32
|
-
<Button variant="ghost" size="icon" className="text-muted-foreground rounded-full">
|
|
33
|
-
<CircleQuestionMarkIcon />
|
|
34
|
-
</Button>
|
|
35
|
-
<Button variant="ghost" size="icon" className="text-muted-foreground rounded-full">
|
|
36
|
-
<BellIcon />
|
|
37
|
-
</Button>
|
|
38
|
-
</div>
|
|
39
|
-
</header>
|
|
40
|
-
)
|
|
41
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { type Table } from '@tanstack/react-table'
|
|
2
|
-
import { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight } from 'lucide-react'
|
|
3
|
-
|
|
4
|
-
import { Button } from '@/components/ui/button'
|
|
5
|
-
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
|
|
6
|
-
|
|
7
|
-
interface DataTablePaginationProps<TData> {
|
|
8
|
-
table: Table<TData>
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function DataTablePagination<TData>({ table }: DataTablePaginationProps<TData>) {
|
|
12
|
-
'use no memo'
|
|
13
|
-
return (
|
|
14
|
-
<div className="mt-4 flex w-full flex-0 flex-wrap items-center justify-between gap-y-4 px-2">
|
|
15
|
-
<div className="text-muted-foreground flex-1 text-sm">
|
|
16
|
-
{table.getFilteredSelectedRowModel().rows.length} of {table.getFilteredRowModel().rows.length} row(s) selected.
|
|
17
|
-
</div>
|
|
18
|
-
<div className="flex flex-wrap items-center space-x-6 gap-y-4 lg:space-x-8">
|
|
19
|
-
<div className="flex items-center space-x-2">
|
|
20
|
-
<p className="text-sm font-medium">Rows per page</p>
|
|
21
|
-
<Select
|
|
22
|
-
value={`${table.getState().pagination.pageSize}`}
|
|
23
|
-
onValueChange={(value) => {
|
|
24
|
-
table.setPageSize(Number(value))
|
|
25
|
-
}}
|
|
26
|
-
>
|
|
27
|
-
<SelectTrigger className="h-8 w-[70px]">
|
|
28
|
-
<SelectValue placeholder={table.getState().pagination.pageSize} />
|
|
29
|
-
</SelectTrigger>
|
|
30
|
-
<SelectContent side="top">
|
|
31
|
-
{[10, 20, 30, 40, 50].map((pageSize) => (
|
|
32
|
-
<SelectItem key={pageSize} value={`${pageSize}`}>
|
|
33
|
-
{pageSize}
|
|
34
|
-
</SelectItem>
|
|
35
|
-
))}
|
|
36
|
-
</SelectContent>
|
|
37
|
-
</Select>
|
|
38
|
-
</div>
|
|
39
|
-
<div className="flex w-25 items-center justify-center text-sm font-medium">
|
|
40
|
-
Page {table.getState().pagination.pageIndex + 1} of {table.getPageCount()}
|
|
41
|
-
</div>
|
|
42
|
-
<div className="flex items-center space-x-2 *:size-9 *:p-0">
|
|
43
|
-
<Button variant="outline" className="lg:flex" onClick={() => table.setPageIndex(0)} disabled={!table.getCanPreviousPage()}>
|
|
44
|
-
<span className="sr-only">Go to first page</span>
|
|
45
|
-
<ChevronsLeft />
|
|
46
|
-
</Button>
|
|
47
|
-
<Button variant="outline" onClick={() => table.previousPage()} disabled={!table.getCanPreviousPage()}>
|
|
48
|
-
<span className="sr-only">Go to previous page</span>
|
|
49
|
-
<ChevronLeft />
|
|
50
|
-
</Button>
|
|
51
|
-
<Button type="button" variant="outline" onClick={() => table.nextPage()} disabled={!table.getCanNextPage()}>
|
|
52
|
-
<span className="sr-only">Go to next page</span>
|
|
53
|
-
<ChevronRight />
|
|
54
|
-
</Button>
|
|
55
|
-
<Button
|
|
56
|
-
variant="outline"
|
|
57
|
-
className="lg:flex"
|
|
58
|
-
onClick={() => {
|
|
59
|
-
table.setPageIndex(table.getPageCount() - 1)
|
|
60
|
-
}}
|
|
61
|
-
disabled={!table.getCanNextPage()}
|
|
62
|
-
>
|
|
63
|
-
<span className="sr-only">Go to last page</span>
|
|
64
|
-
<ChevronsRight />
|
|
65
|
-
</Button>
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import React, { type CSSProperties } from 'react'
|
|
2
|
-
import { type Column, flexRender, type Header, type Table as ReactTable } from '@tanstack/react-table'
|
|
3
|
-
import { ArrowLeftToLineIcon, ArrowRightToLineIcon, ChevronDown, ChevronUp, EllipsisIcon, PackagePlusIcon, PinOffIcon } from 'lucide-react'
|
|
4
|
-
|
|
5
|
-
import { cn } from '@/lib/utils'
|
|
6
|
-
import type { AnyEntity } from '@/types'
|
|
7
|
-
|
|
8
|
-
import { Button } from '../ui/button'
|
|
9
|
-
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '../ui/dropdown-menu'
|
|
10
|
-
import { ScrollArea, ScrollBar } from '../ui/scroll-area'
|
|
11
|
-
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../ui/table'
|
|
12
|
-
|
|
13
|
-
// Helper function to compute pinning styles for columns
|
|
14
|
-
const getPinningStyles = (column: Column<AnyEntity>): CSSProperties => {
|
|
15
|
-
const isPinned = column.getIsPinned()
|
|
16
|
-
return {
|
|
17
|
-
left: isPinned === 'left' ? `${column.getStart('left')}px` : undefined,
|
|
18
|
-
right: isPinned === 'right' ? `${column.getAfter('right')}px` : undefined,
|
|
19
|
-
position: isPinned ? 'sticky' : 'relative',
|
|
20
|
-
width: column.getSize(),
|
|
21
|
-
zIndex: isPinned ? 1 : 0,
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const SortingIndicator = ({ column }: { column: Column<AnyEntity> }) => {
|
|
26
|
-
const sortDirection = column.getIsSorted()
|
|
27
|
-
|
|
28
|
-
const icons = {
|
|
29
|
-
asc: <ChevronUp className="shrink-0 opacity-60" size={16} strokeWidth={2} aria-hidden="true" />,
|
|
30
|
-
desc: <ChevronDown className="shrink-0 opacity-60" size={16} strokeWidth={2} aria-hidden="true" />,
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return sortDirection ? icons[sortDirection] : null
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const PinControls = ({ column }: { column: Column<AnyEntity> }) => {
|
|
37
|
-
const columnHeader = column.columnDef.header as string
|
|
38
|
-
|
|
39
|
-
if (!column.getCanPin()) return null
|
|
40
|
-
|
|
41
|
-
if (column.getIsPinned()) {
|
|
42
|
-
return (
|
|
43
|
-
<Button
|
|
44
|
-
size="icon"
|
|
45
|
-
variant="ghost"
|
|
46
|
-
className="hover:[&_svg]:text-secondary-foreground -mr-1 size-7 shadow-none"
|
|
47
|
-
aria-label={`Unpin ${columnHeader} column`}
|
|
48
|
-
title={`Unpin ${columnHeader} column`}
|
|
49
|
-
onClick={() => column.pin(false)}
|
|
50
|
-
>
|
|
51
|
-
<PinOffIcon className="opacity-60" size={16} aria-hidden="true" />
|
|
52
|
-
</Button>
|
|
53
|
-
)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<DropdownMenu>
|
|
58
|
-
<DropdownMenuTrigger asChild>
|
|
59
|
-
<Button
|
|
60
|
-
size="icon"
|
|
61
|
-
variant="ghost"
|
|
62
|
-
className="-mr-1 size-7 shadow-none"
|
|
63
|
-
aria-label={`Pin options for ${columnHeader} column`}
|
|
64
|
-
title={`Pin options for ${columnHeader} column`}
|
|
65
|
-
>
|
|
66
|
-
<EllipsisIcon className="opacity-60" size={16} aria-hidden="true" />
|
|
67
|
-
</Button>
|
|
68
|
-
</DropdownMenuTrigger>
|
|
69
|
-
<DropdownMenuContent align="end">
|
|
70
|
-
<DropdownMenuItem onClick={() => column.pin('left')}>
|
|
71
|
-
<ArrowLeftToLineIcon size={16} className="opacity-60" aria-hidden="true" />
|
|
72
|
-
Stick to left
|
|
73
|
-
</DropdownMenuItem>
|
|
74
|
-
<DropdownMenuItem onClick={() => column.pin('right')}>
|
|
75
|
-
<ArrowRightToLineIcon size={16} className="opacity-60" aria-hidden="true" />
|
|
76
|
-
Stick to right
|
|
77
|
-
</DropdownMenuItem>
|
|
78
|
-
</DropdownMenuContent>
|
|
79
|
-
</DropdownMenu>
|
|
80
|
-
)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const HeaderContent = ({ header }: { header: Header<AnyEntity, unknown> }) => {
|
|
84
|
-
const { column } = header
|
|
85
|
-
|
|
86
|
-
const handleSort = (e: React.KeyboardEvent) => {
|
|
87
|
-
if (column.getCanSort() && (e.key === 'Enter' || e.key === ' ')) {
|
|
88
|
-
e.preventDefault()
|
|
89
|
-
column.getToggleSortingHandler()?.(e)
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return (
|
|
94
|
-
<div className="flex items-center justify-between gap-2 truncate">
|
|
95
|
-
{!header.isPlaceholder && (
|
|
96
|
-
<div
|
|
97
|
-
className={cn(column.getCanSort() && 'flex h-full cursor-pointer items-center justify-between gap-2 select-none')}
|
|
98
|
-
onClick={column.getToggleSortingHandler()}
|
|
99
|
-
onKeyDown={handleSort}
|
|
100
|
-
tabIndex={column.getCanSort() ? 0 : undefined}
|
|
101
|
-
>
|
|
102
|
-
<span className="truncate">{flexRender(column.columnDef.header, header.getContext())}</span>
|
|
103
|
-
<SortingIndicator column={column} />
|
|
104
|
-
</div>
|
|
105
|
-
)}
|
|
106
|
-
{!header.isPlaceholder && <PinControls column={column} />}
|
|
107
|
-
</div>
|
|
108
|
-
)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
interface DataTableProps {
|
|
112
|
-
table: ReactTable<AnyEntity>
|
|
113
|
-
columnsLength?: number
|
|
114
|
-
isLoading?: boolean
|
|
115
|
-
onClickRow?: (id: string) => void
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export const DataTable = ({ table, isLoading, onClickRow }: DataTableProps) => {
|
|
119
|
-
'use no memo'
|
|
120
|
-
return (
|
|
121
|
-
<ScrollArea className="border-border bg-background relative w-full overflow-auto rounded-lg border">
|
|
122
|
-
<Table
|
|
123
|
-
className={cn(
|
|
124
|
-
'!w-full',
|
|
125
|
-
'[&_td]:border-border',
|
|
126
|
-
'[&_th]:border-border',
|
|
127
|
-
'table-fixed border-separate border-spacing-0',
|
|
128
|
-
'[&_tfoot_td]:border-t',
|
|
129
|
-
'[&_th]:border-b',
|
|
130
|
-
'[&_tr]:border-none',
|
|
131
|
-
'[&_tr:not(:last-child)_td]:border-b',
|
|
132
|
-
)}
|
|
133
|
-
style={{
|
|
134
|
-
width: table.getTotalSize(),
|
|
135
|
-
}}
|
|
136
|
-
>
|
|
137
|
-
<TableHeader className="bg-muted/50 sticky top-0 z-10 backdrop-blur-xs">
|
|
138
|
-
{table.getHeaderGroups().map((headerGroup) => (
|
|
139
|
-
<TableRow key={headerGroup.id} className="bg-muted/50">
|
|
140
|
-
{headerGroup.headers.map((header) => {
|
|
141
|
-
const { column } = header
|
|
142
|
-
const isPinned = column.getIsPinned()
|
|
143
|
-
const isLastLeftPinned = isPinned === 'left' && column.getIsLastColumn('left')
|
|
144
|
-
const isFirstRightPinned = isPinned === 'right' && column.getIsFirstColumn('right')
|
|
145
|
-
return (
|
|
146
|
-
<TableHead
|
|
147
|
-
key={header.id}
|
|
148
|
-
data-pinned={isPinned || undefined}
|
|
149
|
-
data-last-col={isLastLeftPinned ? 'left' : isFirstRightPinned ? 'right' : undefined}
|
|
150
|
-
className={cn(
|
|
151
|
-
'text-accent-foreground/60 relative h-9 border-r font-semibold select-none',
|
|
152
|
-
'data-pinned:backdrop-blur-xs',
|
|
153
|
-
'data-pinned:bg-muted/90',
|
|
154
|
-
'[&>.cursor-col-resize]:last:opacity-0',
|
|
155
|
-
'[&[data-pinned][data-last-col]]:border-border',
|
|
156
|
-
'[&:not([data-pinned]):has(+[data-pinned])_div.cursor-col-resize:last-child]:opacity-0',
|
|
157
|
-
'[&[data-last-col=left]_div.cursor-col-resize:last-child]:opacity-0',
|
|
158
|
-
'[&[data-pinned=left][data-last-col=left]]:border-r',
|
|
159
|
-
'[&[data-pinned=right]:last-child_div.cursor-col-resize:last-child]:opacity-0',
|
|
160
|
-
'[&[data-pinned=right][data-last-col=right]]:border-l',
|
|
161
|
-
)}
|
|
162
|
-
{...{
|
|
163
|
-
colSpan: header.colSpan,
|
|
164
|
-
style: {
|
|
165
|
-
width: header.getSize(),
|
|
166
|
-
maxWidth: header.getSize(),
|
|
167
|
-
...getPinningStyles(header.column),
|
|
168
|
-
},
|
|
169
|
-
}}
|
|
170
|
-
>
|
|
171
|
-
<HeaderContent header={header} />
|
|
172
|
-
</TableHead>
|
|
173
|
-
)
|
|
174
|
-
})}
|
|
175
|
-
</TableRow>
|
|
176
|
-
))}
|
|
177
|
-
</TableHeader>
|
|
178
|
-
|
|
179
|
-
<TableBody className={cn(isLoading && 'h-36', table.getRowModel().rows?.length === 0 && 'h-48')}>
|
|
180
|
-
{isLoading ? (
|
|
181
|
-
<TableRow className="absolute top-9 flex h-36 w-full items-center justify-center">
|
|
182
|
-
<TableCell>loading...</TableCell>
|
|
183
|
-
</TableRow>
|
|
184
|
-
) : (
|
|
185
|
-
<React.Fragment>
|
|
186
|
-
{table.getRowModel().rows?.length ? (
|
|
187
|
-
table.getRowModel().rows.map((row) => (
|
|
188
|
-
<TableRow
|
|
189
|
-
key={row.id}
|
|
190
|
-
data-state={row.getIsSelected() && 'selected'}
|
|
191
|
-
className="cursor-pointer border-none focus:outline-none"
|
|
192
|
-
onClick={() => onClickRow?.(row?.id || row.original?.id?.toString() || row.original?.uuid || undefined)}
|
|
193
|
-
>
|
|
194
|
-
{row.getVisibleCells().map((cell) => {
|
|
195
|
-
const { column } = cell
|
|
196
|
-
const isPinned = column.getIsPinned()
|
|
197
|
-
const isLastLeftPinned = isPinned === 'left' && column.getIsLastColumn('left')
|
|
198
|
-
const isFirstRightPinned = isPinned === 'right' && column.getIsFirstColumn('right')
|
|
199
|
-
return (
|
|
200
|
-
<TableCell
|
|
201
|
-
key={cell.id}
|
|
202
|
-
style={{
|
|
203
|
-
...getPinningStyles(column),
|
|
204
|
-
width: cell.column.getSize(),
|
|
205
|
-
maxWidth: cell.column.getSize(),
|
|
206
|
-
}}
|
|
207
|
-
data-pinned={isPinned || undefined}
|
|
208
|
-
data-last-col={isLastLeftPinned ? 'left' : isFirstRightPinned ? 'right' : undefined}
|
|
209
|
-
className={cn(
|
|
210
|
-
'overflow-hidden py-2.5',
|
|
211
|
-
'[&[data-pinned][data-last-col]]:border-border',
|
|
212
|
-
'[&[data-pinned=left][data-last-col=left]]:border-r',
|
|
213
|
-
'[&[data-pinned=right][data-last-col=right]]:border-l',
|
|
214
|
-
'data-pinned:bg-background/90',
|
|
215
|
-
)}
|
|
216
|
-
>
|
|
217
|
-
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
|
218
|
-
</TableCell>
|
|
219
|
-
)
|
|
220
|
-
})}
|
|
221
|
-
</TableRow>
|
|
222
|
-
))
|
|
223
|
-
) : (
|
|
224
|
-
<TableRow className="absolute top-9 flex h-36 w-full items-center justify-center">
|
|
225
|
-
<TableCell>
|
|
226
|
-
<div className="text-muted-foreground flex size-full flex-col items-center justify-center gap-y-8 text-base">
|
|
227
|
-
<PackagePlusIcon size={48} strokeWidth={2} />
|
|
228
|
-
<p>Thêm dữ liệu để hiển thị</p>
|
|
229
|
-
</div>
|
|
230
|
-
</TableCell>
|
|
231
|
-
</TableRow>
|
|
232
|
-
)}
|
|
233
|
-
</React.Fragment>
|
|
234
|
-
)}
|
|
235
|
-
</TableBody>
|
|
236
|
-
</Table>
|
|
237
|
-
<ScrollBar orientation="vertical" className="z-10 w-2" />
|
|
238
|
-
<ScrollBar orientation="horizontal" className="absolute right-0 bottom-0 left-0 h-2" />
|
|
239
|
-
</ScrollArea>
|
|
240
|
-
)
|
|
241
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
type ColumnDef,
|
|
4
|
-
type ColumnFiltersState,
|
|
5
|
-
getCoreRowModel,
|
|
6
|
-
getFacetedRowModel,
|
|
7
|
-
getFacetedUniqueValues,
|
|
8
|
-
getFilteredRowModel,
|
|
9
|
-
getPaginationRowModel,
|
|
10
|
-
getSortedRowModel,
|
|
11
|
-
type PaginationState,
|
|
12
|
-
type RowSelectionState,
|
|
13
|
-
type SortingState,
|
|
14
|
-
useReactTable,
|
|
15
|
-
type VisibilityState,
|
|
16
|
-
} from '@tanstack/react-table'
|
|
17
|
-
|
|
18
|
-
import { DataTable } from './data-table'
|
|
19
|
-
import { DataTablePagination } from './data-table-pagination'
|
|
20
|
-
import { Flex } from '../layouts/flex'
|
|
21
|
-
import { AddNewBtn } from '../ui/buttons/add-new'
|
|
22
|
-
import { RefreshBtn } from '../ui/buttons/refresh'
|
|
23
|
-
import { SearchInput } from '../ui/inputs/search-input'
|
|
24
|
-
|
|
25
|
-
type Props<T> = {
|
|
26
|
-
data: T[]
|
|
27
|
-
totalCount?: number
|
|
28
|
-
isLoading?: boolean
|
|
29
|
-
columns: ColumnDef<T>[]
|
|
30
|
-
pagination?: PaginationState
|
|
31
|
-
onAdd?: () => void
|
|
32
|
-
onRefresh?: () => void
|
|
33
|
-
onClickRow?: (id: string) => void
|
|
34
|
-
onPaginationChange?: React.Dispatch<React.SetStateAction<PaginationState>>
|
|
35
|
-
}
|
|
36
|
-
export function Table<T extends Record<string, unknown>>({
|
|
37
|
-
data,
|
|
38
|
-
totalCount,
|
|
39
|
-
isLoading,
|
|
40
|
-
columns,
|
|
41
|
-
pagination,
|
|
42
|
-
onAdd,
|
|
43
|
-
onRefresh,
|
|
44
|
-
onClickRow,
|
|
45
|
-
onPaginationChange,
|
|
46
|
-
}: Props<T>) {
|
|
47
|
-
'use no memo'
|
|
48
|
-
|
|
49
|
-
const [rowSelection, setRowSelection] = React.useState<RowSelectionState>({})
|
|
50
|
-
const [sorting, setSorting] = React.useState<SortingState>([])
|
|
51
|
-
const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>([])
|
|
52
|
-
const [columnVisibility, setColumnVisibility] = React.useState<VisibilityState>({})
|
|
53
|
-
|
|
54
|
-
const initialState = React.useMemo(
|
|
55
|
-
() => ({
|
|
56
|
-
columnPinning: { right: ['actions', 'update', 'delete'] },
|
|
57
|
-
pagination: { pageIndex: 0, pageSize: 20 },
|
|
58
|
-
}),
|
|
59
|
-
[],
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
const table = useReactTable<T>({
|
|
63
|
-
initialState,
|
|
64
|
-
data,
|
|
65
|
-
columns,
|
|
66
|
-
rowCount: totalCount,
|
|
67
|
-
columnResizeMode: 'onChange',
|
|
68
|
-
manualPagination: true,
|
|
69
|
-
enableColumnResizing: false,
|
|
70
|
-
enableMultiRowSelection: false,
|
|
71
|
-
getCoreRowModel: getCoreRowModel(),
|
|
72
|
-
getPaginationRowModel: getPaginationRowModel(),
|
|
73
|
-
getSortedRowModel: getSortedRowModel(),
|
|
74
|
-
getFilteredRowModel: getFilteredRowModel(),
|
|
75
|
-
getFacetedRowModel: getFacetedRowModel(),
|
|
76
|
-
getFacetedUniqueValues: getFacetedUniqueValues(),
|
|
77
|
-
getRowId: (row) => (row.id as string) || (row.uuid as string),
|
|
78
|
-
state: {
|
|
79
|
-
rowSelection,
|
|
80
|
-
sorting,
|
|
81
|
-
columnVisibility,
|
|
82
|
-
columnFilters,
|
|
83
|
-
...(pagination ? { pagination } : {}),
|
|
84
|
-
},
|
|
85
|
-
onRowSelectionChange: setRowSelection,
|
|
86
|
-
onSortingChange: setSorting,
|
|
87
|
-
onColumnVisibilityChange: setColumnVisibility,
|
|
88
|
-
onColumnFiltersChange: setColumnFilters,
|
|
89
|
-
...(onPaginationChange ? { onPaginationChange } : {}),
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
return (
|
|
93
|
-
<Flex vertical wrap={false} gap="sm" align="start" className="size-full overflow-y-auto pt-1">
|
|
94
|
-
<Flex justify="between" padding="none" width="full" className="flex-0">
|
|
95
|
-
<SearchInput placeholder="Search..." />
|
|
96
|
-
<Flex className="px-0">
|
|
97
|
-
{onAdd && <AddNewBtn onClick={onAdd} />}
|
|
98
|
-
<RefreshBtn onClick={onRefresh} />
|
|
99
|
-
</Flex>
|
|
100
|
-
</Flex>
|
|
101
|
-
<Flex padding="none" vertical wrap={false} width="full" className="flex-1 overflow-auto">
|
|
102
|
-
<DataTable table={table} isLoading={isLoading} onClickRow={onClickRow} />
|
|
103
|
-
<DataTablePagination<T> table={table} />
|
|
104
|
-
</Flex>
|
|
105
|
-
</Flex>
|
|
106
|
-
)
|
|
107
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import { cva } from 'class-variance-authority'
|
|
3
|
-
|
|
4
|
-
import { cn } from '@/lib/utils'
|
|
5
|
-
|
|
6
|
-
type Props = {
|
|
7
|
-
variant?: 'p' | 'muted' | 'lead' | 'sm' | 'lg'
|
|
8
|
-
className?: string
|
|
9
|
-
children?: React.ReactNode
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const paragraphVariants = cva('', {
|
|
13
|
-
variants: {
|
|
14
|
-
variant: {
|
|
15
|
-
p: 'leading-7 [&:not(:first-child)]:mt-6',
|
|
16
|
-
sm: 'text-sm leading-none font-normal',
|
|
17
|
-
lg: 'text-lg font-semibold',
|
|
18
|
-
lead: 'text-text-positive-strong text-xl',
|
|
19
|
-
muted: 'text-text-positive-muted text-sm',
|
|
20
|
-
},
|
|
21
|
-
default: {
|
|
22
|
-
variant: 'sm',
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
export const Paragraph = ({ variant = 'p', className, children }: Props) => {
|
|
28
|
-
return <p className={cn('text-text-positive', paragraphVariants({ variant }), className)}>{children}</p>
|
|
29
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { JSX } from 'react'
|
|
2
|
-
import { cva } from 'class-variance-authority'
|
|
3
|
-
|
|
4
|
-
import { cn } from '@/lib/utils'
|
|
5
|
-
|
|
6
|
-
const titleVariants = cva('scroll-m-20 text-text-positive-strong tracking-tight', {
|
|
7
|
-
variants: {
|
|
8
|
-
level: {
|
|
9
|
-
1: 'text-center text-4xl font-extrabold text-balance',
|
|
10
|
-
2: 'border-b pb-2 text-3xl font-semibold first:mt-0',
|
|
11
|
-
3: 'text-2xl font-semibold',
|
|
12
|
-
4: 'text-xl font-semibold',
|
|
13
|
-
5: 'text-lg font-semibold',
|
|
14
|
-
6: 'text-base font-semibold',
|
|
15
|
-
},
|
|
16
|
-
default: {
|
|
17
|
-
level: 1,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
type Props = {
|
|
23
|
-
level?: 1 | 2 | 3 | 4 | 5 | 6
|
|
24
|
-
className?: string
|
|
25
|
-
children?: React.ReactNode
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const Title = ({ level = 1, className, children }: Props) => {
|
|
29
|
-
const Comp = `h${level}` as keyof JSX.IntrinsicElements
|
|
30
|
-
return <Comp className={cn(titleVariants({ level }), className)}>{children}</Comp>
|
|
31
|
-
}
|