ikoncomponents 1.5.8 → 1.5.10
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/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +15 -0
- package/dist/ikoncomponents/action-menu/index.d.ts +5 -0
- package/dist/ikoncomponents/action-menu/index.js +42 -0
- package/dist/ikoncomponents/action-menu/type.d.ts +14 -0
- package/dist/ikoncomponents/action-menu/type.js +1 -0
- package/dist/ikoncomponents/activity-sheet/index.d.ts +11 -0
- package/dist/ikoncomponents/activity-sheet/index.js +23 -0
- package/dist/ikoncomponents/alert-dialog/dialog-context.d.ts +21 -0
- package/dist/ikoncomponents/alert-dialog/dialog-context.js +30 -0
- package/dist/ikoncomponents/alert-dialog/index.d.ts +14 -0
- package/dist/ikoncomponents/alert-dialog/index.js +20 -0
- package/dist/ikoncomponents/app-breadcrumb/BreadcrumbProvider.d.ts +18 -0
- package/dist/ikoncomponents/app-breadcrumb/BreadcrumbProvider.js +43 -0
- package/dist/ikoncomponents/app-breadcrumb/index.d.ts +5 -0
- package/dist/ikoncomponents/app-breadcrumb/index.js +57 -0
- package/dist/ikoncomponents/big-calendar/big-calender-event/index.d.ts +5 -0
- package/dist/ikoncomponents/big-calendar/big-calender-event/index.js +16 -0
- package/dist/ikoncomponents/big-calendar/big-calender-toolbar/index.d.ts +2 -0
- package/dist/ikoncomponents/big-calendar/big-calender-toolbar/index.js +39 -0
- package/dist/ikoncomponents/big-calendar/index.d.ts +3 -0
- package/dist/ikoncomponents/big-calendar/index.js +35 -0
- package/dist/ikoncomponents/big-calendar/type.d.ts +31 -0
- package/dist/ikoncomponents/big-calendar/type.js +1 -0
- package/dist/ikoncomponents/buttons/index.d.ts +18 -0
- package/dist/ikoncomponents/buttons/index.js +38 -0
- package/dist/ikoncomponents/combobox-input/index.d.ts +2 -0
- package/dist/ikoncomponents/combobox-input/index.js +18 -0
- package/dist/ikoncomponents/combobox-input/type.d.ts +13 -0
- package/dist/ikoncomponents/combobox-input/type.js +1 -0
- package/dist/ikoncomponents/custom-combo-dropdown/index.d.ts +21 -0
- package/dist/ikoncomponents/custom-combo-dropdown/index.js +85 -0
- package/dist/ikoncomponents/data-table/datatable-column-filter/index.d.ts +2 -0
- package/dist/ikoncomponents/data-table/datatable-column-filter/index.js +22 -0
- package/dist/ikoncomponents/data-table/datatable-faceted-filter/index.d.ts +2 -0
- package/dist/ikoncomponents/data-table/datatable-faceted-filter/index.js +35 -0
- package/dist/ikoncomponents/data-table/datatable-filter-menu/index.d.ts +2 -0
- package/dist/ikoncomponents/data-table/datatable-filter-menu/index.js +38 -0
- package/dist/ikoncomponents/data-table/datatable-pagination/index.d.ts +2 -0
- package/dist/ikoncomponents/data-table/datatable-pagination/index.js +13 -0
- package/dist/ikoncomponents/data-table/datatable-toolbar/index.d.ts +2 -0
- package/dist/ikoncomponents/data-table/datatable-toolbar/index.js +18 -0
- package/dist/ikoncomponents/data-table/function.d.ts +1 -0
- package/dist/ikoncomponents/data-table/function.js +6 -0
- package/dist/ikoncomponents/data-table/index.d.ts +2 -0
- package/dist/ikoncomponents/data-table/index.js +223 -0
- package/dist/ikoncomponents/data-table/type.d.ts +60 -0
- package/dist/ikoncomponents/data-table/type.js +1 -0
- package/dist/ikoncomponents/e-chart/index.d.ts +15 -0
- package/dist/ikoncomponents/e-chart/index.js +115 -0
- package/dist/ikoncomponents/file-input/index.d.ts +1 -0
- package/dist/ikoncomponents/file-input/index.js +21 -0
- package/dist/ikoncomponents/fileUpload/index.d.ts +15 -0
- package/dist/ikoncomponents/fileUpload/index.js +69 -0
- package/dist/ikoncomponents/form-fields/combobox-input/index.d.ts +2 -0
- package/dist/ikoncomponents/form-fields/combobox-input/index.js +21 -0
- package/dist/ikoncomponents/form-fields/combobox-input-value/index.d.ts +18 -0
- package/dist/ikoncomponents/form-fields/combobox-input-value/index.js +26 -0
- package/dist/ikoncomponents/form-fields/date-input/index.d.ts +2 -0
- package/dist/ikoncomponents/form-fields/date-input/index.js +15 -0
- package/dist/ikoncomponents/form-fields/file-input/index.d.ts +1 -0
- package/dist/ikoncomponents/form-fields/file-input/index.js +4 -0
- package/dist/ikoncomponents/form-fields/input/index.d.ts +2 -0
- package/dist/ikoncomponents/form-fields/input/index.js +18 -0
- package/dist/ikoncomponents/form-fields/multi-combobox-input/index.d.ts +6 -0
- package/{templates/default/ikoncomponents/form-fields/multi-combobox-input/index.tsx → dist/ikoncomponents/form-fields/multi-combobox-input/index.js} +381 -574
- package/dist/ikoncomponents/form-fields/otp-input/index.d.ts +2 -0
- package/dist/ikoncomponents/form-fields/otp-input/index.js +18 -0
- package/dist/ikoncomponents/form-fields/phone-input/index.d.ts +1 -0
- package/dist/ikoncomponents/form-fields/phone-input/index.js +4 -0
- package/dist/ikoncomponents/form-fields/textarea/index.d.ts +2 -0
- package/dist/ikoncomponents/form-fields/textarea/index.js +18 -0
- package/dist/ikoncomponents/form-fields/types/index.d.ts +36 -0
- package/dist/ikoncomponents/form-fields/types/index.js +1 -0
- package/dist/ikoncomponents/glowing-effect/index.d.ts +14 -0
- package/dist/ikoncomponents/glowing-effect/index.js +84 -0
- package/dist/ikoncomponents/icon/index.d.ts +8 -0
- package/dist/ikoncomponents/icon/index.js +23 -0
- package/dist/ikoncomponents/image-cropper-upload/components/newCropper.d.ts +15 -0
- package/{templates/default/ikoncomponents/image-cropper-upload/components/newCropper.tsx → dist/ikoncomponents/image-cropper-upload/components/newCropper.js} +85 -117
- package/dist/ikoncomponents/image-cropper-upload/components/newImageUploadForm.d.ts +7 -0
- package/dist/ikoncomponents/image-cropper-upload/components/newImageUploadForm.js +145 -0
- package/dist/ikoncomponents/image-cropper-upload/cropper-form/index.d.ts +6 -0
- package/dist/ikoncomponents/image-cropper-upload/cropper-form/index.js +92 -0
- package/dist/ikoncomponents/image-cropper-upload/cropper-form-with-modal/index.d.ts +6 -0
- package/dist/ikoncomponents/image-cropper-upload/cropper-form-with-modal/index.js +14 -0
- package/dist/ikoncomponents/image-cropper-upload/image-cropper/index.d.ts +14 -0
- package/{templates/default/ikoncomponents/image-cropper-upload/image-cropper/index.tsx → dist/ikoncomponents/image-cropper-upload/image-cropper/index.js} +87 -119
- package/dist/ikoncomponents/image-cropper-upload/index.d.ts +27 -0
- package/dist/ikoncomponents/image-cropper-upload/index.js +49 -0
- package/dist/ikoncomponents/image-cropper-upload/utils/index.d.ts +16 -0
- package/dist/ikoncomponents/image-cropper-upload/utils/index.js +73 -0
- package/dist/ikoncomponents/loading-spinner/index.d.ts +9 -0
- package/dist/ikoncomponents/loading-spinner/index.js +19 -0
- package/dist/ikoncomponents/main-layout/RefreshContext.d.ts +10 -0
- package/dist/ikoncomponents/main-layout/RefreshContext.js +18 -0
- package/dist/ikoncomponents/main-layout/SidebarNavContext.d.ts +33 -0
- package/dist/ikoncomponents/main-layout/SidebarNavContext.js +52 -0
- package/dist/ikoncomponents/main-layout/app-sidebar.d.ts +3 -0
- package/dist/ikoncomponents/main-layout/app-sidebar.js +24 -0
- package/dist/ikoncomponents/main-layout/footer.d.ts +1 -0
- package/dist/ikoncomponents/main-layout/footer.js +5 -0
- package/dist/ikoncomponents/main-layout/header.d.ts +3 -0
- package/dist/ikoncomponents/main-layout/header.js +15 -0
- package/dist/ikoncomponents/main-layout/index.d.ts +6 -0
- package/dist/ikoncomponents/main-layout/index.js +11 -0
- package/dist/ikoncomponents/main-layout/main-sidebar.d.ts +60 -0
- package/dist/ikoncomponents/main-layout/main-sidebar.js +119 -0
- package/dist/ikoncomponents/main-layout/nav-main.d.ts +11 -0
- package/dist/ikoncomponents/main-layout/nav-main.js +33 -0
- package/dist/ikoncomponents/multi-combobox/index.d.ts +13 -0
- package/dist/ikoncomponents/multi-combobox/index.js +202 -0
- package/dist/ikoncomponents/no-data/index.d.ts +3 -0
- package/dist/ikoncomponents/no-data/index.js +5 -0
- package/dist/ikoncomponents/page-wrapper/index.d.ts +9 -0
- package/dist/ikoncomponents/page-wrapper/index.js +7 -0
- package/dist/ikoncomponents/password-strength-meter/index.d.ts +3 -0
- package/dist/ikoncomponents/password-strength-meter/index.js +40 -0
- package/dist/ikoncomponents/phone-input/index.d.ts +1 -0
- package/dist/ikoncomponents/phone-input/index.js +41 -0
- package/dist/ikoncomponents/provider-wrapper/index.d.ts +6 -0
- package/dist/ikoncomponents/provider-wrapper/index.js +11 -0
- package/dist/ikoncomponents/search-input/index.d.ts +1 -0
- package/dist/ikoncomponents/search-input/index.js +19 -0
- package/dist/ikoncomponents/sheet/index.d.ts +10 -0
- package/dist/ikoncomponents/sheet/index.js +6 -0
- package/dist/ikoncomponents/simple-widget/index.d.ts +14 -0
- package/dist/ikoncomponents/simple-widget/index.js +14 -0
- package/dist/ikoncomponents/skeleton-loader/skeleton-table.d.ts +5 -0
- package/dist/ikoncomponents/skeleton-loader/skeleton-table.js +6 -0
- package/dist/ikoncomponents/skeleton-loader/skeleton-widget.d.ts +3 -0
- package/dist/ikoncomponents/skeleton-loader/skeleton-widget.js +5 -0
- package/dist/ikoncomponents/tabs/index.d.ts +2 -0
- package/dist/ikoncomponents/tabs/index.js +50 -0
- package/{templates/default/ikoncomponents/tabs/type.ts → dist/ikoncomponents/tabs/type.d.ts} +19 -20
- package/dist/ikoncomponents/tabs/type.js +2 -0
- package/dist/ikoncomponents/theme-toggle-btn/index.d.ts +1 -0
- package/{templates/default/ikoncomponents/theme-toggle-btn/index.tsx → dist/ikoncomponents/theme-toggle-btn/index.js} +118 -189
- package/dist/ikoncomponents/title-progress/index.d.ts +12 -0
- package/dist/ikoncomponents/title-progress/index.js +10 -0
- package/dist/ikoncomponents/tooltip/index.d.ts +5 -0
- package/dist/ikoncomponents/tooltip/index.js +5 -0
- package/dist/ikoncomponents/twolevel-dropdown/index.d.ts +31 -0
- package/dist/ikoncomponents/twolevel-dropdown/index.js +143 -0
- package/dist/ikoncomponents/upload-tab/index.d.ts +1 -0
- package/dist/ikoncomponents/upload-tab/index.js +92 -0
- package/dist/ikoncomponents/widgets/index.d.ts +2 -0
- package/dist/ikoncomponents/widgets/index.js +14 -0
- package/dist/ikoncomponents/widgets/type.d.ts +10 -0
- package/dist/ikoncomponents/widgets/type.js +2 -0
- package/dist/ikoncomponents/work-in-progress/index.d.ts +1 -0
- package/dist/ikoncomponents/work-in-progress/index.js +4 -0
- package/dist/index.d.ts +138 -0
- package/dist/index.js +116 -14
- package/dist/shadcn/accordion.d.ts +7 -0
- package/dist/shadcn/accordion.js +33 -0
- package/dist/shadcn/alert-dialog.d.ts +20 -0
- package/dist/shadcn/alert-dialog.js +83 -0
- package/dist/shadcn/alert.d.ts +9 -0
- package/dist/shadcn/alert.js +38 -0
- package/dist/shadcn/aspect-ratio.d.ts +3 -0
- package/dist/shadcn/aspect-ratio.js +19 -0
- package/dist/shadcn/avatar.d.ts +6 -0
- package/dist/shadcn/avatar.js +28 -0
- package/dist/shadcn/badge.d.ts +9 -0
- package/dist/shadcn/badge.js +35 -0
- package/dist/shadcn/breadcrumb.d.ts +11 -0
- package/dist/shadcn/breadcrumb.js +45 -0
- package/dist/shadcn/button.d.ts +10 -0
- package/dist/shadcn/button.js +47 -0
- package/dist/shadcn/calendar.d.ts +8 -0
- package/dist/shadcn/calendar.js +61 -0
- package/dist/shadcn/card.d.ts +9 -0
- package/dist/shadcn/card.js +42 -0
- package/dist/shadcn/checkbox.d.ts +4 -0
- package/dist/shadcn/checkbox.js +21 -0
- package/dist/shadcn/collapsible.d.ts +5 -0
- package/dist/shadcn/collapsible.js +27 -0
- package/dist/shadcn/command.d.ts +18 -0
- package/dist/shadcn/command.js +54 -0
- package/dist/shadcn/date-input.d.ts +7 -0
- package/dist/shadcn/date-input.js +179 -0
- package/dist/shadcn/date-range-picker.d.ts +24 -0
- package/dist/shadcn/date-range-picker.js +45 -0
- package/dist/shadcn/dialog.d.ts +15 -0
- package/dist/shadcn/dialog.js +57 -0
- package/dist/shadcn/drawer.d.ts +13 -0
- package/dist/shadcn/drawer.js +56 -0
- package/dist/shadcn/dropdown-menu.d.ts +25 -0
- package/dist/shadcn/dropdown-menu.js +77 -0
- package/dist/shadcn/form.d.ts +24 -0
- package/dist/shadcn/form.js +70 -0
- package/dist/shadcn/hover-card.d.ts +6 -0
- package/dist/shadcn/hover-card.js +28 -0
- package/dist/shadcn/input-otp.d.ts +34 -0
- package/dist/shadcn/input-otp.js +40 -0
- package/dist/shadcn/input.d.ts +3 -0
- package/dist/shadcn/input.js +18 -0
- package/dist/shadcn/label.d.ts +4 -0
- package/dist/shadcn/label.js +20 -0
- package/dist/shadcn/navigation-menu.d.ts +16 -0
- package/dist/shadcn/navigation-menu.js +74 -0
- package/dist/shadcn/popover.d.ts +7 -0
- package/dist/shadcn/popover.js +32 -0
- package/dist/shadcn/progress.d.ts +8 -0
- package/dist/shadcn/progress.js +23 -0
- package/dist/shadcn/radio-group.d.ts +5 -0
- package/dist/shadcn/radio-group.js +25 -0
- package/dist/shadcn/scroll-area.d.ts +5 -0
- package/dist/shadcn/scroll-area.js +26 -0
- package/dist/shadcn/select.d.ts +15 -0
- package/dist/shadcn/select.js +59 -0
- package/dist/shadcn/separator.d.ts +4 -0
- package/dist/shadcn/separator.js +20 -0
- package/dist/shadcn/sheet.d.ts +13 -0
- package/dist/shadcn/sheet.js +61 -0
- package/dist/shadcn/sidebar.d.ts +69 -0
- package/dist/shadcn/sidebar.js +242 -0
- package/dist/shadcn/skeleton.d.ts +3 -0
- package/dist/shadcn/skeleton.js +18 -0
- package/dist/shadcn/slider.d.ts +4 -0
- package/dist/shadcn/slider.js +26 -0
- package/dist/shadcn/sonner.d.ts +3 -0
- package/dist/shadcn/sonner.js +25 -0
- package/dist/shadcn/switch.d.ts +4 -0
- package/dist/shadcn/switch.js +20 -0
- package/dist/shadcn/table.d.ts +10 -0
- package/dist/shadcn/table.js +47 -0
- package/dist/shadcn/tabs.d.ts +7 -0
- package/dist/shadcn/tabs.js +32 -0
- package/dist/shadcn/textarea.d.ts +3 -0
- package/dist/shadcn/textarea.js +18 -0
- package/dist/shadcn/toggle-group.d.ts +9 -0
- package/dist/shadcn/toggle-group.js +35 -0
- package/dist/shadcn/toggle.d.ts +9 -0
- package/dist/shadcn/toggle.js +38 -0
- package/dist/shadcn/tooltip.d.ts +7 -0
- package/dist/shadcn/tooltip.js +32 -0
- package/dist/shadcn/workflow.d.ts +20 -0
- package/dist/shadcn/workflow.js +20 -0
- package/dist/styles.css +6163 -0
- package/dist/utils/actions/account/index.d.ts +5 -0
- package/dist/utils/actions/account/index.js +28 -0
- package/dist/utils/actions/account/type.d.ts +4 -0
- package/dist/utils/actions/account/type.js +1 -0
- package/dist/utils/actions/auth/index.d.ts +7 -0
- package/{templates/default/utils/actions/auth/index.ts → dist/utils/actions/auth/index.js} +58 -69
- package/dist/utils/actions/common/utils.d.ts +5 -0
- package/{templates/default/utils/actions/common/utils.ts → dist/utils/actions/common/utils.js} +25 -28
- package/dist/utils/actions/software/index.d.ts +11 -0
- package/dist/utils/actions/software/index.js +75 -0
- package/dist/utils/api/accountService/index.d.ts +23 -0
- package/dist/utils/api/accountService/index.js +64 -0
- package/dist/utils/api/accountService/type.d.ts +4 -0
- package/dist/utils/api/accountService/type.js +1 -0
- package/dist/utils/api/file-upload/index.d.ts +5 -0
- package/dist/utils/api/file-upload/index.js +80 -0
- package/dist/utils/api/file-upload/type.d.ts +6 -0
- package/dist/utils/api/file-upload/type.js +1 -0
- package/dist/utils/api/ikonBaseApi.d.ts +12 -0
- package/{templates/default/utils/api/ikonBaseApi.ts → dist/utils/api/ikonBaseApi.js} +104 -132
- package/dist/utils/api/loginService/index.d.ts +12 -0
- package/dist/utils/api/loginService/index.js +72 -0
- package/{templates/default/utils/api/loginService/type.ts → dist/utils/api/loginService/type.d.ts} +31 -35
- package/dist/utils/api/loginService/type.js +1 -0
- package/dist/utils/api/softwareService/index.d.ts +64 -0
- package/dist/utils/api/softwareService/index.js +212 -0
- package/dist/utils/api/softwareService/type.d.ts +54 -0
- package/dist/utils/api/softwareService/type.js +1 -0
- package/dist/utils/border-radius-provider.d.ts +11 -0
- package/{templates/default/utils/border-radius-provider.tsx → dist/utils/border-radius-provider.js} +35 -59
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.js +5 -0
- package/dist/utils/font-provider.d.ts +11 -0
- package/{templates/default/utils/font-provider.tsx → dist/utils/font-provider.js} +37 -61
- package/dist/utils/session/cookieSession.d.ts +8 -0
- package/dist/utils/session/cookieSession.js +33 -0
- package/dist/utils/theme-provider/index.d.ts +3 -0
- package/dist/utils/theme-provider/index.js +18 -0
- package/dist/utils/token-management/index.d.ts +10 -0
- package/dist/utils/token-management/index.js +69 -0
- package/dist/utils/token-management/types.d.ts +6 -0
- package/dist/utils/token-management/types.js +1 -0
- package/package.json +91 -17
- package/bin.js +0 -2
- package/dist/commands/init.js +0 -63
- package/dist/utlis/copyDir.js +0 -7
- package/templates/default/hooks/use-mobile.ts +0 -19
- package/templates/default/ikonS/accordion.tsx +0 -66
- package/templates/default/ikonS/alert-dialog.tsx +0 -179
- package/templates/default/ikonS/alert.tsx +0 -66
- package/templates/default/ikonS/aspect-ratio.tsx +0 -11
- package/templates/default/ikonS/avatar.tsx +0 -53
- package/templates/default/ikonS/badge.tsx +0 -49
- package/templates/default/ikonS/breadcrumb.tsx +0 -109
- package/templates/default/ikonS/button.tsx +0 -64
- package/templates/default/ikonS/calendar.tsx +0 -227
- package/templates/default/ikonS/card.tsx +0 -92
- package/templates/default/ikonS/checkbox.tsx +0 -33
- package/templates/default/ikonS/collapsible.tsx +0 -33
- package/templates/default/ikonS/command.tsx +0 -184
- package/templates/default/ikonS/date-input.tsx +0 -259
- package/templates/default/ikonS/date-range-picker.tsx +0 -103
- package/templates/default/ikonS/dialog.tsx +0 -143
- package/templates/default/ikonS/drawer.tsx +0 -134
- package/templates/default/ikonS/dropdown-menu.tsx +0 -259
- package/templates/default/ikonS/form.tsx +0 -166
- package/templates/default/ikonS/hover-card.tsx +0 -44
- package/templates/default/ikonS/input-otp.tsx +0 -71
- package/templates/default/ikonS/input.tsx +0 -22
- package/templates/default/ikonS/label.tsx +0 -24
- package/templates/default/ikonS/navigation-menu.tsx +0 -195
- package/templates/default/ikonS/popover.tsx +0 -48
- package/templates/default/ikonS/progress.tsx +0 -40
- package/templates/default/ikonS/radio-group.tsx +0 -45
- package/templates/default/ikonS/scroll-area.tsx +0 -58
- package/templates/default/ikonS/select.tsx +0 -184
- package/templates/default/ikonS/separator.tsx +0 -28
- package/templates/default/ikonS/sheet.tsx +0 -139
- package/templates/default/ikonS/sidebar.tsx +0 -726
- package/templates/default/ikonS/skeleton.tsx +0 -15
- package/templates/default/ikonS/slider.tsx +0 -64
- package/templates/default/ikonS/sonner.tsx +0 -25
- package/templates/default/ikonS/switch.tsx +0 -31
- package/templates/default/ikonS/table.tsx +0 -116
- package/templates/default/ikonS/tabs.tsx +0 -67
- package/templates/default/ikonS/textarea.tsx +0 -18
- package/templates/default/ikonS/toggle-group.tsx +0 -83
- package/templates/default/ikonS/toggle.tsx +0 -47
- package/templates/default/ikonS/tooltip.tsx +0 -65
- package/templates/default/ikonS/workflow.tsx +0 -119
- package/templates/default/ikoncomponents/action-menu/index.tsx +0 -108
- package/templates/default/ikoncomponents/action-menu/type.ts +0 -18
- package/templates/default/ikoncomponents/activity-sheet/index.tsx +0 -63
- package/templates/default/ikoncomponents/alert-dialog/dialog-context.tsx +0 -65
- package/templates/default/ikoncomponents/alert-dialog/index.tsx +0 -80
- package/templates/default/ikoncomponents/app-breadcrumb/BreadcrumbProvider.tsx +0 -68
- package/templates/default/ikoncomponents/app-breadcrumb/index.tsx +0 -222
- package/templates/default/ikoncomponents/big-calendar/big-calender-event/index.tsx +0 -38
- package/templates/default/ikoncomponents/big-calendar/big-calender-toolbar/index.tsx +0 -81
- package/templates/default/ikoncomponents/big-calendar/index.css +0 -879
- package/templates/default/ikoncomponents/big-calendar/index.tsx +0 -59
- package/templates/default/ikoncomponents/big-calendar/type.ts +0 -37
- package/templates/default/ikoncomponents/buttons/index.tsx +0 -127
- package/templates/default/ikoncomponents/combobox-input/index.tsx +0 -75
- package/templates/default/ikoncomponents/combobox-input/type.ts +0 -14
- package/templates/default/ikoncomponents/custom-combo-dropdown/index.tsx +0 -242
- package/templates/default/ikoncomponents/data-table/datatable-column-filter/index.tsx +0 -80
- package/templates/default/ikoncomponents/data-table/datatable-faceted-filter/index.tsx +0 -149
- package/templates/default/ikoncomponents/data-table/datatable-filter-menu/index.tsx +0 -98
- package/templates/default/ikoncomponents/data-table/datatable-pagination/index.tsx +0 -119
- package/templates/default/ikoncomponents/data-table/datatable-toolbar/index.tsx +0 -45
- package/templates/default/ikoncomponents/data-table/function.ts +0 -7
- package/templates/default/ikoncomponents/data-table/index.tsx +0 -549
- package/templates/default/ikoncomponents/data-table/type.ts +0 -75
- package/templates/default/ikoncomponents/e-chart/index.tsx +0 -183
- package/templates/default/ikoncomponents/file-input/index.tsx +0 -27
- package/templates/default/ikoncomponents/fileUpload/index.tsx +0 -121
- package/templates/default/ikoncomponents/form-fields/combobox-input/index.tsx +0 -111
- package/templates/default/ikoncomponents/form-fields/combobox-input-value/index.tsx +0 -121
- package/templates/default/ikoncomponents/form-fields/date-input/index.tsx +0 -80
- package/templates/default/ikoncomponents/form-fields/file-input/index.tsx +0 -9
- package/templates/default/ikoncomponents/form-fields/input/index.tsx +0 -27
- package/templates/default/ikoncomponents/form-fields/otp-input/index.tsx +0 -39
- package/templates/default/ikoncomponents/form-fields/password-input/index.tsx +0 -52
- package/templates/default/ikoncomponents/form-fields/phone-input/index.tsx +0 -7
- package/templates/default/ikoncomponents/form-fields/textarea/index.tsx +0 -28
- package/templates/default/ikoncomponents/form-fields/types/index.ts +0 -46
- package/templates/default/ikoncomponents/glowing-effect/index.tsx +0 -171
- package/templates/default/ikoncomponents/icon/index.tsx +0 -22
- package/templates/default/ikoncomponents/image-cropper-upload/components/cropperImg.css +0 -19
- package/templates/default/ikoncomponents/image-cropper-upload/components/newImageUploadForm.tsx +0 -352
- package/templates/default/ikoncomponents/image-cropper-upload/cropper-form/index.tsx +0 -250
- package/templates/default/ikoncomponents/image-cropper-upload/cropper-form-with-modal/index.tsx +0 -32
- package/templates/default/ikoncomponents/image-cropper-upload/index.tsx +0 -95
- package/templates/default/ikoncomponents/image-cropper-upload/utils/index.ts +0 -117
- package/templates/default/ikoncomponents/loading-spinner/index.tsx +0 -43
- package/templates/default/ikoncomponents/main-layout/RefreshContext.tsx +0 -30
- package/templates/default/ikoncomponents/main-layout/SidebarNavContext.tsx +0 -103
- package/templates/default/ikoncomponents/main-layout/app-sidebar.tsx +0 -36
- package/templates/default/ikoncomponents/main-layout/footer.tsx +0 -21
- package/templates/default/ikoncomponents/main-layout/header.tsx +0 -53
- package/templates/default/ikoncomponents/main-layout/index.tsx +0 -38
- package/templates/default/ikoncomponents/main-layout/main-sidebar.tsx +0 -389
- package/templates/default/ikoncomponents/main-layout/nav-main.tsx +0 -103
- package/templates/default/ikoncomponents/multi-combobox/index.tsx +0 -345
- package/templates/default/ikoncomponents/no-data/index.tsx +0 -11
- package/templates/default/ikoncomponents/page-wrapper/index.tsx +0 -30
- package/templates/default/ikoncomponents/password-strength-meter/index.tsx +0 -49
- package/templates/default/ikoncomponents/phone-input/index.tsx +0 -72
- package/templates/default/ikoncomponents/provider-wrapper/index.tsx +0 -32
- package/templates/default/ikoncomponents/search-input/index.tsx +0 -18
- package/templates/default/ikoncomponents/sheet/index.tsx +0 -34
- package/templates/default/ikoncomponents/simple-widget/index.tsx +0 -54
- package/templates/default/ikoncomponents/skeleton-loader/skeleton-table.tsx +0 -34
- package/templates/default/ikoncomponents/skeleton-loader/skeleton-widget.tsx +0 -13
- package/templates/default/ikoncomponents/tabs/index.tsx +0 -139
- package/templates/default/ikoncomponents/title-progress/index.tsx +0 -41
- package/templates/default/ikoncomponents/tooltip/index.tsx +0 -17
- package/templates/default/ikoncomponents/twolevel-dropdown/convertToDropdownNodes.tsx +0 -33
- package/templates/default/ikoncomponents/twolevel-dropdown/index.tsx +0 -279
- package/templates/default/ikoncomponents/upload-tab/index.tsx +0 -237
- package/templates/default/ikoncomponents/widgets/index.tsx +0 -81
- package/templates/default/ikoncomponents/widgets/type.ts +0 -11
- package/templates/default/ikoncomponents/work-in-progress/index.tsx +0 -16
- package/templates/default/styles.css +0 -1159
- package/templates/default/utils/actions/account/index.ts +0 -33
- package/templates/default/utils/actions/account/type.ts +0 -4
- package/templates/default/utils/actions/common/revalidate.ts +0 -18
- package/templates/default/utils/actions/common/type.ts +0 -4
- package/templates/default/utils/actions/software/index.ts +0 -106
- package/templates/default/utils/api/accountService/index.ts +0 -103
- package/templates/default/utils/api/accountService/type.ts +0 -4
- package/templates/default/utils/api/file-upload/index.ts +0 -103
- package/templates/default/utils/api/file-upload/type.ts +0 -8
- package/templates/default/utils/api/loginService/index.ts +0 -106
- package/templates/default/utils/api/softwareService/index.ts +0 -356
- package/templates/default/utils/api/softwareService/type.ts +0 -62
- package/templates/default/utils/cn.ts +0 -6
- package/templates/default/utils/session/cookieSession.ts +0 -49
- package/templates/default/utils/theme-provider/index.tsx +0 -11
- package/templates/default/utils/token-management/index.ts +0 -115
- package/templates/default/utils/token-management/types.ts +0 -6
package/templates/default/ikoncomponents/image-cropper-upload/components/newImageUploadForm.tsx
DELETED
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, memo } from "react";
|
|
2
|
-
import {
|
|
3
|
-
ZoomIn,
|
|
4
|
-
ZoomOut,
|
|
5
|
-
RotateCw,
|
|
6
|
-
RotateCcw,
|
|
7
|
-
ArrowUp,
|
|
8
|
-
ArrowDown,
|
|
9
|
-
ArrowLeft,
|
|
10
|
-
ArrowRight,
|
|
11
|
-
ImageIcon,
|
|
12
|
-
FileImage,
|
|
13
|
-
Square,
|
|
14
|
-
Upload,
|
|
15
|
-
} from "lucide-react";
|
|
16
|
-
import { Label } from "../../../shadcn/label";
|
|
17
|
-
import { Input } from "../../../shadcn/input";
|
|
18
|
-
import { Button } from "../../../shadcn/button";
|
|
19
|
-
import { NewCropperImg } from "./newCropper";
|
|
20
|
-
import Image from "next/image";
|
|
21
|
-
|
|
22
|
-
type ActiveState = "first" | "second" | "third";
|
|
23
|
-
|
|
24
|
-
export interface ImageFormProps {
|
|
25
|
-
open: boolean;
|
|
26
|
-
setOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
27
|
-
onImageSubmit: (data: string | null) => void;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const NewImageFormComponent: React.FC<ImageFormProps> = ({
|
|
31
|
-
open,
|
|
32
|
-
setOpen,
|
|
33
|
-
onImageSubmit,
|
|
34
|
-
}) => {
|
|
35
|
-
const [imageSrc, setImageSrc] = useState<string | null>(null);
|
|
36
|
-
const [croppedImage, setCroppedImage] = useState<string | null>(null);
|
|
37
|
-
const [prevImages, setPrevImages] = useState<
|
|
38
|
-
Record<ActiveState, string | null>
|
|
39
|
-
>({
|
|
40
|
-
first: null,
|
|
41
|
-
second: null,
|
|
42
|
-
third: null,
|
|
43
|
-
});
|
|
44
|
-
const [aspectRatio, setAspectRatio] = useState<number>(4 / 3);
|
|
45
|
-
const [activeState, setActiveState] = useState<ActiveState>("first");
|
|
46
|
-
const [rotationAngle, setRotationAngle] = useState(0);
|
|
47
|
-
const [scale, setScale] = useState(1);
|
|
48
|
-
const [moveDirection, setMoveDirection] = useState<{ x: number; y: number }>({
|
|
49
|
-
x: 0,
|
|
50
|
-
y: 0,
|
|
51
|
-
});
|
|
52
|
-
const [fileName, setFileName] = useState<string | undefined>("");
|
|
53
|
-
|
|
54
|
-
const handleImageSubmit = () => {
|
|
55
|
-
console.log("Image Submit Button is pressed");
|
|
56
|
-
console.log(prevImages);
|
|
57
|
-
onImageSubmit(prevImages.third);
|
|
58
|
-
setOpen(false);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const rotateImage = (angle: number) => {
|
|
62
|
-
setRotationAngle((prevAngle) => prevAngle + angle);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const handleMoveUp = () => {
|
|
66
|
-
setMoveDirection({ x: 0, y: -5 });
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const handleMoveDown = () => {
|
|
70
|
-
setMoveDirection({ x: 0, y: 5 });
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const handleMoveLeft = () => {
|
|
74
|
-
setMoveDirection({ x: -5, y: 0 });
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const handleMoveRight = () => {
|
|
78
|
-
setMoveDirection({ x: 5, y: 0 });
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
// Handle zoom in
|
|
82
|
-
const zoomIn = () => {
|
|
83
|
-
setScale((prevScale) => {
|
|
84
|
-
const newScale = prevScale + 0.2;
|
|
85
|
-
if (newScale <= 2) {
|
|
86
|
-
// Ensure scale does not exceed the max value
|
|
87
|
-
return newScale;
|
|
88
|
-
}
|
|
89
|
-
return prevScale;
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
// Handle zoom out
|
|
94
|
-
const zoomOut = () => {
|
|
95
|
-
setScale((prevScale) => {
|
|
96
|
-
const newScale = prevScale - 0.2;
|
|
97
|
-
if (newScale >= 0.2) {
|
|
98
|
-
// Ensure scale does not go below the min value
|
|
99
|
-
return newScale;
|
|
100
|
-
}
|
|
101
|
-
return prevScale;
|
|
102
|
-
});
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const handleAspectRatioChange = (ratio: number, stateName: ActiveState) => {
|
|
106
|
-
setAspectRatio(ratio);
|
|
107
|
-
setActiveState(stateName);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const handleFileChange = (file: File) => {
|
|
111
|
-
if (file.type.startsWith("image/")) {
|
|
112
|
-
const reader = new FileReader();
|
|
113
|
-
reader.onloadend = () => {
|
|
114
|
-
setImageSrc(reader.result as string);
|
|
115
|
-
setFileName((prev) => prev || file.name);
|
|
116
|
-
};
|
|
117
|
-
reader.readAsDataURL(file);
|
|
118
|
-
} else {
|
|
119
|
-
alert("Please drop a valid image file.");
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const handleDrop = (event: React.DragEvent) => {
|
|
124
|
-
event.preventDefault();
|
|
125
|
-
handleFileChange(event.dataTransfer.files[0]);
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const getImagePreview = (state: ActiveState) => {
|
|
129
|
-
const imgSource =
|
|
130
|
-
croppedImage && activeState === state ? croppedImage : prevImages[state];
|
|
131
|
-
// const imgSource = prevImages[state];
|
|
132
|
-
return imgSource ? (
|
|
133
|
-
<div
|
|
134
|
-
className={`
|
|
135
|
-
${state === "first"
|
|
136
|
-
? "relative w-3/5 h-[200px] bg-slate-400"
|
|
137
|
-
: state === "second"
|
|
138
|
-
? "relative w-1/2 h-[220px] bg-slate-400"
|
|
139
|
-
: "relative w-1/3 h-[120px] bg-slate-400"
|
|
140
|
-
}`}
|
|
141
|
-
>
|
|
142
|
-
<Image
|
|
143
|
-
src={imgSource || ""}
|
|
144
|
-
alt={`Preview ${state}`}
|
|
145
|
-
layout="fill"
|
|
146
|
-
objectFit="70vh"
|
|
147
|
-
/>
|
|
148
|
-
</div>
|
|
149
|
-
) : (
|
|
150
|
-
<div
|
|
151
|
-
className={`
|
|
152
|
-
${state === "first"
|
|
153
|
-
? "relative w-3/5 h-[200px] bg-slate-400"
|
|
154
|
-
: state === "second"
|
|
155
|
-
? "relative w-1/2 h-[220px] bg-slate-400"
|
|
156
|
-
: "relative w-1/3 h-[120px] bg-slate-400"
|
|
157
|
-
}`}
|
|
158
|
-
></div>
|
|
159
|
-
);
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
useEffect(() => {
|
|
163
|
-
if (croppedImage) {
|
|
164
|
-
if (
|
|
165
|
-
prevImages.first === null ||
|
|
166
|
-
prevImages.second === null ||
|
|
167
|
-
prevImages.third === null
|
|
168
|
-
) {
|
|
169
|
-
setPrevImages({
|
|
170
|
-
first: croppedImage,
|
|
171
|
-
second: croppedImage,
|
|
172
|
-
third: croppedImage,
|
|
173
|
-
});
|
|
174
|
-
} else {
|
|
175
|
-
setPrevImages((prev) => ({ ...prev, [activeState]: croppedImage }));
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}, [croppedImage]);
|
|
179
|
-
|
|
180
|
-
return (
|
|
181
|
-
<>
|
|
182
|
-
{/* Form UI */}
|
|
183
|
-
<div className="flex flex-row gap-2">
|
|
184
|
-
<div className="flex-1">
|
|
185
|
-
<Label htmlFor="imageName">Image Name</Label>
|
|
186
|
-
<Input
|
|
187
|
-
id="imageName"
|
|
188
|
-
placeholder="Enter image name"
|
|
189
|
-
value={fileName}
|
|
190
|
-
onChange={(e) => setFileName(e.target.value)}
|
|
191
|
-
/>
|
|
192
|
-
</div>
|
|
193
|
-
<div className="self-end">
|
|
194
|
-
<Button
|
|
195
|
-
variant="outline"
|
|
196
|
-
onClick={() => document.getElementById("inputImage1")?.click()}
|
|
197
|
-
>
|
|
198
|
-
<Upload />
|
|
199
|
-
</Button>
|
|
200
|
-
<Input
|
|
201
|
-
id="inputImage1"
|
|
202
|
-
type="file"
|
|
203
|
-
accept="image/png, image/jpeg"
|
|
204
|
-
className="hidden"
|
|
205
|
-
onChange={(e) => {
|
|
206
|
-
const file = e.target.files?.[0];
|
|
207
|
-
if (file && file.type.startsWith("image/")) {
|
|
208
|
-
const reader = new FileReader();
|
|
209
|
-
reader.onloadend = () => {
|
|
210
|
-
setImageSrc(reader.result as string);
|
|
211
|
-
setFileName((prevFileName) => prevFileName || file.name);
|
|
212
|
-
};
|
|
213
|
-
reader.readAsDataURL(file);
|
|
214
|
-
setPrevImages({
|
|
215
|
-
first: null,
|
|
216
|
-
second: null,
|
|
217
|
-
third: null,
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
}}
|
|
221
|
-
/>
|
|
222
|
-
</div>
|
|
223
|
-
<div className="flex-1">
|
|
224
|
-
<Label htmlFor="imageDesc">Image Description</Label>
|
|
225
|
-
<Input id="imageDesc" placeholder="Describe your image" />
|
|
226
|
-
</div>
|
|
227
|
-
</div>
|
|
228
|
-
|
|
229
|
-
{/* Image Upload */}
|
|
230
|
-
<div className="flex flex-row gap-2">
|
|
231
|
-
<div
|
|
232
|
-
className="w-3/5 flex justify-center items-center border-2 border-dashed border-gray-400 bg-gray-100"
|
|
233
|
-
style={{ height: "70vh" }}
|
|
234
|
-
onDrop={handleDrop}
|
|
235
|
-
onDragOver={(e) => e.preventDefault()}
|
|
236
|
-
>
|
|
237
|
-
{imageSrc ? (
|
|
238
|
-
<NewCropperImg
|
|
239
|
-
imageSrc={imageSrc}
|
|
240
|
-
onCroppedImage={setCroppedImage}
|
|
241
|
-
aspectRatio={aspectRatio}
|
|
242
|
-
rotationAngle={rotationAngle}
|
|
243
|
-
zoomLevel={scale}
|
|
244
|
-
moveDirection={moveDirection}
|
|
245
|
-
currentState={activeState}
|
|
246
|
-
/>
|
|
247
|
-
) : (
|
|
248
|
-
<div className="text-center">
|
|
249
|
-
<Label htmlFor="inputImage">Drag and drop an image here</Label>
|
|
250
|
-
<div className="mt-4">
|
|
251
|
-
<Button
|
|
252
|
-
variant="outline"
|
|
253
|
-
onClick={() => document.getElementById("inputImage")?.click()}
|
|
254
|
-
>
|
|
255
|
-
Upload Image
|
|
256
|
-
</Button>
|
|
257
|
-
<Input
|
|
258
|
-
id="inputImage"
|
|
259
|
-
type="file"
|
|
260
|
-
accept="image/png, image/jpeg"
|
|
261
|
-
className="hidden"
|
|
262
|
-
onChange={(e) => {
|
|
263
|
-
const file = e.target.files?.[0];
|
|
264
|
-
if (file) {
|
|
265
|
-
handleFileChange(file);
|
|
266
|
-
}
|
|
267
|
-
}}
|
|
268
|
-
/>
|
|
269
|
-
</div>
|
|
270
|
-
</div>
|
|
271
|
-
)}
|
|
272
|
-
</div>
|
|
273
|
-
|
|
274
|
-
{/* Image Previews */}
|
|
275
|
-
<div className="w-2/5 flex flex-col gap-2">
|
|
276
|
-
<h3>Landscape</h3>
|
|
277
|
-
{getImagePreview("first")}
|
|
278
|
-
<h3>Potrait</h3>
|
|
279
|
-
{getImagePreview("second")}
|
|
280
|
-
<h3>Icon</h3>
|
|
281
|
-
{getImagePreview("third")}
|
|
282
|
-
</div>
|
|
283
|
-
</div>
|
|
284
|
-
|
|
285
|
-
{/* Controls */}
|
|
286
|
-
|
|
287
|
-
<div className="flex flex-row gap-1">
|
|
288
|
-
<div className="w-3/5 flex flex-row justify-between">
|
|
289
|
-
<div>
|
|
290
|
-
<Button
|
|
291
|
-
variant="outline"
|
|
292
|
-
onClick={() => handleAspectRatioChange(4 / 3, "first")}
|
|
293
|
-
>
|
|
294
|
-
<ImageIcon />
|
|
295
|
-
</Button>
|
|
296
|
-
<Button
|
|
297
|
-
variant="outline"
|
|
298
|
-
onClick={() => handleAspectRatioChange(3 / 4, "second")}
|
|
299
|
-
>
|
|
300
|
-
<FileImage />
|
|
301
|
-
</Button>
|
|
302
|
-
<Button
|
|
303
|
-
variant="outline"
|
|
304
|
-
onClick={() => handleAspectRatioChange(1 / 1, "third")}
|
|
305
|
-
>
|
|
306
|
-
<Square />
|
|
307
|
-
</Button>
|
|
308
|
-
</div>
|
|
309
|
-
|
|
310
|
-
<div>
|
|
311
|
-
<Button onClick={() => rotateImage(90)} variant="outline">
|
|
312
|
-
{<RotateCw />}
|
|
313
|
-
</Button>
|
|
314
|
-
|
|
315
|
-
<Button onClick={() => rotateImage(-90)} variant="outline">
|
|
316
|
-
{<RotateCcw />}
|
|
317
|
-
</Button>
|
|
318
|
-
</div>
|
|
319
|
-
|
|
320
|
-
<div>
|
|
321
|
-
<Button onClick={() => zoomIn()} variant="outline">
|
|
322
|
-
{<ZoomIn />}
|
|
323
|
-
</Button>
|
|
324
|
-
<Button onClick={() => zoomOut()} variant="outline">
|
|
325
|
-
{<ZoomOut />}
|
|
326
|
-
</Button>
|
|
327
|
-
</div>
|
|
328
|
-
<div>
|
|
329
|
-
<Button onClick={handleMoveUp} variant="outline">
|
|
330
|
-
{<ArrowUp />}
|
|
331
|
-
</Button>
|
|
332
|
-
<Button onClick={handleMoveDown} variant="outline">
|
|
333
|
-
{<ArrowDown />}
|
|
334
|
-
</Button>
|
|
335
|
-
<Button onClick={handleMoveLeft} variant="outline">
|
|
336
|
-
{<ArrowLeft />}
|
|
337
|
-
</Button>
|
|
338
|
-
<Button onClick={handleMoveRight} variant="outline">
|
|
339
|
-
{<ArrowRight />}
|
|
340
|
-
</Button>
|
|
341
|
-
</div>
|
|
342
|
-
</div>
|
|
343
|
-
|
|
344
|
-
<div className="w-2/5 flex flex-row-reverse">
|
|
345
|
-
<Button onClick={handleImageSubmit}>Save</Button>
|
|
346
|
-
</div>
|
|
347
|
-
</div>
|
|
348
|
-
</>
|
|
349
|
-
);
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
export const NewImageForm = memo(NewImageFormComponent);
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import { Input } from '../../../shadcn/input'
|
|
2
|
-
import { Label } from '../../../shadcn/label'
|
|
3
|
-
import { ToggleGroup, ToggleGroupItem } from '../../../shadcn/toggle-group'
|
|
4
|
-
import { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, FileImage, ImageIcon, RotateCcw, RotateCw, Square, Upload, ZoomIn, ZoomOut } from 'lucide-react'
|
|
5
|
-
import { ChangeEvent, memo, useEffect, useState } from 'react'
|
|
6
|
-
import { ImageCropper } from '../image-cropper'
|
|
7
|
-
import Image from 'next/image'
|
|
8
|
-
import { AspectRatio } from '../../../shadcn/aspect-ratio'
|
|
9
|
-
import { TextButton } from '../../buttons'
|
|
10
|
-
import { toast } from 'sonner'
|
|
11
|
-
import { FileInput } from '../../file-input'
|
|
12
|
-
import { OriginalImageProps, useImageCropper } from '..'
|
|
13
|
-
import { set } from 'date-fns'
|
|
14
|
-
|
|
15
|
-
type ActiveState = "landscape" | "potrait" | "icon";
|
|
16
|
-
|
|
17
|
-
const stateWiseAspectRatio = {
|
|
18
|
-
landscape: 4 / 3,
|
|
19
|
-
potrait: 3 / 4,
|
|
20
|
-
icon: 1 / 1
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface Props {
|
|
24
|
-
onNewFileUpload?: (...args: any) => void
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function CropperFormComponent({ onNewFileUpload }: Props) {
|
|
28
|
-
|
|
29
|
-
const { originalImage, setOriginalImage, aspectRatioWiseImages, setAspectRatioWiseImages } = useImageCropper();
|
|
30
|
-
const [croppedImage, setCroppedImage] = useState<string | null>(null);
|
|
31
|
-
const [activeState, setActiveState] = useState<ActiveState | undefined>();
|
|
32
|
-
const [rotationAngle, setRotationAngle] = useState(0);
|
|
33
|
-
const [scale, setScale] = useState(1);
|
|
34
|
-
const [moveDirection, setMoveDirection] = useState<{ x: number; y: number }>({
|
|
35
|
-
x: 0,
|
|
36
|
-
y: 0,
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
const [imageSrc, setImageSrc] = useState<string | null>(null);
|
|
40
|
-
const handleDrop = (event: React.DragEvent) => {
|
|
41
|
-
event.preventDefault();
|
|
42
|
-
handleFileChange(event.dataTransfer.files[0]);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const handleFileChange = (file: File | string) => {
|
|
46
|
-
if (typeof file === "string") {
|
|
47
|
-
setImageSrc(file);
|
|
48
|
-
} else {
|
|
49
|
-
if (file?.type?.startsWith("image/")) {
|
|
50
|
-
onNewFileUpload?.();
|
|
51
|
-
|
|
52
|
-
const reader = new FileReader();
|
|
53
|
-
reader.onloadend = () => {
|
|
54
|
-
setImageSrc(reader.result as string);
|
|
55
|
-
setActiveState(undefined);
|
|
56
|
-
};
|
|
57
|
-
reader.readAsDataURL(file);
|
|
58
|
-
setOriginalImage({ ...originalImage, image: file, name: file.name });
|
|
59
|
-
} else {
|
|
60
|
-
toast.error("Please select a valid image file.");
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
if (originalImage.image) {
|
|
67
|
-
handleFileChange(originalImage.image)
|
|
68
|
-
}
|
|
69
|
-
}, [originalImage.image]);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const getImagePreview = (state: ActiveState) => {
|
|
73
|
-
const imgSource = croppedImage && activeState === state ? croppedImage : aspectRatioWiseImages[state];
|
|
74
|
-
return (
|
|
75
|
-
<>
|
|
76
|
-
<h3 className='mb-3'>{state}</h3>
|
|
77
|
-
<AspectRatio ratio={stateWiseAspectRatio[state]} className='bg-muted'>
|
|
78
|
-
{imgSource &&
|
|
79
|
-
<Image
|
|
80
|
-
src={imgSource || ""}
|
|
81
|
-
alt={`Preview ${state}`}
|
|
82
|
-
fill
|
|
83
|
-
/>
|
|
84
|
-
}
|
|
85
|
-
</AspectRatio>
|
|
86
|
-
</>
|
|
87
|
-
)
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
useEffect(() => {
|
|
93
|
-
if (croppedImage) {
|
|
94
|
-
if (activeState) {
|
|
95
|
-
setAspectRatioWiseImages({ ...aspectRatioWiseImages, [activeState]: croppedImage });
|
|
96
|
-
} else {
|
|
97
|
-
setAspectRatioWiseImages({
|
|
98
|
-
landscape: croppedImage,
|
|
99
|
-
potrait: croppedImage,
|
|
100
|
-
icon: croppedImage
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
}, [croppedImage]);
|
|
106
|
-
|
|
107
|
-
return (
|
|
108
|
-
<>
|
|
109
|
-
<div className='flex flex-col gap-3 h-full overflow-auto'>
|
|
110
|
-
<div className='flex flex-col lg:flex-row gap-3 justify-between'>
|
|
111
|
-
<div className='w-full flex flex-col gap-4'>
|
|
112
|
-
<Label htmlFor="imageName">
|
|
113
|
-
Image Name
|
|
114
|
-
</Label>
|
|
115
|
-
<FileInput
|
|
116
|
-
id="inputImage"
|
|
117
|
-
accept="image/*"
|
|
118
|
-
fileNamePlaceholder="Enter image name"
|
|
119
|
-
fileName={originalImage?.name || ""}
|
|
120
|
-
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
|
121
|
-
const file = e.target.files?.[0];
|
|
122
|
-
if (file) {
|
|
123
|
-
handleFileChange(file);
|
|
124
|
-
}
|
|
125
|
-
}}
|
|
126
|
-
onFileNameChange={(e: ChangeEvent<HTMLInputElement>) => {
|
|
127
|
-
setOriginalImage({ ...originalImage, name: e.target.value })
|
|
128
|
-
}}
|
|
129
|
-
/>
|
|
130
|
-
|
|
131
|
-
</div>
|
|
132
|
-
<div className='w-full flex flex-col gap-4'>
|
|
133
|
-
<Label htmlFor="imageDescription">
|
|
134
|
-
Image Description
|
|
135
|
-
</Label>
|
|
136
|
-
<Input
|
|
137
|
-
id="imageDescription"
|
|
138
|
-
placeholder="Enter image Description"
|
|
139
|
-
value={originalImage?.description || ""}
|
|
140
|
-
onChange={(e) => setOriginalImage({ ...originalImage, description: e.target.value })}
|
|
141
|
-
/>
|
|
142
|
-
</div>
|
|
143
|
-
</div>
|
|
144
|
-
<div className='flex flex-col lg:flex-row gap-3'>
|
|
145
|
-
<div className='flex-grow flex flex-col gap-3'>
|
|
146
|
-
<div>
|
|
147
|
-
<h3 className='mb-3'>Original Image</h3>
|
|
148
|
-
<AspectRatio
|
|
149
|
-
ratio={4 / 3}
|
|
150
|
-
className='flex justify-center items-center bg-muted text-muted-foreground'
|
|
151
|
-
onDrop={handleDrop}
|
|
152
|
-
onDragOver={(e) => e.preventDefault()}
|
|
153
|
-
>
|
|
154
|
-
{imageSrc ?
|
|
155
|
-
<ImageCropper
|
|
156
|
-
src={imageSrc}
|
|
157
|
-
onCroppedImage={setCroppedImage}
|
|
158
|
-
aspectRatio={stateWiseAspectRatio[activeState || "icon"]}
|
|
159
|
-
rotationAngle={rotationAngle}
|
|
160
|
-
zoomLevel={scale}
|
|
161
|
-
moveDirection={moveDirection}
|
|
162
|
-
/>
|
|
163
|
-
:
|
|
164
|
-
<div className="text-center">
|
|
165
|
-
<Label htmlFor="inputImage">Drag and drop an image here</Label>
|
|
166
|
-
<div className="mt-3">
|
|
167
|
-
<TextButton
|
|
168
|
-
variant="outline"
|
|
169
|
-
onClick={() => document.getElementById("inputImage")?.click()}
|
|
170
|
-
>
|
|
171
|
-
Browse Image
|
|
172
|
-
</TextButton>
|
|
173
|
-
|
|
174
|
-
</div>
|
|
175
|
-
</div>
|
|
176
|
-
}
|
|
177
|
-
</AspectRatio>
|
|
178
|
-
|
|
179
|
-
</div>
|
|
180
|
-
<div className="flex flex-col lg:flex-row gap-3 justify-between">
|
|
181
|
-
<div>
|
|
182
|
-
<ToggleGroup type="single" variant='outline' value={activeState} onValueChange={(value) => setActiveState(value as ActiveState)}>
|
|
183
|
-
<ToggleGroupItem className="rounded-e-none" value="landscape">
|
|
184
|
-
<ImageIcon />
|
|
185
|
-
</ToggleGroupItem>
|
|
186
|
-
<ToggleGroupItem className="rounded-none border-x-0" value="potrait">
|
|
187
|
-
<FileImage />
|
|
188
|
-
</ToggleGroupItem>
|
|
189
|
-
<ToggleGroupItem className='rounded-s-none' value="icon">
|
|
190
|
-
<Square />
|
|
191
|
-
</ToggleGroupItem>
|
|
192
|
-
</ToggleGroup>
|
|
193
|
-
</div>
|
|
194
|
-
<div className='flex flex-col lg:flex-row gap-3 justify-between'>
|
|
195
|
-
<ToggleGroup type="single" variant='outline' value="" onValueChange={(value) => setRotationAngle(parseInt(value))}>
|
|
196
|
-
<ToggleGroupItem className="rounded-e-none" value="90">
|
|
197
|
-
<RotateCw />
|
|
198
|
-
</ToggleGroupItem>
|
|
199
|
-
<ToggleGroupItem className='rounded-s-none border-s-0' value="-90">
|
|
200
|
-
<RotateCcw />
|
|
201
|
-
</ToggleGroupItem>
|
|
202
|
-
</ToggleGroup>
|
|
203
|
-
<ToggleGroup type="single" variant='outline' value=''>
|
|
204
|
-
<ToggleGroupItem className="rounded-e-none" value="up" onClick={() => setMoveDirection({ x: 0, y: -5 })}>
|
|
205
|
-
<ArrowUp />
|
|
206
|
-
</ToggleGroupItem>
|
|
207
|
-
<ToggleGroupItem className="rounded-none border-x-0" value="down" onClick={() => setMoveDirection({ x: 0, y: 5 })}>
|
|
208
|
-
<ArrowDown />
|
|
209
|
-
</ToggleGroupItem>
|
|
210
|
-
<ToggleGroupItem className='rounded-none border-e-0' value="left" onClick={() => setMoveDirection({ x: -5, y: 0 })}>
|
|
211
|
-
<ArrowLeft />
|
|
212
|
-
</ToggleGroupItem>
|
|
213
|
-
<ToggleGroupItem className='rounded-s-none' value="right" onClick={() => setMoveDirection({ x: 5, y: 0 })}>
|
|
214
|
-
<ArrowRight />
|
|
215
|
-
</ToggleGroupItem>
|
|
216
|
-
</ToggleGroup>
|
|
217
|
-
<ToggleGroup type="single" variant='outline' value="" onValueChange={(value) => setScale(pre => pre + parseFloat(value))} >
|
|
218
|
-
<ToggleGroupItem className="rounded-e-none" value="0.1">
|
|
219
|
-
<ZoomIn />
|
|
220
|
-
</ToggleGroupItem>
|
|
221
|
-
<ToggleGroupItem className='rounded-s-none border-s-0' value="-0.1">
|
|
222
|
-
<ZoomOut />
|
|
223
|
-
</ToggleGroupItem>
|
|
224
|
-
</ToggleGroup>
|
|
225
|
-
</div>
|
|
226
|
-
</div>
|
|
227
|
-
|
|
228
|
-
</div>
|
|
229
|
-
{/* Image Previews */}
|
|
230
|
-
<div className="flex flex-row lg:flex-col gap-3 w-full lg:w-48">
|
|
231
|
-
<div className='w-5/5'>
|
|
232
|
-
{getImagePreview("landscape")}
|
|
233
|
-
</div>
|
|
234
|
-
<div className='w-4/5'>
|
|
235
|
-
{getImagePreview("potrait")}
|
|
236
|
-
</div>
|
|
237
|
-
<div className='w-3/5'>
|
|
238
|
-
{getImagePreview("icon")}
|
|
239
|
-
</div>
|
|
240
|
-
</div>
|
|
241
|
-
</div>
|
|
242
|
-
|
|
243
|
-
</div >
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
</>
|
|
247
|
-
)
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
export const CropperForm = memo(CropperFormComponent)
|
package/templates/default/ikoncomponents/image-cropper-upload/cropper-form-with-modal/index.tsx
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '../../../shadcn/dialog'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import { CropperForm } from '../cropper-form'
|
|
4
|
-
import { TextButton } from '../../buttons'
|
|
5
|
-
import { AspectRatioWiseImagesProps, OriginalImageProps, useImageCropper } from '..'
|
|
6
|
-
|
|
7
|
-
export function CropperFormWithModal
|
|
8
|
-
({ open, onOpenChange, onCropperChange }:
|
|
9
|
-
Readonly<{ open: boolean, onOpenChange: (open: boolean) => void, onCropperChange: (originalImage: OriginalImageProps, aspectRatioWiseImages: AspectRatioWiseImagesProps) => void }>) {
|
|
10
|
-
const { originalImage, aspectRatioWiseImages } = useImageCropper();
|
|
11
|
-
return (
|
|
12
|
-
<Dialog modal open={open} onOpenChange={(isOpen) => {
|
|
13
|
-
onOpenChange(isOpen)
|
|
14
|
-
}}>
|
|
15
|
-
<DialogContent className="max-w-full lg:max-w-5xl max-h-full overflow-auto">
|
|
16
|
-
<DialogHeader>
|
|
17
|
-
<DialogTitle>Image to upload</DialogTitle>
|
|
18
|
-
</DialogHeader>
|
|
19
|
-
<CropperForm />
|
|
20
|
-
<DialogFooter>
|
|
21
|
-
<TextButton onClick={() => {
|
|
22
|
-
onCropperChange(originalImage, aspectRatioWiseImages)
|
|
23
|
-
onOpenChange(false);
|
|
24
|
-
}}>
|
|
25
|
-
Save Changes
|
|
26
|
-
</TextButton>
|
|
27
|
-
</DialogFooter>
|
|
28
|
-
</DialogContent>
|
|
29
|
-
</Dialog>
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
|