@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,128 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import {TrendingUp} from "lucide-react"
|
|
4
|
+
import {Area, AreaChart, CartesianGrid, XAxis} from "recharts"
|
|
5
|
+
import {
|
|
6
|
+
ChartConfig,
|
|
7
|
+
ChartContainer,
|
|
8
|
+
ChartLegend,
|
|
9
|
+
ChartLegendContent,
|
|
10
|
+
ChartTooltip,
|
|
11
|
+
ChartTooltipContent
|
|
12
|
+
} from "../ui/chart";
|
|
13
|
+
import {Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle} from "../ui/card";
|
|
14
|
+
import {AreaChartWidgetProps} from "./chart-widgets.types";
|
|
15
|
+
import {cn} from "../../infrastructure/utilities/utils";
|
|
16
|
+
|
|
17
|
+
export function AreaWidgetChart(
|
|
18
|
+
{
|
|
19
|
+
data,
|
|
20
|
+
config,
|
|
21
|
+
title,
|
|
22
|
+
description,
|
|
23
|
+
footerTitle,
|
|
24
|
+
footerDescription,
|
|
25
|
+
areas,
|
|
26
|
+
xAxisDataKey = "month",
|
|
27
|
+
xAxisFormatter,
|
|
28
|
+
showLegend = areas.length > 1,
|
|
29
|
+
className,
|
|
30
|
+
hideCard = false,
|
|
31
|
+
}: AreaChartWidgetProps
|
|
32
|
+
) {
|
|
33
|
+
const formatTick = (value: string) => {
|
|
34
|
+
if (xAxisFormatter) return xAxisFormatter(value)
|
|
35
|
+
return String(value ?? "").trim()
|
|
36
|
+
}
|
|
37
|
+
const content = (
|
|
38
|
+
<>
|
|
39
|
+
{(title || description) && !hideCard && (
|
|
40
|
+
<CardHeader>
|
|
41
|
+
<CardTitle>{title}</CardTitle>
|
|
42
|
+
{description && <CardDescription>{description}</CardDescription>}
|
|
43
|
+
</CardHeader>
|
|
44
|
+
)}
|
|
45
|
+
<CardContent className={cn("w-full h-full", hideCard ? "p-0" : "flex-1", !hideCard && className)}>
|
|
46
|
+
<ChartContainer config={config} className={cn("w-full h-full aspect-auto", hideCard && className)}>
|
|
47
|
+
<AreaChart
|
|
48
|
+
accessibilityLayer
|
|
49
|
+
data={data}
|
|
50
|
+
margin={{
|
|
51
|
+
left: 12,
|
|
52
|
+
right: 12,
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
<CartesianGrid vertical={false}/>
|
|
56
|
+
<XAxis
|
|
57
|
+
dataKey={xAxisDataKey}
|
|
58
|
+
tickLine={false}
|
|
59
|
+
axisLine={false}
|
|
60
|
+
tickMargin={8}
|
|
61
|
+
tickFormatter={formatTick}
|
|
62
|
+
/>
|
|
63
|
+
<ChartTooltip cursor={false} content={<ChartTooltipContent indicator="line"/>}/>
|
|
64
|
+
{showLegend && (
|
|
65
|
+
<ChartLegend content={<ChartLegendContent/>}/>
|
|
66
|
+
)}
|
|
67
|
+
<defs>
|
|
68
|
+
{areas.map((area) => (
|
|
69
|
+
<linearGradient key={`fill-${area.dataKey}`} id={`fill-${area.dataKey}`} x1="0" y1="0"
|
|
70
|
+
x2="0" y2="1">
|
|
71
|
+
<stop
|
|
72
|
+
offset="5%"
|
|
73
|
+
stopColor={`var(--color-${area.dataKey})`}
|
|
74
|
+
stopOpacity={0.8}
|
|
75
|
+
/>
|
|
76
|
+
<stop
|
|
77
|
+
offset="95%"
|
|
78
|
+
stopColor={`var(--color-${area.dataKey})`}
|
|
79
|
+
stopOpacity={0.1}
|
|
80
|
+
/>
|
|
81
|
+
</linearGradient>
|
|
82
|
+
))}
|
|
83
|
+
</defs>
|
|
84
|
+
{areas.map((area) => (
|
|
85
|
+
<Area
|
|
86
|
+
key={area.dataKey}
|
|
87
|
+
dataKey={area.dataKey}
|
|
88
|
+
type="natural"
|
|
89
|
+
fill={`url(#fill-${area.dataKey})`}
|
|
90
|
+
fillOpacity={0.4}
|
|
91
|
+
stroke={area.stroke || `var(--color-${area.dataKey})`}
|
|
92
|
+
{...(area.stackId ? {stackId: area.stackId} : {})}
|
|
93
|
+
/>
|
|
94
|
+
))}
|
|
95
|
+
</AreaChart>
|
|
96
|
+
</ChartContainer>
|
|
97
|
+
</CardContent>
|
|
98
|
+
{(footerTitle || footerDescription) && !hideCard && (
|
|
99
|
+
<CardFooter>
|
|
100
|
+
<div className="flex w-full items-start gap-2 text-sm">
|
|
101
|
+
<div className="grid gap-2">
|
|
102
|
+
{footerTitle && (
|
|
103
|
+
<div className="flex items-center gap-2 leading-none font-medium">
|
|
104
|
+
{footerTitle} <TrendingUp className="h-4 w-4"/>
|
|
105
|
+
</div>
|
|
106
|
+
)}
|
|
107
|
+
{footerDescription && (
|
|
108
|
+
<div className="flex items-center gap-2 leading-none text-muted-foreground">
|
|
109
|
+
{footerDescription}
|
|
110
|
+
</div>
|
|
111
|
+
)}
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
</CardFooter>
|
|
115
|
+
)}
|
|
116
|
+
</>
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
if (hideCard) {
|
|
120
|
+
return content
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<Card className={className}>
|
|
125
|
+
{content}
|
|
126
|
+
</Card>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { ChartConfig } from "../ui/chart"
|
|
2
|
+
|
|
3
|
+
export interface BaseChartWidgetProps {
|
|
4
|
+
data: any[]
|
|
5
|
+
config: ChartConfig
|
|
6
|
+
title?: string
|
|
7
|
+
description?: string
|
|
8
|
+
footerTitle?: string
|
|
9
|
+
footerDescription?: string
|
|
10
|
+
className?: string
|
|
11
|
+
hideCard?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface AreaChartWidgetProps extends BaseChartWidgetProps {
|
|
15
|
+
areas: {
|
|
16
|
+
dataKey: string
|
|
17
|
+
fill?: string
|
|
18
|
+
stroke?: string
|
|
19
|
+
stackId?: string
|
|
20
|
+
}[]
|
|
21
|
+
xAxisDataKey?: string
|
|
22
|
+
xAxisFormatter?: (value: string) => string
|
|
23
|
+
showLegend?: boolean
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface LineChartWidgetProps extends BaseChartWidgetProps {
|
|
27
|
+
lines: {
|
|
28
|
+
dataKey: string
|
|
29
|
+
stroke?: string
|
|
30
|
+
showLabel?: boolean
|
|
31
|
+
}[]
|
|
32
|
+
xAxisDataKey?: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface PieChartWidgetProps extends BaseChartWidgetProps {
|
|
36
|
+
dataKey: string
|
|
37
|
+
nameKey: string
|
|
38
|
+
innerLabel?: string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface RadarChartWidgetProps extends BaseChartWidgetProps {
|
|
42
|
+
radars: {
|
|
43
|
+
dataKey: string
|
|
44
|
+
fill?: string
|
|
45
|
+
fillOpacity?: number
|
|
46
|
+
}[]
|
|
47
|
+
polarAngleDataKey?: string
|
|
48
|
+
gridShape?: "polygon" | "circle"
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface RadialStackedChartWidgetProps extends BaseChartWidgetProps {
|
|
52
|
+
bars: {
|
|
53
|
+
dataKey: string
|
|
54
|
+
stackId?: string
|
|
55
|
+
fill?: string
|
|
56
|
+
cornerRadius?: number
|
|
57
|
+
}[]
|
|
58
|
+
innerRadius?: number
|
|
59
|
+
outerRadius?: number
|
|
60
|
+
endAngle?: number
|
|
61
|
+
innerLabel?: string
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface RadialChartWidgetProps extends BaseChartWidgetProps {
|
|
65
|
+
dataKey: string
|
|
66
|
+
nameKey: string
|
|
67
|
+
startAngle?: number
|
|
68
|
+
endAngle?: number
|
|
69
|
+
innerRadius?: number
|
|
70
|
+
outerRadius?: number
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface TooltipChartWidgetProps extends BaseChartWidgetProps {
|
|
74
|
+
bars: {
|
|
75
|
+
dataKey: string
|
|
76
|
+
stackId?: string
|
|
77
|
+
fill?: string
|
|
78
|
+
radius?: [number, number, number, number]
|
|
79
|
+
}[]
|
|
80
|
+
xAxisDataKey?: string
|
|
81
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// @liorian/sdk/presentation/charts — chart widgets & skeletons.
|
|
2
|
+
export * from "./area-widget.chart-skeleton";
|
|
3
|
+
export * from "./area-widget.chart";
|
|
4
|
+
export * from "./chart-widgets.types";
|
|
5
|
+
export * from "./line-widget.chart-skeleton";
|
|
6
|
+
export * from "./line-widget.chart";
|
|
7
|
+
export * from "./pie-widget.chart-skeleton";
|
|
8
|
+
export * from "./pie-widget.chart";
|
|
9
|
+
export * from "./radar-widget.chart-skeleton";
|
|
10
|
+
export * from "./radar-widget.chart";
|
|
11
|
+
export * from "./radial-stacked-widget.chart-skeleton";
|
|
12
|
+
export * from "./radial-stacked-widget.chart";
|
|
13
|
+
export * from "./radial-widget.chart-skeleton";
|
|
14
|
+
export * from "./radial-widget.chart";
|
|
15
|
+
export * from "./tooltip-widget.chart-skeleton";
|
|
16
|
+
export * from "./tooltip-widget.chart";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import {Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle} from "../ui/card";
|
|
4
|
+
import {Skeleton} from "../ui/skeleton";
|
|
5
|
+
|
|
6
|
+
export interface LineWidgetChartSkeletonProps {
|
|
7
|
+
title?: string
|
|
8
|
+
description?: string
|
|
9
|
+
footerTitle?: string
|
|
10
|
+
footerDescription?: string
|
|
11
|
+
className?: string
|
|
12
|
+
hideCard?: boolean
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function LineWidgetChartSkeleton(
|
|
16
|
+
{
|
|
17
|
+
title,
|
|
18
|
+
description,
|
|
19
|
+
footerTitle,
|
|
20
|
+
footerDescription,
|
|
21
|
+
className,
|
|
22
|
+
hideCard = false,
|
|
23
|
+
}: LineWidgetChartSkeletonProps
|
|
24
|
+
) {
|
|
25
|
+
const content = (
|
|
26
|
+
<>
|
|
27
|
+
{(title || description) && !hideCard && (
|
|
28
|
+
<CardHeader>
|
|
29
|
+
<CardTitle>
|
|
30
|
+
<Skeleton className="h-5 w-48"/>
|
|
31
|
+
</CardTitle>
|
|
32
|
+
{description && (
|
|
33
|
+
<CardDescription>
|
|
34
|
+
<Skeleton className="h-4 w-64"/>
|
|
35
|
+
</CardDescription>
|
|
36
|
+
)}
|
|
37
|
+
</CardHeader>
|
|
38
|
+
)}
|
|
39
|
+
<CardContent className={hideCard ? "p-0" : ""}>
|
|
40
|
+
<div className={hideCard ? "w-full" : "flex flex-col gap-2"}>
|
|
41
|
+
<Skeleton className="h-64 w-full"/>
|
|
42
|
+
<Skeleton className="h-4 w-full"/>
|
|
43
|
+
<Skeleton className="h-4 w-2/3"/>
|
|
44
|
+
</div>
|
|
45
|
+
</CardContent>
|
|
46
|
+
{(footerTitle || footerDescription) && !hideCard && (
|
|
47
|
+
<CardFooter className="flex-col items-start gap-2 text-sm">
|
|
48
|
+
{footerTitle && <Skeleton className="h-4 w-40"/>}
|
|
49
|
+
{footerDescription && <Skeleton className="h-4 w-56"/>}
|
|
50
|
+
</CardFooter>
|
|
51
|
+
)}
|
|
52
|
+
</>
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
if (hideCard) {
|
|
56
|
+
return content
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Card className={className}>
|
|
61
|
+
{content}
|
|
62
|
+
</Card>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { TrendingUp } from "lucide-react"
|
|
4
|
+
import { CartesianGrid, LabelList, Line, LineChart, XAxis } from "recharts"
|
|
5
|
+
import {ChartConfig, ChartContainer, ChartTooltip, ChartTooltipContent} from "../ui/chart";
|
|
6
|
+
import {Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle} from "../ui/card";
|
|
7
|
+
import { LineChartWidgetProps } from "./chart-widgets.types";
|
|
8
|
+
|
|
9
|
+
export function LineWidgetChart({
|
|
10
|
+
data,
|
|
11
|
+
config,
|
|
12
|
+
title,
|
|
13
|
+
description,
|
|
14
|
+
footerTitle,
|
|
15
|
+
footerDescription,
|
|
16
|
+
lines,
|
|
17
|
+
xAxisDataKey = "month",
|
|
18
|
+
className,
|
|
19
|
+
hideCard = false
|
|
20
|
+
}: LineChartWidgetProps) {
|
|
21
|
+
const content = (
|
|
22
|
+
<>
|
|
23
|
+
{(title || description) && !hideCard && (
|
|
24
|
+
<CardHeader>
|
|
25
|
+
<CardTitle>{title}</CardTitle>
|
|
26
|
+
{description && <CardDescription>{description}</CardDescription>}
|
|
27
|
+
</CardHeader>
|
|
28
|
+
)}
|
|
29
|
+
<CardContent className={hideCard ? "p-0" : ""}>
|
|
30
|
+
<ChartContainer config={config}>
|
|
31
|
+
<LineChart
|
|
32
|
+
accessibilityLayer
|
|
33
|
+
data={data}
|
|
34
|
+
margin={{
|
|
35
|
+
top: 20,
|
|
36
|
+
left: 12,
|
|
37
|
+
right: 12,
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
<CartesianGrid vertical={false} />
|
|
41
|
+
<XAxis
|
|
42
|
+
dataKey={xAxisDataKey}
|
|
43
|
+
tickLine={false}
|
|
44
|
+
axisLine={false}
|
|
45
|
+
tickMargin={8}
|
|
46
|
+
tickFormatter={(value) => value.slice(0, 3)}
|
|
47
|
+
/>
|
|
48
|
+
<ChartTooltip
|
|
49
|
+
cursor={false}
|
|
50
|
+
content={<ChartTooltipContent indicator="line" />}
|
|
51
|
+
/>
|
|
52
|
+
{lines.map((line) => (
|
|
53
|
+
<Line
|
|
54
|
+
key={line.dataKey}
|
|
55
|
+
dataKey={line.dataKey}
|
|
56
|
+
type="natural"
|
|
57
|
+
stroke={line.stroke || `var(--color-${line.dataKey})`}
|
|
58
|
+
strokeWidth={2}
|
|
59
|
+
dot={{
|
|
60
|
+
fill: line.stroke || `var(--color-${line.dataKey})`,
|
|
61
|
+
}}
|
|
62
|
+
activeDot={{
|
|
63
|
+
r: 6,
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
{line.showLabel && (
|
|
67
|
+
<LabelList
|
|
68
|
+
position="top"
|
|
69
|
+
offset={12}
|
|
70
|
+
className="fill-foreground"
|
|
71
|
+
fontSize={12}
|
|
72
|
+
/>
|
|
73
|
+
)}
|
|
74
|
+
</Line>
|
|
75
|
+
))}
|
|
76
|
+
</LineChart>
|
|
77
|
+
</ChartContainer>
|
|
78
|
+
</CardContent>
|
|
79
|
+
{(footerTitle || footerDescription) && !hideCard && (
|
|
80
|
+
<CardFooter className="flex-col items-start gap-2 text-sm">
|
|
81
|
+
{footerTitle && (
|
|
82
|
+
<div className="flex gap-2 leading-none font-medium">
|
|
83
|
+
{footerTitle} <TrendingUp className="h-4 w-4" />
|
|
84
|
+
</div>
|
|
85
|
+
)}
|
|
86
|
+
{footerDescription && (
|
|
87
|
+
<div className="leading-none text-muted-foreground">
|
|
88
|
+
{footerDescription}
|
|
89
|
+
</div>
|
|
90
|
+
)}
|
|
91
|
+
</CardFooter>
|
|
92
|
+
)}
|
|
93
|
+
</>
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
if (hideCard) {
|
|
97
|
+
return content
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<Card className={className}>
|
|
102
|
+
{content}
|
|
103
|
+
</Card>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import {Card, CardContent, CardDescription, CardHeader, CardTitle} from "../ui/card";
|
|
4
|
+
import {Skeleton} from "../ui/skeleton";
|
|
5
|
+
import {cn} from "../../infrastructure/utilities/utils";
|
|
6
|
+
|
|
7
|
+
export interface PieWidgetChartSkeletonProps {
|
|
8
|
+
title?: string
|
|
9
|
+
description?: string
|
|
10
|
+
className?: string
|
|
11
|
+
hideCard?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function PieWidgetChartSkeleton(
|
|
15
|
+
{
|
|
16
|
+
title,
|
|
17
|
+
description,
|
|
18
|
+
className,
|
|
19
|
+
hideCard = false,
|
|
20
|
+
}: PieWidgetChartSkeletonProps
|
|
21
|
+
) {
|
|
22
|
+
const content = (
|
|
23
|
+
<>
|
|
24
|
+
{(title || description) && !hideCard && (
|
|
25
|
+
<CardHeader className="flex-row items-start space-y-0 pb-0">
|
|
26
|
+
<div className="grid gap-1">
|
|
27
|
+
<CardTitle>
|
|
28
|
+
<Skeleton className="h-5 w-48"/>
|
|
29
|
+
</CardTitle>
|
|
30
|
+
{description && (
|
|
31
|
+
<CardDescription>
|
|
32
|
+
<Skeleton className="h-4 w-64"/>
|
|
33
|
+
</CardDescription>
|
|
34
|
+
)}
|
|
35
|
+
</div>
|
|
36
|
+
</CardHeader>
|
|
37
|
+
)}
|
|
38
|
+
<div className="flex flex-row items-center justify-end pt-4">
|
|
39
|
+
<Skeleton className="h-9 w-[130px]"/>
|
|
40
|
+
</div>
|
|
41
|
+
<CardContent className={cn("flex flex-1 justify-center pb-0", hideCard ? "p-0" : "")}>
|
|
42
|
+
<Skeleton className="mx-auto aspect-square w-full max-w-[300px] rounded-full"/>
|
|
43
|
+
</CardContent>
|
|
44
|
+
</>
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
if (hideCard) {
|
|
48
|
+
return content
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Card data-chart="skeleton" className={cn("flex flex-col", className)}>
|
|
53
|
+
{content}
|
|
54
|
+
</Card>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import {Label, Pie, PieChart, Sector} from "recharts"
|
|
5
|
+
import type {
|
|
6
|
+
PieSectorShapeProps,
|
|
7
|
+
} from "recharts/types/polar/Pie"
|
|
8
|
+
import {ChartConfig, ChartContainer, ChartStyle, ChartTooltip, ChartTooltipContent} from "../ui/chart";
|
|
9
|
+
import {Card, CardContent, CardDescription, CardHeader, CardTitle} from "../ui/card";
|
|
10
|
+
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from "../ui/select";
|
|
11
|
+
import {cn} from "../../infrastructure/utilities/utils";
|
|
12
|
+
import {PieChartWidgetProps} from "./chart-widgets.types";
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export function PieWidgetChart(
|
|
16
|
+
{
|
|
17
|
+
data,
|
|
18
|
+
config,
|
|
19
|
+
title,
|
|
20
|
+
description,
|
|
21
|
+
dataKey,
|
|
22
|
+
nameKey,
|
|
23
|
+
innerLabel = "Visitors",
|
|
24
|
+
className,
|
|
25
|
+
hideCard = false,
|
|
26
|
+
}: PieChartWidgetProps) {
|
|
27
|
+
const id = React.useId()
|
|
28
|
+
const [activeMonth, setActiveMonth] = React.useState(data[0]?.[nameKey])
|
|
29
|
+
|
|
30
|
+
const activeIndex = React.useMemo(
|
|
31
|
+
() => data.findIndex((item) => item[nameKey] === activeMonth),
|
|
32
|
+
[activeMonth, data, nameKey]
|
|
33
|
+
)
|
|
34
|
+
const keys = React.useMemo(() => data.map((item) => item[nameKey]), [data, nameKey])
|
|
35
|
+
|
|
36
|
+
const renderPieShape = React.useCallback(
|
|
37
|
+
({index, outerRadius = 0, ...props}: PieSectorShapeProps) => {
|
|
38
|
+
if (index === activeIndex) {
|
|
39
|
+
return (
|
|
40
|
+
<g>
|
|
41
|
+
<Sector {...props} outerRadius={outerRadius + 10}/>
|
|
42
|
+
<Sector
|
|
43
|
+
{...props}
|
|
44
|
+
outerRadius={outerRadius + 25}
|
|
45
|
+
innerRadius={outerRadius + 12}
|
|
46
|
+
/>
|
|
47
|
+
</g>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return <Sector {...props} outerRadius={outerRadius}/>
|
|
52
|
+
},
|
|
53
|
+
[activeIndex]
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
const content = (
|
|
57
|
+
<>
|
|
58
|
+
{/*<ChartStyle id={id} config={config} />*/}
|
|
59
|
+
{(title || description) && !hideCard && (
|
|
60
|
+
<CardHeader className="flex-row items-start space-y-0 pb-0">
|
|
61
|
+
<div className="grid gap-1">
|
|
62
|
+
<CardTitle>{title}</CardTitle>
|
|
63
|
+
{description && <CardDescription>{description}</CardDescription>}
|
|
64
|
+
</div>
|
|
65
|
+
</CardHeader>
|
|
66
|
+
)}
|
|
67
|
+
<div className="flex flex-row items-center justify-end">
|
|
68
|
+
<Select value={activeMonth} onValueChange={setActiveMonth}>
|
|
69
|
+
<SelectTrigger
|
|
70
|
+
className="w-[130px]"
|
|
71
|
+
aria-label="Choississez une entrée"
|
|
72
|
+
>
|
|
73
|
+
<SelectValue placeholder="Select item"/>
|
|
74
|
+
</SelectTrigger>
|
|
75
|
+
<SelectContent align="end" className="rounded-xl">
|
|
76
|
+
{keys.map((key) => {
|
|
77
|
+
const itemConfig = config[key as keyof typeof config]
|
|
78
|
+
|
|
79
|
+
if (!itemConfig) {
|
|
80
|
+
return null
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<SelectItem
|
|
85
|
+
key={key}
|
|
86
|
+
value={key}
|
|
87
|
+
className="rounded-lg [&_span]:flex"
|
|
88
|
+
>
|
|
89
|
+
<div className="flex items-center gap-2 text-xs">
|
|
90
|
+
<span
|
|
91
|
+
className="flex h-3 w-3 shrink-0 rounded-xs"
|
|
92
|
+
style={{
|
|
93
|
+
backgroundColor: `var(--color-${key})`,
|
|
94
|
+
}}
|
|
95
|
+
/>
|
|
96
|
+
{itemConfig?.label}
|
|
97
|
+
</div>
|
|
98
|
+
</SelectItem>
|
|
99
|
+
)
|
|
100
|
+
})}
|
|
101
|
+
</SelectContent>
|
|
102
|
+
</Select>
|
|
103
|
+
</div>
|
|
104
|
+
<CardContent className={cn("flex flex-1 justify-center pb-0", hideCard ? "p-0" : "")}>
|
|
105
|
+
<ChartContainer
|
|
106
|
+
id={id}
|
|
107
|
+
config={config}
|
|
108
|
+
className="mx-auto aspect-square w-full max-w-[300px]"
|
|
109
|
+
>
|
|
110
|
+
<PieChart>
|
|
111
|
+
<ChartTooltip
|
|
112
|
+
cursor={false}
|
|
113
|
+
content={<ChartTooltipContent hideLabel/>}
|
|
114
|
+
/>
|
|
115
|
+
<Pie
|
|
116
|
+
data={data}
|
|
117
|
+
dataKey={dataKey}
|
|
118
|
+
nameKey={nameKey}
|
|
119
|
+
innerRadius={60}
|
|
120
|
+
strokeWidth={5}
|
|
121
|
+
shape={renderPieShape}
|
|
122
|
+
>
|
|
123
|
+
<Label
|
|
124
|
+
content={({viewBox}) => {
|
|
125
|
+
if (viewBox && "cx" in viewBox && "cy" in viewBox) {
|
|
126
|
+
return (
|
|
127
|
+
<text
|
|
128
|
+
x={viewBox.cx}
|
|
129
|
+
y={viewBox.cy}
|
|
130
|
+
textAnchor="middle"
|
|
131
|
+
dominantBaseline="middle"
|
|
132
|
+
>
|
|
133
|
+
<tspan
|
|
134
|
+
x={viewBox.cx}
|
|
135
|
+
y={viewBox.cy}
|
|
136
|
+
className="fill-foreground text-3xl font-bold"
|
|
137
|
+
>
|
|
138
|
+
{data[activeIndex]?.[dataKey]?.toLocaleString()}
|
|
139
|
+
</tspan>
|
|
140
|
+
<tspan
|
|
141
|
+
x={viewBox.cx}
|
|
142
|
+
y={(viewBox.cy || 0) + 24}
|
|
143
|
+
className="fill-muted-foreground"
|
|
144
|
+
>
|
|
145
|
+
{innerLabel}
|
|
146
|
+
</tspan>
|
|
147
|
+
</text>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
}}
|
|
151
|
+
/>
|
|
152
|
+
</Pie>
|
|
153
|
+
</PieChart>
|
|
154
|
+
</ChartContainer>
|
|
155
|
+
</CardContent>
|
|
156
|
+
</>
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
if (hideCard) {
|
|
160
|
+
return content
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return (
|
|
164
|
+
<Card data-chart={id} className={cn("flex flex-col", className)}>
|
|
165
|
+
{content}
|
|
166
|
+
</Card>
|
|
167
|
+
)
|
|
168
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import {Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle} from "../ui/card";
|
|
4
|
+
import {Skeleton} from "../ui/skeleton";
|
|
5
|
+
import {cn} from "../../infrastructure/utilities/utils";
|
|
6
|
+
|
|
7
|
+
export interface RadarWidgetChartSkeletonProps {
|
|
8
|
+
title?: string
|
|
9
|
+
description?: string
|
|
10
|
+
footerTitle?: string
|
|
11
|
+
footerDescription?: string
|
|
12
|
+
className?: string
|
|
13
|
+
hideCard?: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function RadarWidgetChartSkeleton(
|
|
17
|
+
{
|
|
18
|
+
title,
|
|
19
|
+
description,
|
|
20
|
+
footerTitle,
|
|
21
|
+
footerDescription,
|
|
22
|
+
className,
|
|
23
|
+
hideCard = false,
|
|
24
|
+
}: RadarWidgetChartSkeletonProps
|
|
25
|
+
) {
|
|
26
|
+
const content = (
|
|
27
|
+
<>
|
|
28
|
+
{(title || description) && !hideCard && (
|
|
29
|
+
<CardHeader className="items-center pb-4">
|
|
30
|
+
<CardTitle>
|
|
31
|
+
<Skeleton className="h-5 w-48"/>
|
|
32
|
+
</CardTitle>
|
|
33
|
+
{description && (
|
|
34
|
+
<CardDescription>
|
|
35
|
+
<Skeleton className="h-4 w-64"/>
|
|
36
|
+
</CardDescription>
|
|
37
|
+
)}
|
|
38
|
+
</CardHeader>
|
|
39
|
+
)}
|
|
40
|
+
<CardContent className={cn("pb-0", hideCard ? "p-0" : "")}>
|
|
41
|
+
<Skeleton
|
|
42
|
+
className={cn(
|
|
43
|
+
"mx-auto aspect-square max-h-[250px] w-full rounded-none",
|
|
44
|
+
"[clip-path:polygon(50%_0%,100%_25%,100%_75%,50%_100%,0%_75%,0%_25%)]",
|
|
45
|
+
hideCard && "max-h-none"
|
|
46
|
+
)}
|
|
47
|
+
/>
|
|
48
|
+
</CardContent>
|
|
49
|
+
{(footerTitle || footerDescription) && !hideCard && (
|
|
50
|
+
<CardFooter className="flex-col items-center gap-2 text-sm">
|
|
51
|
+
{footerTitle && <Skeleton className="h-4 w-40"/>}
|
|
52
|
+
{footerDescription && <Skeleton className="h-4 w-56"/>}
|
|
53
|
+
</CardFooter>
|
|
54
|
+
)}
|
|
55
|
+
</>
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
if (hideCard) {
|
|
59
|
+
return content
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<Card className={className}>
|
|
64
|
+
{content}
|
|
65
|
+
</Card>
|
|
66
|
+
)
|
|
67
|
+
}
|