@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,16 @@
|
|
|
1
|
+
import * as LucideIcons from "lucide-react";
|
|
2
|
+
import { LucideProps } from "lucide-react";
|
|
3
|
+
|
|
4
|
+
interface DynamicIconProps extends LucideProps {
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function DynamicIcon({ name, ...props }: DynamicIconProps) {
|
|
9
|
+
const Icon = (LucideIcons as any)[name];
|
|
10
|
+
|
|
11
|
+
if (!Icon) {
|
|
12
|
+
return <LucideIcons.HelpCircleIcon {...props} />;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return <Icon {...props} />;
|
|
16
|
+
}
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { useRef, useState } from "react"
|
|
5
|
+
import {
|
|
6
|
+
CheckCircle2,
|
|
7
|
+
ChevronDown,
|
|
8
|
+
ChevronUp,
|
|
9
|
+
CloudUpload,
|
|
10
|
+
FileText,
|
|
11
|
+
RotateCw,
|
|
12
|
+
Trash2,
|
|
13
|
+
Upload,
|
|
14
|
+
X,
|
|
15
|
+
XCircle,
|
|
16
|
+
} from "lucide-react"
|
|
17
|
+
import { Button } from "../ui/button"
|
|
18
|
+
import { Activity } from "./activity"
|
|
19
|
+
import { Progress } from "../ui/progress"
|
|
20
|
+
import { Badge } from "../ui/badge"
|
|
21
|
+
import { useUploadStore, type UploadItem } from "../../infrastructure/stores/upload.store"
|
|
22
|
+
import { cn } from "../../infrastructure/utilities/utils"
|
|
23
|
+
import { formatBytesPerSecond, formatEta, formatFileSize } from "../../infrastructure/utilities/format.util"
|
|
24
|
+
import type { MediaUploadOptions } from "../../domain/entities/media"
|
|
25
|
+
|
|
26
|
+
function UploadRow({ upload }: { upload: UploadItem }) {
|
|
27
|
+
const removeFile = useUploadStore((state) => state.removeFile)
|
|
28
|
+
const retryFile = useUploadStore((state) => state.retryFile)
|
|
29
|
+
const isUploading = upload.status === "uploading" || upload.status === "idle"
|
|
30
|
+
const isLoading = upload.status === "uploading"
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div
|
|
34
|
+
data-slot="upload-row"
|
|
35
|
+
data-status={upload.status}
|
|
36
|
+
className="flex flex-col gap-1.5 rounded-lg border border-border/60 bg-muted/30 p-2.5"
|
|
37
|
+
>
|
|
38
|
+
<div className="flex items-center gap-2 min-w-0">
|
|
39
|
+
<div className="flex size-8 shrink-0 items-center justify-center rounded-md bg-background ring-1 ring-foreground/10">
|
|
40
|
+
{upload.status === "done" ? (
|
|
41
|
+
<CheckCircle2 className="size-4 text-emerald-500"/>
|
|
42
|
+
) : upload.status === "error" ? (
|
|
43
|
+
<XCircle className="size-4 text-destructive"/>
|
|
44
|
+
) : upload.status === "cancelled" ? (
|
|
45
|
+
<X className="size-4 text-muted-foreground"/>
|
|
46
|
+
) : (
|
|
47
|
+
<FileText className="size-4 text-muted-foreground"/>
|
|
48
|
+
)}
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div className="flex min-w-0 flex-1 flex-col">
|
|
52
|
+
<span className="truncate text-sm font-medium" title={upload.name}>
|
|
53
|
+
{upload.name}
|
|
54
|
+
</span>
|
|
55
|
+
<span className="text-xs text-muted-foreground">
|
|
56
|
+
{formatFileSize(upload.size)}
|
|
57
|
+
{isLoading && upload.speed > 0 && (
|
|
58
|
+
<> · {formatBytesPerSecond(upload.speed)}</>
|
|
59
|
+
)}
|
|
60
|
+
</span>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<div className="flex shrink-0 items-center gap-1">
|
|
64
|
+
{isUploading && (
|
|
65
|
+
<Button
|
|
66
|
+
variant="ghost"
|
|
67
|
+
size="icon-sm"
|
|
68
|
+
onClick={() => removeFile(upload.id)}
|
|
69
|
+
className="text-muted-foreground hover:text-destructive"
|
|
70
|
+
aria-label="Annuler le téléversement"
|
|
71
|
+
>
|
|
72
|
+
<X className="size-4"/>
|
|
73
|
+
</Button>
|
|
74
|
+
)}
|
|
75
|
+
{upload.status === "error" && (
|
|
76
|
+
<Button
|
|
77
|
+
variant="ghost"
|
|
78
|
+
size="icon-sm"
|
|
79
|
+
onClick={() => retryFile(upload.id)}
|
|
80
|
+
aria-label="Réessayer"
|
|
81
|
+
>
|
|
82
|
+
<RotateCw className="size-4"/>
|
|
83
|
+
</Button>
|
|
84
|
+
)}
|
|
85
|
+
{(upload.status === "done" || upload.status === "error" || upload.status === "cancelled") && (
|
|
86
|
+
<Button
|
|
87
|
+
variant="ghost"
|
|
88
|
+
size="icon-sm"
|
|
89
|
+
onClick={() => removeFile(upload.id)}
|
|
90
|
+
aria-label="Retirer le fichier"
|
|
91
|
+
>
|
|
92
|
+
<Trash2 className="size-4"/>
|
|
93
|
+
</Button>
|
|
94
|
+
)}
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
{isLoading ? (
|
|
99
|
+
<div className="flex items-center gap-2">
|
|
100
|
+
<Progress value={upload.progress} className="h-1.5 flex-1"/>
|
|
101
|
+
<span className="w-11 text-right text-xs tabular-nums text-muted-foreground">
|
|
102
|
+
{Math.round(upload.progress)}%
|
|
103
|
+
</span>
|
|
104
|
+
</div>
|
|
105
|
+
) : upload.status === "error" ? (
|
|
106
|
+
<span className="text-xs text-destructive line-clamp-1">{upload.error}</span>
|
|
107
|
+
) : upload.status === "cancelled" ? (
|
|
108
|
+
<span className="text-xs text-muted-foreground">Téléversement annulé</span>
|
|
109
|
+
) : upload.status === "done" ? (
|
|
110
|
+
<span className="text-xs text-emerald-500">Terminé</span>
|
|
111
|
+
) : null}
|
|
112
|
+
|
|
113
|
+
{isLoading && (
|
|
114
|
+
<div className="flex items-center justify-between text-xs text-muted-foreground">
|
|
115
|
+
<span className="flex items-center gap-1">
|
|
116
|
+
<Activity.Loader size={12}/>
|
|
117
|
+
{upload.eta ? formatEta(upload.eta) : "Estimation…"}
|
|
118
|
+
</span>
|
|
119
|
+
<span>{formatFileSize(upload.size - (upload.size * upload.progress) / 100)} restants</span>
|
|
120
|
+
</div>
|
|
121
|
+
)}
|
|
122
|
+
</div>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function UploadPanel({ uploadOptions }: { uploadOptions?: MediaUploadOptions }) {
|
|
127
|
+
const uploads = useUploadStore((state) => state.uploads)
|
|
128
|
+
const collapse = useUploadStore((state) => state.collapse)
|
|
129
|
+
const addFiles = useUploadStore((state) => state.addFiles)
|
|
130
|
+
const clearCompleted = useUploadStore((state) => state.clearCompleted)
|
|
131
|
+
const hasActiveUploads = useUploadStore((state) => state.hasActiveUploads)
|
|
132
|
+
const inputRef = useRef<HTMLInputElement>(null)
|
|
133
|
+
const [isDragOver, setIsDragOver] = useState(false)
|
|
134
|
+
|
|
135
|
+
const overall = uploads.length
|
|
136
|
+
? uploads.reduce((acc, u) => acc + u.progress, 0) / uploads.length
|
|
137
|
+
: 0
|
|
138
|
+
|
|
139
|
+
const handleFiles = (fileList: FileList | File[] | null) => {
|
|
140
|
+
if (!fileList) return
|
|
141
|
+
addFiles(Array.from(fileList), uploadOptions)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const hasCompleted = uploads.some(
|
|
145
|
+
(u) => u.status === "done" || u.status === "error" || u.status === "cancelled"
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<div
|
|
150
|
+
data-slot="upload-panel"
|
|
151
|
+
className="flex w-80 flex-col overflow-hidden rounded-xl border bg-popover text-popover-foreground shadow-lg ring-1 ring-foreground/10"
|
|
152
|
+
onDragOver={(e) => {
|
|
153
|
+
e.preventDefault()
|
|
154
|
+
setIsDragOver(true)
|
|
155
|
+
}}
|
|
156
|
+
onDragLeave={() => setIsDragOver(false)}
|
|
157
|
+
onDrop={(e) => {
|
|
158
|
+
e.preventDefault()
|
|
159
|
+
setIsDragOver(false)
|
|
160
|
+
handleFiles(e.dataTransfer.files)
|
|
161
|
+
}}
|
|
162
|
+
>
|
|
163
|
+
<div className="flex items-center gap-2 border-b px-3 py-2.5">
|
|
164
|
+
<CloudUpload className="size-4 text-primary"/>
|
|
165
|
+
<span className="flex-1 text-sm font-medium">Téléversements</span>
|
|
166
|
+
{hasActiveUploads && (
|
|
167
|
+
<Badge variant="secondary" className="gap-1">
|
|
168
|
+
<Activity.Loader size={12}/>
|
|
169
|
+
En cours
|
|
170
|
+
</Badge>
|
|
171
|
+
)}
|
|
172
|
+
<Button variant="ghost" size="icon-sm" onClick={collapse} aria-label="Réduire">
|
|
173
|
+
<ChevronDown className="size-4"/>
|
|
174
|
+
</Button>
|
|
175
|
+
</div>
|
|
176
|
+
|
|
177
|
+
{hasActiveUploads && (
|
|
178
|
+
<div className="border-b px-3 py-2">
|
|
179
|
+
<div className="mb-1 flex items-center justify-between text-xs text-muted-foreground">
|
|
180
|
+
<span>Progression globale</span>
|
|
181
|
+
<span className="tabular-nums">{Math.round(overall)}%</span>
|
|
182
|
+
</div>
|
|
183
|
+
<Progress value={overall} className="h-1.5"/>
|
|
184
|
+
</div>
|
|
185
|
+
)}
|
|
186
|
+
|
|
187
|
+
<div
|
|
188
|
+
className={cn(
|
|
189
|
+
"flex max-h-80 min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-2.5",
|
|
190
|
+
isDragOver && "bg-primary/5"
|
|
191
|
+
)}
|
|
192
|
+
>
|
|
193
|
+
{uploads.length === 0 ? (
|
|
194
|
+
<div
|
|
195
|
+
className={cn(
|
|
196
|
+
"flex flex-1 flex-col items-center justify-center gap-2 rounded-lg border border-dashed p-6 text-center text-xs text-muted-foreground",
|
|
197
|
+
isDragOver && "border-primary text-primary"
|
|
198
|
+
)}
|
|
199
|
+
>
|
|
200
|
+
<Upload className="size-6"/>
|
|
201
|
+
<span>Glissez-déposez des fichiers ici</span>
|
|
202
|
+
<span>ou</span>
|
|
203
|
+
<Button variant="outline" size="sm" onClick={() => inputRef.current?.click()}>
|
|
204
|
+
Sélectionner des fichiers
|
|
205
|
+
</Button>
|
|
206
|
+
</div>
|
|
207
|
+
) : (
|
|
208
|
+
<>
|
|
209
|
+
{uploads.map((upload) => (
|
|
210
|
+
<UploadRow key={upload.id} upload={upload}/>
|
|
211
|
+
))}
|
|
212
|
+
{isDragOver && (
|
|
213
|
+
<div className="pointer-events-none flex items-center justify-center rounded-lg border-2 border-dashed border-primary p-3 text-xs text-primary">
|
|
214
|
+
Déposez pour téléverser
|
|
215
|
+
</div>
|
|
216
|
+
)}
|
|
217
|
+
</>
|
|
218
|
+
)}
|
|
219
|
+
</div>
|
|
220
|
+
|
|
221
|
+
<div className="flex items-center gap-2 border-t px-3 py-2">
|
|
222
|
+
<input
|
|
223
|
+
ref={inputRef}
|
|
224
|
+
type="file"
|
|
225
|
+
multiple
|
|
226
|
+
className="hidden"
|
|
227
|
+
onChange={(e) => {
|
|
228
|
+
handleFiles(e.target.files)
|
|
229
|
+
e.target.value = ""
|
|
230
|
+
}}
|
|
231
|
+
/>
|
|
232
|
+
<Button variant="outline" size="sm" className="flex-1" onClick={() => inputRef.current?.click()}>
|
|
233
|
+
<Upload className="size-3.5"/>
|
|
234
|
+
Ajouter
|
|
235
|
+
</Button>
|
|
236
|
+
{hasCompleted && (
|
|
237
|
+
<Button variant="ghost" size="sm" onClick={clearCompleted}>
|
|
238
|
+
Vider
|
|
239
|
+
</Button>
|
|
240
|
+
)}
|
|
241
|
+
</div>
|
|
242
|
+
</div>
|
|
243
|
+
)
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export function FloatingUpload({ module, type }: { module?: string; type?: string }) {
|
|
247
|
+
const isExpanded = useUploadStore((state) => state.isExpanded)
|
|
248
|
+
const toggle = useUploadStore((state) => state.toggle)
|
|
249
|
+
const hasActiveUploads = useUploadStore((state) => state.hasActiveUploads)
|
|
250
|
+
const uploads = useUploadStore((state) => state.uploads)
|
|
251
|
+
|
|
252
|
+
React.useEffect(() => {
|
|
253
|
+
if (!hasActiveUploads) return
|
|
254
|
+
const handler = (event: BeforeUnloadEvent) => {
|
|
255
|
+
event.preventDefault()
|
|
256
|
+
event.returnValue = ""
|
|
257
|
+
}
|
|
258
|
+
window.addEventListener("beforeunload", handler)
|
|
259
|
+
return () => window.removeEventListener("beforeunload", handler)
|
|
260
|
+
}, [hasActiveUploads])
|
|
261
|
+
|
|
262
|
+
if (!hasActiveUploads) return null;
|
|
263
|
+
|
|
264
|
+
const activeCount = uploads.filter(
|
|
265
|
+
(u) => u.status === "uploading" || u.status === "idle"
|
|
266
|
+
).length
|
|
267
|
+
|
|
268
|
+
const uploadOptions: MediaUploadOptions | undefined = module
|
|
269
|
+
? { module, type }
|
|
270
|
+
: undefined
|
|
271
|
+
|
|
272
|
+
return (
|
|
273
|
+
<div className="fixed right-4 bottom-4 z-500 flex flex-col items-end gap-2">
|
|
274
|
+
{isExpanded && <UploadPanel uploadOptions={uploadOptions}/>}
|
|
275
|
+
|
|
276
|
+
<Button
|
|
277
|
+
onClick={toggle}
|
|
278
|
+
size="icon-lg"
|
|
279
|
+
className="relative size-12 rounded-full shadow-lg"
|
|
280
|
+
aria-label={isExpanded ? "Réduire les téléversements" : "Ouvrir les téléversements"}
|
|
281
|
+
>
|
|
282
|
+
{isExpanded ? <ChevronUp className="size-5"/> : <Upload className="size-5"/>}
|
|
283
|
+
{!isExpanded && hasActiveUploads && activeCount > 0 && (
|
|
284
|
+
<span className="absolute -top-1 -right-1 flex size-5 items-center justify-center rounded-full bg-destructive text-[10px] font-semibold text-white">
|
|
285
|
+
{activeCount}
|
|
286
|
+
</span>
|
|
287
|
+
)}
|
|
288
|
+
</Button>
|
|
289
|
+
</div>
|
|
290
|
+
)
|
|
291
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// @liorian/sdk/presentation/components — composite domain components.
|
|
2
|
+
export * from "./activity";
|
|
3
|
+
export * from "./activity-actions";
|
|
4
|
+
export * from "./activity-container";
|
|
5
|
+
export * from "./activity-content";
|
|
6
|
+
export * from "./activity-descriptor-parser";
|
|
7
|
+
export * from "./activity-header";
|
|
8
|
+
export * from "./activity-loader";
|
|
9
|
+
export * from "./activity-title";
|
|
10
|
+
export * from "./auth-lock-screen";
|
|
11
|
+
export * from "./auth-session.view";
|
|
12
|
+
export * from "./data-table";
|
|
13
|
+
export * from "./dynamic-icon";
|
|
14
|
+
export * from "./floating-upload";
|
|
15
|
+
export * from "./local-time";
|
|
16
|
+
export * from "./markdown-parser";
|
|
17
|
+
export * from "./message-scroller";
|
|
18
|
+
export * from "./module-first-access-config.view";
|
|
19
|
+
export * from "./module-first-access-pending.view";
|
|
20
|
+
export * from "./module-guard";
|
|
21
|
+
export * from "./modules-first-access.guard";
|
|
22
|
+
export * from "./modules-guard-forbidden";
|
|
23
|
+
export * from "./notification-details.modal";
|
|
24
|
+
export * from "./notification-item";
|
|
25
|
+
export * from "./notifications-popover";
|
|
26
|
+
export * from "./push-notifications.provider";
|
|
27
|
+
export * from "./upload-progress-dialog";
|
|
28
|
+
export * from "./waiting";
|
|
29
|
+
export * from "./waiting-bar";
|
|
30
|
+
export * from "./waiting-section";
|
|
31
|
+
export * from "./auth";
|
|
32
|
+
|
|
33
|
+
// `activity.tsx` re-exports the compound `*Props` types — re-export them explicitly
|
|
34
|
+
// from their owning modules so the ambiguity is resolved here.
|
|
35
|
+
export type { ActivityActionsProps } from "./activity-actions";
|
|
36
|
+
export type { ActivityContainerProps } from "./activity-container";
|
|
37
|
+
export type { ActivityContentProps } from "./activity-content";
|
|
38
|
+
export type { ActivityHeaderProps } from "./activity-header";
|
|
39
|
+
export type { ActivityLoaderProps } from "./activity-loader";
|
|
40
|
+
export type { ActivityTitleProps } from "./activity-title";
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Clock } from "lucide-react";
|
|
5
|
+
import { cn } from "../../infrastructure/utilities/utils";
|
|
6
|
+
import { useIsDesktop, DESKTOP_BREAKPOINT } from "../../infrastructure/hooks/use-is-desktop";
|
|
7
|
+
import { useIsTauri } from "../../infrastructure/hooks/use-is-tauri";
|
|
8
|
+
|
|
9
|
+
export interface LocalTimeProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
10
|
+
/**
|
|
11
|
+
* If true, only displays when the app is in desktop mode AND running in Tauri.
|
|
12
|
+
* Defaults to false (displays in desktop mode whether web or Tauri).
|
|
13
|
+
*/
|
|
14
|
+
tauriOnly?: boolean;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Breakpoint width in pixels to consider desktop mode (large screen).
|
|
18
|
+
* Default: 768px (md breakpoint).
|
|
19
|
+
*/
|
|
20
|
+
breakpoint?: number;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Whether to display seconds in time format.
|
|
24
|
+
* Default: false.
|
|
25
|
+
*/
|
|
26
|
+
showSeconds?: boolean;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Whether to display the clock icon.
|
|
30
|
+
* Default: true.
|
|
31
|
+
*/
|
|
32
|
+
showIcon?: boolean;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Whether to display date alongside the time.
|
|
36
|
+
* Default: false.
|
|
37
|
+
*/
|
|
38
|
+
showDate?: boolean;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Locale used to format date/time (e.g. 'fr-FR', 'en-US').
|
|
42
|
+
* If omitted, system/browser default locale is used.
|
|
43
|
+
*/
|
|
44
|
+
locale?: string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Custom format options for Intl.DateTimeFormat.
|
|
48
|
+
*/
|
|
49
|
+
formatOptions?: Intl.DateTimeFormatOptions;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Custom formatter function.
|
|
53
|
+
*/
|
|
54
|
+
formatTime?: (date: Date) => string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Update interval in milliseconds.
|
|
58
|
+
* Default: 1000ms.
|
|
59
|
+
*/
|
|
60
|
+
intervalMs?: number;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Optional render prop for custom layout or rendering.
|
|
64
|
+
*/
|
|
65
|
+
children?: (data: {
|
|
66
|
+
time: Date;
|
|
67
|
+
formattedTime: string;
|
|
68
|
+
formattedDate?: string;
|
|
69
|
+
isDesktop: boolean;
|
|
70
|
+
isTauri: boolean;
|
|
71
|
+
}) => React.ReactNode;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* LocalTime component displays the local machine time.
|
|
76
|
+
* - By default, it renders only when the application is in desktop mode (large screen).
|
|
77
|
+
* - When `tauriOnly` (or `onlyTauri`) is enabled, it renders only when the app is in desktop mode AND running in Tauri.
|
|
78
|
+
*/
|
|
79
|
+
export function LocalTime({
|
|
80
|
+
tauriOnly = false,
|
|
81
|
+
breakpoint = DESKTOP_BREAKPOINT,
|
|
82
|
+
showSeconds = false,
|
|
83
|
+
showIcon = true,
|
|
84
|
+
showDate = false,
|
|
85
|
+
locale,
|
|
86
|
+
formatOptions,
|
|
87
|
+
formatTime,
|
|
88
|
+
intervalMs = 1000,
|
|
89
|
+
className,
|
|
90
|
+
children,
|
|
91
|
+
...props
|
|
92
|
+
}: LocalTimeProps) {
|
|
93
|
+
const [mounted, setMounted] = React.useState(false);
|
|
94
|
+
const [time, setTime] = React.useState<Date | null>(null);
|
|
95
|
+
const isDesktop = useIsDesktop(breakpoint);
|
|
96
|
+
const isTauri = useIsTauri();
|
|
97
|
+
|
|
98
|
+
const requireTauri = tauriOnly;
|
|
99
|
+
|
|
100
|
+
React.useEffect(() => {
|
|
101
|
+
setMounted(true);
|
|
102
|
+
setTime(new Date());
|
|
103
|
+
|
|
104
|
+
const timer = setInterval(() => {
|
|
105
|
+
setTime(new Date());
|
|
106
|
+
}, intervalMs);
|
|
107
|
+
|
|
108
|
+
return () => clearInterval(timer);
|
|
109
|
+
}, [intervalMs]);
|
|
110
|
+
|
|
111
|
+
// Only render on client, only in desktop mode, and if requireTauri is set, only in Tauri
|
|
112
|
+
if (!mounted || !time || !isDesktop || (requireTauri && !isTauri)) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const defaultTimeOptions: Intl.DateTimeFormatOptions = {
|
|
117
|
+
hour: "2-digit",
|
|
118
|
+
minute: "2-digit",
|
|
119
|
+
...(showSeconds ? { second: "2-digit" } : {}),
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const formattedTime = formatTime
|
|
123
|
+
? formatTime(time)
|
|
124
|
+
: time.toLocaleTimeString(locale, formatOptions || defaultTimeOptions);
|
|
125
|
+
|
|
126
|
+
const formattedDate = showDate
|
|
127
|
+
? time.toLocaleDateString(locale, {
|
|
128
|
+
weekday: "short",
|
|
129
|
+
day: "numeric",
|
|
130
|
+
month: "short",
|
|
131
|
+
})
|
|
132
|
+
: undefined;
|
|
133
|
+
|
|
134
|
+
const fullDateTimeTooltip = time.toLocaleString(locale, {
|
|
135
|
+
dateStyle: "full",
|
|
136
|
+
timeStyle: "medium",
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
if (typeof children === "function") {
|
|
140
|
+
return (
|
|
141
|
+
<>
|
|
142
|
+
{children({
|
|
143
|
+
time,
|
|
144
|
+
formattedTime,
|
|
145
|
+
formattedDate,
|
|
146
|
+
isDesktop,
|
|
147
|
+
isTauri,
|
|
148
|
+
})}
|
|
149
|
+
</>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return (
|
|
154
|
+
<div
|
|
155
|
+
title={fullDateTimeTooltip}
|
|
156
|
+
aria-label={`Heure locale: ${formattedTime}`}
|
|
157
|
+
className={cn(
|
|
158
|
+
"hidden md:inline-flex items-center gap-1.5 px-0 py-1 text-sm font-medium text-muted-foreground select-none rounded-md hover:text-foreground transition-colors",
|
|
159
|
+
className
|
|
160
|
+
)}
|
|
161
|
+
{...props}
|
|
162
|
+
>
|
|
163
|
+
{showIcon && <Clock className="size-3.5 shrink-0 opacity-70" aria-hidden="true" />}
|
|
164
|
+
{formattedDate && <span className="opacity-80">{formattedDate}</span>}
|
|
165
|
+
<time dateTime={time.toISOString()} className="tabular-nums">
|
|
166
|
+
{formattedTime}
|
|
167
|
+
</time>
|
|
168
|
+
</div>
|
|
169
|
+
);
|
|
170
|
+
}
|