@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,430 @@
|
|
|
1
|
+
import { cn } from "../../infrastructure/utilities/utils";
|
|
2
|
+
import {
|
|
3
|
+
Tooltip,
|
|
4
|
+
TooltipContent,
|
|
5
|
+
TooltipProvider,
|
|
6
|
+
TooltipTrigger
|
|
7
|
+
} from "../ui/tooltip";
|
|
8
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
9
|
+
|
|
10
|
+
export type HeatmapValue = {
|
|
11
|
+
date: string; // YYYY-MM-DD
|
|
12
|
+
value: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type HeatmapData = HeatmapValue[];
|
|
16
|
+
|
|
17
|
+
type InterpolationModes = "linear" | "sqrt" | "log";
|
|
18
|
+
|
|
19
|
+
type ColorOptions =
|
|
20
|
+
| {
|
|
21
|
+
colorMode: "discrete";
|
|
22
|
+
colorScale?: string[];
|
|
23
|
+
customColorMap?: (
|
|
24
|
+
value: number,
|
|
25
|
+
max: number,
|
|
26
|
+
colorCount: number
|
|
27
|
+
) => number;
|
|
28
|
+
}
|
|
29
|
+
| {
|
|
30
|
+
colorMode: "interpolate";
|
|
31
|
+
maxColor?: string;
|
|
32
|
+
minColor?: string;
|
|
33
|
+
interpolation?: InterpolationModes;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
type HeatmapProps = HTMLAttributes<HTMLDivElement> &
|
|
37
|
+
ColorOptions & {
|
|
38
|
+
data: HeatmapData;
|
|
39
|
+
startDate: Date;
|
|
40
|
+
endDate: Date;
|
|
41
|
+
cellSize?: number;
|
|
42
|
+
gap?: number;
|
|
43
|
+
daysOfTheWeek?: "all" | "MWF" | "none" | "single letter";
|
|
44
|
+
displayStyle?: "squares" | "bubbles";
|
|
45
|
+
dateDisplayFunction?: (date: Date) => ReactNode;
|
|
46
|
+
valueDisplayFunction?: (value: number) => ReactNode;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
function getAllDays(start: string, end: string): string[] {
|
|
50
|
+
// Generate all days between start and end dates (inclusive)
|
|
51
|
+
const days: string[] = [];
|
|
52
|
+
let curr = new Date(start + "T00:00:00");
|
|
53
|
+
|
|
54
|
+
const endDate = new Date(end + "T00:00:00");
|
|
55
|
+
|
|
56
|
+
while (curr <= endDate) {
|
|
57
|
+
days.push(formatLocalDate(curr));
|
|
58
|
+
curr.setDate(curr.getDate() + 1);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return days;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function padToWeekStart(days: string[]): (string | null)[] {
|
|
65
|
+
// Pad the start of the days array with nulls to align to week start (Sunday)
|
|
66
|
+
// eg. if first day is Wednesday (3), add 3 nulls at start
|
|
67
|
+
const firstDay = new Date(days[0] + "T00:00:00").getDay();
|
|
68
|
+
const padding = new Array(firstDay).fill(null);
|
|
69
|
+
return [...padding, ...days];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function chunkByWeek(days: (string | null)[]): (string | null)[][] {
|
|
73
|
+
// Chunk the days into weeks (arrays of 7 days)
|
|
74
|
+
const weeks: (string | null)[][] = [];
|
|
75
|
+
for (let i = 0; i < days.length; i += 7) {
|
|
76
|
+
weeks.push(days.slice(i, i + 7));
|
|
77
|
+
}
|
|
78
|
+
return weeks;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function getMonthLabel(week: (string | null)[]) {
|
|
82
|
+
// Get month label for the week (based on last non-null day)
|
|
83
|
+
const lastDay = [...week].reverse().find(Boolean);
|
|
84
|
+
return !lastDay
|
|
85
|
+
? null
|
|
86
|
+
: new Date(lastDay + "T00:00:00").toLocaleString("default", {
|
|
87
|
+
month: "short"
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function defaultColourMap(value: number, max: number, colorCount: number) {
|
|
92
|
+
// Map value to color index
|
|
93
|
+
// default: we do a linear scale from 0 to max
|
|
94
|
+
if (colorCount <= 0) return 0; // safeguard
|
|
95
|
+
if (max <= 0 || value <= 0) return 0; // all zero values
|
|
96
|
+
const index = Math.ceil((value / max) * (colorCount - 1));
|
|
97
|
+
return Math.min(Math.max(index, 0), colorCount - 1);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function interpolateRgb(
|
|
101
|
+
value: number,
|
|
102
|
+
max: number,
|
|
103
|
+
minColor: string,
|
|
104
|
+
maxColor: string,
|
|
105
|
+
scale: InterpolationModes
|
|
106
|
+
) {
|
|
107
|
+
if (value <= 0 || max <= 0) return minColor;
|
|
108
|
+
|
|
109
|
+
let t = value / max;
|
|
110
|
+
|
|
111
|
+
switch (scale) {
|
|
112
|
+
case "sqrt":
|
|
113
|
+
t = Math.sqrt(t);
|
|
114
|
+
break;
|
|
115
|
+
case "log":
|
|
116
|
+
t = Math.log10(value + 1) / Math.log10(max + 1);
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Clamp t between 0 and 1
|
|
121
|
+
t = Math.min(Math.max(t, 0), 1);
|
|
122
|
+
|
|
123
|
+
const s = {
|
|
124
|
+
r: parseInt(minColor.slice(1, 3), 16),
|
|
125
|
+
g: parseInt(minColor.slice(3, 5), 16),
|
|
126
|
+
b: parseInt(minColor.slice(5, 7), 16)
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const e = {
|
|
130
|
+
r: parseInt(maxColor.slice(1, 3), 16),
|
|
131
|
+
g: parseInt(maxColor.slice(3, 5), 16),
|
|
132
|
+
b: parseInt(maxColor.slice(5, 7), 16)
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const r = Math.round(s.r + (e.r - s.r) * t);
|
|
136
|
+
const g = Math.round(s.g + (e.g - s.g) * t);
|
|
137
|
+
const b = Math.round(s.b + (e.b - s.b) * t);
|
|
138
|
+
|
|
139
|
+
return `rgb(${r}, ${g}, ${b})`;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const defaultIntensityColours = [
|
|
143
|
+
"#f0fdf4", // green-50
|
|
144
|
+
"#bbf7d0", // green-200
|
|
145
|
+
"#86efac", // green-300
|
|
146
|
+
"#22c55e", // green-500
|
|
147
|
+
"#166534" // green-700
|
|
148
|
+
];
|
|
149
|
+
|
|
150
|
+
const daysOfTheWeek = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
151
|
+
|
|
152
|
+
interface DaysOfTheWeekIndicatorProps {
|
|
153
|
+
daysOfTheWeekOption: "all" | "MWF" | "none" | "single letter";
|
|
154
|
+
fontSize: number;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function daysOfTheWeekIndicator({
|
|
158
|
+
daysOfTheWeekOption,
|
|
159
|
+
fontSize
|
|
160
|
+
}: DaysOfTheWeekIndicatorProps) {
|
|
161
|
+
if (daysOfTheWeekOption === "none") return null;
|
|
162
|
+
|
|
163
|
+
return daysOfTheWeek.map((day, i) =>
|
|
164
|
+
daysOfTheWeekOption === "MWF" && ![1, 3, 5].includes(i) ? (
|
|
165
|
+
<div
|
|
166
|
+
key={i}
|
|
167
|
+
style={{
|
|
168
|
+
gridRow: i + 2,
|
|
169
|
+
gridColumn: 1
|
|
170
|
+
}}
|
|
171
|
+
/>
|
|
172
|
+
) : (
|
|
173
|
+
<div
|
|
174
|
+
key={i}
|
|
175
|
+
className="flex items-center text-muted-foreground"
|
|
176
|
+
style={{
|
|
177
|
+
gridRow: i + 2,
|
|
178
|
+
gridColumn: 1,
|
|
179
|
+
justifyContent: "flex-end",
|
|
180
|
+
fontSize
|
|
181
|
+
}}
|
|
182
|
+
>
|
|
183
|
+
{daysOfTheWeekOption === "single letter" ? day.charAt(0) : day}
|
|
184
|
+
</div>
|
|
185
|
+
)
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
interface ValueIndicatorProps extends HTMLAttributes<HTMLDivElement> {
|
|
190
|
+
cellSize: number;
|
|
191
|
+
displayStyle: "squares" | "bubbles";
|
|
192
|
+
value: number; // current cell value
|
|
193
|
+
maxValue: number; // maximum possible value out of all cells
|
|
194
|
+
color: string;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function ValueIndicator({
|
|
198
|
+
cellSize,
|
|
199
|
+
displayStyle,
|
|
200
|
+
value,
|
|
201
|
+
maxValue,
|
|
202
|
+
color,
|
|
203
|
+
style,
|
|
204
|
+
...htmlProps
|
|
205
|
+
}: ValueIndicatorProps) {
|
|
206
|
+
let finalSize = cellSize;
|
|
207
|
+
|
|
208
|
+
if (displayStyle === "bubbles") {
|
|
209
|
+
// Min bubble size = 0.3 * size, Max bubble size = size
|
|
210
|
+
const minScale = 0.3;
|
|
211
|
+
const scale = maxValue > 0 ? value / maxValue : 0;
|
|
212
|
+
finalSize = cellSize * (minScale + (1 - minScale) * scale);
|
|
213
|
+
|
|
214
|
+
return (
|
|
215
|
+
<div
|
|
216
|
+
className="flex items-center justify-center"
|
|
217
|
+
style={style}
|
|
218
|
+
{...htmlProps}
|
|
219
|
+
>
|
|
220
|
+
<span
|
|
221
|
+
className="transition-colors rounded-full"
|
|
222
|
+
style={{
|
|
223
|
+
width: finalSize,
|
|
224
|
+
height: finalSize,
|
|
225
|
+
backgroundColor: color
|
|
226
|
+
}}
|
|
227
|
+
/>
|
|
228
|
+
</div>
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return (
|
|
233
|
+
<div
|
|
234
|
+
className="transition-colors rounded-md"
|
|
235
|
+
style={{
|
|
236
|
+
borderRadius: 4,
|
|
237
|
+
backgroundColor: color,
|
|
238
|
+
...style
|
|
239
|
+
}}
|
|
240
|
+
{...htmlProps}
|
|
241
|
+
/>
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export default function Heatmap(props: HeatmapProps) {
|
|
246
|
+
const {
|
|
247
|
+
data,
|
|
248
|
+
startDate,
|
|
249
|
+
endDate,
|
|
250
|
+
cellSize = 16,
|
|
251
|
+
daysOfTheWeek = "MWF",
|
|
252
|
+
gap = 4,
|
|
253
|
+
displayStyle = "squares",
|
|
254
|
+
valueDisplayFunction,
|
|
255
|
+
dateDisplayFunction,
|
|
256
|
+
className,
|
|
257
|
+
colorMode
|
|
258
|
+
} = props;
|
|
259
|
+
|
|
260
|
+
const valueByDate = new Map<string, number>(
|
|
261
|
+
data.map(({ date, value }) => [date, value])
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
const days = getAllDays(formatLocalDate(startDate), formatLocalDate(endDate));
|
|
265
|
+
const paddedDays = padToWeekStart(days);
|
|
266
|
+
const weeks = chunkByWeek(paddedDays);
|
|
267
|
+
|
|
268
|
+
const maxValue = Math.max(...data.map((d) => d.value), 0);
|
|
269
|
+
|
|
270
|
+
const monthLabels = weeks.map((week, i) => {
|
|
271
|
+
const label = getMonthLabel(week);
|
|
272
|
+
const prevLabel = i > 0 ? getMonthLabel(weeks[i - 1]) : null;
|
|
273
|
+
return label !== prevLabel ? label : null;
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
const fontSize = Math.min(12, cellSize);
|
|
277
|
+
|
|
278
|
+
let safeProps: HTMLAttributes<HTMLDivElement> = {};
|
|
279
|
+
|
|
280
|
+
if (colorMode === "discrete") {
|
|
281
|
+
const {
|
|
282
|
+
data,
|
|
283
|
+
startDate,
|
|
284
|
+
endDate,
|
|
285
|
+
cellSize,
|
|
286
|
+
daysOfTheWeek,
|
|
287
|
+
gap,
|
|
288
|
+
displayStyle,
|
|
289
|
+
valueDisplayFunction,
|
|
290
|
+
dateDisplayFunction,
|
|
291
|
+
className,
|
|
292
|
+
colorMode,
|
|
293
|
+
customColorMap,
|
|
294
|
+
colorScale,
|
|
295
|
+
...others
|
|
296
|
+
} = props;
|
|
297
|
+
safeProps = others;
|
|
298
|
+
} else if (colorMode === "interpolate") {
|
|
299
|
+
const {
|
|
300
|
+
data,
|
|
301
|
+
startDate,
|
|
302
|
+
endDate,
|
|
303
|
+
cellSize,
|
|
304
|
+
daysOfTheWeek,
|
|
305
|
+
gap,
|
|
306
|
+
displayStyle,
|
|
307
|
+
valueDisplayFunction,
|
|
308
|
+
dateDisplayFunction,
|
|
309
|
+
className,
|
|
310
|
+
colorMode,
|
|
311
|
+
minColor,
|
|
312
|
+
maxColor,
|
|
313
|
+
interpolation,
|
|
314
|
+
...others
|
|
315
|
+
} = props;
|
|
316
|
+
safeProps = others;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const getCellColor = (value: number) => {
|
|
320
|
+
if (colorMode === "interpolate") {
|
|
321
|
+
if (value <= 0) {
|
|
322
|
+
return props.minColor ?? "var(--heatmap-zero)";
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// 0 < value <= maxValue
|
|
326
|
+
// interpolate between minColor and maxColor
|
|
327
|
+
return interpolateRgb(
|
|
328
|
+
value,
|
|
329
|
+
maxValue,
|
|
330
|
+
props.minColor ?? "#aceebb",
|
|
331
|
+
props.maxColor ?? "#116329",
|
|
332
|
+
props.interpolation ?? "linear"
|
|
333
|
+
);
|
|
334
|
+
} else {
|
|
335
|
+
const colorArray =
|
|
336
|
+
props.colorScale && props.colorScale.length > 0
|
|
337
|
+
? props.colorScale
|
|
338
|
+
: defaultIntensityColours;
|
|
339
|
+
|
|
340
|
+
const map = props.customColorMap ?? defaultColourMap;
|
|
341
|
+
|
|
342
|
+
return colorArray[map(value, maxValue, colorArray.length)];
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
return (
|
|
347
|
+
<div
|
|
348
|
+
role="grid"
|
|
349
|
+
className={cn("grid", className)}
|
|
350
|
+
aria-label="Activity Heatmap"
|
|
351
|
+
style={{
|
|
352
|
+
gap,
|
|
353
|
+
gridTemplateColumns: `max-content repeat(${weeks.length}, ${cellSize}px)`,
|
|
354
|
+
gridTemplateRows: `repeat(8, ${cellSize}px)`
|
|
355
|
+
}}
|
|
356
|
+
{...safeProps}
|
|
357
|
+
>
|
|
358
|
+
{daysOfTheWeekIndicator({ daysOfTheWeekOption: daysOfTheWeek, fontSize })}
|
|
359
|
+
|
|
360
|
+
{weeks.map((_, i) => (
|
|
361
|
+
<div
|
|
362
|
+
key={`header-${i}`}
|
|
363
|
+
style={{ gridColumn: i + 2, gridRow: 1, fontSize }}
|
|
364
|
+
className="text-muted-foreground flex items-end"
|
|
365
|
+
>
|
|
366
|
+
{monthLabels[i]}
|
|
367
|
+
</div>
|
|
368
|
+
))}
|
|
369
|
+
|
|
370
|
+
<TooltipProvider>
|
|
371
|
+
{weeks.map((week, weekIdx) =>
|
|
372
|
+
week.map((day, dayIdx) => {
|
|
373
|
+
if (!day) {
|
|
374
|
+
return (
|
|
375
|
+
<div
|
|
376
|
+
key={dayIdx}
|
|
377
|
+
style={{ gridColumn: weekIdx + 2, gridRow: dayIdx + 2 }}
|
|
378
|
+
/>
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
const thisDateValue = valueByDate.get(day) ?? 0;
|
|
383
|
+
const safeValue = Math.max(0, thisDateValue);
|
|
384
|
+
const thisColor = getCellColor(safeValue);
|
|
385
|
+
const dateForDisplay = new Date(day + "T00:00:00");
|
|
386
|
+
|
|
387
|
+
return (
|
|
388
|
+
<Tooltip key={dayIdx}>
|
|
389
|
+
<TooltipTrigger asChild>
|
|
390
|
+
<ValueIndicator
|
|
391
|
+
style={{ gridColumn: weekIdx + 2, gridRow: dayIdx + 2 }}
|
|
392
|
+
tabIndex={0}
|
|
393
|
+
aria-label={`${day}: ${safeValue} event${safeValue !== 1 ? "s" : ""}`}
|
|
394
|
+
id={`heatmap-cell-${day}`}
|
|
395
|
+
cellSize={cellSize}
|
|
396
|
+
displayStyle={displayStyle}
|
|
397
|
+
value={safeValue}
|
|
398
|
+
maxValue={maxValue}
|
|
399
|
+
color={thisColor}
|
|
400
|
+
/>
|
|
401
|
+
</TooltipTrigger>
|
|
402
|
+
<TooltipContent>
|
|
403
|
+
<div className="text-xs">
|
|
404
|
+
<div>
|
|
405
|
+
{dateDisplayFunction
|
|
406
|
+
? dateDisplayFunction(dateForDisplay)
|
|
407
|
+
: dateForDisplay.toDateString()}
|
|
408
|
+
</div>
|
|
409
|
+
<div className="text-muted-foreground">
|
|
410
|
+
{valueDisplayFunction
|
|
411
|
+
? valueDisplayFunction(safeValue)
|
|
412
|
+
: `${safeValue} event${safeValue !== 1 ? "s" : ""}`}
|
|
413
|
+
</div>
|
|
414
|
+
</div>
|
|
415
|
+
</TooltipContent>
|
|
416
|
+
</Tooltip>
|
|
417
|
+
);
|
|
418
|
+
})
|
|
419
|
+
)}
|
|
420
|
+
</TooltipProvider>
|
|
421
|
+
</div>
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function formatLocalDate(date: Date) {
|
|
426
|
+
const y = date.getFullYear();
|
|
427
|
+
const m = String(date.getMonth() + 1).padStart(2, "0");
|
|
428
|
+
const d = String(date.getDate()).padStart(2, "0");
|
|
429
|
+
return `${y}-${m}-${d}`;
|
|
430
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
const MOBILE_BREAKPOINT = 768;
|
|
4
|
+
|
|
5
|
+
export function useIsMobile() {
|
|
6
|
+
const [isMobile, setIsMobile] = React.useState<boolean | undefined>(
|
|
7
|
+
undefined
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
12
|
+
const onChange = () => {
|
|
13
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
14
|
+
};
|
|
15
|
+
mql.addEventListener("change", onChange);
|
|
16
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
17
|
+
return () => mql.removeEventListener("change", onChange);
|
|
18
|
+
}, []);
|
|
19
|
+
|
|
20
|
+
return !!isMobile;
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @liorian/sdk/presentation/8starlabs-ui — legacy experimental components.
|
|
2
|
+
// Prefer the design-system primitives (`@liorian/sdk/presentation/ui`) when possible.
|
|
3
|
+
export * from "./button";
|
|
4
|
+
export * from "./heatmap";
|
|
5
|
+
export * from "./partition-bar";
|
|
6
|
+
export * from "./timeline";
|
|
7
|
+
export * from "./transport-badge";
|
|
8
|
+
export * from "./hooks";
|
|
9
|
+
export * from "./ui";
|
|
10
|
+
|
|
11
|
+
// Default-exported components exposed with explicit names.
|
|
12
|
+
export { default as FlipClock } from "./flip-clock";
|
|
13
|
+
export { default as JsonViewer } from "./json-viewer";
|
|
14
|
+
export { default as Marquee } from "./marquee";
|
|
15
|
+
export { default as ScrollFade } from "./scroll-fade";
|
|
16
|
+
export { default as StatusIndicator } from "./status-indicator";
|
|
17
|
+
export { default as SystemBanner } from "./system-banner";
|
|
18
|
+
export { default as Heatmap } from "./heatmap";
|
|
19
|
+
export { default as PartitionBar } from "./partition-bar";
|
|
20
|
+
export { default as Timeline } from "./timeline";
|