@liorian/sdk 0.28.0-alpha.56010ca
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/README.md +483 -0
- package/package.json +94 -0
- package/schemas/module.schema.json +818 -0
- package/src/application/index.ts +3 -0
- package/src/application/module-instance.ts +36 -0
- package/src/application/service/auth-api-service.ts +291 -0
- package/src/application/service/auth-user.service.ts +108 -0
- package/src/application/service/index.ts +12 -0
- package/src/application/service/module-activation-api.service.ts +105 -0
- package/src/application/service/notifications-api-service.ts +38 -0
- package/src/application/service/notifications-push.service.ts +299 -0
- package/src/application/service/notifications-socket-service.ts +76 -0
- package/src/application/service/organizations-api-service.ts +104 -0
- package/src/application/service/otp-api-service.ts +11 -0
- package/src/application/service/storage-api-service.ts +77 -0
- package/src/application/service/storefront-api.service.ts +72 -0
- package/src/application/service/user-preferences-api.service.ts +57 -0
- package/src/domain/config/app.config.ts +35 -0
- package/src/domain/config/auth.config.ts +30 -0
- package/src/domain/config/index.ts +4 -0
- package/src/domain/config/logo.config.ts +17 -0
- package/src/domain/entities/activities.interface.ts +18 -0
- package/src/domain/entities/catalog.interface.ts +96 -0
- package/src/domain/entities/index.ts +13 -0
- package/src/domain/entities/media.ts +22 -0
- package/src/domain/entities/module-activation.interface.ts +173 -0
- package/src/domain/entities/module.interface.ts +101 -0
- package/src/domain/entities/notification.interface.ts +23 -0
- package/src/domain/entities/objectable.type.ts +3 -0
- package/src/domain/entities/organization.interface.ts +81 -0
- package/src/domain/entities/user-auth.interface.ts +17 -0
- package/src/domain/entities/user-phone.interface.ts +11 -0
- package/src/domain/entities/user-profile.interface.ts +23 -0
- package/src/domain/entities/user.interface.ts +79 -0
- package/src/domain/enums/coloring.enum.ts +6 -0
- package/src/domain/enums/domains.enum.ts +282 -0
- package/src/domain/enums/index.ts +8 -0
- package/src/domain/enums/module-category.enum.ts +57 -0
- package/src/domain/enums/module.enum.ts +97 -0
- package/src/domain/enums/routine.enum.ts +12 -0
- package/src/domain/enums/user-profile.enum.ts +25 -0
- package/src/domain/enums/user-status.enum.ts +7 -0
- package/src/domain/index.ts +6 -0
- package/src/domain/typing/auth-caches.ts +12 -0
- package/src/domain/typing/auth-oauth.types.ts +172 -0
- package/src/domain/typing/devise.ts +2 -0
- package/src/domain/typing/index.ts +10 -0
- package/src/domain/typing/response.ts +30 -0
- package/src/domain/typing/routine.types.ts +113 -0
- package/src/domain/typing/session.interface.ts +28 -0
- package/src/domain/typing/statisticals.ts +11 -0
- package/src/domain/typing/user-media-upload.ts +9 -0
- package/src/domain/typing/values.ts +6 -0
- package/src/index.tsx +168 -0
- package/src/infrastructure/capabilities/cache-storage/capability.ts +129 -0
- package/src/infrastructure/capabilities/cache-storage/enum.ts +5 -0
- package/src/infrastructure/capabilities/cache-storage/index.ts +4 -0
- package/src/infrastructure/capabilities/cache-storage/types.ts +13 -0
- package/src/infrastructure/capabilities/index.ts +3 -0
- package/src/infrastructure/capabilities/stackable/capability.ts +55 -0
- package/src/infrastructure/capabilities/stackable/index.ts +3 -0
- package/src/infrastructure/capabilities/stackable/types.ts +24 -0
- package/src/infrastructure/common-classname.constant.ts +4 -0
- package/src/infrastructure/data/countries.ts +208 -0
- package/src/infrastructure/data/gender.ts +5 -0
- package/src/infrastructure/data/index.ts +3 -0
- package/src/infrastructure/dataset/index.ts +3 -0
- package/src/infrastructure/dataset/sign-in.dataset.ts +21 -0
- package/src/infrastructure/dataset/sign-up.dataset.ts +64 -0
- package/src/infrastructure/hooks/index.ts +10 -0
- package/src/infrastructure/hooks/use-activity-lock-draft.ts +69 -0
- package/src/infrastructure/hooks/use-auth.ts +24 -0
- package/src/infrastructure/hooks/use-elastic-interaction.ts +180 -0
- package/src/infrastructure/hooks/use-is-desktop.ts +25 -0
- package/src/infrastructure/hooks/use-is-tauri.ts +17 -0
- package/src/infrastructure/hooks/use-mobile.ts +19 -0
- package/src/infrastructure/hooks/use-notifications.ts +128 -0
- package/src/infrastructure/hooks/use-recent-colors.ts +113 -0
- package/src/infrastructure/hooks/use-recent-modules.ts +76 -0
- package/src/infrastructure/index.tsx +11 -0
- package/src/infrastructure/library/design-system.ts +95 -0
- package/src/infrastructure/library/index.tsx +5 -0
- package/src/infrastructure/library/motion-utils.ts +77 -0
- package/src/infrastructure/library/motion.tsx +31 -0
- package/src/infrastructure/library/scroll-progress.tsx +93 -0
- package/src/infrastructure/providers/auth-guard.provider.tsx +47 -0
- package/src/infrastructure/providers/auth.provider.tsx +168 -0
- package/src/infrastructure/providers/index.tsx +8 -0
- package/src/infrastructure/providers/module-usage.provider.tsx +95 -0
- package/src/infrastructure/providers/modules-guard.provider.tsx +64 -0
- package/src/infrastructure/providers/modules-routines.provider.tsx +33 -0
- package/src/infrastructure/providers/modules-switcher.provider.tsx +25 -0
- package/src/infrastructure/providers/query.provider.tsx +27 -0
- package/src/infrastructure/routines/__tests__/routine.test.ts +368 -0
- package/src/infrastructure/routines/index.tsx +3 -0
- package/src/infrastructure/routines/routine.hook.ts +121 -0
- package/src/infrastructure/routines/routine.ts +283 -0
- package/src/infrastructure/routines/routine.tsx +283 -0
- package/src/infrastructure/stores/activity-lock.store.ts +22 -0
- package/src/infrastructure/stores/auth-user-connected.store.ts +24 -0
- package/src/infrastructure/stores/dataset.store.ts +106 -0
- package/src/infrastructure/stores/index.ts +6 -0
- package/src/infrastructure/stores/module.store.ts +266 -0
- package/src/infrastructure/stores/upload.store.ts +198 -0
- package/src/infrastructure/utilities/access-label.util.ts +158 -0
- package/src/infrastructure/utilities/activities.util.tsx +54 -0
- package/src/infrastructure/utilities/activity-lock.service.ts +263 -0
- package/src/infrastructure/utilities/activity-tracker.service.ts +205 -0
- package/src/infrastructure/utilities/api-service.ts +237 -0
- package/src/infrastructure/utilities/auth-logout.util.ts +23 -0
- package/src/infrastructure/utilities/classname.util.ts +7 -0
- package/src/infrastructure/utilities/encryption.service.ts +125 -0
- package/src/infrastructure/utilities/form-snapshot.service.ts +304 -0
- package/src/infrastructure/utilities/format.util.ts +40 -0
- package/src/infrastructure/utilities/index.tsx +23 -0
- package/src/infrastructure/utilities/media-label.service.ts +47 -0
- package/src/infrastructure/utilities/modules.ts +11 -0
- package/src/infrastructure/utilities/permission.util.ts +22 -0
- package/src/infrastructure/utilities/push-permission.util.ts +43 -0
- package/src/infrastructure/utilities/route-access.ts +38 -0
- package/src/infrastructure/utilities/socket-service.ts +123 -0
- package/src/infrastructure/utilities/sso-auth.util.ts +188 -0
- package/src/infrastructure/utilities/stringable.util.ts +16 -0
- package/src/infrastructure/utilities/strings.util.ts +18 -0
- package/src/infrastructure/utilities/tauri.util.ts +15 -0
- package/src/infrastructure/utilities/utils.ts +6 -0
- package/src/infrastructure/utilities/values.ts +5 -0
- package/src/presentation/8starlabs-ui/button.tsx +94 -0
- package/src/presentation/8starlabs-ui/flip-clock.tsx +368 -0
- package/src/presentation/8starlabs-ui/heatmap.tsx +430 -0
- package/src/presentation/8starlabs-ui/hooks/index.tsx +2 -0
- package/src/presentation/8starlabs-ui/hooks/use-mobile.ts +21 -0
- package/src/presentation/8starlabs-ui/index.tsx +20 -0
- package/src/presentation/8starlabs-ui/json-viewer.tsx +972 -0
- package/src/presentation/8starlabs-ui/marquee.tsx +134 -0
- package/src/presentation/8starlabs-ui/partition-bar.tsx +198 -0
- package/src/presentation/8starlabs-ui/scroll-fade.tsx +158 -0
- package/src/presentation/8starlabs-ui/status-indicator.tsx +86 -0
- package/src/presentation/8starlabs-ui/system-banner.tsx +50 -0
- package/src/presentation/8starlabs-ui/timeline.tsx +576 -0
- package/src/presentation/8starlabs-ui/transport-badge.tsx +249 -0
- package/src/presentation/8starlabs-ui/ui/copy-button.tsx +60 -0
- package/src/presentation/8starlabs-ui/ui/index.tsx +2 -0
- package/src/presentation/analytics-section.tsx +85 -0
- package/src/presentation/app-sidebar.tsx +234 -0
- package/src/presentation/charts/area-widget.chart-skeleton.tsx +61 -0
- package/src/presentation/charts/area-widget.chart.tsx +128 -0
- package/src/presentation/charts/chart-widgets.types.ts +81 -0
- package/src/presentation/charts/index.tsx +16 -0
- package/src/presentation/charts/line-widget.chart-skeleton.tsx +64 -0
- package/src/presentation/charts/line-widget.chart.tsx +105 -0
- package/src/presentation/charts/pie-widget.chart-skeleton.tsx +56 -0
- package/src/presentation/charts/pie-widget.chart.tsx +168 -0
- package/src/presentation/charts/radar-widget.chart-skeleton.tsx +67 -0
- package/src/presentation/charts/radar-widget.chart.tsx +80 -0
- package/src/presentation/charts/radial-stacked-widget.chart-skeleton.tsx +66 -0
- package/src/presentation/charts/radial-stacked-widget.chart.tsx +120 -0
- package/src/presentation/charts/radial-widget.chart-skeleton.tsx +61 -0
- package/src/presentation/charts/radial-widget.chart.tsx +87 -0
- package/src/presentation/charts/tooltip-widget.chart-skeleton.tsx +64 -0
- package/src/presentation/charts/tooltip-widget.chart.tsx +89 -0
- package/src/presentation/components/activity-actions.tsx +20 -0
- package/src/presentation/components/activity-container.tsx +55 -0
- package/src/presentation/components/activity-content.tsx +20 -0
- package/src/presentation/components/activity-descriptor-parser.tsx +37 -0
- package/src/presentation/components/activity-header.tsx +20 -0
- package/src/presentation/components/activity-loader.tsx +19 -0
- package/src/presentation/components/activity-title.tsx +32 -0
- package/src/presentation/components/activity.tsx +22 -0
- package/src/presentation/components/auth/index.tsx +4 -0
- package/src/presentation/components/auth/sso-callback.view.tsx +44 -0
- package/src/presentation/components/auth/sso-disconnect.view.tsx +41 -0
- package/src/presentation/components/auth/sso-sign-in.view.tsx +29 -0
- package/src/presentation/components/auth-lock-screen.tsx +309 -0
- package/src/presentation/components/auth-session.view.tsx +17 -0
- package/src/presentation/components/data-table.tsx +814 -0
- package/src/presentation/components/dynamic-icon.tsx +16 -0
- package/src/presentation/components/floating-upload.tsx +291 -0
- package/src/presentation/components/index.tsx +40 -0
- package/src/presentation/components/local-time.tsx +170 -0
- package/src/presentation/components/markdown-parser.tsx +201 -0
- package/src/presentation/components/message-scroller.tsx +131 -0
- package/src/presentation/components/module-first-access-config.view.tsx +181 -0
- package/src/presentation/components/module-first-access-pending.view.tsx +38 -0
- package/src/presentation/components/module-guard.tsx +34 -0
- package/src/presentation/components/modules-first-access.guard.tsx +88 -0
- package/src/presentation/components/modules-guard-forbidden.tsx +46 -0
- package/src/presentation/components/notification-details.modal.tsx +145 -0
- package/src/presentation/components/notification-item.tsx +127 -0
- package/src/presentation/components/notifications-popover.tsx +128 -0
- package/src/presentation/components/push-notifications.provider.tsx +65 -0
- package/src/presentation/components/upload-progress-dialog.tsx +140 -0
- package/src/presentation/components/waiting-bar.tsx +22 -0
- package/src/presentation/components/waiting-section.tsx +15 -0
- package/src/presentation/components/waiting.tsx +14 -0
- package/src/presentation/data-grid/data-grid-empty.tsx +24 -0
- package/src/presentation/data-grid/data-grid-search-engine.tsx +32 -0
- package/src/presentation/data-grid/data-grid.tsx +892 -0
- package/src/presentation/data-grid/index.tsx +4 -0
- package/src/presentation/form-screen.tsx +95 -0
- package/src/presentation/icons/custom.tsx +20 -0
- package/src/presentation/icons/glyphIcons.tsx +53 -0
- package/src/presentation/icons/icons.enum.ts +4 -0
- package/src/presentation/icons/icons.util.ts +6 -0
- package/src/presentation/icons/index.tsx +8 -0
- package/src/presentation/icons/lucide.tsx +17 -0
- package/src/presentation/icons/remix.tsx +33 -0
- package/src/presentation/icons/types.ts +27 -0
- package/src/presentation/index.tsx +45 -0
- package/src/presentation/modals/components/ModalBox.tsx +74 -0
- package/src/presentation/modals/components/ModalPortal.tsx +31 -0
- package/src/presentation/modals/components/ModalStepper.tsx +319 -0
- package/src/presentation/modals/components/ModalWrapper.tsx +65 -0
- package/src/presentation/modals/components/index.tsx +5 -0
- package/src/presentation/modals/hooks/index.ts +2 -0
- package/src/presentation/modals/hooks/useModal.ts +38 -0
- package/src/presentation/modals/index.tsx +5 -0
- package/src/presentation/modals/stores/index.ts +2 -0
- package/src/presentation/modals/stores/useModalStore.ts +90 -0
- package/src/presentation/modals/types/index.ts +2 -0
- package/src/presentation/modals/types/modal.type.ts +33 -0
- package/src/presentation/module-menubar.tsx +300 -0
- package/src/presentation/module-widget.tsx +233 -0
- package/src/presentation/nav-documents.tsx +89 -0
- package/src/presentation/nav-main.tsx +62 -0
- package/src/presentation/nav-secondary.tsx +41 -0
- package/src/presentation/nav-user.tsx +109 -0
- package/src/presentation/permission-action-badge.tsx +35 -0
- package/src/presentation/reui/index.tsx +3 -0
- package/src/presentation/reui/stepper.tsx +508 -0
- package/src/presentation/reui/timeline.tsx +226 -0
- package/src/presentation/sheets/index.tsx +2 -0
- package/src/presentation/sheets/legacy-sheet-header.tsx +0 -0
- package/src/presentation/sheets/legacy-sheet.tsx +37 -0
- package/src/presentation/size.enum.ts +19 -0
- package/src/presentation/system/index.tsx +3 -0
- package/src/presentation/system/logo.theme.tsx +21 -0
- package/src/presentation/system/types.ts +10 -0
- package/src/presentation/theme/index.tsx +6 -0
- package/src/presentation/theme/prefer-color-scheme.tsx +50 -0
- package/src/presentation/theme/switch-color-scheme.tsx +16 -0
- package/src/presentation/theme/theme-switcher-button.tsx +20 -0
- package/src/presentation/theme/theme.enum.ts +4 -0
- package/src/presentation/theme/theme.store.ts +87 -0
- package/src/presentation/themes/index.tsx +2 -0
- package/src/presentation/themes/katon/dashboard-layout.tsx +1080 -0
- package/src/presentation/themes/katon/edge-section.tsx +19 -0
- package/src/presentation/themes/katon/header-menubar.tsx +270 -0
- package/src/presentation/themes/katon/header-modules-available.tsx +44 -0
- package/src/presentation/themes/katon/header-modules-recents.tsx +52 -0
- package/src/presentation/themes/katon/header-modules-store.tsx +25 -0
- package/src/presentation/themes/katon/header-options.tsx +13 -0
- package/src/presentation/themes/katon/header-organization-select.tsx +146 -0
- package/src/presentation/themes/katon/header-routines.tsx +74 -0
- package/src/presentation/themes/katon/header-tasks-connected-user.tsx +150 -0
- package/src/presentation/themes/katon/index.tsx +16 -0
- package/src/presentation/themes/katon/main-wrapper.tsx +34 -0
- package/src/presentation/themes/katon/module-item-link.tsx +32 -0
- package/src/presentation/themes/katon/view-frame.tsx +25 -0
- package/src/presentation/themes/katon/view-helmet.tsx +53 -0
- package/src/presentation/themes/katon/view-status.tsx +32 -0
- package/src/presentation/themes/katon/view-wrapper.tsx +15 -0
- package/src/presentation/themes/katon/view.tsx +42 -0
- package/src/presentation/ui/accordion-multiselect.tsx +206 -0
- package/src/presentation/ui/accordion.tsx +81 -0
- package/src/presentation/ui/alert-dialog.tsx +199 -0
- package/src/presentation/ui/alert.tsx +76 -0
- package/src/presentation/ui/aspect-ratio.tsx +11 -0
- package/src/presentation/ui/attachment.tsx +204 -0
- package/src/presentation/ui/avatar.tsx +112 -0
- package/src/presentation/ui/badge.tsx +49 -0
- package/src/presentation/ui/breadcrumb.tsx +122 -0
- package/src/presentation/ui/bubble.tsx +125 -0
- package/src/presentation/ui/button-group.tsx +83 -0
- package/src/presentation/ui/button.tsx +87 -0
- package/src/presentation/ui/calendar.tsx +222 -0
- package/src/presentation/ui/card.tsx +106 -0
- package/src/presentation/ui/carousel.tsx +242 -0
- package/src/presentation/ui/chart.tsx +373 -0
- package/src/presentation/ui/checkbox.tsx +33 -0
- package/src/presentation/ui/clickable.tsx +58 -0
- package/src/presentation/ui/collapsible.tsx +33 -0
- package/src/presentation/ui/color-swatch-selector.tsx +81 -0
- package/src/presentation/ui/combobox.tsx +299 -0
- package/src/presentation/ui/command.tsx +195 -0
- package/src/presentation/ui/context-menu.tsx +263 -0
- package/src/presentation/ui/dialog.tsx +168 -0
- package/src/presentation/ui/direction.tsx +22 -0
- package/src/presentation/ui/drawer.tsx +134 -0
- package/src/presentation/ui/dropdown-menu.tsx +269 -0
- package/src/presentation/ui/empty.tsx +104 -0
- package/src/presentation/ui/field.tsx +238 -0
- package/src/presentation/ui/granularity-selector.tsx +58 -0
- package/src/presentation/ui/hover-card.tsx +44 -0
- package/src/presentation/ui/index.tsx +74 -0
- package/src/presentation/ui/input-group.tsx +156 -0
- package/src/presentation/ui/input-otp.tsx +87 -0
- package/src/presentation/ui/input.tsx +19 -0
- package/src/presentation/ui/item.tsx +196 -0
- package/src/presentation/ui/kpi-card.tsx +203 -0
- package/src/presentation/ui/label-selector.tsx +100 -0
- package/src/presentation/ui/label.tsx +24 -0
- package/src/presentation/ui/legacy-birth-date-input.tsx +43 -0
- package/src/presentation/ui/legacy-color-picker/index.tsx +42 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.content.tsx +37 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.context.tsx +42 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.hex-input.tsx +97 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.picker.tsx +266 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.presets.ts +22 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.quick-list.tsx +49 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.recent.tsx +43 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.swatches.tsx +111 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.trigger.tsx +128 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.tsx +110 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.types.ts +1 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.utils.ts +114 -0
- package/src/presentation/ui/legacy-country-input.tsx +171 -0
- package/src/presentation/ui/legacy-gender-input.tsx +22 -0
- package/src/presentation/ui/legacy-input.tsx +106 -0
- package/src/presentation/ui/legacy-phone-input.tsx +213 -0
- package/src/presentation/ui/legacy-select-input.tsx +114 -0
- package/src/presentation/ui/legacy-text-area.tsx +111 -0
- package/src/presentation/ui/list-items.tsx +59 -0
- package/src/presentation/ui/marker.tsx +69 -0
- package/src/presentation/ui/media-player/index.tsx +12 -0
- package/src/presentation/ui/media-player/media-player.context.tsx +36 -0
- package/src/presentation/ui/media-player/media-player.tsx +167 -0
- package/src/presentation/ui/media-player/player-controls.tsx +207 -0
- package/src/presentation/ui/media-player/players/audio-player.tsx +78 -0
- package/src/presentation/ui/media-player/players/index.tsx +4 -0
- package/src/presentation/ui/media-player/players/video-player.tsx +193 -0
- package/src/presentation/ui/media-player/players/voice-note-player.tsx +108 -0
- package/src/presentation/ui/media-player/use-media-player.hook.ts +263 -0
- package/src/presentation/ui/menubar.tsx +281 -0
- package/src/presentation/ui/message.tsx +92 -0
- package/src/presentation/ui/navigation-menu.tsx +172 -0
- package/src/presentation/ui/pagination.tsx +129 -0
- package/src/presentation/ui/popover.tsx +89 -0
- package/src/presentation/ui/progress.tsx +31 -0
- package/src/presentation/ui/resizable.tsx +50 -0
- package/src/presentation/ui/select.tsx +192 -0
- package/src/presentation/ui/separator.tsx +28 -0
- package/src/presentation/ui/sheet.tsx +147 -0
- package/src/presentation/ui/sidebar.tsx +702 -0
- package/src/presentation/ui/skeleton.tsx +13 -0
- package/src/presentation/ui/slide-to-confirm.tsx +129 -0
- package/src/presentation/ui/slider.tsx +59 -0
- package/src/presentation/ui/sonner.tsx +58 -0
- package/src/presentation/ui/switch.tsx +33 -0
- package/src/presentation/ui/table.tsx +116 -0
- package/src/presentation/ui/tabs.tsx +90 -0
- package/src/presentation/ui/text-gradient.tsx +84 -0
- package/src/presentation/ui/textarea.tsx +18 -0
- package/src/presentation/ui/timeline-steps.tsx +235 -0
- package/src/presentation/ui/toggle-group.tsx +89 -0
- package/src/presentation/ui/toggle.tsx +47 -0
- package/src/presentation/ui/tooltip.tsx +57 -0
- package/src/presentation/uploading/index.tsx +3 -0
- package/src/presentation/uploading/media-upload-field.tsx +152 -0
- package/src/presentation/uploading/storage-media.tsx +210 -0
- package/src/styles.css +403 -0
- package/src/themes.css +1038 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Menubar,
|
|
3
|
+
MenubarContent,
|
|
4
|
+
MenubarItem,
|
|
5
|
+
MenubarMenu,
|
|
6
|
+
MenubarSeparator,
|
|
7
|
+
MenubarSub,
|
|
8
|
+
MenubarSubContent,
|
|
9
|
+
MenubarSubTrigger,
|
|
10
|
+
MenubarTrigger
|
|
11
|
+
} from "./ui/menubar";
|
|
12
|
+
import {
|
|
13
|
+
ModuleDeclarationInterface,
|
|
14
|
+
ModuleNavigationMenuItem,
|
|
15
|
+
ModuleNavigationMenuSeparator
|
|
16
|
+
} from "../domain/entities/module.interface";
|
|
17
|
+
import {LucideIcon} from "./icons/lucide";
|
|
18
|
+
import {
|
|
19
|
+
Sheet,
|
|
20
|
+
SheetContent,
|
|
21
|
+
SheetHeader,
|
|
22
|
+
SheetTitle,
|
|
23
|
+
SheetTrigger
|
|
24
|
+
} from "./ui/sheet";
|
|
25
|
+
import {
|
|
26
|
+
Accordion,
|
|
27
|
+
AccordionContent,
|
|
28
|
+
AccordionItem,
|
|
29
|
+
AccordionTrigger
|
|
30
|
+
} from "./ui/accordion";
|
|
31
|
+
import {Button} from "./ui/button";
|
|
32
|
+
import {MenuIcon} from "lucide-react";
|
|
33
|
+
import {useState} from "react";
|
|
34
|
+
import {useRouter, usePathname} from "next/navigation";
|
|
35
|
+
import {AppRouterInstance} from "next/dist/shared/lib/app-router-context.shared-runtime";
|
|
36
|
+
import {cn} from "../infrastructure/utilities/utils";
|
|
37
|
+
import {NavigationMenuSize} from "./themes/katon/header-menubar";
|
|
38
|
+
|
|
39
|
+
const sizeMap: Record<NavigationMenuSize, { trigger: string; item: string; icon: number; mobileItem: string }> = {
|
|
40
|
+
xs: { trigger: "text-xs h-7 px-1.5 py-0", item: "text-xs px-2 py-1", icon: 3, mobileItem: "text-xs h-8" },
|
|
41
|
+
sm: { trigger: "text-xs h-8 px-2 py-0", item: "text-xs px-2.5 py-1.5", icon: 3, mobileItem: "text-sm h-9" },
|
|
42
|
+
md: { trigger: "text-sm h-9 px-2.5 py-0", item: "text-sm px-3 py-1.5", icon: 4, mobileItem: "text-sm h-10" },
|
|
43
|
+
lg: { trigger: "text-sm h-10 px-3.5 py-0", item: "text-sm px-3.5 py-2", icon: 4, mobileItem: "text-base h-11" },
|
|
44
|
+
xl: { trigger: "text-base h-11 px-4.5 py-0", item: "text-base px-4 py-2", icon: 5, mobileItem: "text-base h-12" },
|
|
45
|
+
xxl: { trigger: "text-lg h-12 px-5 py-0", item: "text-lg px-5 py-2.5", icon: 5, mobileItem: "text-lg h-14" },
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const activeClasses = {
|
|
49
|
+
desktop: "cursor-pointer",
|
|
50
|
+
mobileAccordion: "text-primary",
|
|
51
|
+
mobileButton: "secondary" as const,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export interface ModuleMenubarProps {
|
|
55
|
+
module: ModuleDeclarationInterface;
|
|
56
|
+
size?: NavigationMenuSize;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function ModuleMenubar({module, size = 'md'}: ModuleMenubarProps) {
|
|
60
|
+
const router = useRouter();
|
|
61
|
+
const pathname = usePathname();
|
|
62
|
+
const [open, setOpen] = useState(false);
|
|
63
|
+
const s = sizeMap[size];
|
|
64
|
+
|
|
65
|
+
if (!module.menu) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const isItemActive = (item: ModuleNavigationMenuItem): boolean => {
|
|
70
|
+
if (item.url && pathname === item.url) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
if (item.items) {
|
|
74
|
+
return item.items.some((subItem) => {
|
|
75
|
+
if ('separator' in subItem) return false;
|
|
76
|
+
return isItemActive(subItem as ModuleNavigationMenuItem);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const handleItemAction = (item: ModuleNavigationMenuItem) => {
|
|
83
|
+
if (item.action) {
|
|
84
|
+
if (item.action.length > 0) {
|
|
85
|
+
(item.action as (router: AppRouterInstance) => void)(router);
|
|
86
|
+
} else {
|
|
87
|
+
void (item.action as () => void)();
|
|
88
|
+
}
|
|
89
|
+
} else if (item.url) {
|
|
90
|
+
router.push(item.url);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const renderItems = (items: (ModuleNavigationMenuItem | ModuleNavigationMenuSeparator)[]) => {
|
|
95
|
+
return items.map((item, index) => {
|
|
96
|
+
if ('separator' in item) {
|
|
97
|
+
return <MenubarSeparator key={`sep-${index}`}/>;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const itemWithItems = item as ModuleNavigationMenuItem;
|
|
101
|
+
const active = isItemActive(itemWithItems);
|
|
102
|
+
|
|
103
|
+
if (itemWithItems.items && itemWithItems.items.length > 0) {
|
|
104
|
+
return (
|
|
105
|
+
<MenubarSub key={itemWithItems.label}>
|
|
106
|
+
<MenubarSubTrigger className={cn(
|
|
107
|
+
"gap-2 rounded-sm",
|
|
108
|
+
s.item,
|
|
109
|
+
active && activeClasses.desktop,
|
|
110
|
+
active && 'hover:bg-transparent hover:text-foreground'
|
|
111
|
+
)}>
|
|
112
|
+
{itemWithItems.icon && <LucideIcon name={itemWithItems.icon} size={s.icon} className=""/>}
|
|
113
|
+
<span>{itemWithItems.label}</span>
|
|
114
|
+
{itemWithItems.items && itemWithItems.items.length > 0 && (
|
|
115
|
+
<LucideIcon name="chevron-down" size={s.icon - 1} className="ml-1 h-4 w-4" />
|
|
116
|
+
)}
|
|
117
|
+
</MenubarSubTrigger>
|
|
118
|
+
<MenubarSubContent>
|
|
119
|
+
{renderItems(itemWithItems.items)}
|
|
120
|
+
</MenubarSubContent>
|
|
121
|
+
</MenubarSub>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<MenubarItem
|
|
127
|
+
key={itemWithItems.label}
|
|
128
|
+
onClick={() => handleItemAction(itemWithItems)}
|
|
129
|
+
className={cn(
|
|
130
|
+
"gap-2 rounded-sm",
|
|
131
|
+
s.item,
|
|
132
|
+
active && activeClasses.desktop,
|
|
133
|
+
active && 'hover:bg-transparent hover:text-foreground'
|
|
134
|
+
)}
|
|
135
|
+
>
|
|
136
|
+
{itemWithItems.icon && <LucideIcon name={itemWithItems.icon} size={s.icon} className=""/>}
|
|
137
|
+
<span>{itemWithItems.label}</span>
|
|
138
|
+
{itemWithItems.items && itemWithItems.items.length > 0 && (
|
|
139
|
+
<LucideIcon name="chevron-down" size={s.icon - 1} className="ml-1 h-4 w-4" />
|
|
140
|
+
)}
|
|
141
|
+
</MenubarItem>
|
|
142
|
+
);
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const renderMobileItems = (items: (ModuleNavigationMenuItem | ModuleNavigationMenuSeparator)[]) => {
|
|
147
|
+
return items.map((item, index) => {
|
|
148
|
+
if ('separator' in item) {
|
|
149
|
+
return <div key={`sep-${index}`} className="my-2 border-b border-border/50"/>
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const itemWithItems = item as ModuleNavigationMenuItem;
|
|
153
|
+
const active = isItemActive(itemWithItems);
|
|
154
|
+
|
|
155
|
+
if (itemWithItems.items && itemWithItems.items.length > 0) {
|
|
156
|
+
return (
|
|
157
|
+
<AccordionItem key={itemWithItems.label} value={itemWithItems.label} className="border-none">
|
|
158
|
+
<AccordionTrigger className={cn(
|
|
159
|
+
"py-2 rounded-sm hover:no-underline",
|
|
160
|
+
s.mobileItem,
|
|
161
|
+
active && activeClasses.mobileAccordion
|
|
162
|
+
)}>
|
|
163
|
+
<div className="flex items-center gap-2">
|
|
164
|
+
{itemWithItems.icon && <LucideIcon name={itemWithItems.icon} size={s.icon}/>}
|
|
165
|
+
<span>{itemWithItems.label}</span>
|
|
166
|
+
{itemWithItems.items && itemWithItems.items.length > 0 && (
|
|
167
|
+
<LucideIcon name="chevron-down" size={s.icon - 1} className="ml-1 h-4 w-4" />
|
|
168
|
+
)}
|
|
169
|
+
</div>
|
|
170
|
+
</AccordionTrigger>
|
|
171
|
+
<AccordionContent>
|
|
172
|
+
<div className="pl-4 flex flex-col gap-1 border-l ml-2">
|
|
173
|
+
{renderMobileItems(itemWithItems.items)}
|
|
174
|
+
</div>
|
|
175
|
+
</AccordionContent>
|
|
176
|
+
</AccordionItem>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return (
|
|
181
|
+
<Button
|
|
182
|
+
key={itemWithItems.label}
|
|
183
|
+
variant={active ? activeClasses.mobileButton : "ghost"}
|
|
184
|
+
className={cn("w-full justify-start gap-2 px-2 font-semibold border-b", s.mobileItem)}
|
|
185
|
+
onClick={() => {
|
|
186
|
+
handleItemAction(itemWithItems);
|
|
187
|
+
setOpen(false);
|
|
188
|
+
}}
|
|
189
|
+
>
|
|
190
|
+
{itemWithItems.icon && <LucideIcon name={itemWithItems.icon} size={s.icon}/>}
|
|
191
|
+
<span>{itemWithItems.label}</span>
|
|
192
|
+
{itemWithItems.items && itemWithItems.items.length > 0 && (
|
|
193
|
+
<LucideIcon name="chevron-down" size={s.icon - 1} className="ml-1 h-4 w-4" />
|
|
194
|
+
)}
|
|
195
|
+
</Button>
|
|
196
|
+
);
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
return (
|
|
201
|
+
<>
|
|
202
|
+
<Menubar className="hidden md:flex border-none shadow-none bg-transparent px-1.5 animate-slide-in-down duration-150">
|
|
203
|
+
{module.menu.items.map((menu, index) => {
|
|
204
|
+
const active = isItemActive(menu);
|
|
205
|
+
return (
|
|
206
|
+
<MenubarMenu key={menu.label || index}>
|
|
207
|
+
<MenubarTrigger
|
|
208
|
+
className={cn(
|
|
209
|
+
"gap-2 rounded-sm",
|
|
210
|
+
s.trigger,
|
|
211
|
+
active && activeClasses.desktop,
|
|
212
|
+
active && 'hover:bg-transparent hover:text-foreground'
|
|
213
|
+
)}
|
|
214
|
+
{...(!menu.items?.length && menu.url ? {onClick: () => router.push(menu.url!)} : {})}
|
|
215
|
+
>
|
|
216
|
+
{menu.icon && <LucideIcon name={menu.icon} size={s.icon}/>}
|
|
217
|
+
{menu.label}
|
|
218
|
+
{menu.items && menu.items.length > 0 && (
|
|
219
|
+
<LucideIcon name="chevron-down" size={s.icon - 1} className="ml-1 h-4 w-4" />
|
|
220
|
+
)}
|
|
221
|
+
</MenubarTrigger>
|
|
222
|
+
{menu.items && menu.items.length > 0 && (
|
|
223
|
+
<MenubarContent className={"rounded-sm!"}>
|
|
224
|
+
{renderItems(menu.items)}
|
|
225
|
+
</MenubarContent>
|
|
226
|
+
)}
|
|
227
|
+
</MenubarMenu>
|
|
228
|
+
);
|
|
229
|
+
})}
|
|
230
|
+
</Menubar>
|
|
231
|
+
|
|
232
|
+
<Sheet open={open} onOpenChange={setOpen}>
|
|
233
|
+
<SheetTrigger asChild>
|
|
234
|
+
<Button variant="ghost" size="icon-sm" className="md:hidden">
|
|
235
|
+
<MenuIcon/>
|
|
236
|
+
</Button>
|
|
237
|
+
</SheetTrigger>
|
|
238
|
+
<SheetContent side="left"
|
|
239
|
+
className="w-[300px]! rounded-sm m-3 h-[92dvh]! px-6 bg-background/70 backdrop-blur-lg">
|
|
240
|
+
<SheetHeader className="pb-4">
|
|
241
|
+
<SheetTitle className="flex items-center gap-2">
|
|
242
|
+
<LucideIcon name={module.icon} size={5}/>
|
|
243
|
+
{module.name}
|
|
244
|
+
</SheetTitle>
|
|
245
|
+
</SheetHeader>
|
|
246
|
+
<div className="py-4 overflow-y-auto max-h-[calc(100vh-80px)]">
|
|
247
|
+
<Accordion type="multiple" className="w-full">
|
|
248
|
+
{module.menu.items.map((menu, index) => {
|
|
249
|
+
const active = isItemActive(menu);
|
|
250
|
+
if (menu.items && menu.items.length > 0) {
|
|
251
|
+
return (
|
|
252
|
+
<AccordionItem key={menu.label || index} value={menu.label || `item-${index}`}
|
|
253
|
+
className="border-b">
|
|
254
|
+
<AccordionTrigger className={cn(
|
|
255
|
+
"font-semibold hover:no-underline",
|
|
256
|
+
s.mobileItem,
|
|
257
|
+
active && activeClasses.mobileAccordion
|
|
258
|
+
)}>
|
|
259
|
+
<div className="flex items-center gap-2">
|
|
260
|
+
{menu.icon && <LucideIcon name={menu.icon} size={s.icon}/>}
|
|
261
|
+
<span>{menu.label}</span>
|
|
262
|
+
{menu.items && menu.items.length > 0 && (
|
|
263
|
+
<LucideIcon name="chevron-down" size={s.icon - 1} className="ml-1 h-4 w-4" />
|
|
264
|
+
)}
|
|
265
|
+
</div>
|
|
266
|
+
</AccordionTrigger>
|
|
267
|
+
<AccordionContent>
|
|
268
|
+
<div className="flex flex-col gap-1 py-1">
|
|
269
|
+
{renderMobileItems(menu.items)}
|
|
270
|
+
</div>
|
|
271
|
+
</AccordionContent>
|
|
272
|
+
</AccordionItem>
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return (
|
|
277
|
+
<Button
|
|
278
|
+
key={menu.label || index}
|
|
279
|
+
variant={active ? activeClasses.mobileButton : "ghost"}
|
|
280
|
+
className={cn("w-full justify-start gap-2 px-0 font-semibold border-b rounded-sm", s.mobileItem)}
|
|
281
|
+
onClick={() => {
|
|
282
|
+
handleItemAction(menu);
|
|
283
|
+
setOpen(false);
|
|
284
|
+
}}
|
|
285
|
+
>
|
|
286
|
+
{menu.icon && <LucideIcon name={menu.icon} size={s.icon}/>}
|
|
287
|
+
<span>{menu.label}</span>
|
|
288
|
+
{menu.items && menu.items.length > 0 && (
|
|
289
|
+
<LucideIcon name="chevron-down" size={s.icon - 1} className="ml-1 h-4 w-4" />
|
|
290
|
+
)}
|
|
291
|
+
</Button>
|
|
292
|
+
);
|
|
293
|
+
})}
|
|
294
|
+
</Accordion>
|
|
295
|
+
</div>
|
|
296
|
+
</SheetContent>
|
|
297
|
+
</Sheet>
|
|
298
|
+
</>
|
|
299
|
+
)
|
|
300
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import {ReactNode} from "react"
|
|
5
|
+
import {
|
|
6
|
+
Card,
|
|
7
|
+
CardContent,
|
|
8
|
+
CardDescription,
|
|
9
|
+
CardHeader,
|
|
10
|
+
CardTitle,
|
|
11
|
+
CardFooter,
|
|
12
|
+
CardAction
|
|
13
|
+
} from "./ui/card"
|
|
14
|
+
import {StatisticalProps} from "../domain/typing/statisticals"
|
|
15
|
+
import {EqualIcon, TrendingDownIcon, TrendingUpIcon} from "lucide-react"
|
|
16
|
+
import {Badge} from "./ui/badge"
|
|
17
|
+
import {cn} from "../infrastructure/utilities/utils"
|
|
18
|
+
import {ListItems, ListItemType} from "./ui/list-items"
|
|
19
|
+
import {
|
|
20
|
+
AreaChartWidgetProps,
|
|
21
|
+
LineChartWidgetProps,
|
|
22
|
+
PieChartWidgetProps,
|
|
23
|
+
RadarChartWidgetProps,
|
|
24
|
+
RadialChartWidgetProps,
|
|
25
|
+
RadialStackedChartWidgetProps,
|
|
26
|
+
TooltipChartWidgetProps
|
|
27
|
+
} from "./charts/chart-widgets.types"
|
|
28
|
+
import {AreaWidgetChart} from "./charts/area-widget.chart"
|
|
29
|
+
import {LineWidgetChart} from "./charts/line-widget.chart"
|
|
30
|
+
import {PieWidgetChart} from "./charts/pie-widget.chart"
|
|
31
|
+
import {RadarWidgetChart} from "./charts/radar-widget.chart"
|
|
32
|
+
import {RadialWidgetChart} from "./charts/radial-widget.chart"
|
|
33
|
+
import {RadialStackedWidgetChart} from "./charts/radial-stacked-widget.chart"
|
|
34
|
+
import {TooltipWidgetChart} from "./charts/tooltip-widget.chart"
|
|
35
|
+
import {AreaWidgetChartSkeleton} from "./charts/area-widget.chart-skeleton"
|
|
36
|
+
import {LineWidgetChartSkeleton} from "./charts/line-widget.chart-skeleton"
|
|
37
|
+
import {PieWidgetChartSkeleton} from "./charts/pie-widget.chart-skeleton"
|
|
38
|
+
import {RadarWidgetChartSkeleton} from "./charts/radar-widget.chart-skeleton"
|
|
39
|
+
import {RadialWidgetChartSkeleton} from "./charts/radial-widget.chart-skeleton"
|
|
40
|
+
import {RadialStackedWidgetChartSkeleton} from "./charts/radial-stacked-widget.chart-skeleton"
|
|
41
|
+
import {TooltipWidgetChartSkeleton} from "./charts/tooltip-widget.chart-skeleton"
|
|
42
|
+
|
|
43
|
+
export type ChartProps =
|
|
44
|
+
| ({ variant: 'chart:area' } & AreaChartWidgetProps)
|
|
45
|
+
| ({ variant: 'chart:line' } & LineChartWidgetProps)
|
|
46
|
+
| ({ variant: 'chart:pie' } & PieChartWidgetProps)
|
|
47
|
+
| ({ variant: 'chart:radar' } & RadarChartWidgetProps)
|
|
48
|
+
| ({ variant: 'chart:radial' } & RadialChartWidgetProps)
|
|
49
|
+
| ({ variant: 'chart:radial-stacked' } & RadialStackedChartWidgetProps)
|
|
50
|
+
| ({ variant: 'chart:tooltip' } & TooltipChartWidgetProps);
|
|
51
|
+
|
|
52
|
+
export interface ModuleWidgetProps {
|
|
53
|
+
title?: ReactNode
|
|
54
|
+
description?: ReactNode
|
|
55
|
+
stats?: StatisticalProps[]
|
|
56
|
+
children?: ReactNode
|
|
57
|
+
footer?: ReactNode
|
|
58
|
+
actions?: ReactNode
|
|
59
|
+
items?: ListItemType
|
|
60
|
+
itemsHeader?: ReactNode
|
|
61
|
+
itemsFooter?: ReactNode
|
|
62
|
+
className?: string
|
|
63
|
+
contentClassName?: string;
|
|
64
|
+
loading?: boolean;
|
|
65
|
+
chartVariant?: 'default' | 'chart:pie' | 'chart:bar' | 'chart:line' | 'chart:area' | 'chart:radar' | 'chart:radial' | 'chart:tooltip' | 'chart:radial-stacked';
|
|
66
|
+
chart?: AreaChartWidgetProps | LineChartWidgetProps | PieChartWidgetProps | RadarChartWidgetProps | RadialChartWidgetProps | RadialStackedChartWidgetProps | TooltipChartWidgetProps;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function ModuleWidget(
|
|
70
|
+
{
|
|
71
|
+
title,
|
|
72
|
+
description,
|
|
73
|
+
stats,
|
|
74
|
+
children,
|
|
75
|
+
footer,
|
|
76
|
+
actions,
|
|
77
|
+
items,
|
|
78
|
+
itemsHeader,
|
|
79
|
+
itemsFooter,
|
|
80
|
+
className,
|
|
81
|
+
contentClassName,
|
|
82
|
+
loading,
|
|
83
|
+
chartVariant,
|
|
84
|
+
chart
|
|
85
|
+
}: ModuleWidgetProps) {
|
|
86
|
+
|
|
87
|
+
const renderChart = () => {
|
|
88
|
+
if (!chartVariant || chartVariant === 'default' || !chart) return null;
|
|
89
|
+
|
|
90
|
+
const commonProps = {
|
|
91
|
+
...chart,
|
|
92
|
+
hideCard: true
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
if (loading) {
|
|
96
|
+
const skeletonProps = {
|
|
97
|
+
hideCard: true,
|
|
98
|
+
title: chart.title,
|
|
99
|
+
description: chart.description,
|
|
100
|
+
footerTitle: chart.footerTitle,
|
|
101
|
+
footerDescription: chart.footerDescription,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
switch (chartVariant) {
|
|
105
|
+
case 'chart:area':
|
|
106
|
+
return <AreaWidgetChartSkeleton {...skeletonProps} />;
|
|
107
|
+
case 'chart:line':
|
|
108
|
+
return <LineWidgetChartSkeleton {...skeletonProps} />;
|
|
109
|
+
case 'chart:pie':
|
|
110
|
+
return <PieWidgetChartSkeleton {...skeletonProps} />;
|
|
111
|
+
case 'chart:radar':
|
|
112
|
+
return <RadarWidgetChartSkeleton {...skeletonProps} />;
|
|
113
|
+
case 'chart:radial':
|
|
114
|
+
return <RadialWidgetChartSkeleton {...skeletonProps} />;
|
|
115
|
+
case 'chart:radial-stacked':
|
|
116
|
+
return <RadialStackedWidgetChartSkeleton {...skeletonProps} />;
|
|
117
|
+
case 'chart:tooltip':
|
|
118
|
+
case 'chart:bar':
|
|
119
|
+
return <TooltipWidgetChartSkeleton {...skeletonProps} />;
|
|
120
|
+
default:
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
switch (chartVariant) {
|
|
126
|
+
case 'chart:area':
|
|
127
|
+
return <AreaWidgetChart {...commonProps as any} />;
|
|
128
|
+
case 'chart:line':
|
|
129
|
+
return <LineWidgetChart {...commonProps as any} />;
|
|
130
|
+
case 'chart:pie':
|
|
131
|
+
return <PieWidgetChart {...commonProps as any} />;
|
|
132
|
+
case 'chart:radar':
|
|
133
|
+
return <RadarWidgetChart {...commonProps as any} />;
|
|
134
|
+
case 'chart:radial':
|
|
135
|
+
return <RadialWidgetChart {...commonProps as any} />;
|
|
136
|
+
case 'chart:radial-stacked':
|
|
137
|
+
return <RadialStackedWidgetChart {...commonProps as any} />;
|
|
138
|
+
case 'chart:tooltip':
|
|
139
|
+
return <TooltipWidgetChart {...commonProps as any} />;
|
|
140
|
+
case 'chart:bar':
|
|
141
|
+
return <TooltipWidgetChart {...commonProps as any} />;
|
|
142
|
+
default:
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const chartContent = renderChart();
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<Card className={cn("@container/module-widget h-full min-h-[40dvh]", className)}>
|
|
151
|
+
{(title || description || actions) && (
|
|
152
|
+
<CardHeader>
|
|
153
|
+
<div className="flex flex-col gap-1">
|
|
154
|
+
{title && <CardTitle>{title}</CardTitle>}
|
|
155
|
+
{description && <CardDescription>{description}</CardDescription>}
|
|
156
|
+
</div>
|
|
157
|
+
{actions && <CardAction>{actions}</CardAction>}
|
|
158
|
+
</CardHeader>
|
|
159
|
+
)}
|
|
160
|
+
<CardContent className={cn("flex flex-col gap-4", contentClassName)}>
|
|
161
|
+
{stats && stats.length > 0 && (
|
|
162
|
+
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4 @md/module-widget:grid-cols-2">
|
|
163
|
+
{stats.map((stat, index) => (
|
|
164
|
+
<div key={index} className="flex flex-col gap-1">
|
|
165
|
+
{stat.label && (
|
|
166
|
+
<div className="text-xs font-medium text-muted-foreground uppercase tracking-wider">
|
|
167
|
+
{stat.label}
|
|
168
|
+
</div>
|
|
169
|
+
)}
|
|
170
|
+
<div className="text-2xl font-bold flex items-baseline gap-1">
|
|
171
|
+
{stat.amount.toLocaleString()}
|
|
172
|
+
{stat.devise && (
|
|
173
|
+
<span
|
|
174
|
+
className="text-xs font-normal text-muted-foreground">{stat.devise}</span>)}
|
|
175
|
+
{stat.trend !== undefined && (
|
|
176
|
+
<div className="flex items-center gap-2 mt-0.5">
|
|
177
|
+
<Badge
|
|
178
|
+
variant="outline"
|
|
179
|
+
className={cn(
|
|
180
|
+
"h-5 px-1 text-[10px] gap-0.5 border-transparent bg-muted/50",
|
|
181
|
+
stat.trend > 0
|
|
182
|
+
? "text-emerald-600 dark:text-emerald-400"
|
|
183
|
+
: (
|
|
184
|
+
stat.trend === 0 ?
|
|
185
|
+
"text-muted-foreground"
|
|
186
|
+
: "text-rose-600 dark:text-rose-400"
|
|
187
|
+
)
|
|
188
|
+
)}
|
|
189
|
+
>
|
|
190
|
+
{stat.trend > 0 ? (
|
|
191
|
+
<TrendingUpIcon className="size-3"/>
|
|
192
|
+
) : (
|
|
193
|
+
(
|
|
194
|
+
stat.trend === 0 ?
|
|
195
|
+
<EqualIcon className="size-3"/>
|
|
196
|
+
: <TrendingDownIcon className="size-3"/>
|
|
197
|
+
)
|
|
198
|
+
)}
|
|
199
|
+
{Math.abs(stat.trend)}%
|
|
200
|
+
</Badge>
|
|
201
|
+
{stat.description && (
|
|
202
|
+
<span
|
|
203
|
+
className="text-[10px] text-muted-foreground truncate">{stat.description}</span>
|
|
204
|
+
)}
|
|
205
|
+
</div>
|
|
206
|
+
)}
|
|
207
|
+
</div>
|
|
208
|
+
|
|
209
|
+
</div>
|
|
210
|
+
))}
|
|
211
|
+
</div>
|
|
212
|
+
)}
|
|
213
|
+
{chartContent && <div className="w-full pt-2">{chartContent}</div>}
|
|
214
|
+
{children}
|
|
215
|
+
</CardContent>
|
|
216
|
+
|
|
217
|
+
{items && (
|
|
218
|
+
<ListItems
|
|
219
|
+
items={items}
|
|
220
|
+
header={itemsHeader}
|
|
221
|
+
footer={itemsFooter}
|
|
222
|
+
className="border-t pt-2"
|
|
223
|
+
/>
|
|
224
|
+
)}
|
|
225
|
+
|
|
226
|
+
{footer && (
|
|
227
|
+
<CardFooter className="text-xs text-muted-foreground border-t bg-transparent py-3">
|
|
228
|
+
{footer}
|
|
229
|
+
</CardFooter>
|
|
230
|
+
)}
|
|
231
|
+
</Card>
|
|
232
|
+
)
|
|
233
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
DropdownMenu,
|
|
5
|
+
DropdownMenuContent,
|
|
6
|
+
DropdownMenuItem,
|
|
7
|
+
DropdownMenuSeparator,
|
|
8
|
+
DropdownMenuTrigger,
|
|
9
|
+
} from "./ui/dropdown-menu"
|
|
10
|
+
import {
|
|
11
|
+
SidebarGroup,
|
|
12
|
+
SidebarGroupLabel,
|
|
13
|
+
SidebarMenu,
|
|
14
|
+
SidebarMenuAction,
|
|
15
|
+
SidebarMenuButton,
|
|
16
|
+
SidebarMenuItem,
|
|
17
|
+
useSidebar,
|
|
18
|
+
} from "./ui/sidebar"
|
|
19
|
+
import { MoreHorizontalIcon, FolderIcon, ShareIcon, Trash2Icon } from "lucide-react"
|
|
20
|
+
|
|
21
|
+
export function NavDocuments({
|
|
22
|
+
items,
|
|
23
|
+
}: {
|
|
24
|
+
items: {
|
|
25
|
+
name: string
|
|
26
|
+
url: string
|
|
27
|
+
icon: React.ReactNode
|
|
28
|
+
}[]
|
|
29
|
+
}) {
|
|
30
|
+
const { isMobile } = useSidebar()
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<SidebarGroup className="group-data-[collapsible=icon]:hidden">
|
|
34
|
+
<SidebarGroupLabel>Bibliothèque</SidebarGroupLabel>
|
|
35
|
+
<SidebarMenu>
|
|
36
|
+
{items.map((item) => (
|
|
37
|
+
<SidebarMenuItem key={item.name}>
|
|
38
|
+
<SidebarMenuButton asChild>
|
|
39
|
+
<a href={item.url}>
|
|
40
|
+
{item.icon}
|
|
41
|
+
<span>{item.name}</span>
|
|
42
|
+
</a>
|
|
43
|
+
</SidebarMenuButton>
|
|
44
|
+
<DropdownMenu>
|
|
45
|
+
<DropdownMenuTrigger asChild>
|
|
46
|
+
<SidebarMenuAction
|
|
47
|
+
showOnHover
|
|
48
|
+
className="rounded-sm data-[state=open]:bg-accent"
|
|
49
|
+
>
|
|
50
|
+
<MoreHorizontalIcon
|
|
51
|
+
/>
|
|
52
|
+
<span className="sr-only">More</span>
|
|
53
|
+
</SidebarMenuAction>
|
|
54
|
+
</DropdownMenuTrigger>
|
|
55
|
+
<DropdownMenuContent
|
|
56
|
+
className="w-24 rounded-lg"
|
|
57
|
+
side={isMobile ? "bottom" : "right"}
|
|
58
|
+
align={isMobile ? "end" : "start"}
|
|
59
|
+
>
|
|
60
|
+
<DropdownMenuItem>
|
|
61
|
+
<FolderIcon
|
|
62
|
+
/>
|
|
63
|
+
<span>Open</span>
|
|
64
|
+
</DropdownMenuItem>
|
|
65
|
+
<DropdownMenuItem>
|
|
66
|
+
<ShareIcon
|
|
67
|
+
/>
|
|
68
|
+
<span>Share</span>
|
|
69
|
+
</DropdownMenuItem>
|
|
70
|
+
<DropdownMenuSeparator />
|
|
71
|
+
<DropdownMenuItem variant="destructive">
|
|
72
|
+
<Trash2Icon
|
|
73
|
+
/>
|
|
74
|
+
<span>Delete</span>
|
|
75
|
+
</DropdownMenuItem>
|
|
76
|
+
</DropdownMenuContent>
|
|
77
|
+
</DropdownMenu>
|
|
78
|
+
</SidebarMenuItem>
|
|
79
|
+
))}
|
|
80
|
+
{/*<SidebarMenuItem>*/}
|
|
81
|
+
{/* <SidebarMenuButton className="text-sidebar-foreground/70">*/}
|
|
82
|
+
{/* <MoreHorizontalIcon className="text-sidebar-foreground/70" />*/}
|
|
83
|
+
{/* <span>More</span>*/}
|
|
84
|
+
{/* </SidebarMenuButton>*/}
|
|
85
|
+
{/*</SidebarMenuItem>*/}
|
|
86
|
+
</SidebarMenu>
|
|
87
|
+
</SidebarGroup>
|
|
88
|
+
)
|
|
89
|
+
}
|